text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import io
import sys
isPython3 = sys.version_info >= (3, 0)
class Scribe:
@staticmethod
def read(path):
with io.open(path, mode="rt", encoding="utf-8") as f:
s = f.read()
# go to beginning
f.seek(0)
return s
@staticmethod
de... | RobertoPrevato/Humbular | tools/knight/core/literature/scribe.py | Python | mit | 1,844 | 0.003254 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models_highres/SHH_WT_models_highres_final_output_0.1_-0.1_5000/SHH_WT_models_highres8869.py | Python | gpl-3.0 | 88,246 | 0.024511 |
import os
#os.system('git checkout develop')
#os.system('git pull origin develop')
ret = os.system('python -u tools/jenkins-scripts/job-comment-trigger.py')
if ret == 0:
exit(0)
else:
exit(1)
| dios-game/dios-cocos | src/oslibs/cocos/cocos-src/tools/jenkins-scripts/configs/cocos-2dx-pull-request-build-comment-trigger.py | Python | mit | 201 | 0.014925 |
"""
Tests course_creators.admin.py.
"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.http import HttpRequest
import mock
from course_creators.admin import CourseCreatorAdmin
from course_creators.models import CourseCreator
fr... | kalebhartje/schoolboost | cms/djangoapps/course_creators/tests/test_admin.py | Python | agpl-3.0 | 2,658 | 0.002634 |
#!/usr/bin/env python
from setuptools import setup
setup(name='pgv',
version='0.0.2',
description="PostgreSQL schema versioning tool",
long_description=open("README.rst").read(),
author='Kirill Goldshtein',
author_email='goldshtein.kirill@gmail.com',
packages=['pgv', 'pgv.utils', '... | go1dshtein/pgv | setup.py | Python | gpl-2.0 | 968 | 0 |
# Create your views here.
from django.shortcuts import render, redirect
from django.views import generic
from Financers.models import Financers
import re
import random
def financer_detail(request, name):
template_name = 'financer_detail.html'
financer = ''
if name != "Unknown":
name = name.replace(',', '')
f... | kdunn926/eunomia-django | Financers/views.py | Python | apache-2.0 | 856 | 0.025701 |
#!/usr/bin/env python
import importlib
import inspect
from django.core.management.base import BaseCommand
from django.conf import settings
from colab.plugins.utils.proxy_data_api import ProxyDataAPI
class Command(BaseCommand):
help = "Import proxy data into colab database"
def handle(self, *args, **kwargs... | rafamanzo/colab | colab/plugins/management/commands/import_proxy_data.py | Python | gpl-2.0 | 1,015 | 0 |
from django.shortcuts import render
from core.views import get_add_model_form
from livestock.models import EggCollection, AnimalReport
from livestock.forms import EggCollectionForm, AnimalReportForm
ADD_LIVESTOCK_TEMPLATE = 'livestock/add_livestock_model.html'
def add_egg_collection(request):
return get_add_mode... | bonnieblueag/farm_log | livestock/views.py | Python | gpl-3.0 | 571 | 0.005254 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2015 by frePPLe bv
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later versio... | frePPLe/frePPLe | djangosettings.py | Python | agpl-3.0 | 19,163 | 0.001148 |
# coding=utf-8
# Copyright 2014 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)
import os
from pant... | landism/pants | src/python/pants/backend/jvm/tasks/nailgun_task.py | Python | apache-2.0 | 4,969 | 0.00644 |
#! /usr/bin/env python3
# encoding: utf-8
'''
http://projecteuler.net/problem=1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
'''
# Since May 22 2012
from projecteuler import c... | fossilet/project-euler | pe1.py | Python | mit | 1,110 | 0.023423 |
#!/usr/bin/env python
# This script will tweet the text that is passed as an argument
# Requires Twython, API credentials set as env vars
# Usage: python status-tweet.py "Hello Everyone, this is my Raspberry Pi tweeting you more nonsense"
import sys
import os
from twython import Twython
import twitter_api_creds
# Se... | swoodford/twitter | status-tweet.py | Python | apache-2.0 | 663 | 0.001508 |
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(blank=... | mohamed-ali-affes/oojuba | src/blog/models.py | Python | mit | 476 | 0 |
from __future__ import absolute_import, unicode_literals
from mopidy.core import PlaybackState
from mopidy.internal import deprecation
from mopidy.mpd import exceptions, protocol
@protocol.commands.add('consume', state=protocol.BOOL)
def consume(context, state):
"""
*musicpd.org, playback section:*
... | ali/mopidy | mopidy/mpd/protocol/playback.py | Python | apache-2.0 | 13,957 | 0 |
#!/usr/bin/python
# Copyright 2011, Thomas G. Dimiduk
#
# This file is part of GroupEng.
#
# Holopy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | tdimiduk/groupeng | src/__init__.py | Python | agpl-3.0 | 724 | 0 |
# Copyright (c) 2019 PaddlePaddle 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... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_imperative_signal_handler.py | Python | apache-2.0 | 5,136 | 0 |
# Rock-paper-scissors-lizard-Spock
import random
# helper functions
def name_to_number(name):
if name == "rock":
name = 0
elif name == "Spock":
name = 1
elif name == "paper":
name = 2
elif name == "lizard":
name = 3
elif name == "scissors":
name = 4
els... | reneisrael/coursera | Rock-paper-scissors-lizard-Spock.py | Python | gpl-2.0 | 1,947 | 0.007191 |
from stripogram import html2text, html2safehtml
# permet de conserver quelques tags html
def HTML2SafeHTML( text, convert_br=True ):
text = html2safehtml( text, valid_tags=('b', 'a', 'i', 'br', 'p'))
if convert_br:
return newline_to_br(text)
else:
return text
def newline_to_br( text ):
... | denys-duchier/Scolar | safehtml.py | Python | gpl-2.0 | 361 | 0.030471 |
from kkross.exceptions import ModuleError, LoaderError
from kkross.module import Module
from glob import glob
from yaml import safe_load
import os
def module_loader(module_dirs):
'''Loads module YAML from ...'''
module_paths = []
for module_dir in module_dirs:
module_paths.extend(glob(os.path.jo... | Doctor-love/kkross | playground/kkross/modules/module_loader.py | Python | gpl-2.0 | 919 | 0.003264 |
# -*- coding: utf-8 -*-
import asyncio
from aiohttp import wsgi
from irc3 import plugin
import json
@plugin
class Webapp:
requires = ['irc3.plugins.userlist']
def __init__(self, bot):
def server():
return wsgi.WSGIServerHttpProtocol(self.wsgi)
self.bot = bot
loop = asynci... | gawel/irc3 | examples/wsgiapp.py | Python | mit | 726 | 0 |
"""scons.Node.Python
Python nodes.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/Node/Python.py | Python | bsd-3-clause | 4,216 | 0.002135 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
BASH_ATTRIBUTES = {"regular": "0",
"bold": "1", "underline": "4", "strike": "9",
"light": "1", "dark": "2",
"invert": "7"} # invert bg and fg
BASH_COLORS = {"black": "30", "red": "31", "green": "32", "yel... | Ye-Yong-Chi/xortool | xortool/libcolors.py | Python | mit | 2,323 | 0.001291 |
# test basic complex number functionality
# constructor
print(complex(1))
print(complex(1.2))
print(complex(1.2j))
print(complex("1"))
print(complex("1.2"))
print(complex("1.2j"))
print(complex(1, 2))
print(complex(1j, 2j))
# unary ops
print(bool(1j))
print(+(1j))
print(-(1 + 2j))
# binary ops
print(1j + False)
prin... | AriZuu/micropython | tests/float/complex1.py | Python | mit | 2,231 | 0.003586 |
# -*- coding: utf-8 -*-
###################################################################################
#
# Init.py
#
# Copyright 2015 Shai Seger <shaise at gmail dot com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | shaise/FreeCAD_FastenersWB | Init.py | Python | gpl-2.0 | 1,063 | 0.007526 |
from . import graph
import tensorflow as tf
import sklearn
import scipy.sparse
import numpy as np
import os, time, collections, shutil
#NFEATURES = 28**2
#NCLASSES = 10
# Common methods for all models
class base_model(object):
def __init__(self):
self.regularizers = []
# High-level interface wh... | mdeff/ntds_2017 | projects/reports/arab_springs/lib/models.py | Python | mit | 40,998 | 0.002829 |
# edit.py
# buffer editing for both ST2 and ST3 that "just works"
import inspect
import sublime
import sublime_plugin
try:
sublime.sublimexiki_edit_storage
except AttributeError:
sublime.sublimexiki_edit_storage = {}
def run_callback(func, *args, **kwargs):
spec = inspect.getfullargspec(func)
if spec... | lunixbochs/SublimeXiki | edit.py | Python | mit | 2,725 | 0.000367 |
from flask_wtf import FlaskForm
from wtforms.fields import StringField, PasswordField, HiddenField, IntegerField, BooleanField
from wtforms.validators import DataRequired
from wtforms.widgets import HiddenInput
class LoginForm(FlaskForm):
username = StringField("username", validators=[DataRequired()])
passwor... | der-michik/c3bottles | c3bottles/views/forms.py | Python | mit | 1,168 | 0.000856 |
from django.contrib import admin
from moneymaker.models import Product
from moneymaker.models import Income
from moneymaker.models import Expense
from moneymaker.models import ExpenseCategory
from moneymaker.models import IncomeCategory
class ExpenseAdmin(admin.ModelAdmin):
list_display = ('date', '__unicode__')... | marthall/accounting | moneymaker/admin.py | Python | mit | 496 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012-2013 Yury Konovalov <YKonovalov@gmail.com>
#
# This file is part of SSP.
#
# SSP 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, o... | mdcic/ssp | ssp/netconfig.py | Python | gpl-3.0 | 5,352 | 0.037937 |
callback_classes = [
['void', 'ns3::Ptr<ns3::Packet const>', 'double', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['... | abdollatiif/NetCoding | wifi/bindings/callbacks_list.py | Python | gpl-2.0 | 1,855 | 0.00593 |
from __future__ import print_function
import sys
import win32com.client
import pywintypes
import pythoncom
import numpy as np
import subprocess as sp
import concurrent.futures
import atexit
import json
import zmq
import os
from six.moves import range
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')... | acq4/acq4 | acq4/util/igorpro.py | Python | mit | 10,366 | 0.002315 |
# -*- coding: utf-8 -*-
"""
Flaskr
~~~~~~
A microblog example application written as Flask tutorial with
Flask and sqlite3.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from sqlite3 import dbapi2 as sqlite3
from flask import (Flask, request, session... | unlessbamboo/grocery-shop | language/python/src/flask/flaskr/flaskr.py | Python | gpl-3.0 | 3,444 | 0 |
#!/usr/bin/env python
import sys
import time
import scapy.all as scapy
SEQ_MAX = 2**32 - 1
previous_packets = set()
def is_retransmission(packet):
packet_key = "%d%d%d" % (packet[scapy.TCP].sport,
packet[scapy.TCP].dport,
packet[scapy.TCP].seq)
i... | NullHypothesis/active-probing-tools | source_port_analysis.py | Python | gpl-3.0 | 1,711 | 0.00526 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = 'plus_reader'
DESCRIPTION = 'Recognition o... | ShashkovS/plus_reader | setup.py | Python | mit | 3,445 | 0.000872 |
'''Tools to guess a blog's posting date without knowing the blog site's layout, using BeautifulSoup.
FindDateInSoup::findDate_main(<BS object>, <ancestorDepth = integer> returns a datetime object or None
It begins from the BS object passed in and works its way up the parse tree until it finds a date or it ... | pbarton666/buzz_bot | djangoproj/djangoapp/crawler/findDate.py | Python | mit | 12,201 | 0.016638 |
from browser.models import Crop
from django.contrib import admin
admin.site.register(Crop) | georgejlee/croptrends | browser/admin.py | Python | mit | 91 | 0.010989 |
# -*- coding: utf-8 -*-
"""Create one-mode (unipartite) projections from bipartite graphs.
"""
import networkx as nx
# Copyright (C) 2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
__author__ = """Aric ... | ChristianKniep/QNIB | serverfiles/usr/local/lib/networkx-1.6/networkx/algorithms/bipartite/projection.py | Python | gpl-2.0 | 15,424 | 0.008169 |
#!/usr/bin/env python
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from clawpack.pyclaw.solution import Solution
import clawpack.visclaw.data as data
rho = [1025.0,1045.0]
eta_init = [0.0,-300.0]
def plot_contour(data_dir="./_output",out_dir='./',num_layers=2,num_frames=1000,ref_lines=[-1... | mandli/multilayer-examples | 1d/plot_shelf_contour.py | Python | mit | 3,904 | 0.024334 |
import time
from cloudbot import hook
@hook.command(autohelp=False)
def beats(text):
"""beats -- Gets the current time in .beats (Swatch Internet Time). """
if text.lower() == "wut":
return "Instead of hours and minutes, the mean solar day is divided " \
"up into 1000 parts called \".... | nidhididi/CloudBot | plugins/time_plugin.py | Python | gpl-3.0 | 1,073 | 0.00466 |
# This file is part of OpenHatch.
# Copyright (C) 2010 John Stumpo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | nirmeshk/oh-mainline | mysite/missions/models.py | Python | agpl-3.0 | 1,422 | 0.000703 |
from ut_arena.settings import * | blstream/ut-arena | ut_arena_py_api/ut_arena/envs/test/settings.py | Python | apache-2.0 | 31 | 0.032258 |
import lean
import lang.expr as expr
# =========================================================
# Declaration Views
class DeclView(lean.declaration):
def __init__(self, decl):
self.decl = decl
def destruct(self):
# type: DeclView -> (lean.name, ?, ?, lean.expr, lean.expr)
return (s... | dselsam/lean-python-bindings | lean/lang/env.py | Python | apache-2.0 | 1,567 | 0 |
import struct
from . import crc16
class PacketWriter:
MAX_PAYLOAD = 1584
MIN_LEN = 6
MAX_LEN = 1590
SOF = 0x01
OFFSET_SOF = 0
OFFSET_LENGTH = 1
OFFSET_CMD = 3
OFFSET_PAYLOAD = 4
def __init__(self):
self._packet = None
def Clear(self):
self._packet = None
... | openaps/dexcom_reader | dexcom_reader/packetwriter.py | Python | mit | 1,120 | 0 |
##Author - Sagar Vakkala (@codezoned)
import numpy
from PIL import Image
def median_filter(data, filter_size):
temp_arr = []
index = filter_size // 2
data_final = []
data_final = numpy.zeros((len(data), len(data[0])))
for i in range(len(data)):
# Iterate over the Image Array
for j... | OpenGenus/cosmos | code/filters/src/median_filter/median_filter.py | Python | gpl-3.0 | 1,398 | 0.003577 |
########################################################################
# $Id$
########################################################################
""" A set of common tools to be used in pilot commands
"""
import sys
import time
import os
import pickle
import getopt
import imp
import types
import urllib2
import... | Andrew-McNab-UK/DIRAC | WorkloadManagementSystem/PilotAgent/pilotTools.py | Python | gpl-3.0 | 18,034 | 0.032051 |
""" An utility module containing utility functions used by the grader module
and some useful pre-test hooks.
"""
import json
import traceback
def import_module(path, name=None):
if name is None:
name = path
import importlib.machinery
loader = importlib.machinery.SourceFileLoader(name, path)
... | macobo/python-grader | grader/utils.py | Python | mit | 1,858 | 0.001615 |
#!/usr/bin/env python3
"""
* Copyright (c) 2015 BEEVC - Electronic Systems This file is part of BEESOFT
* 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... | beeverycreative/beeconnect | Loaders/PrinterInfoLoader.py | Python | gpl-2.0 | 5,218 | 0.012457 |
import re
import uuid as py_uuid
from common_fixtures import * # NOQA
TEST_IMAGE = 'ibuildthecloud/helloworld'
TEST_IMAGE_LATEST = TEST_IMAGE + ':latest'
TEST_IMAGE_UUID = 'docker:' + TEST_IMAGE
if_docker = pytest.mark.skipif("os.environ.get('DOCKER_TEST') == 'false'",
reason='DOCKER_T... | willseward/cattle | tests/integration/cattletest/core/test_docker.py | Python | apache-2.0 | 31,065 | 0.000032 |
# Copyright 2010-2011 OpenStack Foundation
# 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... | liverbirdkte/searchlight | searchlight/tests/utils.py | Python | apache-2.0 | 18,006 | 0 |
import sys
from CTFd import create_app
app = create_app()
app.run(debug=True, host="0.0.0.0", port=int(sys.argv[1]))
| rosatolen/CTFd | serve.py | Python | apache-2.0 | 117 | 0 |
#!/usr/bin/env python3
# Copyright 2017 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... | google/aiyprojects-raspbian | src/examples/vision/dish_classification.py | Python | apache-2.0 | 1,303 | 0.000767 |
from urllib import urlencode
from urllib2 import urlopen
from django.shortcuts import render
from django.http import HttpResponse, Http404
from cms.utils.html import clean_html
def index(request):
url = "http://results.influenzanet.info/results.php?" + urlencode(request.GET)
try:
content = urlopen(ur... | chispita/epiwork | apps/sander/views.py | Python | agpl-3.0 | 486 | 0.012346 |
print(len({(input()) for _ in range(int(input()))}))
| avtomato/HackerRank | Python/_04_Sets/_04_Set .add()/solution.py | Python | mit | 53 | 0 |
from __future__ import print_function
#from cms.sitemaps import CMSSitemap
from django.conf.urls import * # NOQA
from django.conf.urls.i18n import i18n_patterns
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
u... | JackieLan/djangocms-container | app/myapp/urls.py | Python | mit | 820 | 0.00122 |
# coding: utf-8
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ i... | ltowarek/budget-supervisor | third_party/nordigen/test/test_token_api.py | Python | mit | 896 | 0 |
from reportlab.pdfgen import canvas as pdf_container
from reportlab.lib.pagesizes import letter, A4
from reportlab.lib.units import inch
'''Contains methods to split lengthy sections so that they are able to fit within the pdf. After splitting the
sections, it appends the newly formed sections to the "to_pdf_hold... | jpat82792/EloTab | logic.py | Python | gpl-3.0 | 6,308 | 0.005707 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source co... | ayoubg/gem5-graphics | gem5/configs/ruby/MI_example.py | Python | bsd-3-clause | 8,604 | 0.009182 |
from flask.blueprints import Blueprint
import logging
from flask_login import login_required, current_user
from waitlist.ts3.connection import send_poke
from flask import jsonify
bp = Blueprint('api_ts3', __name__)
logger = logging.getLogger(__name__)
@bp.route("/test_poke")
@login_required
def test_poke():
send... | SpeedProg/eve-inc-waitlist | waitlist/blueprints/api/teamspeak.py | Python | mit | 473 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
'''
This software has been developed by:
GI Genética, Fisiología e Historia Forestal
Dpto. Sistemas y Recursos Naturales
ETSI Montes, Forestal y del Medio Natural
Universida... | GGFHF/NGScloud | Package/cmenu.py | Python | gpl-3.0 | 58,331 | 0.00396 |
'''
New Test For cpu bill Operations
1.test vm stop
2.test vm destory
3.test vm live migration
4.test vm clean
@author Antony WeiJiang
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.b... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/public_billing/test_check_vm_lifecycle_with_cpu_billing.py | Python | apache-2.0 | 3,329 | 0.029438 |
from flask import render_template
from . import auth
@auth.route('/login')
def login():
return render_template('auth/login.html')
| baojiwei/flasky | app/auth/views.py | Python | mit | 136 | 0 |
from nose.tools import assert_equal
import urllib
from base import *
from bibserver import web, ingest
import os
class TestWeb(object):
@classmethod
def setup_class(cls):
web.app.config['TESTING'] = True
cls.app = web.app.test_client()
# fixture data
recdict = fixtures['records... | okfn/bibserver | test/test_web.py | Python | mit | 3,627 | 0.003033 |
#!/usr/bin/env python2
""" Quick helper to add HTML5 DOCTYPE and <title> to every testcase. """
import os
import re
import sys
def fixhtml(folder):
changed = 0
for dirpath, _, filenames in os.walk(folder):
for file in filenames:
name, ext = os.path.splitext(file)
if ext != '.ht... | qll/autoCSP | testsuite/testcases/fixhtml.py | Python | mit | 1,054 | 0.003795 |
r"""
==================================
Constants (:mod:`scipy.constants`)
==================================
.. currentmodule:: scipy.constants
Physical and mathematical constants and units.
Mathematical constants
======================
================ ===========================================================... | WarrenWeckesser/scipy | scipy/constants/__init__.py | Python | bsd-3-clause | 12,116 | 0.001073 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster2'],
[TestAction.create_volume, 'volume1', 'cluster=cluster2', ... | zstackio/zstack-woodpecker | integrationtest/vm/mini/multiclusters/paths/multi_path131.py | Python | apache-2.0 | 2,990 | 0.01806 |
import os
from setuptools import setup
with open('asv_test_repo/build_time_env.py', 'w') as f:
f.write("env = {{}}\n".format(repr(dict(os.environ))))
setup(name='asv_test_repo',
version="{version}",
packages=['asv_test_repo'],
# The following forces setuptools to generate .egg-info directory,
... | qwhelan/asv | test/test_repo_template/setup.py | Python | bsd-3-clause | 434 | 0 |
# Copyright (c) 2015 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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... | catapult-project/catapult | third_party/gsutil/gslib/vendored/boto/boto/cloudhsm/__init__.py | Python | bsd-3-clause | 1,726 | 0 |
import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '..'))
from models import gru_simple
from helpers import checkpoint
# Get the review summary file
review_summary_file = 'extracted_data/review_summary.csv'
# Initialize Checkpointer to ensure checkpointing
checkpointer = checkpoint... | harpribot/deep-summarization | train_scripts/train_script_gru_simple_attn.py | Python | mit | 879 | 0.004551 |
#!/usr/bin/env python
import logging
import json
import netifaces
import netaddr
import socket
import fcntl
import struct
import array
import time
import ast
import copy
import subprocess
import os
from netaddr import IPNetwork, IPAddress
from operations import configOpts
from vyos_session import utils
from netifaces i... | jiahaoliang/group-based-policy | gbpservice/nfp/service_vendor_agents/vyos/oc_config_server/vpn_api_server.py | Python | apache-2.0 | 17,163 | 0.000932 |
from datetime import datetime
from operator import itemgetter
import tmdbsimple
from babel.dates import format_date
from django.conf import settings
from .exceptions import MovieNotInDb
from .models import get_poster_url
def get_tmdb(lang=None):
tmdbsimple.API_KEY = settings.TMDB_KEY
tmdbsimple.LANGUAGE = l... | desecho/movies | src/moviesapp/tmdb.py | Python | mit | 5,407 | 0.00074 |
# Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of con... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_parser_unittest.py | Python | gpl-3.0 | 10,336 | 0.003289 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Vinay M. Sajip. See LICENSE for licensing information.
#
# Enhancements in shlex to tokenize closer to the way real shells do
#
from collections import deque
import shlex
import sys
# We need to behave differently on 2,x and 3,x, because on 2.x
# shlex barfs on Unico... | sinesiobittencourt/explainshell | explainshell/shlext.py | Python | gpl-3.0 | 8,869 | 0.001128 |
from __future__ import print_function, absolute_import, division
import warnings
import pytest
import numpy as np
from astropy import units as u
from astropy.wcs import WCS
from astropy.io import fits
from radio_beam import Beam, Beams
from .helpers import assert_allclose
from .test_spectral_cube import cube_and_ra... | e-koch/spectral-cube | spectral_cube/tests/test_projection.py | Python | bsd-3-clause | 27,131 | 0.003317 |
import os
import re
import asyncio
import tempfile
import os.path as osp
import asyncio.subprocess
from concurrent.futures import ThreadPoolExecutor
from PIL import Image
from ..utils import getLogger
from .mediaconfig import *
logger = getLogger('transcode.transcoder')
class Transcoder:
"Nice object-oriented ... | The-Fonz/adventure-track | backend/transcode/transcoder.py | Python | mit | 8,880 | 0.004392 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 Josh Brandoff
#
# 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 wi... | Storj/storjtorrent | storjtorrent/__init__.py | Python | mit | 1,271 | 0 |
from django.db import models
from django.contrib.auth.models import User
from datetime import date
# Create your models here.
class Genre(models.Model):
"""
Model representing a book genre (e.g. Science Fiction, Non Fiction).
"""
name = models.CharField(max_length=200, help_text="Enter a book genre (e... | byronlin92/django_local_library | catalog/models.py | Python | apache-2.0 | 4,639 | 0.006682 |
# -*- coding: utf-8 -*-
from model.contact import Contact
from random import randrange
def test_modify_some_contact(app, db, check_ui):
random_value = str(app.get_random_int())
if app.contact.count() == 0:
app.contact.add(Contact(first_name="First Contact"))
# old_contacts = app.contact.get_contac... | SmotritelTerve/python_training | test/test_modify_contact.py | Python | apache-2.0 | 2,179 | 0.000918 |
# PyVision License
#
# Copyright (c) 2006-2010 David S. Bolme
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, thi... | tigerking/pyvision | src/samples/TutFaceEyes.py | Python | bsd-3-clause | 3,860 | 0.010363 |
# Generated from java-escape by ANTLR 4.5
from antlr4 import *
# This class defines a complete listener for a parse tree produced by ODLv21Parser.
class ODLv21Listener(ParseTreeListener):
# Enter a parse tree produced by ODLv21Parser#label.
def enterLabel(self, ctx):
pass
# Exit a parse tree prod... | godber/pds3label | pds3label/vendor/pds3_python/ODLv21Listener.py | Python | mit | 5,308 | 0.008478 |
import sys
import os.path
import lzma
import time
import os
import subprocess
if "APPVEYOR_REPO_TAG" not in os.environ or os.environ["APPVEYOR_REPO_TAG"] != "true":
print("Not uploading symbols since build is not tagged")
sys.exit()
symbol_filename = sys.argv[1]
with open(symbol_filename, "rt") as fh:
f... | GrognardsFromHell/TemplePlus | deploy_symbols_s3.py | Python | mit | 1,455 | 0.002749 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v9/services/services/custom_audience_service/transports/grpc.py | Python | apache-2.0 | 12,186 | 0.001067 |
from collections import OrderedDict
from django.core.cache import cache
from django.conf import settings
import jingo
import jinja2
from bedrock.firefox.models import FirefoxOSFeedLink
from bedrock.firefox.firefox_details import firefox_desktop, firefox_android
from bedrock.base.urlresolvers import reverse
from lib.... | SujaySKumar/bedrock | bedrock/firefox/helpers.py | Python | mpl-2.0 | 8,166 | 0.000245 |
from sympy.core import Add, S, C, sympify, oo, pi
from sympy.core.function import Function, ArgumentIndexError
from zeta_functions import zeta
from sympy.functions.elementary.exponential import log
from sympy.functions.elementary.integers import floor
from sympy.functions.elementary.miscellaneous import sqrt
from sympy... | minrk/sympy | sympy/functions/special/gamma_functions.py | Python | bsd-3-clause | 10,069 | 0.002086 |
# -*- coding: utf-8 -*-
# Copyright © 2012 Zulip, Inc.
#
# 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, ... | cosmicAsymmetry/zulip | api/integrations/trac/zulip_trac.py | Python | apache-2.0 | 5,443 | 0.003308 |
# -*- coding:utf-8 -*-
#!/usr/bin/env python3
"""
"""
from collections import namedtuple
from minghu6.internet.proxy_ip import proxy_ip
from minghu6.text.seq_enh import filter_invalid_char
URL_LIST_FILE_PATH = 'URList-{username:s}.txt'
UrlNameTuple = namedtuple('UrlNameTuple', ['url', 'title']) | minghu6/csdn | csdn/csdn_offline/csdn_offline_common.py | Python | bsd-3-clause | 313 | 0.00639 |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, getdate, formatdate, cstr
from erpnext.accounts.report.financial_statements import filter_accou... | chdecultot/erpnext | erpnext/accounts/report/profitability_analysis/profitability_analysis.py | Python | gpl-3.0 | 5,688 | 0.031997 |
# -*- coding: utf-8 -*-
"""
oauthlib.parameters
~~~~~~~~~~~~~~~~~~~
This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec.
.. _`section 3.5`: http://tools.ietf.org/html/rfc5849#section-3.5
"""
from __future__ import absolute_import, unicode_literals
try:
from urlparse import urlparse, url... | lucasrangit/twitter-winner | twitter-winner/oauthlib/oauth1/rfc5849/parameters.py | Python | mit | 4,909 | 0.000407 |
import json
import numpy as np
from numpy import vstack, array
from scipy.cluster.vq import kmeans,vq
from django.db import models
from django.db.models import Avg, Max, Min
from opencontext_py.libs.general import LastUpdatedOrderedDict
from opencontext_py.apps.ocitems.geospace.models import Geospace
from opencontext_p... | portableant/open-context-py | opencontext_py/apps/ocitems/projects/metadata.py | Python | gpl-3.0 | 15,649 | 0.001342 |
from ._main import main
main()
| yuanming-hu/taichi | python/taichi/__main__.py | Python | mit | 32 | 0 |
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 | 0.004149 |
import sys
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QSplashScreen, QApplication
from qtpy.QtGui import QColor, QPen, QFont
from ert_gui.ertwidgets import resourceImage
class ErtSplash(QSplashScreen):
def __init__(self, version_string="Version string"):
QSplashScreen.__init__(self)
... | joakim-hove/ert | ert_gui/ert_splash.py | Python | gpl-3.0 | 2,664 | 0 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from askomics.libaskomics.ParamManager import ParamManager
from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder
from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher
class TripleStoreExplorer(ParamManager):
"""
... | cbettemb/askomics | askomics/libaskomics/TripleStoreExplorer.py | Python | agpl-3.0 | 7,283 | 0.009886 |
import os
from flask import Flask, url_for, send_from_directory, flash, get_flashed_messages, session, request, render_template, redirect
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from configure_database import Base, F5Device, AFMStat, StatValue
engine = create_engine('sqlite:///F5AF... | pdawson1983/Python-F5-AFM-App | F5AFMApp.py | Python | mit | 2,130 | 0.022535 |
import hangups
from hangupsbot.utils import text_to_segments
from hangupsbot.handlers import handler
@handler.register(priority=7, event=hangups.ChatMessageEvent)
def handle_forward(bot, event):
"""Handle message forwarding"""
# Test if message is not empty
if not event.text:
return
# Test i... | xmikos/hangupsbot | hangupsbot/handlers/forwarding.py | Python | gpl-3.0 | 1,493 | 0.00134 |
# -*- coding: utf-8 -*-
#
# Clang documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 9 20:01:55 2012.
#
# 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 c... | root-mirror/root | interpreter/llvm/src/tools/clang/docs/conf.py | Python | lgpl-2.1 | 9,185 | 0.006641 |
""" Created by Max 12/10/2017 """
from ValueIteration import ValueIteration
from Game import Game
x = {(0, 32, -5, -5): None,
(0, 32, -5, -4): None,
(0, 32, -5, -3): None,
(0, 32, -5, -2): None,
(0, 32, -5, -1): None,
(0, 32, -5, 0): None,
(0, 32, -5, 1): None,
(0, 32, -5, 2): None,
(0, 32, -5, 3): None,
(0,... | MaxRobinson/CS449 | project7/extra.py | Python | apache-2.0 | 494,316 | 0.000004 |
######################################################################################
# class: LinkConsumer
# purpose: consumes items in the outQueue and sends to parameterFetcher for processing
######################################################################################
import logging
import Queue
import t... | testerofpens/parameterpatrol | linkConsumer.py | Python | gpl-3.0 | 1,022 | 0.018591 |
# coding: utf-8
#This file is part of numword. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
'''
numword for EN_GB
'''
from numword_en import NumWordEN
class NumWordENGB(NumWordEN):
'''
NumWord EN_GB
'''
def currency(self, val, longva... | soshial/text-normalization | numword/numword_en_gb.py | Python | lgpl-3.0 | 1,631 | 0.011649 |
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | openstack/taskflow | releasenotes/source/conf.py | Python | apache-2.0 | 9,270 | 0 |
# -*- coding: utf-8 -*-
import collections
import copy
from . import formulas, legislations, periods, taxbenefitsystems, columns
class AbstractReform(taxbenefitsystems.AbstractTaxBenefitSystem):
"""A reform is a variant of a TaxBenefitSystem, that refers to the real TaxBenefitSystem as its reference."""
CU... | sgmap/openfisca-core | openfisca_core/reforms.py | Python | agpl-3.0 | 13,388 | 0.00478 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.