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 (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import os
import re
import json
import shutil
import subprocess
from tempfile import mkdtemp, mktemp
from distutils.spawn import find_executable
import frappe
from frappe.utils.minify import JavascriptMinify
import cl... | saurabh6790/frappe | frappe/build.py | Python | mit | 14,371 | 0.025277 |
__all__ = ["bayes", "cpt", "heuristic", "payoff", "recognition", "rl", "sharing"] | greenape/disclosure-game | python/disclosuregame/disclosuregame/Agents/__init__.py | Python | mpl-2.0 | 81 | 0.024691 |
# -*- coding: utf-8 -*-
# Description: sort audio clips by intensity, frequency, or duration; outputs .csv file for use in sequence.ck via ChucK
# python sort_audio.py -sort syllables
# python sort_audio.py -sort syllables -by frequency
# python sort_audio.py -sort syllables -by duration -fixed 0
import argpars... | beefoo/still-i-rise | sort_audio.py | Python | mit | 3,221 | 0.003726 |
"""SocialNewspaper URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... | Amyantis/SocialNewspaper | ArticleManagement/urls.py | Python | gpl-3.0 | 1,336 | 0.001497 |
"""Authenticating HTTP Server
This module builds on BaseHTTPServer and implements basic authentication
"""
import base64
import binascii
import BaseHTTPServer
DEFAULT_AUTH_ERROR_MESSAGE = """
<head>
<title>%(code)s - %(message)s</title>
</head>
<body>
<h1>Authorization Required</h1>
this server could not verify th... | mhellmic/davix | test/pywebdav/lib/AuthServer.py | Python | lgpl-2.1 | 3,349 | 0 |
"""
Tests related specifically to the FacilityDataset model.
"""
from django.db.utils import IntegrityError
from django.test import TestCase
from ..models import Classroom
from ..models import Facility
from ..models import FacilityDataset
from ..models import FacilityUser
from ..models import LearnerGroup
class Faci... | lyw07/kolibri | kolibri/core/auth/test/test_datasets.py | Python | mit | 2,905 | 0.000688 |
#!/usr/bin/env python
"""Color ESOM data points by Phylogeny
Usage:
esom_tracer2.py [--bam] [--names] [--taxonomy] [--taxa_level] [--output]
Synopsis:
Takes alignment data from short reads mapped to an assembly in BAM format
and the phylogeny of those short reads from the Phylosift
sequence_taxa_su... | Brazelton-Lab/lab_scripts | esom_tracer2.py | Python | gpl-2.0 | 12,317 | 0.000568 |
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.6.8 on Thu Apr 2 20:01:32 2015
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class SocketFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: SocketFrame.__init__
kwds["style"] ... | xenobyter/xbWeatherSocket | SocketFrame.py | Python | isc | 3,029 | 0.002311 |
from django.contrib.auth.models import User
from djblets.testing.decorators import add_fixtures
from djblets.testing.testcases import TestCase
from reviewboard.accounts.models import LocalSiteProfile
from reviewboard.reviews.models import ReviewRequest
class ProfileTests(TestCase):
"""Testing the Profile model."... | atagar/ReviewBoard | reviewboard/accounts/tests.py | Python | mit | 2,192 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-05-30 22:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pattern', '0014_pattern_editnumber'),
]
operations = [
migrations.AddField(... | yaxu/patternlib | pattern/migrations/0015_pattern_json.py | Python | gpl-3.0 | 444 | 0 |
#
import io
import json
import sys
from django.core.management import call_command
from leaves.models import (
Harvester,
Panda,
)
from aloe import after, step
from aloe.tools import guess_types
from aloe_django.steps.models import (
test_existence,
tests_existence,
write_models,
writes_mode... | michelts/aloe_django | tests/integration/django/dill/leaves/features/steps.py | Python | gpl-3.0 | 1,684 | 0 |
"""Unit tests of authorization searches."""
import pytest
from ..utilities.general import is_never_authz, is_no_authz, uses_cataloging, uses_filesystem_only
from dlkit.abstract_osid.osid import errors
from dlkit.primordium.id.primitives import Id
from dlkit.primordium.type.primitives import Type
from dlkit.runtime ... | mitsei/dlkit | tests/authorization/test_searches.py | Python | mit | 5,434 | 0.001472 |
import plotly.plotly as py
import plotly.graph_objs as go
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
type_z = ['Flood', 'Epidemic', 'Drought', 'Earthquake', 'Storm']
size_fill = [15,20,25,30,35]
fill_colors = ['#00d0f5'... | pdeesawat/PSIT58_test_01 | Test_Python_code/last/02_Indonesia/total_death_indonesia.py | Python | apache-2.0 | 1,399 | 0.010722 |
import balanced
balanced.configure('ak-test-2eKlj1ZDfAcZSARMf3NMhBHywDej0avSY')
debit = balanced.Debit.fetch('/debits/WD5EW7vbyXlTsudIGF5AkrEA')
debit.description = 'New description for debit'
debit.meta = {
'facebook.id': '1234567890',
'anykey': 'valuegoeshere',
}
debit.save() | balanced/balanced-python | scenarios/debit_update/executable.py | Python | mit | 284 | 0.003521 |
# -*- coding: utf-8 -*-
from aero.__version__ import __version_info__
__author__ = 'nickl-'
from .base import CommandProcessor as CommandProcessor
class InstallCommand(CommandProcessor):
from .base import coroutine
package = ''
adapter = ''
def wiring(self):
self.out = self.write()
... | Aeronautics/aero | aero/commands/install.py | Python | bsd-3-clause | 1,362 | 0.002937 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-01 17:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0003_bettoride_success'),
]
operations = [
migrations.AlterField(
... | Fly-Style/metaprog_univ | Lab1/polls/migrations/0004_auto_20161201_1743.py | Python | mit | 487 | 0.002053 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `web-platform-compat` fields module."""
from datetime import datetime
from pytz import UTC
from django.contrib.auth.models import User
from django.test.utils import override_settings
from webplatformcompat.cache import Cache
from webplatformcompat.history imp... | jwhitlock/web-platform-compat | webplatformcompat/tests/test_cache.py | Python | mpl-2.0 | 27,278 | 0 |
"""
Student Views
"""
import datetime
import logging
import re
import uuid
import time
import json
from collections import defaultdict
from pytz import UTC
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models import User, AnonymousUser
from django... | DNFcode/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 91,790 | 0.002528 |
#!/usr/bin/env python
"""Tests for grr.client.client_actions.tempfiles."""
import os
import tempfile
import time
from grr.client.client_actions import tempfiles
from grr.lib import config_lib
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib import utils
class GRRTempF... | ksmaheshkumar/grr | client/client_actions/tempfiles_test.py | Python | apache-2.0 | 6,106 | 0.003439 |
import demowlcutils
from demowlcutils import ppxml, WLC_login
from pprint import pprint as pp
from jnpr.wlc import WirelessLanController as WLC
wlc = WLC(host='a', user='b', password='c')
r = wlc.RpcMaker( target='vlan', name='Jeremy')
# you can access the following attributes, refer to the jnpr.wlc.builder
# file... | trmccart/py-jnprwlc | examples/maker.py | Python | apache-2.0 | 369 | 0.00813 |
import django
if django.VERSION >= (1, 5):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url
def simpleAction(request):
pass
urlpatterns = patterns(
'',
url(r'^simple/action/$', simpleAction, name='simpleAction'),
)
| uranusjr/django-crispy-forms-ng | crispy_forms/tests/urls.py | Python | mit | 292 | 0 |
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | fabio-otsuka/invesalius3 | invesalius/gui/task_tools.py | Python | gpl-2.0 | 5,584 | 0.008596 |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
from .Property import Property
class Header(object):
def __init__(self, properties=None, multimap=None):
if properties is None:
self.properties = []
else:
self.properties = properties
if m... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/message/Header.py | Python | bsd-3-clause | 611 | 0.003273 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest as ut
import numpy as np
import scipy.spatial.distance as spd
from .mock_data import Data
from ....algorithms.similarities import cosine_binary, cosine, dice, jaccard
from ....algorithms.similarities import kulsinski, russellrao, sokalsneath
MATRIX = np.a... | yedivanseven/bestPy | tests/algorithms/similarities/test_similarities.py | Python | gpl-3.0 | 2,753 | 0 |
import subprocess
import os
# setup the path to extopenscad (aka implicitCAD)
cad_bin=os.path.expanduser('~/.cabal/bin/extopenscad')
# set the current input dir to this script file's dir
inp_dir = '.'
# set the output to a directory next to this script file
out_dir = './output'
# set the output file extension to .stl
... | nmz787/microfluidic-cad | implicitCAD/process_all_escad.py | Python | gpl-2.0 | 1,723 | 0.007545 |
from pycraft_minetest import *
pos = where()
chat(pos)
maze("maze1.csv")
t = turtle(obsidian)
t.forward(10)
move(3, 10, 5)
chat(where())
sphere(ice, y=-20)
circle([wool, 5], direction="horizontal")
line(gold, 0, 0, 0, 0, 50, 0)
block(iron, y=3)
blocks(wood, x=5, y=6, z=10)
size = readnumber("tell the size...... | gmenegoz/pycraft | projects/test.py | Python | gpl-3.0 | 1,511 | 0.001324 |
# pilas engine: un motor para hacer videojuegos
#
# Copyright 2010-2014 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine.fondos import fondo
class Color(fondo.Fondo):
def __init__(self, pilas, color):
fondo.Fondo.... | apehua/pilas | pilasengine/fondos/color.py | Python | lgpl-3.0 | 498 | 0 |
# 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
# "License"); you may not u... | szha/mxnet | benchmark/python/sparse/updater.py | Python | apache-2.0 | 2,695 | 0.001484 |
# coding=utf-8
import numpy as np
class CovalentAutocorrelation:
def __init__(self, lattice):
self.reset(lattice)
def reset(self, lattice):
self.lattice = lattice.copy()
def calculate(self, lattice):
return np.sum((lattice == self.lattice) & (lattice != 0))
class MeanSquareDis... | gkabbe/cMDLMC | mdlmc/LMC/output.py | Python | gpl-3.0 | 1,858 | 0.004306 |
#!/usr/bin/env python
# Little script to make HISTORY.rst more easy to format properly, lots TODO
# pull message down and embed, use arg parse, handle multiple, etc...
import os
import sys
try:
import requests
except ImportError:
requests = None
import urllib.parse
import textwrap
PROJECT_DIRECTORY = os.path.j... | natefoo/pulsar | tools/bootstrap_history.py | Python | apache-2.0 | 3,345 | 0.001794 |
#!/usr/bin/env python
# coding=utf-8
import re
import os
from cgi import escape
EMOJIS = [
':Aquarius:', ':two_women_in_love:', ':bus_stop:', ':speak_no_evil_monkey:',
':chicken:', ':heart_eyes:', ':Scorpius:', ':smiley_confused:',
':cat_face_with_wry_smile:', ':GAKUEngine:', ':pistol:', ':relieved:',
... | xtao/code | vilya/libs/emoji.py | Python | bsd-3-clause | 8,756 | 0.000457 |
#
# FBrowserBase.py -- Base class for file browser plugin for fits viewer
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os, glob
import stat, time
from ging... | bsipocz/ginga | ginga/misc/plugins/FBrowserBase.py | Python | bsd-3-clause | 5,421 | 0.003689 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | citrix-openstack-build/cinder | cinder/tests/test_solidfire.py | Python | apache-2.0 | 9,057 | 0.00011 |
# Generated by Django 2.2.13 on 2020-10-29 21:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("server", "0017_merge_20181217_1829")]
operations = [
migrations.AlterField(
model_name="computer",
name="serial",
fi... | grahamgilbert/Crypt-Server | server/migrations/0018_auto_20201029_2134.py | Python | apache-2.0 | 873 | 0 |
"""
Support for TP-Link routers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.tplink/
"""
import base64
from datetime import datetime
import hashlib
import logging
import re
from aiohttp.hdrs import (
ACCEPT, COOKIE, PRAGMA, REFERER... | PetePriority/home-assistant | homeassistant/components/device_tracker/tplink.py | Python | apache-2.0 | 16,061 | 0 |
"""
Tests are performed against csr1000v-universalk9.03.15.00.S.155-2.S-std.
"""
import unittest
from iosxe.iosxe import IOSXE
from iosxe.exceptions import AuthError
node = '172.16.92.134'
username = 'cisco'
password = 'cisco'
port = 55443
class TestIOSXE(unittest.TestCase):
def setUp(self):
self.xe = ... | bobthebutcher/iosxe | tests/test_iosxe.py | Python | gpl-3.0 | 1,026 | 0.003899 |
import glob
import logging
import os
import shutil
from threading import Thread, Lock
class ClientFiles:
"""Processes the clients files to be moved etc"""
def __init__(self, settings, clients):
self.settings = settings
self.clients = clients
# Logging
self._logger = logging.... | Codex-/Octo-SFTP | OctoSFTP/file.py | Python | mit | 4,433 | 0.000451 |
#------------------------------------------------------------------------------
# pycparser: c_parser.py
#
# CParser class: Parser and AST builder for the C language
#
# Copyright (C) 2008-2015, Eli Bendersky
# License: BSD
#------------------------------------------------------------------------------
import re
from ... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/pycparser/c_parser.py | Python | mit | 63,805 | 0.001489 |
'''
Created on Jan 30, 2011
@author: mkiyer
chimerascan: chimeric transcript discovery using RNA-seq
Copyright (C) 2011 Matthew Iyer
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 ... | tectronics/chimerascan | chimerascan/deprecated/nominate_spanning_reads_v01.py | Python | gpl-3.0 | 5,222 | 0.003447 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from itertools import groupby
from time import time
from functools import partial
import re
import django
django.setup()
from django.db import transaction
from clldutils.dsv import reader
from clldutils.text import split_text
from clldutils.path import Path
fro... | NESCent/dplace | dplace_app/load.py | Python | mit | 5,554 | 0.004681 |
#
# Copyright 2015 by Justin MacCallum, Alberto Perez, Ken Dill
# All rights reserved
#
import numpy as np
import math
class ProteinBase(object):
'''
Base class for other Protein classes.
Provides functionality for translation/rotation and adding H-bonds.
'''
def __init__(self):
self._t... | laufercenter/meld | meld/system/protein.py | Python | mit | 7,985 | 0.004258 |
"""
Django settings for gnucash_explorer project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... | peap/gnucash_explorer | gnucash_explorer/settings.py | Python | mit | 2,089 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack 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
#
# ... | russellb/nova | nova/api/openstack/compute/contrib/virtual_storage_arrays.py | Python | apache-2.0 | 23,474 | 0.001406 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | non_semantic_speech_benchmark/export_model/tf_pad.py | Python | apache-2.0 | 2,326 | 0.007739 |
# Copyright 2013 Google 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 required by applicable law or a... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/mock_api_parser.py | Python | gpl-3.0 | 7,467 | 0.006964 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import res_company
# WARNING: Order of imports matters on this module, so don't put res_company
# below the other modules since it will lead to a missing column error when
# the module is initialized for the first time since there are fields with
#... | OCA/event | event_mail/models/__init__.py | Python | agpl-3.0 | 482 | 0 |
from contextional import GCM
with GCM("A") as A:
@GCM.add_setup
def setUp():
pass
@GCM.add_teardown
def tearDown():
pass
with GCM.add_group("B"):
@GCM.add_setup
def setUp():
pass
@GCM.add_test("some test")
def test(case):
... | SalmonMode/contextional | contextional/test_resources/verbose_fixtures.py | Python | mit | 7,418 | 0 |
from django.conf.urls import include, url
from django.contrib import admin
from Poller import views
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='resu... | zzeleznick/zDjango | Poller/urls.py | Python | mit | 396 | 0.002525 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 fileencoding=utf-8
import json
from django.conf import settings
from django.core.management import BaseCommand
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from django.utils.translation import ugettext_lazy
from onadata.apps.log... | mainakibui/kobocat | onadata/apps/logger/management/commands/sync_deleted_instances_fix.py | Python | bsd-2-clause | 1,551 | 0 |
# Copyright 2015 Matthieu Courbariaux, Zhouhan Lin
"""
This file is adapted from BinaryConnect:
https://github.com/MatthieuCourbariaux/BinaryConnect
Running this script should reproduce the results trained on CIFAR10 shown in
the paper.
To train a vanilla ConvNet with ordinary backprop:
1. type "g... | hantek/BinaryConnect | cifar10.py | Python | gpl-2.0 | 9,943 | 0.023836 |
#
# BTZen - library to asynchronously access Bluetooth devices.
#
# Copyright (C) 2015-2021 by Artur Wroblewski <wrobell@riseup.net>
#
# 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 vers... | wrobell/btzen | btzen/bluez.py | Python | gpl-3.0 | 1,239 | 0 |
#!/usr/bin/env python2.7
# Copyright 2015, Google 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 code must retain the above copyright
# notice, this lis... | soltanmm-google/grpc | tools/run_tests/run_interop_tests.py | Python | bsd-3-clause | 33,477 | 0.009111 |
# coding: utf-8
from __future__ import absolute_import
import flask
import auth
import model
import util
from main import app
yahoo_config = dict(
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
base_url='https://query.yaho... | gmist/ctm-5studio | main/auth/yahoo.py | Python | mit | 2,148 | 0.008845 |
#!/usr/bin/env python -tt
# encoding: utf-8
#
"""Use a descriptive macro instead of assert(false);"""
error_msg = 'Use NEVER_HERE() from base/macros.h here.'
regexp = r"""assert *\( *(0|false) *\)"""
forbidden = [
'assert(0)',
'assert(false)',
]
allowed = [
'NEVER_HERE()',
]
| widelands/widelands | cmake/codecheck/rules/assert0.py | Python | gpl-2.0 | 293 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2016 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | hperala/kontuwikibot | mwparserfromhell/string_mixin.py | Python | mit | 4,073 | 0.000491 |
from ...java import opcodes as JavaOpcodes, Classref as JavaClassref
from . import java as Java
##########################################################################
# Python types and their operations
##########################################################################
class Callable:
class invoke:
... | gEt-rIgHt-jR/voc | voc/python/types/python.py | Python | bsd-3-clause | 8,387 | 0.000119 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from numpy import abs, cos, exp, log, arange, pi, roll, sin, sqrt, sum
from .go_benchmark import Benchmark
class BartelsConn(Benchmark):
r"""
Bartels-Conn objective function.
The BartelsConn [1]_ global optimizatio... | chatcannon/scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_B.py | Python | bsd-3-clause | 21,639 | 0.000185 |
#!/usr/bin/python
import os
import signal
import struct
import sys
import time
ALLOWED_INTERFACES = [ "cpu_dma_latency", "network_latency", "network_throughput" ]
def read_pmqos(name):
filename = "/dev/%s" % name
old = open(filename)
old_value = struct.unpack("i", old.read())[0]
print "PMQOS value for %s is %d"%(n... | apanda/NetBricks | scripts/tuning/read_cpu_dma_latency.py | Python | isc | 588 | 0.022109 |
#-------------------------------------------------------------------------------
#
# This file is part of pylibgimpplugin.
#
# Copyright (C) 2014 khalim19 <khalim19@gmail.com>
#
# pylibgimpplugin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | yfede/gimp-plugin-export-layers | export_layers/pylibgimpplugin/tests/test_settings.py | Python | gpl-3.0 | 23,801 | 0.013361 |
"""
Collection of tools for the IQTools library
Xaratustrah
2017
"""
import os
import logging as log
from scipy.signal import hilbert
from scipy.io import wavfile
import xml.etree.ElementTree as et
import numpy as np
import types
import uproot3
import uproot3_methods.classes.TH1
from iqtools.iqbase import IQBase
fr... | xaratustrah/iq_suite | iqtools/tools.py | Python | gpl-2.0 | 10,337 | 0.000871 |
"""
Define the SeriesGroupBy, DataFrameGroupBy, and PanelGroupBy
classes that hold the groupby interfaces (and some implementations).
These are user facing as the result of the ``df.groupby(...)`` operations,
which here returns a DataFrameGroupBy object.
"""
import collections
import copy
import warnings
from functoo... | amolkahat/pandas | pandas/core/groupby/generic.py | Python | bsd-3-clause | 58,252 | 0.000223 |
import json, logging
class Farm:
"""
Main class holding the whole farm.
"""
def __init__(self,json_file):
"""
"""
# load in json file
data = json.loads(open(json_file,'r').read())
# Make sure required data is in the json file
required_attr_list = ["lat... | harmsm/thefarm | thefarm/farm.py | Python | mit | 853 | 0.009379 |
import os
import unittest
import mutagen
import shutil
import audio_pipeline.test.References as ref
from . import TestUtil
from ..util import format
vorbis_files = dict(t1=os.path.join(ref.format_testing_audio, "t1.flac"),
picard=os.path.join(ref.format_testing_audio, "picard.flac"),
... | hidat/audio_pipeline | audio_pipeline/test/TagFormatTest.py | Python | mit | 12,551 | 0.006454 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoKufiArabic-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0261) #uni0759.fina
glyphs.append(0x007F) #uni0625
glyphs.append(0x00D4) #uni0624
glyphs.append(0x0005) #uni0627... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notokufiarabic_regular.py | Python | gpl-3.0 | 33,355 | 0.022875 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | GabrielFortin/ansible-module-f5bigip | library/f5bigip_ltm_traffic_class.py | Python | apache-2.0 | 5,265 | 0.002849 |
# -*- coding: utf-8 -*-
from flask_testing import TestCase
import mock
import journalist
from utils import db_helper, env
from db import (Journalist, Submission, Reply, get_one_or_else,
LoginThrottledException)
class TestDatabase(TestCase):
def create_app(self):
return journalist.app
... | garrettr/securedrop | securedrop/tests/test_db.py | Python | agpl-3.0 | 2,826 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fungiform
~~~~~~~~~
A form handling system that previously was used for Pocoo's Zine
and Plurk's Solace software. Unbundled into a separate library that
is framework independent.
This is still a preview release. Check the source for more info... | mitsuhiko/fungiform | setup.py | Python | bsd-3-clause | 1,459 | 0.020562 |
# -*- coding: utf-8 -*-
# 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 "Li... | bernard357/shellbot | shellbot/stores/sqlite.py | Python | apache-2.0 | 5,489 | 0 |
from xmediusmailrelayserver import *
| xmedius/xmedius-mailrelayserver | xmediusmailrelayserver/__init__.py | Python | mit | 38 | 0.026316 |
import pytest
import responses
from urlobject import URLObject
from flask import Flask
from flask_dance.contrib.reddit import make_reddit_blueprint, reddit
from flask_dance.consumer import OAuth2ConsumerBlueprint
from flask_dance.consumer.storage import MemoryStorage
@pytest.fixture
def make_app():
"A callable to... | singingwolfboy/flask-dance | tests/contrib/test_reddit.py | Python | mit | 3,475 | 0.001151 |
#-*- encoding: utf-8 -*-
import csv, math, time, re, threading, sys
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
class ErAPI():
# Metodo constructor, seteos basicos necesarios de configuracion, instancia objetos utiles
def __init__(self):
self.data = ... | CPedrini/TateTRES | erapi.py | Python | apache-2.0 | 11,009 | 0.004906 |
"""
===========================
Orthogonal Matching Pursuit
===========================
Using orthogonal matching pursuit for recovering a sparse signal from a noisy
measurement encoded with a dictionary
"""
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import OrthogonalMatchingPursuit... | manhhomienbienthuy/scikit-learn | examples/linear_model/plot_omp.py | Python | bsd-3-clause | 2,054 | 0.000974 |
import logging
from django.contrib import messages
from django.contrib.auth import authenticate
from django.core.urlresolvers import reverse
from django.http.response import Http404, HttpResponseRedirect
from django.shortcuts import render, redirect, render_to_response
# Create your views here.
from django.template.co... | Crowdcomputer/CroCoAPI | ui/views.py | Python | gpl-2.0 | 3,534 | 0.005376 |
"""Attachment utils."""
from pathlib import Path
from uuid import uuid4
from blobstash.docstore.error import DocStoreError
from blobstash.filetree import FileTreeClient
_FILETREE_POINTER_FMT = "@filetree/ref:{}"
_FILETREE_ATTACHMENT_FS_PREFIX = "_filetree:docstore"
class Attachment:
"""An attachment represents ... | tsileo/blobstash-python-docstore | blobstash/docstore/attachment.py | Python | mit | 2,286 | 0.002625 |
#! /usr/bin/python
import MDAnalysis
import sys
from pylab import *
my_traj = sys.argv[1]
myTitle = sys.argv[2]
u = MDAnalysis.Universe(my_traj,my_traj)
OH = u.selectAtoms("segid B and resid 18 and name HO")
xArr = []
yArr = []
zArr = []
data = []
for ts in u.trajectory:
xArr.append(OH.coordinates()[0,0])
... | demharters/git_scripts | calc_movement_HO.py | Python | apache-2.0 | 795 | 0.021384 |
from flask import Flask, render_template, request, jsonify, session, redirect, escape, url_for
import bcrypt
class ServerError(Exception):pass
def loginForm(db, form):
error = None
try:
username = form['username']
cur = db.query("SELECT COUNT(1) FROM users WHERE user = %s", [username])
if not cur.fetchone()... | Madpilot0/Flask-Simpleauth | lib/Users.py | Python | gpl-3.0 | 1,789 | 0.035774 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import versatileimagefield.fields
import jsonfield.fields
from decimal import Decimal
import saleor.product.models.fields
import django.core.validators
import django_prices.models
import satchless.item
class Migr... | taedori81/e-commerce-template | saleor/product/migrations/0001_initial.py | Python | bsd-3-clause | 7,464 | 0.005761 |
"""Error codes for PostgresSQL
This module contains symbolic names for all PostgreSQL error codes.
"""
# psycopg2/errorcodes.py - PostgreSQL error codes
#
# Copyright (C) 2006-2010 Johan Dahlin <jdahlin@async.com.br>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU ... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/psycopg2/errorcodes.py | Python | mit | 13,241 | 0.000076 |
"""Autocomplete fields for QuerySetSequence choices."""
from dal_contenttypes.fields import (
ContentTypeModelMultipleFieldMixin,
GenericModelMixin,
)
from django import forms
from django.contrib.contenttypes.models import ContentType
from queryset_sequence import QuerySetSequence
class QuerySetSequenceFie... | Eraldo/django-autocomplete-light | src/dal_queryset_sequence/fields.py | Python | mit | 4,390 | 0 |
# -*- coding: utf-8 -*-
"""This module contains custom roles to use in Sphinx.
"""
from docutils import nodes
def setup(app):
"""Install the extension.
Parameters:
app: Sphinx application context.
"""
app.add_role('arts', arts_docserver_role)
def arts_docserver_role(name, rawtext, text, li... | atmtools/typhon | typhon/utils/sphinxext.py | Python | mit | 1,221 | 0 |
#----------------------------------------------------------------------
# Copyright (c) 2010 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including witho... | dana-i2cat/felix | expedient/src/python/expedient/common/federation/geni/ch.py | Python | apache-2.0 | 15,839 | 0.00423 |
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, obj):
# We take ('noun','thing') tuples and convert them.
self.subject = subject[1]
self.verb = verb[1]
self.object = obj[1]
def peek(word_list):
if word_list:
word = word_... | afronski/playground-other | python/books/learn-python-the-hard-way/projects/ex48/ex48/parser.py | Python | mit | 1,663 | 0.004811 |
"""
Unit tests for instructor_dashboard.py.
"""
import datetime
import re
import ddt
import six
from django.conf import settings
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from django.urls import reverse
from mock import patch
from pyquery import PyQuery as pq
from p... | edx-solutions/edx-platform | lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py | Python | agpl-3.0 | 27,999 | 0.002357 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | gtest-org/test10 | jenkins_jobs/modules/zuul.py | Python | apache-2.0 | 6,120 | 0.00049 |
from django.conf.urls.defaults import *
urlpatterns = patterns('mmda.tags.views',
url(r'^(?P<tag_id>.+?)/$', 'show_tag', name='show-tag')
)
| lidel/mmda | tags/urls.py | Python | cc0-1.0 | 145 | 0.006897 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid - **Generic Impact Function
on Population for Continuous Hazard.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publi... | MariaSolovyeva/inasafe | safe/impact_functions/generic/continuous_hazard_population/impact_function.py | Python | gpl-3.0 | 10,346 | 0 |
# 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
# "License"); you may not u... | Laurawly/tvm-1 | tests/python/contrib/test_cutlass.py | Python | apache-2.0 | 18,515 | 0.002268 |
""" Fantasm: A taskqueue-based Finite State Machine for App Engine Python
Docs and examples: http://code.google.com/p/fantasm/
Copyright 2010 VendAsta Technologies 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 ob... | rafasashi/userinfuser | serverside/fantasm/utils.py | Python | gpl-3.0 | 4,909 | 0.006926 |
# proxy module
from __future__ import absolute_import
from envisage.plugins.remote_editor.i_remote_shell import *
| enthought/etsproxy | enthought/plugins/remote_editor/i_remote_shell.py | Python | bsd-3-clause | 114 | 0 |
import os
def get_files(extension):
for root, dirnames, filenames in os.walk("."):
for filename in filenames:
if filename.endswith(extension):
yield os.path.join(root, filename)
def get_roles():
return sorted(os.listdir("./roles"))
def pytest_generate_tests(metafunc):
... | ideascube/pibox-installer | ansiblecube/tests/conftest.py | Python | gpl-3.0 | 733 | 0 |
from flask_user import DBAdapter
class DataStoreAdapter(DBAdapter):
""" An Wrapper to be use by Flask User to interact with
the database in this case, the DataStore """
def __init__(self, db, objMOdel):
super().__init__(db, objMOdel)
def get_object(self, ObjectClass, pk):
""" Ret... | oldani/nanodegree-blog | app/models/datastore_adapter.py | Python | mit | 2,094 | 0 |
from __future__ import absolute_import
import os
import sys
from collections import defaultdict
from .gemini_constants import *
from . import GeminiQuery
class Site(object):
def __init__(self, row):
self.chrom = row['chrom']
self.end = int(row['end'])
self.gt_type = None
def _prune_run(ru... | bgruening/gemini | gemini/tool_homozygosity_runs.py | Python | mit | 7,165 | 0.00321 |
from google.appengine.ext import ndb
class Users(ndb.Model):
password = ndb.StringProperty(required=True)
full_name = ndb.StringProperty(required=True)
phone_no = ndb.StringProperty(required=False)
timestamp = ndb.DateTimeProperty(auto_now_add=True)
@classmethod
def query_user(cls, ancestor_ke... | gamesbrewer/kegger | kegger/myapp/flaskmyappname/models.py | Python | cc0-1.0 | 496 | 0.008065 |
# 053. Maximum Subarray
# The simple O(n) solution.
import unittest
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ret = nums[0]
pre = nums[0]
for i in nums[1:]:
if ret < i and ret < 0:
... | hanlin-he/UTD | leetcode/py/053.py | Python | mit | 1,020 | 0.013725 |
# Copyright (c) 2012 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 json
from telemetry import timeline_model
def Import(data):
trace = json.loads(data) # pylint: disable=W0612
model = timeline_model.Timeline... | nacl-webkit/chrome_deps | tools/telemetry/telemetry/trace_event_importer.py | Python | bsd-3-clause | 386 | 0.015544 |
import logging
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from corehq.apps.adm.dispatcher import ADMSectionDispatcher
from corehq.apps.adm.models import REPORT_SECTION_OPTIONS, ADMReport
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn, DTSort... | SEL-Columbia/commcare-hq | corehq/apps/adm/reports/__init__.py | Python | bsd-3-clause | 6,857 | 0.003354 |
#!/usr/bin/env python
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Test the Model constructors.
"""
import itertools
import pytest
import numpy as np
import tbmodels
def test_on_site_too_long(get_model):
"""
Check that error is raised when th... | Z2PackDev/TBmodels | tests/test_constructors.py | Python | apache-2.0 | 8,064 | 0.00124 |
from django.contrib.admindocs.middleware import XViewMiddleware
from django.http import HttpResponse
from django.utils.decorators import decorator_from_middleware
from django.views.generic import View
xview_dec = decorator_from_middleware(XViewMiddleware)
def xview(request):
return HttpResponse()
c... | yephper/django | tests/admin_docs/views.py | Python | bsd-3-clause | 404 | 0 |
# -*- coding: utf-8 -*-
#pylint: skip-file
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.inser... | klashxx/PyConES | rspace/rspace/docs/conf.py | Python | mit | 1,487 | 0.001346 |
class StretchException(Exception):
"""Common base class for all exceptions raised explicitly by stretch.
Exceptions which are subclasses of this type will be handled nicely by
stretch and will not cause the program to exit. Any exceptions raised
which are not a subclass of this type will exit(1) and ... | paddycarey/stretch | stretch/exceptions.py | Python | mit | 710 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.