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 |
|---|---|---|---|---|---|---|
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Apple's Speedometer 2 performance benchmark.
"""
import os
import re
from benchmarks import press
from core import path_util
from telemetry import ben... | endlessm/chromium-browser | tools/perf/benchmarks/speedometer2.py | Python | bsd-3-clause | 2,350 | 0.008936 |
#!/usr/bin/env python
#
# Copyright 2014 Institute for Theoretical Information Technology,
# RWTH Aachen University
# www.ti.rwth-aachen.de
#
# This 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... | rwth-ti/gr-ofdm | python/ofdm/qa_moms_ff.py | Python | gpl-3.0 | 1,256 | 0.007962 |
import os.path
from robot.errors import DataError
from robot.utils import secs_to_timestr, timestr_to_secs
from selenium import webdriver
from selenium.common.exceptions import NoSuchWindowException
from Selenium2Library import webdrivermonkeypatches
from Selenium2Library.utils import BrowserCache
from Selenium2Libr... | Gaurang033/Selenium2Library | src/Selenium2Library/keywords/_browsermanagement.py | Python | apache-2.0 | 28,305 | 0.004911 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | deepmind/enn | enn/experiments/neurips_2021/base.py | Python | apache-2.0 | 2,522 | 0.00912 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | morissette/devopsdays-hackathon-2016 | venv/lib/python2.7/site-packages/boto3/resources/model.py | Python | gpl-3.0 | 20,675 | 0.000048 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 创建一个基于TCP连接的Socket
import socket
# 创建一个socket
# AF_INET指定使用IPv4协议,要使用IPv6则指定为AF_INET6
# SOCK_STREAM指定使用面向流的TCP协议
# 此时,Socket对象创建成功,但还没有建立连接
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 建立连接,参数是一个tuple,包含地址和端口号
s.connect(('www.baidu.com', 80))
# TCP连接创建的是双向通道,... | yddgit/hello-python | network/tcp_client.py | Python | apache-2.0 | 1,642 | 0.003584 |
import time
import logging
from autotest.client.shared import error
from virttest import utils_test
from generic.tests import file_transfer
def run(test, params, env):
"""
live_snapshot test:
1). Create live snapshot during big file creating
2). Create live snapshot when guest reboot
3). Check if ... | ypu/tp-qemu | qemu/tests/live_snapshot.py | Python | gpl-2.0 | 3,334 | 0 |
import os
TOP_STORIES_KEY = b'top_30'
TITLE = 'title'
URL = 'url'
BODY = 'body'
SENTENCES = 'sentences'
HACKER_NEWS_ID = 'hn_id'
TEXT = 'text'
DATE_FOUND = 'date_found'
AYLIEN_ID = 'AYLIENID'
AYLIEN_KEY = 'AYLIENKEY'
REDIS_HOST = 'REDIS_HOST'
REDIS_PORT = 'REDIS_PORT'
REDIS_PASS = 'REDIS_PASS'
def get_environment():... | Bachmann1234/hn-tldr | constants.py | Python | apache-2.0 | 586 | 0 |
#!/usr/bin/env python3
# Fortwrangler is a tool that attempts to resolve issues with fortran lines over standard length.
# Global libraries
import sys
# Global variables
# Strings inserted for continuation
CONTINUATION_ENDLINE = "&\n"
CONTINUATION_STARTLINE = " &"
# Line length settings
MIN_LENGTH = len(CONTI... | owainkenwayucl/utils | src/fortwrangler.py | Python | mit | 6,251 | 0.007359 |
#**********************************************************************
# CS 325 - Project Group 9
# Joshua Atchley
# Aalon Cole
# Patrick Kilgore
#
# Project - Solving the Travelling Salesman Problem with Approximation
#
# Algorithm - Simulated Annealing as described in:
# Hansen, Per Brinch, "Simulated An... | jatchley/OSU-Online-CS | 325/Final Project/Final.py | Python | mit | 4,765 | 0.004617 |
import unittest
from powerline_shell.utils import RepoStats
class RepoStatsTest(unittest.TestCase):
def setUp(self):
self.repo_stats = RepoStats()
self.repo_stats.changed = 1
self.repo_stats.conflicted = 4
def test_dirty(self):
self.assertTrue(self.repo_stats.dirty)
def ... | banga/powerline-shell | test/repo_stats_test.py | Python | mit | 687 | 0 |
"""
WSGI config for project_2do 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | Dru89/2do | project_2do/wsgi.py | Python | mit | 399 | 0 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.txt
# -*- coding: utf-8 -*-
"""
Lizard-security's ``admin.py`` contains two kinds of model admins:
- Our own model admins to make editing data sets, permission mappers and user
groups easier.
- ``SecurityFilteredAdmin`` as a base class for admins of models that u... | lizardsystem/lizard-security | lizard_security/admin.py | Python | gpl-3.0 | 5,909 | 0 |
import astropy.io.fits as fits
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as p
import numpy as n
import os
import sys
from scipy.stats import scoreatpercentile as sc
from scipy.interpolate import interp1d
survey = sys.argv[1]
z_min, z_max = 0., 1.6
imfs = ["Chabrier_ELODIE_", "Chabrier_MILES_",... | JohanComparat/pySU | spm/bin_SMF/create_table_snr.py | Python | cc0-1.0 | 8,566 | 0.025683 |
# -*- coding: utf-8 -*-
import re,urlparse,json
from liveresolver.modules import client
from BeautifulSoup import BeautifulSoup as bs
import xbmcgui
def resolve(url):
try:
result = client.request(url)
html = result
result = json.loads(result)
try:
f4m=res... | sanctuaryaddon/sanctuary | script.module.liveresolver/lib/liveresolver/resolvers/playwire.py | Python | gpl-2.0 | 1,286 | 0.01944 |
__all__ = ["speedtest_exceptions", "speedtest"]
from . import sendtest
| Awesomecase/Speedtest | speedtest_sendtest/__init__.py | Python | gpl-3.0 | 71 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lice... | julien6387/supervisors | supvisors/client/subscriber.py | Python | apache-2.0 | 6,689 | 0.001196 |
#-*- coding: utf-8 -*-
'''
留下最後 N 個項目
'''
| williechen/DailyApp | 12/py201501/Ch01_03/__init__.py | Python | lgpl-3.0 | 62 | 0.020833 |
import uuid
from datetime import datetime
from unittest import TestCase
import pytz
import colander
from unicore.comments.service.models import (
COMMENT_MAX_LENGTH, COMMENT_CONTENT_TYPES, COMMENT_MODERATION_STATES,
COMMENT_STREAM_STATES)
from unicore.comments.service.schema import (
Comment, Flag, Banned... | universalcore/unicore.comments | unicore/comments/service/tests/test_schema.py | Python | bsd-2-clause | 9,303 | 0 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def parquet_parse_simple():
"""
Tests Parquet parser by comparing the summary of the original csv frame with the h2o parsed Parquet frame.
Basic use case of importing files with auto-dete... | mathemage/h2o-3 | h2o-py/tests/testdir_parser/pyunit_parquet_parser_simple.py | Python | apache-2.0 | 999 | 0.008008 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | scott-w/pyne-django-tutorial | chatter/chatter/base/migrations/0001_initial.py | Python | mit | 799 | 0.001252 |
from multiprocessing import Process, Pipe,Value, Queue
from time import sleep, clock
from solr import Solr
#### EVERY connection must be a class with a .commit() method.
#### Starbase and solr already have these. If you want to make
#### a csv method, you need to define it as a custom class.
####
#### commit(... | rawkintrevo/sharky | mysharky/writers.py | Python | apache-2.0 | 2,074 | 0.047734 |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import py_utils
from telemetry import story as story_module
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | chromium/chromium | tools/perf/contrib/leak_detection/page_sets.py | Python | bsd-3-clause | 10,066 | 0.001987 |
#!/usr/bin/python3
################################
# File Name: unittestExample.py
# Author: Chadd Williams
# Date: 10/20/2014
# Class: CS 360
# Assignment: Lecture Examples
# Purpose: Demonstrate unit tests
################################
# adapted from https://docs.python.org/3/library/unittest.html
# pytho... | NicLew/CS360-Practive-CI-Testing | unittestExample.py | Python | gpl-2.0 | 1,699 | 0.030606 |
'''
Created on 10 mars 2015
@author: Remi Cattiau
'''
from nxdrive.logging_config import get_logger
from nxdrive.wui.dialog import WebDialog, WebDriveApi
from nxdrive.wui.translator import Translator
from PyQt4 import QtCore
log = get_logger(__name__)
class WebConflictsApi(WebDriveApi):
def __init__(self, appli... | rsoumyassdi/nuxeo-drive | nuxeo-drive-client/nxdrive/wui/conflicts.py | Python | lgpl-2.1 | 3,320 | 0.001506 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Nebula 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... | varunarya10/python-openstackclient | openstackclient/identity/v2_0/ec2creds.py | Python | apache-2.0 | 5,662 | 0 |
import functools
class Solution:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1:
return s
ret = [[] for _ in range(numRows)]
pattern = numRows*2 - 2
for i in range(len(s)):
if i % pattern < numRows:
ret[i % pattern].ap... | MingfeiPan/leetcode | string/6.py | Python | apache-2.0 | 526 | 0.015209 |
import question_template
game_type = 'input_output'
source_language = 'C'
parameter_list = [
['$x0','string'],['$x1','string'],['$x2','string'],
['$y0','string'],['$y1','string'],['$y2','string']
]
tuple_list = [
['echo_io_forward_',['a','b','c',None,None,None]],
]
global_code_template = '''\
d #include <s... | stryder199/RyarkAssignments | Assignment2/ttt/archive/_old/other/echo_io.py | Python | mit | 750 | 0.042667 |
# Author: Drone
import web
from app.helpers import utils
from app.helpers import formatting
projectName = 'Remote Function Trainer'
listLimit = 40
# connect to database
db = web.database(dbn='mysql', db='rft', user='root', passwd='1234')
t = db.transaction()
#t.commit()
# in development debug error messages and r... | gcobos/rft | config.py | Python | agpl-3.0 | 673 | 0.002972 |
import argparse, json
import simpleamt
if __name__ == '__main__':
parser = argparse.ArgumentParser(parents=[simpleamt.get_parent_parser()])
args = parser.parse_args()
mtc = simpleamt.get_mturk_connection_from_args(args)
reject_ids = []
if args.hit_ids_file is None:
parser.error('Must specify --hit_ids_... | achalddave/simple-amt | reject_assignments.py | Python | mit | 970 | 0.016495 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class MariadbCClient(CMakePackage):
"""MariaDB turns data into structured information in a wide ... | iulian787/spack | var/spack/repos/builtin/packages/mariadb-c-client/package.py | Python | lgpl-2.1 | 3,917 | 0.007148 |
### @author Rishi Jatia
import json
import re
import string
def decode_unicode(data, replace_boo=True):
# dictionary which direct maps unicode values to its letters
dictionary = {'0030':'0','0031':'1','0032':'2','0033':'3','0034':'4','0035':'5','0036':'6','0037':'7','0038':'8','0039':'9','0024':'$','0040':'@',... | usc-isi-i2/etk | etk/data_extractors/htiExtractors/unicode_decoder.py | Python | mit | 22,630 | 0.068714 |
import json
import time
import settings
from shared import common
from datetime import datetime
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient
import logging
handler = None
pin_door1 = 11 #BCM17
pin_door2 = 12 # BCM18
pin_door1_led = 13 # BCM27
pin_door2_led = 15 # BCM22
def init():
global handler
... | royveshovda/pifog | source/piclient/doorpi/door_runner.py | Python | apache-2.0 | 4,850 | 0.003093 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('changeset', '0022_auto_20160222_2358'),
]
operations = [
migrations.AddField(
model_name='userdetail',
... | batpad/osmcha-django | osmchadjango/changeset/migrations/0023_userdetail_contributor_uid.py | Python | gpl-3.0 | 441 | 0 |
from flask import Blueprint, render_template, g, request, jsonify
from time import gmtime, strftime
from flask_login import login_required, current_user
from app.models import Month, DreamDay, Dream
import datetime
main_module = Blueprint('main', __name__, template_folder='templates')
@main_module.route('/old')
@lo... | Kwentar/Dream-Crusher | app/main_views.py | Python | apache-2.0 | 2,225 | 0.001348 |
import abc
from OHA.helpers.converters.BaseConverter import BaseConverter
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class LengthConverter(BaseConverter):
def __init__(self, _value, _from=None, _to=None):
super(LengthConverter, self).__init__(_value, _from, _to)
def _supported_units(... | openhealthalgorithms/openhealthalgorithms | OHA/helpers/converters/LengthConverter.py | Python | apache-2.0 | 1,483 | 0 |
#!/usr/bin/python
"""This script run the pathologic """
try:
import optparse, sys, re, csv, traceback
from optparse import OptionGroup
import pickle
import math
from libs.python_modules.taxonomy.LCAComputation import *
import operator
from os import path, _exit, remove, rename
import logging.... | kishori82/MetaPathways_Python.3.0 | utilities/extract_flat_files.py | Python | mit | 7,627 | 0.023994 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mozaik Mass Mailing Access Rights",
"summary": """
New group: Mass Mailing Manager. Managers can edit
and unlink mass mailings.""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
... | mozaik-association/mozaik | mozaik_mass_mailing_access_rights/__manifest__.py | Python | agpl-3.0 | 625 | 0 |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TouristicEventType.pictogram'
db.add_column('t_b_evenement_touristique_type', 'pictogram',
... | johan--/Geotrek | geotrek/tourism/migrations/0022_auto__add_field_touristiceventtype_pictogram__add_field_touristicconte.py | Python | bsd-2-clause | 14,288 | 0.006859 |
# Copyright (c) 2016 Czech National Corpus
#
# 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; version 2
# dated June, 1991.
#
# This program is distributed in the hope that it will be useful,
# b... | tomachalek/kontext | lib/mailing.py | Python | gpl-2.0 | 2,086 | 0.000479 |
request = {
"method": "GET",
"uri": uri("/silly"),
"version": (1, 1),
"headers": [
("AAAAAAAAAAAAA", "++++++++++")
],
"body": b""
}
| DataDog/gunicorn | tests/requests/valid/004.py | Python | mit | 164 | 0 |
from fastpm.state import StateVector, Matter, Baryon, CDM, NCDM
from runtests.mpi import MPITest
from nbodykit.cosmology import Planck15 as cosmo
import numpy
BoxSize = 100.
Q = numpy.zeros((100, 3))
@MPITest([1, 4])
def test_create(comm):
matter = Matter(cosmo, BoxSize, Q, comm)
cdm = CDM(cosmo, BoxSize, ... | rainwoodman/fastpm-python | fastpm/tests/test_state.py | Python | gpl-3.0 | 600 | 0.005 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_propeller_demo.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. En... | tfroehlich82/django-propeller | manage.py | Python | mit | 819 | 0.001221 |
def extractLimostnWordpressCom(item):
'''
Parser for 'limostn.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if "The Outcast" in item['tags']:
return buildReleaseMessageWithType(item, "The Ou... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLimostnWordpressCom.py | Python | bsd-3-clause | 380 | 0.028947 |
from grafo import Digraph
from CaminoMinimo import CaminoMinimo
import heapq
class Dijkstra(CaminoMinimo):
def __init__(self, grafo, origen, destino):
CaminoMinimo.__init__(self, grafo, origen, destino)
self.dist_heap = []
#heapq.heapify(self.dist_heap)
for i in xrange(self.grafo.V... | GFibrizo/TPS_7529 | TDA Grafo/Dijkstra.py | Python | apache-2.0 | 1,960 | 0.003061 |
versions = {
'7.1.1': ['2022-03-04', {
'fix': {
'1649': 'Minor label error in model image',
'1650': 'Obsolete database version in install SQL'}}],
'7.1.0': ['2022-02-15', {
'feature': {
'1506': 'Update CIDOC CRM to 7.1.1',
'1285': 'Improved value t... | craws/OpenAtlas | openatlas/util/changelog.py | Python | gpl-2.0 | 26,790 | 0.000037 |
import datetime
import os
from django.conf import settings
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon
from olympia.devhub.cron import update_blog_posts
from olympia.devhub.tasks import convert_purified
from olympia.devhub.models import BlogPost
class TestRSS(TestCase):
def t... | harikishen/addons-server | src/olympia/devhub/tests/test_cron.py | Python | bsd-3-clause | 1,566 | 0 |
# Copyright (C) 2011, 2012 by Matteo Franchin
#
# This file is part of Pyrtist.
#
# Pyrtist 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 2.1 of the License, or
# (at your optio... | mfnch/pyrtist | pyrtist/gui/dox/dox.py | Python | lgpl-2.1 | 2,729 | 0.009894 |
"""
.. function:: timeslidingwindow(timewindow, timecolumn) -> query results
Returns the query input results annotated with the window id as an extra column.
The following arguments can be passed as parameters:
timewindow: It can be a numeric value that specifies the time length of
the window (in seconds).
timecol... | sosguns2002/interactive-mining | interactive-mining-3rdparty-madis/madis/src/functions/vtable/timeslidingwindow.py | Python | gpl-3.0 | 6,001 | 0.0025 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorFileWriter.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"... | ahuarte47/QGIS | tests/src/python/test_qgsvectorfilewriter.py | Python | gpl-2.0 | 49,644 | 0.002397 |
import sys
import ctypes
def popcount(N):
if sys.platform.startswith('linux'):
libc = ctypes.cdll.LoadLibrary('libc.so.6')
return libc.__sched_cpucount(ctypes.sizeof(ctypes.c_long), (ctypes.c_long * 1)(N))
elif sys.platform == 'darwin':
libc = ctypes.cdll.LoadLibrary('libSystem.dylib')... | knuu/competitive-programming | atcoder/dp/edu_dp_o.py | Python | mit | 818 | 0.002445 |
import teca.utils as tecautils
import teca.ConfigHandler as tecaconf
import unittest
class TestFileFilter(unittest.TestCase):
def setUp(self):
self.conf = tecaconf.ConfigHandler(
"tests/test_data/configuration.json",
{"starting_path": "tests/test_data/images"}
)
self... | alfateam123/Teca | tests/test_utils.py | Python | mit | 902 | 0.001109 |
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val: int = 0, left: "TreeNode" = None, right: "TreeNode" = None):
self.val = val
self.left = left
self.right = right
@classmethod
def serialize(cls, root: "TreeNode") -> str:
"""... | l33tdaima/l33tdaima | local_packages/binary_tree.py | Python | mit | 1,599 | 0.001251 |
# Copyright (C) 2017 FireEye, Inc. All Rights Reserved.
import contextlib
import envi
import viv_utils
class ApiMonitor(viv_utils.emulator_drivers.Monitor):
"""
The ApiMonitor observes emulation and cleans up API function returns.
"""
def __init__(self, vw, function_index):
viv_utils.emulat... | fireeye/flare-floss | floss/api_hooks.py | Python | apache-2.0 | 14,484 | 0.001105 |
# -*- coding: iso-8859-1 -*-
#
# Bicycle Repair Man - the Python Refactoring Browser
# Copyright (C) 2001-2006 Phil Dawes <phil@phildawes.net>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
# A some of this code is ... | lebauce/artub | bike/parsing/pathutils.py | Python | gpl-2.0 | 5,507 | 0.005084 |
# -*- coding: utf-8 -*-
"""
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
# stdlib
import os.path
# gtk
import gtk, gobject
# PIDA Imports
# core
from kiwi.ui.objectlist import Column
from pida.core.service import Service
from pida.core.features impor... | fermat618/pida | pida-plugins/quickopen/quickopen.py | Python | gpl-2.0 | 7,589 | 0.003031 |
__all__ = ('WebSocketResponse', 'MsgType')
import asyncio
import warnings
from . import hdrs
from .errors import HttpProcessingError, ClientDisconnectedError
from .websocket import do_handshake, Message, WebSocketError
from .websocket_client import MsgType, closedMessage
from .web_exceptions import (
HTTPBadReque... | lfblogs/aiopy | aiopy/required/aiohttp/web_ws.py | Python | gpl-3.0 | 8,998 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.plugins import (
bypass_csrf_protection,
get_admin_plugin_menu_bar,
get_user_page_menu_bar,
override_template,
register_admin_plugin_menu_bar,
register_admin_plugin_script,
register_admin_plugin_stylesheet,
register_plugin_asset,
... | isislab/CTFd | tests/test_plugin_utils.py | Python | apache-2.0 | 7,989 | 0.001377 |
# vim:ts=4:et
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This prog... | sketchfab/io_object_mu | import_mu.py | Python | gpl-2.0 | 15,783 | 0.003485 |
# A very basic settings file that allows Sphinx to build
# the docs (this is becuase autodoc is used).
import os
import sys
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
SITE_ID = 303
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {"default": {
"NAME": ":memory:",
"... | mazelife/django-scaffold | docs/settings.py | Python | bsd-3-clause | 698 | 0 |
# -*- coding: utf-8 -*-
import os
import subprocess
import ujson
from django.conf import settings
from django.test import TestCase, override_settings
from django.http import HttpResponse
from typing import Any, Dict, List
from zproject.settings import DEPLOY_ROOT
from zerver.lib.integrations import INTEGRATIONS
from... | rishig/zulip | zerver/tests/test_docs.py | Python | apache-2.0 | 24,048 | 0.002828 |
import sqlite3
import os
from mitmproxy.io import protobuf
class DBHandler:
"""
This class is wrapping up connection to SQLITE DB.
"""
def __init__(self, db_path, mode='load'):
if mode == 'write':
if os.path.isfile(db_path):
os.remove(db_path)
self.db_pat... | ujjwal96/mitmproxy | mitmproxy/io/db.py | Python | mit | 1,107 | 0.000903 |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum.i18n import _
from electrum.util import base_units
import os
from label_dialog import LabelDialog
Builder.load_string('''
#:import os os
<WalletDialog@Popup>:
title: _(... | valesi/electrum | gui/kivy/uix/dialogs/wallets.py | Python | gpl-3.0 | 1,677 | 0.001193 |
import smtplib
import base64
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
from __builtin__ import file
import flogger_settings
import os
import datetime
def email_msg(sender, receive... | tobiz/OGN-Flight-Logger_V3 | flogger_email_msg.py | Python | gpl-3.0 | 1,212 | 0.012376 |
import torch
from .Criterion import Criterion
from .utils import recursiveResizeAs, recursiveFill, recursiveAdd
class ParallelCriterion(Criterion):
def __init__(self, repeatTarget=False):
super(ParallelCriterion, self).__init__()
self.criterions = []
self.weights = []
self.gradInp... | RPGOne/Skynet | pytorch-master/torch/legacy/nn/ParallelCriterion.py | Python | bsd-3-clause | 1,404 | 0.001425 |
#!/usr/bin/env python
import sys
def convert_str(infile, outfile):
f = open(infile, 'r')
lines = f.readlines()
f.close()
f = open(outfile, 'w')
f.writelines(['"%s\\n"\n' % i.rstrip() for i in lines])
f.close()
def main():
convert_str('fountain.vert', 'fountain.vert.inc')
convert_str('... | fountainment/FountainEngineImproved | fountain/render/convert_shader.py | Python | mit | 396 | 0.007576 |
# Copyright 2008-2018 Davide Alberani <da@erlug.linux.it>
# 2008-2018 H. Turgut Uyar <uyar@tekir.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License,... | Vagab0nd/SiCKRAGE | lib3/imdb/parser/http/searchCompanyParser.py | Python | gpl-3.0 | 2,406 | 0.001247 |
# -*- coding: utf-8 -*-
__version__ = '$Id: 7e07cc8b51fa2cdfb23c34c8652adf4a94003dc8 $'
import family
# The Wikimedia i18n family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'i18n'
self.langs = {
'i18n': 'translatewiki.net',
... | races1986/SafeLanguage | CEM/families/i18n_family.py | Python | epl-1.0 | 6,800 | 0.000294 |
import unittest
import time
import pprint
import logging
import scanner.logSetup as logSetup
import pyximport
print("Have Cython")
pyximport.install()
import dbPhashApi
class TestCompareDatabaseInterface(unittest.TestCase):
def __init__(self, *args, **kwargs):
logSetup.initLogging()
super().__init__(*args,... | fake-name/IntraArchiveDeduplicator | Tests/Test_db_BKTree_Compare.py | Python | bsd-3-clause | 1,765 | 0.026062 |
# -*- coding: utf-8 -*-
"""
test/test_api
~~~~~~~~~
Tests of the top-level SPDYPy API. These will be relatively sparse for the
moment.
"""
# Nasty little path hack.
import sys
sys.path.append('.')
class TestAPI(object):
"""
Tests for the top-level spdypy API.
"""
def test_can_import_spdypy_on_py_33(s... | Lukasa/spdypy | test/test_api.py | Python | mit | 368 | 0 |
# -*- encoding: utf-8 -*-
# Copyright © 2012 New Dream Network, LLC (DreamHost)
# 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.... | SauloAislan/ironic | ironic/api/app.py | Python | apache-2.0 | 3,844 | 0 |
# -*- coding: utf-8 -*-
"""
pen: terminal notes
"""
__title__ = 'pen'
__author__ = 'cwoebker'
__version__ = '0.4.2'
__license__ = 'BSD'
__copyright__ = '© 2013-2018 Cecil Wöbker'
| cwoebker/pen | pen/__init__.py | Python | bsd-3-clause | 182 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Post.posts'
db.add_column(u'posts_post', 'posts',
... | elena/dev-parse | posts/migrations/0002_auto__add_field_post_posts.py | Python | bsd-2-clause | 3,048 | 0.007874 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_... | tima/ansible | lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py | Python | gpl-3.0 | 15,589 | 0.003207 |
# -*- coding: utf-8 -*-
"""
################################################################################
# #
# media_editing #
# ... | wdbm/media_editing | media_editing.py | Python | gpl-3.0 | 2,382 | 0.010915 |
import os
import enums
class dm_server:
def __init__ (self, Name, Ip, statistics, Os = None):
self.__name = Name
self.__ip = Ip
self.__services = []
self.__statistics = statistics
if Os:
self.__os = Os
else:
self.__os = None
def addService (self, Service):
self.__services.append(Service)
def ... | PC-fit-Christian-Rupp/serverstatepage | code/testroutine/dm_server.py | Python | mit | 1,222 | 0.047463 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... | DoubleNegativeVisualEffects/gaffer | python/GafferUI/Slider.py | Python | bsd-3-clause | 14,206 | 0.062509 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# ModRana config files handling
#----------------------------------------------------------------------------
# Copyright 2012, Martin Kolman
#
# This program is free software: you can redistribute it and/or modify
# i... | ryfx/modrana | core/configs.py | Python | gpl-3.0 | 6,907 | 0.00304 |
# -*- coding: utf-8 -*-
import sys
import csv
from itertools import izip
# https://pypi.python.org/pypi/unicodecsv
# http://semver.org/
VERSION = (0, 9, 4)
__version__ = ".".join(map(str, VERSION))
pass_throughs = [
'register_dialect',
'unregister_dialect',
'get_dialect',
'list_dialects',
'field_... | archives-new-zealand/archwayimportgenerator | libs/unicodecsv.py | Python | gpl-3.0 | 7,077 | 0.001559 |
import pytest
from tests.functional.ucare_cli.helpers import arg_namespace
from pyuploadcare.ucare_cli.commands.update_webhook import update_webhook
@pytest.mark.vcr
def test_update_webhooks(capsys, uploadcare):
update_webhook(
arg_namespace(
"update_webhook 865715 --deactivate "
... | uploadcare/pyuploadcare | tests/functional/ucare_cli/test_update_webhook.py | Python | mit | 484 | 0 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/link_token_create_request_update.py | Python | mit | 6,717 | 0.000447 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 (standalone edition) on Tue Jan 14 10:41:03 2014
#
import wx
import wx.grid
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwd... | gamesun/MyTerm-for-WangH | GUI.py | Python | bsd-3-clause | 16,544 | 0.001572 |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from computes.models import Compute
from networks.forms import AddNetPool
from vrtManager.network import wvmNetwork, wv... | harry-ops/opencloud | webvirtcloud/networks/views.py | Python | gpl-2.0 | 4,905 | 0.001427 |
import numpy as np
from itertools import combinations, imap
from timer import show_progress
from connectedness import is_connected
def brute_main():
for N in show_progress(xrange(4,1000)):
print N,brute(N)
def brute(N):
return sum(is_connected(s)
for s in combinations(xrange(N),3))
d... | gabegaster/connectedness | experiment.py | Python | mit | 748 | 0.022727 |
import numpy as np
import pystencils as ps
from pystencils_walberla import CodeGeneration, generate_sweep
with CodeGeneration() as ctx:
# ----- Stencil 2D - created by specifying weights in nested list --------------------------
src, dst = ps.fields("src, src_tmp: [2D]", layout='fzyx')
stencil = [[1.11, 2... | lssfau/walberla | tests/field/codegen/JacobiKernel.py | Python | gpl-3.0 | 1,066 | 0.00469 |
# -*- coding: utf-8 -*-
# 本题难度:★
# 不使用额外储存空间,判断一个整数是否为回文数字。例如:
# -22 -> false
# 1221 -> true
# 1221221 -> true
# 1234321 -> true
# 234 -> false
# 需要注意的是:
# 考虑负数
# 不允许使用额外储存空间,比如将数字转换成字符串
# 反转数字需要考虑溢出问题
# 参考答案:https://github.com/barretlee/daily-algorithms/blob/master/answers/7.md
import math
def Palindrome_Number(nu... | pengkobe/leetcode | questions/Palindrome_Number.py | Python | gpl-3.0 | 1,166 | 0.014315 |
import json
import sure # noqa # pylint: disable=unused-import
import moto.server as server
def test_es_list():
backend = server.create_backend_app("es")
test_client = backend.test_client()
resp = test_client.get("/2015-01-01/domain")
resp.status_code.should.equal(200)
json.loads(resp.data).sho... | spulec/moto | tests/test_es/test_server.py | Python | apache-2.0 | 352 | 0 |
#
# Copyright (C) 2014 Jonathan Finlay <jfinlay@riseup.net>
#
# 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 la... | jonathanf/infosalud | visit/visit.py | Python | agpl-3.0 | 3,450 | 0.002319 |
#!/usr/bin/env python
#-*- coding: ascii -*-
from __future__ import print_function
import sys
import platform
def copy_to_dst(src_name, dst_dir):
print("Copy %s to %s" % (src_name, dst_dir))
import shutil
shutil.copy(src_name, dst_dir)
#cfg, address_model=32/64, version_type=debug/release;
def getEnvInfo(address... | bigvat/vat | common.py | Python | apache-2.0 | 3,323 | 0.040024 |
import functools
import httplib as http
import itertools
from operator import itemgetter
from dateutil.parser import parse as parse_date
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils import timezone
from flask import request, redirect
import pytz
from framework.d... | erinspace/osf.io | website/project/views/drafts.py | Python | apache-2.0 | 13,819 | 0.003329 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clients', '0017_auto_20151025_1240'),
('clients', '0015_auto_20151025_1209'),
]
operations = [
]
| deafhhs/adapt | clients/migrations/0018_merge.py | Python | mit | 297 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | rackerlabs/horizon | openstack_dashboard/dashboards/admin/projects/urls.py | Python | apache-2.0 | 1,755 | 0.00057 |
# Copyright 2015 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 requ... | hanlind/nova | nova/conf/cells.py | Python | apache-2.0 | 15,948 | 0.003386 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Shuang Wang <ooocamel@icloud.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_versi... | kvar/ansible | lib/ansible/modules/cloud/amazon/aws_codecommit.py | Python | gpl-3.0 | 6,565 | 0.00198 |
#Copyright 2009 Humanitarian International Services Group
#
#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... | mattmillr/utaka | src/exceptions/BadRequestException.py | Python | apache-2.0 | 11,951 | 0.038407 |
# Script Name : main.py
# Author : Shy Ruparel
# Created : September 8 2015
# Pulls in data from "data.csv" which is 2 columns wide
# Uses a base image as the background
# Uses the data - school name, and venue address -
# and prints onto the base image
# and saves every image as a .PNG
fro... | niespodd/flyer_generator | main.py | Python | mit | 2,191 | 0.006846 |
""" Convert Excel document (.xls) delivered from MAF to a ped.txt file.
"""
import argparse
import csv
import xlrd
def main(xls_file, out_file, sheet_name):
with xlrd.open_workbook(xls_file) as workbook:
worksheet = workbook.sheet_by_name(sheet_name)
with open(out_file, 'w') as fh:
c... | SciLifeLab/scilifelab | scripts/xls2ped.py | Python | mit | 751 | 0 |
"""Support for Pilight binary sensors."""
import datetime
import logging
import voluptuous as vol
from homeassistant.components import pilight
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice
from homeassistant.const import (
CONF_DISARM_AFTER_TRIGGER,
CONF_NAME,
CONF... | leppa/home-assistant | homeassistant/components/pilight/binary_sensor.py | Python | apache-2.0 | 6,144 | 0.000488 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import textwrap, os, shlex, subprocess, glob, shutil
from distutils import sysconfig
... | insomnia-lab/calibre | setup/extensions.py | Python | gpl-3.0 | 24,319 | 0.005222 |
# 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.
"""Presubmit script for rappor.xml.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built ... | guorendong/iridium-browser-ubuntu | tools/metrics/rappor/PRESUBMIT.py | Python | bsd-3-clause | 1,156 | 0.007785 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.