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 |
|---|---|---|---|---|---|
# 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... | Thanu/product-private-paas | components/org.wso2.ppaas.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py | Python | apache-2.0 | 18,201 |
"""The tests for the MQTT discovery."""
from pathlib import Path
import re
import pytest
from homeassistant.components import mqtt
from homeassistant.components.mqtt.abbreviations import (
ABBREVIATIONS,
DEVICE_ABBREVIATIONS,
)
from homeassistant.components.mqtt.discovery import ALREADY_DISCOVERED, async_star... | mKeRix/home-assistant | tests/components/mqtt/test_discovery.py | Python | mit | 15,734 |
import abc
import os
import time
import lockfile
import numpy as np
from ParamSklearn.classification import ParamSklearnClassifier
from ParamSklearn.regression import ParamSklearnRegressor
from autosklearn.scores import libscores
from autosklearn.constants import *
try:
import cPickle as pickle
except:
imp... | paultopia/auto-sklearn | autosklearn/models/evaluator.py | Python | bsd-3-clause | 10,498 |
# -*- coding: utf-8 -*-
from datetime import datetime
panel_gene = dict(
hgnc_id=int, # required
symbol=str,
disease_associated_transcripts=list, # list of strings that represent refseq transcripts
reduced_penetrance=bool,
mosaicism=bool,
database_entry_version=str,
inheritance_models=lis... | Clinical-Genomics/scout | scout/models/panel.py | Python | bsd-3-clause | 703 |
import time
from plaid.model.depository_account_subtypes import DepositoryAccountSubtypes
from plaid.model.depository_account_subtype import DepositoryAccountSubtype
from plaid.model.country_code import CountryCode
from plaid.model.depository_filter import DepositoryFilter
from plaid.model.link_token_account_filters im... | plaid/plaid-python | tests/integration/test_link_token.py | Python | mit | 4,156 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... | nozuono/calibre-webserver | src/calibre/db/tests/add_remove.py | Python | gpl-3.0 | 13,268 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' implementations
This implementation is for svk. It is based on the svn implementation
"""
# Copyright (C) 2006 Holger Hans Peter Freyther
# Copyright (C) 2003, 2004 Chris Larson
#
# This program is free soft... | teamosceola/bitbake | lib/bb/fetch/svk.py | Python | gpl-2.0 | 3,667 |
# classification.py
import os
import pandas as pd
import numpy as np
# import seaborn as sns
import matplotlib.pyplot as plt
# from sklearn import manifold, svm, model_selection, tree, metrics, cluster, ensemble
# from sklearn.model_selection import GridSearchCV
from scipy.io import loadmat
from time import time
from ... | jskDr/jamespy_py3 | cell/classification.py | Python | mit | 11,443 |
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, ... | sippy/rtp_cluster | sippy_lite/sippy/Time/MonoTime.py | Python | bsd-2-clause | 7,750 |
class Song():
def __init__(self, title, artist, album, length, path):
self.title = title
self.artist = artist
self.album = album
self.length = length
self.path = path
def hash_song(self):
hashed_song = {}
hashed_song["path"] = self.path
return has... | eevlogieva/letTheMusicPlaY | player/song.py | Python | gpl-2.0 | 329 |
permutations = dict(
iterationCount = [50000],
spPeriodicStats = [0],
#spCoincCount = [200, 300, 400, 500],
#spNumActivePerInhArea = [3, 5, 7, 9, 11],
spSynPermInactiveDec = [0.005, 0.01, 0.02, 0.04],
)
report = ... | vitaly-krugl/nupic | examples/prediction/experiments/dutyCycle/base/permutations.py | Python | agpl-3.0 | 541 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
from .utils import summarize_variable
def weight_variable(shape, name=None):
"""
Create weight variable with "tf.Variable"
Args:
shape (list): shape of weight
name (str): name of variable
Returns:
tf.Variabl... | evan176/rl | rl/mlp.py | Python | mit | 3,467 |
"""
Normal moment closure
------
This part of the package provides the original the Normal (Gaussian) closure.
"""
import sympy as sp
from sympy.utilities.iterables import multiset_partitions
import operator
from means.util.sympyhelpers import product
from closure_scalar import ClosureBase
class NormalClosure(Closu... | theosysbio/means | src/means/approximation/mea/closure_normal.py | Python | mit | 5,477 |
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from server.server import main
main() | sm5art/pyschedule | tests/testserver.py | Python | mit | 149 |
import ConfigParser
CONFIG_FILE = '/etc/ci-scoreboard/ci-scoreboard.conf'
CONFIG_SECTION = 'scoreboard'
class Config:
def __init__(self):
self._cfg = ConfigParser.ConfigParser()
self._cfg.read(CONFIG_FILE)
def _value(self, option):
if self._cfg.has_option(CONFIG_SECTION, option):
... | openstack/third-party-ci-tools | monitoring/scoreboard/config.py | Python | apache-2.0 | 1,391 |
#!/usr/bin/env python
# encoding: utf-8
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.... | CERT-BDF/Cortex-Analyzers | analyzers/MaxMind/geo.py | Python | agpl-3.0 | 3,380 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2005, 2006, 2007 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# ... | marcosbontempo/inatelos | poky-daisy/scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py | Python | mit | 2,610 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-11-26 16:07
import os
from urllib.error import HTTPError
import shutil
from hanlp.datasets.srl.ontonotes5 import ONTONOTES5_HOME, CONLL12_HOME
from hanlp.datasets.srl.ontonotes5._utils import make_gold_conll, make_ontonotes_language_jsonlines, \
batch_make_ner_t... | hankcs/HanLP | hanlp/datasets/srl/ontonotes5/chinese.py | Python | apache-2.0 | 6,212 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf.urls.static import static
from .views import HomeView
# Uncomment the next two lines to enable the admin:
admin.autodiscover()
urlpatterns = (
static(settings.MEDIA_URL, documen... | jairtrejo/doko | app/rohan/urls.py | Python | mit | 581 |
# coding=utf-8
"""
This file is for automated updates of old versions prior to the
refactor, or for migration from SickRage
"""
# oldest db version we support migrating from
MIN_DB_VERSION = 9
# Max version is not the actual version number, (that is in main_db)
# it just guarantees that an "upgrade" status will be r... | Thraxis/pymedusa | sickbeard/databases/mainDB.py | Python | gpl-3.0 | 348 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) 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 Sof... | Alignak-monitoring-contrib/alignak-app | alignak_app/items/event.py | Python | agpl-3.0 | 2,700 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
sys.path.append(__file__.replace("__init__.py",''))
#import system_main as main
import main
import sim_module
import functions as fu
from gui import gui
import options as opt_module
import inspect
import numpy as np
import loaddata
impor... | espensirnes/paneltime | paneltime/__init__.py | Python | gpl-3.0 | 3,860 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module contains various experimental environments used for testing
human behavior.
Created on Thu Feb 22 14:50:01 2018
@author: Dimitrije Markovic
"""
import torch
from torch import zeros, ones
from torch.distributions import Categorical, Multinomial, Dirichle... | dimarkov/pyBefit | tasks/bandits.py | Python | mit | 4,136 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | nagyistoce/netzob | src/netzob/Inference/Vocabulary/Alignment/NeedlemanAndWunsch.py | Python | gpl-3.0 | 13,296 |
# Copyright (c) 2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | pvo/swift | swift/common/middleware/tempauth.py | Python | apache-2.0 | 21,275 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.serializer.mode import serializeParamsUniq
from hwtLib.amba.axis_comp.base import AxiSCompBase
from hwtLib.handshaked.cdc import HandshakedCdc
@serializeParamsUniq
class AxiSCdc(AxiSCompBase, HandshakedCdc):
"""
CDC (Clock domain crossing) for axi-strea... | Nic30/hwtLib | hwtLib/amba/axis_comp/cdc.py | Python | mit | 626 |
#!/usr/bin/python2.7.3
import random
import string
import user
import filter_restaurants
import generate_timestamp
import datetime
from random import randint
from vote import Vote
ll = "42.3601,-71.0589"
queries = ['sushi', 'burritos', 'pizza', 'ramen', 'burger', 'italian', 'bagels', 'chinese', 'japanese', 'thai']
#... | Unknowncmbk/Thumly | thumly/generate_votes.py | Python | mit | 1,725 |
#!/usr/bin/python
""" PN-CLI vrouter-interface-add/remove/modify """
#
# This file is part of Ansible
#
# Ansible 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... | hantonov/ansible-modules-core | network/netvisor/pn_vrouterif.py | Python | gpl-3.0 | 15,198 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Tests for the engine module
"""
import numpy as np
import scipy.sparse as ssp
from nipype.testing import (assert_raises, assert_equal, assert_true,
assert_false, skipif)
impo... | sgiavasis/nipype | nipype/pipeline/plugins/tests/test_base.py | Python | bsd-3-clause | 1,155 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2016, Mario Vilas
# 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... | debasishm89/OpenXMolar | ExtDepLibs/winappdbg/win32/kernel32.py | Python | bsd-3-clause | 165,560 |
"""General key class."""
# SPDX-License-Identifier: Apache-2.0
import sys
AUTOGEN_MESSAGE = "/* Autogenerated by imgtool.py, do not edit. */"
class KeyClass(object):
def _emit(self, header, trailer, encoded_bytes, indent, file=sys.stdout, len_format=None):
print(AUTOGEN_MESSAGE, file=file)
print... | utzig/mcuboot | scripts/imgtool/keys/general.py | Python | apache-2.0 | 1,822 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... | simonwydooghe/ansible | lib/ansible/modules/network/vyos/vyos_lldp_global.py | Python | gpl-3.0 | 7,664 |
from flask import Flask, jsonify
from backend.settings import ProdConfig
from backend.api import api
from backend.extensions import mail, cors
def create_app(config_object=ProdConfig):
app = Flask(__name__)
app.config.from_object(config_object)
register_extensions(app)
register_blueprints(app)
ret... | TornikeNatsvlishvili/writing.skivri.ge | backend/backend/app.py | Python | mit | 502 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import scipy.interpolate
import gdspy
import picwriter.toolkit as tk
from picwriter.components.ebend import EulerSBend
from picwriter.components.taper import Taper
class SplineYSplitter(tk.Com... | DerekK88/PICwriter | picwriter/components/ysplitter.py | Python | mit | 9,609 |
import ast
def square_it(x):
return x * x
class Transformer1(ast.NodeTransformer):
pass
| ucb-sejits/ast_tool_box | test/sample.py | Python | mit | 101 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | st2actions/st2actions/policies/concurrency_by_attr.py | Python | apache-2.0 | 4,785 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/network/linkset_channel_binding.py | Python | apache-2.0 | 5,947 |
def char(env, node):
return ord(node.character)
def string(env, node):
return node.characters
def strlen(env, node):
args_node = node.args.interpret(env)
if len(args_node) == 0:
raise RuntimeError('strlen call without arguments')
str = args_node[0].interpret(env)
return len(str)
de... | PetukhovVictor/compiler | src/Interpreter/Eval/expressions/strings.py | Python | mit | 2,843 |
#
# Race Capture App
#
# Copyright (C) 2014-2017 Autosport Labs
#
# This file is part of the Race Capture App
#
# This 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 ... | autosportlabs/RaceCapture_App | autosportlabs/racecapture/theme/color.py | Python | gpl-3.0 | 2,812 |
# Copyright (C) 2003 CAMP
# Please see the accompanying LICENSE file for further information.
"""Utility functions and classes."""
import os
import re
from operator import mul
from math import sqrt, exp
import numpy as np
import _gpaw
from gpaw import debug
from numpy import linalg
elementwise_multiply_add = _gpa... | qsnake/gpaw | gpaw/utilities/__init__.py | Python | gpl-3.0 | 10,071 |
from django.db import models
class Country(models.Model):
isocode = models.CharField(primary_key=True, max_length=3)
name = models.CharField(max_length=255)
class Meta:
managed = False
db_table = "cc_country"
| LibreTime/libretime | api/libretime_api/models/countries.py | Python | agpl-3.0 | 240 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2013 Simon Feltman <sfeltman@gnome.org>
#
# test_repository.py: Test for the GIRepository module
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General... | sfeltman/pygobject | tests/test_repository.py | Python | lgpl-2.1 | 20,297 |
"""
WSGI config for vul 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | 404fovnd/vul | vul/wsgi.py | Python | gpl-3.0 | 383 |
import javabridge
from TASSELpy.java.lang.Object import Object
from TASSELpy.java.lang.Integer import metaInteger
from TASSELpy.java.lang.Float import metaFloat
from TASSELpy.utils.Overloading import javaOverload, javaConstructorOverload
from TASSELpy.utils.helper import make_sig
java_imports = {'LDResult':'net/maizeg... | er432/TASSELpy | TASSELpy/net/maizegenetics/analysis/popgen/LDResult.py | Python | bsd-3-clause | 7,806 |
import Expanse
import demistomock as demisto
import json
TEST_IP = "12.4.49.74"
TEST_API_KEY = "123456789123456789"
TEST_DOMAIN = "base2.pets.com"
TEST_PAGE_LIMIT = 1
def http_request_mock(method, endpoint, params=None, token=False):
''' make api call '''
if endpoint == 'IdToken':
r = MOCK_TOKEN_RES... | VirusTotal/content | Packs/Expanse/Integrations/Expanse/Expanse_test.py | Python | mit | 60,897 |
import sys
import numpy as np
import nrrd
def resave( f, outf ):
data_in,opts_in = nrrd.read( f )
print( opts_in )
space_directions=[['1.0', '0.0', '0.0'], ['0.0', '1.0', '0.0'], ['0.0', '0.0', '1.0']]
space_units=['"microns"','"microns"','"microns"']
#space='left-posterior-superior'
space='right-anterior-super... | saalfeldlab/template-building | python/resaveNrrd.py | Python | bsd-2-clause | 690 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('academy', '0003_beauty_n_convenience'),
]
operations = [
migrations.CreateModel(
name='Media_File',
... | enjaz/enjaz | academy/migrations/0004_edit_work.py | Python | agpl-3.0 | 2,531 |
#! /usr/bin/env python
# coding:utf-8
"""html tag attribute"""
from lib.data import BaseXssData
class Attribute(BaseXssData):
"""html tag attribute data"""
def __init__(self):
_data = [
'accesskey',
'class',
'contenteditable',
'contextmenu',
... | blue-bird1/xss_fuzz | data/attribute.py | Python | apache-2.0 | 636 |
"""
WSGI config for django_exams 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_exams.settings")
from dja... | Lapin-Blanc/django_exams | django_exams/wsgi.py | Python | gpl-2.0 | 399 |
# -*- coding: utf-8 -*-
from unittest import TestCase
import resource
from problemtools.run import limit
class Limit_test(TestCase):
def test_less(self):
less = limit.__dict__['__limit_less']
assert less(42, 42)
assert not less(42, 41)
assert less(1e99, resource.RLIM_INFINITY)
... | Kattis/problemtools | problemtools/tests/test_run_limit.py | Python | mit | 439 |
""" Adaptive Gradient Clipping
An impl of AGC, as per (https://arxiv.org/abs/2102.06171):
@article{brock2021high,
author={Andrew Brock and Soham De and Samuel L. Smith and Karen Simonyan},
title={High-Performance Large-Scale Image Recognition Without Normalization},
journal={arXiv preprint arXiv:},
year={2021... | rwightman/pytorch-image-models | timm/utils/agc.py | Python | apache-2.0 | 1,624 |
import sys, string
def hook(mod):
names = sys.builtin_module_names
if 'posix' in names:
removes = ['nt', 'ntpath', 'dos', 'dospath', 'os2', 'mac', 'macpath',
'ce', 'riscos', 'riscospath', 'win32api', 'riscosenviron']
elif 'nt' in names:
removes = ['dos', 'dospath... | lebauce/artub | builder/Installer/hooks/hook-os.py | Python | gpl-2.0 | 1,167 |
#!/usr/bin/env python3
from collections import defaultdict
from urllib.request import Request, urlopen
from urllib.error import URLError
from os.path import join
from functools import *
from poe_utils import *
from sys import exit
class PoEItemData():
# User Variables
__attribute_list = ['str', 'dex', 'int', 'str/in... | martialboniou/poe_filter_demo | poe_item_data.py | Python | mit | 8,318 |
# Copyright (c) 2014 by pyramid_decoy authors and contributors
# <see AUTHORS file>
#
# This module is part of pyramid_decoy and is released under
# the MIT License (MIT): http://opensource.org/licenses/MIT
"""Main decoy module."""
__version__ = "0.2.0"
SETTINGS_PREFIX = "decoy"
def includeme(configurator):
"""... | fizyk/pyramid_decoy | src/pyramid_decoy/__init__.py | Python | mit | 1,031 |
"""Public interface for omdb module
Accessible via:
import omdb
"""
from .client import Client
# Internal client instance used for our requests.
_client = Client()
def set_default(key, default):
"""Proxy method to internal client instance that sets default params
values.
"""
_client.set_defaul... | thewisenerd/pymoviedb | src/omdb-0.5.0/omdb/api.py | Python | gpl-2.0 | 1,242 |
# This file is part of the qpopplerview package.
#
# Copyright (c) 2010 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at yo... | shimpe/frescobaldi | frescobaldi_app/qpopplerview/cache.py | Python | gpl-2.0 | 10,059 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... | timvideos/flumotion | flumotion/component/consumers/disker/disker_plug.py | Python | lgpl-2.1 | 1,401 |
#-------------------------------------------------------------------------------
# Name: shp_helper
# Purpose:
#
# Author: Caleb Mackey
#
# Created: 01/19/2015
#-------------------------------------------------------------------------------
import shapefile
# constants (from shapefile)
shp_dict = {
... | sharifulgeo/restapi | restapi/shp_helper.py | Python | gpl-2.0 | 3,143 |
import string
from .cipher import Cipher
class Caesar(Cipher):
FORWARD = string.ascii_uppercase * 3
def __init__(self, offset=3):
"""This method initializes Caesar with an encryption alphabet"""
self.offset = offset
self.FORWARD = string.ascii_uppercase + string.ascii_uppercase[:self... | Zachary-Jackson/Secret-Messages | ciphers/caesar.py | Python | bsd-3-clause | 1,533 |
#!/usr/bin/env python
# png.py - PNG encoder/decoder in pure Python
#
# Copyright (C) 2006 Johann C. Rocholl <johann@browsershots.org>
# Portions Copyright (C) 2009 David Jones <drj@pobox.com>
# And probably portions Copyright (C) 2006 Nicko van Someren <nicko@nicko.org>
#
# Original concept by Johann C. Rocholl.
#
# ... | ksons/xml3d-blender-exporter | addons/io_scene_xml3d/png.py | Python | gpl-2.0 | 104,334 |
def topgeo ('topgeo'):
"""
Esta libreria funciona para realizar calculos topograficos.
"""
| Alan-Jairo/topgeo | doc.py | Python | mit | 103 |
from flask_restful import Resource, reqparse
from flask_marshmallow import pprint
# Define articles resource api
from app.api.v1.resources.fields import NoticeSchema
from app.exceptions import NoticeNotFound
from app.models import Notice
class NoticeList(Resource):
def __init__(self):
super(NoticeList, ... | Arkanayan/BuieConnect-Web | app/api/v1/resources/Notices.py | Python | mit | 1,679 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from pyowm.commons.databoxes import ImageType, Satellite, SubscriptionType
class TestImageType(unittest.TestCase):
def test_repr(self):
instance = ImageType('PDF', 'application/pdf')
repr(instance)
class TestSatellite(unittest.TestC... | csparpa/pyowm | tests/unit/commons/test_databoxes.py | Python | mit | 580 |
from sympy.mpmath import mnorm, mpf
from sympy.solvers import nsolve
from sympy.utilities.lambdify import lambdify
from sympy import Symbol, Matrix, sqrt, Eq
from sympy.utilities.pytest import raises
def test_nsolve():
# onedimensional
from sympy import Symbol, sin, pi
x = Symbol('x')
assert nsolve(sin... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/solvers/tests/test_numeric.py | Python | agpl-3.0 | 1,787 |
"""
WSGI config for estelcon_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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | hirunatan/estelcon_web | estelcon_web/wsgi.py | Python | agpl-3.0 | 389 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of t... | MSusik/invenio | invenio/modules/accounts/validators.py | Python | gpl-2.0 | 3,887 |
__author__ = 'victor'
import unittest
from data.adaptors import *
import csv
import os
mydir = os.path.dirname(os.path.abspath(__file__))
class TestAdaptor(object):
def test_words(self):
ex = self.adaptor.to_example(self.raw)
self.assertEqual(ex.words, [w.lower() for w in self.words])
def t... | vzhong/sent2rel | tests/test_adaptors.py | Python | mit | 10,128 |
"""
Debug Toolbar middleware
"""
import os
from django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.utils.encoding import smart_unicode
from django.conf.urls.defaults import include, patterns
import debug_toolbar.urls
from debug_toolbar.... | canvasnetworks/canvas | website/debug_toolbar/middleware.py | Python | bsd-3-clause | 4,389 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-15 19:17
from __future__ import unicode_literals
from django.db import migrations
def add_edit_time(apps, schema_editor):
""" Add edit_time to all existing Article instances """
Article = apps.get_model('helpcenter', 'Article')
for article i... | smalls12/django_helpcenter | helpcenter/migrations/0006_auto_20160715_1917.py | Python | mit | 654 |
"""Example for exporting ResNet50 model to ONNX graph.
$ pwd
/path/to/onnx-chainer
$ python examples/resnet50/export.py -I target.jpg -O onnx_model
'model.onnx' will be output under 'onnx_model' directory.
"""
import argparse
import os
import chainer.cuda
import chainercv.links as C
from chainercv.transforms i... | pfnet/chainer | onnx_chainer/examples/resnet50/export.py | Python | mit | 2,402 |
from __future__ import print_function
import logging
import numpy as np
from astropy import units as u
from astropy.io import fits
from megaradrp.instrument.components.instrument import MegaraInstrument
from megaradrp.simulation.efficiency import EfficiencyFile
from megaradrp.simulation.efficiency import InterpolFil... | sergiopasra/megaradrp | scripts/simulation.py | Python | gpl-3.0 | 14,018 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
parse_iso8601,
remove_end,
)
class LifeNewsIE(InfoExtractor):
IE... | jbuchbinder/youtube-dl | youtube_dl/extractor/lifenews.py | Python | unlicense | 9,620 |
import operator
import numpy as np
import pytest
from pandas.compat import np_version_under1p20
import pandas as pd
import pandas._testing as tm
from pandas.core import ops
from pandas.core.arrays.sparse import (
SparseArray,
SparseDtype,
)
@pytest.fixture(params=["integer", "block"])
def kind(request):
... | rs2/pandas | pandas/tests/arrays/sparse/test_arithmetics.py | Python | bsd-3-clause | 20,794 |
"""
The mean of three integers A, B and C is (A + B + C)/3. The median of three integers is the one that would be in the
middle if they are sorted in non-decreasing order. Given two integers A and B, return the minimum possible integer C
such that the mean and the median of A, B and C are equal.
Input
Each test case ... | deyvedvm/cederj | urionlinejudge/python/1379.py | Python | gpl-3.0 | 781 |
from django.conf.urls.defaults import patterns, url, include
from experiment import views
urlpatterns = patterns("",
# url(regex=r'^protocols/$', view=views.ProtocolListView.as_view(), name='protocol_list'),
# url(regex=r'^protocols/(?P<protocol_a_slug>[-\w]+)/layers/(?P<layers>[-\w]+)/$', view=cviews.Compa... | Bionetbook/bionetbook | bnbapp/experiment/urls.py | Python | mit | 1,273 |
"""
Originally lifted from various files at:
https://bitbucket.org/Jeffrey/gevent-websocket/src/fabf03111c73/geventwebsocket
"""
from errno import EINTR
from hashlib import md5, sha1
from socket import error as socket_error
from threading import Semaphore
from urllib import quote
import base64
import re
import stru... | mikeboers/Nitrogen | nitrogen/websocket.py | Python | bsd-3-clause | 22,284 |
# -*- coding: utf-8 -*-
from openprocurement.api.utils import (
json_view,
context_unpack,
APIResource,
get_now
)
from openprocurement.auctions.core.utils import (
apply_patch,
save_auction,
opresource,
)
from openprocurement.auctions.core.validation import (
validate_cancellation_data,... | prozorro-sale/openprocurement.auctions.dgf | openprocurement/auctions/dgf/views/other/cancellation.py | Python | apache-2.0 | 5,435 |
#!/usr/bin/env python
import re
def look_and_say(s):
pieces = re.findall(r'((\d)\2*)', s)
output = ''
for piece in pieces:
l = len(piece[0])
if l > 0:
output += str(l)
output += str(piece[1])
return output
with open('../inputs/10.txt') as f:
for line in f:
line =... | opello/adventofcode | 2015/python/10-1.py | Python | mit | 444 |
#!/usr/bin/python3
#
# Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above c... | ganeti/ganeti | test/py/ganeti.objects_unittest.py | Python | bsd-2-clause | 31,545 |
from __future__ import print_function
# standard library
import functools
import itertools
# third party
import scipy.spatial
from tree_distance import getEuclideanDistance, getGeodesicDistance, getRobinsonFouldsDistance,\
getWeightedRobinsonFouldsDistance
# treeCl
from .utils import setup_progressbar
__all__ =... | DessimozLab/treeCl | treeCl/treedist.py | Python | mit | 5,189 |
import logging
import os
import unittest
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
l = logging.getLogger('angr.test_boyscout')
entries = [
("i386/all", "X86", "Iend_LE"),
("i386/fauxware", "X86", "Iend_LE"),
("x86_64/all", "AMD6... | angr/angr | tests/test_boyscout.py | Python | bsd-2-clause | 5,028 |
from easybuild.easyblocks.generic.cmakemake import CMakeMake
from easybuild.easyblocks.generic.gitcloneconfiguremake import GitCloneConfigureMake
# Work In Progress
class GitCloneCMakeMake(GitCloneConfigureMake, CMakeMake):
"""Builds the Arcade Learning Environment
Uses cmake, make, then copies the executabl... | IGB-UIUC/easybuild | easyblocks/gitclonecmakemake.py | Python | gpl-3.0 | 1,087 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-09-20 15:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course', '0040_auto_20180607_1502'),
]
operations = [
migrations.AlterField... | teemulehtinen/a-plus | course/migrations/0041_auto_20180920_1838.py | Python | gpl-3.0 | 491 |
import abc
from six import add_metaclass
import os
import tempfile
from tests import loopbackedtestcase
from blivet.errors import FSError, FSResizeError, DeviceFormatError
from blivet.size import Size, ROUND_DOWN
from blivet.formats import fs
def can_resize(an_fs):
""" Returns True if this filesystem has all n... | rvykydal/blivet | tests/formats_test/fstesting.py | Python | lgpl-2.1 | 14,269 |
# Copyright 2011 David Irvine
#
# This file 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.
#
# This file is distributed in the h... | irvined1982/percyval | admin.py | Python | gpl-3.0 | 1,280 |
from itertools import combinations
from prime import Prime
def compatible(one, two):
return (
Prime.contains(int(str(one) + str(two))) and
Prime.contains(int(str(two) + str(one)))
)
def remarkable(tuple_):
for one, two in combinations(tuple_, 2):
if not compatible(one, two):
... | mackorone/euler | src/060.py | Python | mit | 716 |
#!/usr/bin/env python
# mammon - a useless ircd
#
# Copyright (c) 2015, William Pitcock <nenolod@dereferenced.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in... | mammon-ircd/mammon | mammon/capability.py | Python | isc | 6,168 |
from machina.apps.forum_conversation.apps import ForumConversationAppConfig \
as BaseForumConversationAppConfig
class ForumConversationAppConfig(BaseForumConversationAppConfig):
name = 'tests._testsite.apps.forum_conversation'
| ellmetha/django-machina | tests/_testsite/apps/forum_conversation/apps.py | Python | bsd-3-clause | 237 |
#!/usr/bin/python
# Copyright 2015 Mirantis, 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 or a... | TAJaroszewski/lma_contrail_monitoring | deployment_scripts/puppet/modules/lma_collector/files/collectd/openstack_nova.py | Python | apache-2.0 | 3,346 |
# Time: O(logn)
# Space: O(logn)
# We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape.
# These shapes may be rotated.
#
# XX <- domino
#
# XX <- "L" tromino
# X
# Given N, how many ways are there to tile a 2 x N board? Return your answer modulo 10^9 + 7.
#
# (In a tiling, every square must be ... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/domino-and-tromino-tiling.py | Python | mit | 2,397 |
# -*- coding: utf-8 -*-
"""
utils
~~~~~
Python utils.
:copyright: (c) 2017 by Kerol Gao.
:license: Apache License.
"""
import struct
import socket
def ip2int(ip):
return struct.unpack("!I",socket.inet_aton(ip))[0]
def int2ip(i):
return socket.inet_ntoa(struct.pack("!I",i))
def logger... | kerol/kepython | kepython/utils.py | Python | apache-2.0 | 881 |
from gwt.ui.FlashPanel import (
DOM,
FlashPanel,
Panel,
browser,
log,
pyjd,
)
| anandology/pyjamas | library/pyjamas/ui/FlashPanel.py | Python | apache-2.0 | 102 |
# engine/strategies.py
# Copyright (C) 2005-2012 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
"""Strategies for creating new instances of Engine types.
These are semi-private... | nabsboss/CouchPotatoServer | libs/sqlalchemy/engine/strategies.py | Python | gpl-3.0 | 8,979 |
# 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 click.testing import CliRunner
from socorro.scripts.db import db_group
def test_it_runs():
"""Test whether t... | lonnen/socorro | socorro/unittest/scripts/test_db.py | Python | mpl-2.0 | 466 |
# -*- coding: utf-8 -*-
'''Wrapper for MeCab node.'''
class MeCabNode(object):
'''Representation of a MeCab Node struct.
A list of MeCab nodes is returned when parsing a string of Japanese with
as_nodes=True. Each node will contain detailed information about the
morpheme encompassed.
:ivar ptr: T... | buruzaemon/natto-py | natto/node.py | Python | bsd-2-clause | 7,909 |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autodoc
~~~~~~~~~~~~~~~~~~
Automatically insert docstrings for functions, classes or whole modules into
the doctree, thus avoiding duplication between docstrings and documentation
for those who like elaborate docstrings.
:copyright: Copyright 2007-2016 by... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/ext/autodoc.py | Python | apache-2.0 | 67,423 |
from django.core.paginator import Paginator
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger
import json
from django.core import serializers
from django.http import JsonResponse
__author__ = 'johnnytsai'
def getUpPagingJSONResult(object, page, size, **dic):
# filter
... | mmmaaaxxx77/Python-Django-AdminLTE2 | HypermediaDemo/Demo/core/paging/CusPaginator.py | Python | gpl-2.0 | 1,190 |
"""Custom context processors for Omuni"""
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils.translation import ugettext as _
from openbudgets.apps.accounts.forms import CustomAuthenticationForm, \
CustomRegistrationForm, CustomPasswordResetForm, CustomPasswordChangeForm... | kobiluria/openbudgets | openbudgets/commons/context_processors.py | Python | bsd-3-clause | 1,519 |
# -*- coding: utf-8 -*-
import re
import xml.etree.ElementTree as etree
from ..internal.Hoster import Hoster
# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/)
class ZDF(Hoster):
__name__ = "ZDF Mediathek"
__type__ = "hoster"
__version__ = "0.90"
__status__ = "testing"
__patter... | igel-kun/pyload | module/plugins/hoster/ZDF.py | Python | gpl-3.0 | 1,775 |
from unittest import TestCase
from chatterbot.storage import JsonFileStorageAdapter
from chatterbot.conversation import Statement, Response
class JsonAdapterTestCase(TestCase):
def setUp(self):
"""
Instantiate the adapter.
"""
from random import randint
# Generate a rando... | maclogan/VirtualPenPal | tests/storage_adapter_tests/test_json_file_storage_adapter.py | Python | bsd-3-clause | 12,819 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.