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 __future__ import unicode_literals
from django.db import models
from django.utils import six
from account.conf import settings
HAS_SOUTH = True
try:
from south.modelsinspector import add_introspection_rules
except ImportError:
HAS_SOUTH = False
class TimeZoneField(six.with_metaclass(models.SubfieldBas... | Amechi101/indieapp | account/fields.py | Python | mit | 739 |
#!/usr/bin/env python3
import timeit
import multisecret.MultiSecretRoyAdhikari as RA
import multisecret.MultiSecretLinYeh as LY
import multisecret.MultiSecretHerranzRuizSaez as HRS
TEST_HRS = 1
if __name__ == "__main__":
""" Measure time performance of multi-secret sharing algorithms """
prime = 2 ** 2... | Qbicz/multi-secret-sharing | python/time-performance.py | Python | mit | 2,062 |
import Adafruit_BBIO.PWM as PWM
import time
pin = "P8_13"
#PWM.start(channel, duty, freq=2000, polarity=0)
#duty values are valid 0 (off) to 100 (on)
PWM.start(pin, 50)
#PWM.set_duty_cycle(pin, 25.5)
#PWM.set_frequency(pin, 10)
for i in range(0,100):
print i
PWM.set_duty_cycle(pin,i)
time.sleep(0.1)
time.sleep(5... | reiser4/amc | test/test-pwm.py | Python | gpl-2.0 | 410 |
#!/bin/python
import sys
def getSumOfAP(n, max):
size = (max - 1) // n
return (size * (n + size * (n)) / 2)
def getSumOfMultiples(n):
return (getSumOfAP(3, n) + getSumOfAP(5, n) - getSumOfAP(15, n))
def main():
numInputs = int(raw_input().strip())
for idx in xrange(numInputs):
n = int... | pavithranrao/projectEuler | projectEulerPython/problem001.py | Python | mit | 429 |
"""Config flow for the SolarEdge platform."""
from requests.exceptions import ConnectTimeout, HTTPError
import solaredge
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_API_KEY, CONF_NAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.ut... | leppa/home-assistant | homeassistant/components/solaredge/config_flow.py | Python | apache-2.0 | 3,551 |
from unittest import TestCase
import json.encoder
CASES = [
(u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>',
'"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>"'),
(u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123... | billygoo/dev-365 | python/just_coding/Lib/json/tests/test_encode_basestring_ascii.py | Python | gpl-2.0 | 1,934 |
# $HeadURL: $
''' LogPolicyResultAction
'''
from DIRAC import S_OK, S_ERROR
from DIRAC.ResourceStatusSystem.PolicySystem.Actions.BaseAction import BaseAction
from DIRAC.ResourceStatusSystem.Utilities import Utils
ResourceManagementClient = ge... | arrabito/DIRAC | ResourceStatusSystem/PolicySystem/Actions/LogPolicyResultAction.py | Python | gpl-3.0 | 2,914 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-06 14:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.fields
import wagtail.wagtailembeds.blocks
import wagtail.wagtailimages.blocks... | Uncaught-Exceptions/minedash | wiki/migrations/0001_initial.py | Python | gpl-2.0 | 9,625 |
###############################################################################
# Name: misc/gdb/print.py
# Purpose: pretty-printers for wx data structures: this file is meant to
# be sourced from gdb using "source -p" (or, better, autoloaded
# in the future...)
# Author: ... | adouble42/nemesis-current | wxWidgets-3.1.0/misc/gdb/print.py | Python | bsd-2-clause | 3,484 |
import cv2
import numpy as np
import pascal
from keras import backend as K
nb_train_samples = 3000 # 3000 training samples
nb_valid_samples = 100 # 100 validation samples
num_classes = 20
def load_pascal_data(version="VOC2007"):
# Load cifar10 training and validation sets
(X_train, Y_train), (X_valid, Y_val... | whoisever/vgg16_finetune_mutli_label | load_pascal.py | Python | mit | 1,652 |
"""
WSGI config for quizshowdown 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quizshowdown.settings")
from dja... | thoreg/quiz | quizshowdown/quizshowdown/wsgi.py | Python | mit | 399 |
# -*- coding: utf-8 -*-
#
# 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
... | KL-WLCR/incubator-airflow | airflow/api/auth/backend/deny_all.py | Python | apache-2.0 | 834 |
# coding=utf-8
"""
The Click Detail Report Members API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/click-details/members/
Schema: https://api.mailchimp.com/schema/3.0/Reports/ClickDetails/Members/Instance.json
"""
from __future__ import unicode_literals
from mailch... | charlesthk/python-mailchimp | mailchimp3/entities/reportclickdetailmembers.py | Python | mit | 3,016 |
import json
import pathlib
import sys
import boto3
dist_folder = pathlib.Path.cwd() / 'dist'
try:
f = next(dist_folder.glob('*.whl'))
except StopIteration:
print("No .whl files found in ./dist!")
sys.exit()
print("Uploading", f.name)
s3 = boto3.client('s3')
s3.upload_file(str(f), 'releases.wagtail.io',... | kaedroho/wagtail | scripts/nightly/upload.py | Python | bsd-3-clause | 615 |
# Copyright 2013 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... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/openstack/common/report/views/xml/generic.py | Python | gpl-2.0 | 3,115 |
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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... | biosustain/cameo | cameo/api/hosts.py | Python | apache-2.0 | 2,939 |
# -*- coding: utf-8 -*-
"""
sphinx.transforms
~~~~~~~~~~~~~~~~~
Docutils transforms used by Sphinx when reading documents.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import nodes
from docutils.transforms import Transf... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/transforms/__init__.py | Python | apache-2.0 | 7,389 |
# -*- 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 'Instance.read_only'
db.add_column(u'physical_instance', '... | globocom/database-as-a-service | dbaas/physical/migrations/0035_auto__add_field_instance_read_only.py | Python | bsd-3-clause | 12,823 |
import imp
import os
import logging
from phoneslack.triggers import *
from phoneslack.actions import *
from phoneslack.actions.manager import MessageManager
from threading import Thread
from Queue import Queue
import sys
from ConfigParser import SafeConfigParser as ConfigParser
from traceback import print_exc
__all__ =... | robscetury/phoneslack | lib/phoneslack/__init__.py | Python | mit | 1,408 |
# -*- coding: utf-8 -*-
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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/... | kiall/designate-py3 | designate/tests/test_central/test_service.py | Python | apache-2.0 | 113,441 |
"""empty message
Revision ID: 2345bfa569f
Revises: 202f38341bd
Create Date: 2015-11-22 20:49:52.248358
"""
# revision identifiers, used by Alembic.
revision = '2345bfa569f'
down_revision = '202f38341bd'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | DanCardin/nosferatu | migrations/versions/2345bfa569f_.py | Python | apache-2.0 | 842 |
# -*- coding: utf-8 -*-
"""
These the test the public routines exposed in types/common.py
related to inference and not otherwise tested in types/test_common.py
"""
import collections
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from fractions import Fraction
from numbers import Num... | GuessWhoSamFoo/pandas | pandas/tests/dtypes/test_inference.py | Python | bsd-3-clause | 48,913 |
# Copyright (c) 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, ... | Mirantis/pumphouse | pumphouse/task.py | Python | apache-2.0 | 1,003 |
__title__ = "betfairlightweight"
__description__ = "Lightweight python wrapper for Betfair API-NG"
__url__ = "https://github.com/liampauling/betfair"
__version__ = "2.16.0"
__author__ = "Liam Pauling"
__license__ = "MIT"
| liampauling/betfair | betfairlightweight/__version__.py | Python | mit | 221 |
__author__ = "William Clyde"
__copyright__ = "Copyright 2016, William Clyde"
__license__ = "MIT"
| BillClyde/safenetfs | safenet/__init__.py | Python | mit | 97 |
# Copyright 2013 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 ... | github-borat/cinder | cinder/api/contrib/scheduler_hints.py | Python | apache-2.0 | 1,964 |
import pytest
from django.urls import reverse
from gamification.models import CourseGamificationEvent, \
MediaGamificationEvent, \
ActivityGamificationEvent
from oppia.test import OppiaTestCase
from oppia.models import Course, CoursePublishingLog, Quiz, A... | DigitalCampus/django-oppia | tests/test_course_upload.py | Python | gpl-3.0 | 14,057 |
import numpy as np
import pytest
from ogusa import demographics
def test_get_pop_objs():
"""
Test of the that omega_SS and the last period of omega_path_S are
close to each other.
"""
E = 20
S = 80
T = int(round(4.0 * S))
start_year = 2018
(omega, g_n_ss, omega_SS, surv_rate, rho,... | OpenSourcePolicyCenter/dynamic | ogusa/tests/test_demographics.py | Python | mit | 2,783 |
default_app_config = 'cms_articles.import_wordpress.apps.CmsArticlesImportWordpressConfig'
| misli/django-cms-articles | cms_articles/import_wordpress/__init__.py | Python | bsd-3-clause | 91 |
#!/usr/bin/env python
from __future__ import print_function
import sys
from os import environ
from os.path import dirname, join, pardir, abspath, exists
import subprocess
import nose
def fetch_es_repo():
# user is manually setting YAML dir, don't tamper with it
if 'TEST_ES_YAML_DIR' in environ:
retur... | brunobell/elasticsearch-py | test_elasticsearch/run_tests.py | Python | apache-2.0 | 2,255 |
"""SCons.Tool.fortran
Tool-specific initialization for a generic Posix f77/f90 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20... | unigent/OpenWrt-Firefly-SDK | staging_dir/host/lib/scons-2.3.1/SCons/Tool/fortran.py | Python | gpl-2.0 | 2,068 |
from yowsup.layers.protocol_messages.protocolentities.attributes.attributes_downloadablemedia import \
DownloadableMediaMessageAttributes
class AudioAttributes(object):
def __init__(self, downloadablemedia_attributes, seconds, ptt, streaming_sidecar=None):
# type: (DownloadableMediaMessageAttributes, ... | tgalal/yowsup | yowsup/layers/protocol_messages/protocolentities/attributes/attributes_audio.py | Python | gpl-3.0 | 1,964 |
# -*- coding: utf-8 -*-
# czat/views.py
from django.shortcuts import render
# from django.http import HttpResponse
def index(request):
"""Strona główna aplikacji."""
# return HttpResponse("Witaj w aplikacji Czat!")
return render(request, 'czat/index.html')
| koduj-z-klasa/python101 | docs/webdjango/czat1/views_z2.py | Python | mit | 274 |
"""Modularity matrix of graphs.
"""
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ["modularity_matrix", "directed_modularity_matrix"]
@not_implemented_for("directed")
@not_implemented_for("multigraph")
def modularity_matrix(G, nodelist=None, weight=None):
r"""Returns the modulari... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/linalg/modularitymatrix.py | Python | gpl-3.0 | 4,394 |
"""
Builds sumatra and uploads results to s3 for easy analysis, viewable at:
http://kjkpub.s3.amazonaws.com/sumatrapdf/buildbot/index.html
"""
import sys
import os
# assumes is being run as ./scripts/buildbot.py
efi_scripts_dir = os.path.join("tools", "efi")
sys.path.append(efi_scripts_dir)
import shutil
im... | ibb-zimmers/betsynetpdf | sumatrapdf/scripts/buildbot.py | Python | gpl-3.0 | 21,187 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import warnings
from distutils.version import LooseVersion
import pytest
import numpy as np
from astropy import __minimum_asdf_version__
asdf = pytest.importorskip('asdf', minversion=__minimum_asdf_version__)
from asdf import ut... | stargaser/astropy | astropy/io/misc/asdf/tags/transform/tests/test_transform.py | Python | bsd-3-clause | 7,934 |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
""":class:`TimestampedModel` tests."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all_... | cloudbase/maas | src/maasserver/models/tests/test_timestampedmodel.py | Python | agpl-3.0 | 2,803 |
from django.contrib import admin
from charcoallog.investments.models import NewInvestment, NewInvestmentDetails
class NewInvestmentModelAdmin(admin.ModelAdmin):
list_display = ('user_name', 'date', 'money', 'kind', 'tx_op', 'brokerage')
readonly_fields = ('user_name',)
search_fields = ('date',)
date_... | hpfn/charcoallog | charcoallog/investments/admin.py | Python | gpl-3.0 | 915 |
#!/usr/bin/env python
"""Tests for HTTP API."""
import json
from grr.gui import api_aff4_object_renderers
from grr.gui import api_call_renderers
from grr.gui import http_api
from grr.lib import flags
from grr.lib import registry
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.rdfvalues import s... | pchaigno/grr | gui/http_api_test.py | Python | apache-2.0 | 6,014 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-11 12:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contributions', '0006_auto_20170711_1302'),
]
oper... | stadtgestalten/stadtgestalten | grouprise/features/contributions/migrations/0007_auto_20170711_1430.py | Python | agpl-3.0 | 867 |
import os
import traceback
from time import time, gmtime, strftime
from datetime import date
from commands import getstatusoutput, getoutput
from shutil import copy2
from PilotErrors import PilotErrors
from pUtil import tolog, readpar, timeStamp, getBatchSystemJobID, getCPUmodel, PFCxml, updateMetadata, addSkippedToPF... | mlassnig/pilot | PandaServerClient.py | Python | apache-2.0 | 49,522 |
"""Script to generate reports on translator classes from Doxygen sources.
The main purpose of the script is to extract the information from sources
related to internationalization (the translator classes). It uses the
information to generate documentation (language.doc,
translator_report.txt) from templates (l... | TextusData/Mover | thirdparty/doxygen-1.8.4/doc/translator.py | Python | gpl-3.0 | 86,697 |
import hashlib
import logging
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import func, Column, Integer, String, DateTime
from sqlalchemy.exc import SQLAlchemyError
from political_data import PoliticalData
data = PoliticalData()
db = SQLAlchemy()
class Call(db.Model):
_... | credo-action/call-congress-for-credo | models.py | Python | agpl-3.0 | 4,827 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Get rietveld stats about the review you done, or forgot to do.
Example:
- my_reviews.py -r me@chromium.org -Q for stats for ... | coreos/depot_tools | my_reviews.py | Python | bsd-3-clause | 11,079 |
################################
# 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.example.Techniques"
VERSION = "1.4.1"
AUTHOR = "Chet Luther"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.exa... | anksp21/Community-Zenpacks | ZenPacks.example.Techniques/setup.py | Python | gpl-2.0 | 2,673 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | gooddata/openstack-nova | api-guide/source/conf.py | Python | apache-2.0 | 9,312 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | fdvarela/odoo8 | openerp/addons/base/res/res_currency.py | Python | agpl-3.0 | 13,459 |
# encoding: UTF-8
from ctaBase import *
from ctaTemplate import CtaTemplate
import talib
import numpy as np
import math
import copy
from datetime import datetime
########################################################################
class Tmm2agStrategy(CtaTemplate):
className = 'Tmm2agStrategy'
author... | mumuwoyou/vnpy-dev | vn.trader/ctaStrategy/strategy/strategyTmm2ag.py | Python | mit | 18,603 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mutations', '0005_mutation_predictor'),
]
operations = [
migrations.AddField(
model_name='strainsource',
... | IQSS/gentb-site | apps/mutations/migrations/0006_strainsource_wgs_group.py | Python | agpl-3.0 | 478 |
#!/usr/bin/env python
"""
Simple wrapper around the ipinfo.io IP geolocation API.
"""
import json
import subprocess as sp
class IPLookupError(Exception):
pass
class IPLookup(object):
def __init__(self):
pass
def lookup(self, ip_address, param=None):
"""
Returns a diction... | mossberg/pyipinfoio | pyipinfoio/pyipinfoio.py | Python | mit | 1,120 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | annarev/tensorflow | tensorflow/python/debug/lib/debug_v2_ops_test.py | Python | apache-2.0 | 30,444 |
'''
module for loading/saving waypoints
'''
import mavutil, time, copy
import logging
import mavutil
try:
from google.protobuf import text_format
import mission_pb2
HAVE_PROTOBUF = True
except ImportError:
HAVE_PROTOBUF = False
class MAVWPError(Exception):
'''MAVLink WP error class'''
def __i... | owenson/ardupilot-sdk-python | pymavlink/mavwp.py | Python | lgpl-3.0 | 14,030 |
from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
def cnn(num_classes):
import mxnet as mx
data = mx.symbol.Variable('data')
inputdropout = mx.symbol.Dro... | mathemage/h2o-3 | h2o-py/tests/testdir_algos/deepwater/pyunit_custom_cnn_mnist_deepwater.py | Python | apache-2.0 | 2,751 |
from yapsy.IPlugin import IPlugin
from logbook.Importer import Plugin
from messages import TimeSeriesData,TimeSeriesMetaData,LogMetaData,UIData,TimeSeries
from sqlalchemy import *
import logging
from tools.profiling import timing
from PyQt5.QtWidgets import QLabel, QFormLayout, QLineEdit
#from PyQt5 import QtCor... | romses/FitView | logbook/Importer/running.py | Python | bsd-3-clause | 6,955 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_rich_string08.py | Python | bsd-2-clause | 1,080 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | tests/dag_processing/test_manager.py | Python | apache-2.0 | 35,343 |
from Tkinter import *
import ttk
def calculate(*args):
try:
value = float(feet.get())
meters.set((0.3048 * value * 10000.0 + 0.5)/10000.0)
except ValueError:
print "Error occured."
root = Tk()
root.title("Feet to Meters")
mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.... | erickmusembi/Robot-Project | Robot Project/tests/foot to meters.py | Python | mit | 1,123 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (C) 2009-2010 Nicolas P. Rougier
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
# -------------... | davidcox/glumpy | glumpy/shader/__init__.py | Python | bsd-3-clause | 2,497 |
import os
import re
import requests
import time
import urllib
from bs4 import BeautifulSoup
from selenium import webdriver
class Taolvlang(object):
def __init__(self,driver,homePage,outputDir):
self.driver = driver
self.homePage = homePage
self.outputDir = outputDir
def get_detail_img... | Mr-meet/PythonApplets | spiders_packege/taobao_girl/temp.py | Python | mit | 3,584 |
# 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 ... | vulcansteel/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/setup.py | Python | mit | 1,142 |
#!/bin/python
# Single pass with lookahead solution.
#
# The worst-case scenario runs in quadratic time
# O(sum(i^2, i=0..|input|-1))-time,
# which is equivalent to O(|input|^2)-time, whereas the best case obviously
# runs in O(|input|)-time. Moreover, it stands in linear-space complexity,
# O(|input|)-space, across... | cassiopagnoncelli/hacker-rank-solutions | reverse.py | Python | mit | 780 |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 19 10:57:30 2016
@author: jmaunon
"""
# 10 minutes to pandas
#==============================================================================
#%% Libraries
#==============================================================================
import pandas as pd
... | juanmixp/Pandas | 10_min_tutorial/10_min_pandas.py | Python | gpl-3.0 | 1,338 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Acehaidrey/incubator-airflow | airflow/providers/google/ads/example_dags/example_ads.py | Python | apache-2.0 | 2,835 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | eadgarchen/tensorflow | tensorflow/python/ops/nn_impl.py | Python | apache-2.0 | 53,908 |
from django import forms
class LoginForm(forms.Form):
login = forms.CharField(max_length=255)
password = forms.CharField(widget=forms.PasswordInput())
target = forms.CharField()
| sstacha/uweb-install | cms_files/forms.py | Python | apache-2.0 | 192 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
NAME = 'recognizers-text-suite'
VERSION = '1.0.0.a0'
REQUIRES = ['recognizers-tex... | matthewshim-ms/Recognizers-Text | Python/libraries/recognizers-suite/setup.py | Python | mit | 1,126 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from random import randrange
from h2o.frame import H2OFrame
from h2o.utils.typechecks import assert_is_type
def h2o_H2OFrame_head():
"""
Python API test: h2o.frame.H2OFrame.head(rows=10, c... | spennihana/h2o-3 | h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame_head.py | Python | apache-2.0 | 921 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | binhqnguyen/lena-local | src/wimax/bindings/modulegen__gcc_ILP32.py | Python | gpl-2.0 | 757,508 |
from crystal_filter_middleware.handlers import CrystalBaseHandler
from swift.common.swob import HTTPMethodNotAllowed
from swift.common.wsgi import make_subrequest
from swift.common.utils import public
import operator
import json
import copy
import urllib
import os
import re
mappings = {'>': operator.gt, '>=': operator... | Crystal-SDS/filter-middleware | crystal_filter_middleware/handlers/proxy.py | Python | gpl-3.0 | 13,744 |
"""Database models used by django-reversion."""
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.conf import settings
from django.core import serializers
from django.core.exceptions import ObjectDoesNotExist
... | Beauhurst/django-reversion | src/reversion/models.py | Python | bsd-3-clause | 7,592 |
import pygame, subprocess, os, sys, shutil, button, urllib2, json, hashlib, threading
class Updater(object):
def __init__(self, screen, clock, fps, resolution, version):
self.screen = screen
self.clock = clock
self.fps = fps
self.resolution = resolution
self.version = version
self.latest = "searching..."... | pedro-b/layer-switcher | updater/updater.py | Python | mit | 5,310 |
#!/usr/bin/python
import sys
import xml.dom.minidom
import os
if sys.argv[1] == 'deploy':
flag = sys.argv[2]
f = open("/usr/share/hazelwire/testmodule3/exploit/flag.txt", 'w')
f.write(flag)
f.close()
if sys.argv[1] == "configure":
dom = xml.dom.minidom.parse(os.getenv("MODULEDIR")+"testmodule3/co... | Hazelwire/hazelwire-modules | testmodule3/testmodule3-0.2/manage.py | Python | gpl-3.0 | 772 |
#!/usr/bin/env python
"""Top level ``eval`` module.
"""
import warnings
import tokenize
from pandas.core import common as com
from pandas.computation import _NUMEXPR_INSTALLED
from pandas.computation.expr import Expr, _parsers, tokenize_string
from pandas.computation.scope import _ensure_scope
from pandas.compat impo... | pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/computation/eval.py | Python | gpl-2.0 | 10,401 |
from Bio import SeqIO
from datetime import date
fname = '../data/gisaid_H3N2_all_years_human.fasta'
all_seqs = []
def parse_gisaid_date(date_str):
if len(date_str.split('-'))==3:
year, month, day = map(int, date_str.split('-'))
return date(year =year, month=month, day=day)
elif len(date_str.s... | rneher/FitnessInference | flu/sequence_and_annotations/filter_gisaid_by_full_date.py | Python | mit | 1,099 |
from hsph.fields import SiteField
class HSPHSiteDataMixin(object):
_site_map = None
@property
def site_map(self):
if self._site_map is None:
self._site_map = SiteField.getFacilities(domain=self.domain)
return self._site_map
_selected_site_map = None
@property
def s... | SEL-Columbia/commcare-hq | custom/_legacy/hsph/reports/__init__.py | Python | bsd-3-clause | 2,576 |
import unittest
import os
if __name__ == '__main__' and __package__ is None:
from os import sys, path
sys.path.append(path.abspath(path.join(__file__, "..", "..")))
from src.MirroredDirectory import MirroredDirectory
from src.mocking.MockFileSystem import MockFileSystem
class MirroredDirectoryTest(unittest.Te... | anconaesselmann/ClassesAndTests | classes_and_tests/srcTest/MirroredDirectoryTest.py | Python | mit | 14,147 |
+#Задача №12, Вариант 30
+#Разработайте игру "Крестики-нолики". (см. М.Доусон Программируем на Python гл. 6)
+
+#Шеменев Андрей.
+#25.04.2016
+def display_instruct():
+ print('''
+ Добро пожаловать на ринг грандиознейших интеллектуальных состязаний всех времён.
+ Твой мозг и мой процессор сойдутся в схватке з... | Mariaanisimova/pythonintask | INBa/2015/Shemenev_A_V/task_122_30.py | Python | apache-2.0 | 4,900 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# MarkAsCodeCoverageNonFeasible.py
# Copyright 2008 Google Inc.
#
# Marks a block of code as non feasible with regards to code coverage.
# To use it with Xcode 3.x, go to the scripts menu and choose
# "Edit User Scripts...". Then "Add Script File..." under the plus in
# th... | nimbusios/CoverStory | Tools/MarkAsCodeCoverageNonFeasible.py | Python | apache-2.0 | 1,657 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='REP-instrumentation',
version='0.20120411',
description='Python interfaces to lab instruments',
author='Philip Chimento',
author_email='philip.chimento@gmail.com',
url='http://ptomato.github.com/REP-instrumentation',
license='g... | ptomato/REP-instrumentation | setup.py | Python | gpl-3.0 | 614 |
#!/usr/bin/env python
import rospy
from lab_ros_perception.ArucoTagModule import ArucoTagModule
import time
import tf2_ros
import tf2_geometry_msgs
import math
def Quaternion_toEulerianAngle(x, y, z, w):
ysqr = y*y
t0 = +2.0 * (w * x + y*z)
t1 = +1.0 - 2.0 * (x*x + ysqr)
X = math.degrees(math.ata... | CMU-ARM/lab_ros_perception | scripts/aruco_demo.py | Python | mit | 1,463 |
# -*- coding: utf-8 -*-
{
'name': 'Time Tracking',
'version': '1.0',
'category': 'Human Resources',
'sequence': 23,
'description': """
This module implements a timesheet system.
==========================================
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
... | syci/ingadhoc-odoo-addons | hr_timesheet_project/__openerp__.py | Python | agpl-3.0 | 591 |
"""
test_g2tools.py
"""
# Copyright (c) 2016-17 G. Peter Lepage.
#
# 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
# any later version (see <http://www.gnu.or... | gplepage/g2tools | tests/test_g2tools.py | Python | gpl-3.0 | 18,525 |
import datetime
import time
import urllib2
import re
from bs4 import BeautifulSoup
from datetime import timedelta, date
from urllib2 import HTTPError
#Initialize Variables
gameMatrix = []
gameList =[]
# Get Webpage Data
class GetData:
def __init__(self):
self.awayTeam = []
self.hom... | Aketay/Baseball-Projection | lineup.py | Python | mit | 4,700 |
# 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 ... | stankovski/AutoRest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py | Python | mit | 1,673 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2008 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
# t... | pmghalvorsen/gramps_branch | gramps/plugins/view/noteview.py | Python | gpl-2.0 | 9,257 |
import piglow
from time import sleep
import psutil
piglow.auto_update = True
while True:
cpu = psutil.cpu_percent()
#piglow.all(0)
if cpu < 5:
piglow.all(0)
if cpu > 10:
piglow.white(20)
if cpu > 20:
piglow.blue(20)
if cpu > 40:
piglow.green(20)
if cpu > 60:
piglow.yellow(20)
if cpu > 80:
piglow.... | developius/piometer | cpu.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Unit tests for writer filewriter module."""
import os
import unittest
import cclib
__filedir__ = os.path.dirname(__... | Schamnad/cclib | test/io/testfilewriter.py | Python | bsd-3-clause | 900 |
## ENVISIoN
##
## Copyright (c) 2021 Gabriel Anderberg, Didrik Axén, Adam Engman,
## Kristoffer Gubberud Maras, Joakim Stenborg
## 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.... | rartino/ENVISIoN | envisionGUI/GUI.py | Python | bsd-2-clause | 33,351 |
# 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 by applicable law or a... | amboutin/GCP | storage/cloud-client/quickstart_test.py | Python | apache-2.0 | 1,029 |
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | intel-analytics/BigDL | python/orca/src/bigdl/orca/automl/search/ray_tune/__init__.py | Python | apache-2.0 | 642 |
#!/usr/bin/env python3
import os
import sys
_upper_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..'))
if _upper_dir not in sys.path:
sys.path.append(_upper_dir)
import chdb
import config
import utils
import time
import subprocess
import argparse
import tempfile
import dateutil.parser
impor... | eggpi/citationhunt | scripts/update_db_tools_labs.py | Python | mit | 4,576 |
# -*- coding: utf-8 -*-
# Copyright 2014 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 require... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/gslib/addlhelp/apis.py | Python | gpl-3.0 | 2,736 |
"""
These validate methods are never run by FlexGet anymore, but these tests serve as a sanity check that the
old validators will get converted to new schemas properly for plugins still using the `validator` method.
"""
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint:... | oxc/Flexget | flexget/tests/test_validator.py | Python | mit | 4,250 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-datalabeling | samples/generated_samples/datalabeling_v1beta1_generated_data_labeling_service_pause_evaluation_job_sync.py | Python | apache-2.0 | 1,488 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from _... | klahnakoski/Bugzilla-ETL | vendor/mo_logs/log_usingQueue.py | Python | mpl-2.0 | 1,197 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | BryanQuigley/sos | sos/report/plugins/openstack_designate.py | Python | gpl-2.0 | 2,931 |
#-*- coding:utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import print_function
from __future__ import unicode_literals
from attest import Tests
suite = lambda mod: 'tests.' + mod + '.suite'
all = Tests([suite('schemata'),
... | dag/stutuz | tests/__init__.py | Python | bsd-2-clause | 476 |
__author__ = 'Oleg Butovich'
__copyright__ = '(c) Oleg Butovich 2013-2015'
__licence__ = 'MIT'
from mock import patch
from proxmoxer import ProxmoxAPI
from tests.base.base_ssh_suite import BaseSSHSuite
class TestOpenSSHSuite(BaseSSHSuite):
proxmox = None
client = None
# noinspection PyMethodOverriding
... | petzah/proxmoxer | tests/openssh_tests.py | Python | mit | 859 |
"""
Support for the OpenWeatherMap (OWM) service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/weather.openweathermap/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.weather import (
Weath... | Duoxilian/home-assistant | homeassistant/components/weather/openweathermap.py | Python | mit | 5,668 |
# -*- coding: utf-8 -*-
import datetime as dt
import unittest.mock
from django.test import TestCase
from influxdb import InfluxDBClient
from core.metrics.conf import settings as metrics_settings
from core.metrics.metric import metric
_test_points = []
def fake_write_points(points):
global _test_points
_t... | erudit/zenon | tests/unit/core/metrics/test_metric.py | Python | gpl-3.0 | 3,303 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.