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 |
|---|---|---|---|---|---|
# Knuth-Morris-Pratt string matching
# David Eppstein, UC Irvine, 1 Mar 2002
from __future__ import generators
def KnuthMorrisPratt(text, pattern):
'''Yields all starting positions of copies of the pattern in the text.
Calling conventions are similar to string.find, but its arguments can be
lists or iterators, n... | darenr/MOMA-Art | kmp.py | Python | mit | 1,327 |
"""Errors for the docref package."""
from typing import Any
__all__ = (
"DocRefException",
"AlreadyUpToDate",
"InvNotAvailable",
"NoMoreRefs",
"Forbidden",
"InternalError",
"HTTPError",
"NotFound",
)
class DocRefException(Exception):
"""Base exception for this package."""
class ... | Tobotimus/Tobo-Cogs | docref/errors.py | Python | mit | 1,251 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
import BioClasses
import cPickle
import pysam
import scipy
def main():
# load data from the GTF pic
with open( "/home/paul/Resources/H_sapiens/test.hg19.chr.pic" ) as f:
genes = cPickle.load( f )
# iterate over a few Transcript objects
c = 0
for gene_... | polarise/python-bioclasses | test/test_Exon.py | Python | gpl-2.0 | 664 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import division
import pytes... | aringh/odl | odl/test/trafos/wavelet_test.py | Python | mpl-2.0 | 3,797 |
# 20170226 Add more additional info
import acm
import ael
import HTI_Util
import HTI_FeedTrade_EDD_Util
import fnmatch
import datetime
import os
import sys
import csv
import re
import sqlite3
import math
import glob
import win32com.client
import traceback
ael_variables = [['asofdate', 'Date', 'string', [str(ael.date_t... | frederick623/pb | fa_collateral_upload/HTI_Loan_Collateral_Automation.py | Python | apache-2.0 | 25,027 |
import datetime
from haystack.indexes import SearchIndex, CharField, DateTimeField, BooleanField, DecimalField
from haystack import site
from models import Organization, Course, Problem, Essay, EssayGrade
class BaseIndex(SearchIndex):
"""
Define a base search index class for all models. Fields text, created, ... | pombredanne/discern | freeform_data/search_indexes.py | Python | agpl-3.0 | 1,695 |
# Sacks: a video conference-meeting system
# Copyright (C) 2009 Associazione Intellicom
#
# Authors: Marcello Di Guglielmo, Daniel Donato
# info_AT_riunionidigitali.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | M0Rf30/sacks | interface/vnc/py_vncKey.py | Python | gpl-3.0 | 12,203 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | noam09/deluge-telegramer | telegramer/include/telegram/base.py | Python | gpl-3.0 | 2,572 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import sys
from gensim import utils
from gensim.models.phrases impo... | pombredanne/gensim | gensim/test/test_phrases.py | Python | lgpl-2.1 | 4,336 |
"""The tests for the REST sensor platform."""
import unittest
from pytest import raises
from unittest.mock import patch, Mock
import requests
from requests.exceptions import Timeout, MissingSchema, RequestException
import requests_mock
from homeassistant.exceptions import PlatformNotReady
from homeassistant.setup imp... | jnewland/home-assistant | tests/components/rest/test_sensor.py | Python | apache-2.0 | 12,631 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem324.py
#
# Building a tower
# ================
# Published on Sunday, 13th February 2011, 10:00 am
#
# Let f(n) represent the number of ways one can fill a 33n tower with blocks of
# 211. You're allowed to rotate the blocks in any way you like; however,
# rotati... | olduvaihand/ProjectEuler | src/python/problem324.py | Python | mit | 649 |
#!/usr/bin/env python
import dataproc
import itertools
import numpy as np
import random
import time
import sys
import tensorflow as tf
from collections import defaultdict
from ltrdnn import LTRDNN
flags = tf.flags
FLAGS = flags.FLAGS
# model related:
flags.DEFINE_integer('vocab_size', 1532783, 'vocabulary size')
fla... | kn45/LTR-DNN | train.py | Python | mit | 6,330 |
'''
mkfs.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) 2008-2009 Nikolaus Rath <Nikolaus@rath.org>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function, absolute_import
from . import CURRENT_FS_REV
from .backends.common impo... | thefirstwind/s3qloss | src/s3ql/mkfs.py | Python | gpl-3.0 | 6,665 |
from frappe import _
def get_data():
return {
'heatmap': True,
'heatmap_message': _('This is based on transactions against this Patient. See timeline below for details'),
'fieldname': 'patient',
'transactions': [
{
'label': _('Appointments and Consultations'),
'items': ['Patient Appointment', 'Cons... | indictranstech/erpnext | erpnext/healthcare/doctype/patient/patient_dashboard.py | Python | agpl-3.0 | 441 |
import sys
from pdflib_py import *
from math import sin,cos
import Image
import ImageDraw
img = Image.new("L", (3, 3))
draw = ImageDraw.Draw(img)
draw.point((0,1), fill=255)
draw.point((0,2), fill=255)
draw.point((1,0), fill=255)
draw.point((1,2), fill=255)
draw.point((2,0), fill=255)
draw.point((2,1), fill=255)
img.... | jdapena/swftools | spec/transparency.py | Python | gpl-2.0 | 2,241 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-datalake-store/azure/mgmt/datalake/store/models/data_lake_store_account.py | Python | mit | 8,543 |
# 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
# distrib... | Tesora/tesora-python-troveclient | troveclient/tests/osc/v1/fakes.py | Python | apache-2.0 | 1,045 |
#!/bin/env python
from CoaSim import *
cm = CustomMarker(0.1)
assert cm.position == 0.1
class MyMarker(CustomMarker):
def __init__(self,pos):
CustomMarker.__init__(self,pos)
def defaultValue(self):
return 1
def mutate(self, parentAllele, edgeLength):
return parentAllele+1
mm = My... | mailund/CoaSim | Python/customMarkerTest.py | Python | gpl-2.0 | 2,572 |
# This file is part of beets.
# Copyright 2015, Malte Ried.
#
# 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, modi... | andremiller/beets | beetsplug/filefilter.py | Python | mit | 2,616 |
# Copyright (C) 2013 Google Inc. 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 list of conditions and the ... | ondra-novak/blink | Tools/TestResultServer/model/testfile_test.py | Python | bsd-3-clause | 5,086 |
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v8.3.0 with dump python functionality
###### Run with DPS_lead_position_V9.py
import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM com... | andreashorn/lead_dbs | ext_libs/OSS-DBS/OSS_platform/Electrode_files/PINS_L302_profile.py | Python | gpl-3.0 | 29,062 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('food', '0004_auto_20150227_0848'),
]
operations = [
migrations.AlterModelOptions(
name='foodingredient',
... | delphcf/sis | sis/food/migrations/0005_auto_20150227_0849.py | Python | bsd-3-clause | 579 |
from .base import *
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
INSTALLED_APPS += (
'debug_toolbar.apps.DebugToolbarConfig',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
| sai-prasanna/simple-django-blog | mysite/settings/local.py | Python | mit | 278 |
#!/usr/bin/python3
#---------------------------------------------------------------------------
#
# Copyright (c) 2015, Baptiste Saleil. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 1. ... | bsaleil/lc | tools/benchtime.py | Python | bsd-3-clause | 8,755 |
## begin license ##
#
# "Meresco Components" are components to build searchengines, repositories
# and archives, based on "Meresco Core".
#
# Copyright (C) 2007-2009 SURF Foundation. http://www.surf.nl
# Copyright (C) 2007 SURFnet. http://www.surfnet.nl
# Copyright (C) 2007-2010 Seek You Too (CQ2) http://www.cq2.nl
# C... | seecr/meresco-components | test/sru/srwtest.py | Python | gpl-2.0 | 13,149 |
# -*- coding: utf-8 -*-
#
# 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
#... | sid88in/incubator-airflow | airflow/hooks/__init__.py | Python | apache-2.0 | 1,206 |
import os, sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "siteapp.settings")
from django.core.wsgi import get_wsgi_application
django_application = get_wsgi_application()
# WSGI redirect logic from
# https://github.com/GrahamDumpleton/mod_wsgi/issues/86
def application_redirect(environ, start_response, http_hos... | GovReady/govready-q | siteapp/wsgi.py | Python | gpl-3.0 | 1,013 |
#! /usr/bin/env python
"""
Arast Daemon
The Arast daemon runs on the control node.
"""
import argparse
import sys
import signal
import daemon
import logging
import lockfile
import multiprocessing
import os
import pymongo
import pika
import router
from ConfigParser import SafeConfigParser
import shock
import cloud
#... | levinas/assembly | lib/assembly/arastd.py | Python | mit | 4,544 |
#import pythonista
from scene import *
import ui, os
import numpy as np
from game_menu import MenuScene, ButtonNode
from objc_util import *
import ctypes
import sound
import time
import random
A = Action
from config import *
def replace_str(text, dic):
for x in dic:
text = text.replace(x, str(dic[x]))
... | yueqiw/ophys-game-ios | main.py | Python | gpl-3.0 | 15,932 |
# Copyright 2013 IBM Corp.
#
# 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 t... | rickerc/cinder_audit | cinder/tests/db/test_name_id.py | Python | apache-2.0 | 2,344 |
"""
Computing distances between DNA sequences based on graphical representation
of nucleotide sequences.
References:
1. Huang G, Zhou H, Li Y, Xu L. (2011) J Theor Biol. 281(1):107-12.
doi: 10.1016/j.jtbi.2011.04.003.
2. Deng M, Yu C, Liang Q et al. (2011) PLoS One. 6(3):e17293.
doi: 10.1371/... | aziele/alfpy | alfpy/graphdna.py | Python | mit | 6,192 |
from __future__ import absolute_import, division, print_function
import abc
import collections
import inspect
import pprint
import re
import struct
import six
# TODO: properly segregate the GSS in its own data structure
# rewrite this with the faster GSS modifications.
# SPPF
# Replace copying of stream data wit... | ceridwen/combinators | continuation_gll_combinators.py | Python | mit | 29,171 |
#!/usr/bin/python
import sys
import urllib
def wget(url):
ufile = urllib.urlopen(url) ## get file-like object for url
info = ufile.info() ## meta-info about the url content
if info.gettype() == 'text/html':
print 'base url:' + ufile.geturl()
text = ufile.read() ## read all its text
# print text
... | ck89119/google-python-exercises | test.py | Python | apache-2.0 | 414 |
# -*- coding: utf-8 -*-
#
# Numina documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 13 12:02:41 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | guaix-ucm/numina | doc/conf.py | Python | gpl-3.0 | 9,108 |
# Copyright 2015, 2016 OpenMarket 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 ... | matrix-org/synapse | synapse/push/push_tools.py | Python | apache-2.0 | 2,646 |
# import necessary packages
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score
import seaborn as sns
# ensure the same random numbers appear every time
np.random.seed(0)
# Design matrix
X = np.array([ [0, 0], [0, 1], [1, 0],[... | CompPhysics/MachineLearning | doc/src/week41/programs/ffnn.py | Python | cc0-1.0 | 14,943 |
#-----------------------------------------------------------------------------------
# Infer.NET IronPython example: Truncated Gaussian with different thresholds
#-----------------------------------------------------------------------------------
import infernet
infernet.setup()
from helpers import InitArray
... | JohnReid/Infer.NET-sandbox | IronPython/gaussianmixture.py | Python | mit | 3,848 |
from gi.repository import GObject
class PyGObject(GObject.GObject):
__gtype_name__ = 'PyGObject'
__gproperties__ = {
'label': (GObject.TYPE_STRING,
'label property',
'the label of the object',
'default', GObject.PARAM_READWRITE),
}
def... | jdahlin/pygobject | tests/testmodule.py | Python | lgpl-2.1 | 595 |
from collections import deque
from datetime import datetime
import logging
import shlex
import asyncio
import re
import hangups
from Core.Commands.Dispatcher import DispatcherSingleton
from Core.Commands import * # Makes sure that all commands in the Command directory are imported and registered.
from Core.Util.Uti... | ShaunOfTheLive/HangoutsBot | Core/Handlers.py | Python | gpl-3.0 | 7,585 |
"""
WSGI config for tracker project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | okin006/tracker | tracker/wsgi.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
# Copyright 2017-2019 Barroux Abbey (www.barroux.org)
# Copyright 2017-2019 Akretion France (www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class BaseConfigSettings(mo... | OCA/vertical-abbey | mass/base_config_settings.py | Python | agpl-3.0 | 793 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nds.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| makhadzi/nds | manage.py | Python | bsd-3-clause | 246 |
#coding:utf-8
from KNNDetector.KNN_Detect import *
import requests
from PIL import Image
import base64
import getpass
def login(username,passwd):
session=requests.session()
session.get('http://wsxk.hust.edu.cn/login.jsp').text
img=session.get('http://wsxk.hust.edu.cn/randomImage.action').conten... | yyxt11/CaptchaProject | KNNDetector/console.py | Python | gpl-3.0 | 1,556 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | Dev-Cloud-Platform/Dev-Cloud | dev_cloud/cc1/src/clm/migrations/0001_initial.py | Python | apache-2.0 | 11,783 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.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
#
# ... | rackerlabs/instrumented-ceilometer | ceilometer/tests/test_collector.py | Python | apache-2.0 | 6,060 |
from __future__ import absolute_import
import logging
try:
from redis import Redis
from rq import Queue
except ImportError:
Redis = None
Queue = None
from kaneda.exceptions import ImproperlyConfigured
from .base import BaseQueue
class RQQueue(BaseQueue):
"""
RQ queue
:param queue: que... | APSL/kaneda | kaneda/queues/rq.py | Python | mit | 1,504 |
"""
Comodulogram
------------
This example creates an artificial signal with phase-amplitude coupling (PAC)
and computes comodulograms with several methods.
A comodulogram shows the estimated PAC metric on a grid of frequency bands.
"""
import numpy as np
import matplotlib.pyplot as plt
from pactools import Comodulog... | RPGOne/Skynet | pactools-master/examples/plot_comodulogram.py | Python | bsd-3-clause | 1,429 |
#!/bin/python
# coding: utf-8
# Standard libraries
import logging
from sys import argv
from urlparse import urljoin
from zipfile import ZipFile
from flask import render_template, Flask, request, redirect, Response, make_response
from fest.decorators import requireformdata
import requests
from statuscodes import statu... | Smarties89/Jockle | jockle.py | Python | mit | 8,737 |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
versi... | adazey/Muzez | libs/simplejson/__init__.py | Python | gpl-3.0 | 24,273 |
# Copyright 2013 IBM Corp.
#
# 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 t... | vedujoshi/os_tempest | tempest/tests/base.py | Python | apache-2.0 | 1,611 |
# -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
yourlexer = yourmodule:YourLexer
formatter pl... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/pygments/plugin.py | Python | mit | 1,734 |
# Copyright 2014-2015 Ivan Kravets <me@ikravets.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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | bq/web2board | src/platformio/platforms/espressif.py | Python | lgpl-3.0 | 1,677 |
"""
Created on 04.07.2017
@author: Matthias Hensen
Converts the input spatial reference name to a string which is used as
parameter item by the function arcpy.SpatialReference(item).
function: convert_spatial_reference(spatial_reference)
"""
import logging
from configuration.configure_logging import create_logger... | bogeo/ChannelMeshGenerator | src/other/convert_spatial_reference.py | Python | gpl-3.0 | 1,830 |
# -*- coding: utf-8 -*-
"""This file is part of the TPOT library.
TPOT was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Weixuan Fu (weixuanf@upenn.edu)
- Daniel Angell (dpa34@drexel.edu)
- and many more generous open source contributors
TPOT is f... | PG-TUe/tpot | tpot/base.py | Python | lgpl-3.0 | 68,849 |
"""
Starts a service to scan in intervals for new devices.
Will emit EVENT_PLATFORM_DISCOVERED whenever a new service has been discovered.
Knows which components handle certain types, will make sure they are
loaded before the EVENT_PLATFORM_DISCOVERED is fired.
"""
import asyncio
import json
from datetime import time... | ewandor/home-assistant | homeassistant/components/discovery.py | Python | apache-2.0 | 5,179 |
#!/usr/bin/env python
# Copyright (c) 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.
import argparse
import collections
import fnmatch
import io
import os
import sys
VALID_TOOLCHAINS = [
'clang-newlib',
'glibc',... | nwjs/chromium.src | native_client_sdk/src/build_tools/parse_dsc.py | Python | bsd-3-clause | 8,606 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# SSDF is distributed under the terms of the (new) BSD License.
# See http://www.opensource.org/licenses/bsd-license.php
""" ssdf.ssdf_text.py
Implements functionality to read/write text ssdf files.
"""
import sys
import struct
import base64
import zlib
imp... | bblais/Classy | classy/ssdf/ssdf_text.py | Python | mit | 16,309 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Train keras CNN on the CIFAR10 small images dataset.
The model comes from: https://zhuanlan.zhihu.com/p/29214791,
and it gets to about 87% validation accuracy in 100 epochs.
Note that the script requires a machine with 4 GPUs. You
can set {"gpu": 0} to use CPUs for tra... | pcmoritz/ray-1 | python/ray/tune/examples/pbt_tune_cifar10_with_keras.py | Python | apache-2.0 | 7,072 |
class BaseStorage(object):
# Read-only (NECESSARY) methods.
def all_objects(self, request):
raise NotImplementedError()
def list(self, **kwargs):
raise NotImplementedError()
def single(self, **kwargs):
raise NotImplementedError()
# Methods needed for write-access.
def ... | toastdriven/piecrust | piecrust/storage.py | Python | bsd-3-clause | 669 |
#----------------------------------------------------------------------
# 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 ... | plantigrade/geni-tools | src/gcf/omnilib/util/omnierror.py | Python | mit | 3,086 |
"""moving_columns_to_set_member_from_gc_metrics
Revision ID: 39e65f2c8112
Revises: 7490afb4beb3
Create Date: 2020-01-21 12:20:26.145005
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '39e65f2c8112'
down_revision = '7490afb4... | all-of-us/raw-data-repository | rdr_service/alembic/versions/39e65f2c8112_moving_columns_to_set_member_from_gc_.py | Python | bsd-3-clause | 4,509 |
from coalib.bearlib.abstractions.Linter import linter
from coalib.bears.requirements.PipRequirement import PipRequirement
@linter(executable='vulture',
output_format='regex',
output_regex=r'(?P<filename>.*):(?P<line>.*):\s*(?P<message>.*)')
class VultureBear:
"""
Checks Python code for unused ... | SanketDG/coala-bears | bears/python/VultureBear.py | Python | agpl-3.0 | 847 |
from django.contrib import admin
from .models import Equipo, Grupo
admin.site.register(Equipo)
admin.site.register(Grupo)
| sn1k/app_mundial | mundial_app/equipos/admin.py | Python | gpl-2.0 | 123 |
from minpermdist_stochastic import MinPermDistCluster
from _minpermdist_policies import MeasureAtomicCluster
from permutational_alignment import optimize_permutations
from pele.utils import rotations
from pele.utils import rotations as rot
from rmsfit import findrotation
import numpy as np
# def getAlignRotation(XA, X... | khs26/pele | pele/mindist/backward_compatibility.py | Python | gpl-3.0 | 3,214 |
#!/usr/bin/env python3
import argparse
import copy
import sys
from ros_buildfarm.argument import add_argument_arch
from ros_buildfarm.argument import add_argument_build_name
from ros_buildfarm.argument import add_argument_custom_rosdep_urls
from ros_buildfarm.argument import \
add_argument_distribution_repository... | clearpathrobotics/ros_buildfarm | scripts/devel/run_devel_job.py | Python | apache-2.0 | 2,255 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
gallery = Table('gallery', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('dead', Boolean, default=ColumnDefault(False)),
Column('path', Text),
C... | seanegoodwin/PandaViewer | PandaViewer/migrate_repo/versions/002_migration.py | Python | gpl-3.0 | 951 |
import pytest
from adhocracy4.test.helpers import render_template
@pytest.mark.django_db
def test_react_polls(rf, user, poll):
request = rf.get('/')
request.user = user
template = '{% load react_polls %}{% react_polls poll %}'
context = {'request': request, 'poll': poll}
rendered = render_templa... | liqd/adhocracy4 | tests/polls/test_template_tags.py | Python | agpl-3.0 | 696 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.forms.models import ModelForm, inlineformset_factory, BaseInlineFormSet
from django import forms
from django.conf import settings
import zipfile
import mimetypes
import re
from solutions.models import Solution, SolutionFile
fr... | jkrinke/Praktomat | src/solutions/forms.py | Python | gpl-2.0 | 4,757 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
List all mounted disk partitions a-la "df -h" command.
$ python examples/disk_usage.py
Device Total Used ... | ypkang/Dato-Core | src/unity/python_deps/psutil/examples/disk_usage.py | Python | agpl-3.0 | 2,031 |
# Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ).
# This software may be distributed under the terms of the
# Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
"""
na_to_nc.py
===========
Contains the NAToNC class for converting a NASA... | eufarn7sp/egads-eufar | egads/thirdparty/nappy/nc_interface/na_to_nc.py | Python | bsd-3-clause | 3,191 |
import logging
from logging import NullHandler
logging.getLogger("protocol.http2").addHandler(NullHandler())
logging.getLogger("protocol.http2").propagate = False
logging.getLogger("tornado_ext").addHandler(NullHandler())
logging.getLogger("tornado_ext").propagate = False
logging.getLogger("tornado").addHandler(NullHa... | mike820324/microProxy | microproxy/test/__init__.py | Python | mit | 376 |
#!/usr/bin/env python
#
# Copyright (c) 2013 by Gerald Young <supersayoyin@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | yoyobuae/synfig-plugins | freeform/freeform-deform-python2.7.py | Python | gpl-2.0 | 28,264 |
"""Weight Boosting
This module contains weight boosting estimators for both classification and
regression.
The module structure is the following:
- The ``BaseAdaBoost`` base class implements a common ``fit`` method
for all the estimators in the module. Regression and classification
only differ from each other in... | florian-f/sklearn | sklearn/ensemble/weight_boosting.py | Python | bsd-3-clause | 37,959 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xnl_2_0/NameLineType.py | Python | gpl-3.0 | 977 |
from vms.models import BackupDefine
from api.decorators import api_view, request_data, setting_required
from api.permissions import IsAdminOrReadOnly
from api.utils.db import get_object
from api.vm.utils import get_vm, get_vms
from api.vm.snapshot.utils import get_disk_id, filter_disk_id
from api.vm.backup.utils impor... | erigones/esdc-ce | api/vm/backup/views.py | Python | apache-2.0 | 18,184 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 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
# ... | vlegoff/tsunami | src/secondaires/tags/__init__.py | Python | bsd-3-clause | 7,398 |
#!/usr/bin/python
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# T... | itoed/anaconda | tests/gui/outside/__init__.py | Python | gpl-2.0 | 11,323 |
import datetime
from django.test import TestCase
from tt_dailyemailblast import models
from tt_dailyemailblast.tests import factories
class DailyEmailBlastTestCase(TestCase):
def setUp(self):
self.blast_type = factories.DailyEmailBlastTypeFactory.create()
def test_unicode_output(self):
crea... | texastribune/tt_dailyemailblast | example/example_usage/tests/models.py | Python | apache-2.0 | 693 |
from paramecio.cromosoma.corefields import CharField
import re
mail_pattern=re.compile("\w[\w\.-]*@\w[\w\.-]+\.\w+")
class EmailField(CharField):
def __init__(self, name, size=1024, required=False):
super().__init__(name, size, required)
self.error_default='Error: No valid f... | paramecio/parameciofm | paramecio/cromosoma/extrafields/emailfield.py | Python | gpl-3.0 | 665 |
# module castanea.utils
from .with_none import *
| YusukeSuzuki/castanea | castanea/utils/__init__.py | Python | mit | 51 |
"""Real life review scenarios.
For different add-on and file statuses, test reviewing them, and make sure then
end up in the correct state.
"""
import pytest
import amo
import amo.tests
from addons.models import Addon
from editors import helpers
from files.models import File
from versions.models import Version
@pyt... | mdaif/olympia | apps/editors/tests/test_review_scenarios.py | Python | bsd-3-clause | 5,874 |
default_app_config = 'polymorphic_auth.usertypes.email.apps.AppConfig'
| whembed197923/django-polymorphic-auth | polymorphic_auth/usertypes/email/__init__.py | Python | mit | 71 |
# -*- coding: iso-8859-1 -*-
svg_preample =\
r'''<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'''
# See: http://groups.yahoo.com/group/svg-developers/message/48562
# svg_preample = ""
class SVG_file(object):
def __init_... | tema-tut/tema-tg | TemaLib/tema/eini/svg_base.py | Python | mit | 1,598 |
# Copyright 2014 Mirantis, 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 in writing... | koder-ua/nailgun-fcert | fuel_agent_ci/fuel_agent_ci/drivers/fabric_driver.py | Python | apache-2.0 | 3,357 |
"""
Discrete Fourier Transforms - helper.py
"""
from __future__ import division, absolute_import, print_function
import collections
try:
import threading
except ImportError:
import dummy_threading as threading
from numpy.compat import integer_types
from numpy.core import integer, empty, arange, asarray, roll
... | gfyoung/numpy | numpy/fft/helper.py | Python | bsd-3-clause | 9,718 |
"""
Specifying ordering
Specify default ordering for a model using the ``ordering`` attribute, which
should be a list or tuple of field names. This tells Django how to order
``QuerySet`` results.
If a field name in ``ordering`` starts with a hyphen, that field will be
ordered in descending order. Otherwise, it'll be ... | kaedroho/django | tests/ordering/models.py | Python | bsd-3-clause | 1,704 |
#
# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# XXX: show string offset and offending ch... | svanschalkwyk/datafari | windows/python/Lib/sre_parse.py | Python | apache-2.0 | 28,911 |
# -*- coding: utf-8 -*-
# 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
#
# Un... | google/mirandum | alerts/fanfunding/migrations/0003_auto_20160416_2023.py | Python | apache-2.0 | 2,470 |
import httplib as http
from litept import conf
def get(url, api_token):
conn = http.HTTPSConnection(conf.api_host, timeout=conf.connection_timeout)
conn.request('GET', url, headers={'X-TrackerToken': api_token})
return conn.getresponse()
def put(url, api_token, body):
conn = http.HTTPSConnection(conf.api_host, ... | lakeslc/Pivot | litept/request.py | Python | mit | 508 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ===============================================================
#
# Filename: MaximumDepthOfBinaryTree.py
#
# Author: Oxnz
# Email: yunxinyi@gmail.com
# Created: [2014-12-02 17:33:41 CST]
# Last-update: 2014-12-02 17:33:41 CST
# Description: ANCHOR
#
# Version: 0.0.1
... | oxnz/algorithms | leetcode/test_sol_38.py | Python | mit | 1,688 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------
# Copyright 2012, 2013 Arndt Droullier, Nive GmbH. All rights reserved.
#
# 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 Fr... | nive-cms/nive | nive/components/objects/base.py | Python | gpl-3.0 | 6,235 |
# -*- coding: iso-8859-1 -*-
import string
import types
import logging
import unicodedata
from fiscalGeneric import PrinterInterface, PrinterException
import epsonFiscalDriver
class FiscalPrinterError(Exception):
pass
class FileDriver:
def __init__(self, filename):
self.filename = filename
s... | eoyarzabal/fiscaldoli | pyfiscalprinter/epsonFiscal.py | Python | gpl-3.0 | 17,411 |
__author__ = 'Fabrizio Lungo<fab@lungo.co.uk>'
import os
import yaml
from __exceptions__.FileNotFound import FileNotFound
from section import ConfigurationSection
class Configuration(ConfigurationSection):
def __init__(self, fn='config.yml', name=None, create=False):
self._fn = fn
self._create ... | flungo/python-yaml-config | lib/yamlconfig/config.py | Python | mit | 821 |
# This example requires the 'message_content' privileged intent to function.
import discord
import asyncio
class MyClient(discord.Client):
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
async def on_message(self, message):
if message.... | Rapptz/discord.py | examples/edits.py | Python | mit | 792 |
#!/usr/bin/env python
import syspath
from upd89.lib.configloader import ConfigLoader
import upd89.lib.mission
import upd89.lib.log
_config = ConfigLoader(syspath.cmd_folder + "/config")
_logger = upd89.lib.log.screenLog()
upd89.lib.mission.send_system_notify_hash(_config, _logger)
| upd89/agent | tools/prod_send_system_notify_hash.py | Python | mit | 285 |
#!/usr/bin/env python2.7
# coding=utf-8
import pysftp
ftp_host = '***'
ftp_user = '***'
ftp_pass = '***'
ftp_port = '***'
def sftp_conn():
try:
# open connection to ftp server
sftp = pysftp.Connection(host=ftp_host,
username=ftp_user,
... | vsamov/sidewinder | sidewinder/utility/sftp.py | Python | mit | 565 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pyspark.ml.feature import IndexToString, StringIndexer, VectorIndexer
from pyspark.ml.feature import OneHotEncoderEstimator
from pyspark.ml.feature import VectorAssembler
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.evaluation import Binar... | qiudebo/13learn | mywork/train_churn_prediction.py | Python | mit | 5,200 |
# -*- coding: utf-8 -*-
"""
モーションインストール用CUIアプリケーション
"""
__author__ = "Kazuyuki TAKASE"
__license__ = "MIT"
__status__ = "2.0.0"
__date__ = "2015/05/22"
__email__ = "takase@plen.jp"
# 標準ライブラリのインポート
import sys
from argparse import ArgumentParser
# 自作ライブラリのインポート
sys.path.append("./lib/")
import bled112_driver
i... | IBCCW/plen2__ble_motion_installer_python | main.py | Python | mit | 1,976 |
# -*- coding: utf-8 -*-
# Scrapy settings for dianping_crawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/... | loggerhead/dianping_crawler | dianping_crawler/settings.py | Python | mit | 4,408 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to resolve double redirects, and to delete broken redirects.
Requires access to MediaWiki's maintenance pages or to a XML dump file.
Delete function requires adminship.
Syntax:
python redirect.py action [-arguments ...]
where action can be one of these:
doub... | hperala/kontuwikibot | scripts/redirect.py | Python | mit | 33,889 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.