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 |
|---|---|---|---|---|---|
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as f:
readme = f.read()
setup(
name="pyi",
version="0.1.0",
description='',
long_description=readme,
author="Johan Andersson",
author_email="Grokzen@gmail.com",
maintai... | Grokzen/pyi | setup.py | Python | mit | 1,398 |
"""
shapefile.py
Provides read and write support for ESRI Shapefiles.
author: jlawhead<at>nvs-inc.com
date: 20110303
version: 1.0.1
"""
from struct import pack, unpack, calcsize, error
import os
import time
import array
#
# Constants for shape types
NULL = 0
POINT = 1
POLYLINE = 3
POLYGON = 5
MULTIPO... | kyleconroy/bitewise | tools/shapefile.py | Python | mit | 28,903 |
# pylint: skip-file
class GCPResource(object):
'''Object to represent a gcp resource'''
def __init__(self, rname, rtype, project, zone):
'''constructor for gcp resource'''
self._name = rname
self._type = rtype
self._project = project
self._zone = zone
@property
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/lib/gcpresource.py | Python | apache-2.0 | 683 |
import collections
import importlib
import inspect
import types
from typing import Any # noqa
from typing import Dict, List, Mapping, MutableMapping, Sequence, Set, Tuple, Union
import uqbar.graphs
import uqbar.strings
class InheritanceGraph:
"""
A builder of Graphviz inheritance graphs.
Here we build ... | josiah-wolf-oberholtzer/uqbar | uqbar/apis/InheritanceGraph.py | Python | mit | 24,048 |
# proxy module
from pyface.key_pressed_event import *
| enthought/etsproxy | enthought/pyface/key_pressed_event.py | Python | bsd-3-clause | 54 |
# encoding: UTF-8
"""
包含一些开发中常用的函数
"""
import os
import decimal
import json
import traceback
from datetime import datetime
from math import isnan
from six import text_type
#----------------------------------------------------------------------
def safeUnicode(value):
"""检查接口数据潜在的错误,保证转化为的字符串正确"""
# 检查是数字接近... | rrrrrr8/vnpy | vnpy/trader/vtFunction.py | Python | mit | 3,461 |
#!/usr/bin/python
#
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... | denis-vilyuzhanin/selenium-fastview | py/test/selenium/webdriver/common/element_attribute_tests.py | Python | apache-2.0 | 12,180 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math, wave, array, time
import sympy
import StringIO
import base64
from sympy.parsing.sympy_parser import parse_expr
import ast
import utils
def safeEval(s,x):
tree = ast.parse(s, mode='eval')
whitelist = (ast.Expression, ast.Call, ast.Name, ast.Load,
... | dittophantassy/accessicalc | audio.py | Python | mit | 4,872 |
# 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/.
from __future__ import unicode_literals
from datetime import datetime
import urllib
import jingo
from lib.l10n_utils.do... | ckprice/bedrock | bedrock/mozorg/helpers/social_widgets.py | Python | mpl-2.0 | 3,148 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name=<%= packageName %>,
version='0.1',
description=<%= packageDescription %>,
long_description=readme(),
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Langua... | mijdavis2/generator-pypi-master | generators/app/templates/setup.py | Python | mit | 861 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 25 15:23:49 2015
@author: chris
based on add_isosurface function from chemview
"""
import numpy as np
#TODO not making this a depedency until it works
try:
from skimage.measure import marching_cubes, correct_mesh_orientation
except ImportError:
pass
def get_isos... | chrisjsewell/PyGauss | pygauss/isosurface.py | Python | gpl-3.0 | 5,668 |
"""
==============================================
Scaling the regularization parameter for SVCs
==============================================
The following example illustrates the effect of scaling the
regularization parameter when using :ref:`svm` for
:ref:`classification <svm_classification>`.
For SVC classificati... | jmschrei/scikit-learn | examples/svm/plot_svm_scale_c.py | Python | bsd-3-clause | 5,415 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010 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
#
# ... | yrobla/nova | nova/virt/xenapi/driver.py | Python | apache-2.0 | 32,943 |
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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 a... | ezbake/ezbake-common-python | thrift/thrift-utils/test/__init__.py | Python | apache-2.0 | 812 |
"""Handles migration of historical statistics CSV files to the database."""
import csv
import logging
import sys
import time
from contextlib import contextmanager
from datetime import datetime, timedelta
from .db import engine, sesh, _set_db_readonly, _set_db_writable
from .dbinfo import DbInfo, get_dbinfo
from .accou... | david-wm-sanders/rwrtrack | rwrtrack/migrate.py | Python | mit | 8,022 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | ilay09/keystone | keystone/tests/unit/fakeldap.py | Python | apache-2.0 | 24,274 |
# Copyright (c) 2015 Industrial Technology Research Institute.
# 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... | xuweiliang/Codelibrary | nova/virt/libvirt/volume/disco.py | Python | apache-2.0 | 2,464 |
# Plot CAV1 transcript/ratio eQTL
try:
import configparser
except ImportError:
import ConfigParser as configparser
import sys
import timeit
from collections import defaultdict
#from interval import Interval, IntervalSet
import re
import pandas as pd
from sklearn.decomposition import PCA
import matplotlib
impo... | jeffhsu3/genda | scripts/transcript_diff_plots.py | Python | bsd-3-clause | 14,548 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008, Frank Scholz <coherence@beebits.net>
class DimmingClient:
def __init__(self, service):
self.service = service
self.namespace = service.get_type()
self.url = service.get_control_url()
... | unintended/Cohen | coherence/upnp/services/clients/dimming_client.py | Python | mit | 1,163 |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 31 15:45:22 2016
@author: wang
"""
#from matplotlib import pylab as plt
#from numpy import fft, fromstring, int16, linspace
#import wave
from read_wav_xml_good_1 import*
from matrix_24_2 import*
from max_matrix_norm import*
import numpy as np
# open a wave file
filename... | daniel20162016/my-first | read_xml_all/calcul_matrix_je_le_qui_dans_de_192_matrix_good_compare_1.py | Python | mit | 31,494 |
# Copyright 2016 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 accompa... | VirtueSecurity/aws-extender | BappModules/s3transfer/copies.py | Python | mit | 13,258 |
# Copyright (C) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | teamfx/openjfx-9-dev-rt | modules/javafx.web/src/main/native/Tools/Scripts/webkitpy/common/net/credentials_unittest.py | Python | gpl-2.0 | 10,367 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
import os
import sys
import gettext
name = "hello"
this_dir = os.path.dirname(__file__)
this_dir = os.path.abspath(this_dir)
this_po_dir = os.path... | dmerejkowsky/qibuild | python/qilinguist/test/projects/hello/hello.py | Python | bsd-3-clause | 808 |
# -*- 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-debugger-client | google/cloud/debugger_v2/services/debugger2/client.py | Python | apache-2.0 | 38,336 |
# -*- coding: utf-8 -*-
import os
import errno
import stat
import unicodedata
import hashlib
import shutil
import logging
import config
class Fsdb(object):
"""File system database
expose a simple api (add,get,remove)
to menage the saving of files on disk.
files are placed under specified fs... | boyska/pyFsdb | fsdb/Fsdb.py | Python | lgpl-3.0 | 9,607 |
"""
WSGI config for job_scheduler_web project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("D... | ewerkema/job-scheduler | job_scheduler_web/job_scheduler_web/wsgi.py | Python | mit | 412 |
# Copyright 2018 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Stock Picking Whole Scrap',
'summary': 'Create whole scrap from a picking for move lines',
'version': '11.0.1.0.0',
'development_status': 'Beta',
'category': 'Warehouse',
'websi... | Domatix/stock-logistics-workflow | stock_picking_whole_scrap/__manifest__.py | Python | agpl-3.0 | 641 |
# -*- encoding: utf-8 -*-
"""
"""
import unittest
import time
class Case1(unittest.TestCase):
def test_success(self):
time.sleep(0.5)
self.assertEqual(1, 1)
def test_failure(self):
time.sleep(0.5)
self.assertEqual(1, 2)
@unittest.skip("because")
def test_skip(self):... | nicolasdespres/hunittest | hunittest/test_samples/testsamp_simple2.py | Python | bsd-2-clause | 468 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Hybpiper(Package):
"""HybPiper was designed for targeted sequence capture, in which DNA
sequencing libra... | iulian787/spack | var/spack/repos/builtin/packages/hybpiper/package.py | Python | lgpl-2.1 | 1,438 |
"""Bulk importer for manually-prepared tariff CSV.
This probably won't be used again following initial data load, so
could be deleted after that.
"""
import csv
import logging
from datetime import datetime
from django.core.management.base import BaseCommand
from django.db import transaction
from dmd.models import ... | annapowellsmith/openpresc | openprescribing/dmd/management/commands/bulk_import_drug_tariff.py | Python | mit | 2,479 |
from polyphony import testbench
class C:
def __init__(self):
self.v1 = 0
self.v2 = 0
def set_v(self, i, v):
if i == 0:
pass
elif i == 1:
self.v1 = v
elif i == 2:
self.v2 = v
else:
return
def if23():
c = C()
... | ktok07b6/polyphony | tests/if/if23.py | Python | mit | 439 |
# -*- coding: utf-8 -*-
{
'name': "Saas Portal Sale Online",
'author': "IT-Projects LLC, Ildar Nasyrov",
'license': 'LGPL-3',
'website': "https://twitter.com/nasyrov_ildar",
'category': 'SaaS',
'version': '1.0.0',
'depends': ['website_sale', 'saas_portal', 'saas_portal_sale', 'website_sale_r... | tarzan0820/odoo-saas-tools | saas_portal_sale_online/__openerp__.py | Python | lgpl-3.0 | 411 |
#! /usr/bin/python3
"""
Datastreams are identified by the address that publishes them, and referenced
in transaction outputs.
For CFD leverage, 1x = 5040, 2x = 10080, etc.: 5040 is a superior highly
composite number and a colossally abundant number, and has 1-10, 12 as factors.
All wagers are in XCP.
Expiring a bet... | mrMuffins/dogepartyd | lib/bet.py | Python | mit | 18,713 |
#!/usr/bin/env python3
import logging
import math
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
FairseqEncoder,
... | pytorch/fairseq | fairseq/models/speech_to_text/convtransformer.py | Python | mit | 16,567 |
class Solution(object):
def removeInvalidParentheses(self, s):
"""
:type s: str
:rtype: List[str]
"""
| xingjian-f/Leetcode-solution | 301. Remove Invalid Parentheses.py | Python | mit | 146 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-09 14:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AddField(
... | pennomi/brimstone-website | apps/accounts/migrations/0002_user_image.py | Python | agpl-3.0 | 458 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
from indico.core import signals
from indico.core.db import db
from .logger import logger
from ... | indico/indico | indico/core/oauth/__init__.py | Python | mit | 1,252 |
# -*- coding: utf-8 -*-
from gentoobootstrap.storage.filesystem import FilesystemStorage
def get_impl(type, **kwargs):
return get_impl_class(type)(**kwargs)
def get_impl_class(type):
if type == "lvm":
from gentoobootstrap.storage.lvm import LVMStorage
return LVMStorage
elif type == 'filesystem':
return Fil... | ercpe/gentoo-bootstrap | src/gentoobootstrap/storage/__init__.py | Python | gpl-2.0 | 399 |
from rest_framework.generics import get_object_or_404
from rest_framework.settings import api_settings
class PaginatedViewMixin:
pagination_class = api_settings.DEFAULT_PAGINATION_CLASS
@property
def paginator(self):
"""
The paginator instance associated with the view, or `None`.
... | ESSolutions/ESSArch_Core | ESSArch_Core/mixins.py | Python | gpl-3.0 | 2,258 |
#!/usr/bin/python
# Check that two transients on the same level maintain their order.
# (Written for NB#177840)
#* Test steps
# * show an application window
# * create and show a window that is transient for the application
# * create and show a window that is transient for the application
# * check that the tran... | nemomobile-graveyard/mcompositor | tests/functional/test18.py | Python | lgpl-2.1 | 2,859 |
# Longest Common Prefix
#
# Write a function to find the longest common prefix string amongst an array of strings.
debug = True
debug = False
# from CommonClasses import * # hxl: comment out this line for submission
class Solution:
# @return a string
def longestCommonPrefix(self, str... | 54lihaoxin/leetcode_python | src/LongestCommonPrefix/solution.py | Python | apache-2.0 | 808 |
# -*- coding: utf-8 -*-
"""
Django settings for SIS project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.jo... | delphcf/sis | sis/config/common.py | Python | bsd-3-clause | 10,568 |
# coding=utf-8
import time
from datetime import date
from api_service import ApiService
class EtvnetService(ApiService):
PER_PAGE = 15
API_URL = 'https://secure.etvnet.com/api/v3.0/'
USER_AGENT = 'Plex User Agent'
AUTH_URL = 'https://accounts.etvnet.com/auth/oauth/'
CLIENT_ID = "a332b9d61df7254... | shvets/Etvnet.bundle | Contents/Code/etvnet_service.py | Python | mit | 11,660 |
from rest_framework import serializers as ser
from rest_framework.exceptions import PermissionDenied, NotFound
from api.base.exceptions import RelationshipPostMakesNoChanges, NonDescendantNodeError
from api.base.serializers import (
JSONAPISerializer, IDField, RelationshipField,
JSONAPIRelationshipSerializer, ... | pattisdr/osf.io | api/view_only_links/serializers.py | Python | apache-2.0 | 4,816 |
import copy
import pandas as pd
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import Legend, Span
# from bokeh.models import HoverTool
from ..utils import in_ipynb
from .plotobj import BasePlot
from .plotutils import get_color
_INITED = False
class BokehPlot(BasePlot):
def __init__(s... | timkpaine/lantern | lantern/plotting/plot_bokeh.py | Python | apache-2.0 | 5,812 |
"""
misc code related to HTML generation and templating
"""
# start out this way so tests will import the local swhlab module
import sys
import os
sys.path.insert(0,os.path.abspath('../../'))
import swhlab
# now import things regularly
import tempfile
import webbrowser
#import common
stylesheet="""
body{
font-f... | swharden/SWHLab | swhlab/indexing/style.py | Python | mit | 2,451 |
def resource_goal(resource, player, game, market, tiles, rivals):
""" Resource stock goals for production and trade phases
"""
if resource == 'water':
water_goal = 2 # one expects to expand at least 1 tile each turn + one for activation
player_tiles = [tile for tile in tiles if tile['owne... | PiotrZakrzewski/steamweb | bots/resource_plan.py | Python | mit | 1,137 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015-2017 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 versio... | fabian-paul/PyEMMA | pyemma/thermo/estimators/DTRAM_estimator.py | Python | lgpl-3.0 | 14,367 |
from .ao_integrals import AOIntegrals, ao2mo
from .mo_integrals import FCIDUMP
from .mo_integrals import load as load_fcidump
from .fcidump_generator import generate_fcidump
| orbkit/orbkit | orbkit/libcint_interface/__init__.py | Python | lgpl-3.0 | 174 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | SCgeeker/OpenSesame | libqtopensesame/extensions/__init__.py | Python | gpl-3.0 | 818 |
#!/usr/bin/env python
import sys
# For debug, preference local install over all else
if "DEBUG" in sys.argv:
sys.path.insert(0, "../../")
sys.path.insert(0, "../")
sys.path.insert(0, ".")
sys.argv.remove("DEBUG")
import unittest
import numpy
from . import test_transped_parser
from libgwas.data_parser ... | torstees/MVtest | meanvar/tests/test_standardization.py | Python | gpl-3.0 | 10,411 |
#!/usr/bin/env python
# Just handle unary rules, working out when one is being used
import re
import category
# from, to, keep original dependencies, activated by extra flag
UNARIES = [
('S[adj]\NP','NP\NP',False,False,[
'(ADJP 0)',
'(NP {1} 0) arg:(NP PP ...):',
'(NP 1 0) arg:default:']),
('S[to]\NP','NP\NP'... | malcolmgreaves/berkeley-ccg2pst | rule.py | Python | isc | 11,966 |
#!/usr/bin/env python
import sys
import re
import pickle
import json
from pyPgSQL import PgSQL, libpq
from bsddb import dbshelve
# bsddb.dbshelve
from clue import *
from pprint import pprint
# Remember to run initdb with locale setting no_NO.UTF-8
if __name__ == '__main__':
fnames = glob.glob('/media/data1/cl... | emnh/clue2 | tojson.py | Python | gpl-2.0 | 2,263 |
from kivy.uix.popup import Popup
from kivy.uix.widget import Widget
from kivy.uix.colorpicker import ColorPicker
from kivy.app import App
from kivy.properties import ListProperty
col = [0,0,1,1]
class SelectedColorEllipse(Widget):
selected_color = ListProperty(col)
class ColPckr(ColorPicker):
pass
class ColP... | PictureYo-self/Picture-Yo-self | code/useless/ex40.py | Python | gpl-2.0 | 871 |
def create_test_spatial_db(verbosity=1, autoclobber=False):
"A wrapper over the MySQL `create_test_db` method."
from django.db import connection
connection.creation.create_test_db(verbosity, autoclobber)
| CollabQ/CollabQ | vendor/django/contrib/gis/db/backend/mysql/creation.py | Python | apache-2.0 | 217 |
"""
SecureTranport support for urllib3 via ctypes.
This makes platform-native TLS available to urllib3 users on macOS without the
use of a compiler. This is an important feature because the Python Package
Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL
that ships with macOS is not capable... | momm3/WelcomeBot | welcomebot/Lib/site-packages/urllib3/contrib/securetransport.py | Python | mit | 30,369 |
# Generated by Django 2.2.24 on 2021-10-28 18:15
from django.db import migrations, models
import django.db.models.deletion
def populate_project(apps, schema_editor):
MetricThreshold = apps.get_model('core', 'MetricThreshold')
for threshold in MetricThreshold.objects.filter().prefetch_related('environment__pr... | Linaro/squad | squad/core/migrations/0160_add_project_to_metricthreshold.py | Python | agpl-3.0 | 2,142 |
#
# IBot.py
#
# @author Alain Rinder
# @date 2017.06.02
# @version 0.1
#
from src.player.IPlayer import *
class IBot(IPlayer):
def __str__(self):
return "[BOT] %s (%s)" % (self.name, self.color.name) | alainrinder/quoridor.py | src/player/IBot.py | Python | mit | 240 |
# -*- coding:utf-8 -*-
'''
Title: Infrastructure NetworkAPI
Author: globo.com / TQI
Copyright: ( c ) 2009 globo.com todos os direitos reservados.
'''
from networkapiclient.GenericClient import GenericClient
from networkapiclient.EspecificacaoGrupoVirtual import EspecificacaoGrupoVirtual
class GrupoVirtual(GenericC... | globocom/GloboNetworkAPI-client-python | networkapiclient/GrupoVirtual.py | Python | apache-2.0 | 5,615 |
# flake8: noqa
from __future__ import absolute_import
from .test_admin import AdminTest
from .test_models import ModelTest
from .test_views import ViewTest
| ixc/plata | tests/testapp/tests/__init__.py | Python | bsd-3-clause | 158 |
import functools
import heapq
def merge(*iterables, key=None):
"""
Merge multiple sorted iterables into a single sorted iterable.
Requires each sequence in iterables be already sorted with key, or by value if key not present.
:param iterables: Iterable objects to merge
:param key: optional, callab... | GravityJack/keyed-merge | keyed_merge/merge.py | Python | mit | 880 |
# Copyright 2007-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import time
from portage import os
from portage.versions import best, catsplit, vercmp
from portage.dep import Atom
from portage.localization import _
from portage._sets.base import PackageSet
from portage._sets... | funtoo/portage-funtoo | pym/portage/_sets/dbapi.py | Python | gpl-2.0 | 14,231 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 Softwa... | shaggytwodope/qutebrowser | tests/end2end/features/test_search_bdd.py | Python | gpl-3.0 | 1,047 |
###############################################################################
# Name: syntax.py #
# Purpose: Manage and dynamically load/provide syntax on request from editor. #
# Also manages the mappings of file extensions to lexers. #
... | robmcmullen/peppy | editra.in/syntax/syntax.py | Python | gpl-2.0 | 11,408 |
#
# 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... | DinoCow/airflow | tests/providers/apache/hive/hooks/test_hive.py | Python | apache-2.0 | 34,397 |
#!/usr/bin/env python
"""
Tests for geneve tool.
"""
import json
import os.path
import pytest
from eve.io.mongo import Validator
from evegenie import EveGenie
test_data = {
'user': {
'name': 'Turtle Man',
'age': 71,
'alive': True,
'title': 'Champion of Sea Dwellers',
'inve... | nicolaiarocci/evegenie | egtest.py | Python | mit | 4,717 |
"""Classes for filtering discrete time signals."""
import numpy as np
class FirstOrderLowpassFilter(object):
def __init__(self, fc, dt, x1=0):
self.kf = 2 * np.pi * fc * dt / (1 + 2 * np.pi * fc * dt)
self.x1 = x1
def __call__(self, x):
self.x1 = (1 - self.kf) * self.x1 + self.kf * x
# If previo... | damienstanton/nanodegree | selfdriving_vehicle/openpilot/common/filters.py | Python | mit | 420 |
import unittest
from ts3 import TS3Proto
class TS3ProtoTest(unittest.TestCase):
""" Tests the TS3Proto class """
def setUp(self):
self.ts3 = TS3Proto()
def testCharacterEscaping(self):
teststr = '|/ abcdefg| |'
expected = r'\p\/\sabcdefg\p\s\p'
res = self.ts3._escape_st... | DownGoat/ts3_watcher | ts3/test.py | Python | mit | 3,629 |
import sys
import unittest
from datetime import datetime
import mock
from libcloud.common.aws import AWSRequestSignerAlgorithmV4
from libcloud.common.aws import SignedAWSConnection
from libcloud.common.aws import UNSIGNED_PAYLOAD
from libcloud.test import LibcloudTestCase
class EC2MockDriver(object):
region_nam... | cryptickp/libcloud | libcloud/test/common/test_aws.py | Python | apache-2.0 | 12,680 |
#! /usr/bin/env python3
"""Get historical status data as a CSV file
Walks the Git history of the repo, loading each revision where data/ changed,
and recording the number of packages for each status.
When an existing data file is specified with --update, the file is repeated,
with commits that aren't in it appended.
... | irushchyshyn/portingdb | scripts/get-history.py | Python | mit | 5,840 |
# -*- coding: utf-8 -*-
"""
Presence analyzer unit tests.
"""
# pylint: disable=maybe-no-member, too-many-public-methods, invalid-name
from datetime import datetime, date, timedelta
import os.path
import unittest
from unittest.mock import patch
from .main import app, db, mail
from . import main, utils
from .fixtures ... | pdyba/lunch-app | src/lunch_app/tests.py | Python | mit | 35,088 |
# 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/.
from __future__ import unicode_literals
import os
import unittest
from collections import defaultdict
from shutil impo... | kostaspl/SpiderMonkey38 | python/mozbuild/mozbuild/test/backend/common.py | Python | mpl-2.0 | 3,692 |
# Copyright 2016 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... | thjashin/tensorflow | tensorflow/contrib/distributions/python/ops/dirichlet.py | Python | apache-2.0 | 10,591 |
# -*- coding: utf-8 -*-
import pytz
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):
# Create a composite index of course_id and topic_id.
db.crea... | zofuthan/edx-platform | lms/djangoapps/teams/migrations/0005_add_course_id_and_topic_id_composite_index.py | Python | agpl-3.0 | 5,931 |
#!/usr/bin/env python
import cgi, cgitb, json, hashlib, os, io, sys, subprocess
form = cgi.FieldStorage()
id = form.getvalue('id')
allowed_chars = set('0123456789abcdefABCDEF')
id_set = set(list(id))
if not id_set.issubset(allowed_chars):
print 'Content-type:application/json'
print
print json.dumps(id)
... | alexpreynolds/cubemaker | services/export_gif.py | Python | gpl-2.0 | 705 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import medicinalproductundesirableeffect
from .fhirdate import FHIRDate
class MedicinalProductUndesirableEffectTests(unittest.TestCa... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/medicinalproductundesirableeffect_tests.py | Python | bsd-3-clause | 2,539 |
#!/usr/bin/env python
"""
Automate runs of GAMS based advanced power models
NOT COMPLETE. STILL MIGRATING FROM RELATED TOOLS
"""
__author__ = "Bryan Palmintier (b_p [at] mit [dot] edu)"
__copyright__ = "Copyright (c) 2011 Bryan Palmintier"
__license__ = "GPLv3.0"
## ===== History ====
# ver date time w... | bpalmintier/mepo | models/util/gams_runs_to_sql.py | Python | bsd-3-clause | 7,180 |
"""
Script that trains graph-conv models on Tox21 dataset.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
from deepchem.molnet import load_to... | Agent007/deepchem | examples/tox21/tox21_tensorgraph_graph_conv.py | Python | mit | 1,183 |
import sys
from os import path
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog
from PyQt5.uic import loadUi
app = QApplication(sys.argv)
from maestro.core.config import Project
from maestro.gui.spectro import spectro
from maestro.gui.calibrator import calibrator
class MainWindow(QMainWindow):
def... | urosjarc/maestro | maestro/gui/main.py | Python | mit | 978 |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i, h2o_browse as h2b
def write_syn_dataset(csvPathname, rowCount, headerData, rowData):
dsf = open(csvPathname, "w+")
dsf.write(headerData + "\n")
for i in range(rowCount):
dsf.write(rowData + ... | 111t8e/h2o-2 | py/testdir_multi_jvm/test_parse_fs_schmoo_fvec.py | Python | apache-2.0 | 2,232 |
#!/usr/bin/env python
'''
This widget can be used to show small popup windows showing messages.
Copyright 2012 Norbert Schechner
nieson@web.de
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 Sof... | cdsteinkuehler/MachineKit | share/gscreen/skins/gmoccapy/python/notification.py | Python | lgpl-2.1 | 10,710 |
"""Setup for IIIF Image Library implementation."""
from setuptools import setup, Command
import os
# setuptools used instead of distutils.core so that
# dependencies can be handled automatically
# Extract version number from iiif/_version.py. Here we are very strict
# about the format of the version string as an extra... | zimeon/iiif | setup.py | Python | gpl-3.0 | 3,464 |
#!/usr/bin/env python
"""Grover's quantum search algorithm example."""
from sympy import pprint
from sympy.physics.quantum import qapply
from sympy.physics.quantum.qubit import IntQubit
from sympy.physics.quantum.grover import (OracleGate, superposition_basis,
WGate, grover_iteration)
def demo_vgate_app(v):... | kaushik94/sympy | examples/advanced/grover_example.py | Python | bsd-3-clause | 2,081 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__authors__ = 'Bruno Adelé <bruno@adele.im>'
__copyright__ = 'Copyright (C) 2013 Bruno Adelé'
__description__ = """A plugins for serialkiller project"""
__license__ = 'GPL'
__version__ = '0.0.2'
from skplugins.checker import checker
import pyping
class ping(checker):
... | badele/serialkiller-plugins | skplugins/checker/network/ping.py | Python | gpl-3.0 | 1,675 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/nspkg/azure-nspkg/setup.py | Python | mit | 1,956 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import pymongo
path_to_23adnme_snps = '/Users/numa/Dropbox/py/perGENIE/pergenie/data/large_dbs/23andme-api/snps.data' # FIX to path of yours.
def import_23andme_snps():
print >>sys.stderr, 'Importing 23andMe SNPs...'
with pymongo.MongoClient() as c:... | knmkr/perGENIE | pergenie/lib/mongo/import_23andme_table.py | Python | agpl-3.0 | 1,593 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-10 21:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('competences', '0001_initial'),
('utilisateurs', 'm... | nils-van-zuijlen/arbre_competences | competences/migrations/0002_auto_20180410_2311.py | Python | gpl-3.0 | 789 |
from pygame.time import Clock
from events import TickEvent, QuitEvent
class CPUSpinnerController:
""" Keeps the program running until notified of a QuitEvent """
def __init__(self, evManager):
self.evManager = evManager
self.evManager.RegisterListener( self )
self.clock = Clock()
... | sentientWilder/Pygame-Demo | CPUSpinnerController.py | Python | mit | 785 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2016 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | kannon92/psi4 | psi4/driver/qcdb/molecule.py | Python | gpl-2.0 | 49,030 |
#!/usr/bin/env python
import functools
from amplify.requesthandler import RequestHandler, ThreadingHTTPServer
class Application:
requesthandler = RequestHandler
httpserver = ThreadingHTTPServer
def __init__(self, import_name):
self.url_map = {}
def route(self, url):
def decorator(fu... | DrMegahertz/amplify | src/amplify/application.py | Python | bsd-3-clause | 862 |
from __future__ import absolute_import
import click
from datasciencebox.cli.main import cli, default_options
@cli.group(short_help='Install packages, applications and more')
@click.pass_context
def install(ctx):
pass
@install.command('miniconda', short_help='Install miniconda in the instances')
@click.option(... | danielfrg/datasciencebox | datasciencebox/cli/install.py | Python | apache-2.0 | 6,874 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | dokinkon/TalkyTalky | server/main.py | Python | apache-2.0 | 12,300 |
from subprocess import *
class HighlightPipe:
""" This Python package serves as interface to the highlight utility.
Input and output streams are handled with pipes.
Command line parameter length is validated before use."""
def __init__(self):
self.cmd = 'highlight'
self.src=''
self.options=dict()
self.suc... | ahmadaghazadeh/FastBook | src/FastBookCreator/highlight/examples/highlight_pipe.py | Python | mit | 1,290 |
from HomeSecurityModules.Firebase.firebase import Firebase
from HomeSecurityModules.HomeSecurity.home_security import HomeSecurity, STATUS_RUNNING, STATUS_STOPPED
from HomeSecurityModules.MotionDetector.motion_detector import MotionDetector
| gaborvecsei/Home-Security | HomeSecurityModules/__init__.py | Python | gpl-3.0 | 241 |
import numpy as np
import math
import sys
import os
#import psutil
from main_src.tools.resolve_partial_computing import *
from main_src.main_classes.General import *
from main_src.main_classes.KinematicDiffuse import *
from main_src.main_classes.Stream import *
import main_src.proces... | jerabekjak/smoderp | main_src/main_classes/Surface.py | Python | gpl-3.0 | 10,065 |
#!/usr/bin/env python3
# -!- encoding:utf8 -!-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# file: slack_log_handler.py
# date: 2017-09-23
# author: paul.dautry
# purpose:
# This class can be used to log events to a Slack channel.
# license:
# MapIF - Where are INSA ... | David-Wobrock/MapIf | core/classes/slack_log_handler.py | Python | gpl-3.0 | 4,347 |
#!/usr/bin/env python2
# Increase intervals from BED by N nucleotides, strand specific.
# USAGE: cat bed | bed2region.py 100000 > enlarged.bed
import os, sys
n = int(sys.argv[1])
for l in sys.stdin:
ldata = l[:-1].split('\t')
s, e = map(int, ldata[1:3])
strand = ldata[5]
#print ldata, (s,e,strand)
if str... | lpryszcz/bin | bed2region.py | Python | gpl-3.0 | 490 |
from numba import cuda
import numpy as np
from numba import unittest_support as unittest
from numba.cuda.testing import skip_on_cudasim, SerialMixin
import threading
class TestMultiGPUContext(SerialMixin, unittest.TestCase):
@unittest.skipIf(len(cuda.gpus) < 2, "need more than 1 gpus")
def test_multigpu_conte... | jriehl/numba | numba/cuda/tests/cudapy/test_multigpu.py | Python | bsd-2-clause | 3,302 |
#!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 18.10.2021
# Author: Moritz Smolka
# Contact: moritz.g.smolka@gmail.com
#
import os
import sys
import datetime
import argparse
from sniffles import util
VERSION="Sniffles2"
BUILD="2.0.2"
SNF_VERSION="S... | fritzsedlazeck/Sniffles | src/sniffles/config.py | Python | mit | 19,408 |
#!/usr/bin/env python
import os
import imp
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
sys.path.append(os.path.join('wsgi', 'openshift'))
#
# Below for running on localhost
#
if __name__ == '__main__':
ip = 'localhost'
port = 8051
zapp = imp.load_source('application', 'wsgi/application'... | coursemdetw/2015wcms | wsgi.py | Python | gpl-2.0 | 495 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.