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 |
|---|---|---|---|---|---|
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import mahotas as mh
from mahotas.colors import rgb2grey
import numpy as np
# Adds a little salt-n-pep... | krahman/BuildingMachineLearningSystemsWithPython | ch10/figure13.py | Python | mit | 791 |
# event/__init__.py
# Copyright (C) 2005-2019 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
from .api import CANCEL # noqa
from .api import contains # noqa
from .api import... | skarra/PRS | libs/sqlalchemy/event/__init__.py | Python | agpl-3.0 | 596 |
import end
for i in range(3):
pass
# end is missing
| nya3jp/end | test/cases/for_ng.py | Python | apache-2.0 | 57 |
import logging
import subprocess
logging.basicConfig(level = logging.info,
format='(%(threadName)-10s) %(message)s')
def kill_leader(*args, **kwargs):
"""
kwargs['target']: Linux process to kill
kwargs['udf1']: Signal to send to pkill
"""
node = kwargs['target']
signal ... | bahadley/dtest-controller | event/mgc.py | Python | mit | 533 |
#!/usr/bin/env python
"""
Copyright 2015 Reverb Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... | ddepaoli3/magnum | magnum/common/pythonk8sclient/client/models/V1beta3_SecretList.py | Python | apache-2.0 | 2,588 |
from gensim.corpora import MmCorpus
from gensim.utils import unpickle
class MetaMmCorpusWrapper:
"""Wrapper which loads MM corpus with metadata."""
def __init__(self, filename):
self.corpus = MmCorpus(filename)
self.metadata = unpickle(filename + ".metadata.cpickle")
def __iter__(self):
... | vanam/clustering | clustering_system/corpus/MetaMmCorpusWrapper.py | Python | mit | 406 |
from numpy.testing import TestCase, run_module_suite, assert_,\
assert_raises
from numpy import random
from numpy.compat import asbytes
import numpy as np
class TestMultinomial(TestCase):
def test_basic(self):
random.multinomial(100, [0.2, 0.8])
def test_zero_probability(self):
random... | lthurlow/Network-Grapher | proj/external/numpy-1.7.0/numpy/random/tests/test_random.py | Python | mit | 23,877 |
#FLM: AT_Copy First Letter SB
from robofab.world import CurrentFont,CurrentGlyph
f = CurrentFont()
g = CurrentGlyph()
numStart=875
for gname in f.selection:
glyph = f[gname]
glyphRef = f[gname[0]]
if f[gname[0]]:
glyph.leftMargin = glyphRef.leftMargin
glyph.rightMargin = glyphRef.rightMargin
print glyphRef.... | huertatipografica/huertatipografica-fl-scripts | AT_Metrics/AT_FirstLetterSB.py | Python | apache-2.0 | 325 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 13 18:19:30 2017
@author: asus
"""
import numpy as np
import pandas as pd
#数据读取
traindata=pd.read_excel(r'training .xlsx',names = ['y','x1','x2','x3','x4','x5','x6','x7','x8','x9','x10','x11','x12'])
#数据剔除
#traindata=traindata.ix[traindata.y>1,0:]
y=traindata.iloc[0:,0... | RayleighChen/SummerVac | dou/competition.py | Python | gpl-2.0 | 1,344 |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from profiles import constants
register = template.Library()
@register.filter
@stringfilter
def access_label(value):
"""Converts an access value into a label with icon."""
ic... | SeattleAttic/HedyNet | HedyNet/profiles/templatetags/access_icons.py | Python | apache-2.0 | 994 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Syncs a database table to the `DocType` (metadata)
.. note:: This module is only used internally
"""
import re
import os
import frappe
from frappe import _
from frappe.utils... | indictranstech/internal-frappe | frappe/model/db_schema.py | Python | mit | 12,815 |
import threading
import time
class Database:
def get_dir(self, path):
pass # ret mapping list
def get_not_visited():
pass # ret list
def get_not_ok():
pass #ret list
def inset(self, path, filename, hashcode, visited, check_ok):
pass
# d... | RedFoxPi/Playground | FileCheck2.py | Python | gpl-2.0 | 1,869 |
from django_filters import FilterSet, IsoDateTimeFilter
from .models import Activity, Location, Sleep
class BaseMetricFilter(FilterSet):
"""
Base Metric Filter
"""
time_start = IsoDateTimeFilter(name='time_start', lookup_expr='gte')
time_end = IsoDateTimeFilter(name='time_start', lookup_expr='lt'... | PEKTOP/metrics-api | metrics/filters.py | Python | mit | 835 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py | Python | apache-2.0 | 13,351 |
# -*- coding: utf-8 -*-
#
# common/templatetags/replace.py
#
# Copyright (C) 2011-19 Tomáš Pecina <tomas@pecina.cz>
#
# This file is part of legal.pecina.cz, a web-based toolbox for lawyers.
#
# This application is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public Licen... | tompecina/legal | legal/common/templatetags/replace.py | Python | gpl-3.0 | 1,046 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | josenavas/QiiTa | qiita_pet/handlers/study_handlers/edit_handlers.py | Python | bsd-3-clause | 12,568 |
def count_token(query, iterable):
"""
>>> count_tokens(1, [1, 2, 3, 1])
2
"""
return sum(1 for word in iterable if word == query)
def count_prefix(query, iterable):
return sum(1 for word in iterable if word is not None and word.startswith(query))
| escherba/flaubert | tests/__init__.py | Python | mit | 273 |
import os
MONGODB_DB = 'movies'
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
REDIS_DB = 0
REDIS_HOST = ''
REDIS_PORT = 6379
HERE = os.path.abspath(os.path.dirname(__file__))
| I-NOCoder/movie-comment | config.py | Python | mit | 193 |
from server import db
from server import app
import bcrypt
class SiteUser(db.Model):
__tablename__="site_user"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128))
email = db.Column(db.String(256))
password = db.Column(db.String(256))
def get_all(self):
users... | lmregus/mywebsite | app/models/site_user.py | Python | mit | 2,192 |
# -*- 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
from sentry.utils.db import is_postgres
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and... | looker/sentry | src/sentry/south_migrations/0423_auto__add_index_grouphashtombstone_deleted_at.py | Python | bsd-3-clause | 107,099 |
from django.apps import AppConfig
class ChannelsConfig(AppConfig):
name = "channels"
verbose_name = "Channels"
def ready(self):
# Do django monkeypatches
from .hacks import monkeypatch_django
monkeypatch_django()
| shearichard/django-channels-demo | channels/channels/apps.py | Python | bsd-3-clause | 253 |
from django.conf import settings
STATUS_MAPPING = getattr(settings, 'NODESHOT_OLDIMPORTER_STATUS_MAPPING', {
'a': 'active',
'h': 'active',
'ah': 'active',
'p': 'potential',
'default': 'potential'
})
DEFAULT_LAYER = getattr(settings, 'NODESHOT_OLDIMPORTER_DEFAULT_LAYER', 1)
| sephiroth6/nodeshot | nodeshot/interop/oldimporter/settings.py | Python | gpl-3.0 | 296 |
from BaseController import BaseController
import dateutil.parser
import datetime
from twisted.internet import defer
class TopCommandsController(BaseController):
@defer.inlineCallbacks
def get(self):
return_data = dict(data=[],
timestamp=datetime.datetime.now().isoformat())
... | gleicon/RedisLive | src/api/controller/TopCommandsController.py | Python | mit | 963 |
# Copyright 2017 The Oppia 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 applicable ... | brianrodri/oppia | core/controllers/learner_playlist.py | Python | apache-2.0 | 3,764 |
"""
Author - Alex Boese Sept 2015
Purpose - Basic File manipulation for image uploads
To Do - Change Filename to describe time and/or detection of objects
"""
#!/usr/bin/env python3
import os
import shutil
import sys
import exifread
import datetime
# Open image file for reading (binary mode)
dr = sys.argv[1]
dr... | aboese/image_extemporaneous | img_org.py | Python | gpl-2.0 | 1,009 |
#!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2018 Thomas Voegtlin
#
# 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 withou... | romanz/electrum | lib/jsonrpc.py | Python | mit | 3,726 |
#!/usr/bin/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 progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f3a0c.py | Python | mit | 2,158 |
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread("/home/pi/Desktop/document-scanner/images/please.jpg",0)
img = cv2.medianBlur(img,5)
ret,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
th2 = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_MEAN_C,\
cv2.THRESH_BINARY... | agdal1125/sicp2 | document-scanner/example.py | Python | mit | 750 |
# -*- coding: utf-8 -*-
import lxml
from . import helpers
import lxml.etree as et
class Task:
"""task object"""
def __init__(self, xml_text):
etroot = et.fromstring(text=xml_text)
self.data = self.get_value_from_xml(etroot=etroot)
self.post_url = self.get_post_url(etroot=etroot)
... | crowd4u/crowd4py | crowd4py/task.py | Python | bsd-2-clause | 1,784 |
# proxy module
from enable.savage.svg.backends.null.null_renderer import *
| enthought/etsproxy | enthought/savage/svg/backends/null/null_renderer.py | Python | bsd-3-clause | 75 |
def validate_file_extension(value):
import os
from django.core.exceptions import ValidationError
ext = os.path.splitext(value.name)[1] # [0] returns path+filename
valid_extensions = ['.csv','.xlsx', '.xls']
if not ext in valid_extensions:
raise ValidationError(u'Unsupported file extension. ... | akmiller01/di-quick-vis | qv/core/validators.py | Python | gpl-2.0 | 356 |
"""
Discount API URLs
"""
from django.conf import settings
from django.conf.urls import url
from .views import CourseUserDiscount, CourseUserDiscountWithUserParam
urlpatterns = [
url(r'^course/{}'.format(settings.COURSE_KEY_PATTERN), CourseUserDiscount.as_view(), name='course_user_discount'),
url(r'^user/(?... | stvstnfrd/edx-platform | openedx/features/discounts/urls.py | Python | agpl-3.0 | 487 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework.views import exception_handler
from rest_framework.response import Response
from rest_framework import status, permissions
from django.core.exceptions import ValidationError
def custom_exception_handler(exc):
if ... | globocom/database-as-a-service | dbaas/api/base.py | Python | bsd-3-clause | 1,854 |
import numpy as np
import matplotlib.pyplot as plt
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Probe.Plot import plot
from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
# Parameters
frequency = 1e3
period = 1 / frequency
omega = 2 * np.pi * frequency
I_P... | FabriceSalvaire/PySpice | issues/issue-157-2.py | Python | gpl-3.0 | 1,077 |
import mail
def main(event, context):
"""
This function is triggered when a check-in fails. It emails a notification
to the user letting them know that they need to check in manually.
"""
confirmation_number = event['confirmation_number']
email = event['email']
first_name = event['first_n... | DavidWittman/serverless-southwest-check-in | lambda/src/handlers/check_in_failure.py | Python | mit | 1,096 |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from lyricwiki.items import LyricWikiItem
class LyricWikiSpider(CrawlSpider):
name = "timbaland" #CHANGE NAME
... | elainekmao/hiphoptextanalysis | lyricwiki-scraper/lyricwiki/spiders/timbaland_spider.py | Python | gpl-2.0 | 1,139 |
# Copyright (c) 2019 Tobias Eriksson
#
# 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, publish... | tobier/yace | tests/test_memory.py | Python | mit | 2,459 |
# coding: utf-8
import os
from tests.shared import getEmptyCol
def test_stats():
d = getEmptyCol()
f = d.newNote()
f['Front'] = "foo"
d.addNote(f)
c = f.cards()[0]
# card stats
assert d.cardStats(c)
d.reset()
c = d.sched.getCard()
d.sched.answerCard(c, 3)
d.sched.answerCa... | Arthaey/anki | tests/test_stats.py | Python | agpl-3.0 | 654 |
#!/usr/bin/python
import sys
import os
import random
import datetime
import time
import urllib
import glob
import re
sys.path.append('../')
from BeautifulSoup import MinimalSoup
from BeautifulSoup import NavigableString
from BeautifulSoup import Tag
from BeautifulSoup import Comment
from common import month_name_to_... | henare/parlparse | pyscraper/sp/parse-question-mentions.py | Python | agpl-3.0 | 11,751 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | zgchizi/oppia-uc | core/domain/privatelog_services.py | Python | apache-2.0 | 2,883 |
#!/usr/bin/env python
# Based heavily on the Bowtie 2 data manager wrapper script by Dan Blankenberg
from __future__ import print_function
import argparse
import os
import shlex
import subprocess
import sys
from json import dumps, loads
DEFAULT_DATA_TABLE_NAME = "hisat2_indexes"
def get_id_name(params, dbkey, fasta... | Delphine-L/tools-iuc | data_managers/data_manager_hisat2_index_builder/data_manager/hisat2_index_builder.py | Python | mit | 3,596 |
#!/usr/bin/env python
# This file is part of the py-boinc-plotter,
# which provides parsing and plotting of boinc statistics and
# badge information.
# Copyright (C) 2013 obtitus@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 ... | obtitus/py-boinc-plotter | pyBoincPlotter/__init__.py | Python | gpl-3.0 | 914 |
# -*- coding: utf-8 -*-
from functools import wraps
import logging
from psycopg2 import IntegrityError, OperationalError, errorcodes
import random
import threading
import time
import openerp
from openerp.tools.translate import translate
from openerp.osv.orm import except_orm
from contextlib import contextmanager
imp... | OpusVL/odoo | openerp/service/model.py | Python | agpl-3.0 | 8,160 |
n, p = int(input()), 5
total = 0
for i in range(n):
like = p // 2
total += like
p = like * 3
print(total)
| csixteen/HackerRank_Python | Algorithms/strange_advertising.py | Python | mit | 118 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_F_CI_CUST_DESC').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
sc.set... | cysuncn/python | spark/crm/PROC_F_CI_CUST_DESC.py | Python | gpl-3.0 | 42,547 |
from django.conf.urls import patterns, url, include
from rest_framework import routers
from members import views as member_views
from machines import views as machines_views
router = routers.DefaultRouter()
router.register(r'contenttypes', member_views.ContentTypeViewSet)
router.register(r'permissions', member_view... | sharestack/sharestack-api | sharestackapi/sharestackapi/apiv1.py | Python | mit | 748 |
# This file is part of trc.me.
#
# trc.me 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.
#
# trc.me is distributed in the hope that it... | kaapstorm/trc_me | src/trc_me/api/forms.py | Python | agpl-3.0 | 937 |
from guelphapi.api.models import Event
from guelphapi.api.apis.resource import LoggingModelResource
from tastypie.authentication import ApiKeyAuthentication
from tastypie.paginator import Paginator
class EventResource(LoggingModelResource):
class Meta:
queryset = Event.objects.all()
resource_name ... | NickPresta/guelphdev-api-service | guelphapi/api/apis/event.py | Python | mit | 488 |
# Copyright 2008-2014 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... | userzimmermann/robotframework-python3 | src/robot/parsing/settings.py | Python | apache-2.0 | 9,227 |
import bob.bio.spear.extractor
extractor = bob.bio.spear.extractor.CepstralExtended(
# the parameters are as specified in the paper "A Comparison of Features for Synthetic Speech Detection" by
# Md Sahidullah, Tomi Kinnunen, Cemal Hanilci
# SCFC features as per paper that compares different features
pr... | bioidiap/bob.bio.spear | bob/bio/spear/config/extractor/scfc20.py | Python | gpl-3.0 | 1,335 |
"""A pythonic alternative to pandocfilters
See:
https://github.com/sergiocorreia/panflute
"""
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | sergiocorreia/panflute | setup.py | Python | bsd-3-clause | 4,886 |
"""Undocumented Module"""
__all__ = ['BulletinBoardWatcher']
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.PythonUtil import Functor, makeList
from direct.showbase import DirectObject
class BulletinBoardWatcher(DirectObject.DirectObject):
""" This class allows you to wait for a set of p... | brakhane/panda3d | direct/src/showbase/BulletinBoardWatcher.py | Python | bsd-3-clause | 2,085 |
''' AStoreParam --- action for multiple param storing '''
from w2p.classes.actions.action import Action
class AStoreParam(Action):
''' Store entire param in processor storage.
You can store multiple parameters by this action. '''
def do(self):
super(AStoreParam, self)._add_to_result_(self.data)
| rails-to-cosmos/force | w2p/classes/actions/storeparam.py | Python | gpl-2.0 | 319 |
#!/usr/bin/env python
'''Get Pods from Kubernetes'''
__author__ = 'pjs7678@pjs7678'
import requests
import urllib3
urllib3.disable_warnings()
def main():
r = requests.get('https://10.245.1.2/api/v1beta2/pods', auth=('vagrant', 'vagrant'), verify=False)
print r.json()
if __name__ == '__main__':
main() | hancockt/python-kubernetes | examples/test.py | Python | apache-2.0 | 318 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Joseph Areeda (2015-2020)
#
# This file is part of GWpy.
#
# GWpy 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, ... | gwpy/gwpy | gwpy/cli/gwpy_plot.py | Python | gpl-3.0 | 5,121 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
def suite():
def my_import(name):
# See http://docs.python.org/lib/built-in-funcs.html#l2h-6
components = name.split('.')
try:
# python setup.py test
mod = __import__(name)
for comp in compone... | opevolution/pyboleto | tests/alltests.py | Python | bsd-3-clause | 1,147 |
# -*- coding: utf-8 -*-
{
' iw-12: Werkdruck / 090 gr / 1,30 Volumen': ' iw-12: Werkdruck / 090 gr / 1,30 Volumen',
' iw-12: Werkdruck / 090 gr / 1,30 Volumen ': ' iw-12: Werkdruck / 090 gr / 1,30 Volumen ',
' iw-13: Matt MC / 115 gr / 0,93 Volumen ': ' iw-13: Matt MC / 115 gr / 0,93 Volumen ',
' iw-2: ... | UB-Heidelberg/UBHD-OMPArthistorikum | languages/sk.py | Python | gpl-3.0 | 16,022 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 26 10:51:54 2017
@author: Johan Steunenberg <kontakt@steunenberg.de>
"""
from simplev20.oandasession import OandaSession
import unittest
import os
class TestOandaSession(unittest.TestCase):
"""
The test assumes the availability of a valid oanda key in the
en... | steunenberg/simple-v20-oanda | simplev20/test/test-oandasession.py | Python | mit | 2,307 |
"""Support for WUnderground weather service."""
import asyncio
from datetime import timedelta
import logging
import re
from typing import Any, Callable, Optional, Union
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.helpers.typing import HomeAssistantType, ConfigType
from homeassistan... | fbradyirl/home-assistant | homeassistant/components/wunderground/sensor.py | Python | apache-2.0 | 38,323 |
# © 2019 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class AccountAccount(models.Model):
_inherit = 'account.account'
circulating = fields.Boolean()
| Comunitea/CMNT_004_15 | project-addons/custom_financial_risk/models/account.py | Python | agpl-3.0 | 224 |
import re
import setuptools
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
pytest.main(self.... | bninja/pilo | setup.py | Python | isc | 1,684 |
from sklearn.cross_validation import KFold
from sklearn.cross_validation import train_test_split
from sklearn.metrics import mean_squared_error
from math import sqrt
import numpy as np
import pandas as pd
import scipy as sci
### Plotting function ###
from matplotlib import pyplot as plt
from sklearn.metrics import r... | WesleyyC/Restaurant-Revenue-Prediction | Ari/testing_grounds/Radius.py | Python | mit | 3,322 |
#!/usr/bin/env python
#
# Functions to update the metadata of WebDC3
#
# Copyright (C) 2014-2017 Javier Quinteros, GEOFON team
# <javier@gfz-potsdam.de>
#
# ----------------------------------------------------------------------
"""Functions to update the metadata for WebDC3
:Platform:
Linux
:Copyright:
... | andres-h/webdc3 | data/update-metadata.py | Python | gpl-3.0 | 14,134 |
#-*- coding: utf-8 -*-
import utils
import signals
import config
import error
from CreateDialog import CreateDialog
from ui.Ui_CreateUdpClientForm import Ui_CreateUdpClientForm
from PyQt4 import QtGui
from PyQt4 import QtCore
class CreateUdpClientDialog(CreateDialog):
def __init__(self, parent=None):
Cre... | uname/PySockDebuger | form/CreateUdpClientDialog.py | Python | apache-2.0 | 2,370 |
#!/usr/bin/python
"""Print a test spec on stdout.
Each line has parameters for a test case. The regtest.sh shell script reads
these lines and runs parallel processes.
We use Python data structures so the test cases are easier to read and edit.
"""
import optparse
import sys
#
# TEST CONFIGURATION
#
DEMO = (
#... | google/rappor | tests/regtest_spec.py | Python | apache-2.0 | 3,470 |
from __future__ import unicode_literals, division, absolute_import
import os
import logging
from path import path
from flexget import plugin
from flexget.event import event
from flexget.config_schema import one_or_more
from flexget.utils.titles.movie import MovieParser
from flexget.utils.tools import TimedDict
log =... | X-dark/Flexget | flexget/plugins/filter/exists_movie.py | Python | mit | 4,400 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CharTextArrayIndexModel',
... | DONIKAN/django | tests/postgres_tests/array_index_migrations/0001_initial.py | Python | bsd-3-clause | 855 |
import os
import re
from thefuck.utils import get_closest, replace_argument, which
from thefuck.specific.brew import get_brew_path_prefix
enabled_by_default = bool(which('brew'))
def _get_formulas():
# Formulas are based on each local system's status
try:
brew_path_prefix = get_brew_path_prefix()
... | thesoulkiller/thefuck | thefuck/rules/brew_install.py | Python | mit | 1,343 |
# -*- coding:utf-8 -*-
import os.path
import unittest
import xml.etree.ElementTree as ET
from statik.views import *
from statik.utils import add_url_path_component
from statik.filters import filter_datetime
from statik.templating import *
from jinja2 import Environment, DictLoader
TEST_SIMPLE_VIEW = """path: /
temp... | thanethomson/statik | tests/modular/test_jinja2_views.py | Python | mit | 5,681 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/import_public_api_test.py | Python | apache-2.0 | 852 |
#!/usr/bin/env python
'''
Steve Biller, March 2011
Usage: RNAseq_getpileup_directional.py
Goal: Get a pileup file for a given SAM/BAM file that can be brought into R, etc
Output: Chromosome, position, # reads mapping to + strand, # reads mapping to - strand
'''
import sys, re, pysam, os
from optparse import Optio... | cuttlefishh/papers | cyanophage-light-dark-transcriptomics/code/RNAseq_getpileup_directional.py | Python | mit | 4,586 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This module can do slight modifications to tidy a wiki page's source code.
The changes are not supposed to change the look of the rendered wiki page.
The following parameters are supported:
¶ms;
-always Don't prompt you for each replacement. Warning (see ... | hperala/kontuwikibot | scripts/cosmetic_changes.py | Python | mit | 4,828 |
# -*- coding: utf-8 -*-
import os
from future.moves.urllib.parse import quote
import uuid
import ssl
from pymongo import MongoClient
import requests
from django.apps import apps
from addons.wiki import settings as wiki_settings
from addons.wiki.exceptions import InvalidVersionError
from osf.utils.permissions import A... | mfraezz/osf.io | addons/wiki/utils.py | Python | apache-2.0 | 7,955 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2015 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program 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,... | ndp-systemes/odoo-addons | fix_negative_landed_costs/__openerp__.py | Python | agpl-3.0 | 1,454 |
#!/usr/bin/env python
from __future__ import print_function
from unbound import ub_ctx, RR_TYPE_A, RR_TYPE_RRSIG, RR_TYPE_NSEC, RR_TYPE_NSEC3
import ldns
def dnssecParse(domain, rrType=RR_TYPE_A):
print("Resolving domain", domain)
s, r = resolver.resolve(domain)
print("status: %s, secure: %s, rcode: %s, ha... | chantra/unbound | libunbound/python/examples/dnssec_test.py | Python | bsd-3-clause | 1,392 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.3)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x16\x86\
\x00\
\x00\xa2\xe5\x78\x9c\xdd\x3d\x6b\x73\xdb\xb6\xb2\xdf\xf5\x2b\x90\
\xe4\x8b\xd3\x6... | msaadat/paper | qdarkstyle/pyqt5_style_rc.py | Python | gpl-3.0 | 101,802 |
import asyncio
from stator import http, redis, loop, aio
def main():
loop = asyncio.get_event_loop()
red = aio.Redis(port=3001)
@asyncio.coroutine
def dispatch(loop, req):
n = yield from red.execute([b"INCR", b"hello-world-counter"])
req.reply(
[200, u"OK"],
{u... | tailhook/stator | examples/redis_asyncio.py | Python | apache-2.0 | 604 |
from django import template
from django.contrib.gis.geos import Point
from classytags.arguments import Argument
from classytags.core import Options
from classytags.helpers import AsTag
from ..models import Boundary
register = template.Library()
class BaseGetBoundaryTag(AsTag):
"""
A base tag for finding t... | ebrelsford/django-inplace | inplace/boundaries/templatetags/boundaries_tags.py | Python | gpl-3.0 | 2,972 |
# tests common to dict and UserDict
import unittest
import collections
class BasicTestMappingProtocol(unittest.TestCase):
# This base class can be used to check that an object conforms to the
# mapping protocol
# Functions that can be useful to override to adapt to dictionary
# semantics
... | Orav/kbengine | kbe/src/lib/python/Lib/test/mapping_tests.py | Python | lgpl-3.0 | 22,673 |
from itertools import product
import matplotlib.pyplot as plt
from neupy import algorithms, utils, init
from utils import plot_2d_grid, make_circle, make_elipse, make_square
plt.style.use('ggplot')
utils.reproducible()
if __name__ == '__main__':
GRID_WIDTH = 4
GRID_HEIGHT = 4
datasets = [
mak... | itdxer/neupy | examples/competitive/sofm_compare_weight_init.py | Python | mit | 1,754 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
from pyasn1.error import PyAsn1Error
from pysnmp.error import PySnmpError
class SmiError(PySnmpError, PyAsn1Error):
pass
class MibLoadError(SmiError):
... | etingof/pysnmp | pysnmp/smi/error.py | Python | bsd-2-clause | 2,507 |
from network_attribute import NetworkAttribute
from network_component import NetworkComponent
| xii/xii | src/xii/builtin/components/network/__init__.py | Python | apache-2.0 | 95 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
from pip.req import parse_requirements
setup(
name="flask-boilerplate",
author="Jerzy Pawlikowski",
version="1.0.0",
py_modules=["app"],
install_requires=parse_requirements("requirements.txt")
)
| jurekpawlikowski/flask-boilerplate | setup.py | Python | mit | 296 |
from glioma.containers import Map, List, Set
from glioma.option import Option, Some, Nothing
from glioma.either import Left, Right
#from glioma_extras import match
from collections import namedtuple
import pytest
def timestwo(x) : return x * 2
def lessten(x) : return x < 10
def test_option():
asse... | Nexus6/Glioma | tests.py | Python | apache-2.0 | 18,658 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | askulkarni2/ansible | lib/ansible/vars/__init__.py | Python | gpl-3.0 | 24,362 |
import pytest
from lightbus import Api, Event
from lightbus.api import ApiRegistry
from lightbus.exceptions import (
MisconfiguredApiOptions,
InvalidApiEventConfiguration,
InvalidApiRegistryEntry,
UnknownApi,
)
pytestmark = pytest.mark.unit
@pytest.fixture()
def SimpleApi():
class SimpleApi(Api)... | adamcharnock/lightbus | tests/test_api.py | Python | apache-2.0 | 2,704 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | quantumlib/OpenFermion-Cirq | openfermioncirq/contrib/__init__.py | Python | apache-2.0 | 675 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-08 15:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cattle', '0004_auto_20170108_1625'),
]
operations = [
migrations.AlterField... | rmlivesales/Django-Reference | cattle/migrations/0005_auto_20170108_1703.py | Python | gpl-3.0 | 1,246 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | usc-isi/horizon-old | horizon/horizon/dashboards/nova/security_groups/panel.py | Python | apache-2.0 | 1,009 |
# -*- coding: utf-8 -*-
import os
import requests
import time
import math
import datetime
import random
import envoy
import jsonfield
import logging
import urllib
from collections import defaultdict
from magic_repr import make_repr
from hashlib import md5, sha1
from django.db import models
from django.db.models import... | AllMyChanges/allmychanges.com | allmychanges/models.py | Python | bsd-2-clause | 55,463 |
from django.core.management import color
from django.db import models
from common import BaseEvolutionOperations
TEMP_TABLE_NAME = 'TEMP_TABLE'
class EvolutionOperations(BaseEvolutionOperations):
def delete_column(self, model, f):
output = []
field_list = [field for field in model._meta.local_fi... | clones/django-evolution | django_evolution/db/sqlite3.py | Python | bsd-3-clause | 8,279 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011 CERN.
#
# Invenio 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) any later... | Panos512/invenio | modules/bibauthorid/lib/bibauthorid_webauthorprofileinterface.py | Python | gpl-2.0 | 4,128 |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.tbtools
~~~~~~~~~~~~~~~~~~~~~~
This module provides various traceback related utility functions.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import re
import os
import sys
import json
import inspect
import ... | 0x19/werkzeug | werkzeug/debug/tbtools.py | Python | bsd-3-clause | 16,785 |
# -*- 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):
# Adding field 'Surcharge.order_surcharge'
db.add_column('orders_surcharg... | oliverdrake/ucbc | orders/migrations/0023_auto__add_field_surcharge_order_surcharge.py | Python | mit | 8,156 |
from io import StringIO
from test.json_tests import PyTest, CTest
class TestDump:
def test_dump(self):
sio = StringIO()
self.json.dump({}, sio)
self.assertEqual(sio.getvalue(), '{}')
def test_dumps(self):
self.assertEqual(self.dumps({}), '{}')
def test_encode... | harmy/kbengine | kbe/res/scripts/common/Lib/test/json_tests/test_dump.py | Python | lgpl-3.0 | 751 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2020, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Tests for Conversion Units
######################################
"""
from exa.util import conversions, constants
import numpy as np
def test_attrs():
assert hasattr(convers... | exa-analytics/exa | exa/util/tests/test_conversions.py | Python | apache-2.0 | 1,067 |
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
from app.models import Project
from app.utils import SelectAllLineEdit
from app.dbmanager import DBManager
from app.utils import event_register
class ProjectForm(QtGui.QWidget):
def __init__(self, editmode = False):
QtGui.QWidget.__init__(self)... | davekr/pyshuffle | app/forms/project.py | Python | mit | 3,647 |
# Generated by Django 2.2.13 on 2020-09-23 19:54
from django.db import migrations
def migrate_existing_submitters_to_privliged(apps, schema_editor):
group_memebers = apps.get_model('core', 'GroupMember')
all_submitters = group_memebers.objects.filter(access='submitter').all()
for member in all_submitters... | Linaro/squad | squad/core/migrations/0136_migrate_submitters_to_privileged.py | Python | agpl-3.0 | 675 |
# -*- 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):
# Adding model 'UserMessages'
db.create_table(u'user_management_usermessa... | katembu/world-cup | world_cup/user_management/migrations/0002_auto__add_usermessages.py | Python | mit | 5,287 |
# overloadSelfArmorDamageAmountDurationBonus
#
# Used by:
# Modules from group: Ancillary Armor Repairer (4 of 4)
# Modules from group: Armor Repair Unit (105 of 105)
type = "overheat"
def handler(fit, module, context):
module.boostItemAttr("duration", module.getModifiedItemAttr("overloadSelfDurationBonus"))
... | Ebag333/Pyfa | eos/effects/overloadselfarmordamageamountdurationbonus.py | Python | gpl-3.0 | 468 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.