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 |
|---|---|---|---|---|---|
"""
models/
This package contains models to be used by the
application layer. All models should be either
named tuples or named tuple-like. That is,
immutable objects with appropriate named
attributes.
"""
__author__ = 'Alan Barber'
| alanebarber/sabroso | python/application/data_layer/models/__init__.py | Python | bsd-3-clause | 235 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, 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... | badlogicmanpreet/nupic | tests/unit/nupic/research/spatial_pooler_cpp_api_test.py | Python | agpl-3.0 | 1,297 |
"""
Public interface for student training:
* Staff can create assessments for example responses.
* Students assess an example response, then compare the scores
they gave to to the instructor's assessment.
"""
import logging
from django.db import DatabaseError
from django.utils.translation import ugettext as _
f... | Edraak/edx-ora2 | openassessment/assessment/api/student_training.py | Python | agpl-3.0 | 16,892 |
import csv
import six
from decimal import Decimal, InvalidOperation
if six.PY3:
from io import StringIO
else:
from StringIO import StringIO
from .base import BaseSmartCSVTestCase
from .config import COLUMNS_WITH_VALUE_TRANSFORMATIONS
import smartcsv
class ValidCSVWithValueTransformations(BaseSmartCSVTestCa... | santiagobasulto/smartcsv | tests/test_value_transformations.py | Python | mit | 5,070 |
import os
import sys
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
# Insert parent directory into path to pick up ernest code
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from ernest.main import db, app
# this is the Alembic Conf... | willkg/ernest | alembic/env.py | Python | mpl-2.0 | 1,873 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_security_settings_service_create_security_settings_sync.py | Python | apache-2.0 | 1,800 |
import os
from collections import OrderedDict
"""
This module is all about constant value
"""
## *********************************************************************************** Testing configuration ************************************************************************************
DEBUG_MODE = True
FULL_SYS... | jessada/pyCMM | pycmm/settings.py | Python | gpl-2.0 | 70,066 |
import warnings
import itertools
from contextlib import contextmanager
import numpy as np
from matplotlib import transforms
from .. import utils
from .. import _py3k_compat as py3k
class Renderer(object):
@staticmethod
def ax_zoomable(ax):
return bool(ax and ax.get_navigate())
@staticmethod
... | azjps/bokeh | bokeh/core/compat/mplexporter/renderers/base.py | Python | bsd-3-clause | 14,360 |
"""Coordinate Point Extractor for KIT system."""
# Author: Teon Brooks <[email protected]>
#
# License: BSD (3-clause)
from os import SEEK_CUR, path as op
import pickle
import re
from struct import unpack
import numpy as np
from .constants import KIT
from .._digitization import _read_dig_points
def read_mrk(f... | Teekuningas/mne-python | mne/io/kit/coreg.py | Python | bsd-3-clause | 2,665 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
import numpy as np
from scipy import odr
try:
from modefit.baseobjects import BaseModel, BaseFitter
except:
raise ImportError("install modefit (pip install modefit) to be able to access to ADRFitter")
from .adr import ADR... | MickaelRigault/pyifu | pyifu/adrfit.py | Python | apache-2.0 | 9,121 |
from __future__ import with_statement
from distutils.version import StrictVersion
from itertools import chain
from select import select
import os
import socket
import sys
import threading
import warnings
try:
import ssl
ssl_available = True
except ImportError:
ssl_available = False
from redis._compat impo... | sigma-random/redis-py | redis/connection.py | Python | mit | 37,068 |
import unittest
from matrix import Matrix
class MatrixTest(unittest.TestCase):
def test_extract_a_row(self):
matrix = Matrix("1 2\n10 20")
self.assertEqual([1, 2], matrix.rows[0])
def test_extract_same_row_again(self):
matrix = Matrix("9 7\n8 6")
self.assertEqual([9, 7], matr... | SteffenBauer/Katas | Exercism.io/python/matrix/matrix_test.py | Python | mit | 978 |
# Django imports
from django.views.generic import ListView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
# Local Django imports
from user.decorators import is_patient
from prescription.models import PatientPrescription
class ListPatientPrescription(Lis... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/prescription/views/listprescriptionpatient.py | Python | mit | 871 |
# -*- coding: utf-8 -*-
###############################################################################################
#
# MediaPortal for Dreambox OS
#
# Coded by MediaPortal Team (c) 2013-2015
#
# This plugin is open source but it is NOT free software.
#
# This plugin may only be distributed to and executed... | n3wb13/OpenNfrGui-5.0-1 | lib/python/Plugins/Extensions/MediaPortal/additions/porn/sexu.py | Python | gpl-2.0 | 7,787 |
#!/usr/bin/env python
import array
import binascii
import glob
import itertools
import json
import logging
import os
import serial
import signal
import stm32_crc
import struct
import threading
import time
import traceback
import uuid
import zipfile
try:
from collections import OrderedDict
except:
from ordereddict i... | Elleo/rockwatch | pebble/pebble.py | Python | gpl-3.0 | 33,192 |
"""
Django base settings for Waldur Core.
"""
from datetime import timedelta
import locale
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import warnings
from waldur_core.core import WaldurExtension
from waldur_core.core.metadata import WaldurConfiguration
from waldur_core.server.adm... | opennode/nodeconductor-assembly-waldur | src/waldur_core/server/base_settings.py | Python | mit | 9,157 |
#===============================================================================
# This file is part of TEMPy.
#
# TEMPy is a software designed to help the user in the manipulation
# and analyses of macromolecular assemblies using 3D electron microscopy maps.
#
# Copyright 2015 Birkbeck Colleg... | OniDaito/ChimeraXTempy | TEMPy/Cluster.py | Python | mit | 22,226 |
from skimage import img_as_float
import math
import numpy as np
def rgChromaticity(rgb):
"""
Converting an RGB image into normalized RGB removes the effect
of any intensity variations.
rg Chromaticity
http://en.wikipedia.org/wiki/Rg_chromaticity
Also know as normalised RGB as per paper:
C... | michaelborck/ipfe | ipfe/colour.py | Python | bsd-3-clause | 1,979 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | lispc/Paddle | python/paddle/trainer_config_helpers/activations.py | Python | apache-2.0 | 5,336 |
'''
Copyright 2012 Will Snook (http://willsnook.com)
MIT License
Generate a NEC2 card stack file for a 2m folded dipole
'''
from nec2utils import *
# =======================================================================================================
# Plan for a 2m folded dipole
# ==============================... | ckuethe/nec2-toys | 2m-folded-dipole/2m-folded-dipole.py | Python | mit | 3,244 |
# manufac - a commandline tool for step-by-step instructions
# Copyright (C) 2014 Johannes Reinhardt <[email protected]>
#
# 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 vers... | jreinhardt/manufac | src/manufac/utils.py | Python | gpl-2.0 | 4,121 |
# -*- coding: utf-8 -*-
# Gitless - a version control system built on top of Git
# Licensed under MIT
"""gl resolve - Mark a file with conflicts as resolved."""
from . import file_cmd
parser = file_cmd.parser('mark files with conflicts as resolved', 'resolve', ['rs'])
| sdg-mit/gitless | gitless/cli/gl_resolve.py | Python | mit | 274 |
import math
import sys
EPSILON = sys.float_info.epsilon
def float_equal(a, b, epsilon=EPSILON):
""" Compares to floats with a given epsilon. Normally you should use the
epsilon constant EPSILON in this module (default value).
Test:
>>> float_equal(0, 0)
True
>>> float_equal(0.0000, 0.0000)
... | tea2code/gamemath | gamemath/comparison.py | Python | mit | 2,241 |
# -*- coding: utf-8 -*-
"""
Sop.libs.baidu
~~~~~~~~~~~~~~
util tool.
:copyright: (c) 2017 by 陶先森.
:license: MIT, see LICENSE for more details.
"""
from .base import ServiceBase
from utils.tool import logger
from bs4 import BeautifulSoup
from urllib import urlencode
import requests
... | staugur/Sop | src/libs/baidu.py | Python | mit | 2,667 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | skuda/client-python | kubernetes/client/models/v1_replication_controller.py | Python | apache-2.0 | 7,930 |
from argparse import ArgumentParser
from gettext import gettext as _
from hashlib import sha1
from os import environ, mkdir
from shutil import rmtree
from subprocess import Popen
from sys import argv
from django.core.management import execute_from_command_line
from .apps.settings.config import create_default_config
f... | trehn/teamvault | teamvault/cli.py | Python | gpl-3.0 | 3,230 |
# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014 Dominic Sacré <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (... | dsacre/mididings | tests/units/test_engine.py | Python | gpl-2.0 | 1,779 |
"""demo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | angellagunas/drf-scaffolding | demo/demo/urls.py | Python | gpl-3.0 | 872 |
#!/usr/bin/python
import bluetooth
from subprocess import Popen, PIPE
import sys
class BT(object):
def __init__(self, receiveSize=1024):
self.btSocket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
self._ReceiveSize = receiveSize
def __exit__(self):
self.Disconnect()
def Co... | fabienroyer/Bluetooth | bt.py | Python | lgpl-3.0 | 3,465 |
# -*- 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... | addition-it-solutions/project-all | addons/note/__init__.py | Python | agpl-3.0 | 991 |
#!/usr/bin/python
import sys
import os
import subprocess
import threading
import urllib2
from xml.dom import minidom
import time
import logging
from logging.handlers import RotatingFileHandler
import signal
import cPickle
try:
from subprocess import DEVNULL # py3k
except ImportError:
DEVNULL = open(os.devnull,... | Helly1206/comskipper | script/hts_skipper.py | Python | gpl-2.0 | 26,814 |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.part_offer_data import PartOfferData
from .base_model_ import Model
from datetime import date, datetime
from typing import List, Dict
from ..util import deserialize_model
class PartOffer(Model):
"""
NOTE: This class is auto gen... | turdusmerula/kipartman | kipartbase/swagger_server/models/part_offer.py | Python | gpl-3.0 | 7,192 |
#!/usr/bin/env python3
import os, sys, logging, urllib, time, string, json, argparse, collections, datetime, re, bz2, math
from concurrent.futures import ThreadPoolExecutor, wait
import lz4
pool = ThreadPoolExecutor(max_workers=16)
logging.basicConfig(level=logging.DEBUG)
sys.path.append(os.path.join(os.path.dirnam... | kislyuk/cartographer | postproc_db.py | Python | agpl-3.0 | 1,920 |
#!/usr/bin/env python
# Copyright 2012-2014 Keith Fancher
#
# 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 p... | keithfancher/Todo-Indicator | todotxt/test_list.py | Python | gpl-3.0 | 11,017 |
from paddle.trainer_config_helpers import *
settings(
batch_size=1000,
learning_rate=1e-5
)
data = data_layer(name='data', size=2304)
conv = img_conv_layer(input=data,
filter_size = 3,
num_channels=1,
num_filters=16,
padd... | zuowang/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_maxout.py | Python | apache-2.0 | 772 |
#!/usr/bin/env python
# Copyright (c) 2013 Turbulenz Limited.
# Released under "Modified BSD License". See COPYING for full text.
from __future__ import print_function
import os
import glob
import sys
def find(dirname, pattern):
for root, dirs, files in os.walk(dirname):
found = glob.glob(os.path.join(r... | turbulenz/turbulenz_build | commands/find.py | Python | bsd-3-clause | 911 |
# encoding: 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 'Optiongroup.form_type'
db.add_column('budgetcalc_optiongroup', 'form_type', self.gf('djang... | MAPC/MBTA | budgetcalc/migrations/0007_auto__add_field_optiongroup_form_type.py | Python | bsd-3-clause | 3,090 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "opengain.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| null-none/OpenGain | manage.py | Python | gpl-2.0 | 251 |
"""
The MIT License (MIT)
Copyright (c) 2014 Chris Wimbrow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge... | cwimbrow/veganeyes-api | app/api_1_0/errors.py | Python | mit | 1,089 |
#!/usr/bin/env python
# encoding: utf-8
from nose.tools import * # noqa
from framework import sessions
from framework.flask import request
from website.models import Session
from website.addons.osfstorage.tests import factories
from website.addons.osfstorage import utils
from website.addons.osfstorage.tests.utils... | jmcarp/osf.io | website/addons/osfstorage/tests/test_utils.py | Python | apache-2.0 | 2,524 |
from __future__ import unicode_literals
from django.db import models
import datetime
from django.db.models.signals import pre_save
from django.urls import reverse
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from source_utils.starters import CommonInfo, GenericCategor... | michealcarrerweb/LHVent_app | stock/models.py | Python | mit | 4,911 |
from common_helper_files import get_dir_of_file
from common_helper_passwords import get_merged_password_set
import logging
import os
NAME = 'blacklist'
BLACKLIST = list()
def filter_function(file_meta, file_cache=None):
_get_blacklist()
return file_meta['uid'] in BLACKLIST
def setup(app):
app.register... | weidenba/recovery_sort | filter_plugins/ignore/blacklist.py | Python | gpl-3.0 | 707 |
""" watch for modifications to ./docs folder """
from twisted.internet import inotify
from twisted.internet import task
from twisted.python import filepath
from twisted.python import log
from twisted.application.service import IService
from zope.interface import implements
from txbitwrap.event import HANDLERS
class S... | stackdump/txbitwrap | txbitwrap/session_watch.py | Python | mit | 1,150 |
# Copyright 2018 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... | hehongliang/tensorflow | tensorflow/python/kernel_tests/cwise_ops_binary_test.py | Python | apache-2.0 | 32,577 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/widgets/signsandsymbols.py
# signsandsymbols.py
# A collection of new widgets
# author: John Precedo ([email protected])
__version__=''' $I... | nakagami/reportlab | src/reportlab/graphics/widgets/signsandsymbols.py | Python | bsd-3-clause | 30,281 |
from setuptools import setup , find_namespace_packages
setup(name='PeriPyDIC',
version='0.3',
description='Peridynamics (PD) computations for state-based PD in 1D, 2D for elastic and viscoelastic materials. Also possible to import Digital Image Correlation results and compute PD forces for each pixel as a ... | lm2-poly/PeriPyDIC | setup.py | Python | gpl-3.0 | 713 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-03 02:32
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('reports', '0020_auto_20170116_1410'),
... | MartinPaulo/ReportsAlpha | reports/migrations/0021_auto_20170503_1232.py | Python | gpl-3.0 | 1,079 |
# -*- coding: utf-8 -*-
"""
docstring goes here.
:copyright: Copyright 2014 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
import unittest
import neo
import numpy as np
from numpy.testing.utils import assert_array_almost_equal, assert_array_equal
import quantities as ... | mczerwinski/elephant | elephant/test/test_statistics.py | Python | bsd-3-clause | 22,605 |
# -*- 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 'WeekNumber'
db.create_table(u'mothers_calendar_weeknumber', (
(u'id', self.gf('d... | muranga/ataps | ataps/apps/mothers_calendar/migrations/0001_initial.py | Python | unlicense | 4,004 |
import shutil
import time
import os
import string
import random
import sys
sys.path.append('../')
from constants import PLAYER_X, PLAYER_Y, DANCE, UP, REVERSE
CENTER = 'center'
LEFT = 'left'
RIGHT = 'right'
class Box():
def __init__(self, width, height, border='*', empty=' '):
self.width = width
... | fisadev/choppycamp | game/visualizer.py | Python | mit | 8,460 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-24 20:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('node', '0003_node_is_paused_errors'),
]
operations = [
migrations.RenameField(
... | ngageoint/scale | scale/node/migrations/0004_auto_20170524_1639.py | Python | apache-2.0 | 430 |
import pytest
import cv2
from plantcv.plantcv import auto_crop
@pytest.mark.parametrize('padx,pady,expected', [[20, 20, (98, 56, 4)], [(400, 400), (400, 400), (58, 16, 4)]])
def test_auto_crop(padx, pady, expected, test_data):
"""Test for PlantCV."""
# Read in test data
img = cv2.imread(test_data.small_rg... | danforthcenter/plantcv | tests/plantcv/test_auto_crop.py | Python | mit | 1,737 |
'''Holds Settings'''
import logging
import json
from WeatherType import WeatherType
import os
FILELOC = 'json/whet_settings.json'
class Settings(object):
"""Class to hold settings"""
# pylint: disable=too-many-instance-attributes
logger = logging.getLogger('__main__')
last_modified_time = 0
d... | mike-gracia/whet | Settings.py | Python | mit | 2,114 |
import os
import shutil
import pytest
DATA_PATH = os.path.join(os.path.dirname(__file__), 'data')
@pytest.fixture
def testing_gallery(tmpdir):
"""Testing gallery with two albums:
- testing-album
- album-incomplete (without album metadata in album.ini)
Both galleryes contain four photos: Photo{1..4}... | sergejx/kaleidoscope | tests/conftest.py | Python | bsd-3-clause | 975 |
from django.contrib import admin
from .models import SimpleModel
admin.site.register(SimpleModel, admin.ModelAdmin)
| gavinwahl/django-optimistic-lock | tests/tests/admin.py | Python | bsd-2-clause | 118 |
from google.appengine.ext import db
class BudgetGroup():
INCOME = "Income"
COMMITED = "Committed"
IRREGULAR = "Irregular"
FUN = "Fun"
# RETIREMENT = "Retirement"
SAVINGS = "Savings"
UNGROUPED = "Ungrouped"
IGNORED = "Ignored"
@staticmethod
def getAllGroups():
return... | gregmli/Spendalyzer | budget.py | Python | mit | 4,648 |
# Copyright (c) 2010 Witchspace <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | XertroV/bitcoin-python3 | src/bitcoinrpc/__init__.py | Python | mit | 2,292 |
# -*- coding: utf-8 -*-
from ccxt.base.exchange import Exchange
import base64
import hashlib
from ccxt.base.errors import ExchangeError
class btcturk (Exchange):
def describe(self):
return self.deep_extend(super(btcturk, self).describe(), {
'id': 'btcturk',
'name': 'BTCTurk',
... | tritoanst/ccxt | python/ccxt/btcturk.py | Python | mit | 7,964 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# pylint: disable=W0141
import sys
from pandas.core.base import PandasObject
from pandas.core.common import adjoin, notnull
from pandas.core.index import Index, MultiIndex, _ensure_index
from pandas import compat
from pandas.compat import(StringIO, lzip, r... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/pandas/core/format.py | Python | mit | 88,798 |
from Numberjack.ExternalSolver import ExternalCNFSolver
from Numberjack import NBJ_STD_Solver
import re
class GlucoseSolver(ExternalCNFSolver):
def __init__(self):
super(GlucoseSolver, self).__init__()
self.solverexec = "glucose"
self.info_regexps = { # See doc on ExternalSolver.info_re... | JElchison/Numberjack | Numberjack/solvers/Glucose.py | Python | lgpl-2.1 | 1,138 |
# -*- coding: utf-8 -*-
"""Filesystem path resource."""
from __future__ import division
import pathlib
from xal.resource import Resource
class Path(Resource):
POSIX_FLAVOUR = 'posix'
WINDOWS_FLAVOUR = 'windows'
def __init__(self, path, flavour=POSIX_FLAVOUR):
super(Path, self).__init__()
... | benoitbryon/xal | xal/path/resource.py | Python | bsd-3-clause | 8,243 |
"""
Implementation of the standard :mod:`thread` module that spawns greenlets.
.. note::
This module is a helper for :mod:`gevent.monkey` and is not
intended to be used directly. For spawning greenlets in your
applications, prefer higher level constructs like
:class:`gevent.Greenlet` class or :func:`g... | burzillibus/RobHome | venv/lib/python2.7/site-packages/gevent/thread.py | Python | mit | 3,633 |
## Copyright 2013 Luc Saffre
## This file is part of the Lino project.
## Lino 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.... | MaxTyutyunnikov/lino | lino/core/signals.py | Python | gpl-3.0 | 2,881 |
# mysql/base.py
# Copyright (C) 2005-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Support for the MySQL database.
Supported Versions and Features
--------------------... | eunchong/build | third_party/sqlalchemy_0_7_1/sqlalchemy/dialects/mysql/base.py | Python | bsd-3-clause | 92,519 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/oehealth | oehealth_medicament_group/oehealth_tag.py | Python | agpl-3.0 | 1,912 |
import os
import tempfile
import numpy as np
from clustering_system.corpus.LineCorpus import LineCorpus
from clustering_system.corpus.LineNewsCorpus import LineNewsCorpus
class TestLineCorpus:
CORPUS = [[1, 3, 2], [0, -1]]
CORPUS_TEXTS = [["hello", "word", "world"], ["!"]]
CORPUS_WITH_META = [([1, 3, 2]... | vanam/clustering | tests/clustering_system/corpus/test_LineCorpus.py | Python | mit | 1,711 |
# 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... | briancurtin/python-openstacksdk | openstack/metric/v1/metric.py | Python | apache-2.0 | 1,442 |
#!/usr/bin/python
#
# Copyright 2014, Intel Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
#... | eurogiciel-oss/Tizen-development-report | bin/checkRpmSrc.py | Python | mit | 3,700 |
# Copyright 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 applicable law or agreed to in... | MaheshIBM/keystone | keystone/tests/test_ldap_livetest.py | Python | apache-2.0 | 9,051 |
import logging
import ssl
from urllib import request
from bs4 import BeautifulSoup, Tag
from HTMLParseError import HTMLParseError
from LyricParser import LyricParser
class UltimateGuitarInteractor:
export_location = ""
logger = ""
ultimate_guitar_link = ""
main_html = ""
main_header = ""
p... | BrianMargolis/TranscriptionGenerator | UltimateGuitarInteractor.py | Python | mit | 6,275 |
def hows_the_parrot():
print("He's pining for the fjords!")
hows_the_parrot()
def lumberjack(name):
if name.lower() == 'casey':
print("Casey's a lumberjack and he's OK!")
else:
print("{} sleeps all night and {} works all day!".format(name, name))
lumberjack("Casey")
... | CaseyNord/Treehouse | Python Basics/functions_lumberjack.py | Python | mit | 569 |
"""private_mkt will be populated from puppet and placed in this directory"""
from lib.settings_base import *
from mkt.settings import *
from settings_base import *
import private_mkt
SERVER_EMAIL = '[email protected]'
DOMAIN = "payments-alt.allizom.org"
SITE_URL = 'https://%s' % DOMAIN
SERVICES_U... | jinankjain/zamboni | sites/paymentsalt/settings_mkt.py | Python | bsd-3-clause | 6,014 |
"""
OLI analytics service event tracker backend.
"""
from __future__ import absolute_import
import json
import logging
from urlparse import urljoin
from django.contrib.auth.models import User
from requests_oauthlib import OAuth1Session
from student.models import anonymous_id_for_user
from track.backends import BaseB... | caesar2164/edx-platform | common/djangoapps/track/backends/oli.py | Python | agpl-3.0 | 4,922 |
#!/usr/bin/env python
from blocking import blocking
from sweep import sweep
if __name__ == "__main__":
nsites = 6
'''
do blocking first
'''
blocking(nsites)
print "done blocking"
'''
next do the weep iterations
'''
sweep(nsites)
print "done sweep"
| v1j4y/pyDMRG | src/main.py | Python | gpl-2.0 | 267 |
#!/usr/bin python
#coding: utf-8
# 最美应用图标下载
import re
import requests
import shutil
for page in range(1,101):
url='http://zuimeia.com/?page='+str(page)+'&platform=1'
r=requests.get(url)
reg=r'alt="([^"]*?) 的 icon" data-original="(http://qstatic.zuimeia.com/[^"]*?\.([^"]*?))"'
img_src=re.findall(reg,r.content)
f... | Urinx/SomeCodes | Python/others/zuimei.py | Python | gpl-2.0 | 525 |
"""
This file provides simple functions to calculate the integrated stellar number counts
as a function of limiting magnitude and galactic coordinates.
:requires: NumPy
:requires: matplotlib
:version: 0.1
:author: Sami-Matias Niemi
:contact: [email protected]
"""
import matplotlib
matplotlib.rc('text', usetex=True)
... | sniemi/EuclidVisibleInstrument | sources/stellarNumberCounts.py | Python | bsd-2-clause | 6,889 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | mohamedhagag/community-addons | openeducat_erp/op_allocat_division/__init__.py | Python | agpl-3.0 | 1,099 |
from django.contrib import admin
from .models import LastRun
# Last Run site display
class lastRunModelAdmin(admin.ModelAdmin):
"""
Override the default Django Admin website display for backup history table
"""
list_display = [
"component",
"last_run"
]
class Meta:
mod... | faisaltheparttimecoder/EMEARoster | BackgroundTask/admin.py | Python | mit | 381 |
#!/usr/bin/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.
"""Do all the steps required to build and test against nacl."""
import optparse
import os.path
import re
import shutil
import subproc... | leiferikb/bitpop-private | chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py | Python | bsd-3-clause | 11,702 |
import io
import locale
import mimetypes
import sys
import unittest
from test import support
# Tell it we don't know about external files:
mimetypes.knownfiles = []
mimetypes.inited = False
mimetypes._default_mime_types()
class MimeTypesTestCase(unittest.TestCase):
def setUp(self):
self.db = mimetypes.M... | yotchang4s/cafebabepy | src/main/python/test/test_mimetypes.py | Python | bsd-3-clause | 4,294 |
try:
import rasterio
has_rasterio = True
except:
has_rasterio = False
from functools import partial
import os
import dask
from dask.array import store
import numpy as np
threads = int(os.environ.get('GBDX_THREADS', 64))
threaded_get = partial(dask.threaded.get, num_workers=threads)
class rio_writer(obj... | DigitalGlobe/gbdxtools | gbdxtools/rda/io.py | Python | mit | 2,579 |
'''
Auto Create Input Provider Config Entry for Available MT Hardware (linux only).
===============================================================================
Thanks to Marc Tardif for the probing code, taken from scan-for-mt-device.
The device discovery is done by this provider. However, the reading of
input ca... | LogicalDash/kivy | kivy/input/providers/probesysfs.py | Python | mit | 9,117 |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | jesseengel/magenta | magenta/models/onsets_frames_transcription/onsets_frames_transcription_create_dataset_maps.py | Python | apache-2.0 | 5,250 |
"""Sprite and tile engine.
tilevid, isovid, hexvid are all subclasses of this interface.
Includes support for:
* Foreground Tiles
* Background Tiles
* Sprites
* Sprite-Sprite Collision handling
* Sprite-Tile Collision handling
* Scrolling
* Loading from PGU tile and sprite formats (optional)
* Set rate FPS (optiona... | gentooza/Freedom-Fighters-of-Might-Magic | src/gamelib/pgu/vid.py | Python | gpl-3.0 | 15,711 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.simulator.simTestCase import SimTestCase
from hwtLib.logic.bcdToBin import BcdToBin
from hwtSimApi.constants import CLK_PERIOD
def bin_to_bcd(v: int, digits: int):
_v = v
bcd = 0
for i in range(digits):
bcd |= (v % 10) << (i * 4)
v /... | Nic30/hwtLib | hwtLib/logic/bcdToBin_test.py | Python | mit | 1,922 |
"""Monkey patch lame-o vanilla unittest with test skip feature.
From the patch that was never applied (shameful!):
http://bugs.python.org/issue1034053
"""
import time
import unittest
class SkipException(Exception):
pass
def TestResult__init__(self):
self.failures = []
self.errors = []
self.skipped... | joyxu/autotest | tko/parsers/test/unittest_hotfix.py | Python | gpl-2.0 | 4,373 |
from django.db.models.sql.compiler import SQLCompiler
# This monkey patch allows us to write subqueries in the `tables` argument to the
# QuerySet.extra method. For example Foo.objects.all().extra(tables=["(SELECT * FROM Bar) t"])
# See: http://djangosnippets.org/snippets/236/#c3754
_quote_name_unless_alias = SQLCompi... | mdj2/django-arcutils | arcutils/models.py | Python | mit | 484 |
'''
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken in... | Vaibhav/InterviewPrep | LeetCode/Easy/198-House-Robber.py | Python | mit | 1,460 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: user
#
# Created: 05/08/2012
# Copyright: (c) user 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env ... | tech-srl/TRACY | graph_printer.py | Python | epl-1.0 | 1,511 |
# Copyright: (c) 2018 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import bisect
import json
import pkgutil
import re
from ansible import constants as C
from ansible... | azaghal/ansible | lib/ansible/executor/interpreter_discovery.py | Python | gpl-3.0 | 9,872 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | googlegenomics/gcp-variant-transforms | gcp_variant_transforms/libs/sample_info_table_schema_generator.py | Python | apache-2.0 | 2,538 |
#!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from math import fabs
import numpy as np
import cart_analysis_db.io.reader as db
from cart_analysis_db.utils.utilities import *
import pydot
simulation = "L500_NR_0"
mt = db.Simulation(simulation+"_mt", db_dir = "... | cavestruz/L500analysis | caps/diagnostics/mergertree/plot_full_merger_trees.py | Python | mit | 3,597 |
'''
Created on Apr 19, 2017
@author: Leo Zhong
'''
import numpy as np
import random
# m denotes the number of examples here, not the number of features
def gradientDescent(x, y, theta, alpha, m, numIterations):
xTrans = x.transpose()
for i in range(0, numIterations):
hypothesis = np.dot(x, theta)
... | LeoZ123/Machine-Learning-Practice | Regression_Problem/Losgistic_Regression.py | Python | mit | 1,332 |
# -*- python -*-
# Copyright (c) 2012 The Native Client 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 gdb_test import AssertEquals
import gdb_test
def test(gdb):
gdb.Command('break leaf_call')
gdb.ResumeAndExpectStop('cont... | cvsuser-chromium/native_client | tests/gdb/stack_trace.py | Python | bsd-3-clause | 984 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... | sputnick-dev/weboob | modules/bred/bred/browser.py | Python | agpl-3.0 | 5,970 |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... | JackKelly/neuralnilm_prototype | scripts/e189.py | Python | mit | 6,646 |
# Copyright 2016 Fortinet 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 agre... | samsu/networking-fortinet | networking_fortinet/agent/l2/openvswitch/br_tun.py | Python | apache-2.0 | 1,287 |
#!/usr/bin/env python3
from modules.pastafari.libraries.task import Task
from settings import config
import unittest, os
class TestTask(unittest.TestCase):
def test_task(self):
# You need have defined config.server_test variable
task=Task(config.server_test)
fi... | paramecio/pastafari | tests/tasktest.py | Python | gpl-2.0 | 652 |
from random import choice
import fauxfactory
import pytest
from manageiq_client.filters import Q
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.markers.env_markers.provider import ONE
from cfme.rest.gen_data import vm as _vm
from cfme.utils.log_validator import Log... | nachandr/cfme_tests | cfme/tests/infrastructure/test_vm_rest.py | Python | gpl-2.0 | 7,581 |
"find all paths from start to goal in graph"
def search(start, goal, graph):
solns = []
generate([start], goal, solns, graph) # collect paths
solns.sort(key=lambda x: len(x)) # sort by path length
return solns
def generate(path, goal, solns, graph):
state = ... | simontakite/sysadmin | pythonscripts/programmingpython/Dstruct/Classics/gsearch1.py | Python | gpl-2.0 | 814 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.