code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from ImageData import ImageData
class StoreData(object):
def __init__(self):
self.images = list()
def Push(self, image):
self.images.append(image)
def getStoredData(self):
return self.images
| Hazecode/E-commerce-using-recommendation | DataGathering/StoreData.py | Python | mit | 231 |
# Copyright 2012 Red Hat, 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... | yanheven/neutron | neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py | Python | apache-2.0 | 6,996 |
#!/usr/bin/env python3
from __future__ import print_function
import xml.etree.ElementTree as et
import sys
for l in sys.stdin:
try:
root = et.fromstring(l.strip())
print('****PayloadData****')
data = list(root.findall('./payload/data'))[0]
for frame in data:
name = ... | usdot-jpo-ode/asn1_codec | docker-test/test_out.py | Python | apache-2.0 | 652 |
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2014 Chun-wei Fan
#
# This library 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; eithe... | anthrotype/gobject-introspection | giscanner/ccompiler.py | Python | gpl-2.0 | 16,071 |
"""
Wind Turbine Company - 2013
Author: Stephan Rayner
Email: stephan.rayner@gmail.com
"""
import time
from test.Base_Test import Base_Test
class Maintenance_153Validation(Base_Test):
def setUp(self):
self.WindSpeedValue = "4.5"
self.interface.reset()
self.interface.write("Yaw_Generation... | stephan-rayner/HIL-TestStation | Tests/e3120/Maintenance/TransitionIntoState0.py | Python | mit | 3,533 |
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license noti... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/pythonscript.py | Python | lgpl-3.0 | 39,818 |
#coding:UTF-8
"""
磁盘监控模块
"""
from config import disk
from lib import core
import os,re
def init():
"对外接口"
sign=True
for t in disk.DISK_PATH:
warn,data=check(t)
if not warn:
login_time=time.time()
message="磁盘监控预警提示,磁盘使用率超过%s"%(disk.DISK_USED)+"%\n监控结果:"+data
... | yubang/smallMonitor | lib/disk.py | Python | apache-2.0 | 903 |
"""YAContrac module
"""
import inspect
from types import FunctionType, ListType, TupleType, StringType
def exec_validator(value, validator, error_message):
"""Run validation
Checks value against validator and returns error_message
in case of failure as a ValueError
"""
if not validator(value):
... | msempere/yacontracts | src/yacontracts.py | Python | mit | 3,410 |
import datetime
import json
from threading import local
from time import time
from django.utils.encoding import force_str
from debug_toolbar import settings as dt_settings
from debug_toolbar.utils import get_stack, get_template_info, tidy_stacktrace
try:
from psycopg2._json import Json as PostgresJson
except Imp... | django-debug-toolbar/django-debug-toolbar | debug_toolbar/panels/sql/tracking.py | Python | bsd-3-clause | 7,203 |
"""Tests for 1-Wire devices connected on OWServer."""
import logging
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_validation import e... | rohitranjan1991/home-assistant | tests/components/onewire/test_binary_sensor.py | Python | mit | 2,294 |
#******************************************************************************
# TTFontFile class
#
# This class is based on The ReportLab Open Source PDF library
... | ericgriffin/fflock | web2py/gluon/contrib/fpdf/ttfonts.py | Python | apache-2.0 | 39,811 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='NotificationEmail',
fields=[
('id', models.Auto... | sinnwerkstatt/landmatrix | apps/notifications/migrations/0001_initial.py | Python | agpl-3.0 | 1,516 |
import factory
from .models import JobType, JobCategory, Job
class JobCategoryFactory(factory.DjangoModelFactory):
FACTORY_FOR = JobCategory
FACTORY_DJANGO_GET_OR_CREATE = ('name',)
name = factory.Sequence(lambda n: 'Job Category {}'.format(n))
class JobTypeFactory(factory.DjangoModelFactory):
FAC... | lsk112233/Clone-test-repo | jobs/factories.py | Python | apache-2.0 | 1,875 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license i... | etherkit/OpenBeacon2 | client/linux-arm/venv/lib/python3.6/site-packages/PyInstaller/hooks/hook-text_unidecode.py | Python | gpl-3.0 | 858 |
from pyquery import PyQuery
import requests
def main():
d = PyQuery(requests.get("http://localhost:5000/").content)
print d('h1')
if __name__ == '__main__':
main()
| matthewhughes/RSWA-Solutions | 0.0/pyquery/main.py | Python | mit | 176 |
"""
Implementation of "reverification" service to communicate with Reverification XBlock
"""
import logging
from django.core.urlresolvers import reverse
from student.models import User
from .models import SoftwareSecurePhotoVerification
log = logging.getLogger(__name__)
class VerificationService(object):
"""... | lduarte1991/edx-platform | lms/djangoapps/verify_student/services.py | Python | agpl-3.0 | 1,283 |
from datetime import timedelta
from django import template
register = template.Library()
@register.filter
def duration(value):
if not value and type(value) != timedelta:
return u''
# does not take microseconds into account
total_secs = value.seconds + value.days * 24 * 3600
mins = total_secs /... | ArchAssault-Project/archassaultweb | mirrors/templatetags/mirror_status.py | Python | gpl-2.0 | 1,057 |
'''
1.create public network with Network segment
1.1 add ipv6 address
2.check dhcp ip address
@author Antony WeiJiang
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/dhcp_server_ip/test_dhcp_for_networkSegment_ipv6.py | Python | apache-2.0 | 2,459 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LGBMClassifier" , "FourClass_500" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_500/ws_FourClass_500_LGBMClassifier_mysql_code_gen.py | Python | bsd-3-clause | 142 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | jensreeder/scikit-bio | skbio/io/_base.py | Python | bsd-3-clause | 7,311 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/objects/realm.py | Python | agpl-3.0 | 14,710 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('universidades', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='universidademodel',
... | MCRSoftwares/AcadSocial | universidades/migrations/0002_auto_20150118_1319.py | Python | gpl-2.0 | 640 |
"""
Send sample query to prediction engine
"""
import predictionio
engine_client = predictionio.EngineClient(url="http://localhost:8000")
print engine_client.send_query({"items": ["i1", "i3"], "num": 4})
| TheDataShed/PredictionIO | templates/scala-parallel-similar/data/send_query.py | Python | apache-2.0 | 205 |
# -*- test-case-name: twisted.trial.test.test_util -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""
A collection of utility functions and classes, used internally by Trial.
This code is for Trial's internal use. Do NOT use this code if you are writing
tests. It is subject to change ... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/trial/util.py | Python | gpl-2.0 | 14,239 |
#!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | googleads/googleads-shopping-samples | python/shopping/content/accounts/insert.py | Python | apache-2.0 | 1,326 |
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.rmodel import inputconst
from rpython.tool.ansi_print import AnsiLogger
from rpython.translator.simplify import get_graph
log = AnsiLogger("backendopt")
def graph_operations(graph):
for block in graph.iterblocks():
for op in block.operati... | oblique-labs/pyVM | rpython/translator/backendopt/support.py | Python | mit | 4,115 |
# Copyright (C) 2010, One Laptop Per Child
# Copyright (C) 2010, Kushal Das
#
# 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) any later ver... | godiard/pathagar | books/epubinfo.py | Python | gpl-2.0 | 3,947 |
"""
Models for User Information (students, staff, etc)
Migration Notes
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration student --auto description_of_... | antoviaque/edx-platform | common/djangoapps/student/models.py | Python | agpl-3.0 | 78,461 |
"""
Plot class.
$Id$
"""
__version__='$Revision$'
import copy
import numpy
import numpy
from numpy.oldnumeric import zeros, ones, Float, divide
from math import pi, sin, cos
import param
from topo.base.sheetcoords import SheetCoordinateSystem,Slice
from bitmap import HSVBitmap, RGBBitmap, Bitmap, DrawBitmap
#... | jesuscript/topo-mpi | topo/plotting/plot.py | Python | bsd-3-clause | 25,016 |
"""
Monitors home energy use for the eliq online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eliqonline/
"""
import logging
from urllib.error import URLError
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, STATE_UNKNOWN
... | justyns/home-assistant | homeassistant/components/sensor/eliqonline.py | Python | mit | 2,207 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012, 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:
#
# 1. Redistributions of source code must retain the above copyright no... | yiannist/ganeti | lib/server/rapi.py | Python | bsd-2-clause | 11,924 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 pr... | otsaloma/gaupol | gaupol/agents/test/test_search.py | Python | gpl-3.0 | 1,872 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from datetime import datetime, timedelta
from django.contrib.sites.models import Site
from django.test.client import RequestFactory
from treemap.models import Plot
from treemap.tests.... | kdeloach/otm-core | opentreemap/otm_comments/tests.py | Python | gpl-3.0 | 15,666 |
"""
This module contains functions for the Looking For Group comic
"""
import requests
from bs4 import BeautifulSoup
lfg_comic_url = "http://www.lfg.co/page/{}/"
cache = {}
def get(number):
"""Returns the image URL for the requested comic"""
if not number in cache:
cache[number] = fetch_comic(number... | Hubro/lfg-viewer | lib/comic_reader/lfg.py | Python | gpl-2.0 | 872 |
from scrapy_jsonschema.item import JsonSchemaItem
from scrapy_jsonschema.pipeline import JsonSchemaValidatePipeline
__version__ = "0.5.0"
| scrapy-plugins/scrapy-jsonschema | scrapy_jsonschema/__init__.py | Python | bsd-3-clause | 139 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ***********************IMPORTANT NMAP LICENSE TERMS************************
# * *
# * The Nmap Security Scanner is (C) 1996-2013 Insecure.Com LLC. Nmap is *
# * also a registered trademark of Inse... | markofu/scripts | nmap/nmap/zenmap/zenmapGUI/higwidgets/higframe.py | Python | gpl-2.0 | 10,173 |
# Copyright 2009 Google 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, ... | termie/jaikuengine | api/urls.py | Python | apache-2.0 | 1,686 |
#!/usr/bin/python
desc = """demo.py
John Donnal 2015
GPL v2 (see LICENSE)
This demonstrates some of the capabilities of the SmartEE plug control board
Usage:
1.) Control plug relay:
python demo.py --relay on 192.168.1.4
python demo.py --relay off 192.168.1.4
2.) Read met... | jdrunner/smartee | software/demo.py | Python | gpl-2.0 | 4,592 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2013 Roberto Alsina and others.
# 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 t... | damianavila/nikola | nikola/plugins/compile/pandoc.py | Python | mit | 2,605 |
from django.test.testcases import TestCase
from 臺灣言語服務.models import 訓練過渡格式
from django.core.management import call_command
class 試驗(TestCase):
def test句數正確(self):
call_command('詞彙分級')
self.assertGreater(訓練過渡格式.資料數量(), 59000)
| sih4sing5hong5/hue7jip8 | 試驗/test詞彙分級.py | Python | mit | 313 |
# coding:utf-8
#
# Copyright (c) 2010, guo.li <lycying@gmail.com>
# Site < http://code.google.com/p/seeking/ >
# All rights reserved.
# vim: set ft=python sw=2 ts=2 et:
#
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction
from plugins.webscan.adminscan import Scanner
from plugins.webscan.portscan impor... | lycying/seeking | plugins/pluginwebscan.py | Python | gpl-2.0 | 1,304 |
# Copyright 2009-2014 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster 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 3 of the License, or (at your option) any
# later ... | cjh1/StarCluster | starcluster/commands/listzones.py | Python | gpl-3.0 | 1,226 |
import unittest
import env
from src.BoardCubePool import BoardCubePool
from src import Enums
from src.MediatorResource import MediatorResource
#Unit testing framework will automatically consider any method starting with test as
#We use this and put all unit tests in a single class to use the setup feature
class TestB... | coderjz/pypandemic | tests/TestBoardCubePool.py | Python | mit | 4,421 |
"""ord_hackday URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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... | bellisk/opendata-multisearch | ord_hackday/urls.py | Python | mit | 846 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.subsystem... | qma/pants | src/python/pants/backend/python/tasks/checkstyle/plugin_subsystem_base.py | Python | apache-2.0 | 886 |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... | robtandy/AutobahnPython | examples/twisted/wamp/basic/rpc/timeservice/backend.py | Python | apache-2.0 | 1,191 |
# Google (Web)
#
# @website https://www.google.com
# @provide-api yes (https://developers.google.com/custom-search/)
#
# @using-api no
# @results HTML
# @stable no (HTML can change)
# @parse url, title, content, suggestion
import re
from flask_babel import gettext
from lxml import html, etree
fro... | misnyo/searx | searx/engines/google.py | Python | agpl-3.0 | 13,491 |
# -*- coding: utf-8 -*-
import numpy as np
import copy
from operator import attrgetter, methodcaller
from itertools import chain, product
from bisect import bisect_left
from .basis import BSplineBasis
from .utils import (
reshape, rotation_matrix, is_singleton, ensure_listlike,
check_direction, ensure_flatlis... | sintefmath/Splipy | splipy/splineobject.py | Python | gpl-3.0 | 54,514 |
from unittest import TestCase
from username.functions.check import check_username
class TestCheck_username(TestCase):
def test_normal(self):
self.assertTrue(check_username("Max.2000-up"), "Полное соответсвие")
self.assertTrue(check_username("M"), "Полное соответсвие")
self.assertTrue(check... | sergey-egv/DJandExtJSTest | username/test/test_check_username.py | Python | gpl-3.0 | 1,206 |
"""Support for sensors."""
from __future__ import annotations
from fjaraskupan import Device, State
from homeassistant.components.number import NumberEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG, TIME_MINUTES
from homeassistant.core import HomeAssi... | jawilson/home-assistant | homeassistant/components/fjaraskupan/number.py | Python | apache-2.0 | 2,306 |
# -*- coding: utf-8 -*-
"""
Holds all the information relevant to the client (addresses for instance)
"""
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
BASE_ADDRESS_TEMPLATE = \
_("""
Name: %(name)s,
Address: %(ad... | NB-Dev/django-shop | shop/addressmodel/models.py | Python | bsd-3-clause | 2,375 |
from datetime import datetime
from flask import Flask, render_template
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
app = Flask(__name__)
manager = Manager(app)
bootstrap = Bootstrap(app)
moment = Moment(app)
@app.errorhandler(404)
def page_not_f... | bt3gl/Neat-Problems-in-Python-and-Flask | USEFUL/snippets_and_examples_Flask/example_time/hello.py | Python | mit | 746 |
################################
# These variables are overwritten by Zenoss when the ZenPack is exported
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.community.MsmqMonitor"
VERSION = "1.0"
AUTHOR = "Justin Shepard"
LICENSE = "GPLv2"
NAMESPACE_PACKAGES = ['ZenPacks', 'Zen... | zenoss/ZenPacks.community.MsmqMonitor | setup.py | Python | gpl-2.0 | 2,674 |
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re # noqa
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS
class Josm_multiple(PluginMapCSS):
MAPCSS_URL = 'https://josm.openstreetmap.de/browser/josm/trunk/resources/data/validator/multiple.ma... | frodrigo/osmose-backend | plugins/Josm_multiple.py | Python | gpl-3.0 | 38,176 |
import re
import os
import tempfile
import unittest
import warnings
import pickle
import sys
import nose.config
from nose.plugins.manager import DefaultPluginManager
from nose.plugins.skip import SkipTest
from nose.plugins.prof import Profile
class TestNoseConfig(unittest.TestCase):
def test_defaults(self):
... | DESHRAJ/fjord | vendor/packages/nose/unit_tests/test_config.py | Python | bsd-3-clause | 4,551 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance wit... | kuba1/qtcreator | tests/system/suite_WELP/tst_WELP04/test.py | Python | lgpl-2.1 | 4,899 |
'''
The file verifies the request payload.
'''
class PayloadAuthenticator:
def __init__(self, payload, request):
self.payload = payload
self.request = request
self.is_authenticated = True
self.current_method = None
self.request_data = None
def authenticate(self):
... | droidlife/guardian | django_rest_guardian/payload_authenticator.py | Python | mit | 4,703 |
import YoutubeListener
import YouList
class YouTools:
def __init__(self):
print("YouTools Message: YouTools Start")
if __name__ == '__main__':
# code your scheduel
YouList.YouList()
| fxt0706/YouTools | YouTools.py | Python | gpl-3.0 | 215 |
# Copyright 2019 Fortinet, 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, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | thaim/ansible | test/units/modules/network/fortios/test_fortios_firewall_shaper_per_ip_shaper.py | Python | mit | 10,515 |
from lcapy import R, L
n = (R('R1') | L('L1')) + (R('R2') | L('L2'))
n.draw(__file__.replace('.py', '.png'))
| mph-/lcapy | doc/examples/networks/seriesparallelRL1.py | Python | lgpl-2.1 | 110 |
__author__ = 'Michael Zoorob'
# Description: Checks if questions in codebook are in text file questionnaires
# Input: List of question codes as csv file, surveys as text files in folder
# Output: CSV File with Question Codes as column 1 and the text of questions in subsequent columns
from gibberishclassifier import c... | mzoorob/LAPOP-Projects | QMatrix/get_questions.py | Python | cc0-1.0 | 6,243 |
import json
import pytest
from indy.anoncreds import prover_create_proof
from indy import error
@pytest.mark.asyncio
async def test_prover_create_proof_works(wallet_handle, prepopulated_wallet, gvt_schema_id, gvt_schema,
master_secret_id, proof_req, id_credential_1, issuer_1_... | Artemkaaas/indy-sdk | wrappers/python/tests/anoncreds/test_prover_create_proof.py | Python | apache-2.0 | 2,512 |
from __future__ import print_function
import cPickle
import itertools
import sqlite3
from os import path
import matplotlib.pyplot as plt
import numpy as np
import pylab
from scipy import stats
from sklearn.decomposition import PCA
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import LeaveO... | JustusSchwan/MasterThesis | BagOfWordsClassification.py | Python | mit | 14,313 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina, Chris Warrick and others.
# 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... | immanetize/nikola | nikola/plugins/command/orphans.py | Python | mit | 1,859 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.postgres.fields
class Migration(migrations.Migration):
dependencies = [
('survey', '0022_auto_20150423_2208'),
]
operations = [
migrations.AlterField(
... | tndatacommons/tndata_backend | tndata_backend/survey/migrations/0023_auto_20150427_1027.py | Python | mit | 3,173 |
from setuptools import setup
import os
filename = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'requirements.txt')
with open(filename, 'r') as f:
requirements = f.readlines()
description = 'Ask not what $ORG can do for you, but what you can do for $ORG'
setup(
name='asknot-ng',
version='... | sils1297/asknot-ng | setup.py | Python | gpl-3.0 | 962 |
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('sktensor', parent_package, top_path)
config.add_subpackage('tests')
return config
| mnick/scikit-tensor | sktensor/setup.py | Python | gpl-3.0 | 229 |
from .filter import DateRangeFilter # noqa
| f213/django-suit-daterange-filter | date_range_filter/__init__.py | Python | mit | 44 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#- Author : (DEK) Devendra Kavthekar
# program078:
# Please write a program to generate a list with 5 random numbers between
# 100 and 200 inclusive.
# Hints:
# Use random.sample() to generate a list of random values.
import random
def main(startLimit, endLim... | dek-odoo/python-samples | python exercises/dek_program078.py | Python | apache-2.0 | 584 |
# VERSION: 1.0
# AUTHOR: Prelude Team <support.prelude@c-s.fr>
# DESCRIPTION: Triggered by a single host being the source of an unusual amount of alerts
# Copyright (C) 2006 G Ramon Gomez <gene at gomezbrothers dot com>
# Copyright (C) 2009-2020 CS-SI <support.prelude@c-s.fr>
#
# This file is part of the Prelude-Correl... | Prelude-SIEM/prelude-correlator | rules/EventStormPlugin.py | Python | gpl-2.0 | 1,959 |
# coding=utf-8
# Copyright 2022 The Mesh TensorFlow 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 applicab... | tensorflow/mesh | mesh_tensorflow/transformer/transformer_layers_test.py | Python | apache-2.0 | 12,718 |
# Copyright 2015-2016 Open Source Robotics Foundation, 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 applicabl... | osrf/docker_templates | docker_templates/library.py | Python | apache-2.0 | 2,737 |
class Capacity():
def __init__(self, data):
self.capacity = data
def __str__(self):
return "%s" % 'Available'
def __repr__(self):
return '{}: {}'.format(self.__class__.__name__, self.capacity)
| disha94/packet-python | packet/Capacity.py | Python | lgpl-3.0 | 233 |
# Copyright (c) 2011-2014 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 agre... | swiftstack/swift | test/unit/common/middleware/s3api/__init__.py | Python | apache-2.0 | 7,238 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1... | hryamzik/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py | Python | gpl-3.0 | 4,305 |
from datetime import datetime
from rallycaster import helpers
from rallycaster import mongo
class UserService(object):
def get_user_by_id(self, user_id):
user = mongo.db.users.find_one({'_id': user_id})
return user
def get_user_by_oauth_id(self, oauth_id):
user = mongo.db.users.find_... | chiangf/rallycaster | rallycaster/users/service.py | Python | apache-2.0 | 1,171 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("XGBRegressor" , "freidman1" , "postgresql")
| antoinecarme/sklearn2sql_heroku | tests/regression/freidman1/ws_freidman1_XGBRegressor_postgresql_code_gen.py | Python | bsd-3-clause | 133 |
# apis_v1/documentation_source/campaign_news_item_save_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def campaign_news_item_save_doc_template_values(url_root):
"""
Show documentation about campaignNewsItemSave
"""
required_query_parameter_list = [
{
'name': ... | wevote/WeVoteServer | apis_v1/documentation_source/campaign_news_item_save_doc.py | Python | mit | 5,095 |
# Provide a class for authoring a simple letter. In the constructor, supply the names of
# the sender and the recipient:
# def _ _init_ _(self, letterFrom, letterTo)
# Supply a method
# def addLine(self, line)
# to add a line of text to the body of the letter. Supply a method
# def getText(self)
# that ret... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter9-Objects-and-Classes/P9_11.py | Python | mit | 1,242 |
# 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... | zhangwenyu/packages | volt/volt/openstack/common/sslutils.py | Python | apache-2.0 | 2,842 |
#!/usr/bin/env python
import json
import argparse
from flask import Flask, make_response, render_template
import app_config
from render_utils import make_context, smarty_filter, urlencode_filter
import static
app = Flask(__name__)
app.add_template_filter(smarty_filter, name='smarty')
app.add_template_filter(urlenc... | nprapps/bestsongs14 | app.py | Python | mit | 1,748 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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, or (at your op... | pculture/unisubs | apps/subtitles/urls.py | Python | agpl-3.0 | 1,775 |
import os
import tempfile
import uuid
class SharedDriveConfiguration(object):
def __init__(self, shared_drive_path, restore_dir, transfer_dir, temp_dir):
self.shared_drive_path = shared_drive_path
self.restore_dir_name = restore_dir
self.transfer_dir_name = transfer_dir
self.temp_d... | puttarajubr/commcare-hq | settingshelper.py | Python | bsd-3-clause | 3,639 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test ZMQ interface
#
from test_framework.test_framework import MateriaTestFramework
from test_framew... | materia-coin/materia | qa/rpc-tests/zmq_test.py | Python | mit | 3,264 |
from __future__ import print_function
from pySecDec.integral_interface import IntegralLibrary
import sympy as sp
# load c++ library
triangle3L = IntegralLibrary('triangle3L/triangle3L_pylink.so')
# choose integrator
triangle3L.use_Vegas(epsrel=1e-3)
# integrate
str_integral_without_prefactor, str_prefactor, str_inte... | mppmu/secdec | examples/triangle3L/integrate_triangle3L.py | Python | gpl-3.0 | 2,242 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'test_app.urls'
SECRET_KEY = 'nokey'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEST_PROJECT_APPS = (
'discover_jen... | nvbn/django-discover-jenkins | tests/test_project/settings.py | Python | bsd-3-clause | 1,325 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""NetPBM Raster Bitmap Pure-Python Image."""
import datetime
import os
import re
from json import dumps, loads
from mimetypes import guess_type
from pprint import pprint
from pathlib import Path
from random import randint
from shutil import which
from subprocess impo... | juancarlospaco/netpbm | netpbm.py | Python | gpl-3.0 | 21,359 |
import DadaBot
from DadaBot import DadaBot
import artremixer
import random
import os
import sys
usage = ("\nDadaBots this_bot usage:\n"
"*****************************************************************\n"
"| python this_bot.py [url|file.intention] [remix] [post] [clean]\n"
"******************************... | Cortexelus/dadabots | dadabots_old/chopshopshockshack.py | Python | gpl-2.0 | 6,014 |
"""Nose Plugin that supports IPython doctests.
Limitations:
- When generating examples for use as doctests, make sure that you have
pretty-printing OFF. This can be done either by setting the
``PlainTextFormatter.pprint`` option in your configuration file to False, or
by interactively disabling it with %Ppri... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/IPython/testing/plugin/ipdoctest.py | Python | mit | 31,162 |
# -*- coding: utf-8 -*-
#
# complex.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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
# (... | magnastrazh/NEUCOGAR | nest/serotonin/research/C/nest-2.10.0/extras/ConnPlotter/examples/complex.py | Python | gpl-2.0 | 5,485 |
# -*- coding: utf-8 -*-
"""
zine.plugins.blogger_feedimport
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Import from the blogger.com extended feed format.
:copyright: (c) 2010 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from zine.importers import Tag, Comme... | mitsuhiko/zine | zine/plugins/blogger_feedimport/__init__.py | Python | bsd-3-clause | 6,556 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2006 - Jonathan Matthew
#
# 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, or (at yo... | njpatel/avant-window-navigator | plugins/Rhythmbox/artdisplay-awn/Loader.py | Python | gpl-2.0 | 2,058 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
# A test case sent to me by Steve White
def f(self):
if self==1:
pass
elif self.m('fred'):
pass
elif (g==1) and (b==2):
pass
... | blueyed/coveragepy | tests/farm/annotate/src/white.py | Python | apache-2.0 | 617 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Sam Liu <sam.liu@activenetwork.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported... | hkariti/ansible | lib/ansible/modules/windows/win_file_version.py | Python | gpl-3.0 | 1,742 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... | shlomif/PySolFC | pysollib/pysolgtk/tkwrap.py | Python | gpl-3.0 | 7,432 |
from __future__ import print_function
import numpy as np
import mdtraj as md
from mdtraj.testing import eq
from mdtraj import Trajectory, lprmsd
from mdtraj._lprmsd import _munkres
from mdtraj.utils import rotation_matrix_from_quaternion, uniform_quaternion
random = np.random.RandomState(0)
def test_munkres_0():
... | rmcgibbo/mdtraj | tests/test_lprmsd.py | Python | lgpl-2.1 | 4,012 |
# Copyright 2016 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | BaluDontu/docker-volume-vsphere | esx_service/utils/auth.py | Python | apache-2.0 | 13,215 |
class Parent():
def __init__(self,last_name,eye_color):
self.last_name=last_name
self.eye_color=eye_color
def show_info(self):
print("last name "+self.last_name)
print("eye color "+self.eye_color)
class Child(Parent):
def __init__(self,last_name,eye_color,number_toys):
Parent.__init__(self,last_name,eye... | Tatvam/Python-Scripts | Inheritance.py | Python | mit | 507 |
import string
import logging
import logging.handlers
class SyslogSender:
"""Sends Syslog messages."""
def __init__(self, **kwargs):
"""Initiate Syslog server settings."""
kwargs.setdefault("syslog_server","udp://127.0.0.1:514")
# to-do: extract fields from kwargs["syslog_server"]
... | ziQ/observables | observable_importer.py | Python | gpl-3.0 | 6,668 |
#!/usr/bin/env python
# "manhole" entry point, friendlier ipython startup to remote container
__author__ = 'Dave Foster <dfoster@asascience.com>'
def main():
import sys, os, re, errno, json, socket
from pkg_resources import load_entry_point
r = re.compile('manhole-(\d+).json')
if len(sys.argv) == 2... | scionrep/scioncc | src/scripts/manhole.py | Python | bsd-2-clause | 3,942 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.