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 |
|---|---|---|---|---|---|---|
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | alfasin/st2 | st2client/st2client/models/core.py | Python | apache-2.0 | 11,745 | 0.001192 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
# 通过列表存储dick的key来达到创建有序字典
class MyDict(dict):
def __init__(self):
self.li = []
super(MyDict, self).__init__()
def __setitem__(self, key, value):
self.li.append(key)
super(MyDict, self).__setitem__(key, value... | smartczm/python-learn | Old-day01-10/s13-day8/有序字典/s1.py | Python | gpl-2.0 | 689 | 0.001541 |
# Distributed under the MIT licesnse.
# Copyright (c) 2013 Dave McCoy (dave.mccoy@cospandesign.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 in
# the Software without restriction, including without lim... | CospanDesign/verilog-visualizer | verilogviz/view/graph/graphics_view.py | Python | gpl-2.0 | 2,510 | 0.005578 |
import salt.returners.sentry_return as sentry
from tests.support.unit import TestCase
class SentryReturnerTestCase(TestCase):
"""
Test Sentry Returner
"""
ret = {
"id": "12345",
"fun": "mytest.func",
"fun_args": ["arg1", "arg2", {"foo": "bar"}],
"jid": "54321",
... | saltstack/salt | tests/unit/returners/test_sentry_return.py | Python | apache-2.0 | 787 | 0.001271 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/core/vistrail/connection.py | Python | bsd-3-clause | 10,497 | 0.005716 |
"""Convert between larger integers and chunks of smaller integers and booleans.
Note: chunks have little-endian bit-order
like gmpy2.(un)pack, but reverse of numpy.(un)packbits
"""
from itertools import compress, zip_longest
__all__ = ['chunkreverse', 'pack', 'unpack', 'packbools', 'unpackbools']
NBITS = {'B'... | xflr6/bitsets | bitsets/transform.py | Python | mit | 2,607 | 0 |
#!/usr/bin/env python
# Copyright (c) Suchakra Sharma <suchakrapani.sharma@polymtl.ca>
# Licensed under the Apache License, Version 2.0 (the "License")
from bcc import BPF, _get_num_open_probes, TRACEFS
import os
import sys
from unittest import main, TestCase
class TestKprobeCnt(TestCase):
def setUp(self):
... | mcaleavya/bcc | tests/python/test_probe_count.py | Python | apache-2.0 | 2,656 | 0.000377 |
# -*- coding: utf-8 -*-
"""
***
Labelling is B I O St Sm Sb
Singletons are split into:
- St : a singleton on "top" of its cell, vertically
- Sm : a singleton in "middle" of its cell, vertically
- Sb : a singleton in "bottom" of its cell, vertically
Copyright Naver Labs Eu... | Transkribus/TranskribusDU | TranskribusDU/tasks/TablePrototypes/DU_ABPTableSkewed_txtBIOStmb_sepSIO_line.py | Python | bsd-3-clause | 8,251 | 0.021937 |
from group import Group
from label import Label
from path import Path
from polygon import Polygon
| drepetto/chiplotle | chiplotle/geometry/core/__init__.py | Python | gpl-3.0 | 98 | 0 |
# FST tests related classes
# Copyright (c) 2015, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
import os
import signal
import time
import re
import hostapd
import wpaspy
import utils
from wpasupplicant import WpaSupplican... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/fst_module_aux.py | Python | gpl-3.0 | 33,202 | 0.001867 |
# coding: utf-8
#
# Copyright 2015 The Oppia 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 requi... | jestapinski/oppia | core/domain/collection_domain.py | Python | apache-2.0 | 30,872 | 0.000065 |
# -*- coding: utf-8 -*-
import cv, cv2
import numpy as np
def display_histogram(frame):
hist_height = 300
hist_width = 256
cv2.namedWindow('colorhist', cv2.CV_WINDOW_AUTOSIZE)
b,g,r = cv2.split(frame)
color = [(255,0,0),(0,255,0),(0,0,255)]
# image à afficher
h = np.zeros((300,256,3))
... | FilippoC/pke | src/pke/gui.py | Python | mit | 1,481 | 0.025051 |
#!/usr/bin/env python
import os, sys, argparse
from fabric.api import execute
from soppa.file import import_string
def use_fabric_env(path):
path = path or env.sync_filename
local_env = json.loads(open(path, 'r').read().strip() or '{}')
env.update(**local_env)
def main(args):
use_fabric_env(args.fil... | futurice/fabric-deployment-helper | soppa/remote/runner.py | Python | bsd-3-clause | 593 | 0.008432 |
#!/usr/bin/env python
import math
import random
import pygame
import pygame.color as color
import boid
import mapparser as mp
from prm import PRMGenerator
class Configuration:
"""
Static class that holds important global variables
"""
## Dimensions of the screen
dim = xSize, ySize = 1000, 600
... | wallarelvo/CRoPS | code/configuration.py | Python | apache-2.0 | 8,245 | 0.001698 |
#!./bin/python
""" Shows interesting activity from followed users of Github
"""
from __future__ import print_function
from github import Github
from datetime import datetime, timedelta
from argparse import ArgumentParser
from config import GITHUB_USERNAME, GITHUB_PASS
def repo_title(repo):
return "{} ({}/{})".fo... | tiberiuichim/minitools | get_git_social_log.py | Python | gpl-3.0 | 1,890 | 0.000529 |
"""
This integration tests will perform basic operations on a storage element, depending on which protocols are available.
It creates a local hierarchy, and then tries to upload, download, remove, get metadata etc
Potential problems:
* it might seem a good idea to simply add tests for the old srm in it. It is not :-)
... | andresailer/DIRAC | tests/Integration/Resources/Storage/Test_Resources_GFAL2StorageBase.py | Python | gpl-3.0 | 14,281 | 0.008333 |
################################################################
# CreditPiggy - Volunteering Computing Credit Bank Project
# Copyright (C) 2015 Ioannis Charalampidis
#
# 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 Fr... | wavesoft/creditpiggy | creditpiggy-server/creditpiggy/frontend/views/embed.py | Python | gpl-2.0 | 3,531 | 0.021524 |
# Django
from django.views.generic.list import ListView
__all__ = ['DataTableView']
class DataTableView(ListView):
"""Class-based list view using a datatable."""
# FIXME: Implement me!
| ninemoreminutes/django-datatables | datatables/views.py | Python | bsd-3-clause | 197 | 0 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CourseImage.year'
db.add_column('profiles_courseimage', 'year', self.gf('dj... | ParsonsAMT/Myne | datamining/apps/profiles/migrations/0008_auto__add_field_courseimage_year__add_field_courseimage_type__chg_fiel.py | Python | agpl-3.0 | 21,539 | 0.008264 |
"""Array printing function
$Id: arrayprint.py,v 1.9 2005/09/13 13:58:44 teoliphant Exp $
"""
__all__ = ["array2string", "array_str", "array_repr", "set_string_function",
"set_printoptions", "get_printoptions", "printoptions",
"format_float_positional", "format_float_scientific"]
__docformat__ = ... | pbrod/numpy | numpy/core/arrayprint.py | Python | bsd-3-clause | 61,625 | 0.000471 |
from corehq.dbaccessors.couchapps.all_docs import \
get_all_doc_ids_for_domain_grouped_by_db, get_doc_count_by_type, \
delete_all_docs_by_doc_type, get_doc_count_by_domain_type
from dimagi.utils.couch.database import get_db
from django.test import TestCase
class AllDocsTest(TestCase):
maxDiff = None
... | qedsoftware/commcare-hq | corehq/couchapps/tests/test_all_docs.py | Python | bsd-3-clause | 3,246 | 0.003389 |
# -*- coding: utf-8 -*-
# ____________
# ___/ | \_____________ _ _ ___
# / ___/ | _ __ _ _| | ___ __ _ __| | \
# / \___/ ______/ | '_ \ || | |__/ _ \/ _` / _` | \
# \ ◯ | | .__/\_, |____\___/\__,_\__,_| /
# \_______\ /_______|_| |__/... | vuolter/pyload | src/pyload/__init__.py | Python | agpl-3.0 | 1,504 | 0.000666 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-03-27 12:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0248_auto_20180328_1347'),
# ('attribution', '0032_auto_20180327_1458'),
]
... | uclouvain/OSIS-Louvain | base/migrations/0249_auto_20180327_1458.py | Python | agpl-3.0 | 7,422 | 0.004042 |
#!/usr/bin/env python2
import os, sys, time, subprocess, threading
from struct import pack
import kismetclient, netifaces, requests
led_device='/dev/serial/by-id/pci-FTDI_USB__-__Serial-if00-port0'
ppp_iface = 'ppp0'
ovpn_iface = 'tun.bukavpn'
uplink_usb_id = '1199:68a3'
storage_usb_id = '152d:2336'
external_url = 'h... | mgrela/whitestar | ansible/roles/whitestar/files/bin/whitestar-watchdog.py | Python | mit | 7,240 | 0.020856 |
import _plotly_utils.basevalidators
class AlignsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="alignsrc",
parent_name="histogram2dcontour.hoverlabel",
**kwargs
):
super(AlignsrcValidator, self).__init__(
plotly_name=... | plotly/python-api | packages/python/plotly/plotly/validators/histogram2dcontour/hoverlabel/_alignsrc.py | Python | mit | 501 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
### auteur: Ward De Ridder
### bedoeling: regelmatige werkwoorden op -cer vervoegen in het Frans
werkwoord = input("Werkwoord: ")
#werkwoord = developper
stam = werkwoord[:-3]
FILE = open(werkwoord+".txt","w",encoding='utf-8')
begin = "{{-start-}}\n"
eind =... | warddr/wiktionary-frverb | verb-ger.py | Python | gpl-3.0 | 6,287 | 0.008133 |
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher
#
# This file is part of the LipidFinder software tool and governed by the
# 'MIT License'. Please see the LICENSE file that should have been
# included as part of this software.
"""Set of methods focused on creating a summary of the dataset:
> create_summary... | cjbrasher/LipidFinder | LipidFinder/PeakFilter/Summary.py | Python | mit | 2,682 | 0.000373 |
from pybrain.rl.environments.timeseries.maximizereturntask import DifferentialSharpeRatioTask
from pybrain.rl.environments.timeseries.timeseries import AR1Environment, SnPEnvironment
from pybrain.rl.learners.valuebased.linearfa import Q_LinFA
from pybrain.rl.agents.linearfa import LinearFA_Agent
from pybrain.rl.experim... | samstern/MSc-Project | pybrain/rl/environments/timeseries/test programs/ar1TestScript.py | Python | bsd-3-clause | 976 | 0.018443 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | machristie/airavata | airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/testAiravataClient.py | Python | apache-2.0 | 1,089 | 0.003673 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem415.py
#
# Titanic sets
# ============
# Published on Sunday, 17th February 2013, 10:00 am
#
# A set of lattice points S is called a titanic set if there exists a line
# passing through exactly two points in S. An example of a titanic set is S =
# {(0, 0), (0, 1... | olduvaihand/ProjectEuler | src/python/problem415.py | Python | mit | 990 | 0.002033 |
from .parser import IEMLParser | IEMLdev/propositions-restful-server | ieml/usl/parser/__init__.py | Python | gpl-3.0 | 30 | 0.033333 |
import imp
import logging
import os
import sys
from mock import *
from .gp_unittest import *
from gppylib.gpcatalog import GPCatalogTable
class GpCheckCatTestCase(GpTestCase):
def setUp(self):
# because gpcheckcat does not have a .py extension, we have to use imp to import it
# if we had a gpchec... | 50wu/gpdb | gpMgmt/bin/gppylib/test/unit/test_unit_gpcheckcat.py | Python | apache-2.0 | 16,180 | 0.005562 |
import json
from jaspyx.visitor import BaseVisitor
class Types(BaseVisitor):
def visit_Num(self, node):
self.output(json.dumps(node.n))
def visit_Str(self, node):
self.output(json.dumps(node.s))
def visit_List(self, node):
self.group(node.elts, prefix='[', infix=', ', suffix=']')... | iksteen/jaspyx | jaspyx/visitor/types.py | Python | mit | 351 | 0 |
import unittest
from QuickSort import QuickSort
class QuickSortTester(unittest.TestCase):
def setUp(self):
self.qs = QuickSort()
def test_partition(self):
arr = [10, 5, 2, 90, 61, 32, 3]
#pivot point is 10
#after partition array should be
#[5, 2, 3, 10, 90, 61, 32]
... | nicangeli/Algorithms | arrays/quick_sort/tests.py | Python | mit | 1,602 | 0.003745 |
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8
# Copyright (c) 2008, 2010 Janne Blomqvist
# This source code file is subject to the terms of the MIT (Expat)
# License. See the file LICENSE for details.
"""This module contains unit tests for the vasputil.dos module."""
import unittest
import vasputil.dos as d... | oren88/vasputil | vasputil/tests/test_dos.py | Python | mit | 592 | 0.001689 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xnl_2_0/GeneralSuffixElement.py | Python | gpl-3.0 | 962 | 0.00104 |
# encoding:utf-8
import logging
import maya.api.OpenMaya as om
# fast convenience tests on API objects
def isValidMObjectHandle(obj):
if isinstance(obj, om.MObjectHandle):
return obj.isValid() and obj.isAlive()
else:
return False
def isValidMObject(obj):
if isinstance(obj, om.MObject):
... | yes7rose/maya_utils | python/maya_utils/api_utils.py | Python | mit | 2,347 | 0.005113 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# 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 ... | Micronaet/micronaet-bom | lavoration_cl_sl_mrp/__openerp__.py | Python | agpl-3.0 | 1,541 | 0.001298 |
#!/usr/bin/python3
#!/usr/bin/python3
from PIL import Image, ImageDraw
import glob
import os
from recolor import replace_color
dest = "."
for fname in glob.glob("in/*.png"):
im = Image.open(fname)
replace_color(im, range(112, 123+1), range(80, 95+1))
_, ofname = os.path.split(fname)
ofname = os.path... | forcecore/yupgi_alert0 | assets/shp/slave/run.py | Python | gpl-3.0 | 385 | 0.002597 |
# Generated by Django 2.2 on 2020-02-14 12:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scoping', '0315_auto_20200114_1420'),
('twitter', '0020_auto_20200115_1237'),
]
operations = [
migrat... | mcallaghan/tmv | BasicBrowser/twitter/migrations/0021_auto_20200214_1232.py | Python | gpl-3.0 | 784 | 0.002551 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil import relativedelta
from odoo import fields, models, api
class LeadTest(models.Model):
_name = "base.automation.lead.test"
_description = "Automated Rule Test"
name = fields.Char(string='Sub... | t3dev/odoo | addons/base_automation/tests/test_models.py | Python | gpl-3.0 | 1,762 | 0.00227 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Tests for the engine module
"""
import numpy as np
import scipy.sparse as ssp
import re
import mock
from nipype.pipeline.plugins.tools import report_crash
def test_report_crash... | mick-d/nipype | nipype/pipeline/plugins/tests/test_tools.py | Python | bsd-3-clause | 1,756 | 0.006264 |
from ImageScripter import *
from elan import *
raise ValueError('fff')
Viewer.Start()
Viewer.CloseAndClean()
Configurator.Start()
Configurator.inputoutput.Click()
addNewComDev(ComType = "Standard Connection",HardwareType = "Serial Port",Comport = '0')
addNewDevice(Configurator.genericserialdevices,"Generic Serial De... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/Backup Pools/Repeat_One_Test/1____Serial_Device_Settings_Change_Check.py | Python | gpl-3.0 | 1,335 | 0.019476 |
import urllib
import pandas as pd
import pandas.io.data as web
#from datetime import datetime
import matplotlib.pyplot as plt
import pickle as pk
from pandas.tseries.offsets import BDay
# pd.datetime is an alias for datetime.datetime
#today = pd.datetime.today()
import time
#time.sleep(5) # delays for 5 seconds
today ... | iamaris/pystock | scansingle.py | Python | apache-2.0 | 2,023 | 0.024221 |
import time
import wx
class ShowBinding(object):
def __init__(self, field, trait, show_if_value=True):
self.field, self.trait, self.show_if_value = field, trait, show_if_value
trait[0].on_trait_change(self.update_view, trait[1], dispatch='ui')
self.update_view()
def update_view(self):... | Bouke/mvvm | mvvm/viewbinding/display.py | Python | mit | 6,057 | 0.001816 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from frappe.model.document import Document
class EmployeeTaxExemptionCategory(Document):
pass
| mhbu50/erpnext | erpnext/payroll/doctype/employee_tax_exemption_category/employee_tax_exemption_category.py | Python | gpl-3.0 | 218 | 0.004587 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vasicek parameter class
~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function, division
import numpy as np
from .param_generic import GenericParam
__all__ = ['VasicekParam']
class VasicekParam(GenericParam):
"""Parameter storage for Vasicek model.... | khrapovs/diffusions | diffusions/param_vasicek.py | Python | mit | 2,899 | 0 |
"""
"Custom template tags and filters must live inside a Django app. If they relate to an existing app it makes
sense to bundle them there; otherwise, you should create a new app to hold them." –
https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/
This is such an app to hold template tags.
"""
| fausecteam/ctf-gameserver | src/ctf_gameserver/web/templatetags/__init__.py | Python | isc | 311 | 0.006472 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | mrunge/openstack_horizon | openstack_horizon/dashboards/admin/volumes/volume_types/extras/views.py | Python | apache-2.0 | 3,595 | 0 |
# coding: utf-8
from leancloud import Object
from leancloud import Query
from leancloud import LeanCloudError
from flask import Blueprint
from flask import request
from flask import redirect
from flask import url_for
from flask import render_template
import sys
sys.path.insert(0,'../')
from utils import JsonDict
import... | zhangw/leancloud_apperance_app | views/weibos.py | Python | mit | 1,920 | 0.017857 |
"""
Lights sample
This sample shows how to setup multiple lights and load them from a .bam file.
"""
# Disable the "xxx has no yyy member" error, pylint seems to be unable to detect
# the properties of a nodepath
# pylint: disable=no-member
from __future__ import print_function
import os
import sys
import math
fr... | tobspr/RenderPipeline-Samples | 03-Lights/main.py | Python | mit | 5,332 | 0.002063 |
#!/usr/bin/env python
# vim:set ts=4 sw=4 ai et:
# Kohorte, a peer-to-peer protocol for sharing git repositories
# Copyright (c) 2015, Michael Toren <kohorte@toren.net>
# Released under the terms of the GNU GPL, version 2
import fcntl
import traceback
import os
import signal
from subprocess import Popen, PIPE, STDOU... | mct/kohorte | p2p/child.py | Python | gpl-2.0 | 2,883 | 0.001734 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Commitment.stage'
db.add_column('valueaccounting_commitment', 'stage',
... | thierrymarianne/valuenetwork | valuenetwork/valueaccounting/migrations/0018_auto__add_field_commitment_stage__add_field_commitment_state__add_fiel.py | Python | agpl-3.0 | 53,765 | 0.006882 |
############################################################
# -*- coding: utf-8 -*-
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 for python
# Python v3.5
#
# Michael Würtenberger
# (c) 2016, 2017, 2018
#
# Licence APL2.0
#
############################################################... | mworion/mountwizzard | mountwizzard/mount/ascommount.py | Python | apache-2.0 | 12,566 | 0.004536 |
import pytest
from eche.env import get_default_env
from eche.tests import eval_ast_and_verify_env, eval_ast_and_read_str
from eche.eche_types import Node
from eche.eche_types import List
from eche.eval import eval_ast
from eche.reader import read_str
import eche.step3_env as step
@pytest.mark.parametrize("test_input... | skk/eche | eche/tests/test_step3_env.py | Python | mit | 1,749 | 0.000572 |
"""
WSGI config for lms 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.6/howto/deployment/wsgi/
"""
import os
from os.path import abspath, dirname
from sys import path
SITE_ROOT = dirname(dirname(absp... | ishahid/django-blogg | source/website/wsgi.py | Python | mit | 524 | 0.001908 |
# -*- coding: utf-8 -*-
'''
xpathwebdriver
Copyright (c) 2014 Juju. Inc
Code Licensed under MIT License. See LICENSE file.
'''
from xpathwebdriver.solve_settings import ConfigVar, BaseSettings
import logging
class DefaultSettings(BaseSettings):
base_url = ConfigVar(
doc='specifies the root URL string to ... | joaduo/xpathwebdriver | xpathwebdriver/default_settings.py | Python | mit | 5,213 | 0.004796 |
"""Contains the core functionality that manages merging of assets.
"""
from __future__ import with_statement
import contextlib
import urllib2
import logging
try:
import cStringIO as StringIO
except:
import StringIO
from utils import cmp_debug_levels
__all__ = ('FileHunk', 'MemoryHunk', 'merge... | mozilla/verbatim | vendor/lib/python/webassets/merge.py | Python | gpl-2.0 | 12,313 | 0.000893 |
"""
AUTHOR: Peter Collins, 2005.
This software is Copyright (C) 2004-2008 Bristol University
and is released under the GNU General Public License version 2.
MODULE: RunHill
PURPOSE:
A sample setup and configuration for the normalization algorithms.
NOTES:
See RunConfig.py for configuration options
"""
import sy... | Peter-Collins/NormalForm | src/config-run/RunHill.py | Python | gpl-2.0 | 1,029 | 0.015549 |
'''
<<<<<<< HEAD
This package contains the estimations for cstwMPC.
=======
Nearly all of the estimations for the paper "The Distribution of Wealth and the
Marginal Propensity to Consume", by Chris Carroll, Jiri Slacalek, Kiichi Tokuoka,
and Matthew White. The micro model is a very slightly altered version of
ConsIndS... | ganong123/HARK | cstwMPC/cstwMPC.py | Python | apache-2.0 | 45,177 | 0.001549 |
# This file is part of PooPyLab.
#
# PooPyLab is a simulation software for biological wastewater treatment processes using International Water Association
# Activated Sludge Models.
#
# Copyright (C) Kai Zhang
#
# PooPyLab is free software: you can redistribute it and/or modify it under the terms of the GNU Gener... | toogad/PooPyLab_Project | PooPyLab/ASMModel/asm_2d.py | Python | gpl-3.0 | 24,192 | 0.003555 |
import os
import pytest
import random
import shutil
import tempfile
from raven.utils.testutils import TestCase
from raven.base import Client
from raven.contrib.zerorpc import SentryMiddleware
zerorpc = pytest.importorskip("zerorpc")
gevent = pytest.importorskip("gevent")
class TempStoreClient(Client):
def __ini... | Goldmund-Wyldebeast-Wunderliebe/raven-python | tests/contrib/zerorpc/tests.py | Python | bsd-3-clause | 2,939 | 0.001021 |
import CommonGraphDiffer as cgd
import argparse
def parseArgs():
parser = argparse.ArgumentParser()
parser.add_argument("cg1", help="This is the first .CGX (CommonGraph) file")
parser.add_argument("cg2", help="This is the second .CGX (CommonGraph) file")
parser.add_argument("ds", help="This is the outp... | oderby/VVD | diffgraph.py | Python | mit | 602 | 0.009967 |
from rest_framework.serializers import (DateTimeField, ModelSerializer,
PrimaryKeyRelatedField, SerializerMethodField)
from threads.models import Post
from threads.serializers import PostSerializer
from .models import User
class BaseUserSerializer(ModelSerializer):
posts =... | annaelde/forum-app | site/users/serializers.py | Python | mit | 859 | 0.002328 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='wu4'
SPELL='wù'
CN='戊'
SEQ='5'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/tiangan/wu4.py | Python | apache-2.0 | 217 | 0.03271 |
from flask import jsonify, request
from .. import db
from ..models import Event
from . import api
# Get event
@api.route('/event/<int:id>')
def get_event(id):
event = Event.query.get_or_404(id)
# TODO: Implement when the model updates
attendees_count = 1
json_post = event.to_json()
# TODO: Change when new m... | foodsnag/foodsnag-web | app/api/events.py | Python | mit | 576 | 0.020833 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | ElliotTheRobot/LILACS-mycroft-core | mycroft/skills/LILACS_chatbot/__init__.py | Python | gpl-3.0 | 5,092 | 0.002357 |
import _plotly_utils.basevalidators
class StartarrowsizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="startarrowsize",
parent_name="layout.scene.annotation",
**kwargs
):
super(StartarrowsizeValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/annotation/_startarrowsize.py | Python | mit | 557 | 0 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | sergiusens/snapcraft | tests/integration/general/test_prime_filter.py | Python | gpl-3.0 | 1,931 | 0.001036 |
# Copyright (c) 2014 Mirantis 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 ... | ekasitk/sahara | sahara/tests/tempest/scenario/data_processing/client_tests/test_data_sources.py | Python | apache-2.0 | 3,802 | 0 |
"""
Functions which are common and require SciPy Base and Level 1 SciPy
(special, linalg)
"""
from numpy import arange, newaxis, hstack, prod, array, frombuffer, load
__all__ = ['central_diff_weights', 'derivative', 'ascent', 'face',
'electrocardiogram']
def central_diff_weights(Np, ndiv=1):
"""
... | pizzathief/scipy | scipy/misc/common.py | Python | bsd-3-clause | 9,678 | 0.006716 |
# Copyright 2015 Hitachi Data Systems inc.
# 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... | jcsp/manila | manila/tests/share/test_migration.py | Python | apache-2.0 | 19,945 | 0.00005 |
from model.contact import Contact
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/contacts.json"
for o, a... | dariansk/python_training | generator/contact.py | Python | apache-2.0 | 1,606 | 0.006227 |
"""
fabcloudkit
:copyright: (c) 2013 by Rick Bohrer.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
# pypi
from fabric.context_managers import cd, prefix, settings
from fabric.operations import run, sudo
from fabric.state import env
# package
from fabcloudkit impo... | waxkinetic/fabcloudkit | fabcloudkit/build_tools/python_build.py | Python | bsd-3-clause | 7,221 | 0.003324 |
# -*- coding: utf-8 -*-
#
# fortran-linter documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 02:28:25 2017.
#
# 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... | uchchwhash/fortran-linter | docs/source/conf.py | Python | mit | 9,283 | 0.006033 |
import shutil
from setuptools import setup
# Load list of requirements from req file
with open('requirements.txt') as f:
REQUIRED_PACKAGES = f.read().splitlines()
# Load description from README file
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()
# Rename Scripts to sync with original name
sh... | titom73/inetsix-config-builder | setup.py | Python | gpl-2.0 | 1,313 | 0 |
# (C) 2016, Markus Wildi, wildi.markus@bluewin.ch
#
# 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, or (at your option)
# any later version.
#
# This program is distr... | RTS2/rts2 | scripts/u_point/u_point/httpd_connection.py | Python | lgpl-3.0 | 3,250 | 0.009846 |
from django.test import TransactionTestCase
from django.contrib.auth.models import Group
from django.conf import settings
from hs_core import hydroshare
from hs_core.hydroshare import utils
from hs_core.models import CoreMetaData
from hs_core.testing import TestCaseCommonUtilities
class TestRasterMetaData(TestCaseCo... | RENCI/xDCIShare | hs_geo_raster_resource/tests/test_raster_metadata_user_zone.py | Python | bsd-3-clause | 8,568 | 0.002801 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 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 la... | redhat-cip/dci-control-server | tests/api/v1/test_issues.py | Python | apache-2.0 | 15,798 | 0.000886 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the :class:`iris.coord_systems.VerticalPerspective` class."""
# Import iris.tests first so that some things ... | SciTools/iris | lib/iris/tests/unit/coord_systems/test_VerticalPerspective.py | Python | lgpl-3.0 | 3,251 | 0 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .stretch import *
from .interval import *
from .transform import *
from .ui import *
from .mpl_style import *
| piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/visualization/__init__.py | Python | mit | 180 | 0 |
import pytest
pytestmark = [pytest.mark.setone, pytest.mark.working]
@pytest.fixture
def data_release_update_1(award, lab):
return{
"schema_version": '1',
"award": award['@id'],
"lab": lab['@id'],
"summary": "Upgrader test.",
"update_tag": "UPGRADERTEST",
"submitted... | 4dn-dcic/fourfront | src/encoded/tests/test_upgrade_data_release_update.py | Python | mit | 3,172 | 0.000631 |
# -*- coding: utf-8 -*-
# Copyright(C) 2018 Arthur Huillet
#
# This file is part of a weboob module.
#
# This weboob module 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 Licens... | vicnet/weboob | modules/suravenir/pages.py | Python | lgpl-3.0 | 4,491 | 0.00468 |
""" Authentication library
======================
A base authentication & authorization module.
Includes the base class BaseAuth.
Authentication and authorization in NIPAP
-----------------------------------------
NIPAP offers basic authentication with two different backends, a simple
two... | SoundGoof/NIPAP | nipap/nipap/authlib.py | Python | mit | 24,138 | 0.002941 |
from http.server import BaseHTTPRequestHandler, HTTPServer
import requests
import urllib.parse
import json
# Define server address and port, use localhost if you are running this on your Mattermost server.
HOSTNAME = ''
PORT = 7800
# guarantee unicode string
_u = lambda t: t.decode('UTF-8', 'replace') if isinstance(t... | mlongo4290/mattermost-wunderground-slash-command | wunderground-slash-command.py | Python | gpl-3.0 | 4,117 | 0.00486 |
# Copyright 2008,2009 Marcus Huewe <suse-tux@gmx.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT... | OlegGirko/osc | osc/OscConfigParser.py | Python | gpl-2.0 | 13,677 | 0.003436 |
import userHelper
import serverPackets
import exceptions
import glob
import consoleHelper
import bcolors
import locationHelper
import countryHelper
import time
import generalFunctions
import channelJoinEvent
def handle(flaskRequest):
# Data to return
responseTokenString = "ayy"
responseData = bytes()
# The IP for ... | RlSEN/bannedcho | c.ppy.sh/loginEvent.py | Python | gpl-3.0 | 7,180 | 0.02507 |
"""Support for the Italian train system using ViaggiaTreno API."""
import asyncio
import logging
import time
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, HTTP_OK, TIME_MINUTES
im... | lukas-hetzenecker/home-assistant | homeassistant/components/viaggiatreno/sensor.py | Python | apache-2.0 | 5,443 | 0.000367 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Avoin Systems (http://avoin.systems).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publ... | avoinsystems/product_lot_sequence | __init__.py | Python | agpl-3.0 | 994 | 0.002012 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Noé Rubinstein
#
# This file is part of weboob.
#
# weboob 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 opt... | blckshrk/Weboob | modules/batoto/__init__.py | Python | agpl-3.0 | 796 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_pages_list_pages_async.py | Python | apache-2.0 | 1,481 | 0.000675 |
from mongoengine import *
class FeatureReference(EmbeddedDocument):
id = ObjectIdField()
name = StringField()
| slickqa/slickqaweb | slickqaweb/model/featureReference.py | Python | apache-2.0 | 120 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Chris Dekter
#
# 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 late... | nuclearsandwich/autokey | src/lib/qtui/dialogs.py | Python | gpl-3.0 | 20,532 | 0.005796 |
#!/usr/bin/env python3
import predict
import sklearn.metrics
import argparse, sys
import os
import numpy as np
import glob
import re
import matplotlib.pyplot as plt
def calc_auc(predictions):
y_true =[]
y_score=[]
for line in predictions:
values= line.split(" ")
y_true.append(float(values[1]))
y_score.append... | gnina/scripts | bootstrap.py | Python | bsd-3-clause | 3,080 | 0.047403 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003] [Jürgen Hamel, D-32584 Löhne]
##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 versio... | BackupTheBerlios/cuon-svn | cuon_client/cuon/Proposal/SingleProposalMisc.py | Python | gpl-3.0 | 1,877 | 0.018667 |
import sys
from collections import Counter
def get_domain(email_address):
return email_address.lower().split("@")[-1]
with open('email_addresses.txt','r') as f:
domain_counts = Counter(get_domain(line.strip())
for line in f
if "@" in line) | buckiracer/data-science-from-scratch | RefMaterials/Text-Manipulation/find_email.py | Python | unlicense | 258 | 0.034884 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | JetChars/vim | vim/bundle/python-mode/pymode/libs/logilab/common/ureports/nodes.py | Python | apache-2.0 | 5,838 | 0.002227 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
###########################################################
# © 2011 Daniel 'grindhold' Brendle and Team
#
# This file is part of Skarphed.
#
# Skarphed is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as ... | skarphed/skarphed | admin/src/skarphedadmin/gui/__init__.py | Python | agpl-3.0 | 1,295 | 0.015456 |
from __future__ import absolute_import
from contextlib import contextmanager
__all__ = [
'reversed',
]
@contextmanager
def reversed(G):
"""A context manager for temporarily reversing a directed graph in place.
This is a no-op for undirected graphs.
Parameters
----------
G : graph
A... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/utils/contextmanagers.py | Python | gpl-3.0 | 632 | 0 |
import os
import socket
import struct
from OpenSSL import SSL
from mitmproxy import exceptions
from mitmproxy import flow
from mitmproxy.proxy.protocol import base
from mitmproxy.net import tcp
from mitmproxy.net import websockets
from mitmproxy.websocket import WebSocketFlow, WebSocketMessage
class WebSocketLayer(b... | laurmurclar/mitmproxy | mitmproxy/proxy/protocol/websocket.py | Python | mit | 7,179 | 0.002368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.