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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
""" Files need for FASTQC summary files. """
import sys
import re
if sys.version_info[0] < 3:
from StringIO import StringIO
else:
from io import StringIO
import pandas as pd
MODULES = ['Basic_Statistics',
'Per_base_sequence_quality',
'Per_tile_sequence_quality',
... | jfear/fastqc_parser | fastqc_parser/parser.py | Python | mit | 3,172 |
from __future__ import print_function
from tree import create_tree
def get_height(root):
if root is None:
return 0
return max(get_height(root.left), get_height(root.right)) + 1
def is_balanced(root):
"""O(n^2)"""
if root is None:
return True
lb = is_balanced(root.left)
rb = i... | shichao-an/ctci | chapter4/question4.1.py | Python | bsd-2-clause | 1,025 |
# Copyright (c) 2017 Fujitsu Limited
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | noironetworks/neutron | neutron/services/logapi/drivers/manager.py | Python | apache-2.0 | 4,997 |
# Purpose:
# Use the GUI, WASD or the arrow keys to control the robots movement.
# Reason for updated version:
# Reason for an updated version is that using the setWidgetProperties, I would be able to eliminate a lot of repeated
# code and be able to set everything easily through one function therefore saving ti... | erickmusembi/Robot-Project | Robot Project/src/GUI 1.2.py | Python | mit | 4,687 |
# -*- coding: utf-8 -*-
from flask_restful import Resource
from flask_restful import reqparse
from flask import request, url_for, jsonify
import pymysql.cursors
import jsondate as json
import dbSettings
# UserList
# - post: create a new item and return it's list dependent ItemNo
# - get: return the set of list data fo... | wightman/Lists | api/resources/listItems.py | Python | lgpl-3.0 | 2,593 |
# -*- coding : utf-8 -*-
def main():
v = []
t = []
n = []
f = []
fout = open("temple.obj", "w")
for i in range(24):
fin = open("t" + str(i+1)+".obj")
for line in fin.readlines():
if line[0] == "v" and line[1] == " ":
v.append(line)
if line... | Impavidity/GameTutorial | 3DGmame/res/merge.py | Python | mit | 792 |
#!/usr/bin/python
# Copyright 2012 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | lex128/mtasa-blue | vendor/curl/tests/http_pipe.py | Python | gpl-3.0 | 14,039 |
import discord
import injector
import database
import pymongo
class Events:
"""Events"""
def __init__(self, bot):
self.bot = bot
async def on_connect(self):
try:
await database.client.server_info()
except pymongo.errors.ServerSelectionTimeoutError as error:
... | mooster311/Gigabot | cogs/events.py | Python | mit | 4,025 |
import socket
from socket import AF_INET, AF_INET6
import struct
import pytest
from unittest.mock import Mock, patch, call
from sshuttle.helpers import Fatal
from sshuttle.methods import get_method
def test_get_supported_features():
method = get_method('nat')
features = method.get_supported_features()
as... | sshuttle/sshuttle | tests/client/test_methods_nat.py | Python | lgpl-2.1 | 7,579 |
from braintree.credit_card import CreditCard
from braintree.credit_card_verification import CreditCardVerification
from braintree.search import Search
from braintree.util import Constants
class CreditCardVerificationSearch:
credit_card_cardholder_name = Search.TextNodeBuilder("credit_card_cardholder_name")
id... | DiptoDas8/Biponi | lib/python2.7/site-packages/braintree/credit_card_verification_search.py | Python | mit | 1,265 |
# Copyright (c) 2014, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import base_plots
import models_plots
import priors_plots
import variational_plots
import kernel_plots
import dim_reduction_plots
import mapping_plots
import Tango
import visualize
import latent_space_visua... | ptonner/GPy | GPy/plotting/matplot_dep/__init__.py | Python | bsd-3-clause | 435 |
"""NotebookExporter class"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from .exporter import Exporter
from IPython import nbformat
from IPython.utils.traitlets import Enum
class NotebookExporter(Exporter):
"""Exports to an IPython notebook."""
nbf... | mattvonrocketstein/smash | smashlib/ipy3x/nbconvert/exporters/notebook.py | Python | mit | 1,204 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/front/sitemaps/base.py | Python | agpl-3.0 | 1,985 |
#Librerías y módulos requeridos para el desarrollo del app
from kivy.config import Config
Config.set('graphics','resizable',0)
from kivy.core.window import Window
Window.size = (600, 500)
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.grid... | mora260/ie0117_III16 | grupo5/videoStreamClient.py | Python | gpl-3.0 | 4,583 |
# Plot Landau distributions with FWHM and MPV
import numpy as np
import matplotlib.pyplot as plt
import pylandau
from scipy.interpolate import splrep, sproot
def fwhm(x, y, k=10): # http://stackoverflow.com/questions/10582795/finding-the-full-width-half-maximum-of-a-peak
"""
Determine full-with-half-maximum ... | SiLab-Bonn/pyLandau | examples/mpv_fwhm.py | Python | lgpl-2.1 | 1,506 |
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:443
... | melanj/my-spare-time-work | httpserver/simple-https-server.py | Python | apache-2.0 | 611 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Print the current working directory.
"""
from __future__ import print_function
import argparse
import os
import sys
_stash = globals()['_stash']
collapseuser = _stash.libcore.collapseuser
def main(args):
p = argparse.ArgumentParser(description=__doc__)
p.add... | ywangd/stash | bin/pwd.py | Python | mit | 926 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 04/08/2015
Updated: 19/09/2017
# Description
A very simple example of how to count the number occurrences of a certain object
o in a list ls.
You should not use recursion in general for doing this task: for example, i... | nbro/ands | ands/algorithms/recursion/count.py | Python | mit | 761 |
import mne, sys
from mne.fiff import Evoked
try:
subject = sys.argv[1]
trigger = sys.argv[2]#Get the trigger is stim or resp
except:
print "Please run with input file provided. Exiting"
sys.exit()
subjects_dir = '/home/qdong/freesurfer/subjects/'
subject_path = subjects_dir + subject#Set the data path ... | dongqunxi/GrangerCausality | Preprocessing/sourcelocalization.py | Python | bsd-3-clause | 3,847 |
import sys
try:
from Bio import Seq
except ImportError:
print """
****************************
* Sorry I don't seem to be *
* able to access BioPython *
* from this python. Maybe *
* you have a module such *
* as qiime loaded, and its *
* python doesn't have bio *
* -python installed ? *
* Try unloading ... | AgResearch/metagenomics_illumina_processing | check_python_env.py | Python | gpl-3.0 | 439 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import glob
from textwrap import dedent
import os
import sys
from setuptools import setup, find_packages, Command
def load_requirements(fname):
is_comment = re.compile('^\s*(#|--).*').match
with open(fname) as fo:
return [line.strip() for line i... | cbclab/MCT | setup.py | Python | lgpl-3.0 | 4,217 |
import json
import urllib.request as request
JSONRPC_VERSION = "2.0"
HEADERS = {"content-type": "application/json"}
class JSONRPCBuilder():
def __init__(self, method, params):
self.method = method
self.params = params
def dump(self):
data = {
"jsonrpc": JSONRPC_VERSION,
... | uinput/deeplator | deeplator/jsonrpc.py | Python | mit | 1,187 |
from fabric.api import *
def update():
"""Requires code_root env variable. Does a git pull and restarts the web server"""
require('code_root')
git_pull()
restart_web_server()
def git_pull():
"""Does a git stash then a git pull on the project"""
run('cd %s; git stash; git pull' % (env.code_... | brajput24/fabric-bolt | fabric_bolt/fabfile.py | Python | mit | 1,632 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | andrewsmedina/horizon | horizon/horizon/dashboards/nova/access_and_security/security_groups/tests.py | Python | apache-2.0 | 10,057 |
import unittest
import sys
import weakref
from helper import UsesQApplication
from PySide.QtGui import QTextBlockUserData, QTextEdit, QTextCursor
class TestUserData(QTextBlockUserData):
def __init__(self, data):
super(TestUserData, self).__init__()
self.data = data
class TestUserDataRefCount(Use... | enthought/pyside | tests/QtGui/bug_811.py | Python | lgpl-2.1 | 976 |
from django import forms
from logistics.models import Fleet, Trip
ROLE_CHOICES = (
("1", "OWNER"),
("2", "DRIVER")
)
class SignUpForm(forms.Form):
login = forms.CharField(label='Your login', max_length=50)
email = forms.EmailField(label='Your email', max_length=50)
password = forms.CharField(labe... | geo2tag-logistics/Geo2Logistics | logistics/forms.py | Python | apache-2.0 | 1,894 |
# Copyright (c) 2014 Cisco Systems
# 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 require... | noironetworks/apic-ml2-driver | apic_ml2/neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py | Python | apache-2.0 | 16,869 |
# coding: utf-8
# # [Fancy Table][1] #
# Dynamic table views for the IPython Notebook
#
# [1]: http://www.snip2code.com/Snippet/47354/Fancy-Table-Using-IPython-Widgets
from math import ceil
from IPython.html import widgets
from IPython.display import display
from IPython.display import display_html, clear_output
d... | cfobel/parallel-tsp | fancy_table.py | Python | mit | 3,399 |
#!/usr/bin/env python
'''
Created on 07-Nov-2016
Updated on 16-Dec-2016
@author: Ramith Nambiar
@website: www.iotcon.top
Version : 1.6
'''
import RPi.GPIO as GPIO
import sys, getopt,requests,json,time
import urllib2,cookielib
from urllib2 import URLError
user="xxxxxxxxxxxxx"
hash="xxxxxxxxxxxxx"
url="ht... | ramith27/We4u-Raspberry | src/connect.py | Python | gpl-3.0 | 2,838 |
ROOT_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/... | oxtopus/liquipy | liquipy/changeset.py | Python | mit | 1,601 |
import pandas as pd
with open("ssize.100.spe.10.l2.0.iters.5.fltr/summaries.tsv", "r") as f:
df = pd.read_csv(f, sep="\t")
df = df[df["run"] == "L2S.F1"]
print df[["partial", "confidence"]].corr("pearson")
print df[["partial", "confidence"]].corr("spearman")
print df[["partial", "confidence"]].corr("kendall")
| kedz/cuttsum | trec2015/sbin/l2s/cor.py | Python | apache-2.0 | 320 |
class Event(object):
_event_groups = {}
@classmethod
def get_events(cls, key="Default"):
return cls._event_groups.get(key, [])
def __init__(self, name, msg=None, group_key="Default"):
self._name = name
self._msg = msg
self._my_group = group_key
groups = Event.... | ifermon/garagePi | event.py | Python | gpl-2.0 | 1,068 |
# Name: mapper_globcolour_l3b
# Purpose: Mapping for GLOBCOLOUR L3B data
# Authors: Anton Korosov
# Licence: This file is part of NANSAT. You can redistribute it or modify
# under the terms of GNU General Public License, v.3
# http://www.gnu.org/licenses/gpl-3.0.html
import ... | yuxiaobu/nansat | mappers/mapper_globcolour_l3b.py | Python | gpl-3.0 | 5,989 |
#
# 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 us... | bavardage/spark | python/pyspark/context.py | Python | apache-2.0 | 11,827 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_stock_picking_operation_quick_change
| Domatix/stock-logistics-workflow | stock_picking_operation_quick_change/tests/__init__.py | Python | agpl-3.0 | 121 |
#!/usr/bin/env python
# encoding: utf-8
## ==============================================
## GOAL : Format code, Add/Strip headers
## ==============================================
import argparse
import logging
import os
import re
import sys
## ==============================================
## CONFIGURATION
## ====... | ranxian/peloton | script/formatting/formatter.py | Python | apache-2.0 | 7,126 |
class LittleNumber(object):
def __init__(self, value):
self.x = value
@property
def x(self):
return self._x
@x.setter
def x(self, value):
if not (type(value) == int and 0 < value < 32):
raise ValueError("LittleNumber.x "
"must be an int... | AnthonyBriggs/Python-101 | hello_python_source_py3/chapter 07/compare.py | Python | mit | 1,587 |
# coding: utf-8
from __future__ import unicode_literals
from ..util import get_doc
from ...tokens import Doc
from ...vocab import Vocab
from ...attrs import LEMMA
from ...tokens import Span
import pytest
import numpy
@pytest.mark.parametrize('text', [["one", "two", "three"]])
def test_doc_api_compare_by_string_posi... | aikramer2/spaCy | spacy/tests/doc/test_doc_api.py | Python | mit | 10,763 |
##Create a program that will play the “cows and bulls” game
##with the user. The game works like this:
##
##Randomly generate a 4-digit number. Ask the user to guess a
##4-digit number. For every digit that the user guessed correctly
##in the correct place, they have a “cow”. For every digit the user
##guessed correctl... | RodRojas/Hello_World | cows_bulls.py | Python | gpl-3.0 | 1,578 |
from __future__ import absolute_import, unicode_literals
import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
logger = logging.getLogger('wagtail.frontendcache')
class InvalidFrontendCacheBackendError(Improperl... | chrxr/wagtail | wagtail/contrib/wagtailfrontendcache/utils.py | Python | bsd-3-clause | 2,569 |
"""
sphinxit.core.nodes
~~~~~~~~~~~~~~~~~~~
Implements atomic nodes and containers of lexemes.
:copyright: (c) 2013 by Roman Semirook.
:license: BSD, see LICENSE for more details.
"""
from __future__ import unicode_literals
from collections import deque
from sphinxit.core.convertors import (
... | maximzxc/sphinxit_with_geo | sphinxit/core/nodes.py | Python | bsd-3-clause | 16,584 |
from django.contrib import messages
from django.contrib.auth.decorators import permission_required, login_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.urlresolvers import reverse
from django.db import transaction, IntegrityError
from django.db.models import Count
from django.... | rfdrake/netbox | netbox/secrets/views.py | Python | apache-2.0 | 7,380 |
# Django settings for ftrain project.
DEBUG = True
DEFAULT_DIC_PATH = '/home/ford/sites/ftrain/'
TOTAL_ALLOWED_CALORIES = 2100
CALORIC_DEFICIT_BELOW = 2700
ADMINS = (
('Paul Ford', 'ford@harpers.org'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sq... | ftrain/django-ftrain | settings_example.py | Python | bsd-3-clause | 3,548 |
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | malikcjm/qtcreator | tests/system/suite_HELP/tst_HELP06/test.py | Python | lgpl-2.1 | 8,212 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | quietguy675/website | mysite/settings.py | Python | bsd-3-clause | 3,208 |
# Copyright 2013 NEC Corporation.
# 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... | queria/my-tempest | tempest/services/compute/xml/aggregates_client.py | Python | apache-2.0 | 5,059 |
from givabit.backend.amount_mismatch import AmountMismatch
from givabit.backend.payment import IncomingPayment, OutgoingPayment, OutgoingPaymentState, Payment
from google.appengine.ext import db
class PaymentRepository(object):
def __init__(self, donation_proportion_repository):
self.donation_proportion_r... | illicitonion/givabit | src/givabit/backend/payment_repository.py | Python | apache-2.0 | 5,953 |
#
# 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 us... | nchammas/spark | python/pyspark/sql/functions.py | Python | apache-2.0 | 188,138 |
import os
import ConfigParser
import logging
import exceptions
from tls import TLS
from openstack_cert import OSCert
from keystoneclient import session
from keystoneclient.auth.identity import v2 as v2_client
from keystoneclient.auth.identity import v3 as v3_client
from barbicanclient import client
class BarbicanCe... | rombie/contrail-controller | src/vnsw/opencontrail-vrouter-netns/opencontrail_vrouter_netns/cert_mgr/barbican_cert_manager.py | Python | apache-2.0 | 4,947 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-26 09:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('primus', '0031_auto_20160526_1134'),
]
operations = [
migrations.AddField(
... | sighill/shade_app | primus/migrations/0032_archetype_description.py | Python | mit | 468 |
"""The tests for the VoiceRSS speech platform."""
import asyncio
import os
import shutil
import homeassistant.components.tts as tts
from homeassistant.components.media_player import (
SERVICE_PLAY_MEDIA, ATTR_MEDIA_CONTENT_ID, DOMAIN as DOMAIN_MP)
from homeassistant.bootstrap import setup_component
from tests.com... | kyvinh/home-assistant | tests/components/tts/test_voicerss.py | Python | apache-2.0 | 7,340 |
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/paginate.py | Python | mit | 11,056 |
from pylama.main import shell
@profile
def pylama_test():
shell('-l pylint ../perf_test/requests-2.12.1/'.split(), error=False)
if __name__ == '__main__':
pylama_test() | IPMITMO/statan-research | analyze/perfomance_test/pylama_memory_profiler_test.py | Python | mit | 178 |
"""
Copyright 2015 Rackspace
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
dist... | tonyli71/designate | functionaltests/api/v2/models/recordset_model.py | Python | apache-2.0 | 975 |
"""Amber Electric Constants."""
import logging
DOMAIN = "amberelectric"
CONF_API_TOKEN = "api_token"
CONF_SITE_NAME = "site_name"
CONF_SITE_ID = "site_id"
CONF_SITE_NMI = "site_nmi"
ATTRIBUTION = "Data provided by Amber Electric"
LOGGER = logging.getLogger(__package__)
PLATFORMS = ["sensor", "binary_sensor"]
| aronsky/home-assistant | homeassistant/components/amberelectric/const.py | Python | apache-2.0 | 313 |
import sys
import os
import re
from datetime import date
DATEMAP= [ 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' ]
def genbankDate():
D = date.today()
if int(D.day) < 10:
return ( '0'+str(D.day) +'-' + DATEMAP[D.month-1] + '-'+ str(D.year) )
else:
... | Koonkie/MetaPathways_Python_Koonkie.3.0 | libs/python_modules/utils/sysutil.py | Python | mit | 1,375 |
# This file is part of xmpp-backends (https://github.com/mathiasertl/xmpp-backends).
#
# xmpp-backends 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 l... | mathiasertl/xmpp-backends | xmpp_backends/base.py | Python | gpl-3.0 | 21,732 |
#!/usr/bin/env python
#coding:utf-8
"""
1000-digit Fibonacci number
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term... | Urinx/Project_Euler_Answers | 025.py | Python | gpl-2.0 | 735 |
from core.tests.mommy_utils import make_user, make_recipe
from cla_common.constants import REQUIRES_ACTION_BY
from timer.models import Timer
from legalaid.models import Case
from cla_eventlog import event_registry
from cla_eventlog.constants import LOG_TYPES, LOG_LEVELS
from cla_eventlog.models import Log
class E... | ministryofjustice/cla_backend | cla_backend/apps/cla_eventlog/tests/base.py | Python | mit | 7,888 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import datetime
import re
import socket
from typing import Pattern
f... | thumbor/thumbor | thumbor/loaders/http_loader.py | Python | mit | 7,690 |
#!/usr/bin/env python
import sys
import os
import os.path
import hashlib
import createrepo_c as cr
REPO_PATH = "repo/"
class CalculationException(Exception):
pass
def calculate_contenthash(path):
if not os.path.isdir(path) or \
not os.path.isdir(os.path.join(path, "repodata/")):
raise Attrib... | rpm-software-management/createrepo_c | examples/python/contenthash_calculation.py | Python | gpl-2.0 | 1,320 |
from sense_hat import SenseHat
import pygame
from pygame.locals import *
from time import sleep
pygame.init()
pygame.display.set_mode((1,1))
sense = SenseHat()
loop = True
i = 0
while i < 25:
i += 1
while loop == True:
for event in pygame.event.get():
if event.type == KEYDOWN:
... | geomapping/raspi-python | Schleifenwechsel.py | Python | mit | 643 |
'''Passing the two lists as argument containing numbers'''
def find_missing(list1, list2):
'''First we verify that the two passed arguments are lists '''
if type(list1) and type(list2) is list:
if list1 == list2:
'''Testing whether the two arguments are equal if so zero will be returned'''
print(0)
else:
... | anthonyndunguwanja/Anthony-Ndungu-bootcamp-17 | Day4/Missing_Number.py | Python | mit | 699 |
"""
AMAK: 20050515: This module is a brand new test_select module, which gives much wider coverage.
"""
import errno
import time
from test import test_support
import unittest
import socket
import select
SERVER_ADDRESS = ("localhost", 54321)
DATA_CHUNK_SIZE = 1000
DATA_CHUNK = "." * DATA_CHUNK_SIZE
... | adaussy/eclipse-monkey-revival | plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_select_new.py | Python | epl-1.0 | 7,568 |
from plumbum import cli
class Main3Validator(cli.Application):
def main(self, myint: int, myint2: int, *mylist: int):
print(myint, myint2, mylist)
class TestProg3:
def test_prog(self, capsys):
_, rc = Main3Validator.run(["prog", "1", "2", "3", "4", "5"], exit=False)
assert rc == 0
... | tomerfiliba/plumbum | tests/test_3_cli.py | Python | mit | 734 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description:
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [−2,1,−3,4,−1,2,1,−5,4],
the contiguous subarray [4,−1,2,1] has the largest sum = 6.
More practice:
I... | Jan-zou/LeetCode | python/Array/53_maximum_subarray.py | Python | mit | 942 |
import collections
import datetime
import re
from typing import List, Optional, Union, Callable, Dict, Mapping, Tuple, Any, Iterable, Set, NamedTuple
import argparse
import os
import tempfile
import hashlib
import string
import random
import pickle
from beancount.core.data import Transaction, Posting, Balance, Open, C... | jbms/beancount-import | beancount_import/reconcile.py | Python | gpl-2.0 | 40,832 |
#!/usr/bin/env python
import argparse
import sys
import os
from redis import Redis
from rq_scheduler.scheduler import Scheduler
from rq_scheduler.utils import setup_loghandlers
def main():
parser = argparse.ArgumentParser(description='Runs RQ scheduler')
parser.add_argument('-H', '--host', default=os.envir... | lechup/rq-scheduler | rq_scheduler/scripts/rqscheduler.py | Python | mit | 2,093 |
from typing import Dict, List
import gym
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.tf.misc import normc_initializer
from ray.rllib.models.utils import get_filter_config
from ray.rllib.utils.framework import get_activation_fn, try_import_tf
from ray.rllib.utils.typing import ModelConfig... | richardliaw/ray | rllib/models/tf/visionnet.py | Python | apache-2.0 | 6,769 |
#!/usr/bin/python3
from itertools import *
KINDS = ['unorm', 'snorm', 'uint', 'sint', 'float']
PRECS = [8, 16, 32, 64]
def value(kind, prec, ndim):
ikind = KINDS.index(kind)
iprec = PRECS.index(prec)
index = ikind * len(PRECS) + iprec
return index << 16 | KINDS.index(kind) << 12 | iprec << 8 | (ndim - 1) << 10 ... | ciechowoj/haste-format | make_data_t.py | Python | mit | 5,303 |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
# falgh1, grunjol, csitk... | Kyosfonica/calibre-web | cps/about.py | Python | gpl-3.0 | 4,057 |
# -*- encoding: utf-8 -*-
"""Implements Open Scap Content for UI."""
from robottelo.constants import FILTER
from robottelo.ui.base import Base, UIError
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class OpenScapContent(Base):
"""Manipulate... | Ichimonji10/robottelo | robottelo/ui/oscapcontent.py | Python | gpl-3.0 | 1,885 |
__version__ = '0.1b8'
import functools
import logging
import os
import sys
import shutil
import jinja2
import aiohttp
import aiohttp.web
import aiohttp_security
import aiohttp_session.redis_storage
import aioredis
import aiopg
import aiopg.sa
import sys
import json
import requests_oauthlib
import ssl
import modconf
i... | chuck1/web_sheets | ws_web_aiohttp/__init__.py | Python | mit | 2,198 |
import unicodecsv as csv
import cStringIO as StringIO
import codecs
import itertools
from django import forms
from django.utils.translation import ugettext_lazy as _
from .utils.common import has_duplicate_items
class CSVImportForm(forms.Form):
"""
Form used for importing and uploading of CSV-file.
Thi... | onepercentclub/onepercentclub-site | apps/csvimport/forms.py | Python | bsd-3-clause | 6,689 |
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
import numpy as np
from .tod import TOD
from .noise import Noise
from ..op import Operator
from .. import timing as timing... | tskisner/pytoast | src/python/tod/sim_noise.py | Python | bsd-2-clause | 3,547 |
import fauxfactory
import pytest
import cfme.configure.access_control as ac
from cfme import login, test_requirements
from cfme.base.credential import Credential
from cfme.common.vm import VM
from cfme.configure.configuration import Tag, Category
from utils import testgen
def pytest_generate_tests(metafunc):
arg... | rlbabyuk/integration_tests | cfme/tests/cloud_infra_common/test_tag_visibility.py | Python | gpl-2.0 | 2,706 |
# -*- coding: utf-8 -*-
from numpy import abs, asarray, cos, exp, arange, pi, sin, sqrt, sum
from .go_benchmark import Benchmark
class Easom(Benchmark):
r"""
Easom objective function.
This class defines the Easom [1]_ global optimization problem. This is a
a multimodal minimization problem defined a... | WarrenWeckesser/scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_E.py | Python | bsd-3-clause | 9,797 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/cynosdb/v20190107/models.py | Python | mit | 131,425 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/r-aims/package.py | Python | lgpl-2.1 | 1,980 |
# Copyright 2012 OpenStack Foundation
#
# 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... | ilay09/keystone | keystone/tests/unit/test_auth.py | Python | apache-2.0 | 68,909 |
# Lint as: python3
# Copyright 2019 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 ... | tensorflow/lingvo | lingvo/tasks/car/tools/export_kitti_detection.py | Python | apache-2.0 | 9,084 |
"""
Classes for making simple 2D visualizations.
"""
import numpy as N
from theano.compat.six.moves import xrange
from theano import config
class Graph2D(object):
"""
A class for plotting simple graphs in two dimensions.
Parameters
----------
shape : tuple
The shape of the display of the ... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/gui/graph_2D.py | Python | bsd-3-clause | 4,942 |
"""
Main module that use fuse to provide filesystem
"""
import os
import sys
import llfuse
import errno
import auth
import requests
import json
import re
import datetime
import time
FILES = "https://www.googleapis.com/drive/v2/files/"
def countMode(meta):
"""
count file mode
"""
mode = 0
if meta["mimeType"].spl... | ilya-ilya/nikolayfs | fs.py | Python | gpl-2.0 | 3,194 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) Camptocamp SA - http://www.camptocamp.com
# Author: Arnaud WÃŒst
#
# This file is part of the c2c_budget module
#
# WARNING: This program as such is intended to be used by professional
# programm... | VitalPet/c2c-rd-addons | c2c_budget_chricar/wizard/budget_vs_reality.py | Python | agpl-3.0 | 4,479 |
"""===========================
Pipeline Splicing
===========================
Overview
========
This pipeline enables differential exon usage testing through the
implementation of
* rMATS-turbo
* DEXSeq
rMATS is a computational tool to detect differential alternative splicing
events from RNA-Seq data. The statistica... | CGATOxford/CGATPipelines | CGATPipelines/pipeline_splicing.py | Python | mit | 20,530 |
"""All Task related methods."""
class Tasks:
"""Tasks for database."""
URL = '/_api/tasks'
def __init__(self, database):
"""Initialise the database."""
self.database = database
def __call__(self):
"""All the active tasks in the db."""
response = self.database.action.... | tariqdaouda/pyArango | pyArango/tasks.py | Python | apache-2.0 | 1,754 |
"""
>>> list(zip_exc([]))
[]
>>> list(zip_exc((), (), ()))
[]
>>> list(zip_exc("abc", range(3)))
[('a', 0), ('b', 1), ('c', 2)]
>>> try:
... list(zip_exc("", range(3)))
... except LengthMismatch:
... print "mismatch"
mismatch
>>> try:
... list(zip_exc(range(3), ()))
... except LengthMismatch:
... pr... | ActiveState/code | recipes/Python/497006_zipexc_lazy_zip_that_ensures_that_all_iterables_/recipe-497006.py | Python | mit | 1,348 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
"""
jvisor_spectrum_panel (visor_07)
25 julio 2010
"""
#
import wx
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
#
#
class SpectrumPanel(w... | bmazin/SDR | Projects/BestBeammap/wxFix.py | Python | gpl-2.0 | 2,441 |
import tempfile
import shutil
import sys
from unittest import mock
import pytest
from tools.wpt import run
from tools import localpaths # noqa: F401
from wptrunner.browsers import product_list
@pytest.fixture(scope="module")
def venv():
from tools.wpt import virtualenv
class Virtualenv(virtualenv.Virtuale... | CYBAI/servo | tests/wpt/web-platform-tests/tools/wpt/tests/test_run.py | Python | mpl-2.0 | 1,969 |
# coding: utf-8
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# 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,
# ... | jeffmahoney/supybot | src/__init__.py | Python | bsd-3-clause | 3,249 |
from __future__ import unicode_literals
from django.contrib.auth.tokens import default_token_generator
from django.core import mail
from django.core.urlresolvers import reverse
from django.forms.fields import DateField, DateTimeField
from django.utils.http import int_to_base36
from mezzanine.accounts import ProfileNo... | fusionbox/mezzanine | mezzanine/accounts/tests.py | Python | bsd-2-clause | 3,370 |
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from twisted.internet.endpoints import serverFromString, clientFromString
from twisted.internet.protocol import Factory
from twisted.internet.task import LoopingCall
from twisted.internet.threads import deferToThread
from twisted.inter... | DesertBus/txircd | txircd/ircd.py | Python | bsd-3-clause | 30,203 |
# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | adam-iris/mailman | src/mailman/bin/checkdbs.py | Python | gpl-3.0 | 7,696 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2006 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described in the fil... | apache/bloodhound | trac/trac/ticket/model.py | Python | apache-2.0 | 50,948 |
###############################################################################
# Name: schemetags.py #
# Purpose: Generate Tags for Scheme #
# Author: Cody Precord <cprecord@editra.org> #
... | garrettcap/Bulletproof-Backup | wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/schemetags.py | Python | gpl-2.0 | 3,365 |
from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause
green = LED(17)
red = LED(18)
google = PingServer('google.com')
green.source = google.values
green.source_delay = 60
red.source = negated(green.values)
pause()
| MrHarcombe/python-gpiozero | docs/examples/internet_status_indicator.py | Python | bsd-3-clause | 261 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py | Python | apache-2.0 | 14,813 |
import numpy as np
from scipy.special import jn_zeros, jn
from chimeraCL.methods.transformer_methods_cl import TransformerMethodsCL
class Transformer(TransformerMethodsCL):
def init_transformer(self):
"""
Initialize the data for Fourier-Bessel transformations
"""
self._init_transf... | hightower8083/chimeraCL | chimeraCL/transformer.py | Python | gpl-3.0 | 5,145 |
import pytest
from tz import tzfile
def test_invalid_zoneinfo(tmpdir):
empty = tmpdir.ensure('empty')
with pytest.raises(ValueError):
with empty.open() as f:
tzfile.read(f)
def test_tzfile_read_ny2(ny_tzfile):
ny = tzfile.read(ny_tzfile)
assert ny.version == 2
assert ny.time... | abalkin/tz | tests/test_tzfile.py | Python | mit | 567 |
from __future__ import absolute_import
import os
import sys
import logging
log = logging.getLogger("main")
from ..master_task import AlgTask
from ..master_job import Job
from .. import db
from ..utils import (read_fasta, OrderedDict, GLOBALS, pjoin, SeqGroup)
from ..errors import TaskError
__all__ = ["ManualAlg"]
cl... | karrtikr/ete | ete3/tools/phylobuild_lib/task/dummyalg.py | Python | gpl-3.0 | 1,474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.