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 hlt import *
from networking import *
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import SGD, Adam, RMSprop
from os import listdir, remove
from os.path import join, isfile
def loadGame(filename):
def stringUntil(gameFile, endChar):
returnStrin... | yangle/HaliteIO | website/tutorials/machinelearning/TrainMatt.py | Python | mit | 4,981 |
tw = 32
th = 44
class Sprite(object):
def __init__(self, posX, posY):
self.x = posX
self.y = posY
self.dir = 1
self.dx = 0
self.dy = 0
def checkCollision(self, otherSprite):
if (self.x < otherSprite.x + tw and otherSprite.x < self.x + tw
and se... | kantel/processingpy | sketches/xmaspingus01/sprite3.py | Python | mit | 1,934 |
"""
This module provides solvers for the unitary Schrodinger equation.
"""
__all__ = ['sesolve']
import os
import types
import numpy as np
import scipy.integrate
from scipy.linalg import norm as la_norm
from qutip.cy.stochastic import normalize_inplace
import qutip.settings as qset
from qutip.qobj import Qobj
from qu... | cgranade/qutip | qutip/sesolve.py | Python | bsd-3-clause | 13,471 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint, _
from webnotes.utils import cint,cstr
class DocType:
def __init__(self, d, ... | gangadhar-kadam/powapp | selling/doctype/device_group/device_group.py | Python | agpl-3.0 | 1,071 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import plant
from . import customer
from . import order | tde-banana-odoo/odoo_plants | plant_nursery/models/__init__.py | Python | mit | 162 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 DAVY Guillaume
# 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 notice, this
#... | vlegoff/tsunami | src/secondaires/jeux/commandes/__init__.py | Python | bsd-3-clause | 1,644 |
import pytest
from django.db import IntegrityError
from django.utils import timezone
from django.contrib.auth.models import User
from wheelcms_axle.node import Node, NodeInUse
from wheelcms_axle.content import Content, ContentCopyFailed
from wheelcms_axle.content import ContentCopyNotSupported
from wheelcms_axle.test... | wheelcms/wheelcms_axle | wheelcms_axle/tests/test_content.py | Python | bsd-2-clause | 11,926 |
# -*- 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 field 'QuestionModule.description'
db.add_column(u'survey_questionmodule', 'description',
... | antsmc2/mics | survey/migrations/0086_auto__add_field_questionmodule_description.py | Python | bsd-3-clause | 28,789 |
import base64
from ..storage import UserMixin, NonceMixin, AssociationMixin, \
CodeMixin, PartialMixin, BaseStorage
class BaseModel(object):
@classmethod
def next_id(cls):
cls.NEXT_ID += 1
return cls.NEXT_ID - 1
@classmethod
def get(cls, key):
return cls... | tobias47n9e/social-core | social_core/tests/models.py | Python | bsd-3-clause | 6,016 |
import dicom
import os
import sys
def get_path_dictlist(path):
files = os.listdir(path)
dict_list = []
for f in files:
if os.path.isdir(path + '/' + f):
dict_list.append(f)
return dict_list
while True:
path = input("Path:")
dict_list = get_path_dictlist(path)
dcm_1 ... | Wujiao233/dicom_tools | rename_path.py | Python | mit | 779 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | mgx2/python-nvd3 | examples/discreteBarChart.py | Python | mit | 899 |
"""Stuff that differs in different Python versions"""
import os
import imp
import sys
import site
__all__ = ['WindowsError']
uses_pycache = hasattr(imp, 'cache_from_source')
class NeverUsedException(Exception):
"""this exception should never be raised"""
try:
WindowsError = WindowsError
except NameError:
... | ktan2020/legacy-automation | win/Lib/site-packages/pip-1.3.1-py2.7.egg/pip/backwardcompat/__init__.py | Python | mit | 3,519 |
#
# 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... | DinoCow/airflow | airflow/contrib/sensors/emr_step_sensor.py | Python | apache-2.0 | 1,164 |
'''
Module to handle generating test files.
'''
from __future__ import absolute_import, division, print_function
import shutil
import sys
from os.path import dirname, join, isdir, exists
def create_files(dir_path, m):
"""
Create the test files for pkg in the directory given. The resulting
test files ar... | sandhujasmine/conda-build | conda_build/create_test.py | Python | bsd-3-clause | 4,089 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | moto-timo/robotframework | src/robot/output/filelogger.py | Python | apache-2.0 | 2,008 |
# -*- coding: utf-8 -*-
from bamboo.model import db
# TODO: Change 'db' to 'db = SQLAlchemy()'
from flask.ext.mail import Mail
mail = Mail()
from flask.ext.cache import Cache
cache = Cache()
from flask.ext.login import LoginManager
login_manager = LoginManager()
from flask.ext.openid import OpenID
oid = OpenID()
... | gloaec/bamboo | bamboo/templates/bbapp/bbapp/ext/__init__.py | Python | gpl-3.0 | 435 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] =... | andrew-szymanski/gae_django | settings.py | Python | bsd-3-clause | 2,332 |
# 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 (t... | apache/allura | ForgeWiki/forgewiki/tests/test_models.py | Python | apache-2.0 | 3,094 |
#!/usr/bin/env python
# encoding: utf-8
"""
Test module for SSPStarFactory and SSPIsocFactory
History
-------
2011-12-31 - Created by Jonathan Sick
"""
import numpy as np
import matplotlib.pyplot as plt
from pysps import sp_params
from sspstars import SSPStarFactory
from sspisoc import SSPIsocFactory
def main():
... | jonathansick/pySPS | demo/test_sspstars.py | Python | bsd-3-clause | 3,807 |
# -*- test-case-name: twisted.test.test_jelly -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
S-expression-based persistence of python objects.
It does something very much like L{Pickle<pickle>}; however, pickle's main goal
seems to be efficiency (both in space and time); jelly's main ... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/spread/jelly.py | Python | agpl-3.0 | 36,237 |
'''
ASCII Translator
This Translator takes a DP-formatted book and generates one formatted
as an ASCII etext. The user is queried for the optimum and maximum line lengths
(typically 73 and 75), and for the treatment of italic, bold and smallcap markup.
The input book's txt is formatted to DP standards (as extended... | tallforasmurf/PPQT2 | extras/Translators/ascii.py | Python | gpl-3.0 | 34,713 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-22 14:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sigad', '0027_auto_20171226_0348'),
]
operations = [
migrations.AlterModelOptions(
... | cmjatai/cmj | cmj/sigad/migrations/0028_auto_20180122_1216.py | Python | gpl-3.0 | 441 |
# coding: utf-8
from . import TestCase, make_validated_form, CashForm
class CashFormTest(TestCase):
def test_if_has_fields(self):
form = CashForm()
existing_fields = list(form.fields.keys())
expected_field = ['date', 'history', 'income', 'expenses']
self.assertEqual(existing_fi... | delete/estofadora | estofadora/statement/tests/test_forms.py | Python | mit | 953 |
from flask.ext.restplus import Namespace
from app.models.track import Track as TrackModel
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (
can_create,
can_update,
can_delete,
requires_auth
)
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBas... | Achint08/open-event-orga-server | app/api/tracks.py | Python | gpl-3.0 | 3,195 |
#
# 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 os
import urlparse
from ..base import BaseJob
from paasmaker.util.plug... | kaze/paasmaker | paasmaker/common/job/heart/shutdown.py | Python | mpl-2.0 | 2,244 |
"""API SDK"""
# coding:utf-8
import requests
AUTH = ('api', 'api123')
URL = 'https://api.iloft.xyz/'
HEADERS = {'content-type': 'application/json'}
def get_status(type_id, device_id):
"""Get Device Status"""
if type_id == 0:
g_controller = requests.get(
url=URL + 'controller/' + str(devi... | myloft/API-SDK | api.py | Python | mit | 2,527 |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 11 16:45:34 2016
@author: Mohtashim
"""
life_exp = [43.828000000000003, 76.423000000000002, 72.301000000000002,
42.731000000000002, 75.319999999999993, 81.234999999999999,
79.828999999999994, 75.635000000000005, 64.061999999999998,
79.... | Moshiasri/learning | Python_dataCamp/LifeExpectancy_HistogramBinValPlot.py | Python | gpl-3.0 | 3,596 |
# pylint: disable=R0904,R0902,E1101,E1103,C0111,C0302,C0103,W0101
from __future__ import (nested_scopes, generators, division, absolute_import,
print_function, unicode_literals)
from six.moves import range
from numpy.linalg import norm
from pyNastran.utils import integer_types
from pyNastran.b... | saullocastro/pyNastran | pyNastran/bdf/cards/elements/rods.py | Python | lgpl-3.0 | 17,298 |
from __future__ import print_function
import sys
import numpy as np
from scipy import stats
def p_value_scoring_object(clf, X, y):
"""
p_value_getter is a scoring callable that returns the negative p value from the KS test on the prediction probabilities for the particle and antiparticle samples.
"""
#Finding... | weissercn/MLTools | Dalitz_simplified/p_value_scoring_object.py | Python | mit | 5,852 |
import os
import sys
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcer... | weiyuliang/rt-thread | bsp/w60x/rtconfig.py | Python | apache-2.0 | 4,283 |
import os
import fnmatch
from os.path import join
Import('env names addfiles')
# env: the basic env created in the SConstruct
# names: list of the names of all files in the
# current directory
# addfiles: procedure
# addfiles(sources, names, pattern)
# adds to 'sources' all names in 'names'
... | madratman/nuklei-code | test/SConscript.py | Python | gpl-3.0 | 795 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='fastidious',
versi... | lisael/fastidious | setup.py | Python | gpl-3.0 | 2,226 |
"""Check for definitions and usage happening on the same line."""
#pylint: disable=missing-docstring,multiple-statements,wrong-import-position,unnecessary-comprehension,unspecified-encoding
from __future__ import print_function
print([index
for index in range(10)])
print((index
for index in range(10)))
... | PyCQA/pylint | tests/functional/d/defined_and_used_on_same_line.py | Python | gpl-2.0 | 685 |
VERSION = (0, 9, 4)
| makaimc/pfisdi | taggit/__init__.py | Python | mit | 20 |
"NewspaperPresseuropModule init"
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Florent Fourcot
#
# 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 ... | laurent-george/weboob | modules/presseurop/__init__.py | Python | agpl-3.0 | 854 |
# -*- coding: utf-8 -*-
import sure
import json
import unittest
import mailroute
import httpretty
from mailroute.tests import base
class TestSchema(base.Test):
@property
def entity_classes(self):
return [
mailroute.Admin,
mailroute.Branding,
mailroute.ContactCustome... | MailRoute/mailroute_python | mailroute/tests/test_schema.py | Python | lgpl-3.0 | 1,832 |
# Nimble Storage, Inc. (c) 2013-2014
# 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... | Hybrid-Cloud/cinder | cinder/tests/unit/volume/drivers/test_nimble.py | Python | apache-2.0 | 58,418 |
#!/usr/bin/python -u
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | kun--hust/sccloud | test/probe/test_object_failures.py | Python | apache-2.0 | 7,804 |
#encoding:utf-8
from setuptools import setup, find_packages
import sys, os
version = '1.4.0'
setup(name='qiniu4blog',
version=version,
description="写博客用的七牛图床",
long_description="""写博客用的七牛图床""",
classifiers=[],
keywords='python qiniu',
author='wzyuliyang',
author_email='wzyuli... | wzyuliyang/qiniu4blog | setup.py | Python | mit | 793 |
import os
import pytest
import catconv.stabi as sb
from catfixtures import *
import os.path as op
def test_to_change_path():
conv = {'cat': 'SD_png', 'ext': '.png', 'remove_type': True}
png = sb.change_path('../SD/SD002/TIF/00000643.tif', **conv)
target = '../SD_png/SD_png002/00000643.png'.split(os.sep)... | kaphka/catconv | tests/test_stabi.py | Python | apache-2.0 | 2,128 |
import os
import re
#import logging
import numpy
import logging
#import h5py # added by sakurai@advancesoft.jp
from egfrd import Single, Pair, Multi # added by sakurai@advancesoft.jp
__all__ = [
'FixedIntervalInterrupter',
'Logger',
'HDF5Logger',
]
INF = numpy.inf
log = logging.getLogger('ecell')
... | gfrd/egfrd | logger.py | Python | gpl-2.0 | 11,204 |
from entities.atom import Atom
from decimal import *
from numpy import matrix
import unittest
class AtomTestCase(unittest.TestCase):
rawAtom = "ATOM 1 N SER A 4 12.140 45.657 29.217 1.00 40.81 N "
rawAtom2 = "ATOM 1162 CG2 VAL B 147X 10.793 0.886 28.197 1.00 11.51 ... | julianah/cathAnalysis | entities/atomTest.py | Python | apache-2.0 | 4,599 |
"""
Mostly just smoke tests, and verifying that the parallel implementation is
the same as the serial.
"""
import dask.array as da
import dask.dataframe as dd
import numpy as np
import pandas as pd
import pytest
from dask.array.utils import assert_eq
from dask_ml.cluster import k_means
from dask_ml.cluster import KMea... | daniel-severo/dask-ml | tests/test_kmeans.py | Python | bsd-3-clause | 5,623 |
# coding=utf8
from Position import Position
from datetime import date
class Worker(object):
'''
Classe worker définissant un ouvrier
Attributs :
- num : son numentifiant unique (int)
- name : le name de famille (str)
- firstName : le prénom (str)
- birthdate : la date de naissance de ... | gpierre42/optraj | vagrant/optraj.istic.univ-rennes1.fr/src/system/Worker.py | Python | apache-2.0 | 5,370 |
# Import the modules
import cv2
from sklearn.externals import joblib
from sklearn import datasets
from skimage.feature import hog
from sklearn.svm import *
import numpy as np
from collections import Counter
from skimage import io
import os
from PIL import Image, ImageChops
from matplotlib import pyplot as plt
# featur... | forrestgtran/TeamX | handwritingRecognition/generateClassifierAlpha2.py | Python | apache-2.0 | 6,119 |
#!/usr/bin/python3
################################
# File Name: unittestExample.py
# Author: Chadd Williams
# Date: 10/20/2014
# Class: CS 360
# Assignment: Lecture Examples
# Purpose: Demonstrate unit tests
################################
# adapted from https://docs.python.org/3/library/unittest.html
# pytho... | bri-a/BriTest | unittestExample.py | Python | mit | 1,738 |
'''
Project: Farnsworth
Authors: Karandeep Singh Nagra and Nader Morshed
XXX:
This module is deprecated and marked for replacement.
'''
from django.contrib import admin
from wiki.models import Page, Revision
class PageAdmin(admin.ModelAdmin):
list_display = ('slug',)
search_fields = ('slug',)
list_filt... | knagra/farnsworth | farnswiki/admin.py | Python | bsd-2-clause | 876 |
"""
Integration tests that exercise Gooey's various run modes
WX Python needs to control the main thread. So, in order to simulate a user
running through the system, we have to execute the actual assertions in a
different thread
""" | chriskiehl/Gooey | gooey/tests/integration/__init__.py | Python | mit | 239 |
from lxml.builder import ElementMaker
from casexml.apps.stock import const
def _(tag, ns=const.COMMTRACK_REPORT_XMLNS):
return '{%s}%s' % (ns, tag)
def XML(ns=const.COMMTRACK_REPORT_XMLNS, prefix=None):
prefix_map = None
if prefix:
prefix_map = {prefix: ns}
return ElementMaker(namespace=ns, nsm... | puttarajubr/commcare-hq | corehq/apps/commtrack/xmlutil.py | Python | bsd-3-clause | 336 |
import http.server
import json
import os
import shutil
import socketserver
import sys
import click
import apistar
from apistar.client import Client
from apistar.client.debug import DebugSession
from apistar.exceptions import (
ClientError, ErrorResponse, ParseError, ValidationError
)
def _encoding_from_filename... | tomchristie/apistar | apistar/cli.py | Python | bsd-3-clause | 9,847 |
from setuptools import find_packages, setup
from django_rocket import __author__, __email__, __license__, __version__
README = open("README.rst").read()
# Second paragraph has the short description
description = README.split("\n")[1]
setup(
name="django-rocket",
version=__version__,
description=descript... | mariocesar/django-rocket | setup.py | Python | mit | 1,244 |
"""
WSGI config for memo project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | dogukantufekci/memo | memo/memo/wsgi.py | Python | mit | 1,556 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import base64
import itertools
import operator
import random
import re
import zlib
from botocore.exceptions import ClientError
from dateutil.parser import parse
from concurrent.futures import as_completed
import jmespath
from c7n.actions i... | thisisshi/cloud-custodian | c7n/resources/ec2.py | Python | apache-2.0 | 75,181 |
#
# Martin Gracik <mgracik@redhat.com>
#
# Copyright 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be use... | pbokoc/pykickstart | tests/commands/rescue.py | Python | gpl-2.0 | 1,579 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("delft3dworker", "0064_merge"),
]
operations = [
migrations.AlterField(
model_name="scene",
name="pha... | openearth/delft3d-gt-server | delft3dworker/migrations/0065_auto_20160831_1441.py | Python | gpl-3.0 | 1,435 |
# +-------------------------------------------------------------------------
# | Copyright (C) 2016 Yunify, Inc.
# +-------------------------------------------------------------------------
# | Licensed under the Apache License, Version 2.0 (the "License");
# | you may not use this work except in compliance with the Li... | yunify/qingstor-sdk-python | qingstor/sdk/error.py | Python | apache-2.0 | 1,669 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Event.url'
db.delete_column('news_and_events_event', 'u... | evildmp/Arkestra | news_and_events/migrations/0004_auto__del_field_event_url__del_field_newsarticle_url.py | Python | bsd-2-clause | 40,453 |
#!/usr/bin/python3
#
# When in Fear,
# When in Doubt,
# Run Centry,
# Scream and Shout
#
# _( }
# -= _ << \
# `.\__/`/\\
# -= '--'\\ `
# -= //
# \)
#
# Licensed under GPL v3 by 0xPoly
# Inspired by panic_bcast
import sys... | lukzag33k/Centry | centry.py | Python | gpl-3.0 | 8,614 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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 notice, this
# l... | stormi/tsunami | src/primaires/meteo/perturbations/brouillard.py | Python | bsd-3-clause | 2,372 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'leave_allocation',
'transactions': [
{
'items': ['Compensatory Leave Request']
},
{
'items': ['Leave Encashment']
}
... | Zlash65/erpnext | erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py | Python | gpl-3.0 | 334 |
import copy
import json
from bson import ObjectId
import datetime
try:
from requests.structures import CaseInsensitiveDict
except:
CaseInsensitiveDict = None
class _CustomJsonEncoder(json.JSONEncoder):
def default(self, obj): # pylint: disable-msg=E0202
if isinstance(obj, datetime.datetime):
return ... | pricingassistant/mongokat | mongokat/utils.py | Python | mit | 3,002 |
#!/usr/bin/env python
# -*- coding: 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, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | nberliner/SRVis | lib/localisationClass.py | Python | gpl-3.0 | 11,417 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | xiangel/hue | desktop/core/src/desktop/urls.py | Python | apache-2.0 | 5,286 |
import re
import logging
from autotest.client.shared import error
from virttest import qemu_storage, data_dir
@error.context_aware
def run_cluster_size_check(test, params, env):
"""
qemu-img cluster size check test:
1) Create image without cluster_size option
2) Verify if the cluster_size is default... | spiceqa/virt-test | qemu/tests/cluster_size_check.py | Python | gpl-2.0 | 3,358 |
"""Functional unit tests for the RBCM class."""
import rBCM
import pytest
import numpy as np
class RegressionFixture(object):
def __init__(self, X, y):
self.X = X
self.y = y
class TestRBCM(object):
@pytest.fixture
def empty_data(self):
X = np.array([])
y = np.array([])
... | lucaskolstad/rBCM | tests/test_rbcm.py | Python | bsd-3-clause | 2,916 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from sentry.plugins.bases.issue import IssuePlugin
from sentry.utils import json
import sentry_github_issues
import urllib2
class GitHubIssuesOptionsForm(forms.Form):
repo = forms.CharField(label=_('Repository Name'),
widget=... | yoshiori/sentry-github-issues | src/sentry_github_issues/plugin.py | Python | mit | 4,168 |
import celery
from .core import update_modules
@celery.task(ignore_result=True)
def update_bigbrother():
logger = update_bigbrother.get_logger()
logger.info('Updating BigBrother modules...')
update_modules()
logger.info('Update complete.') | anderspetersson/django-bigbrother | bigbrother/tasks.py | Python | mit | 257 |
import time
__author__ = 'bromix'
import tempfile
from ..abstract_context import AbstractContext
from .mock_settings import MockSettings
from .mock_context_ui import MockContextUI
from .mock_system_version import MockSystemVersion
from ...logging import log
class MockContext(AbstractContext):
def __init__(self... | azumimuo/family-xbmc-addon | zips/plugin.video.youtube/resources/lib/kodion/impl/mock/mock_context.py | Python | gpl-2.0 | 2,846 |
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.models import Realm, RealmAlias, get_realm
from zerver.lib.actions import realm_aliases
import sys
class Command(BaseCommand):
help = """Manage aliases for the specified realm"""
def add_arguments(self, par... | ashwinirudrappa/zulip | zerver/management/commands/realm_alias.py | Python | apache-2.0 | 1,776 |
#!/usr/bin/env python3
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the foll... | ionomy/ion | contrib/devtools/update-translations.py | Python | mit | 8,103 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import startup
import page_sets
from telemetry import benchmark
class _StartWithUrl(benchmark.Benchmark):
page_set = page_sets.StartupP... | sgraham/nope | tools/perf/benchmarks/start_with_url.py | Python | bsd-3-clause | 1,178 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from models import Email, Resolution, Submitter
class ResolutionInline(admin.StackedInline):
model = Resolution
max_num = 1
class EmailAdmin(admin.ModelAdmin):
list_display = ('subject', 'submitter', 'cre... | rosti-cz/django-emailsupport | django_emailsupport/admin.py | Python | mit | 1,413 |
# -*- coding: utf-8 -*-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for main builder logic (__init__.py)."""
from __future__ import print_function
import importlib
import mock
from c... | endlessm/chromium-browser | third_party/chromite/cbuildbot/builders/init_unittest.py | Python | bsd-3-clause | 2,044 |
#! /usr/bin/env python
"""
Reads B1500 csv VthMeasure files and summarises parameters
Jeremy Smith
Northwestern University
Version 1.5
"""
from numpy import *
import os
import sys
from myfunctions import *
__author__ = "Jeremy Smith"
__version__ = "1.5"
data_path = os.path.dirname(__file__) # Path name for locati... | jzmnd/fet-py-scripts | B1500csv_paramextractor.py | Python | mit | 2,038 |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2020 MinIO, 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/lic... | minio/minio-py | tests/unit/retention_test.py | Python | apache-2.0 | 1,477 |
# Generated by Django 3.1 on 2021-04-14 06:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('audits', '0011_userloginlog_backend'),
]
operations = [
migrations.AlterField(
model_name='userloginlog',
name='type',... | jumpserver/jumpserver | apps/audits/migrations/0012_auto_20210414_1443.py | Python | gpl-3.0 | 476 |
from nose import SkipTest
from nose.tools import assert_raises, assert_true, assert_equal, raises
import networkx as nx
from networkx.testing import assert_graphs_equal
from networkx.generators.classic import barbell_graph,cycle_graph,path_graph
from networkx.testing.utils import assert_graphs_equal
class TestConver... | jcurbelo/networkx | networkx/tests/test_convert_scipy.py | Python | bsd-3-clause | 9,372 |
#Задача 9. Вариант 34.
#Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, причем программа может отвечать только "Да" и "Нет". Вслед за тем игрок должен попробовать отг... | Mariaanisimova/pythonintask | BIZa/2014/Novikova_J_V/Задача №9. Вариант 34.py | Python | apache-2.0 | 2,431 |
import mock
import unittest
from pythonwarrior.abilities.detonate import Detonate
from pythonwarrior.floor import Floor
from pythonwarrior.units.base import UnitBase
from pythonwarrior.units.warrior import Warrior
class TestDetonate(unittest.TestCase):
def setUp(self):
self.floor = Floor()
self.f... | arbylee/python-warrior | pythonwarrior/tests/abilities/test_detonate.py | Python | mit | 1,694 |
"""Tests for the :mod:`bigchaindb.backend.rethinkdb.admin` module."""
import pytest
import rethinkdb as r
def _count_rethinkdb_servers():
from bigchaindb import config
conn = r.connect(host=config['database']['host'],
port=config['database']['port'])
return len(list(r.db('rethinkdb')... | stanta/darfchain | darfchain_docker_vagrant/tests/backend/rethinkdb/test_admin.py | Python | gpl-3.0 | 8,526 |
from nose.tools import assert_equal
import urllib
from base import *
from bibserver import web, ingest
import os
class TestWeb(object):
@classmethod
def setup_class(cls):
web.app.config['TESTING'] = True
cls.app = web.app.test_client()
# fixture data
recdict = fixtures['records... | okfn/bibserver | test/test_web.py | Python | mit | 3,627 |
#########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | jelly/calibre | src/calibre/ebooks/rtf2xml/tokenize.py | Python | gpl-3.0 | 8,395 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Bloom Stack, Inc and contributors
# For license information, please see license.txt
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
class PackageTag(Document):
def validate(self):
if self.sou... | neilLasrado/erpnext | erpnext/compliance/doctype/package_tag/package_tag.py | Python | gpl-3.0 | 2,493 |
class HashTable(object):
class Node(object):
def __init__(self, k, v):
self.k = k
self.v = v
def __eq__(self, k):
return self.k == k
def __init__(self):
self.n_buckets = 512
self.buckets = [[] for i in range(self.n_buckets)]
def __getite... | frasertweedale/drill | py/hashtable.py | Python | mit | 710 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/python-docs-samples | run/idp-sql/credentials.py | Python | apache-2.0 | 1,761 |
from collective.grok import gs
from sinar.accountable import MessageFactory as _
@gs.importstep(
name=u'sinar.accountable',
title=_('sinar.accountable import handler'),
description=_(''))
def setupVarious(context):
if context.readDataFile('sinar.accountable.marker.txt') is None:
return
por... | abdza/sinar.accountable | sinar/accountable/setuphandlers.py | Python | gpl-2.0 | 368 |
#!/usr/bin/env python2
#
# Copyright (c) 2011, Roboterclub Aachen e.V.
# 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
#... | dergraaf/xpcc | scons/site_tools/font.py | Python | bsd-3-clause | 2,598 |
"""Hearthstone simulations
All numbers taken from http://hearthstone.gamepedia.com/Card_pack_statistics"""
from pprint import pprint
import random
from collections import defaultdict
from collection import Collection
from collection import Pack
def simulate(runs=10000):
common = 0
rare = 0
epic = 0
... | Rellikiox/hs-card-generator | packs_needed.py | Python | mit | 1,206 |
import pygame
import sys
def make(i):
for x in xrange(i.get_width()):
for y in xrange(i.get_height()):
r,g,b,a = i.get_at((x, y))
C = 255
i.set_at((x, y), (C, C, C, a))
i = pygame.image.load(sys.argv[1])
make(i)
pygame.ima... | zielmicha/freeciv-android | makemask.py | Python | gpl-2.0 | 345 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# 顶点云 Web 服务器 documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 21 13:47:25 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... | Forec/zenith-cloud | docs/conf.py | Python | isc | 5,885 |
#!/bin/env python
# -*- coding: utf-8 -*-
'''A phylogenetic hierarchy that would have made Linnaeus proud.'''
INCOMPATIBLE_SPECIES = (set(("human", "lion")),
set(("dog", "cat")),
set(("cat", "mouse")))
class Animal(object):
"""An animal from the planet Earth."""... | FullStackEmbedded/fse2016-python | objects_and_inheritance.py | Python | mit | 4,809 |
# -*- coding: utf8 -*-
u"""
Тесты на ДЗ#5.
"""
__author__ = "wowkalucky"
__email__ = "wowkalucky@gmail.com"
__date__ = "2014-11-17"
import datetime
from hw5_solution1 import Person
def tests_for_hw5_solution1():
u"""Тесты задачи 1"""
petroff = Person("Petrov", "Petro", "1952-01-02")
ivanoff = Person(... | pybursa/homeworks | o_shestakoff/hw5/hw5_tests.py | Python | gpl-2.0 | 953 |
"""
Module implementing `xblock.runtime.Runtime` functionality for the LMS
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from badges.service import BadgingService
from badges.utils import badges_enabled
from openedx.core.djangoapps.user_api.course_tag import api as user_course_tag_a... | TheMOOCAgency/edx-platform | lms/djangoapps/lms_xblock/runtime.py | Python | agpl-3.0 | 8,659 |
#!/usr/bin/python
# Supports 16x2 and 20x4 screens.
#
# Based on work by Matt Hawkins (raspberrypi-spy.co.uk)
#
# 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, ... | bananu7/Arduino | proj/spotibox_pi/flask/plcd.py | Python | mit | 3,310 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | ahelsing/geni-ch | plugins/sarm/plugin.py | Python | mit | 1,711 |
#!/usr/bin/env python
import os, shutil, sys
# NOTE: It's better if /backup is a btrfs filesystem mounted using /etc/fstab line like this:
# UUID=f52862ce-abdb-44ae-aea5-f649dfadc32b /tmp btrfs compress-force=lzo,noatime,nobootwait 0 2
# so works in crontab
os.environ['PATH']='/usr/local/sbin:/usr/local/bin:/sbin:/b... | pabryan/smc | src/scripts/rethinkdb/rethinkdb_backup.py | Python | gpl-3.0 | 2,774 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from undebt.pattern.common import NAME
from undebt.pattern.lang.python import EXPR
from undebt.pattern.util import condense
from undebt.pattern.util import tokens_as_dict
from undebt.pyp... | Yelp/undebt | undebt/examples/swift.py | Python | apache-2.0 | 1,112 |
'''
InteractiveConsole ÀàʵÏÖÁËÒ»¸ö½»»¥¿ØÖÆÌ¨, ÀàËÆÄãÆô¶¯µÄ Python ½âÊÍÆ÷½»»¥Ä£Ê½.
¿ØÖÆÌ¨¿ÉÒÔÊǻµÄ(×Ô¶¯µ÷Óú¯Êýµ½´ïÏÂÒ»ÐÐ) »òÊDZ»¶¯µÄ(µ±ÓÐÐÂÊý¾Ýʱµ÷Óà push ·½·¨).
ĬÈÏʹÓÃÄÚ½¨µÄ raw_input º¯Êý. Èç¹ûÄãÏëʹÓÃÁí¸öÊäÈ뺯Êý, Äã¿ÉÒÔʹÓÃÏàͬµÄÃû³ÆÖØÔØÕâ¸ö·½·¨.
ÏÂÀý չʾÁËÈçºÎʹÓà code Ä£¿éÀ´Ä£Äâ½»»¥½âÊÍÆ÷.
'''
import code... | iamweilee/pylearn | code-example-2.py | Python | mit | 377 |
"""
Test the Sprockets Command Line Interface
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
import mock
from sprockets import cli
class Package(object):
def __init__(self, name, module_name):
self.name = name
self.module_name = module_name
class Initializa... | sprockets/sprockets.cli | tests.py | Python | bsd-3-clause | 1,884 |
from __future__ import unicode_literals
from .helpers import use_appropriate_encoding
class Device(object):
def __init__(self, account, device_info):
self._account = account
self.device_iden = device_info.get("iden")
for attr in ("push_token", "app_version", "android_sdk_version", "fing... | xbot/alfred-pushbullet | lib/pushbullet/device.py | Python | mit | 1,593 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.