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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# Copyright 2015 Matthew Iannucci
#
# reporter.py
# The main collector script. The front end web page. Recieves the
# data from the collector and displays it for the user in meaningful
# way
import web
import json
import model
import config
from google.appengine.api import users
# Map out the URL... | mpiannucci/PiMonitor | Reporter/reporter.py | Python | mit | 1,964 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-07-11 04:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zotero', '0024_auto_20180709_0216'),
]
operations = [
migrations.AddField(... | upconsulting/IsisCB | isiscb/zotero/migrations/0025_importaccession_import_errors.py | Python | mit | 473 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | abhishekkr/nix-bootstrapper | commands/command_plugins/password/__init__.py | Python | apache-2.0 | 5,851 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Story',
fields=[
('id', models.AutoField(verbos... | acidjunk/django-scrumboard | scrumtools/apps/scrumboard/migrations/0001_initial.py | Python | gpl-3.0 | 1,420 |
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import BigInteger, CHAR, Integer, SmallInteger
from destiny.main.bdd import Base
from destiny.utils import rep_model
class Stats(Base):
__tablename__ = 'stats'
gameId = Column(BigInteger, primary_key=True)
participantId = Column(SmallInteger, pr... | Schluucht/Destiny | destiny/main/bdd/models/stats.py | Python | mit | 684 |
files_c=[
'C/Threads.c',
]
files_cpp=[
'CPP/7zip/UI/P7ZIP/wxP7ZIP.cpp',
'CPP/Common/IntToString.cpp',
'CPP/Common/MyString.cpp',
'CPP/Common/MyVector.cpp',
'CPP/Common/StringConvert.cpp',
'CPP/Windows/FileDir.cpp',
'CPP/Windows/FileFind.cpp',
'CPP/Windows/FileIO.cpp',
'CPP/Windows/FileName.cpp',
'CPP/Commo... | punesemu/puNES | src/extra/p7zip-17.04/Utils/file_P7ZIP.py | Python | gpl-2.0 | 382 |
"""
WSGI config for the_cottage 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | adityak2190/la_casa | arbatflat/wsgi.py | Python | mit | 397 |
# Copyright 2013 Cisco Systems, 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 o... | shakamunyi/neutron-dvr | neutron/plugins/cisco/common/config.py | Python | apache-2.0 | 5,949 |
# -*- coding: utf-8 -*-
#
# python wrapper for word query from synonymo.fr
# Author: Eloi perdereau [[eloi@perdereau.eu][E-mail]]
try:
from urllib2 import urlopen
from urllib2 import URLError, HTTPError
except ImportError:
from urllib.request import urlopen
from urllib.error import URLError, HTT... | Ron89/thesaurus_query.vim | autoload/thesaurus_query/backends/synonymo_fr_lookup.py | Python | apache-2.0 | 3,416 |
#coding=utf8
import os
import mapnik
from utilities import execution_path
from nose.tools import *
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'csv' in mapnik.DatasourceCache.plugin_names():
def tes... | ake-koomsin/mapnik_nvpr | tests/python_tests/markers_complex_rendering_test.py | Python | lgpl-2.1 | 1,647 |
# Copyright 2015 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.
"""Monkey patching of GCS library to use real GCS on local dev server."""
import functools
import logging
from google.appengine.ext import ndb
from clouds... | nicko96/Chrome-Infra | appengine/chrome_infra_packages/cas/hacks.py | Python | bsd-3-clause | 1,575 |
#!/usr/bin/python3
# mediaList.py - walk directory and list media
import os, sys, shutil
if os.path.exists(sys.argv[1]):
for folderNames, subFolders, fileNames in os.walk(sys.argv[1]):
#print('The current folder is ' + folderNames)
#for subFolder in subFolders:
#print('Subfolder of ' + folderNames + ': ' + s... | samcheck/Scripts | py3/mediaList.py | Python | mit | 511 |
from __future__ import print_function, division
from sympy.core.sympify import _sympify, sympify
from sympy.core.basic import Basic, _aresame
from sympy.core.cache import cacheit
from sympy.core.compatibility import ordered, range
from sympy.core.logic import fuzzy_and
from sympy.core.evaluate import global_evaluate
... | jerli/sympy | sympy/core/operations.py | Python | bsd-3-clause | 16,481 |
import pygame
def play(screen, clock,):
pygame.mixer.quit()
video = pygame.movie.Movie("./resources/videos/video5.mpg")
video.set_display(screen, [0, 0, 1280, 720])
video.play()
playing = True
while playing:
for event in pygame.event.get():
if event.type == pygame.QUIT:
... | aricooperdavis/lander | main/video6.py | Python | gpl-3.0 | 660 |
# -*- test-case-name: twisted.mail.test.test_mail -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Maildir-style mailbox support.
"""
import os
import stat
import socket
from hashlib import md5
from zope.interface import implementer
try:
import cStringIO as StringIO
except Import... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/mail/maildir.py | Python | gpl-3.0 | 27,925 |
# Copyright iris-grib contributors
#
# This file is part of iris-grib and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Tests for function
:func:`iris_grib._load_convert.generating_process`.
"""
# import iris_grib.tests first so th... | SciTools/iris-grib | iris_grib/tests/unit/load_convert/test_generating_process.py | Python | lgpl-3.0 | 1,814 |
"""
This file is part of Seten which is released under the MIT License (MIT).
See file LICENSE or go to https://github.com/gungorbudak/seten-cli/blob/master/LICENSE
for full license details.
"""
from os import path, mkdir
import seten
def get_filename(filepath):
"""
Obtain filename from the filepath
"""
... | gungorbudak/seten-cli | seten/utils.py | Python | mit | 2,771 |
#Page 207, Figure 13.6
class styleIterator(object):
def __init__(self, styles):
self.index = 0
self.styles = styles
def nextStyle(self):
result = self.styles[self.index]
if self.index == len(self.styles) - 1:
self.index = 0
else:
self.index += 1
... | knuu/Introduction_to_Computing_and_Programming_Using_Python | ch13/code13_6.py | Python | mit | 341 |
# -*- coding: utf-8 -*-
import unittest
from openkongqi.utils import get_uuid
class TestStations(unittest.TestCase):
"""Test the stations UUID map functions"""
def test_get_uuid(self):
"""test UUID generation"""
self.assertEqual(
get_uuid('cn', 'shanghai', 'jinganjincezhan'),
... | eddowh/openkongqi | tests/test_stations.py | Python | apache-2.0 | 486 |
from scipy import shape, dstack, sqrt, floor, array, mean, ones, vstack, hstack, ndarray
from vlfeat import vl_rgb2gray, vl_imsmooth, vl_dsift
from sys import maxint
"""
Python rewrite of https://github.com/vlfeat/vlfeat/blob/master/toolbox/sift/vl_phow.m
### notice no hsv support atm
### comments are largely copied f... | lbarnett/BirdID | vl_phow.py | Python | gpl-2.0 | 6,449 |
import numpy as np
from copy import deepcopy
import pandas as pd
def MP(ft, D, tol=1e-4):
"""
This is an implementation of matching pursuit (MP) algorithm
Input: Signal: f(t), dictionary D with normalized columns g_i
Output: List if coefficients a_n and indices for corresponding atoms gamma_n
Init... | luoshao23/ML_algorithm | Feature_selection/MP.py | Python | mit | 1,499 |
# September 2013, Glenn F. Matthews
# Copyright (c) 2013-2015 the COT project developers.
# See the COPYRIGHT.txt file at the top-level directory of this distribution
# and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt.
#
# This file is part of the Common OVF Tool (COT) project.
# It is subject to t... | glennmatthews/cot | COT/tests/__init__.py | Python | mit | 782 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show t... | HurricaneLabs/turf | docs/conf.py | Python | mit | 10,190 |
from . import ikh
| bernoullio/toolbox | tests/indicators/__init__.py | Python | mit | 18 |
#!/usr/bin/env python
# -*- encoding: utf8 -*-
import sys
__author__ = 'noahsark'
while True:
N = float( sys.stdin.readline() )
if N == 0.0:
break
count, total = 2.0, 0.0
while total < N:
total += 1.0/count
count += 1.0
print "%d card(s)" % ( int(count-2) )
| jimmylai/spoj | classical/HANGOVER/HANGOVER.py | Python | apache-2.0 | 306 |
"""
Let d(n) be defined as the sum of proper divisors of n
(numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b,
then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are
1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110;
... | singmyr/project-euler | Python/problem21/main.py | Python | mit | 949 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-07 18:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('countries', '0004_auto_20150528_1248'),
]
operations = [
migrations.AddField... | Valuehorizon/valuehorizon-countries | countries/migrations/0005_auto_20160607_1416.py | Python | mit | 1,531 |
from django.db import models
from django.contrib.auth.models import User
import requests
from datetime import datetime
from BeautifulSoup import BeautifulSoup
import re
SPOJ_ENDPOINT = "http://www.spoj.com/status/%s/signedlist/"
class SpojUser(models.Model):
user = models.OneToOneField(User)
spoj_handle = mo... | krisys/SpojBot | src/spojbot/bot/models.py | Python | mit | 6,922 |
d1,d10,d100,d1000,d10000,d100000,d1000000 = '','','','','','',''
number=''
m=0 # The current decimal number (1, 2, 3, ..., 10, 11, 12
while True:
m += 1
number += str(m)
if len(number) >= 1000000:
d1000000 = number[999999]
print("d1000000 is " + d1000000)
d100000 = number[9999... | danroberts728/Project-Euler-Answers | python/Problem40.py | Python | mit | 904 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, erpnext
import json
from frappe import _
from frappe.utils import flt, getdate, cint
from six import iteritems
from frapp... | saurabh6790/erpnext | erpnext/loan_management/doctype/loan_repayment/loan_repayment.py | Python | gpl-3.0 | 15,813 |
import pytest
from pandas.util._validators import validate_bool_kwarg, validate_kwargs
_fname = "func"
def test_bad_kwarg():
good_arg = "f"
bad_arg = good_arg + "o"
compat_args = {good_arg: "foo", bad_arg + "o": "bar"}
kwargs = {good_arg: "foo", bad_arg: "bar"}
msg = fr"{_fname}\(\) got an une... | TomAugspurger/pandas | pandas/tests/util/test_validate_kwargs.py | Python | bsd-3-clause | 1,740 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright Camptocamp SA 2011
# SQL inspired from OpenERP original code
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | VitalPet/account-financial-reporting | account_financial_report_webkit/report/common_balance_reports.py | Python | agpl-3.0 | 15,816 |
# -*- coding: utf-8 -*-
import 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 'Feed'
db.create_table(u'alexander_feed', (
(u'id', self.gf('django.db.models.fie... | CityOfPhiladelphia/myphillyrising | website/alexander/migrations/0001_initial.py | Python | gpl-3.0 | 5,237 |
class Point:
def __init__(self, x: int, y: int):
self.position_x = x
self.position_y = y
def __eq__(self, other):
if self.position_x == other.position_x and self.position_y == other.position_y:
return True
else:
return False
def __hash__(self):
... | AlgorithmLover/OJCodes | qlcoder/other/game/game.py | Python | mit | 3,104 |
from jira import JIRA
import requests
from config import JIRA_DOMAIN, JIRA_PASSWORD, JIRA_USERNAME
jira = JIRA(JIRA_DOMAIN, basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
projects = jira.projects()
boards = jira.boards()
for board in boards:
print('BOARD: ', board)
dashboards = jira.dashboards()
for dash in dashboard... | casahome2000/projects_radiator | helper.py | Python | mit | 825 |
""" Parse dessimination block shapefile to get shape of each dblock """
import shapefile
DBUID_FIELD = 0
CTUID_FIELD = 24
SHAPEFILE_SHAPE_shape = 5
def parse_shape_file(file_path):
"""
parse the shapefile of all the dblocks
returns map of dblock => shape
"""
dblock_to_shape = {}
import ipd... | gitah/canada-racial-dotmap | src/shapefile_parser.py | Python | mit | 773 |
#!/usr/bin/python
# (c) oomwoo.com
# Self-driving (autonomous) robot vehicle
# Runs on Raspberry Pi 3
# Distributed under GNU General Public License v3
# Use solely at your own risk
# Absolutely no warranty expressed or implied
import webiopi
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import time... | oomwoo/dora | rpi3/dora.py | Python | gpl-3.0 | 10,198 |
import logging
from datetime import datetime
from scrapy.log import ScrapyFileLogObserver
from scrapy.utils.misc import load_object
from twisted.python import logfile, log as tlog
from scrapy.crawler import Crawler
from scrapy.settings import Settings
from models.spiders import get_spider
from helpers.config_reader imp... | kirankoduru/arachne-ui | helpers/scrapy_util.py | Python | apache-2.0 | 2,149 |
# encoding: UTF-8
from __future__ import absolute_import
from .vnkorbit import Korbit_TradeApi , Korbit_DataApi
apiKey = 'FssV9Jw0aZVCOYbu9YlqVNc2Rhgmh1QpruNgSVhvVmFP1iw1aPfc3APbfz0ZM'
secretKey = 'lSMc1TT2AZYX5pyEm01SFqx7PgMjNB18eXWpi8DQKHf0rcYhLiaiRVzJwaVZR'
def testData():
d = Korbit_DataApi()
d.init(0.5 , 1)... | mumuwoyou/vnpy-master | beta/api/korbit/test.py | Python | mit | 950 |
# -*- coding: utf-8 -*-
"""Video xmodule tests in mongo."""
import json
import os
import tempfile
import textwrap
from datetime import timedelta
import ddt
import freezegun
import six
from django.core.files.base import ContentFile
from django.utils.timezone import now
from edxval import api
from mock import MagicMoc... | msegado/edx-platform | lms/djangoapps/courseware/tests/test_video_handlers.py | Python | agpl-3.0 | 52,409 |
import six
import unittest2
from robottelo.ui.browser import browser
if six.PY2:
import mock
else:
from unittest import mock
class BrowserTestCase(unittest2.TestCase):
def setUp(self):
self.settings_patcher = mock.patch('robottelo.ui.browser.settings')
self.webdriver_patcher = mock.patch... | elyezer/robottelo | tests/robottelo/test_ui.py | Python | gpl-3.0 | 2,369 |
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... | klahnakoski/ActiveData | vendor/jx_base/expressions/outer_join_op.py | Python | mpl-2.0 | 2,742 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_gdalconst.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| ryfeus/lambda-packs | Rasterio_osgeo_shapely_PIL_pyproj_numpy/source/osgeo/_gdalconst.py | Python | mit | 286 |
# -*- coding: utf-8 -*-
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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/license... | nzlosh/st2 | st2tests/integration/orquesta/test_wiring.py | Python | apache-2.0 | 6,164 |
'''Bucketlist(s) tests'''
import json
from tests.base_test import BaseTestCase
class BucketlistTestCase(BaseTestCase):
'''Class to test bucketlist'''
def test_create_bucketlist(self):
'''Testing if bucketlists successfully created.'''
response = self.client.post('/api/v1/bucketlists', data... | bmuthoga/cp-2-bucketlist-api | tests/test_bucketlist.py | Python | gpl-3.0 | 4,427 |
#!/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 the ZMQ API."""
import configparser
import os
import struct
from test_framework.test_framework im... | s-crow-project/s-crow | test/functional/zmq_test.py | Python | mit | 4,296 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#encoding=utf-8
'''
Created on 2015年4月21日
@author: kerry
'''
from base.http import MIGHttpMethodGet,MIGHttpMethodPost
from base.miglog import miglog
import urlparse
import json
class HttpApi(object):
'''
classdocs
'''
def __init__(self):
'''
... | smartdata-x/robots | api/HttpApi.py | Python | apache-2.0 | 1,065 |
# Copyright 2016 MongoDB, 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, so... | BriData/DBus | dbus-mongo-extractor/tests/test_oplog_manager_wildcard.py | Python | apache-2.0 | 16,541 |
from django.test import TestCase
from django.test.client import Client
from model_mommy import mommy
from pyprende.courses.models import Course
class CourseManagerTestCase(TestCase):
def setUp(self):
self.courses_django = mommy.make(
'courses.Course', name='Python na Web com Django', _quantity... | kassiacatarine/server | pyprende/courses/tests/models_tests.py | Python | gpl-3.0 | 855 |
# -*- coding: utf-8 -*-
## Comments and reviews for records.
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Softwar... | fjorba/invenio | modules/webcomment/lib/webcomment_templates.py | Python | gpl-2.0 | 118,784 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013-2014 Maxime Le Coz <lecoz@irit.fr>
# This file is part of TimeSide.
# TimeSide 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, ... | ANR-DIADEMS/timeside-diadems | timeside/plugins/diadems/irit_noise_startSilences.py | Python | gpl-2.0 | 7,140 |
from bokeh.util.deprecate import deprecated_module
deprecated_module('bokeh.properties', '0.11', 'use bokeh.core.properties instead')
del deprecated_module
from .core.properties import * # NOQA
| phobson/bokeh | bokeh/properties.py | Python | bsd-3-clause | 195 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['Lag1Trend'] , ['Seasonal_MonthOfYear'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_Lag1Trend_Seasonal_MonthOfYear_LSTM.py | Python | bsd-3-clause | 165 |
# 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... | asimshankar/tensorflow | tensorflow/python/keras/layers/convolutional.py | Python | apache-2.0 | 115,833 |
from exchange.yunbi.client import Client, get_api_path
from RebotConfig import RebotConfig
from Log import Log
import json
class yunbiEX():
def set(self, access, sercet):
self.client = Client(access_key=access, secret_key=sercet);
# function
def getServerTimestamp(self):
r... | WaitGodot/peatio-client-python | exchange/yunbiEX.py | Python | cc0-1.0 | 6,848 |
import numpy as np
import numpy.testing as nt
import pytest
import warnings
from dipy.core.sphere import (Sphere, HemiSphere, unique_edges, unique_sets,
faces_from_sphere_vertices, disperse_charges,
disperse_charges_alt, _get_forces,
... | FrancoisRheaultUS/dipy | dipy/core/tests/test_sphere.py | Python | bsd-3-clause | 12,667 |
"""
mfgage module. Contains the ModflowGage class. Note that the user can access
the ModflowGage class as `flopy.modflow.ModflowGage`.
Additional information for this MODFLOW package can be found at the `Online
MODFLOW Guide
<http://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/gage.htm>`_.
"""
import os
i... | bdestombe/flopy-1 | flopy/modflow/mfgage.py | Python | bsd-3-clause | 13,588 |
"""
Trello service
Pulls trello cards as tasks.
Trello API documentation available at https://developers.trello.com/
"""
from jinja2 import Template
import requests
import typing_extensions
from bugwarrior.services import IssueService, Issue, ServiceClient
from bugwarrior import config
class TrelloConfig(config.Se... | ralphbean/bugwarrior | bugwarrior/services/trello.py | Python | gpl-3.0 | 7,975 |
from plotly.graph_objs import Carpet
| plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/template/data/_carpet.py | Python | mit | 37 |
# pylint: disable=unused-argument, redefined-outer-name
from lxml import etree
import pytest
import searxstats.common.html as html
@pytest.mark.asyncio
async def test_html_fromstring():
results_xpath = etree.XPath("//a[contains(@class,'result-default')]")
doc = await html.html_fromstring('<div><a href="http... | dalf/searx-stats2 | tests/common/test_html.py | Python | agpl-3.0 | 3,869 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | mateusz-blaszkowski/PerfKitBenchmarker | tests/scratch_disk_test.py | Python | apache-2.0 | 5,758 |
from chapter12.textbook12_1 import inorder_tree_walk
from chapter12.textbook12_3 import tree_insert
from datastructures.binary_tree import BinaryTree, Node
from util import between
def inorder_sort(A):
T = BinaryTree()
for i in between(1, A.length):
tree_insert(T, Node(A[i]))
inorder_tree_walk(T.r... | wojtask/CormenPy | src/chapter12/textbook_exercise12_3_3.py | Python | gpl-3.0 | 325 |
"""Contributed 'recipes'"""
| alisaifee/flask-limiter | flask_limiter/contrib/__init__.py | Python | mit | 28 |
""" alcustoms.sql.objects.versioning
Versioning framework for alcustoms.sql.Database objects.
Uses the DotVersion module (previously a class in alcustoms.methods) to parse version numbers.
Example Usage:
from alcustoms.sql import generate_dropcolumn
## Database Subclass with the VersionM... | AdamantLife/alcustoms | alcustoms/sql/objects/versioning.py | Python | gpl-3.0 | 5,916 |
#!/usr/bin/env python
"""TODO(haberman): DO NOT SUBMIT without one-line documentation for make_cmakelists.
TODO(haberman): DO NOT SUBMIT without a detailed description of make_cmakelists.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
impo... | firebase/grpc | third_party/upb/tools/make_cmakelists.py | Python | apache-2.0 | 7,159 |
# This file is a part of datanommer, a message sink for fedmsg.
# Copyright (C) 2014, Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your... | pombredanne/datanommer | datanommer.models/alembic/versions/143ec484f5ba_add_uuid_column.py | Python | gpl-3.0 | 1,242 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module for the chromium_testshell targets."""
import cr
class ChromiumTestShellTarget(cr.NamedTarget):
NAME = 'chromium_testshell'
DEFAULT = cr.Con... | Gateworks/platform-external-chromium_org | tools/cr/cr/targets/chromium_testshell.py | Python | bsd-3-clause | 833 |
from django.shortcuts import render
import srvice
@srvice.program
def message_manager(client, pk, action='get'):
"""
Manage messages using AJAX.
The 'action' attribute can assume the following values:
get:
Fetch a list of messages from the server.
clear:
Mark all ... | jonnatas/codeschool | src/cs_messages/views.py | Python | gpl-3.0 | 397 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="simplemail",
version="1.0",
packages=["simplemail"],
# install_requires=[""],
author="Ilya Otyutskiy",
author_email="ilya.otyutskiy@icloud.com",
maintainer="Ilya Otyutskiy",
url="https://github.com/thesharp/... | thesharp/simplemail | setup.py | Python | mit | 409 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
from djang... | lawzou/shoop | shoop/simple_pricing/admin_form_part.py | Python | agpl-3.0 | 4,068 |
# -----------------------------------------------------------------------------
# calclex.py
# -----------------------------------------------------------------------------
import ply.lex as lex
tokens = (
'NAME','NUMBER',
'PLUS','MINUS','TIMES','DIVIDE','EQUALS',
'LPAREN','RPAREN',
)
# Tokens
t_PLU... | JaDogg/__py_playground | reference/ply-3.8/test/pkg_test4/parsing/calclex.py | Python | mit | 892 |
import pytest
import abjad
def test_Container_extend_01():
"""
Extend container with list of leaves.
"""
voice = abjad.Voice("c'8 d'8")
abjad.beam(voice[:])
voice.extend([abjad.Note("c'8"), abjad.Note("d'8")])
assert abjad.lilypond(voice) == abjad.string.normalize(
r"""
... | Abjad/abjad | tests/test_Container_extend.py | Python | gpl-3.0 | 6,074 |
from pymongo import MongoClient
import gridfs
class mongodb(object):
def __init__(self, artifact):
self.artifact = artifact
self.config = artifact.config
client = MongoClient(self.config.mongo_host)
db = client.smass
self.collection = db.analysis
self.fs = gridfs.Gri... | espenfjo/smass | lib/database/mongodb.py | Python | gpl-3.0 | 328 |
#!/usr/bin/env python
""" simscript main - automation of virtual inputs for simulators """
import sys,os,time,logging,tempfile,traceback,getopt,subprocess
def modulo(value,start,end):
if value!=value: #NaN check
return value
value = (value - start) % (end-start)
value = start+value if value>=0 el... | Denney/SimScript | simscript.py | Python | bsd-3-clause | 8,818 |
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
import unittest
import frappe
from erpnext.education.doctype.course.test_course import make_course, make_course_and_linked_topic
from erpnext.education.doctype.topic.test_topic import make_topic_and_linked_content
test_data = {
"program_n... | frappe/erpnext | erpnext/education/doctype/program/test_program.py | Python | gpl-3.0 | 2,771 |
from __future__ import unicode_literals
import os
import warnings
import yaml
__author__ = "Pymatgen Development Team"
__email__ ="pymatgen@googlegroups.com"
__maintainer__ = "Shyue Ping Ong"
__maintainer_email__ ="shyuep@gmail.com"
__date__ = "May 14 2017"
__version__ = "4.7.6"
SETTINGS_FILE = os.path.join(os.path... | tallakahath/pymatgen | pymatgen/__init__.py | Python | mit | 2,773 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cuenta',
fields=[
('id', models.AutoField(verbo... | montenegroariel/sigos | apps/cuentas/migrations/0001_initial.py | Python | gpl-3.0 | 837 |
from __future__ import division
'''Implements Sum-Product Algorithm and Sampling over Factor Graphs'''
import os
import csv
import sys
import copy
import inspect
import random
from collections import defaultdict
from itertools import product as iter_product
from Queue import Queue
import sqlite3
from prettytable impo... | kamijawa/ogc_server | bayesian/factor_graph.py | Python | mit | 39,129 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
from helfertool.utils import nopermission
from registration.decor... | helfertool/helfertool | src/badges/views/register.py | Python | agpl-3.0 | 1,633 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-25 18:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transcript', '0025_transcriptphrasecorrectionvote_original_phrase'),
]
operations =... | WGBH/FixIt | mla_game/apps/transcript/migrations/0026_transcript_active.py | Python | mit | 486 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @author:Hieda no Chiaki <i@wind.moe>
| forblackking/PyBiu | src/__init__.py | Python | apache-2.0 | 86 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
RasterDisplayComposer
A QGIS plugin
Compose RGB image display from different bands
-------------------
begin : 2016-02-13
... | amondot/RasterDisplayComposer | RasterDisplayComposer.py | Python | gpl-3.0 | 19,263 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import keras.backend as K
from keras.datasets import mnist
from keras.layers import *
from keras.models import *
from keras.optimizers import *
from keras.initializers import *
from keras.utils.generic_utils import Progbar
GPU = "0"... | antkillerfarm/antkillerfarm_crazy | python/ml/keras/hello_gan1.py | Python | gpl-3.0 | 8,363 |
# Runs all multi-d datasets
Experiment(description='Run all multi D datasets',
data_dir='../data/kfold_data/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=2,
sd=4,
max_jobs=400... | ekamioka/gp-structure-search | experiments/multi-d-6May.py | Python | mit | 574 |
from rest_framework import serializers as ser
from rest_framework import exceptions
from osf.exceptions import ValidationError
from osf.models import ApiOAuth2PersonalToken, ApiOAuth2Scope
from api.base.exceptions import format_validation_error
from api.base.serializers import JSONAPISerializer, LinksField, IDField, ... | mfraezz/osf.io | api/tokens/serializers.py | Python | apache-2.0 | 6,614 |
# -*- coding: utf-8 -*-
import datetime
import constants
# Choose and configure the browser of your choice
def get_browser():
return webdriver.Chrome()
# The host and port where the tested ap shoud listen.
HOST = '127.0.0.1'
PORT = 8080
# The host alias set in the /etc/hosts file.
# The actual tests will navi... | viksvampire19/Twigle | authomatic-master/tests/functional_tests/config-template.py | Python | mit | 6,344 |
#N,M = map(int,raw_input().split())
N,M = 10,9
arr = [0]*M
#for i in xrange(M):
# arr[i] = map(int,raw_input().split())
arr = [[2, 1], [3, 1], [4, 3], [5, 2], [6, 1], [7, 2], [8, 6], [9, 8], [10, 8]]
sol = [1]*(N+1)
for (a,b) in reversed(arr):
sol[b] += sol[a]
#count number of even ele... | khaleeque-ansari/Online-Coding- | Hackerrank/Graph Theory/EvenTree.py | Python | apache-2.0 | 419 |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free sof... | leomorsy/medical7.0 | oemedical_emr/models/oemedical_operational_sector.py | Python | agpl-3.0 | 1,771 |
import cherrypy
from cherrypy.test import helper
class ETagTest(helper.CPWebCase):
def setup_server():
class Root:
def resource(self):
return "Oh wah ta goo Siam."
resource.exposed = True
def fail(self, code):
code = int(cod... | evilhero/mylar | lib/cherrypy/test/test_etags.py | Python | gpl-3.0 | 3,071 |
class MapManager:
def __init__(self, mywiz, world, game):
if 1:#game.fraction == 'dire':
self.home = (9,1)
else:
self.home = (1,9)
self.mywiz = mywiz
self.world = world
self.map_area = [(0,0),(world.width, world.height)]
self.lanes = ... | Kintull/AiCupBot | MapManager.py | Python | gpl-3.0 | 3,497 |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name = 'music_looper',
version = '1.0.0',
author = 'Matheus Schuh',
author_email = 'matheus.schuh@gmail.com',
description = 'Application to turn yo... | mschuh/pi_music_looper | setup.py | Python | gpl-2.0 | 576 |
"""Platform for Time of Flight sensor VL53L1X from STMicroelectronics."""
import asyncio
import logging
from functools import partial
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.components import rpi_gpio... | jamespcole/home-assistant | homeassistant/components/tof/sensor.py | Python | apache-2.0 | 3,585 |
#!/usr/bin/python
__author__ = 'guorongxu'
import re
import logging
from Bio import Entrez
from Bio import Medline
def query(geneName):
Entrez.email = "A.N.Other@example.com"
queryTerm = geneName + "[All Fields] AND (\"human\"[All Fields) AND (\"gene\"[All Fields) "
handle = Entrez.esearch(db="pubmed", ... | ucsd-ccbb/Oncolist | src/server/Pubmed/ESearch.py | Python | mit | 2,690 |
#! /usr/bin/env python
import os
import sys
from django.conf import settings
DIRNAME = os.path.abspath(os.path.dirname(__file__))
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
INSTALLE... | fankcoder/django-wkhtmltopdf | wkhtmltopdf/tests/run.py | Python | bsd-2-clause | 819 |
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from time import time
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs, load_digits
from sklearn import metrics
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
def _wrong_assumption():
plt.fi... | DoWhatILove/turtle | programming/python/library/scikit-learn/clustering/kmeans.py | Python | mit | 4,821 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/security_rule.py | Python | mit | 7,479 |
import md5
import os
import json
import tensorflow as tf
import importlib
import itertools
import sys
def model_factory(module_name, cls_name, path, config):
if isinstance(config, basestring):
config = json.loads(config)
print('importing ' + module_name)
module = importlib.import_module(module_name... | adhertz/tensorblocks | tensorblocks/model.py | Python | mit | 13,589 |
#!/usr/bin/python
# --------------------------------------------
# __author__ = "Kimi Jin"
# __copyright__ = "Copyright 2016, PrettyYes"
# __version__ = "1.0.1"
# __maintainer__ = "Kimi Jin"
# __email__ = "kimi@prettyyes.com"
# __created__ = "2/25/16"
# __status__ = "Production"
# --------------------------------------... | Guiders/CoreIce | webapp/urls.py | Python | apache-2.0 | 560 |
import hashlib
from setuptools import setup
from setuptools.command.install import install
import shutil
import urllib
import os
import subprocess
import sys
import tarfile
import HPOlib
here = os.path.abspath(os.path.dirname(__file__))
desc = 'A software that can be used to evaluate either black boxes or hyperparame... | claesenm/optunity-benchmark | setup.py | Python | gpl-3.0 | 12,993 |
from StringIO import StringIO
import unittest
from compbio import phylo
from compbio.vis import transsvg
from rasmus.testing import make_clean_dir
from rasmus import treelib
stree_newick = """((((sde1:1,sde2:1):2,sdd:3):1,(spy1:2,spy2:2):2):1,see:5);"""
smapfile = StringIO("""\
SDE1* sde1
SDEG* sde2
SDD* sdd
SpyM... | wutron/compbio | test/compbio/test_vistrans.py | Python | mit | 4,045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.