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 |
|---|---|---|---|---|---|
"""The Logitech Harmony Hub integration."""
import asyncio
import logging
from homeassistant.components.remote import ATTR_ACTIVITY, ATTR_DELAY_SECS
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant, callback
from home... | partofthething/home-assistant | homeassistant/components/harmony/__init__.py | Python | apache-2.0 | 4,085 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import erppeek
import dbconfig
import time
from yamlns import namespace as ns
import sys
from consolemsg import step, error, warn, success
nregistres = sys.argv[1] if len(sys.argv)>1 else 100
step("Connectant a {server}",**dbconfig.erppeek)
t0 = time.time()
erp = e... | Som-Energia/invoice-janitor | benchmarks/user_browse.py | Python | agpl-3.0 | 823 |
# Copyright 2016 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... | e4p/dsub | dsub/commands/dsub.py | Python | apache-2.0 | 27,524 |
import importlib
import logging
import sys
import unittest
from functools import partial
from io import StringIO
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
try:
from importlib import reload
except ImportError:
from imp import reload
import sleuth
import f... | emrob/sleuth | test/test_sleuth.py | Python | mit | 12,148 |
import collections
import re
import csv
import gzip
import sys
import itertools
import codecs
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
try:
import pysam
except ImportError:
pysam = None
try:
import cparse
except ImportError:
cparse = Non... | Victorian-Bioinformatics-Consortium/nesoni | nesoni/third_party/vcf/parser.py | Python | gpl-2.0 | 20,729 |
# Copyright 2011 Yaco Sistemas <lgs@yaco.es>
#
# This file is part of EzWeb.
# EzWeb is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | sixuanwang/SAMSaaS | wirecloud-develop/src/wirecloud/platform/themes.py | Python | gpl-2.0 | 4,117 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.views.generic import FormView
from forms import RSIForm
from __init__ import __info__
__author__ = 'tchen'
logger = logging.getLogger(__name__)
class RSIView(FormView):
template_name = 'rsi.html'
form_class = RSIForm
... | tyrchen/karp | apps/rsi/views.py | Python | mit | 693 |
"""
This file contains the class definitions and functions that form the base of an MCMC sampler.
These classes are the base Parameter class, various MCMC step classes (e.g., Gibbs update,
Metropolis-Hastings update), and various proposal distributions for the Metropolis-like
algorithms.
"""
#TODO: ADD IN ASSERTIONS T... | acbecker/BART | steps.py | Python | mit | 11,512 |
import unittest
from netaddr import IPRange, IPAddress
from netaddr_extensions import funcs
from netaddr_extensions import classes
class FuncsTestCase(unittest.TestCase):
def test_bool_funcs(self):
self.assertTrue(funcs.is_netmask('255.255.255.0'))
self.assertFalse(funcs.is_netmask('127.0.0.1'))
... | MichaelCombs28/netaddr-extensions | tests.py | Python | mit | 2,756 |
"""Functions for Github authorisation."""
from __future__ import print_function
try:
input = raw_input
except NameError:
pass
import os
import requests
import getpass
import json
# Keyring stores passwords by a 'username', but we're not storing a username and
# password
fake_username = 'networkx-tests'
cla... | JamesClough/networkx | tools/gh_api.py | Python | bsd-3-clause | 6,599 |
"""
WSGI config for p27_d17 project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | fogcitymarathoner/gae_p27_dj17 | p27_d17_prj/wsgi.py | Python | mit | 1,789 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | colinbrislawn/scikit-bio | skbio/sequence/_iupac_sequence.py | Python | bsd-3-clause | 16,530 |
import os
import subprocess
import time
import signal
from configs import configs_defined, generate_configs
from game import game_defined, generate_game
CONFIGS_PATH = os.environ['CONFIGS_PATH']
GAME_PATH = os.environ['GAME_PATH']
ADMIN_PLAYERS_CONFIG = os.path.join(CONFIGS_PATH, 'server-adminlist.json')
WHITELISTED_... | Magnitus-/DockerFiles | headless-factorio-server/code/entrypoint.py | Python | mit | 2,467 |
"""Unit tests for :mod:`nailgun.entity_fields`."""
import datetime
import socket
from random import randint
from unittest import TestCase
from urllib.parse import urlparse
from fauxfactory.constants import VALID_NETMASKS
from nailgun import entity_fields
# It is OK that this class has no public methods. It just nee... | JacobCallahan/nailgun | tests/test_entity_fields.py | Python | gpl-3.0 | 7,488 |
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**ISClipper test suite.**
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 published by
the Free Software Foundation; ... | maning/inasafe | safe_qgis/test_clipper.py | Python | gpl-3.0 | 24,397 |
from setuptools import setup
setup(
name = 'minerva',
version = '1.0',
description = 'Probability calculations for the board game Risk',
packages = ['minerva'],
entry_points = {
'console_scripts': 'minerva = minerva.main:run',
},
author = 'Kyle Beatty',
author_email = 'kylebeatt... | Nestor15/Minerva | setup.py | Python | gpl-2.0 | 387 |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2017/11/1 ~ 2019/9/1
# @Author : Allen Woo
import json
import sys
import regex as re
from pymongo.cursor import Cursor
def objid_to_str(datas, fields=["_id"]):
"""
mongodb ObjectId to str
:param datas:
:param field:
:return:
"""
if isins... | osroom/osroom | apps/utils/format/obj_format.py | Python | bsd-2-clause | 2,640 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015, 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in... | stgraber/snapcraft | snapcraft/tests/__init__.py | Python | gpl-3.0 | 4,319 |
from OpenGL.GL import *
import pygame, pygame.image, pygame.key
from pygame.locals import *
import numpy
import math
from random import Random
from ogl_helpers import (
make_buffer,
short_element_buffer,
float_array,
short_array,
translation_matrix,
make_texture,
make_shader,
show_info_l... | weeble/clockworkcodex_ogl | shaders.py | Python | mit | 2,075 |
"""Common libraries for test setup."""
import aiohttp
from google_nest_sdm.auth import AbstractAuth
import pytest
class FakeAuth(AbstractAuth):
"""A fake implementation of the auth class that records requests.
This class captures the outgoing requests, and can also be used by
tests to set up fake respon... | jawilson/home-assistant | tests/components/nest/conftest.py | Python | apache-2.0 | 2,062 |
from django.core.exceptions import ObjectDoesNotExist
from django.utils.importlib import import_module
class CacheClearingModel (object):
@classmethod
def resolve_attr(cls, attr):
if hasattr(cls, attr):
value = getattr(cls, attr)
if isinstance(value, str):
modul... | codeforsanjose/MobilityMapApi | src/sa_api_v2/models/caching.py | Python | gpl-3.0 | 1,767 |
#!/usr/bin/env python
"""
Tags media by querying the TVDB API.
"""
import argparse
import os
import tv_tagger
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--show-dir', required=True,
help='Directory containing media to be tagged.')
args = parser.parse_args()
... | bcipriano/home-scripts | auto_tagger/tag.py | Python | gpl-3.0 | 486 |
import os
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy.io import fits
from astropy.coordinates import Galactic, ICRS
from astropy.wcs import WCS
from ..geometry import Path
HEADER_FILE = os.path.join(os.path.dirname(__file__), 'data', 'w51.hdr')
HEADER = fits.... | keflavich/pvextractor | pvextractor/tests/test_path.py | Python | bsd-3-clause | 5,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/bottle/bottle.py | Python | gpl-3.0 | 150,580 |
import numpy as np
import scipy
from scipy import linalg
from scipy import sparse
from scipy import ndimage
import scipy.sparse.linalg.eigen.arpack
from scipy.sparse.linalg.eigen.arpack import eigen, eigen_symmetric
#from pyamg.graph import lloyd_cluster
import pyamg
from pyamg import smoothed_aggregation_solver
from s... | GaelVaroquaux/diffusion-segmentation | spectral_embedding.py | Python | bsd-3-clause | 11,610 |
__author__ = 'bromix'
from .directory_item import DirectoryItem
from .. import constants
class SearchItem(DirectoryItem):
def __init__(self, context, alt_name=None, image=None, fanart=None):
name = alt_name
if not name:
name = context.localize(constants.localize.SEARCH)
if im... | Etharr/plugin.video.youtube | resources/lib/youtube_plugin/kodion/items/search_item.py | Python | gpl-2.0 | 632 |
# Copyright (C) 2015-2019 Magenta ApS, https://magenta.dk.
# Contact: info@magenta.dk.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pika
import json
from ... | magenta-aps/mox | oio_rest/oio_rest/log_client.py | Python | mpl-2.0 | 3,325 |
from dwb.prosemaker.tests import ProseMakerTestCase
from dwb.prosemaker import ProseMaker
# ===================================================================
class TestProseMakerReplacements(ProseMakerTestCase):
def setUp(self):
super(TestProseMakerReplacements, self).setUp()
self.pm.data = {
... | DanielBaird/prosemaker | egg/dwb.prosemaker/src/dwb/prosemaker/tests/test_prosemaker_replacements_arithmetic.py | Python | apache-2.0 | 3,038 |
#!/usr/bin/env python3
import sys
sys.stderr.buffer.write(b"\xe2" * 2048)
sys.stderr.buffer.write("foo bar baz".encode("utf8"))
sys.stderr.flush()
sys.exit(1)
| facebook/buck | test/com/facebook/buck/testutil/endtoend/testdata/cli/bad_utf8/out.py | Python | apache-2.0 | 162 |
# Copyright (C) 2016 Jorge Costa
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR P... | JeevesTakesOver/Railtrack | lib/__init__.py | Python | gpl-3.0 | 527 |
"""Analytics helper class for the analytics integration."""
import asyncio
import uuid
import aiohttp
import async_timeout
from homeassistant.components import hassio
from homeassistant.components.api import ATTR_INSTALLATION_TYPE
from homeassistant.components.automation.const import DOMAIN as AUTOMATION_DOMAIN
from ... | w1ll1am23/home-assistant | homeassistant/components/analytics/analytics.py | Python | apache-2.0 | 8,698 |
from common import *
from gridRole import GridRole
properties = ArrayList()
class Movable(GridRole) :
def __init__(self) :
GridRole.__init__(self)
self.speed = 4
self.currentSpeed = 0 # Number of pixels to move per tick when dx or dy are non zero.
self.dx = 0 # -1, 0 or 1 dependi... | nickthecoder/itchy | resources/Cavern-Quest/scripts/movable.py | Python | gpl-3.0 | 5,120 |
#!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
import time
import logging
logging.basicConfig(filename='repo_crawler.log',level=logging.DEBUG)
import json
import traceback
os.environ.s... | cmu-db/cmdbac | scripts/crawl_repos.py | Python | apache-2.0 | 1,324 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'WMS Landed Costs',
'version': '1.1',
'summary': 'Landed Costs',
'description': """
Landed Costs Management
=======================
This module allows you to easily add extra costs on pickings a... | Aravinthu/odoo | addons/stock_landed_costs/__manifest__.py | Python | agpl-3.0 | 1,131 |
import os
from time import sleep
import unittest
from appium import webdriver
# Returns abs path relative to this file and not cwd
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
class SimpleAndroidTests(unittest.TestCase):
def setUp(self):
desired_caps = {}
de... | liumeixia/xiaworkspace | pythonProject/automate/appiumexample/android_simple.py | Python | gpl-2.0 | 1,786 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2018 Satpy developers
#
# This file is part of satpy.
#
# satpy 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 Licens... | pytroll/satpy | satpy/tests/reader_tests/test_nucaps.py | Python | gpl-3.0 | 24,800 |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='joint',is_safe=True)
@stringfilter
def joint(value):
return ', '.join(map(lambda x:x.name,value))
| enixdark/10gen-Courses | Relational-SQL/DjangoBlog/Blog/templatetags/blog_filter.py | Python | mit | 237 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import webbrowser
from crawl_trulia import trulia_urlencoder
todo = [
# raw address, formatted address, zipcode
("2818 w shady shores rd", "2818 W Shady Shores Rd", 76208),
]
class TestUrlEncoder:
def test_format_address(self):
for add... | MacHu-GWU/crawl_trulia-project | tests/test_urlencoder.py | Python | mit | 754 |
#!/usr/bin/env python
from __future__ import print_function
from ROOT import *
import argparse
import os
syst_names = ['nominal','lightdown','lightup','ckv','calibneg','calibpos','calibshape']
alg_names = ['bayes','svd']
en_names = ['xsec','osc']
input_ds_names = ['roounfold','ndrespin']
if __name__ == '__main__':
... | kaikai581/NOvA | xsec-2019/check_light_syst/roounfold_test/plot_unfolding_results.py | Python | gpl-2.0 | 2,984 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Mo. Dez. 1 14:00:12 2014
# by: The Resource Compiler for PyQt (Qt v5.3.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xdc\
\x00\
\x00\x08\x22\x78\x9c\xed\x95\x4d\x73\x9b\x30\x10\... | davy39/eric | Helpviewer/Bookmarks/DefaultBookmarks_rc.py | Python | gpl-3.0 | 2,864 |
import _plotly_utils.basevalidators
class TernaryValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="ternary", parent_name="layout", **kwargs):
super(TernaryValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/_ternary.py | Python | mit | 1,546 |
from django.utils import timezone
from bulbs.content.models import Content, FeatureType
from bulbs.utils.test import make_content, BaseIndexableTestCase
from example.testcontent.models import (TestContentObj, TestReadingListObj, TestVideoContentObj)
from bulbs.videos.models import VideohubVideo
class ContentManage... | theonion/django-bulbs | tests/content/test_content_manager.py | Python | mit | 3,750 |
# -*- coding: utf-8 -*-
# PROJECT : picopico
# TIME : 17-1-5 下午8:59
# AUTHOR : youngershen <younger.x.shen@gmail.com>
from django.test import TestCase
from picopico.utils.validator import Validator
from picopico.apps.account.models import User
class AlphaTestValidator(Validator):
text1 = "alphabet"
text2 ... | universalyouth/picopico | picopico/utils/validator/test.py | Python | mit | 8,994 |
#!/usr/bin/env python3.5
'''
Tests the printTable() function
'''
from io import StringIO
import unittest
from unittest.mock import patch
import printTable
class TestPrintTable(unittest.TestCase):
'''tests the printTable.py script'''
def test_printTable(self):
'''
tests printTable()
... | jakdept/pythonbook | ch6/printTable_test.py | Python | mit | 2,278 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-datastream | google/cloud/datastream_v1alpha1/services/datastream/__init__.py | Python | apache-2.0 | 753 |
"""
Called by tox.ini: uses the generated executable to run the tests in ./tests/
directory.
.. note:: somehow calling "build/runtests_script" directly from tox doesn't
seem to work (at least on Windows).
"""
if __name__ == '__main__':
import os
import sys
executable = os.path.join(os.getcwd(), ... | Yukarumya/Yukarum-Redfoxes | testing/web-platform/tests/tools/pytest/testing/cx_freeze/tox_run.py | Python | mpl-2.0 | 464 |
# imports
from re import VERBOSE
import numpy as np
import scipy.optimize as opt
from dask import delayed, compute
import dask.multiprocessing
from ogusa import tax, household, firm, utils, fiscal
from ogusa import aggregates as aggr
from ogusa.constants import SHOW_RUNTIME
import os
import warnings
if not SHOW_RUNTI... | OpenSourcePolicyCenter/dynamic | ogusa/SS.py | Python | mit | 27,048 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Subject'
db.create_table(u'questionnaire_subject', (
... | affan2/ed-questionnaire | questionnaire/migrations/0001_initial.py | Python | bsd-3-clause | 14,506 |
from .nodo import Nodo
class Pila:
def __init__(self):
self.__primero = None
def vacio(self):
if self.__primero == None:
return True
else:
return False
def vaciar_pila(self):
self.__primero = None
def push(self, dato):
if self.vacio():
self.__primero = Nodo(dato)
else:
nuevo = Nodo(dato)
... | AlejandroMolinaReyes/PracticaJunio2017_201020787 | practica1EDD/estructuras/pila/pila.py | Python | gpl-3.0 | 823 |
import os
import sys
import argparse
import collections
import multiprocessing as mp
import glob
import subprocess
import shlex
import re
import sz_collapse
import sz_acount
import sz_mergeAC
import sz_filter
import sz_fisher
import sz_cmh
import sz_plotting
import sz_overlap
import sz_prepVCF
import sz_view
import sz... | svm-zhang/poolseq_tk | poolseq_tk.py | Python | gpl-2.0 | 12,829 |
from __future__ import unicode_literals
from builtins import zip
from builtins import range
from builtins import object
import unittest, mock
from isisdata import export # Ha!
from isisdata.models import *
class TestExportCSV(unittest.TestCase):
def test_output(self):
for i in range(5):
Cit... | upconsulting/IsisCB | isiscb/isisdata/tests/test_export.py | Python | mit | 29,625 |
import sys
import logging
logger = logging.getLogger(__name__)
def configure_logging():
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(name)12s %(levelname)7s - %(mes... | edouard-lopez/parlr | config.py | Python | apache-2.0 | 394 |
"""
Copyright (c) 2016, Pietro Piscione, Luigi De Bianchi, Giulio Micheloni
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
noti... | PP90/ANAWS-project-on-Traffic-Engineering | New_project/GUI/Manager/Mpls_snmp/__init__.py | Python | bsd-3-clause | 1,567 |
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business involves the administration of students, teachers,
# courses, progr... | uclouvain/osis | infrastructure/tests/shared_kernel/academic_year/repository/in_memory/test_academic_year.py | Python | agpl-3.0 | 2,533 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 ... | wevoice/wesub | apps/auth/admin.py | Python | agpl-3.0 | 5,591 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-configure
# Author : Ricardo Graciani
########################################################################
"""
Main script to write dirac.cfg for a new DIRAC installation and initial downl... | miloszz/DIRAC | Core/scripts/dirac-configure.py | Python | gpl-3.0 | 19,484 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | marionleborgne/nupic.research | htmresearch/algorithms/faulty_temporal_memory_shim.py | Python | agpl-3.0 | 4,869 |
import argparse
import os
import json
import collections
from subprocess import call
parser = argparse.ArgumentParser(description='CUE!')
options = parser.add_argument_group('Options')
options.add_argument('-p', '--project',
help='Specify the target project for the task',
requ... | josephdwyer/cue | cue.py | Python | mit | 8,972 |
#!/usr/bin/env python
import json
import os
import re
import pprint
import gerritlib.gerrit
from launchpadlib import launchpad
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
GERRIT_USER = "johngarbutt"
"""
Blueprints
lp_attributes
['self_link', 'web_link', 'resource_type_link', 'http_etag', 'date_complet... | JohnGarbutt/gerrit-bp-lp | poc.py | Python | apache-2.0 | 11,468 |
#!/usr/bin/python
__author__ = 'wangwei'
# +----+----------+---------+-----------+
# | id | parentId | osName | osVersion |
# +----+----------+---------+-----------+
# | 2 | 0 | iOS | 0 |
# | 11 | 2 | iOS | 4.x |
# | 12 | 2 | iOS | 5.x |
# | 13 | 2 | iOS ... | sdgdsffdsfff/traffic_prediction | hadoop/pig/test/test_combine_udf2.py | Python | mit | 3,471 |
from django.utils import unittest
from ..list import CassandraList
import time
class TestList(CassandraList):
pass
class CassandraListTest(unittest.TestCase):
def setUp(self):
TestList.sync(destructive=True)
self.seq = TestList("Test")
def tearDown(self):
self.seq.delete()
... | wehriam/Cassorm | cassorm/tests/list.py | Python | mit | 2,414 |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
"""Use VTK to display an HMatrix graphically.
"""
import logging
import optparse
import sys
import vtk
import random
from hmat_json_parser import *
from vtk_utils import *
def badLeaves(hmat):
"""Return a list of big, badly-compressed Rk leaves.
"""
# leav... | BenoitLBen/runtime | tools/display_tree.py | Python | mit | 9,511 |
from mpf.system.modes import Mode
class TimeRift(Mode):
def mode_init(self):
pass
def mode_stop(self):
self.machine.events.post('return_to_mission_control')
| GabeKnuth/STTNG | modes/time_rift/code/time_rift.py | Python | mit | 191 |
# Copyright 2012 - 2013 Zarafa B.V.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the Free Software Foundation with the following additional
# term according to sec. 7:
#
# According to sec. 7 of the ... | zarafagroupware/zarafa-zsm | webservice/apiapp/models_ldap.py | Python | agpl-3.0 | 14,422 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ZipFolder
# Creates a zip file containing all files within the specified folder and returns a link to the new compressed file.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under... | jordanemedlock/psychtruths | temboo/core/Library/Box/Folders/ZipFolder.py | Python | apache-2.0 | 4,787 |
class Appl(object):
"""docstring for MC"""
def __init__(self, expa_id=0,espo_id=0,person_id = 0, op_id = 0,person_lc_id = 0, op_lc_id = 0):
super(Appl, self).__init__()
self.expa_id = expa_id
self.espo_id = espo_id
self.person_id = person_id
self.op_id = op_id
self.person_lc_id = person_lc_id
self.op_lc... | AIESECMX/ESPO_EXPA_CRM | Model/application.py | Python | mit | 340 |
"""
Problem 3:
Write a program to remove duplicate elements in an array.
Example:
Enter array size : 5
Enter 5 array element : 11 13 11 12 13
Original array is : 11 13 11 12 13
New array is : 11 13 12
"""
from __future__ import print_function
def remove_duplicate(array):
unique_list = []
for i in array:
if ... | ankitjavalkar/algosutra | wayve_task/prob3.py | Python | gpl-2.0 | 562 |
from enum import unique, Enum
@unique
class ExtractionType(Enum):
histogram = "histogram"
simpleHistogram = "simpleHistogram"
edge = "edge"
edgeim = "edgeim"
@unique
class CharactersAlgorithm(Enum):
dtw = "dtw"
nw = "nw"
| Miiha/FilmAnalyzerKit | analyzer/constants.py | Python | mit | 231 |
import time
class TimerError(Exception):
"""A custom exception used to report errors in use of Timer class"""
class Timer:
def __init__(self):
self._start_time = None
def start(self):
"""Start a new timer"""
if self._start_time is not None:
raise TimerError("Timer is... | HPC-buildtest/buildtest-framework | buildtest/utils/timer.py | Python | mit | 721 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext as _
class NameMi... | suutari-ai/shoop | shuup/core/utils/name_mixin.py | Python | agpl-3.0 | 762 |
#! /usr/bin/env python
#Just print a sorted list of sequence numbers per PHYLIP-formatted alignment/sequence file
from Bio import SeqIO
import os
seqs_per_fam = []
a = 0
b = 0
c = 0
decent_length = 0
alignments = [file for file in os.listdir(".") if file.endswith(".phy")]
for file in alignments:
decent_length... | Tancata/phylo | sgts/check_alignment_sequence_numbers.py | Python | mit | 1,126 |
# Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files ... | Asana/boto | boto/ec2/connection.py | Python | mit | 178,701 |
from django.contrib import admin
# Register your models here.
from .models import About, Database, File, Sample, SampleType, TeamMember
# Allow Admin Users to set the type of multiple Samples at once
def MarkAsMineralType(modelAdmin, request, queryset):
queryset.update(sample_type=SampleType.objects.get(pk='Minera... | kyledmellander/spectroscopy | src/mars/admin.py | Python | mit | 3,390 |
# Copyright 2013 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 requir... | spandanb/horizon | openstack_dashboard/dashboards/admin/domains/tables.py | Python | apache-2.0 | 6,137 |
import os
import pyuca
unicode_collator = None
def set_unicode_collator(file):
global unicode_collator
unicode_collator = pyuca.Collator(file)
set_unicode_collator(os.path.join(os.path.dirname(__file__), 'allkeys.txt'))
| ccpgames/eve-metrics | web2py/gluon/contrib/pyuca/__init__.py | Python | mit | 241 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
This script converts Finnish TSV-formatted lexicon to lexc format, given that
they contain at least following information for each word (i.e. at least two
fields per line):
* the word lemma or the dictionary form
* the word inflection classification in one of th... | redox-alpha/omorfi | src/python/generate-kotus-sanalista.py | Python | gpl-3.0 | 4,913 |
"""
Copyright (c) 2011, Mihail Szabolcs
All rights reserved.
See LICENSE for more information.
"""
from sandbox.rendertarget import RenderTarget
from sandbox.shader import Shader
from sandbox.texture import Texture
from sandbox.meshquad import MeshQuad
class PostProcess:
def __init__(self, w=1024, h=1024):
self... | icebreaker/pyGLox | demo/postprocess.py | Python | mit | 1,309 |
import sys
import yaml
import click
def load_yaml(fh_or_string):
return yaml.safe_load(fh_or_string)
def dump_yaml(obj):
return yaml.dump(obj, default_flow_style=False)
def edit_yaml(content='', footer=''):
MARKER = '# Everything below is ignored\n\n'
message = click.edit(content + '\n\n' + MARKER... | yougov/rapt | rapt/util.py | Python | bsd-3-clause | 981 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import api, SUPERUSER_ID
import logging
_logger = logging.getLo... | adhoc-dev/odoo-argentina | l10n_ar_ux/hooks.py | Python | agpl-3.0 | 859 |
import argparse
import em.tools.input_output as IO
def register_parser(subparsers):
parser = subparsers.add_parser('extract', usage=usage(), description=description())
add_arguments(parser)
def add_arguments(parser):
parser.add_argument("--input", metavar="FILE", help="Input File.", required=True)
... | noelcjr/EntropyMaxima | em/subscripts/extract.py | Python | gpl-3.0 | 1,764 |
"""
WSGI config for utsu project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | tosfan4ever/hacktheplanet | config/wsgi.py | Python | bsd-3-clause | 1,616 |
# PostgreSQL
# Recommended way to run PostgreSQL:
# $ docker run --rm --name ukbrest_pg \
# -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test \
# -e POSTGRES_DB=ukb -p 5432:5432 postgres:9.6
POSTGRESQL_ENGINE='postgresql://test:test@localhost:5432/ukb'
# SQLite
SQLITE_ENGINE='sqlite:///tmp.db'
| miltondp/ukbrest | tests/settings.py | Python | gpl-3.0 | 309 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# node.py
"""
Represents a node in a subsystem. Each node has a unique index, its position
in the network's list of nodes.
"""
import functools
import numpy as np
from . import utils
# TODO extend to nonbinary nodes
@functools.total_ordering
class Node:
"""A node... | rlmv/pyphi | pyphi/node.py | Python | gpl-3.0 | 6,795 |
# 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... | jiajiechen/mxnet | python/mxnet/gluon/contrib/__init__.py | Python | apache-2.0 | 896 |
"""
Classes used for defining and running nose test suites
"""
import os
from pavelib.utils.test import utils as test_utils
from pavelib.utils.test.suites.suite import TestSuite
from pavelib.utils.envs import Env
try:
from pygments.console import colorize
except ImportError:
colorize = lambda color, text: text... | Livit/Livit.Learn.EdX | pavelib/utils/test/suites/nose_suite.py | Python | agpl-3.0 | 7,336 |
__all__ = [
'__title__',
'__package_name__',
'__version__',
'__summary__',
'__keywords__',
'__author__',
'__email__',
'__author__',
'__license__',
'__url__',
'__copyright__',
]
__title__ = 'Github Lines of Code'
__package_name__ = 'githubloc'
__version__ = '0.2.2'
__summary_... | z/github-loc | githubloc/__about__.py | Python | mit | 622 |
from config.buildings.spsc import *
DIRECTORY_SLUG = 'spsc-south'
DIRECTORY_LOCATION = 'South'
ORIENTATION_SLUG = 'south'
DEFAULT_FLOOR = 'lower-level'
PLACEMENT = 'lower-level'
ANALYTICS = ''
ORIGIN = {
'x': 381,
'y': 205,
}
| umnsuaweb/touch-directory-software | config/spsc_south.py | Python | mit | 237 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Pretty-printer for simple trace backend binary trace files
#
# Copyright IBM, Corp. 2010
#
# Portions copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level ... | BCLinux/qga-bc | qemu-kvm-0.12.1.2/scripts/simpletrace.py | Python | gpl-2.0 | 10,837 |
from __future__ import annotations
import dataclasses
import enum
import io
import secrets
import struct
from typing import Callable, Generator, Optional, Sequence, Tuple
from . import exceptions, extensions
from .typing import Data
try:
from .speedups import apply_mask
except ImportError: # pragma: no cover
... | aaugustin/websockets | src/websockets/frames.py | Python | bsd-3-clause | 12,229 |
"""The tests for mqtt camera component."""
import asyncio
import unittest
from homeassistant.setup import async_setup_component
from tests.common import (
get_test_home_assistant, mock_mqtt_component, get_test_instance_port)
import requests
SERVER_PORT = get_test_instance_port()
HTTP_BASE_URL = 'http://127.0.0.... | JshWright/home-assistant | tests/components/camera/test_mqtt.py | Python | apache-2.0 | 1,475 |
'''
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/test/python/unitTests.py | Python | apache-2.0 | 11,372 |
# testing/assertsql.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import collections
import contextlib
import re
from .. import event
from .. im... | graingert/sqlalchemy | lib/sqlalchemy/testing/assertsql.py | Python | mit | 13,674 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'FacebookProfile.polls'
db.add_column(u'socialplatform_facebookprofile', 'polls',
... | tekton/DocuCanvas | socialplatform/migrations/0005_auto__add_field_facebookprofile_polls.py | Python | gpl-3.0 | 7,753 |
import cgi
import codecs
import re
from io import BytesIO
from django.conf import settings
from django.core import signals
from django.core.handlers import base
from django.http import HttpRequest, QueryDict, parse_cookie
from django.urls import set_script_prefix
from django.utils.encoding import force_text, repercent... | camilonova/django | django/core/handlers/wsgi.py | Python | bsd-3-clause | 8,053 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Domain'
db.create_table(u'entities_domain', (
(u'id', self.gf('django.db.models.... | zbyufei/open-budgets | openbudget/apps/entities/migrations/0001_initial.py | Python | bsd-3-clause | 11,598 |
# -*- test-case-name: foolscap.test.test_crypto -*-
available = False # hack to deal with half-broken imports in python <2.4
from OpenSSL import SSL
# we try to use ssl support classes from Twisted, if it is new enough. If
# not, we pull them from a local copy of sslverify. The funny '_ssl' import
# stuff is used to... | pexip/os-foolscap | foolscap/crypto.py | Python | mit | 4,123 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, Float, ForeignKey, DateTime
from open_weather_forecast.conf.constants import WEATHER_DATE_FORMAT
Base = declarative_base()
class Temperature(Base):
__tablename__ = 'temperature'... | enanablancaynumeros/OpenWeatherForecast | open_weather_forecast/info_extractor/forecast/forecast_weather_info.py | Python | mit | 1,112 |
"""Scrapes the General MIDI Wikipedia article for a list of
instrument types and outputs a list of instrument tuples.
Needs the 'wikipedia' library.
"""
import wikipedia
import string
print("instruments = [")
gmidi = wikipedia.page("General MIDI")
last_header = "broken lol"
for line in gmidi.content.split("\n"):
... | milkey-mouse/swood | get_instruments.py | Python | mit | 1,302 |
##
# Copyright 2015 Bart Oldeman
#
# This file is triple-licensed under GPLv2 (see below), MIT, and
# BSD three-clause licenses.
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish ... | hpcugent/easybuild-framework | easybuild/toolchains/nvhpc.py | Python | gpl-2.0 | 1,867 |
from cls_method_decorators import debugmethods
class metatype(type):
def __new__(cls, cls_name, bases, cls_dict):
clsobj = super().__new__(cls, cls_name, bases, cls_dict)
clsobj = debugmethods(clsobj)
return clsobj
class Animal(metaclass = metatype):
def __init__(self, name):
... | kmad1729/python_notes | metaprogramming/practice_code/metatype_demo.py | Python | unlicense | 583 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.