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 |
|---|---|---|---|---|---|
import sys, cv2, bisect, skimage, graph, seed_reader
import numpy as np
#global parameters
#~~~~~~~~~~~~~~~~~
alpha = 2 #power associated with intensity cost
beta = 300000 #factor associated with curvature cost
radius = 36 #radius of the circle
bfactor = 25 #how much predecessors are necessary t... | elmadjian/hand_drawn_line_detector | prog/circles.py | Python | mit | 5,084 |
#
# Implementation of in-memory cache
#
# Author: Gregory Fleischer (gfleischer@gmail.com)
#
# Copyright (c) 2011 RAFT Team
#
# This file is part of RAFT.
#
# RAFT 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 Foundatio... | basicScandal/raft | core/network/InMemoryCache.py | Python | gpl-3.0 | 3,444 |
#!/usr/bin/env python3.6
# coding: utf8
"""
Tools to manage frequent elements
"""
# Copyright (C) 2017 by
# Emmanuel Desmontils <emmanuel.desmontils@univ-nantes.fr>
# Patricia Serrano-Alvarado <patricia.serrano-alvarado@univ-nantes.fr>
# All rights reserved.
# GPL v 2.0 license.
# [MAA05]
# Ahmed Metwal... | edesmontils/Linked-Data-Query-Profiler | tools/ssa.py | Python | gpl-3.0 | 6,012 |
# -*- coding: utf-8 -*-
"""
Pytest plugin that folds captured output sections in Travis CI build log.
"""
from __future__ import absolute_import, division, print_function
import os
import re
import sys
from collections import defaultdict
from contextlib import contextmanager
from functools import partial, update_wrap... | abusalimov/pytest-travis-fold | pytest_travis_fold.py | Python | mit | 8,187 |
# Generated by Finn Stutzenstein on 2019-11-22 11:42
from django.db import migrations
def calculate_aspect_ratios(apps, schema_editor):
"""
Assignes every projector one aspect ratio of the ones, that OS
supported until this migration. If no matching ratio was found, the
default of 16:9 is assigned.
... | FinnStutzenstein/OpenSlides | server/openslides/core/migrations/0027_projector_size_2.py | Python | mit | 1,406 |
"""Module that provides the default validators and validator registry.
Inherit BaseValidator to implement the custom validators.
"""
import os
import re
import six
from django.core.files.base import File
from django.utils.translation import ugettext_lazy as _
from . import status
from .exceptions import ValidationErr... | romain-li/django-validator | django_validator/validators.py | Python | mit | 12,536 |
# Time: O(h)
# Space: O(1)
# Given the root node of a binary search tree (BST) and a value.
# You need to find the node in the BST that the node's value equals the given value.
# Return the subtree rooted with that node.
# If such node doesn't exist, you should return NULL.
#
# For example,
#
# Given the tree:
# ... | kamyu104/LeetCode | Python/search-in-a-binary-search-tree.py | Python | mit | 1,107 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | MaximNevrov/neutron | neutron/extensions/default_subnetpools.py | Python | apache-2.0 | 1,792 |
#Milton Orlando Sarria Paja
#USC 2018
#solucion parcial 2
import numpy as np
import math
########################################################
def text2numbers(file_name):
hf = open(file_name,'r')
lines=hf.readlines()
hf.close()
x=[]
numID=[]
for line in lines:
#leer el dato de cada... | miltonsarria/dsp-python | calc-circ/solPar_2_2018B.py | Python | mit | 3,731 |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca 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... | mathiasertl/django-ca | ca/django_ca/acme/constants.py | Python | gpl-3.0 | 2,384 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.db import models
from django.shortcuts import get_object_or_404
from django.utils.cache import add_never_cache_headers
from django.utils.translation import get_language_from_request
from rest_framework import generics
from rest_fra... | jrief/django-shop | shop/views/catalog.py | Python | bsd-3-clause | 10,693 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest as ut
import stripeline.quaternions as q
import numpy as np
class TestOperations(ut.TestCase):
def test_addition(self):
'Check that the quaternion addition is implemented correctly'
q1 = np.array([[1.0, 2.0, 3.0, 4.0],
... | ziotom78/stripeline | tests/quaternions_test.py | Python | mit | 6,035 |
# Generated from java-escape by ANTLR 4.4
from antlr4 import *
from io import StringIO
package = globals().get("__package__", None)
ischild = len(package)>0 if package is not None else False
if ischild:
from .ProtoParserListener import ProtoParserListener
else:
from ProtoParserListener import ProtoParserListene... | asifmadnan/protobuf2uml | bin/protobuf/ProtoParser.py | Python | apache-2.0 | 86,857 |
# Current Status: Complete
# Assume that we execute the following assignment statements:
# width = 17
# height = 12.0
# delimiter = '.'
# For each of the following expressions, write the value of the expression
# and the type (of the value of the expression).
# 1. width/2
# 2. width/2.0
# 3. height/3
# 4. 1 + 2 * 5
#... | epequeno/ThinkPy-Solutions | ch02/2.03.py | Python | gpl-3.0 | 1,157 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('thing', '0021_itemmaterial'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='... | cmptrgeekken/evething | thing/migrations/0022_auto_20170620_0952.py | Python | bsd-2-clause | 776 |
import argparse
import pydoc
import pager
from texttable import Texttable
from .ntripbrowser import NtripBrowser
from .ntripbrowser import ExceededTimeoutError, UnableToConnect, NoDataReceivedFromCaster
from .ntripbrowser import CAS_HEADERS, STR_HEADERS, NET_HEADERS
SCREEN_WIDTH = pager.getwidth()
def argparser()... | emlid/ntripbrowser | ntripbrowser/browser.py | Python | bsd-3-clause | 2,765 |
import requests
import ujson
import datetime
def assert_site_json(site_json):
try:
site = ujson.loads(site_json)
except:
assert False
assert site.has_key('id')
assert isinstance(site['id'], int)
assert site.has_key('alias')
assert isinstance(site['alias'], unicode)
assert site.has_key('nodes')
assert isinst... | Hackerfarm/techrice | api/app/tests.py | Python | lgpl-3.0 | 2,593 |
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2016, Gluu
#
# Author: Yuriy Movchan
# Author: Hemant Mehta
#
from org.gluu.service.cdi.util import CdiUtil
from org.gluu.oxauth.security import Identity
from org.gluu.model.custom.script.type.auth... | GluuFederation/oxAuth | Server/integrations/basic.passwordchangewithvalidations/PasswordChangeWithValidations.py | Python | mit | 6,837 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# Diego Muñoz Escalante. #
# (pacoqueen@users.sourceforge.ne... | pacoqueen/ginn | ginn/formularios/busca_partida.py | Python | gpl-2.0 | 10,343 |
from bitmovin.resources.models import GCSOutput
from ..rest_service import RestService
class GCS(RestService):
BASE_ENDPOINT_URL = 'encoding/outputs/gcs'
def __init__(self, http_client):
super().__init__(http_client=http_client, relative_url=self.BASE_ENDPOINT_URL, class_=GCSOutput)
| bitmovin/bitmovin-python | bitmovin/services/outputs/gcs_output_service.py | Python | unlicense | 303 |
from dependency_injector import containers, providers
from dependency_injector.wiring import inject, Provide, Closing
class Service:
init_counter: int = 0
shutdown_counter: int = 0
@classmethod
def reset_counter(cls):
cls.init_counter = 0
cls.shutdown_counter = 0
@classmethod
... | rmk135/objects | tests/unit/samples/wiringstringidssamples/resourceclosing.py | Python | bsd-3-clause | 743 |
"""Grover's algorithm and helper functions.
Todo:
* W gate construction (or perhaps -W gate based on Mermin's book)
* Generalize the algorithm for an unknown function that returns 1 on multiple
qubit states, not just one.
* Implement _represent_ZGate in OracleGate
"""
from __future__ import print_function, divisio... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/physics/quantum/grover.py | Python | mit | 9,537 |
# This file is part of Invenio.
# Copyright (C) 2007, 2008, 2009, 2010, 2011 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 the
# License, or (at your option) any later v... | CERNDocumentServer/invenio | modules/websubmit/lib/functions/Get_Recid.py | Python | gpl-2.0 | 12,743 |
# -*- 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 'ChecklistInstance.completion_status'
db.add_column('checklists_checklistinstance', 'completi... | tekton/DocuCanvas | checklists/migrations/0005_auto__add_field_checklistinstance_completion_status.py | Python | gpl-3.0 | 8,702 |
"""Support for Spider thermostats."""
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_T... | nkgilley/home-assistant | homeassistant/components/spider/climate.py | Python | apache-2.0 | 3,866 |
# (c) 2018 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
author: Ansible Networking Team
connection: httpapi
short_description: Use httpapi to run... | jimi-c/ansible | lib/ansible/plugins/connection/httpapi.py | Python | gpl-3.0 | 9,898 |
from depot.manager import DepotManager
from .interfaces import DepotFileInfo
import json
class UploadedFile(DepotFileInfo):
"""Simple :class:`depot.fields.interfaces.DepotFileInfo` implementation that stores files.
Takes a file as content and uploads it to the depot while saving around
most file informat... | rlam3/depot | depot/fields/upload.py | Python | mit | 2,857 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_configuration.py | Python | mit | 1,748 |
# 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 selenium.webdriver.common.by import By
from pages.firefox.base import FirefoxBasePage
from pages.regions.send_to_d... | mkmelin/bedrock | tests/pages/firefox/whatsnew.py | Python | mpl-2.0 | 700 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# Copyright (c) 2009-2014 Richard Jones, Claudio Canepa
# All rights reserved.
#
# Redistribution and use in source and binary forms, with o... | Alwnikrotikz/los-cocos | cocos/scenes/pause.py | Python | bsd-3-clause | 3,836 |
from __future__ import unicode_literals
import json
def test_get_version(app, client, current_version):
headers = [('Accept', 'application/json'),
('Content-Type', 'application/json')]
res = client.get('/api/v0/version', headers=headers)
assert res.status_code == 200
data = json.loads(... | ecolell/pfamserver | tests/api/v0/test_version.py | Python | agpl-3.0 | 394 |
# Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
# Copyright (C) 2015 Apple 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 ret... | Debian/openjfx | modules/web/src/main/native/Tools/Scripts/webkitpy/w3c/test_parser_unittest.py | Python | gpl-2.0 | 11,210 |
#
# PAIMEIdiff
# Copyright (C) 2006 Peter Silberman <peter.silberman@gmail.com>
#
# $Id$
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either version 2 of the License, or (at your optio... | Alwnikrotikz/paimei | console/modules/_PAIMEIdiff/InsigList.py | Python | gpl-2.0 | 2,089 |
# usage:
# python covcmb.py out.covmat in1.covmat in2.covmat
# Nb. in1 values take priority over in2
from __future__ import print_function
import sys
from getdist import covmat
if len(sys.argv) < 3:
print('Usage: python covcmb.py out.covmat in1.covmat in2.covmat [in3.covmat...]')
sys.exit()
foutname = sys.arg... | ClaudioNahmad/Servicio-Social | Parametros/CosmoMC/CosmoMC-master/python/getdist/covcomb.py | Python | gpl-3.0 | 500 |
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
urlpatterns = i18n_patterns(
url(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')),
)
| DONIKAN/django | tests/i18n/patterns/urls/wrong.py | Python | bsd-3-clause | 272 |
# Copyright (c) 2012 Richard Klancer <rpk@pobox.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | rascalmicro/control-freak | public/joystick.py | Python | gpl-3.0 | 4,187 |
# sbhs-timetable-python
# Copyright (C) 2015 Simon Shields, James Ye
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | sbhs-forkbombers/sbhs-timetable-python | app.py | Python | agpl-3.0 | 22,589 |
import logging
from xml.etree import ElementTree
from zoom.agent.action.action import Action
from zoom.agent.util.helpers import verify_attribute
from zoom.common.decorators import catch_exception
class ActionFactory(object):
def __init__(self, component=None, zkclient=None, proc_client=None,
ac... | spottradingllc/zoom | server/zoom/agent/action/factory.py | Python | gpl-2.0 | 4,455 |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Special subset sums: testing".
The problem is: Using sets.txt, a 4K text file with one-hundred sets containing
seven to twelve elements, identify all the special sum sets, A1, A2, ..., Ak,
and find the value of S(A1) + S(A2) + ... + S(Ak).
"""
try... | iansealy/projecteuler | 105.py | Python | gpl-3.0 | 2,379 |
#!/usr/bin/env python
# *********************************************************************
# * Copyright (C) 2014 Luca Baldini (luca.baldini@pi.infn.it) *
# * *
# * For the license terms see the file LICENSE, distributed *
# * along ... | centrofermi/e3pipe | apps/e3crawl.py | Python | gpl-3.0 | 3,258 |
# -------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/__init__.py | Python | apache-2.0 | 6,833 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
import shoop.apps
class ShoopUtilsAppConf... | jorge-marques/shoop | shoop/utils/__init__.py | Python | agpl-3.0 | 626 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-20 15:10
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_plans', '0020_contact_2000... | liqd/a4-meinberlin | meinberlin/apps/plans/migrations/0021_district_not_required.py | Python | agpl-3.0 | 614 |
# Copyright (c) 2015, DjaoDjin 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 copyright notice,
# this list of conditions and t... | Lalmas/drop | src/tero/setup/sldap.py | Python | bsd-2-clause | 7,789 |
# -*- coding: utf-8 -*-
"""
Tests of ``critica.apps.regions`` application.
"""
from django.test import TestCase
| brunobord/critica | apps/regions/tests.py | Python | gpl-3.0 | 114 |
import os
import sys
import pip
from subprocess import call
if not os.environ.get('VIRTUAL_ENV'):
print('[!] Should call this script inside a virtualenv, I do not want to '
'mess with your system. Bye!')
sys.exit(1)
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + ... | leapcode/bitmask-dev | pkg/tools/upgrade_all.py | Python | gpl-3.0 | 351 |
import copy
import warnings
from django.utils import six
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given dictionaries, only the
f... | edisonlz/fruit | web_project/base/site-packages/django/utils/datastructures.py | Python | apache-2.0 | 15,846 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | boblannon/dotfiles | vim/.global_ycm_extra_conf.py | Python | mit | 5,521 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class MailTestSimple(models.Model):
""" A very simple model only inheriting from mail.thread when only
communication history is necessary. """
_description = 'Simple Cha... | jeremiahyan/odoo | addons/test_mail/models/test_mail_models.py | Python | gpl-3.0 | 5,467 |
# Copyright (c) 2007-2016 Godefroid Chapelle and ipdb development team
#
# This file is part of ipdb.
# Redistributable under the revised BSD license
# https://opensource.org/licenses/BSD-3-Clause
from ipdb.__main__ import set_trace, post_mortem, pm, run # noqa
from ipdb.__main__ import runcall, runeval, l... | vicky2135/lucious | oscar/lib/python2.7/site-packages/ipdb/__init__.py | Python | bsd-3-clause | 507 |
#! /usr/bin/python
#***********************************************************
#* Software License Agreement (BSD License)
#*
#* Copyright (c) 2009, Willow Garage, Inc.
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the ... | UnbDroid/robomagellan | Codigos/Raspberry/desenvolvimentoRos/src/tf2_ros/src/tf2_ros/buffer_client.py | Python | gpl-3.0 | 9,915 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 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 pytz
from sqlalchemy import func, types
from sqlalchemy.sql import operators
from sqlalchemy.sql.sq... | DirkHoffmann/indico | indico/core/db/sqlalchemy/custom/utcdatetime.py | Python | gpl-3.0 | 1,992 |
# -*- coding: utf-8 -*-
#
## This file is part of Zenodo.
## Copyright (C) 2014 CERN.
##
## Zenodo 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 ... | otron/zenodo | zenodo/modules/preservationmeter/api.py | Python | gpl-3.0 | 3,261 |
# -*- coding: utf-8 -*-
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Tests for DynamoDB client.
"""
__author__ = 'spencer@emailscrubbed.com (Spencer Kimball)'
import os
import unittest
from boto.exception import DynamoDBResponseError
from functools import partial
from tornado import options
from viewfin... | treejames/viewfinder | backend/db/test/dynamodb_client_test.py | Python | apache-2.0 | 20,272 |
# Copyright (c) 2014 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this list
# of conditions and the following disclaimer.... | xiaojunwu/crosswalk-test-suite | tools/atip/atip/tizen/tizen.py | Python | bsd-3-clause | 3,509 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
GIT_ORIGIN = ''
__version__ = (1, 0, 0, 'final')
import sys
import os
import datetime
import time
from fabric.api import *
BASE_HEADER = """%(now)s
using project '%(app)s'
%(desc)s
"""
##
## available commands
##
def provision(update_rep=False):
# starts provisi... | arkanister/django-flickr-gallery | fabfile.py | Python | bsd-3-clause | 2,103 |
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
class Synth_server(object):
def run_flow(self, net_config):
return ""
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/RPC2',)
if __name__ == '__main__':
server = SimpleX... | five-elephants/hw-neural-sampling | sampling_service/synth_server/synth_server.py | Python | apache-2.0 | 503 |
from .base import BaseUtils
from .message import MessageUtils
from .recipient import RecipientUtils
from .tag import TagUtils
from .thread import ThreadUtils
from .db import DBUtils
class IndexUtils(BaseUtils):
def __init__(self):
super(IndexUtils, self).__init__()
self.message = MessageUtils(self.... | franckv/pygmail | src/utils/index/__init__.py | Python | gpl-3.0 | 514 |
# -*- encoding: utf-8 -*-
"""
Policies modules
"""
__author__ = 'mendozah'
import theano
import theano.tensor as T
initial_lr = 0.1
value_gamma = 0.8
value_epoch = 3.0
value_power = 0.75
lr = theano.shared(initial_lr, 'lr')
epoch, gamma, powr, step = T.scalars('epoch', 'gm', 'powr', 'step')
lr_policy = 'fixed'
if ... | hmendozap/master-arbeit-projects | autosk_dev_test/utilities/policies_theano.py | Python | mit | 959 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | michielkleinnijenhuis/NeuroBlender | imports/import_tracts.py | Python | gpl-3.0 | 42,308 |
import pytest
import numpy as np
def test_val_0():
from batchup.datasets import fashion_mnist
ds = fashion_mnist.FashionMNIST(n_val=0)
assert ds.train_X.shape == (60000, 1, 28, 28)
assert ds.train_X.dtype == np.float32
assert ds.train_y.shape == (60000,)
assert ds.train_y.dtype == np.int32
... | Britefury/batchup | batchup/tests/test_fashion_mnist.py | Python | mit | 1,605 |
import itertools
import sqlalchemy as sql
import pandas as pd
from stock import models, util, api, params, predict as pp
def bulk_update_signals(codes, **kw):
if not isinstance(codes, list):
codes = [codes]
filtered = {k: v for k, v in kw.items() if hasattr(models.Signal, k)}
if not filtered:
... | her0e1c1/pystock | stock/query.py | Python | gpl-3.0 | 7,831 |
'''
Send a submit request to islandviewer via tcp
'''
import os
import glob
import sys
import socket
import json
import base64
import time
from django.conf import settings
import pprint
default_host = settings.ISLANDVIEWER_HOST
default_port = settings.ISLANDVIEWER_PORT
timeout = 120
'''
This is the generic handler, ... | lairdm/islandviewer-ui | lib/uploadparser/submitter.py | Python | gpl-3.0 | 7,327 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-06-04 03:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateM... | rtorres90/django_tutorial | mysite/polls/migrations/0001_initial.py | Python | mit | 1,227 |
from django.contrib import admin
from .models import *
from markdownx.admin import MarkdownxModelAdmin
from markdownx.fields import MarkdownxFormField
# 文章
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title','author','publish','updated','category','viewcount')
fields = ('title','body','author','categ... | IAMBADCODER/Blog | web/blog/admin.py | Python | apache-2.0 | 985 |
__version__ = "5.2"
| MrFelixU/ks5-edexcel | oink/simpletal/__init__.py | Python | apache-2.0 | 20 |
from urllib.parse import quote
from loguru import logger
from requests.exceptions import RequestException
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.event import event
from flexget.utils import json
from flexget.utils.template import RenderError
logger = logger.bind(name='p... | Flexget/Flexget | flexget/plugins/clients/pyload.py | Python | mit | 9,436 |
import os
import logging
LOG_PREFIX = 'webfp'
def reset_logger(logger):
"""Remove all the handlers for a logger."""
for handler in logger.handlers:
if isinstance(handler, logging.FileHandler):
handler.close()
elif isinstance(handler, logging.StreamHandler):
handler.fl... | pankajb64/webfp-crawler-phantomjs | tor-browser-crawler-webfp-paper/log.py | Python | gpl-2.0 | 1,940 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | Ircam-Web/mezzanine-organization | organization/magazine/apps.py | Python | agpl-3.0 | 1,029 |
from django.core.management import BaseCommand
from django.utils import timezone
from redditpoller.models import WatchedSubreddit, WatchedSubredditThread
from redditpoller.poller import get_subreddit_threads, notify_user
from datetime import timedelta
class Command(BaseCommand):
help = "Checks watched subreddits a... | ericleepa/watcherforreddit | redditpoller/management/commands/check_watched_subreddits.py | Python | mit | 3,647 |
import os
import stat
from shutil import copy2
def RecursiveCount(path):
count = 1
if os.path.isdir(path):
for e in os.listdir(path):
count += RecursiveCount(os.path.join(path, e))
return count
def RecursiveSize(path):
size = 0
for e in os.listdir(path):
size += os.path.getsize(os.path.join(path, e))
if... | xaiki/pybackpack | pybackpack/Copy.py | Python | gpl-2.0 | 886 |
from __future__ import absolute_import
# copyright openpyxl 2010-2015
from . import _Serialiasable, Sequence
from openpyxl.compat import safe_string
from openpyxl.xml.functions import Element, SubElement, safe_iterator, localname
class Serialisable(_Serialiasable):
"""
Objects can serialise to XML their att... | Darthkpo/xtt | openpyxl/descriptors/serialisable.py | Python | mit | 3,230 |
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>"""
import os.path
import csv
import uuid
import numpy
import sklearn
import condor
import borg
logger = borg.get_logger(__name__, default_level = "INFO")
def evaluate_split(run_data, model_name, K, split, train_mask, test_mask):
"""Evaluate a model on a train/te... | borg-project/borg | borg/experiments/mix_over_k.py | Python | mit | 2,454 |
# -*- coding: UTF-8 -*-
# Copyright 2015-2016 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""The :xfile:`settings.py` modules for this variant.
.. autosummary::
:toctree:
demo
doctests
"""
from lino_book.projects.noi1e.settings.demo import *
class Site(Site):
default_ui = 'lino_noi.... | lino-framework/book | lino_book/projects/public/settings/__init__.py | Python | bsd-2-clause | 497 |
from logging import basicConfig, DEBUG, INFO, WARNING, ERROR, CRITICAL
from sensors.sensor_type import SensorType
'''
Sensor data location - IMPORTANT!
Replace value below with the /dev location of your data streams.
It is expected that reading these location will return a single numerical value.
Valid values for ty... | OzuYatamutsu/klima | config.sample.py | Python | mit | 1,962 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# lsvgridmembers - simple list of vgrid members for a grid with access
# Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms o... | heromod/migrid | mig/shared/functionality/lsvgridmembers.py | Python | gpl-2.0 | 2,788 |
## Serializing - What it does
# Our serialization occurs in a multi-step process. THe first of which is converting every field
# and object into a primitive type that is acceptable in JSON. Those types include, but are not
# limited to: lists, dictionaries, booleans, strings, integers, floats, dates and datetimes.
# S... | mysidewalk/training-django | 03-django-rest-framework/03-serializers/serializers.py | Python | mit | 5,362 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | getnikola/nikola | nikola/plugins/misc/scan_posts.py | Python | mit | 5,021 |
#------------------------------------------------------------------------------
# pycparser: c_json.py
#
# by Michael White (@mypalmike)
#
# This example includes functions to serialize and deserialize an ast
# to and from json format. Serializing involves walking the ast and converting
# each node from a python Node o... | CtheSky/pycparser | examples/c_json.py | Python | bsd-3-clause | 6,397 |
#!/usr/bin/python
"""
Sceleton of a wflow_vegetation model.
---------------------------------------
Usage:
wflow_vegatation -C case -R Runid -c inifile
-C: set the name of the case (directory) to run
-R: set the name runId within the current case
-c name of the config file (in the case dire... | openstreams/wflow | Sandbox/wflow_vegetation.py | Python | gpl-3.0 | 8,245 |
# -*- coding: utf-8 -*-
from flask import request, jsonify, g, url_for, Blueprint, render_template, redirect, flash
from flask.ext.login import login_required, current_user
from wtforms import ValidationError
from project.application.entities import db, auth
from project.application.entities.professors.forms import Cr... | Warprobot/diplom | project/application/entities/professors/views.py | Python | cc0-1.0 | 4,874 |
# Copyright (C) 2001-2015 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at you... | khushboo9293/mailman | src/mailman/bin/runner.py | Python | gpl-3.0 | 7,595 |
"""Address model tests."""
from core.models import Address
from core.factory import AddressFactory
from tests.utils import ModelTestCase
class AddressTest(ModelTestCase):
"""Test the Address model."""
model = Address
field_tests = {
'line1': {
'verbose_name': 'ligne 1',
'... | oser-cs/oser-website | tests/test_core/test_address.py | Python | gpl-3.0 | 1,331 |
# 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 ... | xuweiliang/Codelibrary | nova/cmd/compute.py | Python | apache-2.0 | 2,119 |
""" Test script for the Unicode implementation.
Written by Bill Tutt.
Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import ast
import unittest
import unicodedata
from test import support
from http.client import HTTPException
try:
... | brython-dev/brython | www/src/Lib/test/test_ucn.py | Python | bsd-3-clause | 9,748 |
class BatchAlgorithm(object):
def __init__(self):
pass
def get_policy(self):
raise NotImplementedError()
def update(self, samples):
raise NotImplementedError()
class OnlineAlgorithm(object):
def __init__(self):
pass
def get_policy(self):
raise NotImpleme... | justinjfu/chaos_theory | chaos_theory/algorithm/algorithm.py | Python | gpl-3.0 | 410 |
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
import apiutil
def GenerateEntrypoints():
#apiutil.CopyrightC()
# Get sorted list of dispatched functions.
# The order is very important - it must ... | miguelinux/vbox | src/VBox/Additions/common/crOpenGL/Linux_i386_exports.py | Python | gpl-2.0 | 2,622 |
# gear_profile_macro.py
# the macro to generate a gear_profile.
# created by charlyoleg on 2013/08/27
#
# (C) Copyright 2013 charlyoleg
#
# This file is part of the Cnc25D Python package.
#
# Cnc25D is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | charlyoleg/Cnc25D | cnc25d/tests/gear_profile_macro.py | Python | gpl-3.0 | 6,930 |
from pytest_bdd import scenario
from .contact_steps import *
@scenario('contact.feature', 'Add new contact')
def test_sdd_new_contact():
pass
@scenario('contact.feature', 'Delete a contact')
def test_delete_contact():
pass
@scenario('contact.feature', 'Edit a contact')
def test_edit_contact():
pass | MaxDavion/Python_traning | bdd/contact_scenarios.py | Python | apache-2.0 | 315 |
# -*- coding: utf-8 -*-
import cStringIO
import contextlib
import datetime
import hashlib
import inspect
import itertools
import logging
import math
import mimetypes
import unicodedata
import os
import re
import urlparse
from PIL import Image
from sys import maxint
import werkzeug
import werkzeug.exceptions
import we... | andrius-preimantas/odoo | addons/website/models/website.py | Python | agpl-3.0 | 33,629 |
from uuid import uuid4
from django.db import models, transaction
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from media.models import MediaFileModel
from .constants import CLAIM_STATUS_CHOICES, CLAIM_STATUS_ENQUEUED, CLAIM_STATUS_CANCELED, CLAIM_STATUS_RECEIVED,\
CLAIM_... | dchaplinsky/badparking.in.ua | badparking/core/models.py | Python | mit | 3,650 |
from django.contrib import admin
try:
from django.conf.urls import patterns, include
except ImportError:
from django.conf.urls.defaults import patterns, include
urlpatterns = patterns(
'',
(r'^admin/', include(admin.site.urls)),
)
| trbs/django-constance-trbs | tests/urls.py | Python | bsd-3-clause | 250 |
from __future__ import unicode_literals
import re
from django.contrib import messages
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.test.client import RequestFactory
from djblets.registries.errors import ItemLookupError, RegistrationError
from djblets.testi... | davidt/reviewboard | reviewboard/accounts/tests.py | Python | mit | 19,866 |
import numpy as np
import math
import logging
import shutil
import os,sys
import matplotlib
import random
import datetime
import tables
import matplotlib.pyplot as plt
from collections import OrderedDict
from scipy.optimize import curve_fit
from scipy.stats import norm
from matplotlib.figure import Figure
from matplot... | SiLab-Bonn/monopix_daq | monopix_daq/analysis/plotting_base.py | Python | gpl-2.0 | 17,517 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import json
import logging
import sys
import time
from itertools import tee, islice, chain
from orgformat import OrgFormat
from memacs.lib.orgproperty import OrgProperties
from memacs.lib.reader import UnicodeDictReader
from .csv import Csv
# stolen fro... | novoid/Memacs | memacs/kodi.py | Python | gpl-3.0 | 6,858 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 20 17:40:07 2015
@author: casim
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
import numpy as np
import copy
from pyxe.command_... | casimp/edi12 | pyxe/merge.py | Python | mit | 6,830 |
# Copyright 2020,2021 Sony 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 applicable law or agreed to i... | sony/nnabla | python/test/utils/inspection/test_time_profiler.py | Python | apache-2.0 | 1,990 |
"""
Functions for testing independence of several distributions.
The functions in this module provide methods for testing if
the samples generated from two random vectors are independent.
"""
import numpy as np
import scipy.stats
from . import _dcor_internals, _hypothesis
from ._dcor import u_distance_correlation_sqr... | vnmabus/dcor | dcor/independence.py | Python | mit | 11,219 |
# Copyright 2021 Google LLC. 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... | tensorflow/tfx | tfx/orchestration/portable/partial_run_utils_test.py | Python | apache-2.0 | 68,347 |
# Copyright 2013 Metacloud, Inc.
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | himanshu-setia/keystone | keystone/assignment/controllers.py | Python | apache-2.0 | 39,657 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.