text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
=========
SMOTE SVM
=========
An illustration of the random SMOTE SVM method.
"""
print(__doc__)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Define some color for the plotting
almost_black = '#262626'
palette = sns.color_palette()
from sklearn.datasets import make_classification
from skl... | RPGOne/Skynet | imbalanced-learn-master/examples/over-sampling/plot_smote_svm.py | Python | bsd-3-clause | 1,830 | 0.002732 |
#!/usr/bin/env python
# coding: utf-8
#encoding: latin1
def ingresar_numero(numero_minimo, numero_maximo):
''' Muestra un cursor de ingreso al usuario para que ingrese un número
tal que numero_mínimo <= ingreso <= numero_máximo. Ante un ingreso
inválido muestra un mensaje descriptivo de error y repregunta.... | sit0x/farmasoft | interaccion_usuario.py | Python | gpl-3.0 | 2,473 | 0.001227 |
from a10sdk.common.A10BaseClass import A10BaseClass
class DeviceGroup(A10BaseClass):
"""Class Description::
configure scaleout device groups.
Class device-group supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param devi... | amwelch/a10sdk-python | a10sdk/core/acos/acos_scaleout_cluster_config_device_groups_device_group.py | Python | apache-2.0 | 1,370 | 0.010949 |
##############################################################################
#
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | eicher31/compassion-switzerland | partner_communication_switzerland/models/partner_communication_config.py | Python | agpl-3.0 | 4,913 | 0.000204 |
from django.apps import AppConfig
class GeoTweetsConfig(AppConfig):
name = 'geo_tweets'
| adoublebarrel/geo-tweet-exercise | server/assesment_site/geo_tweets/apps.py | Python | mit | 94 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Santi Argüeso
# Copyright 2014 Pexego Sistemas Informáticos S.L.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | jgmanzanas/CMNT_004_15 | project-addons/stock_deposit/stock_deposit.py | Python | agpl-3.0 | 10,814 | 0.001017 |
"""
2.3.4: If `x` is not an object or function, fulfill `promise` with `x`
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.3.4.js
"""
from test.promises.helpers import generate_fulfilled_test_case, generate_rejected_test_case
dummy = {'dummy': 'dummy'}
sentinel = {'sentinel': 'sentinel'}
def ... | MeerkatLabs/sleekpromises | test/promises/test_2_3_4.py | Python | bsd-3-clause | 7,323 | 0.006691 |
"""
.. _ex-limo-data:
=============================================================
Single trial linear regression analysis with the LIMO dataset
=============================================================
Here we explore the structure of the data contained in the
`LIMO dataset`_.
This example replicates and extend... | Teekuningas/mne-python | examples/datasets/plot_limo_data.py | Python | bsd-3-clause | 13,302 | 0 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
##
## Test surrogatepass encoding error handler
##
import unittest
import codecs
from iptest import run_test
... | IronLanguages/ironpython3 | Tests/test_surrogatepass.py | Python | apache-2.0 | 4,002 | 0.010245 |
#! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# 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 t... | indigo-dc/im | test/unit/connectors/OpenNebula.py | Python | gpl-3.0 | 17,429 | 0.003844 |
""" Copyright 2012, 2013 UW Information Technology, University of Washington
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 r... | uw-it-aca/spacescout_web | spacescout_web/views/share.py | Python | apache-2.0 | 8,038 | 0.000498 |
"""
This module manages the interface between webpack and Django.
It loads webpack bundle tracker stats files, and catalogues the different files
that need to be served in order to inject that frontend code into a Django template.
Originally, it was a monkeypatch of django-webpack-loader - but as our needs are somewhat... | MCGallaspy/kolibri | kolibri/core/webpack/utils.py | Python | mit | 1,718 | 0.004075 |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free ... | UdK-VPT/Open_eQuarter | crow_archive/crow_django/ates/models.py | Python | gpl-2.0 | 33,811 | 0.00627 |
from zipfile import ZipFile
class ZipFileArchiver(object):
"""
An archiver used to generate .zip files.
This wraps Python's built in :class:`zipfile.ZipFile`
methods to operate exactly like :class:`tarfile.TarFile` does.
"""
def __init__(self, *args, **kwargs):
"""
Create ... | guohongze/adminset | elfinder/utils/archivers.py | Python | gpl-2.0 | 1,102 | 0.006352 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/authentication/authenticationradiuspolicy_authenticationvserver_binding.py | Python | apache-2.0 | 5,569 | 0.035374 |
#!/usr/bin/env python
"""
Implement common functions for tests
"""
from __future__ import print_function
from __future__ import unicode_literals
import io
import sys
def parse_yaml(yaml_file):
"""
Parses a yaml file, returning its contents as a dict.
"""
try:
import yaml
except ImportErro... | ivandgreat/netmiko | tests/test_utils.py | Python | mit | 567 | 0.001764 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import NumberActionMap
from Components.config import config, getConfigListEntry, ConfigNothing, NoSave, ConfigPIN
from Components.ParentalControlList import ParentalControlEntryComponent, ParentalControlList
... | Ophiuchus1312/enigma2-master | lib/python/Screens/ParentalControlSetup.py | Python | gpl-2.0 | 14,944 | 0.02844 |
# coding=utf-8
import json
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse
import django.views
from django.template import defaultfilters as template_filters
from horizon import tables
from horizon import exceptions
from cloudkittydashboard.api import cloudkitty as api
f... | FNST-OpenStack/cloudkitty-dashboard | cloudkittydashboard/dashboards/project/billing_overview/views.py | Python | apache-2.0 | 14,849 | 0.027079 |
from setuptools import setup, find_packages
setup(
name='yandextank',
version='1.12.7',
description='a performance measurement tool',
longer_description='''
Yandex.Tank is a performance measurement and load testing automatization tool.
It uses other load generators such as JMeter, ab or phantom inside ... | fomars/yandex-tank | setup.py | Python | lgpl-2.1 | 3,327 | 0.000902 |
import unittest
import types
import datetime
from flask import Flask
from pprint import pprint
from sqlalchemy import (Column, create_engine, DateTime, Date, Float,
ForeignKey, Integer, Boolean, Unicode, create_engine)
from lever import API, preprocess, postprocess, ModelBasedACL, ImpersonateM... | Crowdlink/lever | lever/tests/unit_tests.py | Python | bsd-2-clause | 14,490 | 0.000897 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tornado.testing
import tornado.ioloop
import tornado.gen
from tornadis.pubsub import PubSubClient
from tornadis.client import Client
from support import test_redis_or_raise_skiptest, mock
class PubSubClientTestCase(tornado.testing.AsyncTestCase):
def setUp(s... | thefab/tornadis | tests/test_pubsub.py | Python | mit | 3,713 | 0 |
def getitem(list, index):
return list[index]
def entry_point(i):
return getitem([i, 2, 3, 4], 2) + getitem(None, i)
def target(*args):
return entry_point, [int]
def get_llinterp_args():
return [1]
# _____ Run translated _____
def run(c_entry_point):
c_entry_point(0)
| oblique-labs/pyVM | rpython/translator/goal/targetsegfault.py | Python | mit | 291 | 0.013746 |
#import DBusInterface
| buguelos/odoo | yowsup/Interfaces/DBus/__init__.py | Python | agpl-3.0 | 22 | 0.045455 |
#!/usr/bin/env python
# Test whether a retained PUBLISH to a topic with QoS 1 is retained.
# Subscription is made with QoS 0 so the retained message should also have QoS
# 0.
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-fr... | telefonicaid/fiware-IoTAgent-Cplusplus | third_party/mosquitto-1.4.4/test/broker/04-retain-qos1-qos0.py | Python | agpl-3.0 | 1,749 | 0.005718 |
"""
Export to RAW/RPL file format
Based on:
http://www.nist.gov/lispix/doc/image-file-formats/raw-file-format.htm
"""
# Standard library modules.
import os
# Third party modules.
# Local modules.
from pyhmsa.fileformat.exporter.exporter import _Exporter, _ExporterThread
from pyhmsa.spec.datum.analysislist import A... | pyhmsa/pyhmsa | pyhmsa/fileformat/exporter/raw.py | Python | mit | 3,504 | 0.001427 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/deckhand | deckhand/tests/unit/db/test_revision_diffing.py | Python | apache-2.0 | 14,036 | 0 |
""" Write the pseudocode and code for a function that reverses the words in a sentence. Input: "This is awesome" Output: "awesome is This". Give the Big O notation. """
def reverse(sentence):
""" split original sentence into a list, then append elements of the old list to the new list starting from last to first.... | megasan/210-CT | coursework 6.py | Python | mit | 903 | 0.006645 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FirstLastReturn.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Niccolo' Marchi
Email : sciurusurbanus at hotmail dot it
***************... | michaelkirk/QGIS | python/plugins/processing/algs/lidar/fusion/FirstLastReturn.py | Python | gpl-2.0 | 2,653 | 0.001131 |
#!/usr/bin/env python3
import os
import sys
import re
import math
import platform
import xml.etree.ElementTree as ET
################################################################################
# Config #
#######################################... | jejung/godot | doc/tools/doc_status.py | Python | mit | 15,221 | 0.003679 |
# vDial-up client
# Copyright (C) 2015 - 2017 Nathaniel Olsen
# 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 later version.
# This pr... | vDial-up/client | libs/vDialing.py | Python | gpl-3.0 | 5,879 | 0.004252 |
# -*- coding: utf-8 -*-
# ##### 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.
#
# ... | PLyczkowski/Sticky-Keymap | 2.74/scripts/addons_contrib/cursor_control/history.py | Python | gpl-2.0 | 9,295 | 0.006885 |
"""Weighted maximum matching in general graphs.
The algorithm is taken from "Efficient Algorithms for Finding Maximum
Matching in Graphs" by Zvi Galil, ACM Computing Surveys, 1986.
It is based on the "blossom" method for finding augmenting paths and
the "primal-dual" method for finding a matching of maximum weight, bo... | bvancsics/TCMC | maximum_matching.py | Python | gpl-3.0 | 35,707 | 0.002745 |
# Copyright (c) 2016 Dustin Doloff
# Licensed under Apache License v2.0
import jinja2
import os
MESSAGE_FILL = '`'
AUTO_GEN_MESSAGE = """
``````````````````````````````````````````````````````
``````````````````````````````````````````````````````
````````______________________________________ ``````
```````/ ... | quittle/bazel_toolbox | actions/scripts/jinja_helper.py | Python | apache-2.0 | 2,197 | 0.005007 |
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import blocks
from gnuradio import digital
import numpy
#applies fftshift to a vecter.
#
class FFTshift(gr.basic_block):
#constructor
def __init__(self,size,drop_when_overloaded):
gr.basic_block.__init__(self, name="FFT_Shift",
in_sig=[(numpy.float32,s... | cityscapesc/specobs | main/tools/USRP_N200_UBX40_Filter_Testing/GRC/FFTshift.py | Python | apache-2.0 | 837 | 0.04779 |
##
# Copyright 2009-2018 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | bartoldeman/easybuild-easyblocks | easybuild/easyblocks/r/rosetta.py | Python | gpl-2.0 | 12,847 | 0.003269 |
# Copyright 2009 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 or agreed to in writing, ... | lemonad/jaikuengine | common/tests.py | Python | apache-2.0 | 2,923 | 0.008211 |
# Copyright (c) 2015 Raihan Kibria
#
# 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, merge, publish, distr... | rkibria/yapyg | yapyg_widgets/screen_widget.py | Python | mit | 18,072 | 0.012561 |
import os
from pypers.core.step import CmdLineStep
class ReorderSam(CmdLineStep):
spec = {
"version": "0.0.1",
"descr": [
"Runs ReorderSam to reorder chromosomes into GATK order"
],
"args":
{
"inputs": [
{
"name" ... | frankosan/pypers | pypers/steps/picard/reordersam.py | Python | gpl-3.0 | 1,863 | 0.011809 |
"""Unit tests for the Paver server tasks."""
import ddt
from paver.easy import call_task
from ..utils.envs import Env
from .utils import PaverTestCase
EXPECTED_SASS_COMMAND = (
u"libsass {sass_directory}"
)
EXPECTED_COMMON_SASS_DIRECTORIES = [
u"common/static/sass",
]
EXPECTED_LMS_SASS_DIRECTORIES = [
u... | cpennington/edx-platform | pavelib/paver_tests/test_servers.py | Python | agpl-3.0 | 13,743 | 0.002401 |
""" Git Parent model """
from django.db import models
class GitParentEntry(models.Model):
""" Git Parent """
project = models.ForeignKey('gitrepo.GitProjectEntry', related_name='git_parent_project')
parent = models.ForeignKey('gitrepo.GitCommitEntry', related_name='git_parent_commit')
son = models.For... | imvu/bluesteel | app/logic/gitrepo/models/GitParentModel.py | Python | mit | 713 | 0.007013 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
#import calendar
#import datetime as dt
#import pprint
#import pickle
import sys
def plotFontSize(ax,fontsize=8):
for item in ([ax.title, ax.xaxis.l... | mikemoorester/ESM | nadirSiteSolution.py | Python | mit | 7,907 | 0.020362 |
# Author: Julien Coux
# Copyright 2016 Camptocamp SA
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
class TestTrialBalanceReport(common.TransactionCase):
def setUp(self):
super(TestTrialBalance... | OCA/account-financial-reporting | account_financial_report/tests/test_trial_balance.py | Python | agpl-3.0 | 33,159 | 0.000513 |
import unittest
import numpy as np
from astropy import constants as const
from astropy import units as u
from .context import superbol
from superbol.mag2flux import *
from yaml import load
class TestMag2Flux(unittest.TestCase):
def setUp(self):
self.filter_band = "V"
self.magnitude = 8.8
s... | JALusk/SuperBoL | tests/test_mag2flux.py | Python | mit | 2,006 | 0.011964 |
#Embedded file name: /usr/lib/enigma2/python/upgrade.py
import os
from subprocess import Popen, PIPE
opkgDestinations = ['/']
opkgStatusPath = ''
overwriteSettingsFiles = False
overwriteDriversFiles = True
overwriteEmusFiles = True
overwritePiconsFiles = True
overwriteBootlogoFiles = True
overwriteSpinnerFiles = True
... | kingvuplus/gui_test4 | upgrade.py | Python | gpl-2.0 | 3,532 | 0.003681 |
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | eicher31/compassion-switzerland | report_compassion/models/contract_group.py | Python | agpl-3.0 | 5,996 | 0.001167 |
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from wtforms import validators
from ..forms import ModelForm
from digits import utils
class ImageModelForm(ModelForm):
"""
Defines the form used to create a new ImageModelJob
"""
crop_size = ... | Deepomatic/DIGITS | digits/model/images/forms.py | Python | bsd-3-clause | 3,851 | 0.001298 |
import os
import random
import sys
from datetime import date
from urllib import urlencode
import mailpile.auth
from mailpile.defaults import CONFIG_RULES
from mailpile.i18n import ListTranslations, ActivateTranslation, gettext
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpil... | laborautonomo/Mailpile | mailpile/plugins/setup_magic.py | Python | apache-2.0 | 40,094 | 0.000499 |
"""Deals with input examples for deep learning.
One "input example" is one storm object.
--- NOTATION ---
The following letters will be used throughout this module.
E = number of examples (storm objects)
M = number of rows in each radar image
N = number of columns in each radar image
H_r = number of radar heights
F... | thunderhoser/GewitterGefahr | gewittergefahr/deep_learning/input_examples.py | Python | mit | 103,640 | 0.000251 |
""" Python test discovery, setup and run of test functions. """
import re
import fnmatch
import functools
import py
import inspect
import sys
import pytest
from _pytest.mark import MarkDecorator, MarkerError
from py._code.code import TerminalRepr
try:
import enum
except ImportError: # pragma: no cover
# Only ... | codewarrior0/pytest | _pytest/python.py | Python | mit | 84,482 | 0.002 |
from __future__ import unicode_literals
from future.builtins import int
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.template.defaultfilters import linebreaksbr, urlize
from mezzanine import template
from mezzanine.conf import settings
from mezzanine.generic.forms impo... | aptuz/mezzanine_onepage_theme | one_page/customapp/templatetags/testtag.py | Python | mit | 1,240 | 0.004032 |
#!/usr/bin/env python
# coding: utf8
import sys;
import struct;
def do_convert(filename):
fid_in = open(filename, 'rb')
fid_out = open('sound_conv.out','w')
data = fid_in.read(4) # read 4 bytes = 32 Bit Sample
while data:
ser = str(struct.unpack('<i', data)[0]) + '\n'
fid_out.... | EPiCS/soundgates | hardware/tools/to_samples.py | Python | mit | 505 | 0.017822 |
# -*- coding: utf-8 -*-
"""
UserBot module
Copyright 2015, Ismael R. Lugo G.
"""
import translate
reload(translate)
from sysb import commands
from translate import lang
from translate import _
commands.addHandler('translate', '(tr|translate)2 (?P<in>[^ ]+) (?P<out>[^ ]+) '
'(?P<text>.*)', {'sintax': 'tr2 <input... | IsmaelRLG/UserBot | mods/translate/__init__.py | Python | mit | 817 | 0.015912 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The path to enlightenment starts with the following:
import unittest
from koans.about_asserts import AboutAsserts
from koans.about_strings import AboutStrings
from koans.about_none import AboutNone
from koans.about_lists import AboutLists
from koans.about_list_assignme... | tokyo-jesus/university | src/python/koans/python3/runner/path_to_enlightenment.py | Python | unlicense | 4,893 | 0.000204 |
from datetime import datetime
path= str(datetime.now().date())
per= datetime.now()
per_h= str(per.hour)
per_m= str(per.minute)
timeit= str("%s:%s"%(per_h,per_m))
def Final(file_name):
NPfile= str("%s-%s"%(file_name,timeit))
A_Dump= "airodump-ng wlan0 -w "
ADFN= A_Dump+NPfile
return ADFN
| TheTrueH4cks0r/YeagerBomb | FiLe_AD.py | Python | gpl-3.0 | 315 | 0.060317 |
import ast
import os
import sys
# Import a minimal set of stdlib modules needed for list_stdlib_modules()
# to work when run from a virtualenv. The modules were chosen empirically
# so that the return value matches the return value without virtualenv.
import BaseHTTPServer
import zlib
def dotted_name_of_path(path, t... | hekra01/mercurial | contrib/import-checker.py | Python | gpl-2.0 | 8,337 | 0.001679 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 0, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_ConstantTrend/cycle_0/ar_12/test_artificial_1024_RelativeDifference_ConstantTrend_0_12_20.py | Python | bsd-3-clause | 279 | 0.082437 |
#!/usr/bin/env python
import argparse
import sys
from util import add_common_args, init_protocol
from local_thrift import thrift
from thrift.Thrift import TMessageType, TType
# TODO: generate from ThriftTest.thrift
def test_string(proto, value):
method_name = 'testString'
ttype = TType.STRING
proto.writ... | Jimdo/thrift | test/features/string_limit.py | Python | apache-2.0 | 1,665 | 0.001201 |
# pyOCD debugger
# Copyright (c) 2006-2016 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | pyocd/pyOCD | pyocd/target/builtin/target_lpc4088qsb.py | Python | apache-2.0 | 5,692 | 0.01669 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/pdfdoc.py
__version__=''' $Id: pdfdoc.py 3795 2010-09-30 15:52:16Z rgbecker $ '''
__doc__="""
The module pdfdoc.py handles the 'outer structure... | mattjmorrison/ReportLab | src/reportlab/pdfbase/pdfdoc.py | Python | bsd-3-clause | 83,521 | 0.009279 |
# -*- coding: utf-8 -*-
#
# 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
#... | danielvdende/incubator-airflow | airflow/contrib/hooks/wasb_hook.py | Python | apache-2.0 | 5,899 | 0 |
# Copyright 2015 Dimitri Racordon
#
# 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 writi... | kyouko-taiga/mushi | mushi/apps/webui/views.py | Python | apache-2.0 | 1,256 | 0.001592 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
user = Table('user', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('username', String(length=64)),
Column('email', String(length=120)),
Column('... | atlefren/beercalc | db_repository/versions/006_migration.py | Python | mit | 884 | 0.001131 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Ivan Vanderbyl <ivan@app.io>
#
# This 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 3 of the License, or
# (at your option) any la... | kbrebanov/ansible-modules-extras | monitoring/logentries.py | Python | gpl-3.0 | 4,638 | 0.00539 |
import dj_database_url
import os
from .base import *
# Parse database configuration from $DATABASE_URL
DATABASES = { 'default': {} }
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Allow a... | kern3020/opportunity | opportunity/settings/prod.py | Python | mit | 575 | 0.006957 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: db_ext_split.py <src> <dst> <prob>
Options:
-h --help
"""
import os
import cv2
from glob import glob
from docopt import docopt
from mscr.split import Split, RandomSplitPredicate
from mscr.util import Crop
from mscr.data import MyProgressBar
PAD = 8
if ... | fpeder/mscr | bin/db_ext_split.py | Python | bsd-2-clause | 1,070 | 0 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickGear.
#
# SickGear 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,... | jetskijoe/SickGear | sickbeard/db.py | Python | gpl-3.0 | 19,942 | 0.002507 |
from marshmallow import Schema, fields, post_load, EXCLUDE
from ..resource import Resource
from collections import namedtuple
class Plan(Resource):
"""
https://dev.chartmogul.com/v1.0/reference#plans
"""
_path = "/plans{/uuid}"
_root_key = 'plans'
_many = namedtuple('Plans', [_root_key, "curre... | chartmogul/chartmogul-python | chartmogul/api/plan.py | Python | mit | 727 | 0 |
from __future__ import print_function
from ._compat import string_types
import os
import re
import logging
import inspect
import datetime
import decimal
log = logging
def safe_import(path):
module = path.split('.')
g = __import__(module[0], fromlist=['*'])
s = [module[0]]
for i in module[1:]:
... | limodou/parm | parm/utils.py | Python | bsd-2-clause | 10,640 | 0.004229 |
import unittest
from ietfparse.datastructures import ContentType
class ContentTypeCreationTests(unittest.TestCase):
def test_that_primary_type_is_normalized(self):
self.assertEqual('contenttype',
ContentType('COntentType', 'b').content_type)
def test_that_subtype_is_normaliz... | dave-shawley/ietfparse | tests/test_datastructure.py | Python | bsd-3-clause | 3,585 | 0 |
import unittest
import mock
from mopidy_playbackdefaults import PlaybackDefaultsFrontend
class PlaybackDefaultsFrontendTest(unittest.TestCase):
def test_no_settings(self):
config = {'playbackdefaults': {'default_random': '', 'default_repeat': '', 'default_consume': '', 'default_single': ''}}
co... | DavisNT/mopidy-playbackdefaults | tests/test_frontend.py | Python | apache-2.0 | 5,145 | 0.000972 |
# Copyright 2016 Rudrajit Tapadar
#
# 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... | rtapadar/pscan | pscan/tests/test_scan.py | Python | apache-2.0 | 5,489 | 0.00419 |
"""
this example shows how to freeze degrees of freedom using the Lennard Jones potential as
an example
"""
import numpy as np
from pele.potentials import LJ, FrozenPotentialWrapper
from pele.optimize import mylbfgs
def main():
natoms = 4
pot = LJ()
reference_coords = np.random.uniform(-1, 1, [3 * natoms... | khs26/pele | examples/frozen_degrees_of_freedom/frozen_lj.py | Python | gpl-3.0 | 1,133 | 0.002648 |
#!/usr/bin/env python3
from optparse import OptionParser
from datetime import datetime
from datetime import timedelta
import pyopencl as cl
import numpy as np
import time
MIN_ELAPSED = 0.25
KEY_LENGTH = 64
BUF_MAX_SIZE= 1024 * 1024
class BurnInTarget():
def __init__(self, platform, kernel):
self.name = ... | jimmysitu/jBenchmark | micro-benchmark/MixBurnIn/MixBurnIn.py | Python | gpl-2.0 | 4,944 | 0.002629 |
#
# #/usr/bin/env python3
# -*- coding:utf-8 -*-
from database import Measure
import json
import requests
import time
import yaml
with open("param.yml", 'r') as stream:
try:
param = yaml.load(stream)
except yaml.YAMLError as e:
print(e)
def getkwatthours(url, data, headers, sensorId, t0, t1)... | SamR1/OpenCityLab-dataviz | functions.py | Python | gpl-3.0 | 4,740 | 0.005274 |
"""
Module contains helper functions
"""
def get_user(username, db):
"""
Usage: queries through and database and returns user
object with passed username argument
:return: User object or None if no such user
"""
for user in db:
if user.username.lower() == username.l... | JoshuaOndieki/buckylist | bucky/helpers.py | Python | mit | 710 | 0.002817 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.doctypemigrations.djangomigrations import assert_initial_complete
from corehq.doctypemigrations.migrator_instances import users_migration
from corehq.sql_db.operations import HqRunPython
class Migration(migra... | qedsoftware/commcare-hq | corehq/doctypemigrations/migrations/0004_auto_20151001_1809.py | Python | bsd-3-clause | 527 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2013, 2014, 2015, 2016, 2017, 2018 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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,... | kpreid/shinysdr | shinysdr/interfaces.py | Python | gpl-3.0 | 11,304 | 0.007432 |
"""Support for the Philips Hue lights."""
from datetime import timedelta
from functools import partial
import logging
import random
import aiohue
import async_timeout
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRA... | tboyce021/home-assistant | homeassistant/components/hue/light.py | Python | apache-2.0 | 14,995 | 0.001067 |
# vertex.py
# This module contains all the things for creating
# and using vertices...starting with vector, and
# going on to edge and face.
# Observe two things, though:
# First, I tried to keep small numbers as "zeros"
# by rounding divisions (see __div__ and norm) to
# five significant digits. So if a number i... | snowfarthing/nibbles_3d | vertex.py | Python | mit | 6,509 | 0.020126 |
"""
WSGI config for bball_intel project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bball_intel.settings.base")
from ... | ltiao/basketball-intelligence | bball_intel/bball_intel/wsgi.py | Python | mit | 437 | 0.004577 |
# A base file for use in fabfiles.
# This file is geared toward a particular directory structure on webfaction and in dev
# Some of it may be useful to other folks, but no guarantees.
# Local Structure
# /
# /db (sqllite for dev and dumps)
# /media
# /appname
# /source (psds and the like)
# Remote Structure (webfact... | skoczen/qi-toolkit | qi_toolkit/boltbase.py | Python | bsd-3-clause | 27,252 | 0.007339 |
"""
clipocr1.py
Demonstrates a technique that often improves ocr quality on screen captures.
Reads an image from the system clipboard,
and writes to stdout various versions of the text recognized in the image.
Uses tesseract OCR.
The technique is based on judicious rescaling of image dimensions.
... | cniswander/clipocr | clipocr1.py | Python | bsd-3-clause | 6,229 | 0.013004 |
#!/usr/bin/env python
import sys, os
import numpy as np
import logging
import IPython as ip
from IPython import parallel
from IPython.parallel.error import RemoteError
from msmbuilder import arglib
from msmbuilder import metrics
from msmbuilder import Project
from parallel_assign import remote, local
def setup_logge... | msmbuilder/msmbuilder-legacy | Extras/parallel_assign/scripts/AssignParallel.py | Python | gpl-2.0 | 7,120 | 0.007022 |
# Copyright 2015-2016 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | Yelp/paasta | tests/api/test_client.py | Python | apache-2.0 | 1,486 | 0.000673 |
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import base64
import contextlib
import datetime
import json
import logging
import time
import webtest
from google.appengine.datastore import dat... | luci/luci-py | appengine/components/test_support/test_case.py | Python | apache-2.0 | 11,348 | 0.009076 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/modules/syslog_broker.py | Python | agpl-3.0 | 1,841 | 0.001086 |
import sys
from captcha import get_version as get_captcha_version
from setuptools import find_packages, setup
from setuptools.command.test import test as test_command
class Tox(test_command):
user_options = [("tox-args=", "a", "Arguments to pass to tox")]
def initialize_options(self):
test_command.i... | mbi/django-simple-captcha | setup.py | Python | mit | 2,125 | 0.000471 |
import base64
import copy
import inspect
import logging
import re
import urlparse
import pilo
from . import Expression, exp, types
logger = logging.getLogger(__name__)
__all__ = [
'PathMixin',
'String',
'Boolean',
'Integer',
'IPAddress',
'IPNetwork',
'NamedTuple'
'StringHash',
'A... | bninja/rump | rump/request.py | Python | isc | 10,243 | 0.000293 |
import bpy
def main(operator, context):
space = context.space_data
node_tree = space.node_tree
node_active = context.active_node
node_selected = context.selected_nodes
# now we have the context, perform a simple operation
if node_active in node_selected:
node_selected.remove(node_acti... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/templates_py/operator_node.py | Python | gpl-3.0 | 1,429 | 0 |
# -*- coding: utf-8 -*-
"""
This package contains all the forms and models
for the rheumatism questionnaires.
"""
| acesonl/remotecare | remotecare/apps/questionnaire/rheumatism/__init__.py | Python | gpl-3.0 | 114 | 0 |
import cv2
import numpy
import Tool
class HueEqualiser(Tool.Tool):
def on_init(self):
self.id = "hueequaliser"
self.name = "Hue Equaliser"
self.icon_path = "ui/PF2_Icons/HueEqualiser.png"
self.properties = [
Tool.Property("header", "Hue Equaliser", "Header", None, has_t... | Tilo15/PhotoFiddle2 | PF2/Tools/HueEqualiser.py | Python | gpl-3.0 | 5,526 | 0.005972 |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2018 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""Gather correlator log outputs and log them into M&C."""
import sys
import json
import redis
import socket
import logging
from astropy.time import Time
from hera_mc impor... | HERA-Team/hera_mc | scripts/mc_listen_to_corr_logger.py | Python | bsd-2-clause | 3,281 | 0.000914 |
"""
Rate Service Module
===================
This package contains classes to request pre-ship rating information and to
determine estimated or courtesy billing quotes. Time in Transit can be
returned with the rates if it is specified in the request.
"""
from datetime import datetime
from .. base_service import FedexBa... | shivam1111/python-fedex | fedex/services/rate_service.py | Python | bsd-3-clause | 5,261 | 0.004752 |
import unittest
from p5.pmath.utils import (
constrain,
lerp,
remap,
normalize,
magnitude,
distance,
sq)
class TestUtils(unittest.TestCase):
def test_constrain(self):
self.assertEqual(constrain(5, 0, 10), 5)
self.assertEqual(constrain(-10, 0, 10), 0)
self.asse... | p5py/p5 | p5/pmath/tests/test_utils.py | Python | gpl-3.0 | 874 | 0 |
__author__ = 'erik'
import numpy as np
from PetersScheme.Edge import Edge
from PetersScheme.Quad import Quad
from PetersScheme.Vertex import Vertex
def getABsC_ind(quadIndex, indVertex, indOtherVertex, regularPoints):
'''
:param _quad:
:param indVertex:
:param indOtherVertex:
:param regularPoints... | BGCECSE2015/CADO | PYTHON/NURBSReconstruction/DooSabin/DualCont_toABC_simple.py | Python | bsd-3-clause | 4,309 | 0.02019 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListZones
# Retrieves the list of Zone resources for the specified project.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... | jordanemedlock/psychtruths | temboo/core/Library/Google/ComputeEngine/Zones/ListZones.py | Python | apache-2.0 | 5,734 | 0.005232 |
import math
import datetime
#from subgen.subtitle import Subtitle
#def time_parse(s):
#hour, minute, second_decimal = [t for t in s.split(':')]
#second, microsec = second_decimal.split('.')
#microsec = microsec.ljust(6, '0')
#return [int(hour), int(minute), int(second), int(microsec)]
def subtitle_par... | hank5925/automatic-subtitle-transcriptor | subgen/subtitle_parsing.py | Python | mit | 1,283 | 0.018706 |
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | houseurmusic/my-swift | test/unit/container/test_updater.py | Python | apache-2.0 | 8,262 | 0.000484 |
AUTHENTICATION_REQUIRED_401 = 401
NOT_AUTHORIZED_403 = 403
INVALID_REQUEST_400 = 400
REQUEST_ENTITY_TOO_LARGE_413 = 413
NOT_FOUND_404 = 404
INTERNAL_SERVER_ERROR_500 = 500
RESOURCE_CONFLICT_409 = 409
PAYMENT_REQUIRED_402 = 402
HEADER_PRECONDITIONS_FAILED = 412
LOCKED_423 = 423
TOO_MANY_REQUESTS_429 = 429
class JSONAP... | Patreon/cartographer | cartographer/exceptions/request_exceptions.py | Python | apache-2.0 | 2,455 | 0.001222 |
from io import BytesIO
import json
import os
import urllib.parse
import six
import sys
from ftptool import FTPHost
import xlsxwriter
# from https://docs.djangoproject.com/en/1.10/_modules/django/utils/encoding/
def smart_text(s, encoding="utf-8", strings_only=False, errors="strict"):
"""
Returns a text objec... | shapiromatron/tblBuilder | src/private/scripts/ftpScraper.py | Python | mit | 3,966 | 0.000756 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.