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 |
|---|---|---|---|---|---|
import logging.config
from pyramid.config import Configurator
import pyramid_jwtauth
from pyramid.security import Allow, Everyone, Authenticated
class RootFactory(object):
__acl__ = [(Allow, Authenticated, 'user'),
(Allow, 'admin', ('admin'))]
def __init__(self, request):
pass
def ... | riccardocagnasso/jwtauth_aiopyramid_test | jwtauth_test/__init__.py | Python | mit | 876 |
from decouple import config
DEBUG = config('DEBUG', cast=bool)
TOKEN = config('TOKEN', cast=str)
GAME = config('GAME', cast=str)
DESC = config('DESC', cast=str)
SERVER_NAME = config('SERVER_NAME', cast=str)
TEST_CHANNEL = config('TEST_CHANNEL', cast=str, default=None)
COMMAND_PREFIX = config('COMMAND_PREFIX', cast=str... | supranstd/bot | supran/settings.py | Python | mit | 335 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from builtins import str
from builtins import object
__author__ = 'carolinux'
"""
Helper functions that manage getting layer settings from a variety of sources - the timelayer
layer, the addLayerOptions gui, the widget table and the sav... | anitagraser/TimeManager | layers/layer_settings.py | Python | gpl-2.0 | 7,248 |
#!/usr/bin/python
"""Test of tree table output using Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(3000))
sequence.append(KeyComboAction("<Alt>b"))
sequence.append(KeyComboAction("Return"))
sequence.append(PauseAction(3000))
sequence.append(KeyComboA... | GNOME/orca | test/keystrokes/firefox/ui_role_tree_table.py | Python | lgpl-2.1 | 1,762 |
from django.contrib import admin
from .models import Question, Answer, Upvote, Categories, Customuser
from .forms import add_Question_Form, add_Answer_Form, CustomuserAdminForm
class QuestionAdmin(admin.ModelAdmin):
list_display = ["__unicode__","timestamp"]
readonly_fields=("question_text","follow","author")
#for... | aadithyamd/QandA | QA/admin.py | Python | mit | 1,187 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 Softw... | xguse/outspline | src/outspline/interfaces/wxgui/about.py | Python | gpl-3.0 | 13,106 |
from distutils.core import setup
import sys
import os
# require import
import py2exe
# require shadowsocks
sspath = os.path.abspath(os.path.join("..", "shadowsocks"))
if not os.path.isdir(sspath):
raise IOError("require shadowsocks")
sys.path.append(sspath)
with open('README.rst') as f:
long_... | liyan1972/ChinaDNS | py2exe_setup.py | Python | mit | 1,210 |
# Copyright (c) 2008-2009 Pedro Matiello <pmatiello@gmail.com>
# Zsolt Haraszti <zsolt@drawwell.net>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restri... | cwacek/experimentor_tools | pygraph/algorithms/generators.py | Python | mit | 3,962 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 14:27:37 2015
@author: Jaromir Camphuijsen (6042473) and Eva van Weel(10244743)
"""
#This code is based on code found at: http://www.vtk.org/gitweb?p=VTK.git;
#a=blob;f=Examples/Medical/Python/Medical3.py
import Tkinter
import vtk
from vtk.tk.vtkTkRenderWidget import... | JaroCamphuijsen/SVVR | Assignment 2/Assignment2.py | Python | gpl-2.0 | 3,968 |
from django.conf.urls.defaults import patterns
from qna import views
from qna.models import Question
from voting.views import xmlhttprequest_vote_on_object
urlpatterns = patterns('',
(r'^question/ask/$', views.ask),
(r'^question/(\d+)/$', views.question),
(r'^question/(\d+)/answer/$', views.answer),
(r... | fosslabs/django-qna | src/qna/urls.py | Python | bsd-3-clause | 536 |
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2016, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
#####################################... | krull/docker-zenoss4 | init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.Microsoft.Windows-2.6.9.egg/ZenPacks/zenoss/Microsoft/Windows/ClusterInterface.py | Python | gpl-3.0 | 939 |
"""
Learner profile settings and helper methods.
"""
from openedx.core.djangoapps.waffle_utils import WaffleFlag, WaffleFlagNamespace
# Namespace for learner profile waffle flags.
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='learner_profile')
# Waffle flag for showing a message about the new profile features.
... | ahmedaljazzar/edx-platform | openedx/features/learner_profile/__init__.py | Python | agpl-3.0 | 639 |
#!/usr/bin/env python3
#
# Copyright (c) 2019, Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import shutil
import os
import sys
import filecmp
import logging
def main():
parser = argparse.ArgumentParser(
description="""Maintains a shadow copy of generated files. Restores thei... | ldts/zephyr | doc/scripts/restore_modification_times.py | Python | apache-2.0 | 3,393 |
from unittest import TestCase, main
from Rammbock import Rammbock
class TestParamParsing(TestCase):
def setUp(self):
self.rammbock = Rammbock()
def test_create_three_dicts(self):
confs, pdu_fields, header_fields = self.rammbock._parse_parameters(['foo=bar', 'doo:dar'])
self.assertEqu... | samratashok87/Rammbock | utest/test_rammbock.py | Python | apache-2.0 | 3,949 |
import os
from premailer import Premailer
TEMPLATES_DIR = 'formspree/templates/email/pre_inline_style/'
def generate_templates():
template_map = dict()
for filename in os.listdir(TEMPLATES_DIR):
if filename.endswith('.html'):
with open(os.path.join(TEMPLATES_DIR, filename), 'r') as html:
... | asm-products/formspree | formspree/template.py | Python | agpl-3.0 | 867 |
from __future__ import absolute_import
from usaidmmc.celery import app as celery_app # flake8: noqa
| praekelt/django-usaid-mmc | usaidmmc/__init__.py | Python | bsd-3-clause | 100 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='TrackingEvent',
fields=[
('id', models.AutoFiel... | smn/garelay | garelay/tracker/migrations/0001_initial.py | Python | bsd-2-clause | 1,310 |
#!/usr/bin/env python
"""
.. py:currentmodule:: pymcxray.FileFormat.Results.XraySpectraRegionEmitted
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Read XraySpectraRegionEmitted mcxray result file.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgi... | drix00/pymcxray | pymcxray/FileFormat/Results/XraySpectraRegionEmitted.py | Python | apache-2.0 | 4,773 |
class Solution(object):
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i, n in enumerate(nums, 1):
while i != n and nums[n - 1] != n:
nums[i - 1], nums[n - 1] = nums[n - 1], nums[i - 1]
n = nums[i... | ckclark/leetcode | py/set-mismatch.py | Python | apache-2.0 | 419 |
import heapq
with open("day-15.txt") as f:
lines = [line for line in f.read().rstrip().splitlines()]
graph = {}
for i, row in enumerate(lines):
for j, n in enumerate(row):
graph[i, j] = int(n)
DELTAS = (
(0, 1),
(1, 0),
(-1, 0),
(0, -1),
)
FACTOR = 5
def get_risk(graph, rows, i, j):... | scorphus/sparring | advent-of-code/2021/day-15-part-2.py | Python | mit | 1,058 |
import datetime
import os
import time
from nose2.tools import params
from test import GithubBoardTestCase
from test import mock
from github_board import board_origin, UTC_TO_PST_OFFSET
class TestBoardOrigin(GithubBoardTestCase):
@params(
(datetime.date(1971, 1, 1), "UTC", 0, UTC_TO_PST_OFFSET),
... | bayandin/github-board | test/test_board_origin.py | Python | mit | 1,156 |
# -*- coding: utf-8 -*-
"""Page model for Automation/Anisble/Credentials"""
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.exceptions import NoSuchElementException
from widgetastic.utils import ParametrizedLocator, VersionPick
from widgetastic.widget import ConditionalSwitchab... | quarckster/cfme_tests | cfme/ansible/credentials.py | Python | gpl-2.0 | 14,297 |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
import networkx as nx
import math
import creategraph
fig = plt.figure()
projectname = "tomcat_history/tomcat6.0.0/tomcat"
[g, nodes] = creategraph.readfile(projectname)
#print g
sg = creategraph.refine(g, 40)
[pos,x,y] = cre... | plumer/codana | archive/visualize.py | Python | mit | 2,435 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
from lizard_efcis.settings import *
DEBUG = True
LOGGING['loggers']['']['level'] = 'DEBUG'
RAVEN_CONFIG = {}
# ENGINE: 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
# In case of geodatabase, prepend with:
# django.contrib.gis.db.backend... | lizardsystem/lizard-efcis | lizard_efcis/developmentsettings.py | Python | gpl-3.0 | 1,501 |
import re
from helpers import subleq
from helpers import next_subleq
from helpers import clear
def icmpParseArgs(argStr):
args = [];
args.append(re.findall("\s*\w*(?=\s)",argStr)[0].strip()); #comparison type
args.append(re.findall("(?<=i32\s)[^,]*(?=,)",argStr)[0].strip()); #first operand
args.append(re.findall(... | purisc-group/purisc | compiler/class_def/conversions/logical.py | Python | gpl-2.0 | 4,377 |
from bs4 import BeautifulSoup
import requests
import base64
def crawler(url):
'''
Handles the actual crawling.
If the response headers of our HTTP GET request to the desired URL includes the word 'image', then we return the content of the response,
n base64 format (simplest way to get images embedded, it ... | AkshatM/Scribe | server/crawler.py | Python | cc0-1.0 | 1,312 |
#=============
import sqlite3
import subprocess
from datetime import datetime
import urllib
def init_db():
conn = sqlite3.connect('update_log.db')
c = conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS update_dates(data_source TEXT, last_update DATETIME)')
conn.commit()
conn.close()
#check ... | jerrylei98/graphene | curation.py | Python | apache-2.0 | 3,149 |
import tweepy
from auth import authenticate
from collections import Counter
"""
This script tells you who the Tweetiest/most prolific people you
follow are.
Fetch the most recent 800 (Twitter limit) tweets on your timeline.
Count how many tweets each person emitted. Output something like
this:
Period: 2014-07-20 19... | marcua/nommer | timeline_stats.py | Python | bsd-3-clause | 1,321 |
# -*- 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):
# Changing field 'Version.version'
db.alter_column(u'pypi_version', 'version', self.gf('django.db.models.fi... | kitsunde/django-pypi | pypi/migrations/0004_auto__chg_field_version_version.py | Python | mit | 2,623 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maito'
__all__ = ['add2zip_list']
##########
import sys
import argparse
import codecs
import csv
##########
class Add2zip(object):
"""
[CLASSES] Class説明文
"""
def parse_address(address):
return([])
def add_csv2list(address_list... | maito610/Data_cleaning_tools | get_zipcode_from_address/add2zip_list.py | Python | gpl-3.0 | 1,923 |
from test.test_dga import TestDGA
from dgacollection.Cryptolocker import Cryptolocker
from unittest import TestCase
"""Examples of domains.
Usually found with the reverse engineering analysis.
"""
cryptolocker_domains = ['19/12/2013',
['sljjjupfgagolpg.ru', 'vxagtvsyqxtrfcm.com',
... | pchaigno/dga-collection | test/test_cryptolocker.py | Python | mit | 1,175 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : Jianwei Fu
# E-mail : jianwei1031@gmail.com
# Date : 15/12/21 12:16:41
# Desc :
#
| hellokuku/livetzc | plugins/movies.py | Python | mit | 166 |
#!/usr/bin/env python3
"""
This script tests the localized spectral analysis routines
"""
import numpy as np
import pyshtools
from pyshtools import shtools
pyshtools.utils.figstyle()
def main():
test_MultitaperSE()
def test_MultitaperSE():
print('\n---- testing SHReturnTapersM ----')
theta0_deg = 20.
... | SHTOOLS/SHTOOLS | examples/python/LocalizedSpectralAnalysis/SHMultitaperSE.py | Python | bsd-3-clause | 3,736 |
from proteus import *
from kappa_p import *
from proteus import Context
ct = Context.get()
timeIntegration = BackwardEuler_cfl
stepController = Min_dt_cfl_controller
femSpaces = {0:basis}
massLumping = False
numericalFluxType = Kappa.NumericalFlux
conservativeFlux = None
subgridError = Kappa.SubgridErr... | erdc-cm/air-water-vv | 2d/benchmarks/flatPlate_wallFunctions/kappa_n.py | Python | mit | 1,287 |
# MIT License
#
# Copyright (c) 2016 Daily Actie
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... | DailyActie/Surrogate-Model | surrogate/selection/utils/assignCrowdingDist.py | Python | mit | 2,167 |
"""
Instaclone configuration handling.
"""
__author__ = 'jlevy'
import logging as log
import os
import re
import sys
from collections import namedtuple, OrderedDict
from enum import Enum # enum34 pip
import yaml # PyYAML pip
from functools32 import lru_cache # functools32 pip
from log_calls import log_calls
imp... | jlevy/instaclone | instaclone/configs.py | Python | apache-2.0 | 5,665 |
# This file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... | d7415/merlin | Hooks/user/addchan.py | Python | gpl-2.0 | 2,441 |
#!/usr/bin/env python
# Copyright (c) 2010-2012 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 a... | williamthegrey/swift | test/unit/proxy/controllers/test_obj.py | Python | apache-2.0 | 105,184 |
#!/usr/bin/env python
import cherrypy
import os
import glob
import re
import subprocess
from subprocess import Popen
USER_DIR = '.wahcade'
IMAGE_FILETYPES= ['jpg', 'jpeg', 'png', 'bmp', 'gif','svg']
class WebCade(object):
@cherrypy.expose
def launch(self, r=None):
if r:
self.wc_launch(r)
@cherrypy.expose... | sairuk/webcade | wahcade.py | Python | gpl-2.0 | 10,039 |
from ..field import Field
class Integer(Field):
min = None
max = None
messages = {
'type': 'Invalid number.',
'min': 'Must not be lower than {min}.',
'max': 'Must not be higher than {max}.',
}
def validate(self, value):
try:
value = int(value)
... | hugollm/lie2me | lie2me/fields/integer.py | Python | mit | 567 |
# (C) British Crown Copyright 2010 - 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | scollis/iris | lib/iris/tests/test_hybrid.py | Python | gpl-3.0 | 9,277 |
#!/usr/bin/python
# Part of Latex-Suite
#
# Copyright: Srinath Avadhanula
# Description:
# This file implements a simple outline creation for latex documents.
import re
import os
import sys
import StringIO
# getFileContents {{{
def getFileContents(fname):
if type(fname) is not str:
fname = fname.group(... | xsyn/dotfiles | vim/vim.symlink/ftplugin/latex-suite/outline.py | Python | mit | 6,274 |
"""
Bing (Images)
@website https://www.bing.com/images
@provide-api yes (http://datamarket.azure.com/dataset/bing/search),
max. 5000 query/month
@using-api no (because of query limit)
@results HTML (using search portal)
@stable no (HTML can change)
@parse url, title, img_src
... | gugod/searx | searx/engines/bing_images.py | Python | agpl-3.0 | 2,631 |
from numpy.testing import assert_array_equal
from nose.tools import raises
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab.grid.unstructured.links import (link_ids_at_node,
in_link_ids_at_node,
... | decvalts/landlab | landlab/grid/unstructured/tests/test_links.py | Python | mit | 3,086 |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from app import app
import gevent
from gevent.pywsgi import WSGIServer
from gevent.pool import Pool
from gevent import monkey
import signal
monkey.patch_all()
server = WSGIServer(('', 5000), app, spawn=Pool(None))
def stop():
se... | Jumpscale/go-raml | codegen/fixtures/congo/python_server/server.py | Python | bsd-2-clause | 425 |
from ..module import B
class A(B):
def foo(self):
pass
def func(x):
x.foo()
x.bar() | east825/green-type | test/test_data/resolve/local/import_from/relative/import_star/p1/p2/main.py | Python | mit | 105 |
from setuptools import find_packages, setup
import os
import sys
PYTHON3 = sys.version_info > (3, )
HERE = os.path.abspath(os.path.dirname(__file__))
def readme():
with open(os.path.join(HERE, 'README.md')) as f:
return f.read()
def get_version():
with open(os.path.join(HERE, 'thrift_tools/__init... | shrijeet/thrift-tools | setup.py | Python | apache-2.0 | 1,893 |
#!/usr/bin/python
"""fio-multiplexer tool
Usage: ./run.py [[-c|--config=] <config.ini>] [[-v|--vms=] <vms.ini>] [-h|--help]
-c|--config configuration file that will be used as base for
fio tool
-v|--vms configuration file that describes every virtual
... | otubo/fio-multiplexer | run.py | Python | gpl-2.0 | 16,753 |
# the main Flask application
from outline_client import create_outline_app
app = create_outline_app(root='outline_client')
if __name__ == "__main__":
app.run(**app.config['INIT'])
| Braiiin/outline-client | run.py | Python | apache-2.0 | 183 |
from tastypie.resources import ModelResource
from tastypie.contrib.gis.resources import ModelResource
from tastypie import fields
from tastypie import utils
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import DjangoAuthorization
from tastypie.validation import Validation, FormVal... | i-DAT-Qualia/Qualia-Urban | app/media/api/resources.py | Python | gpl-3.0 | 1,630 |
import sys
import time
import os
import logging
import nose
import angr
l = logging.getLogger("angr_tests")
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
vfg_0_addresses = {
'x86_64': 0x40055c
}
def run_vfg_0(arch):
proj = angr.Project(os.path.join(... | GuardianRG/angr | tests/test_vfg.py | Python | bsd-2-clause | 4,537 |
from django import forms
from . import models
from apps.utils import forms as utils, constants
from django.forms import models as models_form
from apps.personas import models as persona_models
class VacanteForm(utils.BaseFormAllFields):
title = 'Vacante'
fecha = forms.DateField(input_formats=constants.INPUT_F... | 0sw4l/villas-de-san-pablo | apps/empleabilidad/forms.py | Python | mit | 1,944 |
import asyncio
from itertools import compress
import traceback
from proxypool.rules.rule_base import CrawlerRuleBase
from proxypool.utils import page_download, page_download_phantomjs, logger, Result
class ProxyCrawler(object):
"""Crawl proxies according to the rules."""
def __init__(self, proxies, rules=No... | arrti/proxypool | proxypool/proxy_crawler.py | Python | apache-2.0 | 4,906 |
# -*- coding: utf-8 -*-
#
# Jansson documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 5 21:47:20 2010.
#
# 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... | neurodrone/jansson | doc/conf.py | Python | mit | 7,023 |
# -*- coding: utf-8 -*-
## Copyright (C) 2014 Bitergia
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## Thi... | jalonsob/Informes | grimoirelib_alch/tests/test_type_activity.py | Python | gpl-3.0 | 2,829 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2012 Rosen Diankov <rosen.diankov@gmail.com>
#
# 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
#
# ... | vitan/openrave | test/test_environment.py | Python | lgpl-3.0 | 10,766 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import json
from keras.models import Model
from keras.layers import Input, Conv2D, MaxPool2D, Flatten, Dense
if __name__ == '__main__':
inpData = Input(shape=(3,128,128))
x = Conv2D(filters=8, kernel_size=(3, 3), activation='relu')(inpData)
x = ... | SummaLabs/DLS | app/backend-test/keras_2x_api/run01_print_keras_model_json.py | Python | mit | 836 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | dawnpower/nova | nova/api/metadata/handler.py | Python | apache-2.0 | 8,937 |
import sys
import re
import sh
try:
import cStringIO as StringIO
except:
import StringIO
################
# BASE CLASSES #
################
class Alert(object):
"""
Define an alert for the rackspace-monitor. Your check's alerts() method should return an array
of these objects, which are used to g... | evilchili/raxalert | checks.py | Python | mit | 18,008 |
from migen import *
from migen.genlib.fsm import *
from migen.genlib.misc import WaitTimer
from misoc.interconnect import wishbone
class AD9_DDS(Module):
"""Wishbone interface to the AD9858 and AD9914 DDS chips.
Addresses 0-2**len(pads.a)-1 map the AD9xxx registers.
Write to address 2**len(pads.a) to pu... | JQIamo/artiq | artiq/gateware/ad9_dds.py | Python | lgpl-3.0 | 5,150 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['LinearTrend'] , ['Seasonal_DayOfWeek'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_LinearTrend_Seasonal_DayOfWeek_SVR.py | Python | bsd-3-clause | 166 |
import feedparser
from random import randint
from flask import Flask
app = Flask(__name__)
RSS_FEEDS = {
'bbc' : 'http://feeds.bbci.co.uk/news/rss.xml',
'cnn' : 'http://rss.cnn.com/rss/edition.rss',
'fox' : 'http://feeds.foxnews.com/foxnews/latest',
'iol' : 'http://www.iol.co.za/cmlink/1.640'
}
@app.... | nirajkvinit/flask-headlines | upto_ch4/headlines3.py | Python | mit | 1,110 |
import pygame, math
import numpy as np
class Graph():
def __init__(self, display, sensor):
self.heightPercent = 1.0 / 1
self.display = display
self.sensor = sensor
self.width = self.display.width
self.height = self.display.height * self.heightPercent
self.x = 0
self.colors = (
(128, 0, 0), (0, 255,... | Psychedelic-Engineering/sleep-machine | display/graph.py | Python | mit | 3,432 |
"""
Note: this file is very out of date, and is not current with the rest of the
library
"""
import threading
from pprint import pprint, pformat
import pytweener
import time
import StringIO
import sys
import os
from subprocess import Popen, call, STDOUT, PIPE
def sh(cmd):
return Popen(cmd,shell=True,stdout=PIPE... | ptone/BirdFish | birdfish/scene.py | Python | bsd-3-clause | 10,859 |
import threading
import time
import os
from termcolor import colored
class SleepableThread(threading.Thread):
def __init__(self):
super(SleepableThread, self).__init__()
self.create_thread()
self.start_thread()
thread = None
thread_pid = ''
thread_spawn_count = 0
thread_s... | MJWherry/Greggg-Python | Utilities/SleepableThread.py | Python | mit | 4,594 |
# -*- coding: utf-8 -*-
from .xml import LXMLSpiderMeta
from .html import BLOGSpiderMeta
from .spider import ErrbackSpider
SpiderMetaClses = {
'xml': LXMLSpiderMeta,
'blog': BLOGSpiderMeta
}
__all__ = [
'ErrbackSpider',
'SpiderMetaClses'
]
| alone-walker/BlogSpider | spider/src/mydm/spider/__init__.py | Python | mit | 262 |
"""
Evaluate hermite polynomials using cuda
* use modified version of previously written polynomial evaluator
"""
import warnings
warnings.simplefilter('ignore',Warning)
import numpy
import time
from math import sqrt, log10, exp, ceil
import sys
from optparse import OptionParser
from scipy.special import hermite
im... | barbagroup/cufast | eval_hermite_final.py | Python | mit | 10,640 |
import telebot
from telebot import types,util
bot = telebot.TeleBot("token")
#chat_member_handler. When status changes, telegram gives update. check status from old_chat_member and new_chat_member.
@bot.chat_member_handler()
def chat_m(message: types.ChatMemberUpdated):
old = message.old_chat_member
new = mes... | eternnoir/pyTelegramBotAPI | examples/chat_member_example.py | Python | gpl-2.0 | 1,552 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.task.task... | cevaris/pants | testprojects/src/python/plugins/dummy_options/tasks/dummy_options.py | Python | apache-2.0 | 931 |
# 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... | tseaver/gcloud-python | datastore/google/cloud/datastore/helpers.py | Python | apache-2.0 | 17,375 |
# Copyright 2016 Brian Innes
#
# 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, ... | brianinnes/vPiP | python/test2.py | Python | apache-2.0 | 1,586 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | Tset-Noitamotua/_learnpython | playground/populators.py | Python | gpl-2.0 | 8,400 |
#!/usr/bin/python
'''
@file test-uart.py
@author Pere Tuset-Peiro (peretuset@openmote.com)
@version v0.1
@date May, 2015
@brief
@copyright Copyright 2015, OpenMote Technologies, S.L.
This file is licensed under the GNU General Public License v2.
'''
import os, sys
library_path... | tdautc19841202/firmware | test/test-uart/test-uart.py | Python | gpl-2.0 | 508 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.transla... | suutari-ai/shoop | shuup/testing/admin_module/toolbar.py | Python | agpl-3.0 | 1,530 |
# api/resources/__init__.py
from flask import Blueprint
from flask_restful import Api
from api import add_cors_headers
from api.resources.bucketlist import \
(ResourceBucketList, ResourceBucketLists, ResourceBucketItem, ResourceBucketItems)
# arguments: blueprint name and a module/package where the blueprint is lo... | Mbarak-Mbigo/cp2_bucketlist | api/resources/__init__.py | Python | mit | 791 |
# Author: Stefan Wunsch CERN 08/2018
################################################################################
# Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. #
# All rights reserved. #
# ... | karies/root | bindings/pyroot/pythonizations/python/ROOT/pythonization/_stl_vector.py | Python | lgpl-2.1 | 1,080 |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal... | CalebBell/fluids | tests/test_nrlmsise00_full.py | Python | mit | 4,237 |
#!/usr/bin/env python
# Copyright (c) 2017, Intel Corporation.
#
# 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 applic... | taf3/taf | taf/testlib/pypacker_server.py | Python | apache-2.0 | 9,056 |
"""Set up the app."""
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension
from flask_security import SQLAlchemyUserDatastore, Security
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('config')
socketio = SocketIO(app, asy... | eirism/PU-66 | iris/__init__.py | Python | mit | 578 |
'''
Created on Sep 9, 2015
@author: wirkert
'''
import unittest
import filecmp
import os
from mc.tissuemodels import GenericTissue
this_dir, this_filename = os.path.split(__file__)
DATA_PATH = os.path.join(this_dir, "..", "data")
class TestTissueModels(unittest.TestCase):
def setUp(self):
self.mci_fi... | iwegner/MITK | Modules/Biophotonics/python/iMC/mc/test/test_tissuemodels.py | Python | bsd-3-clause | 1,540 |
# -*- coding: latin-1 -*-
import spotipy
from spotipy import util
import unittest
import pprint
import sys
'''
Since these tests require authentication they are maintained
separately from the other tests.
These tests try to be benign and leave your collection and
playlists in a relatively stable sta... | joohoi/spotipy | tests/authtests.py | Python | mit | 6,126 |
# urls.py:
# Mapping from URLs to view functions for Bin Alerts.
#
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: duncan@mysociety.org; WWW: http://www.mysociety.org/
from django.conf.urls.defaults import *
import django.views.static
import djangoproj.settings
from django.contrib impo... | mysociety/binalerts | pylib/djangoproj/urls.py | Python | agpl-3.0 | 1,350 |
from django.contrib import admin
from .models import *
class DepartamentoAdmin(admin.ModelAdmin):
list_display = ['nombre']
list_filter = ['nombre']
prepopulated_fields = {"slug": ("nombre",)}
search_fields = ['nombre']
class MunicipioAdmin(admin.ModelAdmin):
list_display = ['nombre','departamento... | ErickMurillo/ciat_analisis_org | lugar/admin.py | Python | mit | 739 |
import numpy as np
from ase.structure import molecule
from gpaw import GPAW
unitcell = np.array([6.5, 6.6, 9.])
gridrefinement = 2
for formula in ('Na', 'Cl', 'NaCl',):
calc = GPAW(xc='PBE',
nbands=-5,
h=0.18,
convergence={'eigenstates':1E-8},
txt=... | ajylee/gpaw-rtxs | doc/tutorials/all-electron/NaCl.py | Python | gpl-3.0 | 835 |
import theano
import theano.tensor as T
from .. import activations, initializations
from .. utils.theano_utils import shared_zeros
from .. layers.core import Layer
import pdb
class BatchNormalization(Layer):
"""
Batch Normalization:
Published by S. Ioffee and C. Szegedy from Google.Solve the gradient
... | shenxudeu/deuNN | deuNet/layers/batch_normalization.py | Python | mit | 4,407 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import parse_duration
class DiscoveryVRIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?discoveryvr\.com/watch/(?P<id>[^/?#]+)'
_TEST = {
'url': 'http://www.discoveryvr.com/watch/discovery-vr-an-introductio... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/discoveryvr.py | Python | gpl-3.0 | 1,781 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | david-ragazzi/nupic | nupic/support/pymysqlhelpers.py | Python | gpl-3.0 | 4,303 |
from uber.common import *
import shutil
import pytest
from sideboard.tests import patch_session
@pytest.fixture(scope='session', autouse=True)
def init_db(request):
patch_session(Session, request)
register_session_listeners()
with Session() as session:
session.add(Attendee(
placeholder... | bds002/ubersystem | uber/tests/conftest.py | Python | gpl-3.0 | 2,765 |
""""Automatically rewrite modules with the import blocks sorted."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# fiximports
#
# Public Classes:
# ProcessingException
#
# Public Functions:
# ... | cs-shadow/phabricator-tools | meta/autofix/fiximports.py | Python | apache-2.0 | 6,078 |
class Solution(object):
def addBinary(self, a, b):
len_a = len(a)
len_b = len(b)
length = max(len_a, len_b)
c = [0] * (length + 1)
if len_a < len_b:
a, b = b, a
len_a, len_b = len_b, len_a
for i in range(0, length):
if len_a - 1 - ... | luosch/leetcode | python/Add Binary.py | Python | mit | 964 |
import tkinter as tk
from tkinter import *
import spotipy
import webbrowser
from PIL import Image, ImageTk
import os
from twitter import *
from io import BytesIO
import urllib.request
import urllib.parse
import PIL.Image
from PIL import ImageTk
import simplejson
song1 = "spotify:artist:58lV9VcRSjABbAbfWS6skp"
song2 = ... | AndrewKLeech/Pip-Boy | Game.py | Python | mit | 42,161 |
#
# Example that shows how to fill a table using YItemCollection
#
# Copyright information
#
# Author: Angelo Naselli <anaselli@linux.it>
#
# License
#
# 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 S... | anaselli/libyui-bindings | swig/python/examples/YTable_n_YItemCollection.py | Python | lgpl-3.0 | 1,736 |
from . import *
class TestSecurity(TestCase):
def test_path_normalization(self):
self.assertRaises(ValueError, url_for, 'images', filename='/etc//passwd')
self.assertRaises(ValueError, url_for, 'images', filename='/./etc/passwd')
self.assertRaises(ValueError, url_for, 'images', filename='... | knadir/Flask-Images | tests/test_security.py | Python | bsd-3-clause | 1,090 |
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
from openapi_server.models.hudson_master_computerexecutors ... | cliffano/swaggy-jenkins | clients/python-fastapi/generated/src/openapi_server/models/hudson_master_computer.py | Python | mit | 2,775 |
"""Webhooks for Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/webhook/
"""
import logging
from aiohttp.web import Response
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.loader import bind_hass
fro... | PetePriority/home-assistant | homeassistant/components/webhook/__init__.py | Python | apache-2.0 | 3,550 |
import sqlite3
import os
import ttqpy.db as db
# Delete the database if exists
try:
os.remove('test.db')
except:
pass
# Create the new one
conn = sqlite3.connect('test.db')
conn.close()
del conn
connection_string = db.create_connection_string("test.db")
db.create_session(connection_string, True)
| zachdicus/ttqpy | test/__init__.py | Python | bsd-2-clause | 309 |
from openstates.utils import LXMLMixin
from billy.scrape.votes import VoteScraper, Vote
from billy.scrape.utils import convert_pdf
import datetime
import subprocess
import lxml
import os
import re
journals = "http://www.leg.state.co.us/CLICS/CLICS%s/csljournals.nsf/" \
"jouNav?Openform&%s"
date_re = re.compile(
... | cliftonmcintosh/openstates | openstates/co/votes.py | Python | gpl-3.0 | 12,425 |
import gevent
import os
import re
import traceback
from gevent import queue
from os import path
from wal_e.exception import UserCritical
from wal_e import storage
class WalSegment(object):
def __init__(self, seg_path, explicit=False):
self.path = seg_path
self.explicit = explicit
self.nam... | modulexcite/wal-e | wal_e/worker/pg/wal_transfer.py | Python | bsd-3-clause | 5,962 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
from decimal import Decimal
import six
from future.builtins import next, object
from future.utils import python_2_unicode_compatible, raise_from
from .categories import CategoriesAPI, IncomeCategory
from .contacts import InvoiceContact
fro... | rambo/python-holviapi | holviapi/invoicing.py | Python | mit | 9,180 |
#!/usr/bin/env python2.6
#-*- coding: utf-8 -*-
import socket
HOST = '127.0.0.1'
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 定义socket类型,网络通信,TCP
s.connect((HOST, PORT)) # 要连接的IP与端口
while 1:
cmd = raw_input("Please input cmd:") # 与人交互,输入命令
s.sendall(cmd) # 把命令发送给对端
data = s.recv... | fixbugs/py-fixbugs-tools | example/socket/send.py | Python | gpl-3.0 | 526 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.