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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import mock
import os
import unittest
from mkdocs import nav, utils, exceptions
from mkdocs.tests.base import dedent
class UtilsTests(unittest.TestCase):
def test_html_path(self):
expected_results = {
'index.md': ... | luweicong/loovee_live_src | mkdocs/tests/utils/utils_tests.py | Python | bsd-2-clause | 6,425 |
class Example1:
def __init__(self):
self.field1 = 1
class Example2(Example1):
def __init__(self): # Some valuable comment here
Example1.__init__(self) | asedunov/intellij-community | python/testData/inspections/AddCallSuperCommentAfterColonPreserved_after.py | Python | apache-2.0 | 177 |
# coding: utf-8
from flask.ext import wtf
import flask
import wtforms
import auth
import config
import model
import util
from main import app
###############################################################################
# Admin Stuff
###############################################################################... | tiberiucorbu/av-website | main/views/admin/dashboard/dashboard_controller.py | Python | mit | 502 |
# ext/horizontal_shard.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
"""Horizontal sharding support.
Defines a rudimental 'horizontal sharding' sy... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/sqlalchemy/ext/horizontal_shard.py | Python | mit | 4,953 |
from sdoc.sdoc1.data_type.DataType import DataType
class StringDataType(DataType):
"""
Class for string data types.
"""
# ------------------------------------------------------------------------------------------------------------------
def __init__(self, value: str):
"""
Object c... | SDoc/py-sdoc | sdoc/sdoc1/data_type/StringDataType.py | Python | mit | 3,015 |
"""Creates Github links from @user and #issue text.
Bascially a much simplified version of sphinxcontrib.issuetracker
with support for @user.
"""
import re
from docutils import nodes
from docutils.transforms import Transform
GITHUB_ISSUE_URL = "https://github.com/{0}/issues/{1}"
GITHUB_USER_URL = "https://github.co... | beardypig/streamlink | docs/ext_github.py | Python | bsd-2-clause | 2,059 |
# Copyright 2016 Capital One Services, 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... | siddartha1992/cloud-custodian | tools/c7n_mailer/c7n_mailer/sqs_queue_processor.py | Python | apache-2.0 | 7,011 |
from flask import Flask, render_template, flash, request, jsonify
from flask_bootstrap import Bootstrap
from flask_nav import Nav
from flask_nav.elements import Navbar, View, Subgroup, Link, Text, Separator
from flask_wtf import Form
from flask_wtf.file import FileField, FileRequired
from wtforms.fields import StringFi... | iDigBio/idq | idq/harness/__init__.py | Python | mit | 3,231 |
##########################################################################
#
# Copyright (c) 2015, John Haddon. 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 so... | chippey/gaffer | python/GafferDispatchUI/PythonCommandUI.py | Python | bsd-3-clause | 3,382 |
#!/usr/bin/env python3
# ABOUT
# Artisan Roast Calculator
# LICENSE
# This program or module 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
# version 3 of the License, or... | MAKOMO/artisan | src/artisanlib/calculator.py | Python | gpl-3.0 | 15,918 |
import numpy as np
from scipy.special import erf, erfinv
# =============================================================================
# Define variables
# =============================================================================
sqrt2 = np.sqrt(2)
sqrt2pi = np.sqrt(2 * np.pi)
# ==============================... | njcuk9999/neil_functions | neil_stats_functions.py | Python | mit | 4,576 |
# 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 to in writing, ... | google-research/selfstudy-adversarial-robustness | defense_discretize/model.py | Python | apache-2.0 | 2,341 |
import sys
import os
extensions = [
'sphinx.ext.todo',
]
source_suffix = '.txt'
master_doc = 'index'
### part to update ###################################
project = u'domogik-plugin-daikcode'
copyright = u'2014, Nico0084'
version = '0.1'
release = version
######################################################
... | Nico0084/domogik-plugin-daikcode | docs/conf.py | Python | gpl-3.0 | 430 |
from . import test_account_banking_mandate_usability
| oihane/odoo-addons | account_banking_mandate_usability/tests/__init__.py | Python | agpl-3.0 | 53 |
import tempfile
import pytest
# this is require near the top to do setup of the test suite
# from counterpartylib.test import conftest
from counterpartylib.test.util_test import CURR_DIR as CPLIB_TESTDIR
import os
from pycoin.serialize import b2h
from picopayments_hub import db
from picopayments_hub import api
from p... | F483/picopayments | tests/db_test.py | Python | mit | 3,038 |
from os import path
class TestNodeIntegration:
def test_get_subvolumes(self, driver, node):
driver.create({'id': 32, 'reserved_size': 1})
assert '32' in node.get_subvolumes()
def test_get_space(self, driver, node):
driver.create({'id': 32, 'reserved_size': 1})
assert 2 == node... | PressLabs/cobalt | tests/integration/models/node/test_node_integration.py | Python | apache-2.0 | 427 |
import os
def trash_existing_tables():
database_path = os.path.abspath('archive.db')
if os.path.isfile(database_path):
print 'Removing existing database...'
os.remove(database_path)
print 'Database removed.'
if __name__ == '__main__':
trash_existing_tables()
| itsmeolivia/NOT-a-trivial-pursuit | steps/trash_existing_tables.py | Python | mit | 298 |
""" Copyright 2020 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 to in writing, software
di... | googleinterns/intern2020_cocal | uncertainty/model/resnet_util.py | Python | apache-2.0 | 25,028 |
from django.core.serializers.json import Serializer
from ..builtins import StringIO
class CustomizableLocalFieldsSerializer(Serializer):
"""
This is a not so elegant copy/paste from django.core.serializer.base.Serializer serialize method.
We wanted to add parent fields of current serialized object becaus... | iwoca/django-deep-collector | deep_collector/compat/serializers/django_1_9.py | Python | bsd-3-clause | 2,672 |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
@testing.parameterize(*testing.product({
'dtype': [numpy.float16, nu... | kikusu/chainer | tests/chainer_tests/functions_tests/normalization_tests/test_local_response_normalization.py | Python | mit | 2,262 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Canto - ncurses RSS reader
# Copyright (C) 2008 Jack Miller <jack@codezen.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
f... | themoken/Canto | canto/cfg/base.py | Python | gpl-2.0 | 5,452 |
from __future__ import absolute_import
# Copyright (c) 2010-2014 openpyxl
#
# 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 u... | Hitachi-Data-Systems/org-chart-builder | openpyxl/xml/__init__.py | Python | apache-2.0 | 1,899 |
from alembic.operations import Operations
from alembic.environment import EnvironmentContext
op = Operations()
context = EnvironmentContext()
| hurricup/intellij-community | python/helpers/python-skeletons/alembic.py | Python | apache-2.0 | 144 |
import spacy
subjects = set(['nsubj'])
objects = set(['dobj', 'pobj'])
def merge_noun_phrases(sent_doc):
for np in sent_doc.noun_chunks:
np.merge(np.root.tag_, np.text, np.root.ent_type_)
def merge_entities(sent_doc):
for ent in sent_doc.ents:
ent.merge(ent.root.dep_, ent.text, ent.label_)
de... | TimDettmers/spodernet | spodernet/utils/spacy_util.py | Python | mit | 3,124 |
import time
import unittest
from graphite.worker_pool import pool
class TestPool(unittest.TestCase):
def tearDown(self):
pool.stop_pools()
def test_basic(self):
p = pool.get_pool()
results = pool.pool_exec(p, [], 1)
self.assertEqual(list(results), [])
def test_exception... | DanCech/graphite-web | webapp/tests/test_worker_pool.py | Python | apache-2.0 | 1,941 |
import csv
def get_name_score(name):
score = 0
for ch in name:
score += ord(ch.lower()) - ord('a') + 1
return score
def find_total_name_scores_from_file(filename):
# read/parse from file
names = []
with open(filename, 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
... | birdchan/project_euler | problems/022/run.py | Python | mit | 762 |
#!/usr/bin/python
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distribu... | tumf/xen-3.3.1 | tools/python/xen/xm/xenapi_create.py | Python | gpl-2.0 | 33,167 |
#!/usr/bin/env python
# import
from __future__ import print_function
## batteries
import os
import sys
import pytest
## 3rd party
import numpy as np
import pandas as pd
## package
from SIPSim.Commands import Fragment_KDE as Fragment_KDE_CMD
from SIPSim import Utils
# data dir
test_dir = os.path.join(os.path.dirname(__... | nick-youngblut/SIPSim | tests/test_Fragment_KDE.py | Python | mit | 526 |
# -*- coding: utf-8 -*-
#
# test_labeled_synapses.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 L... | magnastrazh/NEUCOGAR | nest/serotonin/research/C/nest-2.10.0/pynest/nest/tests/test_labeled_synapses.py | Python | gpl-2.0 | 5,391 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension('fsdt_donnell_bc3_nonlinear',
['fsdt_donnell_bc3_nonlinear.pyx'],
extra_compile_args=['/openmp',
'/O2', '/favor:IN... | albertoferna/compmech | compmech/conecyl/fsdt/setup_fsdt_donnell_bc3_nonlinear.py | Python | bsd-3-clause | 517 |
# Copyright (c) 2012 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.
import os
import re
import urlparse
def _UrlPathJoin(*args):
"""Joins each path in |args| for insertion into a URL path.
This is distinct from os.p... | mogoweb/chromium-crosswalk | tools/telemetry/telemetry/page/page.py | Python | bsd-3-clause | 3,424 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-29 22:39
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 = [
migratio... | andela-sjames/Django-ReactJS-Library-App | reactlibapp/libraryapi/migrations/0001_initial.py | Python | mit | 5,719 |
import librosa
import numpy as np
def test_dtw_global():
# Example taken from:
# Meinard Mueller, Fundamentals of Music Processing
X = np.array([[1, 3, 3, 8, 1]])
Y = np.array([[2, 0, 0, 8, 7, 2]])
gt_D = np.array([[1., 2., 3., 10., 16., 17.],
[2., 4., 5., 8., 12., 13.],
... | craffel/librosa | tests/test_dtw.py | Python | isc | 2,830 |
import time
import RPi.GPIO as GPIO
# Constants
PULSE_LEN = 0.03 # length of clock motor pulse
A_PIN = 18 # one motor drive pin
B_PIN = 23 # second motor drive pin
# Configure the GPIO pins
GPIO.setmode(GPIO.BCM)
GPIO.setup(A_PIN, GPIO.OUT)
GPIO.setup(B_PIN, GPIO.OUT)
# Glogal variables
positive_polarity... | simonmonk/pi_magazine | 04_analog_clock/analog_clock_24.py | Python | mit | 1,066 |
# 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.
"""Presubmit script for components/url_pattern_index directory.
See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more detail... | scheib/chromium | components/url_pattern_index/PRESUBMIT.py | Python | bsd-3-clause | 1,806 |
"""
Script for generating smart playlists based on a seeding track and last.fm api
Created by: ErlendSB
"""
import os
import httplib, urllib, urllib2
import sys, time
import xbmc, xbmcgui, xbmcaddon
from urllib import quote_plus, unquote_plus
import re
class Main:
countFoundTracks = 0
foundTracks... | pacificIT/lastfmplaylistgenerator | default.py | Python | gpl-2.0 | 6,419 |
from symfit import parameters, variables, Fit, Piecewise, exp, Eq, Model
import numpy as np
import matplotlib.pyplot as plt
x, y = variables('x, y')
a, b, x0 = parameters('a, b, x0')
# Make a piecewise model
y1 = x**2 - a * x
y2 = a * x + b
model = Model({y: Piecewise((y1, x <= x0), (y2, x > x0))})
# As a constraint... | tBuLi/symfit | examples/piecewise2.py | Python | gpl-2.0 | 966 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['pname', 'index', 'val'])
def glGetMultisamplefvNV(pname, index, val):
pass
@params(api='gl', prms=['index', 'mask'])
def glSampleMaskIndexedNV(index, mask):
pass
@params(api='gl', prms=['target', 'renderbuffer'])
def glTexRenderbufferNV(target, renderbuffe... | cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/NV/explicit_multisample.py | Python | mit | 332 |
#------------------------------------------------------------------------------
# _dd.py
#
# Parser for the jam 'd' debug flag output - which contains details of
# file dependencies, and inclusions.
#
# November 2015, Jonathan Loh
#------------------------------------------------------------------------------
"""jam -... | ensoft/jamjar | jamjar/parsers/_dd.py | Python | mit | 2,088 |
"""
Realtek Semiconductor Corp.
RTL8195A elf2bin script
"""
import sys, array, struct, os, re, subprocess
import hashlib
import shutil
from tools.paths import TOOLS_BOOTLOADERS
from tools.toolchains import TOOLCHAIN_PATHS
from datetime import datetime
# Constant Variables
RAM2_RSVD = 0x00000000
RAM2_VER = 0x8195FFF... | HeadsUpDisplayInc/mbed | tools/targets/REALTEK_RTL8195AM.py | Python | apache-2.0 | 10,067 |
######################################################################
#
# energy.py: calculate the energy of a molecule
#
######################################################################
from __future__ import print_function
from openbabel import openbabel
import sys
# Make sure we have a filename
try:
filen... | dkoes/openbabel | scripts/python/examples/energy.py | Python | gpl-2.0 | 1,195 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import re
from myuw.dao.category_links import get_links_for_category
from myuw.logger.timer import Timer
from myuw.logger.logresp import log_data_not_found_response
from myuw.logger.logresp import log_api_call
from my... | uw-it-aca/myuw | myuw/views/api/category_links.py | Python | apache-2.0 | 2,335 |
from spine.management.commands.generate import scaffold
from .base import TestSpineBase
class TestSpineScaffold(TestSpineBase):
def setUp(self):
super(TestSpineScaffold, self).setUp()
self.new_setUp()
def tearDown(self):
super(TestSpineScaffold, self).tearDown()
self.new_tear... | ikeikeikeike/django-spine | tests/gencmd/tests/scaffold.py | Python | mit | 835 |
import gui.fitCommands as cmd
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from service.fit import Fit
class FillWithModule(ContextMenuSingle):
visibilitySetting = 'moduleFill'
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, cal... | DarkFenX/Pyfa | gui/builtinContextMenus/moduleFill.py | Python | gpl-3.0 | 1,151 |
#!/usr/bin/env python
"""
We'll be working with the data from the American Community Survey from a survey on job outcomes for recent college graduates based on the major they studied in college.
You can find the cleaned up version of the dataset on FiveThirtyEight's Github repo.
Here are some of the columns in the da... | tleonhardt/CodingPlayground | dataquest/DataVisualiation/data_exploration.py | Python | mit | 3,074 |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
from unittest2 import TestCase as TC
else:
import unittest
from unittest import TestCase as TC
skip = unittest.skip
_dummy = False
# less than 2.6 ...
if sys.version_info[0] == 2 and sys.version_info[1] <= 6:
_dummy = True
def... | rembo10/headphones | lib/unittestcompat.py | Python | gpl-3.0 | 3,835 |
from textblob import TextBlob
import mongoengine
import config
from models import Tweet
def naive_tweet_polarity(tweet):
"""
*Very* naive algorithm computing tweet polarity (ranging from -1 to 1).
"""
blob = TextBlob(tweet.status)
try:
polarities = [x.sentiment.polarity for x in blob.sent... | jmcomets/twitto-feels | more_feels.py | Python | apache-2.0 | 880 |
from typing import Callable, Tuple, Type
import eagerpy as ep
from .types import BoundsInput, Bounds
from .attacks.base import Attack
def evolutionary_strategies_gradient_estimator(
AttackCls: Type[Attack],
*,
samples: int,
sigma: float,
bounds: BoundsInput,
clip: bool,
) -> Type[Attack]:
... | bethgelab/foolbox | foolbox/gradient_estimators.py | Python | mit | 1,619 |
"""
.. _ex-hf-sef-data:
==============
HF-SEF dataset
==============
This example looks at high-frequency SEF responses.
"""
# Author: Jussi Nurminen (jnu@iki.fi)
#
# License: BSD (3-clause)
import mne
import os
from mne.datasets import hf_sef
fname_evoked = os.path.join(hf_sef.data_path(),
... | olafhauk/mne-python | examples/datasets/plot_hf_sef_data.py | Python | bsd-3-clause | 986 |
from Cython.TestUtils import CythonTest
from Cython.Compiler.TreeFragment import *
from Cython.Compiler.Nodes import *
from Cython.Compiler.UtilNodes import *
import Cython.Compiler.Naming as Naming
class TestTreeFragments(CythonTest):
def test_basic(self):
F = self.fragment(u"x = 4")
T = F.copy()... | bzzzz/cython | Cython/Compiler/Tests/TestTreeFragment.py | Python | apache-2.0 | 2,243 |
from .strand import * | amylittleyang/OtraCAD | cadnano25/cadnano/strand/__init__.py | Python | mit | 21 |
import requests
import json
from zone import ZoneBase
class HotWater(ZoneBase):
def __init__(self, client, data=None):
super(HotWater, self).__init__()
self.client = client
self.zone_type = 'domesticHotWater'
if data is not None:
self.__dict__.update(data)
... | sander76/evohome-client | evohomeclient2/hotwater.py | Python | apache-2.0 | 1,288 |
"""
Django settings for UploadPic2 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | GitSomeCode/Django-Jquery-Photo-App | UploadPic2/settings.py | Python | mit | 2,237 |
# Created On: 2012/01/23
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
class TextFi... | hsoft/pdfmasher | qtlib/text_field.py | Python | gpl-3.0 | 814 |
from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwords
from collections import defaultdict
from string import punctuation
from heapq import nlargest
import re
"""
Modified from http://glowingpython.blogspot.co.uk/2014/09/text-summarization-with-nltk.html
"""
class FrequencySummarizer... | rebeccamorgan/easyskim | nat_proc/FrequencySummarizer.py | Python | apache-2.0 | 2,032 |
# vim:ts=4:sw=4:expandtab
'''Simple udp echo server and client.
'''
import sys
from diesel import (
UDPService, UDPClient, call, send, datagram, quickstart, receive,
)
class EchoClient(UDPClient):
"""A UDPClient example.
Very much like a normal Client but it can only receive datagrams
from the wire.
... | dieseldev/diesel | examples/udp_echo.py | Python | bsd-3-clause | 1,225 |
#!/bin/python
import re
import sys
import os
from datetime import date
class VersionHandler:
def __init__(self, file):
self.file = file
self.major = 0
self.minor = 0
self.revision = 0
self.build = 1
self.touch()
def read(self):
try:
f = open(self.file, 'r')
lines = f.readlines()
f.close()
... | mickem/nscp | build/python/VersionHandler.py | Python | gpl-2.0 | 2,824 |
#!/usr/bin/env python
'''
Chamomile
=========
A small script to help you sleep.
Based heavily on David Shaw's sleepyti.me bedtime calculator.
'''
from __future__ import print_function
from datetime import date as datedate, datetime, timedelta
import argparse
import textwrap
import sys
__copyright__ ... | bdchauvette/chamomile | chamomile.py | Python | isc | 4,573 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 - 2017 CoNWeT Lab., Universidad Politécnica de Madrid
# This file belongs to the business-charging-backend
# of the Business API Ecosystem.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License... | FIWARE-TMForum/business-ecosystem-charging-backend | src/wstore/admin/users/notification_handler.py | Python | agpl-3.0 | 8,152 |
class Solution:
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
people = sorted(people, key=lambda x: x[1])
people = sorted(people, key=lambda x: x[0], reverse=True)
res = []
for p in people:
... | stuti-rastogi/leetcodesolutions | 406_queueReconstructionByHeight.py | Python | apache-2.0 | 360 |
import six.moves
import datetime
import unittest
from mock import patch, Mock, mock_open
from vwunfinished import (UnfinishedTasksCounter,
VimwikiFileProvider,
vimwiki_unfinished_tasks,
parser,)
class TestUnfinishedTasksCounter(unittest.Te... | vimwiki/utils | tests/test_vwunfinished.py | Python | mit | 6,511 |
#! /usr/bin/env python
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | firebase/firebase-ios-sdk | FirebasePerformance/ProtoSupport/proto_generator.py | Python | apache-2.0 | 8,973 |
#!/usr/bin/env python
""" AnDA_stat_functions.py: Collection of statistical functions used in AnDA. """
__author__ = "Phi Huynh Viet"
__version__ = "2.0"
__date__ = "2017-08-01"
__email__ = "phi.huynhviet@telecom-bretagne.eu"
import numpy as np
def AnDA_RMSE(a,b):
""" Compute the Root Mean Square Error betw... | rfablet/PB_ANDA | AnDA_stat_functions.py | Python | gpl-3.0 | 6,040 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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, eit... | Endika/hr | hr_policy_group/hr_policy_group.py | Python | agpl-3.0 | 2,073 |
# MIT License
#
# Copyright (c) 2014 Gaetan Guidet
#
# This file is part of excons.
#
# 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 rig... | gatgui/excons | tools/szip.py | Python | lgpl-3.0 | 2,625 |
from flask_wtf import Form
from wtforms import StringField, SelectField, IntegerField, SubmitField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import InputRequired
from ..models import Client, User
def get_all_clients():
return Client.query.filter_by(active=True).order_by(Cl... | ryanmattc/CDManager | app/magazines/forms.py | Python | apache-2.0 | 1,082 |
from __future__ import print_function
from collections import Counter, deque
import sys
import time
import numpy as np
try:
from sklearn import neighbors, svm
HAVE_SK = True
except ImportError:
HAVE_SK = False
from common import *
from myo_raw import MyoRaw
SUBSAMPLE = 3
K = 15
class NNClassifier(obje... | Victor-Haefner/polyvr | extras/python/Myo/myo.py | Python | gpl-3.0 | 3,106 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | elopio/snapcraft | tests/integration/general/test_build_snap_grammar.py | Python | gpl-3.0 | 3,326 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer WMTS.
From build dir, run: ctest -R PyQgsServerWMTS -V
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the Lic... | rduivenvoorde/QGIS | tests/src/python/test_qgsserver_wmts.py | Python | gpl-2.0 | 12,309 |
import sys
s = raw_input()
sys.stdout.write(s)
| guilhermeleobas/cftool | test/scode/echo.py | Python | mit | 49 |
# Copyright 2013 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.
import fnmatch
OS_MODIFIERS = ['win', 'xp', 'vista', 'win7',
'mac', 'leopard', 'snowleopard', 'lion', 'mountainlion',
'maver... | Just-D/chromium-1 | content/test/gpu/gpu_tests/test_expectations.py | Python | bsd-3-clause | 6,284 |
# -*- coding: utf-8 -*-
#
# 2017-01-23 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Avoid XML bombs
# 2016-07-17 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add GPG encrpyted import
# 2016-01-16 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add PSKC import ... | wheldom01/privacyidea | privacyidea/lib/importotp.py | Python | agpl-3.0 | 20,360 |
import os
from functools import partial
from PyQt4.QtCore import QObject, SIGNAL
from PyQt4.QtGui import QIcon
from qgis.utils import iface
from processing.core.Processing import Processing
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithm import GeoAlgorithm
from process... | ricardogsilva/qgisconefor | processing/processingconeforinputs.py | Python | gpl-3.0 | 9,891 |
from operator import itemgetter, attrgetter
class RouteManager(object):
"class with many operations available for the list of airports"
def __init__(self, airportManager):
"Airport manager from some input source"
self.am = airportManager
"""
This method finds the best transfer city bet... | abrogley/pptool | src/RouteManager.py | Python | gpl-3.0 | 9,358 |
# weightless
# not deterministic
states = '''
- name: server stopped
transitions:
- action: start_server()
to: server started
'''
def get_initial_state():
return ('server stopped',)
def start_server():
pass
| timdiels/pyautomate | test/texttest/file_param/myauto.py | Python | gpl-3.0 | 236 |
#encoding:utf-8
subreddit = 'comedynecrophilia'
t_channel = '@comedynecrophilia'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/comedynecrophilia/app.py | Python | mit | 155 |
# Copyright (c) 2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | xiaoyuanW/gem5 | configs/common/MemConfig.py | Python | bsd-3-clause | 8,019 |
# -*- coding: utf-8 -*-
'''
Created on 26 oct. 2017
@author: admin
'''
import funciones
from Tkinter import *
import sqlite3
import tkMessageBox
nombreDatabase="database.db"
funciones.borrarDatabase(nombreDatabase)
conn = sqlite3.connect(nombreDatabase)
conn.text_factory = str
conn.execute('''CREATE TABLE CACTUS
... | manuelgomezsuarez/practicasAII | practicasAII/manuCactus/main.py | Python | gpl-3.0 | 1,315 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-iap | samples/generated_samples/iap_v1_generated_identity_aware_proxy_admin_service_test_iam_permissions_async.py | Python | apache-2.0 | 1,594 |
# Copyright (c) 2018 Ericsson
#
# 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 agree... | noironetworks/neutron | neutron/conf/plugins/ml2/drivers/openvswitch/mech_ovs_conf.py | Python | apache-2.0 | 1,849 |
#!/usr/bin/python
"""
vUSBf: A KVM/QEMU based USB-fuzzing framework.
Copyright (C) 2015 Sergej Schumilo, OpenSource Security Ralf Spenneberg
This file is part of vUSBf.
See the file LICENSE for copying permission.
"""
__author__ = 'Sergej Schumilo'
# suppress scapy ipv6 warning
import logging
logging... | schumilo/vUSBf | vusbf.py | Python | gpl-2.0 | 11,024 |
from .dashboard import OPLSDashboard
| BiRG/Omics-Dashboard | omics/omics_dashboard/dashboards/nmr_metabolomics/opls/__init__.py | Python | mit | 37 |
#!/bin/env python
data = {
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "ChIJAwJyd2l_ToYRufeohoDb590",
"types" : [ "premise" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJzYms1B8oTIYRWtJcWVQxMEc",
"types" : [ "premise... | bpfx/sysinfor | modules/theDrive/test.py | Python | bsd-3-clause | 15,364 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-05 12:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('floybd', '0007_auto_20170605_1152'),
]
operations = [
migrations.AlterField(
... | LiquidGalaxyLAB/FlOYBD | Django/mysite/floybd/migrations/0008_auto_20170605_1257.py | Python | mit | 660 |
"""
:codeauthor: :email:`Jorge Schrauwen <sjorge@blackdot.be>`
"""
import salt.grains.mdata as mdata
from tests.support.mock import Mock, patch
from tests.support.unit import TestCase
class MdataGrainsTestCase(TestCase):
"""
Test cases for mdata grains
"""
def setup_loader_modules(self):
... | saltstack/salt | tests/unit/grains/test_mdata.py | Python | apache-2.0 | 5,711 |
#Created by Dmytro Konobrytskyi, 2013 (github.com/Akson/MoveMe)
import wx
import numpy as np
from MoveMe.Canvas.Objects.Base.ClonableObject import ClonableObject
from MoveMe.Canvas.Objects.Base.ConnectableDestination import ConnectableDestination
from MoveMe.Canvas.Objects.Base.ConnectableSource import ConnectableSourc... | Akson/RemoteConsolePlus3 | RemoteConsolePlus3/MoveMe/Canvas/Objects/MessageProcessingNodes/Base.py | Python | lgpl-3.0 | 4,801 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | beernarrd/gramps | gramps/gen/filters/rules/media/_hascitation.py | Python | gpl-2.0 | 1,881 |
class Program(object):
"""
A Program keeps a list of its rules.
"""
def __init__(self):
# The original program is a list of rules and a list of facts
self.rules = []
self.facts = []
def add_rule(self, rule):
self.rules.append(rule)
def add_fact(self, fact):... | sheymans/eunomia | eunomia/models.py | Python | gpl-3.0 | 5,148 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | t-wissmann/qutebrowser | qutebrowser/misc/cmdhistory.py | Python | gpl-3.0 | 4,378 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | meta_learning_without_memorization/pose_code/np_ib.py | Python | apache-2.0 | 14,306 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | fingeronthebutton/RIDE | src/robotide/editor/popupwindow.py | Python | apache-2.0 | 3,498 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/message_registry_message_registry.py | Python | apache-2.0 | 2,519 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BatchAlgorithmDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... | geopython/QGIS | python/plugins/processing/gui/BatchAlgorithmDialog.py | Python | gpl-2.0 | 9,458 |
from functools import wraps
from utils import get_argc, is_env_required
def normalfn(sym = None):
def decorator(f):
fn = wraps(f)(xLispFunction(f, (), {}, False))
if not sym is None:
fn.__name__ = sym
return fn
return decorator
def macrofn(sym = None):
def decorator(f)... | shivylp/xLisp | xLisp/xtypes.py | Python | gpl-3.0 | 5,610 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Create your models here.
class Student(models.Model):
first_name = models.CharField(
max_length=256,
blank=False,
verbose_name=_('First Name'))
last_name = models.CharField(
max_length=25... | hddn/studentsdb | students/models/student.py | Python | mit | 1,179 |
#!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Utilities for working directly with the wallet's BDB database file
This is specific to the configuration o... | bitcoinknots/bitcoin | test/functional/test_framework/bdb.py | Python | mit | 5,533 |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
import socketio.sdjango
from fabric_bolt.core import views
socketio.sdjango.autodiscover()
admin.autodiscover()
urlpatterns = [
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(... | paperreduction/fabric-bolt | fabric_bolt/core/urls.py | Python | mit | 1,071 |
import sifter.grammar
__all__ = ('TestTrue',)
# section 5.10
class TestTrue(sifter.grammar.Test):
RULE_IDENTIFIER = 'TRUE'
def __init__(self, arguments=None, tests=None):
super(TestTrue, self).__init__(arguments, tests)
self.validate_arguments()
self.validate_tests_size(0)
def e... | garyp/sifter | sifter/tests/true.py | Python | bsd-2-clause | 392 |
from openedx.core.djangoapps.ga_operation.ga_operation_base_form import GaOperationEmailField, GaOperationDeleteCourseForm, FIELD_NOT_INPUT
class DeleteCourseForm(GaOperationDeleteCourseForm):
email = GaOperationEmailField(required=True, error_messages={'required': FIELD_NOT_INPUT})
| nttks/edx-platform | cms/djangoapps/ga_operation/forms/delete_course_form.py | Python | agpl-3.0 | 290 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | percyfal/bokeh | tests/plugins/file_server.py | Python | bsd-3-clause | 4,128 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.