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 |
|---|---|---|---|---|---|
# Copyright 2017 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... | rabipanda/tensorflow | tensorflow/contrib/receptive_field/python/util/receptive_field_test.py | Python | apache-2.0 | 17,992 |
"""
Grab images from OMERO based on Screen data
"""
import csv
import multiprocessing
import progressbar
import signal
import sys
import time
import requests
import json
import getpass
from argparse import ArgumentParser
from collections import OrderedDict
from omeroidr.images import Images
import omeroidr.connect as ... | zegami/omero-idr-fetch | fetch_omero_images.py | Python | mit | 2,750 |
from .utils.dataIO import fileIO
from .utils import checks
from __main__ import send_cmd_help
from __main__ import settings as bot_settings
# Sys.
import discord
from discord.ext import commands
from operator import itemgetter, attrgetter
from copy import deepcopy
import random
import os
import sys
import time
import l... | jonyroda97/redbot-amigosprovaveis | data/downloader/cogs/fourinarow/fourinarow.py | Python | gpl-3.0 | 92,138 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | jarped/QGIS | python/plugins/db_manager/db_plugins/plugin.py | Python | gpl-2.0 | 44,273 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-faq-views',
version='0.1',... | donnywdavis/Django-faq-views | setup.py | Python | bsd-3-clause | 1,185 |
'''Describe a theta of nlg(n) time algorithm that, given a set S of n integers and another
integer x, determines whether or not there exist two elements in S whose sum is
exactly x.
'''
def set_check(S, x):
return [[i, j] for i in S for j in S if i+j==x]
S = [1, 2, 3, 4, 5, 6, 7, 8 ,9 ,0, 1, 2, 3, 4, 5, 6, 7, ... | neale/CS-program | 325-Algorithms/algorithms/set_check.py | Python | unlicense | 350 |
# -*- coding: utf-8 -*-
import copy
import inspect
from rest_framework import permissions
class BaseComposedPermission(permissions.BasePermission):
"""
Base class for compose permission with permission
components and logical operators.
This class should have permission_set defined as
a instanc... | pombredanne/djangorestframework-composed-permissions | restfw_composed_permissions/base.py | Python | bsd-3-clause | 5,369 |
"""
module level docstring
is not included
"""
# this line is not code
# `tty` was chosen for stability over python versions (so we don't get diffrent results
# on different computers, that has different versions of Python).
#
# According to https://github.com/python/cpython/tree/master/Lib (at 2021-04-23) `tty`
# wa... | github/codeql | python/ql/test/query-tests/Summary/my_file.py | Python | mit | 632 |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = '42babe56'.decode('hex')
P2P_PORT = 13333
ADDRESS_VERSION = 0
RPC_PORT = 13332
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'terracoinaddress' in (y... | alexandrcoin/p2pooldoge-all | p2pool/bitcoin/networks/terracoin.py | Python | gpl-3.0 | 1,155 |
# 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... | dhuang/incubator-airflow | tests/kubernetes/test_pod_generator.py | Python | apache-2.0 | 28,695 |
"""
Tests of neo.io.neuroexplorerio
"""
import unittest
from neo.io import NeuroExplorerIO
from neo.test.iotest.common_io_test import BaseTestIO
class TestNeuroExplorerIO(BaseTestIO, unittest.TestCase, ):
ioclass = NeuroExplorerIO
entities_to_download = [
'neuroexplorer'
]
entities_to_downloa... | samuelgarcia/python-neo | neo/test/iotest/test_neuroexplorerio.py | Python | bsd-3-clause | 1,260 |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lic... | openweave/openweave-core | src/test-apps/happy/lib/WeaveTest.py | Python | apache-2.0 | 10,025 |
'''
Created on May 11, 2009
@author: george
'''
import unittest
class Test(unittest.TestCase):
def testName(self):
self.assertTrue(False)
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main()
| Alwnikrotikz/rebuildingtogethercaptain | gaeunit/test/Test.py | Python | apache-2.0 | 252 |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2016 Indiana University
#
# This file is part of AEGeAn (http://github.com/BrendelGroup/AEGeAn) and is
# licensed under the ISC license: see LICENSE.
# ----------------------------------------------... | BrendelGroup/AEGeAn | LocusPocus/LocusPocus/tair.py | Python | isc | 8,329 |
#!/usr/bin/env python
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri <johnp@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License a... | nzjrs/pygobject | demos/gtk-demo/demos/builder.py | Python | lgpl-2.1 | 1,919 |
"""The Distribution template."""
from equadratures.distributions.recurrence_utils import custom_recurrence_coefficients
import numpy as np
PDF_SAMPLES = 500000
class Distribution(object):
"""
The class defines a Distribution object. It serves as a template for all distributions.
:param double lower:
... | psesh/Effective-Quadratures | equadratures/distributions/template.py | Python | mit | 2,985 |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
# Thanks to Jonas Kjellström and Cody Boisclair for their help in finding bugs in this script!
import re
import os
import sys
import tempfile
from fontTools.ttLib import TTFont, newTable
from fontTools.ttLib.xmlImport import importXML
doc = """USAGE: python /path/to/i... | ifeegoo/ifeegoo-programming-fonts-collections | Input/Input-Font/Scripts/inputCustomize.py | Python | apache-2.0 | 9,784 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/body_part.py | Python | mit | 7,433 |
"""
Extra HTML Widget classes
"""
from __future__ import unicode_literals
import datetime
import re
from django.conf import settings
from django.forms.widgets import Select, Widget
from django.utils import datetime_safe, six
from django.utils.dates import MONTHS
from django.utils.encoding import force_str... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/forms/extras/widgets.py | Python | mit | 5,447 |
#!/usr/bin/python
# Author: Jared Sanson <jared@jared.geek.nz>
#
# A very basic collection & upload script for pyMATE,
# designed for resource-constrained systems
# (My particular system barely has enough flash space to fit Python!)
#
from pymate.matenet import MateNET, MateDevice, MateMXDevice, MateFXDevice, MateDCD... | jorticus/pymate | examples/srv1/collector.py | Python | gpl-2.0 | 6,663 |
# 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.
"""Finds android browsers that can be controlled by telemetry."""
import logging
import os
import sys
from telemetry.core import exceptions
from telemetry.... | js0701/chromium-crosswalk | tools/telemetry/telemetry/internal/backends/chrome/android_browser_finder.py | Python | bsd-3-clause | 8,415 |
from flask import Blueprint
from flask import request, current_app as app
import json
from flask.ext.discoverer import advertise
bp = Blueprint('bumblebee', __name__)
@advertise(scopes=[], rate_limit = [100, 3600*24])
@bp.route('/configuration', methods=['GET'])
@bp.route('/configuration/<key>', methods=['GET'])
de... | romanchyla/myads | myads_service/views/bumblebee.py | Python | gpl-2.0 | 808 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import warnings
from typing import Optional, Union
import numpy as np
import pandas as pd
import pydaymet.pet as daypet
import typic
from solarpy import declination
from tstoolbox import tsutils
from tstoolbox.tstoolbox import r... | timcera/mettoolbox | src/mettoolbox/pet.py | Python | bsd-3-clause | 13,283 |
from turtle import *
fillcolor("red")
begin_fill()
while True:
forward(200)
right(144)
if abs(pos()) < 1:
break
end_fill() | eatmore/python_learning | 五角星.py | Python | mit | 142 |
from .support import argparse # see support/__init__.py docstring
# DEPRECATED - remove after requiring py 3.4
from binascii import hexlify
from datetime import datetime
from operator import attrgetter
import functools
import inspect
import io
import os
import signal
import stat
import ... | level323/borg | borg/archiver.py | Python | bsd-3-clause | 51,719 |
from collections import defaultdict
from Tkinter import *
import math
VERTEX_MODE = 0
DRAG_MODE = 1
EDGE_MODE = 2
class Pygraph(object):
def __init__(self, width=500, height=250, diam=25):
self.master = Tk()
self.make_toolbar()
self.canvas = Canvas(self.master, width=width, height=height)... | brandoncazander/pygraphs | pygraphs/main.py | Python | mit | 5,083 |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2018 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""script to write M&C records to a CSV file
"""
from astropy.time import Time, TimeDelta
from hera_mc import mc, cm_utils
valid_tables = {
"hera_obs": {"method": "get... | HERA-Team/hera_mc | scripts/write_records_to_file.py | Python | bsd-2-clause | 6,355 |
#
# Paasmaker - Platform as a Service
#
# 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 time
import paasmaker
from base import BasePeriodic, BasePeriodicTest
... | kaze/paasmaker | paasmaker/common/periodic/jobs.py | Python | mpl-2.0 | 4,126 |
from django.contrib import admin
from players.models import Player
class PlayerAdmin(admin.ModelAdmin):
pass
admin.site.register(Player, PlayerAdmin)
| rymcimcim/django-foosball | players/admin.py | Python | mit | 158 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
class ConversationGroup(object):
date = ""
conversations = []
def __init__(self, conversations):
super(ConversationGroup, self).__init__()
self.conversations = conversations
self.date = conversations[-1].date
def... | arruda/presente_14 | presente_14/chat_parser/chat_objects.py | Python | mit | 918 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
@api.model_create_multi
def create(self, vals_list):
records = super(StockMoveLine, self).create(vals_li... | ygol/odoo | addons/mrp_subcontracting/models/stock_move_line.py | Python | agpl-3.0 | 1,039 |
#! /bin/usr/env python
# Barry's super-lazy png2chr converter. Takes an PNG file and makes an NES
# pattern table (exactly $2000 bytes). It uses the RED of each pixel to decide
# the palette pixel to use.
# Usage: ./png2chr.py <png> <chr>
import png
import sys
chrfile = sys.argv[2]
pngfile = sys.argv[1]
# Generate... | isharacomix/8bitmooc | utils/png2chr.py | Python | gpl-3.0 | 2,031 |
import time
NUM_RECORDS = 50* 1000 * 444
class PyMemTrade():
def __init__(self, tradeId, clientId, venueId, instrumentCode, price, quantity, side):
self.tradeId = tradeId
self.clientId = clientId
self.venueId = venueId
self.instrumentCode = instrumentCode
self.price = price
... | logicchains/ArrayAccessBench | Py2.py | Python | bsd-2-clause | 1,380 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/google-ctf | 2019/finals/web-gphotos-finals/app/gallery/apps.py | Python | apache-2.0 | 694 |
# -*- coding: utf-8 -*-
#
# django-auth-ldap documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 23 18:06:43 2009.
#
# 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... | DheerendraRathor/django-auth-ldap-ng | docs/source/conf.py | Python | bsd-2-clause | 6,783 |
from .settings import * # noqa
MINIFIED_MEDIA = False
DATASTORE = 'sqlite:///$project_name.sqlite'
CACHE_SERVER = 'redis://127.0.0.1:6379/3'
CACHE_DEFAULT_TIMEOUT = 5
| quantmind/lux | lux/core/commands/project_template/project_name/config.py | Python | bsd-3-clause | 173 |
import json
import os
import logging
from checkQC.parsers.parser import Parser
from checkQC.exceptions import StatsJsonNotFound, ConfigurationError
log = logging.getLogger(__name__)
class StatsJsonParser(Parser):
"""
The StatsJsonParser reads the values from the Illumina Stats.json file (which is created b... | monikaBrandt/checkQC | checkQC/parsers/stats_json_parser.py | Python | gpl-3.0 | 3,189 |
# interfaces.py
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Michael Bayer
# mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
Semi-private module containing various base classes used throughout the ORM.... | dbbhattacharya/kitsune | vendor/packages/sqlalchemy/lib/sqlalchemy/orm/interfaces.py | Python | bsd-3-clause | 38,644 |
import pymysql.cursors
connection = pymysql.connect(host="127.0.0.1", database="addressbook",
user="root", password="")
try:
cursor = connection.cursor()
cursor.execute("select * from group_list")
for row in cursor.fetchall():
print(row)
finally:
connection... | eugene-petrash/address_book | check_db_connection.py | Python | apache-2.0 | 329 |
import mock
import csv
import furl
import pytz
import pytest
from datetime import datetime, timedelta
from nose import tools as nt
from django.test import RequestFactory
from django.http import Http404
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import timezone
from django.core.urlr... | chrisseto/osf.io | admin_tests/users/test_views.py | Python | apache-2.0 | 27,220 |
import sys
import praw
import unicodedata
user_agent='bloppit_app'
if len(sys.argv) == 2:
script, filename, subreddit = argv
else:
subreddit = "opensource"
filename = subreddit + ".txt"
r = praw.Reddit(user_agent)
submissions = r.get_subreddit(subreddit).get_hot(limit=100)
target = open(filename, 'w')
for x in... | asears/bloppit | gethot.py | Python | mit | 547 |
#!/usr/bin/env python
import os
import subprocess
import pandas as pd
import time
import sys
from configobj import ConfigObj
import logging
# need to reverse these loops; INITGRID FIRST then ensemble loop. That way garantee at least some complete ensembles, otherwise need wait till all ensemble memebers are done to ge... | joelfiddes/topoMAPP | ensembleRun.py | Python | mit | 3,460 |
# Copyright 2016 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 ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/ml/jobs/submit/__init__.py | Python | apache-2.0 | 751 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2016 GEM Foundation
#
# OpenQuake 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 Licen... | vup1120/oq-hazardlib | openquake/hazardlib/gsim/abrahamson_2015.py | Python | agpl-3.0 | 17,998 |
from django.conf.urls import patterns, include, url
from rest_framework import routers
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from quickstart import views
admin.autodiscover()
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'g... | M-Carter/zettaknight | zettaknight_api/urls.py | Python | gpl-3.0 | 1,229 |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.ndimage import map_coordinates
from dipy.viz.colormap import line_colors
# Conditional import machinery for vtk
from dipy.utils.optpkg import optional_package
# import vtk
# Allow import, but disable doctests if we don't ... | StongeEtienne/dipy | dipy/viz/utils.py | Python | bsd-3-clause | 7,548 |
from theano import tensor as T, printing
import theano
import numpy
from mlp import HiddenLayer
from logistic_sgd_lazy import LogisticRegression
from DocEmbeddingNNOneDoc import DocEmbeddingNNOneDoc
# from DocEmbeddingNNPadding import DocEmbeddingNN
from knoweagebleClassifyFlattenedLazy import CorpusReader
import cPick... | jiafeimaowudi/KnowlegeableCNN | structureTestOnMonster2ShareHighLevelOneDocTest.py | Python | gpl-2.0 | 5,873 |
# 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 the Li... | bswartz/manila | manila/db/migrations/alembic/versions/e9f79621d83f_add_cast_rules_to_readonly_to_share_instances.py | Python | apache-2.0 | 3,557 |
from asposepdf import Settings
from com.aspose.pdf import Document
from com.aspose.pdf import TextAbsorber
from java.io import FileWriter
from java.io import File
class ExtractTextFromAllPages:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithText/ExtractTextFromAllPages... | aspose-pdf/Aspose.Pdf-for-Java | Plugins/Aspose-Pdf-Java-for-Jython/asposepdf/WorkingWithText/ExtractTextFromAllPages.py | Python | mit | 1,396 |
"""Project-wide shared test fixtures."""
import os
import pytest
IF_DUMMY_SPARK = 'DUMMY_SPARK' in os.environ
@pytest.fixture(scope='session', autouse=True)
def spark_ctx():
"""A simple spark context."""
if IF_DUMMY_SPARK:
from dummy_spark import SparkConf, SparkContext
conf = SparkConf()
... | tschijnmo/drudge | tests/conftest.py | Python | mit | 847 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-12-18 13:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback', '0011_auto_20170411_1508'),
]
operations = [
migrations.AddField... | wearespindle/flindt | backend/flindt/feedback/migrations/0012_feedback_skipped_feedback_reason.py | Python | agpl-3.0 | 477 |
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime
from mpl_toolkits.mplot3d import Axes3D
import scipy.optimize
import functools
from scipy.interpolate import interp1d
from matplotlib.lines import Line2D
from collections import Counter
#from pymongo import MongoClient
t... | vrooje/gzcandels_datapaper | plotting/plot_consistency.py | Python | mit | 12,936 |
import argparse
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
import time
import socket
import os
import os.path
from pathlib import Path
def clean(file):
try:
... | groupe-sii/ogham | .tools/showcase-recorder/showcase-launcher/play_showcase.py | Python | apache-2.0 | 2,008 |
# encoding: utf-8
from . import AppRemoveMigration
class Migration(AppRemoveMigration):
app_name = 'social_auth'
tables = [
'social_auth_association',
'social_auth_nonce',
'social_auth_usersocialauth',
]
| patricmutwiri/pombola | pombola/core/migrations/0050_del_social_auth.py | Python | agpl-3.0 | 243 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | angdraug/nova | nova/tests/api/openstack/compute/contrib/test_block_device_mapping.py | Python | apache-2.0 | 13,335 |
"""Brain Requirement Just A Formality. Copyright 2011 by J.
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.
"""
import os
fr... | ikn/brjaf | brjaf/menu.py | Python | gpl-3.0 | 63,135 |
#!/usr/bin/env python
from mongoengine import *
from flask_login import UserMixin
from random import randint, random, Random
import time, hashlib, datetime
from utils import get_hexdigest
righthand = '23456qwertasdfgzxcvbQWERTASDFGZXCVB'
lefthand = '789yuiophjknmYUIPHJKLNM'
allchars = righthand + lefthand
def gene... | manasgarg/flask-sauth | flask_sauth/models.py | Python | bsd-3-clause | 4,459 |
from comics.aggregator.crawler import CrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "White Ninja"
language = "en"
url = "http://www.whiteninjacomics.com/"
start_date = "2002-01-01"
end_date = "2012-08-04"
active = False
rights = "Scott ... | jodal/comics | comics/comics/whiteninja.py | Python | agpl-3.0 | 443 |
# Copyright 2018 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Stock Picking Procure Method',
'summary': 'Allows to force the procurement method from the picking',
'version': '12.0.1.0.0',
'category': 'Warehouse',
'author': 'Tecnativa,'
... | Vauxoo/stock-logistics-warehouse | stock_picking_procure_method/__manifest__.py | Python | agpl-3.0 | 587 |
from patients.models import Patient, Next_of_Kin, Vitals, Visits, Diagnosis, Medication, History, Documents
from django import forms
class PatientForm(forms.ModelForm):
class Meta:
model = Patient
class Next_of_KinForm(forms.ModelForm):
class Meta:
model = Next_of_Kin
class VitalsForm(form... | ianjuma/usiu-app-dir | benchcare/patients/forms.py | Python | gpl-2.0 | 775 |
#! /usr/bin/python2.7
# 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 distributed in... | lvgilmore/Luke | Luke/MongoClient/MBareMetalList.py | Python | gpl-3.0 | 1,295 |
# Core
class InvalidBDUSSException(Exception):
pass
class InvalidBar(Exception):
pass
class LoginFailure(Exception):
def __init__(self, code, message):
self.code = code
self.message = message
class InvalidPassword(LoginFailure):
pass
class InvalidCaptcha(LoginFailure):
pass... | abrasumente233/mpsign | mpsign/exceptions.py | Python | mit | 547 |
# Copyright 2012 Canonical Ltd.
#
# 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 writi... | bigswitch/horizon | openstack_dashboard/test/api_tests/ceilometer_tests.py | Python | apache-2.0 | 14,717 |
"""
:mod:`zsl.interface.gearman.task_filler`
----------------------------------------
.. moduleauthor:: Martin Babka
"""
from __future__ import print_function, unicode_literals
import json
from zsl import Config, Injected, inject
from zsl.gearman import gearman
@inject(config=Config)
def exec_task_filler(task_path... | AtteqCom/zsl | src/zsl/interface/gearman/task_filler.py | Python | mit | 971 |
__author__ = 'Sanket'
import re
from nltk.corpus import stopwords
import json
import sys
from sklearn.metrics import mean_squared_error
reload(sys)
sys.setdefaultencoding('utf8')
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.svm ... | akshaykamath/ReviewPredictionYelp | PosNeg.py | Python | mit | 4,764 |
import unittest
from PyFoam.Applications.CommonTemplateFormat import CommonTemplateFormat
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Applications/test_CommonTemplateFormat.py | Python | gpl-2.0 | 122 |
"""
Support for Homematic devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/homematic/
"""
import os
import time
import logging
from datetime import timedelta
from functools import partial
import voluptuous as vol
import homeassistant.helpers.co... | kyvinh/home-assistant | homeassistant/components/homematic.py | Python | apache-2.0 | 29,352 |
#!/usr/bin/env python3
"""https://www.graphviz.org/Gallery/gradient/angles.html"""
import graphviz
g = graphviz.Digraph('G', filename='angles.gv')
g.attr(bgcolor='blue')
with g.subgraph(name='cluster_1') as c:
c.attr(fontcolor='white')
c.attr('node', shape='circle', style='filled', fillcolor='white:black',
... | xflr6/graphviz | examples/angles.py | Python | mit | 1,129 |
# config
#configure our database
class Configuration(object):
DATABASE = {
'name': 'sylvanian',
'engine': 'peewee.MySQLDatabase',
'user': 'sylvanian',
'passwd': '68zL7VeS0W',
}
DEBUG = True
SECRET_KEY = 'ssshhhh'
| filiperodriguez/sylvanian | sylvanian_family/config.py | Python | mit | 262 |
# code adapted from lasagne tutorial
# http://lasagne.readthedocs.org/en/latest/user/tutorial.html
import time
import os
from itertools import product
import numpy as np
from sklearn.cross_validation import KFold
import theano
from theano import tensor as T
import lasagne
from params import nnet_params_dict, feats_tra... | rafaelvalle/MDI | nnet_lasagne.py | Python | mit | 10,609 |
#!/usr/bin/env python
"""
Abstract: Filter biom file on both 'sample' and 'observation' axes, given a list of
sampleIDs to retain.
Author: Akshay Paropkari
Date: 02/15/2016
"""
import sys
import argparse
from phylotoast import util
importerrors = []
try:
import biom
from biom.util import biom_open as ... | akshayparopkari/phylotoast | bin/filter_biom.py | Python | mit | 3,395 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/client/configuration/scag_dm/base/jurisdiction_boundary.py | Python | gpl-3.0 | 1,720 |
import xmlrpclib
from socket import gaierror
VERSION_OK = "0.5.6"
try:
pypi = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
VERSION_OK = pypi.package_releases('ricecooker')[0]
except gaierror:
pass
VERSION_OK_MESSAGE = "Ricecooker v{} is up-to-date."
VERSION_SOFT_WARNING = "0.5.6"
VERSION_SOFT_WARNING_MES... | aronasorman/content-curation | contentcuration/contentcuration/ricecooker_versions.py | Python | mit | 780 |
"""Authentication unit tests."""
import pytest
from .models import DoshUser
@pytest.mark.django_db
def test_creating_a_user():
"""Test creating standard users."""
assert DoshUser.objects.count() == 0
# Create users with all required arguments
user = DoshUser.objects.create_user(email='test-user@exa... | danielward/dosh | dosh/authentication/tests.py | Python | gpl-3.0 | 1,912 |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# Author: Federico Ceratto <federico.ceratto@hpe.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | openstack/designate | designate/tests/unit/agent/backends/test_knot2.py | Python | apache-2.0 | 7,785 |
# encoding: UTF-8
"""
无人值守运行服务
"""
from __future__ import print_function
from time import sleep
from datetime import datetime, time
from multiprocessing import Process
import webbrowser
from webServer import run as runWebServer
from tradingServer import main as runTradingServer
from vnpy.trader.vtEngine import LogE... | rrrrrr8/vnpy | examples/WebTrader/run.py | Python | mit | 1,854 |
__author__ = 'Călin Sălăgean'
from events.models.event import Event
from events.repositories.event import EventRepository
from events.repositories.person_event import PersonEventRepository
from events.repositories.person import PersonRepository
class EventController():
def __init__(self):
'''
Even... | dooma/Events | events/controllers/event.py | Python | mit | 6,395 |
import sys
sys.path.append ("../lib")
import lib.pwm as pwm
import common
import time
import numpy
# First motor makes the angle negative when goes up
angle_to_level = 'p'
#angle_to_level = 'r'
motors_angle = {'p':[13,15], 'r':[14,12]}
motors = motors_angle[angle_to_level]
SKIP = False
def angle_to_key (angle):
... | Daniel-Brosnan-Blazquez/DIT-100 | actuators/level_trapezoidal.py | Python | gpl-3.0 | 14,988 |
# ******************************************************************************
# Copyright 2014-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | NervanaSystems/neon | neon/backends/winograd_conv.py | Python | apache-2.0 | 77,634 |
#!/usr/bin/env python
import os, sys
import re
import io
import subprocess
import numpy as np
try:
import http.client as httpcl
except ImportError:
import httplib as httpcl
from ugali.utils.logger import logger
from ugali.utils.shell import mkdir
DATABASES = {
'sdss':['dr10'],
'des' :['sva1','sva1... | DarkEnergySurvey/ugali | ugali/preprocess/database.py | Python | mit | 20,242 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20150503_2026'),
]
operations = [
migrations.AddField(
model_name='membership',
name='membership_type',
field=models.IntegerField(choi... | manhhomienbienthuy/pythondotorg | users/migrations/0004_auto_20150503_2100.py | Python | apache-2.0 | 776 |
# Copyright 2020 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, ... | google/gae-secure-scaffold-python3 | src/securescaffold/factory.py | Python | apache-2.0 | 3,574 |
from .usuario import RepositorioUsuarioEmMemoria
from .recurso import RepositorioRecursoEmMemoria
| ESEGroup/Paraguai | repositorios_memoria/__init__.py | Python | apache-2.0 | 98 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint, getdate, now
from erpnext.stock.utils import update_included_uom_in_report
from e... | ovresko/erpnext | erpnext/stock/report/stock_balance/stock_balance.py | Python | gpl-3.0 | 10,303 |
import unittest
from requests.exceptions import HTTPError
import lodstats
from lodstats import RDFStats
from requests import HTTPError
from . import helpers
http_base = helpers.webserver(helpers.resources_path)
testfile_path = helpers.resources_path
class LodstatsTest(unittest.TestCase):
def setUp(self):
... | AKSW/LODStats | test/test_lodstats.py | Python | gpl-3.0 | 1,647 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia_ | Sketches/MPS/Old/Grey/greylisting.py | Python | apache-2.0 | 20,998 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/identity/groups/tables.py | Python | apache-2.0 | 8,448 |
import os
import urllib.parse
import pytest
from pytest_girder.assertions import assertStatus, assertStatusOk
from pytest_girder.utils import getResponseBody
from girder.api import access
from girder.api.describe import Description, describeRoute
from girder.api.rest import boundHandler, rawResponse, Resource, setRes... | Kitware/girder | test/test_custom_root.py | Python | apache-2.0 | 4,177 |
# -*- coding: koi8-r -*-
import unittest
from test.support import TESTFN, unlink, unload, rmtree
import importlib
import os
import sys
import subprocess
class SourceEncodingTest(unittest.TestCase):
def test_pep263(self):
self.assertEqual(
"ðÉÔÏÎ".encode("utf-8"),
b'\xd0\x9f\xd0\xb... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_source_encoding.py | Python | gpl-3.0 | 5,265 |
from django.db import models
# Create your models here.
class App(models.Model):
calculationPeriod = models.IntegerField()
currentCity = models.CharField(max_length = 60)
periodCounter = models.IntegerField()
calculationCheck = models.BooleanField()
def getCR(self):
return self.objects... | CriminalProject/Project2 | app/models.py | Python | unlicense | 888 |
from pandas.io.excel._base import ExcelFile, ExcelWriter, read_excel
from pandas.io.excel._openpyxl import _OpenpyxlWriter
from pandas.io.excel._util import register_writer
from pandas.io.excel._xlsxwriter import _XlsxWriter
from pandas.io.excel._xlwt import _XlwtWriter
__all__ = ["read_excel", "ExcelWriter", "ExcelFi... | toobaz/pandas | pandas/io/excel/__init__.py | Python | bsd-3-clause | 422 |
from decimal import Decimal, getcontext
from Pylinear.vector import Vector
getcontext().prec = 30
class Plane(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, normal_vector=None, constant_term=None):
self.dimension = 3
if not normal_vector:
all_zeros = [0]*self.dimensi... | MaxPoon/Pylinear | Pylinear/plane.py | Python | mit | 3,013 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-31 06:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classroom', '0001_initial'),
]
operations = [
migrations.AlterField(
... | shmish/core-assess | classroom/migrations/0002_auto_20170730_2338.py | Python | mpl-2.0 | 436 |
"""Initial migrations.
Revision ID: 159b60132535
Revises:
Create Date: 2015-12-04 21:53:17.278656
"""
# revision identifiers, used by Alembic.
revision = '159b60132535'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto ... | kushaldas/autocloud | alembic/versions/159b60132535_initial_migrations.py | Python | agpl-3.0 | 1,031 |
# Copyright 2008-2010 ITA Software, 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 or agreed to ... | marineam/nagcat | python/nagcat/plugins/filter_table.py | Python | apache-2.0 | 4,181 |
"""
Support for converting a django user to an XBlock user
"""
from __future__ import absolute_import
from django.contrib.auth.models import User
from opaque_keys.edx.keys import CourseKey
from xblock.reference.user_service import UserService, XBlockUser
from openedx.core.djangoapps.user_api.preferences.api import ge... | ESOedX/edx-platform | common/djangoapps/xblock_django/user_service.py | Python | agpl-3.0 | 3,420 |
#!/usr/bin/env python
import sys
import os
import math
# ensure that the kicad-footprint-generator directory is available
#sys.path.append(os.environ.get('KIFOOTPRINTGENERATOR')) # enable package import from parent directory
#sys.path.append("D:\hardware\KiCAD\kicad-footprint-generator") # enable package im... | pointhi/kicad-footprint-generator | scripts/tools/footprint_scripts_resistorlike.py | Python | gpl-3.0 | 49,900 |
def greeting(Name):
"This function greets to person with Name." # Docs
return "Hello " + Name
print greeting("John")
def plus(x, y):
# x variable won't change outside the function because of immutability
x += 4
y = 8
print "Inside x:", x
print "Inside y:", y # will be 8, reference is b... | getsadzeg/python-codes | src/functions.py | Python | mit | 602 |
import unittest
from pprint import pprint
from bs4 import BeautifulSoup
from app.start import create_app
class TestAcceptance(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
with open('./tests/resources/styleguide.html', 'r', encoding='UTF-8') as file:
c... | otto-de/jellyfish | tests/test_styleguide.py | Python | apache-2.0 | 1,027 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | larryhynes/qutebrowser | scripts/run_profile.py | Python | gpl-3.0 | 1,728 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.