code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Library of functions for encoding a number in LEDs."""
import RPi.GPIO as GPIO
def light(pin):
GPIO.output(pin, GPIO.HIGH)
def clear(pinlist):
for p in pinlist:
GPIO.output(p, GPIO.LOW)
def encode(n, pinlist):
clear(pinlist)
for i, p in enumerate(pinlist):
if (n >> i) % 2:
... | zimolzak/Raspberry-Pi-newbie | fourleds.py | Python | mit | 338 |
# -*- coding: utf-8 -*-
def get_alignments(iseq, jseq, backtracking, end_cell):
iseq_r = []
jseq_r = []
current_cell_v = backtracking[end_cell[0]][end_cell[1]]
current_cell_index = end_cell
while current_cell_v != "s":
if current_cell_v == "u":
jseq_r.append("-")
ise... | compbiol/CAMSA | camsa/utils/fasta/algo.py | Python | mit | 3,576 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/resourcemover/azure-mgmt-resourcemover/azure/mgmt/resourcemover/models/_models_py3.py | Python | mit | 93,853 |
"""
.. module:: BOSS
BOSS
*************
:Description: BOSS
:Authors: bejar
:Version:
:Created on: 15/02/2017 13:48
"""
import numpy as np
from kemlglearn.preprocessing import Discretizer
import seaborn as sn
from collections import Counter
from kemlglearn.time_series.decomposition.MFT import mft
__... | bejar/kemlglearn | kemlglearn/time_series/discretization/BOSS.py | Python | mit | 4,543 |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... | Lana-B/Pheno4T | madanalysis/layout/merging_plots_for_dataset.py | Python | gpl-3.0 | 2,345 |
# 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
import optparse
import os
import sys
import webgl_conformance_expectations
from telemetry import benchmark as benchmark_module
from telemetr... | TheTypoMaster/chromium-crosswalk | content/test/gpu/gpu_tests/webgl_conformance.py | Python | bsd-3-clause | 8,433 |
# Datetime configuration spoke class
#
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program i... | cgwalters/anaconda | pyanaconda/ui/gui/spokes/datetime_spoke.py | Python | gpl-2.0 | 39,276 |
#! /usr/bin/env python
"""Consolidate a bunch of CVS or RCS logs read from stdin.
Input should be the output of a CVS or RCS logging command, e.g.
cvs log -rrelease14:
which dumps all log messages from release1.4 upwards (assuming that
release 1.4 was tagged with tag 'release14'). Note the trailing
colon!
Thi... | teeple/pns_server | work/install/Python-2.7.4/Tools/scripts/logmerge.py | Python | gpl-2.0 | 5,576 |
# (C) British Crown Copyright 2011 - 2012, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... | marqh/cartopy | lib/cartopy/tests/mpl/test_shapely_to_mpl.py | Python | gpl-3.0 | 4,821 |
#################
# AA Solvers #
#################
import numpy as np
from itertools import product
from scipy.linalg import solve
from scipy.sparse.linalg import spsolve
def check_each_direction(n,angs,ifprint=True):
""" returns a list of the index of elements of n which do not have adequate
toy angle cov... | adrn/gary | gala/dynamics/_genfunc/solver.py | Python | mit | 5,861 |
import sys
import platform
import twisted
import scrapy
from scrapy.command import ScrapyCommand
class Command(ScrapyCommand):
def syntax(self):
return "[-v]"
def short_desc(self):
return "Print Scrapy version"
def add_options(self, parser):
ScrapyCommand.add_options(self, pars... | pablohoffman/scrapy | scrapy/commands/version.py | Python | bsd-3-clause | 1,277 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2015 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2015-07-27
#
"""
Generate password from (mostly) gibberish words.
http://stackoverflow.com/a/5502875/356942
"""
from __future__ import print_funct... | deanishe/alfred-pwgen | src/generators/gen_pronounceable.py | Python | mit | 2,220 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='graphitesend',
version='0.7.0',
description='A simple interface for sending metrics to Graphite',
author='Danny Lawrence',
author_email='dannyla@linux.com',
url='https://github.com/daniellawrence/graphitesend',
packages=['g... | PabloLefort/graphitesend | setup.py | Python | apache-2.0 | 604 |
#----------------------------------------------------------------------
# Copyright (c) 2013 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... | GENI-NSF/gram | grizzly/install/OpenStack.py | Python | mit | 5,584 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import re
from core import httptools
from core import logger
from core import scr... | r0balo/pelisalacarta | python/main-classic/channels/documentalesonline.py | Python | gpl-3.0 | 5,391 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | dbbhattacharya/kitsune | vendor/packages/logilab-astng/test/data/__init__.py | Python | bsd-3-clause | 1,001 |
"""
Weather component that handles meteorological data for your location.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/weather/
"""
import asyncio
import logging
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.he... | ewandor/home-assistant | homeassistant/components/weather/__init__.py | Python | apache-2.0 | 4,427 |
#!/usr/bin/env python
#
# Copyright (C) 2005 Christopher J. Stawarz <chris@pseudogreen.org>
#
# This file is part of i2py.
#
# i2py 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 ... | zimmerst/i2py | setup.py | Python | gpl-2.0 | 2,104 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-06-01 21:22
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.text import slugify
def migrate_data_forward(apps, schema_editor):
Impresso = apps.get_model('lotes', 'Impresso')
for instance in Impres... | anselmobd/fo2 | src/lotes/migrations/0050_impresso_slug_init.py | Python | mit | 714 |
print("This is simple2.py")
| sprescott3/cs3240-labdemo | simple2.py | Python | mit | 28 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/_network_management_client.py | Python | mit | 32,278 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
import memcache, conf
class MClient(memcache.Client):
"""memcache client that will automatically prefix conf.db_name"""
def n(self, key):
return (conf.db_name + ":" + key.replace(" ", "_"... | rohitw1991/latestadbwnf | webnotes/memc.py | Python | mit | 522 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Xeralux/tensorflow | tensorflow/python/keras/_impl/keras/model_subclassing_test.py | Python | apache-2.0 | 19,733 |
from __future__ import unicode_literals
import sys
class C(object):
x = 'C_x'
def __init__(self):
self.y = 'c_y'
class D(C):
pass
if len(sys.argv) > 2:
v1 = C
else:
v1 = D
v2 = v1()
def f():
if len(sys.argv) > 3:
v3 = C()
else:
v3 = D()
return v3
def g(arg):
... | github/codeql | python/ql/test/library-tests/PointsTo/lookup/test.py | Python | mit | 1,725 |
# pylint: skip-file
"""
Settings.py for testing on Circle CI.
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'foobar' # nosec
DEBUG = False
ADMINS = [('Chris Karr', 'chris@audacious... | audaciouscode/PassiveDataKit-Django | circle_settings.py | Python | apache-2.0 | 2,489 |
'''
Runs tests against exceptions defined in ``exception.py``
'''
import unittest
from sqlstr import exception
class Test_Exceptions(unittest.TestCase):
'''Test suite for sqlstr.exception'''
def test_sqlstrException(self):
'''Test the base exception sqlstr.exception.sqlstrException'''
test_e... | GochoMugo/sql-string-templating | test/test_exception.py | Python | mit | 505 |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="value",
parent_name="layout.scene.xaxis.tickformatstop",
**kwargs
):
super(ValueValidator, self).__init__(
plotly_name=pl... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/scene/xaxis/tickformatstop/_value.py | Python | mit | 454 |
from . import rd_parser as rd
def peg():
return rd.action('peg', rd.sequence([
rd.zero_or_more(_()),
parsing_header(),
rd.one_or_more(_()),
parsing_body(),
rd.end_of_file()
]))
def parsing_header():
return rd.action('noop', rd.sequence([
rd.string('GRAMMAR... | SimplePEG/Python | simplepeg/speg_parser.py | Python | mit | 5,310 |
# Copyright 2015 ARM Limited
#
# 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 writin... | rockyzhang/workload-automation | wlauto/core/agenda.py | Python | apache-2.0 | 10,036 |
#!/usr/bin/python3
from queue import Queue
from queue import Empty
import time
import threading
import sys
import requests
import click
from requests.exceptions import ReadTimeout
from socket import error as socket_error
import logging
logging.basicConfig(filename='log.log', level=logging.INFO)
# Tests are loaded as... | io-digital/hurt | tolerance3/tolerance3.py | Python | bsd-2-clause | 5,505 |
import os, sys
import config
def notify_user(msg):
sys.stderr.write(msg+'\n')
raw_input('Press enter to exit ')
sys.exit(1)
def run_cmd(cmd):
if os.system(cmd) != 0:
notify_user('Command "%s" failed!'%cmd)
def run_cmds(*cmds):
for cmd in cmds:
run_cmd(cmd)
if config.current != config.pro... | JustinTulloss/harmonize.fm | uploader/publish_win.py | Python | mit | 800 |
from datetime import date
from unittest import TestCase
from opensrs.models import Domain
class DomainTestCase(TestCase):
def setUp(self):
domain_data = {
'f_let_expire': 'N',
'expiredate': '2016-11-02 12:17:12',
'f_auto_renew': 'N',
'name': 'foo.co.za'
... | yola/opensrs | tests/test_models.py | Python | mit | 1,014 |
from urlparse import urljoin
from scrapy import log
from scrapy.http import HtmlResponse
from scrapy.utils.response import get_meta_refresh
from scrapy.exceptions import IgnoreRequest, NotConfigured
class BaseRedirectMiddleware(object):
enabled_setting = 'REDIRECT_ENABLED'
def __init__(self, settings):
... | pablohoffman/scrapy | scrapy/contrib/downloadermiddleware/redirect.py | Python | bsd-3-clause | 4,231 |
# -*- coding: utf-8 -*-
"""
h2/events
~~~~~~~~~
Defines Event types for HTTP/2.
Events are returned by the H2 state machine to allow implementations to keep
track of events triggered by receiving data. Each time data is provided to the
H2 state machine it processes the data and returns a list of Event objects.
"""
fr... | mhils/hyper-h2 | h2/events.py | Python | mit | 4,782 |
<selection>#comment line
a = 1</selection> | allotria/intellij-community | python/testData/surround/SurroundCommentAtStart.py | Python | apache-2.0 | 42 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
... | chrys87/fenrir | src/fenrirscreenreader/commands/help/curr_help.py | Python | lgpl-3.0 | 656 |
from __future__ import absolute_import
import torch
import numpy as np
import pandas as pd
import scipy
import copy
from pysurvival import HAS_GPU
from pysurvival import utils
from pysurvival.utils import neural_networks as nn
from pysurvival.utils import optimization as opt
from pysurvival.models import BaseModel
fro... | square/pysurvival | pysurvival/models/semi_parametric.py | Python | apache-2.0 | 28,318 |
import os
from app import create_app
from itsdangerous import URLSafeTimedSerializer
app = create_app(os.environ['APP_CONFIG'])
def generate_confirmation_token(email):
serializer = URLSafeTimedSerializer(app.config['SECRET_KEY'])
return serializer.dumps(email, salt = app.config['PASSWORD_SALT'])
def confirm... | andMYhacks/infosec_mentors_project | app/token.py | Python | gpl-3.0 | 848 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ee
import json
import sys
import time
class ExportGeeAssetsStatus(object):
options = {
'assets': {
'mosaico': 'projects/mapbiomas-workspace/MOSAICOS/workspace',
'classificacao': 'projects/mapbiomas-workspace/COLECAO2_1/classific... | TerrasAppSolutions/seeg-mapbiomas-workspace | app/Console/Scripts/export_gee_assets_status.py | Python | mit | 3,165 |
#!/usr/bin/env python
# This file is part of Responder, a network take-over set of tools
# created and maintained by Laurent Gaffie.
# email: laurent.gaffie@gmail.com
# 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... | snar5/Responder | poisoners/LLMNR.py | Python | gpl-3.0 | 3,475 |
# Big Data Smart Socket
# Copyright (C) 2016 Clemson University
#
# 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.
#
# Th... | feltus/BDSS | client/client/actions/mechanisms_action.py | Python | gpl-2.0 | 1,025 |
#!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... | brguez/TEIBA | src/python/sourceElements.stats.py | Python | gpl-3.0 | 18,064 |
import codecs
from datetime import datetime, timedelta
from optparse import make_option
from os import path, unlink
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import olympia.core.logger
from olympia.addons.models import Addon
from olympia.files.models import Fil... | harikishen/addons-server | src/olympia/stats/management/commands/download_counts_from_file.py | Python | bsd-3-clause | 6,839 |
#!/usr/bin/python3
# Copyright (c) 2015 Davide Gessa
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from libcontractvm import Wallet, WalletExplorer, ConsensusManager
from forum import ForumManager
import sys
import time
consMan ... | andreasscalas/dappforum | samples/vote.py | Python | mit | 734 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @Daddy_Blamo wrote this file. As long as you retain this notice you
# can do whatever you want wi... | RuiNascimento/krepo | script.module.lambdascrapers/lib/lambdascrapers/sources_ lambdascrapers/de/kinoking.py | Python | gpl-2.0 | 4,845 |
"""
Utils function.
"""
import sys
import os
import logging
from glob import glob
def add_pyspark_path_if_needed():
"""Add PySpark to the library path based on the value of SPARK_HOME if
pyspark is not already in our path"""
try:
from pyspark import context
except ImportError:
# We ne... | eyeem/spark-testing-base | python/sparktestingbase/utils.py | Python | apache-2.0 | 1,497 |
"""The Unify Circuit component."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_NAME, CONF_URL
from homeassistant.helpers import config_validation as cv, discovery
_LOGGER = logging.getLogger(__name__)
DOMAIN = "circuit"
CONF_WEBHOOK = "webhook"
WEBHOOK_SCHEMA = vol.Schema(
{vo... | tchellomello/home-assistant | homeassistant/components/circuit/__init__.py | Python | apache-2.0 | 895 |
#!/usr/bin/env python3
#
# Copyright (C) 2012 W. Trevor King <wking@tremily.us>
#
# This file is part of pygrader.
#
# pygrader 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, ... | wking/pygrader | bin/pg.py | Python | gpl-3.0 | 11,702 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditRScriptDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... | slarosa/QGIS | python/plugins/sextante/r/EditRScriptDialog.py | Python | gpl-2.0 | 5,932 |
#!/usr/bin/env python
# This library 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 option) any later version.
#
# This library is distributed in the ho... | mpitid/apiutils | instagram/instapi.py | Python | lgpl-2.1 | 8,762 |
#!/usr/bin/env python3
# Copyright 2019 Canonical Ltd.
# Licensed under the AGPLv3, see LICENCE file for details.
import argparse
import re
import sys
def main(args):
p = argparse.ArgumentParser(description="parse claim log files, reporting output")
p.add_argument("file", type=argparse.FileType('r'), default=... | freyes/juju | scripts/leadershipclaimer/count-leadership.py | Python | agpl-3.0 | 2,748 |
from astropy.cosmology import FLRW
from astropy import units as u
from astropy.utils.misc import isiterable
import numpy as np
class n7CPL(FLRW):
"""FLRW cosmology with a n=7 nCPL dark energy equation of state and curvature.
The equation for the dark energy equation of state uses the
nCPL form as describe... | per-andersen/Deltamu | n7CPL.py | Python | gpl-3.0 | 6,396 |
from share.provider import OAIProviderAppConfig
class AppConfig(OAIProviderAppConfig):
name = 'providers.pe.upc'
version = '0.0.1'
title = 'Universidad Peruana de Ciencias Aplicadas (UPC)'
long_title = 'Universidad Peruana de Ciencias Aplicadas (UPC)'
home_page = 'http://repositorioacademico.upc.e... | zamattiac/SHARE | providers/pe/upc/apps.py | Python | apache-2.0 | 394 |
#!/usr/bin/env python
# coding: utf-8
import os, re
from setuptools import setup, find_packages
PKG='txoauth'
VERSIONFILE = os.path.join('txoauth', '_version.py')
verstr = "unknown"
try:
verstrline = open(VERSIONFILE, "rt").read()
except EnvironmentError:
pass # Okay, there is no version file.
else:
MVSRE... | simplegeo/txoauth-OLD | setup.py | Python | mit | 1,889 |
# -*- coding: utf-8 -*-
import json
from django.test import TestCase
from django.test.client import RequestFactory
from djangular.views.crud import NgCRUDView
from djangular.views.mixins import JSONResponseMixin
from server.models import DummyModel, DummyModel2, SimpleModel, M2MModel
class CRUDTestViewWithM2M(JSONR... | vaniakov/django-angular | examples/server/tests/test_crud.py | Python | mit | 8,124 |
""" Testing ``isestimable`` in regression module
"""
from __future__ import absolute_import
import numpy as np
from ..regression import isestimable
from numpy.testing import (assert_almost_equal,
assert_array_equal)
from nose.tools import (assert_true, assert_false, assert_raises,
... | alexis-roche/nipy | nipy/algorithms/statistics/models/tests/test_estimable.py | Python | bsd-3-clause | 1,497 |
#!/usr/bin/env python3
from flask import *
from meteorismo import app
| iomataani/meteorismo | main.py | Python | gpl-2.0 | 70 |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import copy
import os
import pytest
import salt.modules.scsi as scsi
import salt.utils.path
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {scsi: {}}
def test_ls_():
"""
Test for list... | saltstack/salt | tests/pytests/unit/modules/test_scsi.py | Python | apache-2.0 | 2,457 |
"""
Utilities for plotting various figures and animations in EEG101.
"""
# Author: Hubert Banville <hubert@neurotechx.com>
#
# License: TBD
import numpy as np
import matplotlib.pylab as plt
import collections
from scipy import signal
def dot_plot(x, labels, step=1, figsize=(12,8)):
"""
Make a 1D dot plot.
... | NeuroTechX/eeg-101 | python_tools/utilities.py | Python | isc | 5,241 |
# -*- coding: utf-8 -*-
"""
tests.test_functionality
{{ "~" * "tests.test_functionality"|count }}
Test basic login and registration functionality
:author: {{ cookiecutter.author }}
:copyright: © {{ cookiecutter.copyright }}
:license: {{ cookiecutter.license }}, see LICENSE for more details.
... | ryanolson/cookiecutter-webapp | {{cookiecutter.app_name}}/tests/test_functionality.py | Python | mit | 5,755 |
#
# 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... | ganeshmurthy/qpid-dispatch | tests/management/entity.py | Python | apache-2.0 | 2,365 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2015, 2016, University of Tuebingen, CERN.
#
# B2Share 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
# ... | SarahBA/b2share | b2share/modules/communities/workflows.py | Python | gpl-2.0 | 3,365 |
'''
Created on Jan 8, 2015
@author: ubuntu
'''
putCablingPlan = []
putDeviceConfiguration = []
getDevices = []
getIpFabric = []
def main():
outFile = open("out.csv","w") # open file for appending
with open ("locust.csv", "r") as locust:
for line in locust:
if 'cabling-plan' in line:
... | plucena24/OpenClos | jnpr/openclos/tests/performance/postProcess.py | Python | apache-2.0 | 2,361 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os.path
import configparser
import pandas as pd
from tqdm import tqdm
from tsfresh.utilities.dataframe_functions import impute
from tsfresh.feature_extraction import feature_calculators
def main():
if len(sys.argv) < 2:
print('Usage: ./extract_best_... | TPeterW/Bitcoin-Price-Prediction | feature_extraction/extract_best_features.py | Python | mit | 4,773 |
from __future__ import print_function, absolute_import, division
import os
import shutil
from itertools import product
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from casa_formats_io import coordsy... | radio-astro-tools/spectral-cube | spectral_cube/tests/test_casafuncs.py | Python | bsd-3-clause | 9,896 |
"""
Test some lldb help commands.
See also CommandInterpreter::OutputFormattedHelpText().
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class HelpCommandTestCase(TestBase... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/help/TestHelp.py | Python | bsd-3-clause | 9,505 |
#!/usr/bin/env python
# Copyright(C) 2011,2012,2013,2014 by Abe developers.
# 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 lat... | Max-Coin/maxcoin-abe | Abe/abe.py | Python | agpl-3.0 | 78,956 |
import datetime
from google.appengine.api.memcache import get_stats
from django.http import HttpResponse
from django.utils import simplejson as json
from subscription.models import Subscription, SubscriptionItem
from series.models import Show
def memcache(request):
return HttpResponse("%s" % get_stats())
def... | maxgraser/seriesly | seriesly/statistics/views.py | Python | agpl-3.0 | 1,920 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py | Python | apache-2.0 | 1,549 |
from django.db import models
# Create your models here.
class account(models.Model):
url = models.URLField(max_length=200, blank=True)
index_limit = models.IntegerField(default=0)
verified_status = models.BooleanField(blank=False, null=False, default=False, editable=False)
deposit_address = models.Char... | cryptoproofinfo/webapp | popsite/models.py | Python | apache-2.0 | 1,839 |
# coding: utf-8
# Copyright 2014 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 requir... | infinyte/oppia | core/controllers/editor.py | Python | apache-2.0 | 29,703 |
# -*- coding: utf-8 -*-
# Copyright 2013 Dev in Cachu 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 unittest
from django.db import models as django_models
from .. import models
class ModelPalestranteTestCase(unittest.Test... | devincachu/devincachu-2014 | devincachu/palestras/tests/test_model_palestrante.py | Python | bsd-2-clause | 6,017 |
#!/home/david/miniconda/envs/klusta/bin/python
import psutil
import time
import subprocess
import os
import glob
import fnmatch
import socket
import shutil
import argparse
import xml.etree.ElementTree as ET
# import resample
# TODO
# - add behavior tracking extraction
# - add LFP extraction
ssdDirectory = '/home/davi... | DavidTingley/ephys-processing-pipeline | processRecordings.py | Python | gpl-3.0 | 11,099 |
# -*- 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):
# Removing unique constraint on 'NetworkInterface', fields ['name']
db.de... | schakrava/rockstor-core | src/rockstor/storageadmin/south_migrations/0037_auto__chg_field_networkinterface_autoconnect__chg_field_networkinterfa.py | Python | gpl-3.0 | 42,159 |
# -*- coding: utf-8 -*-
import pytest
import networkx
from acopy import Ant
from acopy import Solution
def test_ant_get_unvisited_nodes():
graph = networkx.Graph({0: [1, 2, 3]})
solution = Solution(graph, start=0)
moves = set(Ant().get_unvisited_nodes(graph, solution))
assert moves == {1, 2, 3}
def... | rhgrant10/Pants | tests/test_ant.py | Python | gpl-2.0 | 1,186 |
# This is a little script update the README.md file according to the current status of the folder
# Author: Your dear boyfriend/coding genius.
# import module
import os
# update places we have been
def updatePlace():
places = []
for filename in os.listdir("."):
if os.path.isdir(os.path.join(os.path.abspath("."),... | WesleyyC/Lazy-Script | Jo's Flash Drive/updateREADME.py | Python | mit | 1,637 |
from django.utils.encoding import smart_unicode
from django.utils.xmlutils import SimplerXMLGenerator
from rest_framework.compat import StringIO
import re
import xml.etree.ElementTree as ET
# From xml2dict
class XML2Dict(object):
def __init__(self):
pass
def _parse_node(self, node):
node_tre... | voer-platform/vp.repo | vpr/rest_framework/utils/__init__.py | Python | agpl-3.0 | 2,929 |
# -*- coding: utf-8 -*-
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from unidecode import unidecode
"""
This script uses the NLTK implementation of VADER to get the sentiment
polarities of all the original files with ground truth values.
Data set: http://comp.social.gatech.edu/papers/hutto_ICWSM_2014... | nunoachenriques/vader-sentiment-analysis | src/test/resources/getNltkVader.py | Python | apache-2.0 | 1,609 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2014 Brian Douglass bhdouglass@gmail.com
# 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 Softwa... | bhdouglass/agui | agui/aextras/__init__.py | Python | gpl-3.0 | 997 |
from WebStudioLib import *
from WebStudioUtil import *
from WebStudioBase import *
from WebStudioApi import *
class PageMainHandler(BaseHandler):
def get(self):
self.render_template('main.html')
class PageTableHandler(BaseHandler):
def get(self):
self.render_template_Vue('table.html')
class P... | Microsoft/rDSN | src/tools/webstudio/app_package/WebStudioPage.py | Python | mit | 7,573 |
MAIN_LIST_FOCUS = "main_list_focus"
STATUS_BG = "#06a"
STATUS_BG_FOCUS = "#08d"
# name, fg, bg, mono, fg_h, bg_h
PALLETE = [
(MAIN_LIST_FOCUS, 'default', 'brown', "default", "white", "#060"), # a60
('main_list_lg', 'light gray', 'default', "default", "g100", "default"),
('main_list_dg', 'dark gray', 'd... | f-cap/sen | sen/tui/constants.py | Python | mit | 6,074 |
import math, os, shutil, subprocess
import runner
from runner import RunnerCore, path_from_root
from tools.shared import *
# standard arguments for timing:
# 0: no runtime, just startup
# 1: very little runtime
# 2: 0.5 seconds
# 3: 1 second
# 4: 5 seconds
# 5: 10 seconds
DEFAULT_ARG = '4'
TEST_REPS = 2
CORE_BENCHMA... | slightperturbation/Cobalt | ext/emsdk_portable/emscripten/1.27.0/tests/test_benchmark.py | Python | apache-2.0 | 23,045 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py | Python | mit | 16,337 |
################################################################################
#
# This program is part of the WMIDataSource Zenpack for Zenoss.
# Copyright (C) 2008, 2009, 2010 Egor Puzanov.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http://www.z... | anksp21/Community-Zenpacks | ZenPacks.community.WMIDataSource/ZenPacks/community/WMIDataSource/services/WmiPerfConfig.py | Python | gpl-2.0 | 5,653 |
import ConfigParser
from zope.interface import implements
# from repoze.who.interfaces import IChallenger, IIdentifier, IAuthenticator
from repoze.who.interfaces import IMetadataProvider
class INIMetadataProvider(object):
implements(IMetadataProvider)
def __init__(self, ini_file, key_attribute):
... | cloudera/hue | desktop/core/ext-py3/pysaml2-5.0.0/src/saml2/s2repoze/plugins/ini.py | Python | apache-2.0 | 1,180 |
"""
Support for ASUSWRT routers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.asuswrt/
"""
import logging
from homeassistant.components.device_tracker import DeviceScanner
from . import DATA_ASUSWRT
DEPENDENCIES = ['asuswrt']
_LOGGER... | jamespcole/home-assistant | homeassistant/components/asuswrt/device_tracker.py | Python | apache-2.0 | 1,927 |
"""The tests for the Script component."""
# pylint: disable=protected-access
from datetime import timedelta
from unittest import mock
import unittest
from homeassistant.core import callback
# Otherwise can't test just this file (import order issue)
import homeassistant.components # noqa
import homeassistant.util.dt a... | srcLurker/home-assistant | tests/helpers/test_script.py | Python | mit | 9,951 |
#!/usr/bin/python
import socket
buffer=["A"]
counter=50
while len(buffer) <= 100:
buffer.append("A"*counter)
counter=counter+50
commands=["HELP","STATS .","RTIME .","LTIME .","SRUN .","TRUN .","GMON .","GDOG .","KSTET .","GTER .","HTER .","LTER .","KSTAN ."]
for command in commands:
for buffstri... | appseckev/python_hacking_library | simplefuzzer.py | Python | gpl-3.0 | 581 |
# Copyright (c) 2013 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... | rdo-management/neutron | neutron/tests/unit/test_extension_ext_net.py | Python | apache-2.0 | 7,932 |
import math
def is_pentagonal(n):
pentagonals = []
j = 2
k = 1
while True:
| Daphron/project-euler | p44.py | Python | gpl-3.0 | 84 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import os
import glob
import h5py
import fitsio
import numpy as np
fns = glob.glob("data/k2/*.fits.gz")
base_fns = [os.path.split(fn)[1] for fn in fns]
n = len(fns)
meta = np.empty(n, dtype=[
("fn", np.str_, max(map(len... | dfm/photoica | stitch.py | Python | mit | 1,839 |
# -*- coding: utf-8 -*-
# Part of hexy. See LICENSE file for full copyright and licensing details.
import os
import sys
import arrow
from .util.bubble import Bubble
from .util.deb import deb,debset
from .grid import (grid_make,
grid_reset,
grid_show,
grid_set_p... | e7dal/hexy | hexy/__init__.py | Python | gpl-3.0 | 2,172 |
"""Utilities available to workbench applications."""
def make_safe_for_html(html):
"""Turn the text `html` into a real HTML string."""
html = html.replace("&", "&")
html = html.replace(" ", " ")
html = html.replace("<", "<")
html = html.replace("\n", "<br>")
return html
| jamiefolsom/xblock-sdk | workbench/util.py | Python | agpl-3.0 | 309 |
"""
-------------------------------------------------------------------------------
| Copyright 2016 Esri
|
| 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/... | JRosenfeldIntern/data-assistant | Shared/GPTools/arcpy/dlaPublish.py | Python | apache-2.0 | 10,633 |
import os
import unittest
from manolo_scraper.spiders.minsa import MinsaSpider
from utils import fake_response_from_file
class TestMinsaSpider(unittest.TestCase):
def setUp(self):
self.spider = MinsaSpider()
def test_parse_item(self):
filename = os.path.join('data/minsa', '18-08-2015.html')... | aniversarioperu/django-manolo | scrapers/tests/test_minsa_spider.py | Python | bsd-3-clause | 1,311 |
# Mercurial extension to provide 'hg relink' command
#
# Copyright (C) 2007 Brendan Cully <brendan@kublai.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""recreates hardlinks between repository clones"""
from mercurial imp... | seewindcn/tortoisehg | src/hgext/relink.py | Python | gpl-2.0 | 6,459 |
# Parallelized gridsearch using a package that integrates Spark with scikit-learn.
# I couldn't run this in AWS EC2 because I couldn't manage to download
# the right versions of Spark, PySpark, Python, Pip, and the dependencies all together.
# It's definitely possible, just beyond my current linux abilities.
from skle... | samgoodgame/sf_crime | iterations/spark-sklearn/random_forest_spark_mini.py | Python | mit | 2,464 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui4/pqdiagdialog_base.ui'
#
# Created: Mon May 4 14:30:35 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self... | matrumz/RPi_Custom_Files | Printing/hplip-3.15.2/ui4/pqdiagdialog_base.py | Python | gpl-2.0 | 2,746 |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class SecurityContextConstraintsConfig(object):
''' Handle scc options '''
# pylint: disable=too-many-arguments
def __init__(self,
sname,
kubeconfig,
options=None,
... | mmahut/openshift-ansible | roles/lib_openshift/src/lib/scc.py | Python | apache-2.0 | 6,696 |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | google/makani | gs/monitor2/apps/plugins/layouts/hover_template.py | Python | apache-2.0 | 2,600 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.