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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Post'
db.create_table(u'blog_post', (
(u'id', self.gf('django.db.models.fields.A... | megaprojectske/megaprojects.co.ke | megaprojects/blog/migrations/0001_initial.py | Python | apache-2.0 | 7,726 |
from linecache import getline, clearcache, checkcache
from datetime import datetime
import os
'''
with open('fort.63', 'r') as f:
for i in range(0,5):
print f.readline()
with open('fort.63', 'r') as f:
end = len(f.readlines())
'''
#---enter # of nodes in mesh
nnodes = 165290
... | jdorvi/CSHORE | extract_adcirc_63/extract63.py | Python | apache-2.0 | 2,541 |
#
# File : utils.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
#
# 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 th... | aozima/rt-thread | tools/utils.py | Python | gpl-2.0 | 3,953 |
#
# pyip is a Python package offering assembling/disassembling of raw ip packet
# including ip, udp, and icmp. Also it includes 2 utilities based on raw ip,
# traceroute and ping.
#
# pyip is released under PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, and is
# a project inspired by 'ping' written by Jeremy Hylton.
#
... | Zulan/PBStats | tests/fix_upload_bug/Linux/python3-pyip-0.7/inetutils.py | Python | gpl-2.0 | 1,635 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import string
from typing import Any
from typing import Generator
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
from ._compat import chr
from ._compat import decode
from ._utils import RF... | python-poetry/poetry-core | src/poetry/core/_vendor/tomlkit/parser.py | Python | mit | 42,075 |
from setuptools import setup, find_packages
setup(
name="python-turbovote",
version="0.0.2",
author="Fight for the Future",
author_email="",
packages=find_packages(),
license="LICENSE.txt",
description="Python wrapper for the TurboVote API",
long_description=open("README.txt").read(),
... | fightforthefuture/python-turbovote | setup.py | Python | gpl-3.0 | 375 |
import pytest
import pymasapi.client as client
class Test_Asset_Liability:
def setup_class(cls):
cls.c = client.Client()
def teardown_method(cls):
cls.c = None
@pytest.mark.parametrize("period,limit", [("m", 5), ("y", 5)])
def test_mas_asset_liability(cls, period, limit):
'''... | laisee/pymasapi | test/test_pymaspi_mas_assetliab.py | Python | mit | 489 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | Innogator/portfolio | portfolio/config/production.py | Python | bsd-3-clause | 4,349 |
prediction = simple_seq2seq(first_test_sequence).numpy()
print("prediction shape:", prediction.shape)
# Let's use `argmax` to extract the predicted token ids at each step:
predicted_token_ids = prediction[0].argmax(-1)
print("prediction token ids:", predicted_token_ids)
# We can use the shared reverse vocabulary to m... | m2dsupsdlclass/lectures-labs | labs/07_seq2seq/solutions/interpret_output.py | Python | mit | 969 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/keras/regularizers_test.py | Python | apache-2.0 | 3,702 |
#! /usr/bin/env python
'''
Demonstrates how simple group can be used as one-to-many
relationship using a column family
'''
import util
from pycassa.columnfamily import ColumnFamily
from pycassa.types import *
import time
from threading import Thread
import json
import datetime
import random
# Load data from data/movi... | naishe/mastering_cassandra | chapter_3/ch3_2.3.1_time_series1.py | Python | apache-2.0 | 2,069 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | huggingface/pytorch-transformers | src/transformers/models/bert/modeling_bert.py | Python | apache-2.0 | 77,484 |
import json
import os
import time
from urllib.parse import quote
def test_standard_requests():
""" Tests app controller methods. These tests should be
compartmentalized. Also these methods should be made to not retest
the behavior of the associated Manager class. """
from .test_utils import test_pulsa... | galaxyproject/pulsar | test/wsgi_app_test.py | Python | apache-2.0 | 3,083 |
# -*- coding: utf-8 -*-
'''
Flixnet Add-on
Copyright (C) 2016 Flixnet
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 3 of the License, or
(at your option) any... | azumimuo/family-xbmc-addon | plugin.video.showboxarize/resources/lib/modules/trailer.py | Python | gpl-2.0 | 4,137 |
# encoding: utf-8
# 2009 © Václav Šmilauer <eudoxos@arcig.cz>
"""
Core functionality (Scene in c++), such as accessing bodies, materials, interactions. Specific functionality tests should go to engines.py or elsewhere, not here.
"""
import woo
import unittest
import random
import os
from minieigen import *
from math i... | woodem/woo | py/tests/test_core.py | Python | gpl-2.0 | 30,561 |
from HTMLParser import HTMLParser
import simplejson as json
import database
import re
class MyHTMLParser(HTMLParser):
def array(self):
self.dataArray = []
def handle_data(self, data):
self.dataArray.append(data)
def htmlFormat(json_dump):
html = "<p><img src=\"https://graph.facebook... | chinoogawa/fbht | MyParser.py | Python | bsd-2-clause | 5,245 |
"""Super useful module"""
def print_num(number):
print(number)
| brooth/far.vim | test/very long directory name with spaces/very long file name also with spaces.py | Python | mit | 68 |
import fuse
| hubearth/odoo_fuse | models/__init__.py | Python | gpl-3.0 | 14 |
from classifip.models.qda import EuclideanDiscriminant, LinearDiscriminant, QuadraticDiscriminant, NaiveDiscriminant
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis, QuadraticDiscriminantAnalysis
import random, numpy as np, pandas as pd, sys
from sklearn.model_selection import KFold
from collection... | sdestercke/classifip | experiments/classification/qda/qda_common.py | Python | gpl-2.0 | 4,995 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-01 11:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('website', '0028_auto_20170601_1436'),
]
operations = [
migrations.DeleteModel(
... | hiezust/teask | website/migrations/0029_delete_github_user.py | Python | gpl-3.0 | 365 |
# reference: https://tkipf.github.io/graph-convolutional-networks/
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from scipy.special import expit
# np.random.seed(1)
G = nx.karate_club_graph()
A = nx.adjacency_matrix(G)
A = np.array(A.todense())
# parameters for synthtization
n = 50 #... | acgacgacgacg/biclustering | test_WL.py | Python | agpl-3.0 | 1,934 |
#
# Proximate - Peer-to-peer social networking
#
# Copyright (c) 2008-2011 Nokia Corporation
#
# All rights reserved.
#
# This software is licensed under The Clear BSD license.
# See the LICENSE file for more details.
#
from errno import EAGAIN, EINTR
from gobject import io_add_watch, IO_IN
import socket
from random im... | proximate/proximate | community.py | Python | bsd-3-clause | 37,731 |
#!/usr/bin/env python
import rospy
import math
import time
from sensor_msgs.msg import Range
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
from sonar_data_aggregator import SonarDataAggregator
from laser_data_aggregator import LaserDataAggregator
from navigation import Navigation
# Class... | etsardou/intelligent_robot_systems_2016 | art_autonomous_exploration/src/speeds_assignment.py | Python | gpl-3.0 | 4,002 |
# This library is free software, distributed under the terms of
# the GNU Lesser General Public License Version 3, or any later version.
# See the COPYING file included in this archive
""" Entangled DHT and distributed tuple space
The distributed hash table (DHT) used by Entangled is based on Kademlia,
and be accesse... | anupcshan/buddyfs | entangled/__init__.py | Python | mit | 992 |
"""
Test PEP 0448 -- Additional Unpacking Generalizations
https://www.python.org/dev/peps/pep-0448/
"""
# pylint: disable=superfluous-parens, unnecessary-comprehension
UNPACK_TUPLE = (*range(4), 4)
UNPACK_LIST = [*range(4), 4]
UNPACK_SET = {*range(4), 4}
UNPACK_DICT = {'a': 1, **{'b': '2'}}
UNPACK_DICT2 = {**UNPACK_D... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/s/star/star_needs_assignment_target_py35.py | Python | mit | 472 |
# _*_ coding:utf-8 _*_
"""
Created on 2015-06-13
@author: lujin
"""
from django.conf.urls import url
from app.setup import views
urlpatterns = [
url(r'^website/$', views.website),
url(r'^personal/$', views.personal),
] | myangeline/rorobot | app/setup/urls.py | Python | apache-2.0 | 228 |
'''
>>> p = Portfolio()
>>> stocks = (('APPL', 1000, 251.80, 252.73),
... ('CSCO', 5000, 23.09, 23.74),
... ('GOOG', 500, 489.23, 491.34),
... ('MSFT', 2000, 24.63, 25.44))
...
>>> for stock in stocks:
... p.add(Investment(*stock))
>>> print p['APPL']
1000 shares of APPL worth 252730.0... | csuttles/utils | python/py-book/oop/oop-3-portfolio.py | Python | apache-2.0 | 887 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from openerp.addons.connector.unit.mapper import (ExportMapper, ExportMapChild)
class ICOPSExportMapChild(ExportMapChild):
""" :py:class:`MapChild` for the Exports """
... | Elico-Corp/openerp-7.0 | base_intercompany/unit/mapper.py | Python | agpl-3.0 | 1,643 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | manojngb/Crazyfly_simple_lift | src/cflib/cflib/bootloader/cloader.py | Python | gpl-2.0 | 14,059 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks 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
import os
import json
import pytest
import sys
if sys.version_info < (2... | F5Networks/f5-ansible-modules | ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_gtm_monitor_tcp.py | Python | mit | 6,578 |
from __future__ import division
from sympy.external import import_module
from sympy.plotting.intervalmath import (
Abs, acos, acosh, And, asin, asinh, atan, atanh, ceil, cos, cosh,
exp, floor, imax, imin, interval, log, log10, Or, sin, sinh, sqrt,
tan, tanh,
)
np = import_module('numpy')
if not np:
di... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/plotting/intervalmath/tests/test_interval_functions.py | Python | mit | 9,816 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['MovingAverage'] , ['Seasonal_Minute'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_MovingAverage_Seasonal_Minute_AR.py | Python | bsd-3-clause | 170 |
"""Script to build the xpi add-in for firefox
Usage : python build-implicit-wait.py "x.x.x.x"
"""
import os, re, sys, shutil, datetime, zipfile, glob
CD = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = CD + r'\implicit-wait'
OUT_DIR = CD + r'\bin'
RDF_PATH = CD + r'\implicit-wait\install.rdf'
def main(args):... | florentbr/SeleniumBasic | FirefoxAddons/build-implicit-wait.py | Python | bsd-3-clause | 3,005 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2012, Jayson Vantuyl <jayson@aggressive.ly>
#
# 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
#... | Jmainguy/ansible-modules-core | packaging/os/apt_key.py | Python | gpl-3.0 | 12,627 |
from __future__ import (absolute_import, division, print_function)
from PyQt4 import QtGui
import Muon.GUI.Common.message_box as message_box
from qtpy import PYQT4
# determine whether the interface is opened from within Mantid or not
# (outside of Mantid we cannot use the "Manage user directories" functionality)
STAN... | mganeva/mantid | scripts/Muon/GUI/Common/help_widget/help_widget_view.py | Python | gpl-3.0 | 2,535 |
# coding=utf-8
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | google/pasta | setup.py | Python | apache-2.0 | 1,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"Fully test this module's functionality through the use of fixtures."
from megacosm.generators import Gem
import unittest2 as unittest
import fakeredis
from config import TestConfiguration
import fixtures
class TestGem(unittest.TestCase):
def setUp(self):
"... | CityGenerator/Megacosm-Generator | tests/test_gem.py | Python | gpl-2.0 | 980 |
"""
Object containing dynamic simulation state.
"""
import opiniongame.IO as og_io
import opiniongame.coupling as og_coupling
import opiniongame.opinions as og_opinions
import opiniongame.adjacency as og_adj
import numpy as np
class WorldState:
def __init__(self, adj, couplingWeights, initialOpinions, initialHist... | HNoorazar/PyOpinionGame | opiniongame/state.py | Python | gpl-3.0 | 4,551 |
"""Unit tests for reviewboard.reviews.views.ReviewRequestDetailView."""
from datetime import timedelta
from django.contrib.auth.models import User
from django.test.html import parse_html
from djblets.extensions.hooks import TemplateHook
from djblets.extensions.models import RegisteredExtension
from djblets.siteconfig... | reviewboard/reviewboard | reviewboard/reviews/tests/test_review_request_detail_view.py | Python | mit | 18,961 |
# Copyright 2012 Christoph Reiter <reiter.christoph@gmail.com>,
# 2012,2014 Nick Boultbee
#
# 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 op... | Mellthas/quodlibet | tests/plugin/test_titlecase.py | Python | gpl-2.0 | 1,547 |
#!/usr/bin/env python3
import os
import gzip
import sys
# Run this scrpipt under 33208_Vertebrate folder, mirroring the following site.
# http://eggnog5.embl.de/download/eggnog_5.0/per_tax_level/33208/
dirname_curr = os.path.dirname(os.path.realpath(__file__))
dirname_output = 'MODtree_ENOG50.raw_alg'
filename_out_ba... | taejoonlab/NuevoTx | MODtree/eggnog/ENOG50-to-MODtree.py | Python | apache-2.0 | 5,092 |
# Copyright (c) 2015 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi, Sophie Jazwiecki
import os
import time
from zope.interface import Interface, implementer
from elasticsearch.client import Elasticsearch
from arango import Arango
from... | ecreall/lagendacommun | lac/content/resources.py | Python | agpl-3.0 | 5,692 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-21 23:11
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | Mxious/Mxious | posts/migrations/0001_initial.py | Python | gpl-2.0 | 1,210 |
#!/usr/bin/env python
import unittest
class TestGood(unittest.TestCase):
def test_zero(self):
self.assertEqual(0, 0)
if __name__ == '__main__':
unittest.main()
| davetcoleman/catkin_tools | tests/integrated/resources/pkg_with_test/test_good.py | Python | apache-2.0 | 180 |
#
# 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... | wooga/airflow | tests/providers/apache/spark/hooks/test_spark_jdbc.py | Python | apache-2.0 | 4,769 |
from __future__ import print_function
from itertools import chain
import ast
import cgi
import re
import sys
from . import codegen
from . import runtime
PY35 = sys.version_info >= (3, 5, 0)
class Base(object):
def __init__(self):
self.inline_child = None
self.children = []
def iter_all_c... | mikeboers/PyHAML | haml/nodes.py | Python | bsd-3-clause | 18,376 |
import functools
from pyp2rpm import settings
def memoize_by_args(func):
"""Memoizes return value of a func based on args."""
memory = {}
@functools.wraps(func)
def memoized(*args):
if not args in memory.keys():
value = func(*args)
memory[args] = value
return ... | henrysher/spec4pypi | pyp2rpm/utils.py | Python | mit | 1,076 |
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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... | fernandog/Sick-Beard | sickbeard/providers/kat.py | Python | gpl-3.0 | 14,136 |
from django_filters.filters import MultipleChoiceFilter, ModelMultipleChoiceFilter
from django_filters.filterset import FilterSet
from account.models import School, Profile
from tag.models import TreeTag
class SchoolGenericFilterSet(FilterSet):
id = MultipleChoiceFilter(name='id',
... | ace-han/onedegree | admin/account/api/v1/filtersets.py | Python | bsd-3-clause | 822 |
# -*- coding: utf-8 -*-
"""Docx renderer module."""
import sys
import bleach
if not sys.version_info >= (3, 0):
from pydocx.parsers import Docx2Html
from mfr import RenderResult
def render_docx(fp, *args, **kwargs):
"""Generate an html representation of the docx file using PyDocx
:param ... | chrisseto/modular-file-renderer | mfr/ext/docx/render.py | Python | apache-2.0 | 699 |
#!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure LTCG is working properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp... | Jet-Streaming/gyp | test/win/gyptest-link-ltcg.py | Python | bsd-3-clause | 1,133 |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2012, Machinalis S.R.L.
# This file is part of quepy and is distributed under the Modified BSD License.
# You should have received a copy of license in the LICENSE file.
#
# Authors: Rafael Carrascosa <rcarrascosa@machinalis.com>
# Gonzalo Garcia Berrotara... | mpetyx/pychatbot | AIML/CAML/semiotics/quepy/quepy/expression.py | Python | apache-2.0 | 8,937 |
#!/usr/bin/python2.4
#
#
# Copyright 2017 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... | iparanza/earthenterprise | earth_enterprise/legacy_installer/Scripts/portable/windows-installer/check_server_running.py | Python | apache-2.0 | 1,661 |
# 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.
from indico.core import signals
from indico.core.db import db
from indico.modules.events.agreements.models... | indico/indico | indico/modules/events/agreements/util.py | Python | mit | 1,533 |
from django.core.urlresolvers import reverse
from testbase.unit import UnitTestCase
class TestAssertContextValueEqual(UnitTestCase):
def test_raisesNoErrorIfContextContainsExpectedValue(self):
response = self.get('home')
self.assertContextValueEqual(response, 'context_var', 'expected')
def te... | tctimmeh/django-testing-base | testsite/testapp/tests/unit/testAssertContextValueEqual.py | Python | mit | 892 |
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import sys
import collections
import numbers
from six import string_types
import warnings
import numpy as np
# If numba is installed, import jit. Otherwise, define an empty decorator with
# the same name.
HAS... | pabell/stingray | stingray/utils.py | Python | mit | 14,885 |
from pylab import *
def func(tt):
if tt=='aa':
print " ----> hell!"
raise SystemExit
else:
return 999.
print func('uu')
print func('aa')
| jimsrc/seatos | mcs/src/tmp/te.py | Python | mit | 171 |
#!/usr/bin/python
import Tkinter
from Tkinter import *
from PIL import ImageTk, Image
import os
import time
root = Tk()
frame = Frame(root)
root.wm_title("Switch to Windows")
frame.pack()
bottomframe = Frame(root)
bottomframe.pack( side = BOTTOM )
def shutdownPress():
text.config(text = "Shutting down...")
... | billwi/Ubuntu-setup | Configs/SwitchToWindows/windowsStartup.py | Python | mpl-2.0 | 1,090 |
import warnings
from asl_data import SinglesData
def recognize(models: dict, test_set: SinglesData):
""" Recognize test word sequences from word models set
:param models: dict of trained models
{'SOMEWORD': GaussianHMM model object, 'SOMEOTHERWORD': GaussianHMM model object, ...}
:param test_set: Si... | loredanacirstea/ai-algos | hidden_markov_models/my_recognizer.py | Python | gpl-3.0 | 1,646 |
"""
Testing for the tree module (sklearn.tree).
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from sklearn import tree
fro... | maxlikely/scikit-learn | sklearn/tree/tests/test_tree.py | Python | bsd-3-clause | 19,420 |
import os
from botplugin import BotPlugin
gifs = []
def get_doggif():
import random
global gifs
if not len(gifs):
fname = os.path.join(os.path.dirname(__file__), 'doggif.txt')
f = open(fname, 'r')
gifs = f.read().split()
f.close()
random.shuffle(gifs)
return gi... | aelse/MrHappy | botplugins/cmd_doggif.py | Python | gpl-3.0 | 1,369 |
from sklearn.linear_model import Lasso
def get_lasso_prediction(train_data, train_truth, test_data, test_truth, alpha=1.0, iter_id=0):
clf = Lasso(alpha=alpha)
clf.fit(train_data, train_truth)
predicted = clf.predict(test_data)
return predicted.ravel()
| rileymcdowell/genomic-neuralnet | genomic_neuralnet/methods/lasso_regression.py | Python | mit | 270 |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Class for storing Skia Gold comparison properties.
Examples:
* git revision being tested
* Whether the test is being run locally or on a bot
* What the co... | ric2b/Vivaldi-browser | chromium/build/skia_gold_common/skia_gold_properties.py | Python | bsd-3-clause | 4,742 |
from .fw1 import get_dot_completions, get_script_completions, get_inline_documentation
from .. import completions, inline_documentation
completions.add_completion_source('script', get_script_completions)
completions.add_completion_source('dot', get_dot_completions)
inline_documentation.add_documentation_source(get_inl... | jcberquist/SublimeText-Lucee | src/fw1/__init__.py | Python | mit | 339 |
import zstackwoodpecker.test_state as ts_header
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template2", path_list=[
[TestAction.create_volume, "volume1", "=scsi"],
[TestAction.create_volume, "volume2", "=scsi"],
#[TestAction.create_volume, "volume3", "=scsi"],
#[TestAction.crea... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/volumes/paths/path99.py | Python | apache-2.0 | 2,275 |
# Implementation of Binary Search algorithm
import random
def main():
_list = random.sample(xrange(1, 101), 10)
value = 87
print("Searching for the value: " + str(value))
if binarySearch(value):
print("The number " + str(value) + " found in the list")
else:
print("The number " + st... | eneskemalergin/Data_Structures_and_Algorithms | Chapter5/binarysearch.py | Python | gpl-3.0 | 1,151 |
from modularui import csv_autolog
csv_autolog() | jasongtz/RataTAT-web | csvonly.py | Python | mit | 48 |
import random
import datetime
import time
import hashlib
from django.db import models
from django.conf import settings
from django.urls import reverse
from django.contrib.auth.models import User, Group
from django.db.models.signals import post_save
from djangopress.core.models import Property
from django.utils import ... | codefisher/djangopress | djangopress/accounts/models.py | Python | mit | 5,282 |
########################################################################
# Copyright 2012 wst, wstcode@gmail.com
#
# This file is part of wstbot.
#
# wstbot 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, eith... | salamiwst/wstbot | patches/media_to_db.py | Python | gpl-3.0 | 1,982 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | amacd31/bom_data_parser | bom_data_parser/_version.py | Python | bsd-3-clause | 15,781 |
#!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script for generating new binary protobuf seeds for fuzzers.
Currently supports creating a single seed binary protobuf of the form
... | chromium/chromium | components/zucchini/fuzzers/generate_fuzzer_data.py | Python | bsd-3-clause | 2,665 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2010 Jonathan Matthew
#
# 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, or (at your ... | dignan/control | plugins/replaygain/replaygain/__init__.py | Python | gpl-2.0 | 2,008 |
import traci
import os, sys
import environment_state
if 'SUMO_HOME' not in os.environ:
print "SUMO setup incomplete. Exiting."
exit()
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
sumoBinary = "C:/Program Files (x86)/DLR/Sumo/bin/sumo-gui"
sumoCmd = [sumoBinary, "-c", "C:/Users/sree... | kamikazekartik/madrl_traffic_control | Sumo Stuff/main.py | Python | mit | 491 |
from __future__ import absolute_import, division, unicode_literals
import re
from xml.sax.saxutils import escape, unescape
from pipenv.patched.notpip._vendor.six.moves import urllib_parse as urlparse
from . import base
from ..constants import namespaces, prefixes
__all__ = ["Filter"]
allowed_elements = frozenset(... | kennethreitz/pipenv | pipenv/patched/notpip/_vendor/html5lib/filters/sanitizer.py | Python | mit | 26,266 |
# Copyright (C) 2010 Michael Foord
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# This software is licensed under the terms of the BSD license.
# http://www.voidspace.org.uk/python/license.shtml
from __future__ import with_statement
from _weakref import ref
__all__ = ['WeakSet']
__version__ = '1.0.0'
class _I... | spacetelescope/PyFITS | pyfits/_compat/_weakset_py2/__init__.py | Python | bsd-3-clause | 6,423 |
from parser.calc.base import calc
| tehmaze/parser | parser/calc/__init__.py | Python | mit | 34 |
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware
from ..PulseSequencePlotter import plot_pulse_files
from .helpers import create_cal_seqs
from itertools import product
import operator
from ..ControlFlow import *
from ..TdmInstructions import *
from functools import reduce
from typing import It... | BBN-Q/QGL | QGL/BasicSequences/Feedback.py | Python | apache-2.0 | 12,237 |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | souravbadami/oppia | core/domain/role_services_test.py | Python | apache-2.0 | 4,392 |
from django.conf.urls import patterns, include, url
from django.conf import settings
# Here, user contacts.profile will cause some 'mismatch' since contacts is also a module
from profile import ProfileView
from contacts import ContactsView
from authen import Authenticate
strid = settings.CONTACT_URL['strid']
user = s... | sharehub/DBRest | dbrest/contacts/urls.py | Python | mit | 858 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, Optional
from UM.Application import Application
from UM.Decorators import override
from UM.Settings.Interfaces import PropertyEvaluationContext
from UM.Settings.SettingInstance import InstanceState
... | thopiekar/Cura | cura/Settings/PerObjectContainerStack.py | Python | lgpl-3.0 | 3,365 |
from bottle import template
print template('form', {})
| alixedi/recline | test.py | Python | mit | 56 |
"""
Tools for formulating interpretable/implementable MDPs as mathematical optimization
problems (MILP). This solves the models as described in:
Petrik, M., & Luss, R. (2016). Interpretable Policies for Dynamic Product Recommendations. In Uncertainty in Artificial Intelligence (UAI).
Usage:
- Use get_milp_... | marekpetrik/RAAM | raam/implementable.py | Python | mit | 11,043 |
"""
kombu.utils.eventio
===================
Evented IO support for multiple platforms.
"""
from __future__ import absolute_import
import errno
import select as __select__
import socket
from numbers import Integral
_selectf = __select__.select
_selecterr = __select__.error
epoll = getattr(__select__, 'epoll', None)... | sunze/py_flask | venv/lib/python3.4/site-packages/kombu/utils/eventio.py | Python | mit | 7,868 |
#import uncertainties
#from uncertainties import ufloat
import math
import numpy
import numpy
import pylab
from scipy.optimize import curve_fit
import math
import scipy.stats
import uncertainties
from uncertainties import ufloat, unumpy
import matplotlib.pyplot as plt
def ff(x, a, I, V):
return I*(numpy.exp(a*(V-... | fedebell/Laboratorio3 | Fotoelettrico/subplotexp.py | Python | gpl-3.0 | 3,927 |
from sensor import Sensor
import grovepi
# (5 * grovepi.analogRead(0) * 100) / 1024 <--- formula for LM35 sensor
class Temperature(Sensor):
name = 'Temperature'
def __init__(self, pin, logger=None):
Sensor.__init__(self, self.name, logger)
self.pin = pin
self.connect()
def connect(self):
if(not isinstance(s... | GoMake/gomake-telemetry | telemetry/internaltemp.py | Python | mit | 841 |
from typing import List, Tuple
from ...pipeline import Lemmatizer
from ...tokens import Token
class DutchLemmatizer(Lemmatizer):
@classmethod
def get_lookups_config(cls, mode: str) -> Tuple[List[str], List[str]]:
if mode == "rule":
required = ["lemma_lookup", "lemma_rules", "lemma_exc", "... | spacy-io/spaCy | spacy/lang/nl/lemmatizer.py | Python | mit | 4,608 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0011_sentence'),
]
operations = [
migrations.AddField(
model_name='sentence',
name='article'... | leehosung/writing_sandbox | quiz/migrations/0012_auto_20150127_0316.py | Python | mit | 1,017 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'map_review',
'HOST': 'localhost'
}
}
| stringfellow/map_review | map_review/settings/devel.py | Python | gpl-2.0 | 258 |
from threading import Thread
import Queue
class TQueue(Queue.Queue):
def __init__(self, workers=5, maxsize=0):
#super(TQueue, self).__init__(maxsize=maxsize)
Queue.Queue.__init__(self, maxsize=maxsize)
self._workers = workers
self._start_workers()
def add_task(self... | hellopanpy/myscript | zabbix/alarter/thread.py | Python | gpl-3.0 | 805 |
# Copyright (c) 2011 OpenStack Foundation
# 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 ... | vipulsabhaya/cue | cue/common/policy.py | Python | apache-2.0 | 3,164 |
from django.contrib.auth.models import User
from .models import Profile
from django.db.models.signals import post_save
from django.dispatch import receiver
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
@r... | NeverWalkAloner/collectiveblogs | users/signals.py | Python | gpl-3.0 | 520 |
"""
These are debug machines used for content creators, so they're kind of a cross
between dev machines and AWS machines.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
from .aws im... | jswope00/griffinx | lms/envs/content.py | Python | agpl-3.0 | 1,435 |
# http://www.creatis.insa-lyon.fr/~bernard/creaseg/
# http://ascratchpad.blogspot.com/2011/03/image-segmentation-using-active.html
#------------------------------------------------------------------------
# Region Based Active Contour Segmentation
#
# seg = region_seg(I,init_mask,max_its,alpha,display)
#
# Inputs: I ... | BioMedIA/irtk-legacy | wrapping/cython/irtk/ext/chanvese.py | Python | bsd-3-clause | 9,929 |
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import pytest
pytestmark = pytest.mark.asyncio
async def test_substitute_prefix(get_version):
assert await get_version("example", {
"source": "manual",
"manual": "v1.0",
"prefix": "v",
}) == "1.0"
async def... | lilydjwg/nvchecker | tests/test_substitute.py | Python | mit | 1,490 |
import contextlib # closing
import pytest
from journal import app
from journal import connect_db
from journal import get_database_connection
from journal import init_db
# The walkthrough implied this manages browser cookies when used...
from flask import session
TEST_DSN = 'dbname=test_learning_journal user=fried'... | defzzd/learning_journal | test_journal.py | Python | mit | 10,338 |
# -----------------------------------------------------------------------------
# Karajlug.org
# Copyright (C) 2010 Karajlug community
#
# 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 Found... | Karajlug/karajlug | books/urls.py | Python | gpl-2.0 | 1,132 |
#!/usr/bin/env python3
# Set up imports and paths
bufferpath = "../../dataAcq/buffer/python"
sigProcPath = "../signalProc"
from psychopy import visual, core, event, gui, sound, data, monitors
import numpy as np
import sys
import socket
from time import sleep, time
import os
bufhelpPath = "../../python/signalProc"
sys.p... | jadref/buffer_bci | tutorial/lect3-helloworld/ERPviewer_stimulus_psychopy_skel.py | Python | gpl-3.0 | 1,698 |
from sage.all import RealDistribution
from yanntricks import *
def ChiSquared():
pspict,fig = SinglePicture("ChiSquared")
pspict.dilatation_X(0.5)
pspict.dilatation_Y(50)
f=phyFunction(RealDistribution("chisquared",10).distribution_function).graph(0,30)
f.linearr_plotpoints=1000
pspict.DrawGra... | LaurentClaessens/mazhe | src_yanntricks/yanntricksChiSquared.py | Python | gpl-3.0 | 471 |
# -*- coding: utf-8 -*-
# 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/.
PROJECT_NAME = 'tooltool/api'
APP_NAME = 'tooltool_api'
PULSE_ROUTE_CHECK_FILE_PENDING_UPLOADS =... | La0/mozilla-relengapi | src/tooltool/api/tooltool_api/config.py | Python | mpl-2.0 | 447 |
# -*- coding: utf-8 -*-
import logging
from logging import DEBUG, INFO, WARN, ERROR, CRITICAL
import sys
import warnings
#
# Exceptions
#
class MarkdownException(Exception):
""" A Markdown Exception. """
pass
class MarkdownWarning(Warning):
""" A Markdown Warning. """
pass
#
# Global functions
#
... | DJMelonz/basic-blog | markdown/md_logging.py | Python | bsd-3-clause | 702 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.