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 bill.items import BillItem
from scrapy import Spider, Request
class BillSpider(Spider):
name = 'billtopedm_spider'
allowed_ulrs = ['http://www.billboard.com/charts']
start_urls = ['http://www.billboard.com/charts/year-end/' + str(i) + '/hot-dance-electronic--songs' for i in range(2014, 2017)] + ['http://www.b... | Detailscool/YHSpider | BillboardAnalysis/bill/spiders/billtopedm.py | Python | mit | 1,995 |
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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... | matrix-org/synapse | tests/replication/tcp/streams/test_account_data.py | Python | apache-2.0 | 4,541 |
def diff(old, new):
"""Returns the set of differences between two C{dict}s.
@return: A 3-tuple of dicts with the changes that would need to be
made to convert C{old} into C{new}: C{(creates, updates, deletes)}
"""
new_keys = set(new)
old_keys = set(old)
creates = {}
for key in new_... | CanonicalLtd/landscape-client | landscape/client/diff.py | Python | gpl-2.0 | 616 |
"""Tests for plugin.py."""
import ckanext.eaw_vocabularies.plugin as plugin
def test_plugin():
pass | eawag-rdm/ckanext-eaw_vocabularies | ckanext/eaw_vocabularies/tests/test_plugin.py | Python | agpl-3.0 | 104 |
# coding=utf-8
"""
Copyright 2013 LinkedIn Corp. 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 l... | linkedin/naarad | src/naarad/__init__.py | Python | apache-2.0 | 20,029 |
# Copyright 2009 Simon Schampijer
#
# 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 version.
#
# This program is distributed in t... | manuq/hello-world | activity.py | Python | gpl-2.0 | 2,731 |
# -*- coding: utf-8 -*-
"""
conversion pixel<>point
"""
def convertDot2Pixel(dpi,value):
assert dpi != 0.0, 'DPI value can not be Zero'
return int(round(1.0*value*(dpi/72.0),0))
def convertPixel2Dot(dpi,value):
assert dpi != 0.0
return round(1.0*value*(72.0/dpi),-2) | Transkribus/TranskribusDU | TranskribusDU/util/unitConversion.py | Python | bsd-3-clause | 290 |
#!/usr/bin/python3
import random
N = 8
def sumf(f):
s = 0
for row in f:
for cell in row:
s += cell
return s
def randf():
f = list()
for x in range(8):
f.append(list())
for y in range(8):
f[x].append(random.randint(0,1))
return f
def neif(f, x, ... | anokata/pythonPetProjects | bunny.py | Python | mit | 1,041 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
pass
| glaudsonml/kurgan-ai | tools/sqlmap/waf/__init__.py | Python | apache-2.0 | 150 |
# Django Imports
from django.apps import AppConfig
# Implementation
class MyConfig(AppConfig):
name = 'ava.integration_ldap'
label = 'ava_oauth_ldap'
verbose_name = 'integration_ldap'
def ready(self):
import ava.oauth_ldap.signals
| alzeih/ava | ava_core/integration/integration_ldap/apps.py | Python | gpl-3.0 | 258 |
# Copyright 2017 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import six
from google.appengine.datastore imp... | catapult-project/catapult | dashboard/dashboard/api/alerts.py | Python | bsd-3-clause | 3,663 |
from .main import NZBMatrix
def start():
return NZBMatrix()
config = [{
'name': 'nzbmatrix',
'groups': [
{
'tab': 'searcher',
'subtab': 'nzb_providers',
'name': 'nzbmatrix',
'label': 'NZBMatrix',
'description': 'See <a href="https://nzbma... | arnif/CouchPotatoServer | couchpotato/core/providers/nzb/nzbmatrix/__init__.py | Python | gpl-3.0 | 1,064 |
#!/usr/bin/env python
""" MultiQC module to parse output from QUAST """
from __future__ import print_function
from collections import OrderedDict
import logging
import re
from multiqc import config
from multiqc.plots import table, bargraph
from multiqc.modules.base_module import BaseMultiqcModule
# Initialise the l... | robinandeer/MultiQC | multiqc/modules/quast/quast.py | Python | gpl-3.0 | 12,459 |
"""Support for Habitica sensors."""
from collections import namedtuple
from datetime import timedelta
import logging
from aiohttp import ClientResponseError
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_NAME, HTTP_TOO_MANY_REQUESTS
from homeassistant.util import Throttl... | sander76/home-assistant | homeassistant/components/habitica/sensor.py | Python | apache-2.0 | 7,438 |
from bisect import bisect_right
class Solution:
def triangleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ans = 0
n = len(nums)
nums.sort()
for i in range(n):
if nums[i] == 0: continue
for j in range(i+... | YiqunPeng/Leetcode-pyq | solutions/611ValidTriangleNumber.py | Python | gpl-3.0 | 495 |
# -*- coding: UTF-8 -*-
# pylint: disable=protected-access
import os
import unittest
from datetime import date, datetime
from collections import OrderedDict
import numpy as np
from landscape.finance import database
from landscape.finance.quotes import stocks, options
from landscape.finance.volatility import structures... | zzzoidberg/landscape | finance/volatility/tests/test_structures.py | Python | mit | 7,197 |
import yaml
import pprint
class SettingsList():
list_of_dicts = list();
def __str__(self):
pp = pprint.PrettyPrinter(indent=2)
pp.pprint(self.list_of_dicts)
def get_dict(self, group, name):
for element in self.list_of_dicts:
if element['name'] == name and element['group'] == group:
... | henryhallam/piksi_firmware | scripts/settings_list.py | Python | gpl-3.0 | 1,250 |
""" Adhocracy catalog extensions."""
from datetime import datetime
from substanced.catalog import Field
from pyramid.traversal import find_interface
from adhocracy_core.catalog.adhocracy import AdhocracyCatalogIndexes
from adhocracy_core.utils import get_sheet_field
from adhocracy_core.sheets.workflow import IWorkflow... | fhartwig/adhocracy3.mercator | src/adhocracy_s1/adhocracy_s1/catalog/adhocracy.py | Python | agpl-3.0 | 1,799 |
# Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import scipy.io
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
#import hrl_lib.mayavi2_util as mu
imp... | tapomayukh/projects_in_python | sandbox_tapo/src/skin_related/AI_Surface_Recognition/src/hmm_crossvalidation_force_2_states.py | Python | mit | 14,832 |
"""Support for Tuya Smart devices."""
import asyncio
from datetime import timedelta
import logging
from tuyaha import TuyaApi
from tuyaha.tuyaapi import (
TuyaAPIException,
TuyaFrequentlyInvokeException,
TuyaNetException,
TuyaServerException,
)
import voluptuous as vol
from homeassistant.config_entrie... | sdague/home-assistant | homeassistant/components/tuya/__init__.py | Python | apache-2.0 | 12,548 |
from chiplotle.hpgl.commands import *
import py.test
def test_AA_01( ):
t = AA((0,0), 180)
assert t.angle == 180
assert t.chordtolerance is None
assert t.format == 'AA0,0,180.00;'
def test_AA_02( ):
t = AA((0,0), 180, 45)
assert t.angle == 180
assert t.chordtolerance == 45
assert t.... | drepetto/chiplotle | chiplotle/hpgl/test/test_AA.py | Python | gpl-3.0 | 959 |
# Proof: Use pigeon hole principle.
# If the duplicate is only repeated once, then we could just calculate
# sum(nums)-sum(range(n)). We need to try other ways.
# The problem requires the complexity to be less than O(n^2). One common
# complexity is O(nlogn). This brings us to the method of divide and conquer.
# If t... | shen-yang/leetcode_solutions | 287_find_the_duplicate_number.py | Python | apache-2.0 | 1,975 |
#!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Miscellaneous Data I/O
^^^^^^^^^^^^^^^^^^^^^^
.. autosummary::
:nosignatures:
:toctree: generated/
{}
"""
__all__ = [
"write_polygon_to_text",
"to_pickle",
... | wradlib/wradlib | wradlib/io/misc.py | Python | mit | 6,510 |
import numpy as np
from numpy.testing import assert_array_equal
from nose import with_setup
try:
from nose.tools import assert_is, assert_is_instance
except ImportError:
from landlab.testing.tools import assert_is, assert_is_instance
from nose.tools import (assert_equal, assert_raises)
from landlab.grid import... | csherwood-usgs/landlab | landlab/grid/tests/test_raster_funcs/test_find_nearest_node.py | Python | mit | 2,465 |
from django.core.management import call_command
from django.test import TestCase
from frontend.models import Practice
def setUpModule():
Practice.objects.create(code="1", name="ADDINGHAM SURGERY", postcode="LS29 0LZ")
Practice.objects.create(
code="2", name="HAWORTH MEDICAL PRACTICE", postcode="BD22 8... | ebmdatalab/openprescribing | openprescribing/frontend/tests/commands/test_import_practice_dispensing_status.py | Python | mit | 1,528 |
def py2java_int_array(sc, args):
gw = sc._gateway
result = gw.new_array(gw.jvm.int, len(args))
for i in range(0, len(args)):
result[i] = int(args[i])
return result
def py2java_integer_array(sc, args):
gw = sc._gateway
result = gw.new_array(gw.jvm.Integer, len(args))
for i in range(... | data-commons/prep-buddy | python/pyprepbuddy/__init__.py | Python | apache-2.0 | 568 |
# -*- 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 'NewsItem'
db.create_table(u'newsfeed_newsitem', (
... | iver56/trondheim.kodeklubben.no | backend/wsgi/newsfeed/migrations/0001_initial.py | Python | gpl-3.0 | 1,499 |
"""
Django settings for pg_memento project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | onebit0fme/django-pgMemento | test_app/settings.py | Python | lgpl-3.0 | 3,601 |
from helper import CompatTestCase
from validator.compat import FX21_DEFINITION
class TestFX21Compat(CompatTestCase):
"""Test that compatibility tests for Gecko 21 are properly executed."""
VERSION = FX21_DEFINITION
def test_jsm(self):
def test_pattern(self, pat):
self.setUp()
... | mattbasta/amo-validator | tests/compat/test_gecko21.py | Python | bsd-3-clause | 1,493 |
# Copyright 2017 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0+
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from .page import Page
class LoginPage(Page):
PATH = "/login"... | wazo-pbx/wazo-admin-ui | integration_tests/suite/helpers/pages/login.py | Python | gpl-3.0 | 1,458 |
'''
Copyright (C) 2012 Wiley Snyder
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.
This program is distributed in t... | wileynet/EatDudeWeb | EatDudeWeb/app/controller/main/index.py | Python | gpl-3.0 | 2,337 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_knowledge_py3.py | Python | mit | 2,314 |
"""This module contains utility functions for working with Pastas models."""
import logging
from datetime import datetime, timedelta
from logging import handlers
import numpy as np
from pandas import Series, Timedelta, Timestamp, date_range, to_datetime
from pandas.tseries.frequencies import to_offset
from scipy impo... | pastas/pasta | pastas/utils.py | Python | mit | 20,440 |
from PyQt5.QtWidgets import QMainWindow, QDialog, QFileDialog
from PyQt5.QtCore import pyqtSlot, Qt
from Compiled_UI.MainWindow import Ui_MainWindow
from Compiled_UI.about import Ui_About
import sys
import subprocess
class MainWindow(QMainWindow):
argv = []
def __init__(self):
super(MainWindow, self)... | lzambella/Qyoutube-dl | Controllers/MainWindowController.py | Python | gpl-3.0 | 6,363 |
# Copyright 2016 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 applicable ... | googleinterns/wss | third_party/slim/nets/inception_v2.py | Python | apache-2.0 | 26,623 |
#!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py -t {SAMPLE_TEST} -- {SAMPLE_NOSE_ARGUMENTS}
$ python runtests.py -... | AustereCuriosity/numpy | runtests.py | Python | bsd-3-clause | 16,571 |
# Load json bulk files into elasticsearch
import json
import os
import time
import traceback
import elasticsearch
from etl.common.store import list_entity_files
from etl.common.utils import get_folder_path, get_file_path, create_logger, first, replace_template
class ElasticSearchException(Exception):
pass
# I... | gnpis/BrAPI-extract-index-prototype | etl/load/elasticsearch.py | Python | mit | 6,456 |
import pygame
from pygame.locals import *
from chunk import Chunk
class Explorer:
K_AMT = 16
SCALE = 2
def __init__(self, pos):
pygame.init()
pygame.display.init()
pygame.font.init()
self.surface = pygame.display.set_mode( (1024,600), pygame.DOUBLEBUF|pygame.HWSURFACE)
self.font = pygame.font.SysFont(... | dantheta/mcslice | MCSlice/explorer.py | Python | bsd-2-clause | 3,709 |
# -*- 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-channel | samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_list_transferable_skus_async.py | Python | apache-2.0 | 1,628 |
from rule_worker_app import app
app.run(host="0.0.0.0", debug=True)
| remote-filter/rule-worker | app.py | Python | gpl-2.0 | 68 |
#! /usr/bin/env python3
from datetime import datetime
import pyglow
from pyglow import Point
print(
"pyglow version = {}".format(
pyglow.__version__,
)
)
# Make sure we're using a pyglow version
# that implements the user defined indices:
assert(float(pyglow.__version__) > 1.0)
lat = 30.
lon = -10.... | timduly4/pyglow | examples/example_user_indices.py | Python | mit | 1,390 |
#!/usr/bin/env python
#
# Python-bindings volume type test script
#
# Copyright (C) 2010-2022, Joachim Metz <joachim.metz@gmail.com>
#
# Refer to AUTHORS for acknowledgements.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publis... | libyal/libfwsi | tests/pyfwsi_test_volume.py | Python | lgpl-3.0 | 1,400 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
from ._common import isstring
class StringTypeCheckerStrictLevel0(TypeCheckerBase):
def is_instance(self):
return isstring(self._value)
def is_valid_aft... | thombashi/typepy | typepy/checker/_string.py | Python | mit | 2,055 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (Lesser GPL)
#
# Copyright (C) 2009-2012 Rosen Diankov <rosen.diankov@gmail.com>
#
# ikfast 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... | jdsika/TUM_HOly | openrave/python/ikfast_generator_cpp.py | Python | mit | 129,384 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ovm.exceptions import OVMError
from ovm.utils.compat23 import etree
class Disk:
def __init__(self, **kargs):
self.guest_dev = None
if 'xmldef' in kargs:
xmldef = kargs['xmldef']
disk_type = xmldef.attrib.get('type')
... | lightcode/OVM | ovm/inventory/disk.py | Python | mit | 2,584 |
# Copyright 2020 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, ... | google/telluride_decoding | test/regression_data_test.py | Python | apache-2.0 | 3,840 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2016 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#... | marlengit/BitcoinUnlimited | qa/rpc-tests/test_framework/util.py | Python | mit | 27,960 |
#-*- coding: iso-8859-1 -*-
# pysqlite2/test/factory.py: tests for the various factories in pysqlite
#
# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liab... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/sqlite3/test/factory.py | Python | gpl-3.0 | 10,671 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | idovear/odoo | addons/stock/wizard/stock_return_picking.py | Python | agpl-3.0 | 9,834 |
# -*- coding: utf-8 -*-
__author__ = """Kevin Wierman"""
__email__ = 'kevin.wierman@pnnl.gov'
__version__ = '0.1.0'
| HEP-DL/root2hdf5 | root2hdf5/__init__.py | Python | gpl-3.0 | 117 |
# This file is part of OtfBot.
# -*- coding: utf-8 -*-
#
# OtfBot 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 version.
#
# OtfBot is distrib... | Farthen/OTFBot | otfbot/plugins/ircClient/weather.py | Python | gpl-2.0 | 8,002 |
input1 = """2/13/15
1-31-10
5 10 2015
2012 3 17
2001-01-01
2008/01/07"""
def getLines(input):
return input.splitlines()
def reformat(date):
# take date string and split
datesp = date.replace('/',' ').replace('-',' ').strip().split(' ')
# if date has more than 3, there are seperators
# if 1st is 4 ... | jamtot/DailyChallenge | date_dilemma (14dec2015)/datedilemma.py | Python | mit | 895 |
# -*- Mode: Python; python-indent-offset: 4 -*-
#
# Time-stamp: <2017-06-03 11:36:32 alex>
#
# --------------------------------------------------------------------
# PiProbe
# Copyright (C) 2016-2017 Alexandre Chauvin Hameau <ach@meta-x.org>
#
# This program is free software: you can redistribute it and/or modify
# it... | achauvinhameau/netProbe | py-net-probe/database/__init__.py | Python | gpl-3.0 | 1,035 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import operator
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from astropy.tests.helper import assert_follows_unicode_guidelines, catch_warnings
from astropy import table
from astropy import units ... | MSeifert04/astropy | astropy/table/tests/test_column.py | Python | bsd-3-clause | 32,770 |
from openerp.osv import osv
from openerp.addons.runbot.runbot import now
class RunbotBuild(osv.osv):
_inherit = "runbot.build"
def job_28_wodemo(self, cr, uid, build, lock_path, log_path, args=None):
build._log('wodemo', 'Start database without demo')
self.pg_createdb(cr, uid, "%s-wodemo" % b... | amoya-dx/runbot-addons | runbot_wodemo/model/runbot.py | Python | agpl-3.0 | 720 |
"""Defines the unit tests for the :mod:`colour.models.cie_xyy` module."""
import numpy as np
import unittest
from itertools import permutations
from colour.models import (
XYZ_to_xyY,
xyY_to_XYZ,
xy_to_xyY,
xyY_to_xy,
xy_to_XYZ,
XYZ_to_xy,
)
from colour.utilities import domain_range_scale, ign... | colour-science/colour | colour/models/tests/test_cie_xyy.py | Python | bsd-3-clause | 19,016 |
# Gravitational constant for computing weight from mass
g = 9.80665
# Material properties
materials = {"A36": {"rho": 7800,
"E": 200*pow(10, 9),
"Fy": 250*pow(10, 6),
"Cy": 250*pow(10, 6)},
"A992": {"rho": 7800,
... | jknesek/Balsa-Bridge-Optimizer | trussme/physical_properties.py | Python | gpl-3.0 | 1,291 |
# Copyright 2014 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | jonparrott/gcloud-python | core/google/cloud/_testing.py | Python | apache-2.0 | 3,434 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Ui_Wizard.ui'
#
# Created: Tue Jul 31 04:19:55 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attri... | irees/emdash | emdash/ui/Ui_Wizard.py | Python | bsd-3-clause | 1,634 |
"""
This file is part of Giswater 3
The 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.
"""
# -*- coding: utf-8 -*-
from .task import... | Giswater/giswater_qgis_plugin | core/threads/connect_link.py | Python | gpl-3.0 | 2,670 |
class Power:
def __init__(self, base, exponent):
self.base = base
self.exponent = exponent
def addexponent(self):
self.exponent += 1
def getTotal(self):
return self.base**self.exponent
def getBase(self):
return self.base
def getexponent(self):
return s... | chrisjluc/ProjectEuler | Power.py | Python | mit | 409 |
# coding=utf-8
import random
lista = []
for x in range(10):
numero = random.randint(1, 100)
if x == 0:
maior, menor = numero, numero
elif numero > maior:
maior = numero
elif numero < menor:
menor = numero
lista.append(numero)
lista.sort()
print(lista)
print("Maior: %d" % maio... | renebentes/Python4Zumbis | Exercícios/Lista IV/questao01.py | Python | mit | 350 |
import unittest
from lxml.tests.common_imports import make_doctest
def test_suite():
suite = unittest.TestSuite()
suite.addTests([make_doctest('test_autolink.txt')])
return suite
if __name__ == '__main__':
unittest.main()
| lxml/lxml | src/lxml/html/tests/test_autolink.py | Python | bsd-3-clause | 240 |
from components import stateManagment, formControl, helpers
from functools import partial
import pygame as pg
SCENE_NAME = "SETTINGS"
class Scene(stateManagment.BaseScene):
"""
Parent class for individual game states to inherit from.
"""
def __init__(self, screen, helpers):
super(Scene, self)._... | daniellinye/HRINFG3 | euromast/scenes/settings.py | Python | mit | 5,818 |
import numpy as np
import pytest
from astromodels import Blackbody, Powerlaw, Model, PointSource
from threeML import JointLikelihood, DataList
from threeML.io.package_data import get_path_of_data_file
from threeML.plugins.DispersionSpectrumLike import DispersionSpectrumLike
from threeML.plugins.SpectrumLike import Spe... | giacomov/3ML | threeML/test/test_spectrumlike.py | Python | bsd-3-clause | 9,090 |
"""Function to return max and min in a list."""
def min_cw(l):
"""Return min value of a list."""
a = sorted(l)
return a[0]
def max_cw(l):
"""Return max value of a list."""
a = sorted(l)
return a[-1]
| clair3st/code-katas | src/max_min.py | Python | mit | 227 |
import logging
from popserver.ai.interest import tag as tag_interest
from popserver.lib.base import *
from popserver.model import User, TagCount, Tag
from pylons.decorators import rest
log = logging.getLogger(__name__)
class InterestsController(BaseController):
@authorize(And(UserInRoute('username'),ValidAu... | santisiri/popego | popego/popserver/popserver/controllers/website/interests.py | Python | bsd-3-clause | 644 |
from __future__ import print_function
from SimpleCV import *
print("")
print("This program runs a list of test for machine learning on")
print("the SimpleCV library. Not all scores will be high, this")
print("is just to ensure that the libraries are functioning correctly")
print("on your system")
print("")
print("****... | tpltnt/SimpleCV | SimpleCV/MachineLearning/MLTestSuite.py | Python | bsd-3-clause | 9,967 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | rajalokan/keystone | keystone/common/policies/role_assignment.py | Python | apache-2.0 | 1,550 |
#FilterNumber function to remove all the numbers from the string
def filter_numbers(string):
return ''.join([i for i in string if not i.isdigit()])
| JLJTECH/TutorialTesting | CodeWars/2016/FailedFilter-BugFix3-7k.py | Python | mit | 154 |
# Apache Thrift User Defined Exception Client in Python
import sys
sys.path.append("gen-py")
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from excep import TradeHistory
from excep.ttypes import BadFish
trans = TSocket.TSocket("localhost", 90... | RandyAbernethy/ThriftBook | part2/exceptions/excep_client.py | Python | apache-2.0 | 679 |
#!/usr/bin/python
#
# FishPi - An autonomous drop in the ocean
#
# Simple viewer for onboard camera
#
import argparse
import io
import sys
import socket
import struct
# from StringIO import StringIO
import wx
class CameraPanel(wx.Panel):
def __init__(self, parent, server, port=8001, enabled=True):
wx.P... | FishPi/FishPi-POCV---Command---Control | fishpi/ui/camera_view.py | Python | bsd-2-clause | 3,892 |
#!/usr/bin/env python
# coding:utf-8
import errno
import socket
import ssl
import urlparse
import OpenSSL
NetWorkIOError = (socket.error, ssl.SSLError, OpenSSL.SSL.Error, OSError)
from proxy import xlog
import simple_http_client
import simple_http_server
from cert_util import CertUtil
from config import config
imp... | hexlism/xx_net | gae_proxy/local/proxy_handler.py | Python | bsd-2-clause | 14,990 |
from __future__ import print_function
from __future__ import absolute_import
# System modules
import argparse
import sys
import multiprocessing
import os
import textwrap
# Third-party modules
# LLDB modules
from . import configuration
class ArgParseNamespace(object):
pass
def parse_args(parser, argv):
""... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/dotest_args.py | Python | bsd-3-clause | 13,110 |
def set_user_info_from_auth_provider(backend, user, details, *args, **kwargs):
"""Social auth pipeline to set user info returned from auth provider
"""
if not user:
return
user.email = details['email']
user.full_name = details['fullname']
backend.strategy.storage.user.changed(user)
| brasilcomvc/brasilcomvc | brasilcomvc/accounts/pipelines.py | Python | apache-2.0 | 317 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function # py2.6 with_statement
import sys
import pprint
import h5py
import numpy as np
import os.path
# date related stuff
import datetime
import dateutil
import dateutil.tz
import dateutil.parser
import arrow
# compatibility
import f... | cleemesser/eeg-hdfstorage | scripts/edf2eeghdf.py | Python | bsd-3-clause | 51,534 |
#!/usr/bin/python2
'''
Perform basic ELF security checks on a series of executables.
Exit status will be 0 if successful, and the program will be silent.
Otherwise the exit status will be 1 and it will log which executables failed which checks.
Needs `readelf` (for ELF) and `objdump` (for PE).
'''
from __future__ impor... | jimmykiselak/lbrycrd | contrib/devtools/security-check.py | Python | mit | 6,511 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-09 13:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | GOlssn/supervisord_overseer | supervisord_overseer/process_management/migrations/0001_initial.py | Python | mit | 1,010 |
from .compat import py27, binary_type, string_types
import sys
from sqlalchemy.engine import url
import warnings
import textwrap
import collections
import logging
log = logging.getLogger(__name__)
if py27:
# disable "no handler found" errors
logging.getLogger('alembic').addHandler(logging.NullHandler())
try... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/alembic/util/messaging.py | Python | mit | 2,442 |
from typing import Optional, List
def a(x):
# type: (List[int]) -> List[str]
return <warning descr="Expected type 'List[str]', got 'List[List[int]]' instead">[x]</warning>
def b(x):
# type: (int) -> List[str]
return <warning descr="Expected type 'List[str]', got 'List[int]' instead">[1,2]</warning>
d... | hurricup/intellij-community | python/testData/inspections/PyTypeCheckerInspection/FunctionReturnType.py | Python | apache-2.0 | 1,000 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para IB3
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import urlparse,re
from core import logger
from core import scrapertools
... | igurrutxaga/tvalacarta | python/main-classic/channels/ib3.py | Python | gpl-3.0 | 8,380 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import unittest
from telemetry import decorators
from telemetry.util import path
class PathTest(unittest.TestCase):
def testIsExecu... | M4sse/chromium.src | tools/telemetry/telemetry/util/path_unittest.py | Python | bsd-3-clause | 645 |
from discord.ext import commands
from coins import Coin
from db import database
class Holdem:
def __init__(self, bot):
self.bot = bot
self.database = database.Database(self.bot)
self.holdem_players = []
self.game_status = 0
self.deck = []
self.dealersHand = []
... | Cmoen11/BuffBot | BuffBot/holdem.py | Python | gpl-3.0 | 5,327 |
"""Support for Rheem EcoNet thermostats."""
from pyeconet.equipment import EquipmentType
from pyeconet.equipment.thermostat import ThermostatFanMode, ThermostatOperationMode
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH,
AT... | rohitranjan1991/home-assistant | homeassistant/components/econet/climate.py | Python | mit | 7,917 |
#########################################################################
#
# SwapServer
#
# Copyright (c) 2011 panStamp <contact@panstamp.com>
#
# This file is part of the panStamp project.
#
# panStamp is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Lic... | ekoeppen/panstamp-python | pyswap/src/swap/SwapServer.py | Python | gpl-2.0 | 26,788 |
import tempfile
from datetime import datetime
import flask_testing
from flask import url_for
import iis
from iis.models import User
from iis.extensions import db
class BaseTestCase(flask_testing.TestCase):
DB_FILE = tempfile.mkstemp()
SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1]
LOGGING = {"versi... | interactomix/iis | test_utils/base.py | Python | agpl-3.0 | 1,749 |
# -*- 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):
# Changing field 'PingedURL.message'
db.alter_column(u'pinging_pingedurl... | niklaushug/pinging | pinging/migrations/0002_auto__chg_field_pingedurl_message.py | Python | bsd-3-clause | 2,690 |
# Minimum spanning tree (MST) algorithms
#
# Long Le
# University of Illinois
#
import numpy as np
import matplotlib.pyplot as plt
from pqdict import minpq
class Node:
def __init__(self,x):
self.val = x
class Edge:
def __init__(self,n0,n1,w):
self.ePts = set([n0,n1]) # end points
self... | long0612/randProbs | mst/mst.py | Python | mit | 3,078 |
#!/usr/bin/env python
"""GRR server entry points."""
| dunkhong/grr | grr/server/grr_response_server/bin/__init__.py | Python | apache-2.0 | 53 |
# -*- coding: utf-8 -*-
import logging
import re
try:
import json
except:
import simplejson as json
from hashlib import md5
from time import time
from datetime import datetime,timedelta
from urllib import urlencode
from common import *
from setting import *
from model import Article, Comment, Link, Categor... | yobin/saepy-log | admin.py | Python | mit | 38,450 |
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
import cherrypy
# 導入 Python 內建的 os 模組, 因為 os 模組為 Python 內建, 所以無需透過 setup.py 安裝
import os
# 導入 random 模組
import random
import math
from cherrypy.lib.static import serve_file
# ... | 40123210/w17b_exam | wsgi.py | Python | agpl-3.0 | 26,472 |
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Pychart 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 your option) any
# later version.
#
# Pychart is dis... | cecep-edu/refactory | requirements/PyChart-1.39/demos/colors.py | Python | gpl-3.0 | 1,345 |
"""
Test outgoing call using ICE-UDP transport mechanism.
"""
from gabbletest import exec_test, sync_stream
from servicetest import (
wrap_channel, make_channel_proxy, EventPattern, call_async,
assertEquals)
import gabbletest
import dbus
import time
from twisted.words.xish import xpath
import ns
import constan... | jku/telepathy-gabble | tests/twisted/jingle/test-outgoing-iceudp.py | Python | lgpl-2.1 | 5,772 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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) any later version.
#
# Ansible is distributed i... | benjixx/ansible | lib/ansible/cli/vault.py | Python | gpl-3.0 | 6,700 |
from __future__ import division
from sympy import (Add, Basic, S, Symbol, Wild, Float, Integer, Rational, I,
sin, cos, tan, exp, log, nan, oo, sqrt, symbols, Integral, sympify,
WildFunction, Poly, Function, Derivative, Number, pi, NumberSymbol, zoo,
Piecewise, Mul, Pow, nsimplify, ratsimp, trigsimp, rads... | flacjacket/sympy | sympy/core/tests/test_expr.py | Python | bsd-3-clause | 48,018 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tests/server/server.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | securestate/king-phisher | tests/geoip.py | Python | bsd-3-clause | 3,433 |
"""Download modules for built-in datasets.
Download functions accept two arguments:
* `save_directory` : Where to save the downloaded files
* `clear` : If `True`, clear the downloaded files. Defaults to `False`.
"""
from fuel.downloaders import adult
from fuel.downloaders import binarized_mnist
from fuel.downloaders... | rizar/attention-lvcsr | libs/fuel/fuel/downloaders/__init__.py | Python | mit | 993 |
#!/usr/bin/env python3
import io
import os
import png
import shutil
import tempfile
import unittest
from pico8 import util
from pico8.game import compress
from pico8.game import file
from pico8.game import game
from pico8.game.formatter import p8
from pico8.game.formatter import p8png
from pico8.game.formatter import... | dansanderson/picotool | tests/pico8/game/game_test.py | Python | mit | 20,965 |
# Copyright 2015 UniMOOC. 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 agr... | UniMOOC/AAClassroom | modules/um_students/exceptions.py | Python | apache-2.0 | 734 |
# coding=utf-8
from django.core.mail import EmailMessage
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from scheduler.models import Need
@receiver(pre_delete, sender=Need)
def send_email_notifications(sender, instance, **kwargs):
"""
HACK ALERT
This needed to be d... | tordans/volunteer_planner | scheduler/signals.py | Python | agpl-3.0 | 1,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.