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 |
|---|---|---|---|---|---|---|
# explore.py
"""
Module containing functionality for exploratory data analysis and visualization.
"""
import seaborn as sns
import matplotlib.pyplot as plt
__all__ = [
'class_proportions',
'see_nulls',
'distplots',
'pairplots'
]
# ====== Data Statistics
def class_proportions(y):
"""
Function... | xfaxca/pymlkit | pymlkit/preproc/eda.py | Python | gpl-3.0 | 2,894 | 0.003455 |
#!/usr/bin/python
# coding=utf-8
"""
Project MCM - Micro Content Management
SDOS - Secure Delete Object Store
Copyright (C) <2016> Tim Waizenegger, <University of Stuttgart>
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
import logging,... | timwaizenegger/osecm-sdos | mcm/__init__.py | Python | mit | 1,307 | 0.012242 |
# -*- coding: utf-8 -*-
import os,logging
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.db import Model as DBModel
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengi... | mozillazg/mzgblog | model.py | Python | mit | 30,298 | 0.018222 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | andrebellafronte/stoq | stoq/gui/test/test_purchase.py | Python | gpl-2.0 | 11,536 | 0.00156 |
import argparse, requests, sys, configparser, zipfile, os, shutil
from urllib.parse import urlparse, parse_qs
appname="ConverterUpdater"
author="Leo Durrant (2017)"
builddate="05/10/17"
version="0.1a"
release="alpha"
filesdelete=['ConUpdate.py', 'Converter.py', 'LBT.py', 'ConverterGUI.py', 'LBTGUI.py']
directoriesdel... | ZanyLeonic/LeonicBinaryTool | ConUpdate.py | Python | gpl-3.0 | 5,039 | 0.009724 |
from jobman import DD, expand, flatten
import pynet.layer as layer
from pynet.model import *
from pynet.layer import *
from pynet.datasets.mnist import Mnist, Mnist_Blocks
import pynet.datasets.spec as spec
import pynet.datasets.mnist as mnist
import pynet.datasets.transfactor as tf
import pynet.datasets.mapping as ma... | hycis/Pynet | hps/models/Laura_Two_Layers.py | Python | apache-2.0 | 2,815 | 0.005329 |
from muntjac.ui.vertical_layout import VerticalLayout
from muntjac.ui.menu_bar import MenuBar, ICommand
from muntjac.terminal.external_resource import ExternalResource
class MenuBarItemStylesExample(VerticalLayout):
def __init__(self):
super(MenuBarItemStylesExample, self).__init__()
self._menu... | rwl/muntjac | muntjac/demo/sampler/features/menubar/MenuBarItemStylesExample.py | Python | apache-2.0 | 2,645 | 0.000378 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/picard/package.py | Python | lgpl-2.1 | 4,400 | 0.001136 |
from feedgen.feed import FeedGenerator
def format_itunes_duration(td):
return "{hours:02d}:{minutes:02d}:{seconds:02d}".format(
hours=td.seconds//3600,
minutes=(td.seconds//60)%60,
seconds=int(td.seconds%60)
)
def add_entry(fg, md):
fe = fg.add_entry()
fe.id(md.id)
fe.title... | calpaterson/dircast | dircast/feed.py | Python | gpl-3.0 | 848 | 0.005896 |
# Izhikevich.py ---
#
# Filename: Izhikevich.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Fri May 28 14:42:33 2010 (+0530)
# Version:
# Last-Updated: Tue Sep 11 14:27:18 2012 (+0530)
# By: subha
# Update #: 1212
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
# th... | BhallaLab/moose | moose-examples/izhikevich/Izhikevich.py | Python | gpl-3.0 | 23,767 | 0.009593 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...vml import Vml
class TestWriteOidmap(unittest.TestCase):
"""
Test the Vml _write... | ivmech/iviny-scope | lib/xlsxwriter/test/vml/test_write_idmap.py | Python | gpl-3.0 | 748 | 0 |
"""
@name: PyHouse/src/Modules/Families/Insteon/_test/test_Insteon_HVAC.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2014-2020 by D. Brian Kimmel
@license: MIT License
@note: Created on Dec 6, 2014
@Summary:
Passed all 2 tests - DBK - 2015-07-29
"""
__updated__ = '20... | DBrianKimmel/PyHouse | Project/src/Modules/House/Family/Insteon/_test/test_insteon_light.py | Python | mit | 6,285 | 0.002546 |
# from server.utility.service_utility import count_total_page | bingweichen/GOKU | backend/server/utility/__init__.py | Python | apache-2.0 | 61 | 0.016393 |
import json
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib.auth import logout
from django.contrib.auth import update_session_auth_hash
from rest_framework import status
from rest_framework import views
from rest_framework import viewsets
from rest_framework.permi... | KonichiwaKen/band-dashboard | authentication/views.py | Python | mit | 4,259 | 0.000704 |
## {{{ http://code.activestate.com/recipes/496882/ (r8)
'''
http://code.activestate.com/recipes/496882/
Author: Michael Palmer 13 Jul 2006
a regex-based JavaScript code compression kludge
'''
import re
class JSCompressor(object):
def __init__(self, compressionLevel=2, measureCompression=False):
'''
... | MaxTyutyunnikov/lino | lino/utils/jscompressor.py | Python | gpl-3.0 | 5,152 | 0.011258 |
#!/usr/bin/env python
__author__ = 'waroquiers'
import unittest
import numpy as np
from pymatgen.util.testing import PymatgenTest
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import ExplicitPermutationsAlgorithm
from pymatgen.analysis.chemenv.coordination_environments.coordinatio... | tschaume/pymatgen | pymatgen/analysis/chemenv/coordination_environments/tests/test_coordination_geometries.py | Python | mit | 19,397 | 0.005104 |
from Vintageous.ex.ex_error import ERR_NO_RANGE_ALLOWED
from Vintageous.ex.ex_error import VimError
from Vintageous.ex.parser.tokens import TokenDigits
from Vintageous.ex.parser.tokens import TokenDollar
from Vintageous.ex.parser.tokens import TokenDot
from Vintageous.ex.parser.tokens import TokenMark
from Vintageous.e... | denim2x/Vintageous | ex/parser/nodes.py | Python | mit | 6,391 | 0.001095 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2018 Kevin Deldycke <kevin@deldycke.com>
# and contributors.
# All Rights Reserved.
#
# 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 F... | torkelsson/meta-package-manager | meta_package_manager/base.py | Python | gpl-2.0 | 11,025 | 0 |
# Copyright 2016 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 agreed to in writing, s... | tseaver/google-cloud-python | logging/google/cloud/logging/_helpers.py | Python | apache-2.0 | 3,909 | 0 |
# -*- coding: UTF-8 -*-
from openvpnzone import extract_zones_from_status_file
from IPy import IP
def test_empty_server():
assert extract_zones_from_status_file('tests/samples/empty.ovpn-status-v1') \
== {}
def test_one_client_on_server():
assert extract_zones_from_status_file('tests/samples/one.ov... | mswart/openvpn2dns | tests/test_parser.py | Python | mit | 1,061 | 0.00377 |
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_show_main_menu_and_go_to_each_section(self):
... | baile/infojoiner | infojoiner/datacenter/functional_test.py | Python | mit | 2,451 | 0.001224 |
# Copyright (C) 2016 Pierre Marchand <pierremarc07@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
... | atelier-cartographique/static-sectioner | sectioner/template.py | Python | agpl-3.0 | 1,286 | 0.002333 |
from config import Prefix
from sigma.core.blacklist import check_black
async def custom_command_detection(ev, message, args):
if message.guild:
if message.content.startswith(Prefix):
cmd = message.content[len(Prefix):].lower()
if cmd not in ev.bot.plugin_manager.commands:
... | aurora-pro/apex-sigma | sigma/plugins/moderation/other/custom_command_detection.py | Python | gpl-3.0 | 805 | 0.003727 |
# Copyright (c) 2013-2017 CodeReclaimers, LLC
# Public API v3 description: https://btc-e.com/api/3/documentation
from collections import namedtuple
from . import common, scraping
PairInfoBase = namedtuple("PairInfoBase",
["decimal_places", "min_price", "max_price", "min_amount", "hidden", "fee"])
class PairIn... | CodeReclaimers/btce-api | btceapi/public.py | Python | mit | 6,783 | 0.001622 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-2013 Elanz (<http://www.openelanz.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | noemis-fr/old-custom | e3z_add_delivery_method/sale_order.py | Python | agpl-3.0 | 2,622 | 0.002288 |
#!/usr/bin/env python
import argparse
import getpass
import sys
import csv
from cassandra.auth import PlainTextAuthProvider
from cassandra.cqlengine import connection
from ddb import configuration
import utils
from coveragestore import SampleCoverage
from collections import defaultdict
def get_target_amplicons(fi... | dgaston/ddbio-variantstore | Misc_and_Old/create_sample_coverage_reports.py | Python | mit | 3,582 | 0.005025 |
"""
The WCS package provides functions to parse World Coordinate System (WCS)
coordinates for solar images as well as convert between various solar
coordinate systems. The solar coordinates supported are
* Helioprojective-Cartesian (HPC): The most often used solar coordinate
system. Describes positions on the Sun ... | Alex-Ian-Hamilton/sunpy | sunpy/wcs/__init__.py | Python | bsd-2-clause | 2,364 | 0.000423 |
#Convert to lower (lol)
string = input()
print (string.lower())
| LTKills/languages | python/17.py | Python | gpl-3.0 | 66 | 0.030303 |
import logging
import random
import urllib.parse
import collections
import aiohttp
import discord
import motor.motor_asyncio
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
class BooruError(Exception):
pass
class BooruProvider:
url = ''
@classmethod
def... | lnmds/jose | ext/nsfw.py | Python | mit | 7,881 | 0 |
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import radio
import datetime
import sys
import os
class RadioLogger():
"""Radio logger"""
def __init__(self, LOG_FILE, VERBOSE):
"""init the logger"""
# set up formatting for console and the two log files
confor = loggin... | hephaestus9/Radio | radio/logger.py | Python | mit | 2,105 | 0.0019 |
from __future__ import division
import numpy as np
from Tkinter import *
import json
import io
import unicodecsv as csv
#import csv
#file = open("moviesTest-1970.txt",'r')
act = open("invertedIndexActorsWeightedAll.txt",'r')
dir = open("invertedIndexDirectorsWeightedAll.txt", 'r')
wri = open("invertedIndexWritersWeig... | 93lorenzo/software-suite-movie-market-analysis | testMovies.py | Python | gpl-3.0 | 6,486 | 0.015264 |
from google.appengine.ext import db
class Stuff (db.Model):
owner = db.UserProperty(required=True, auto_current_user=True)
pulp = db.BlobProperty()
class Greeting(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
avatar = db.BlobProperty()
date = db.DateTimeProp... | 0--key/lib | portfolio/2009_GoogleAppEngine/apps/0--key/models.py | Python | apache-2.0 | 651 | 0.004608 |
""" Care about audio fileformat
"""
try:
from mutagen.flac import FLAC
from mutagen.oggvorbis import OggVorbis
except ImportError:
pass
import parser
import mutagenstripper
class MpegAudioStripper(parser.GenericParser):
""" Represent mpeg audio file (mp3, ...)
"""
def _should_remove(self, fi... | jubalh/MAT | libmat/audio.py | Python | gpl-2.0 | 1,375 | 0 |
from .ctp_gateway import CtpGateway | bigdig/vnpy | vnpy/gateway/ctp/__init__.py | Python | mit | 35 | 0.028571 |
from unittest import TestCase
import neuropsydia as n
n.start(open_window=False)
class TestColor(TestCase):
def test_is_string(self):
c = n.color("w")
self.assertTrue(isinstance(c, tuple)) | neuropsychology/Neuropsydia.py | neuropsydia/tests/test_color.py | Python | mpl-2.0 | 210 | 0.009524 |
"""The tower of Hanoi."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def tower_of_hanoi(height, from_pole, to_pole, with_pole, counter):
"""Tower of Hanoi.
Time complexity: T(1) = 1, T(n) = 2T(n - 1) + 1 => O(2^n).
Space complexity: O(1).
... | bowen0701/algorithms_data_structures | alg_tower_of_hanoi.py | Python | bsd-2-clause | 1,320 | 0.001515 |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class ShopifyAccount(ProviderAccount):
pass
class ShopifyProvider(OAuth2Provider):
id = 'shopify'
name = 'Shopify'
a... | wli/django-allauth | allauth/socialaccount/providers/shopify/provider.py | Python | mit | 1,032 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 18 12:04:44 2017
@author: rstreet
"""
from os import getcwd, path, remove, environ
from sys import path as systempath
cwd = getcwd()
systempath.append(path.join(cwd,'..'))
import artemis_subscriber
import log_utilities
import glob
from datetime import datetime
import pyt... | ytsapras/robonet_site | scripts/tests/test_survey_data_utilities.py | Python | gpl-2.0 | 4,078 | 0.01643 |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
# and then modified post-generation to use AbstractGfeRequest and
# implement str(), repr()
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ExecuteIfpNetCDFGridRequest.py | Python | bsd-3-clause | 6,327 | 0.000632 |
from __future__ import absolute_import
from abc import ABCMeta, abstractmethod
import weakref
import functools
# Decorator to target specific messages.
def targets(target_messages, no_first=False):
if isinstance(target_messages, str):
target_messages = [target_messages]
def wrapper(f):
@funct... | terhorst/psmcpp | smcpp/observe.py | Python | gpl-3.0 | 1,330 | 0 |
import numpy as np
from numpy.testing import *
from numpy.testing.noseclasses import KnownFailureTest
import nose
def test_slow():
@dec.slow
def slow_func(x,y,z):
pass
assert_(slow_func.slow)
def test_setastest():
@dec.setastest()
def f_default(a):
pass
@dec.setastest(True)
... | lthurlow/Network-Grapher | proj/external/numpy-1.7.0/numpy/testing/tests/test_decorators.py | Python | mit | 4,070 | 0.001966 |
"""
WSGI config for mng_files 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/2.0/howto/deployment/wsgi/
"""
import os
import sys
path = os.path.abspath(__file__+'/../..')
if path not in sys.path:
sys.... | idjung96/mng_files | mng_files/wsgi.py | Python | gpl-3.0 | 498 | 0.004016 |
__author__ = 'bromix'
import xbmcgui
from ..abstract_progress_dialog import AbstractProgressDialog
class XbmcProgressDialog(AbstractProgressDialog):
def __init__(self, heading, text):
AbstractProgressDialog.__init__(self, 100)
self._dialog = xbmcgui.DialogProgress()
self._dialog.create(he... | repotvsupertuga/tvsupertuga.repository | plugin.video.youtube/resources/lib/youtube_plugin/kodion/impl/xbmc/xbmc_progress_dialog.py | Python | gpl-2.0 | 911 | 0 |
# -*- coding: utf-8 -*-
"""
test_transaction.py
:copyright: (C) 2014-2015 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
import datetime
import random
import authorize
from dateutil.relativedelta import relativedelta
from trytond.tests.te... | openlabs/payment-gateway-authorize-net | tests/test_transaction.py | Python | bsd-3-clause | 23,226 | 0.000043 |
"""
CursorWrapper (like django.db.backends.utils)
"""
import decimal
import logging
import warnings
from itertools import islice
from typing import Any, Callable, Iterable, Iterator, List, Tuple, TypeVar, Union, overload
from django.db import models, NotSupportedError
from django.db.models.sql import subqueries, Query... | django-salesforce/django-salesforce | salesforce/backend/utils.py | Python | mit | 17,530 | 0.003023 |
"""
==============================================
Discrete Fourier transforms (:mod:`scipy.fft`)
==============================================
.. currentmodule:: scipy.fft
Fast Fourier Transforms (FFTs)
==============================
.. autosummary::
:toctree: generated/
fft - Fast (discrete) Fourier Transf... | jor-/scipy | scipy/fft/__init__.py | Python | bsd-3-clause | 3,965 | 0.001261 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 4 juin 2013
@author: Aristote Diasonama
'''
from shop.handlers.event.base import BaseHandler
from shop.handlers.base_handler import asso_required
from shop.models.event import Event
from shop.shop_exceptions import EventNotFoundException
class ShowEven... | EventBuck/EventBuck | shop/handlers/event/show.py | Python | mit | 2,800 | 0.018571 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | lib/spack/spack/cmd/use.py | Python | lgpl-2.1 | 1,713 | 0 |
# -*- 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 'Settings'
db.create_table('operations_settings', (
('id', self.gf('django.db.mod... | ngageoint/geoevents | geoevents/operations/migrations/0012_auto__add_settings.py | Python | mit | 17,700 | 0.00791 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
my_site = os.path.join(os.environ["HOME"], ".local/lib/python2.7/site-packages")
sys.path.insert(0, my_site)
import h5py
import networkx as nx
import numpy as np
import pycuda.driver as cuda
import scipy.stats as st
import sys
import aux
from consts import... | unicamp-lbic/small_world_ca | analysis.py | Python | gpl-2.0 | 19,617 | 0.005251 |
from core import C
from sympify import sympify
from basic import Basic, Atom
from singleton import S
from evalf import EvalfMixin, pure_complex
from decorators import _sympifyit, call_highest_priority
from cache import cacheit
from compatibility import reduce, as_int, default_sort_key
from sympy.mpmath.libmp import mpf... | amitjamadagni/sympy | sympy/core/expr.py | Python | bsd-3-clause | 102,305 | 0.000655 |
# This file is part of ArcJail.
#
# ArcJail 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.
#
# ArcJail is distributed in the hope that... | KirillMysnik/ArcJail | srcds/addons/source-python/plugins/arcjail/modules/lrs/win_reward.py | Python | gpl-3.0 | 4,013 | 0 |
import gtk
import cairo
import gobject
class CellRendererEmblems(gtk.CellRenderer):
"""Cell renderer that accepts list of icon names."""
__gproperties__ = {
'emblems': (
gobject.TYPE_PYOBJECT,
'Emblem list',
'List of icon names to display',
gobject.PARAM_READWRITE
),
'is-link': ... | Goodmind/sunflower-fm | application/widgets/emblems_renderer.py | Python | gpl-3.0 | 2,375 | 0.032842 |
#!/usr/bin/env python
"""
@file pythonPropsMSVC.py
@author Michael Behrisch
@author Daniel Krajzewicz
@author Jakob Erdmann
@date 2011
@version $Id: pythonPropsMSVC.py 14425 2013-08-16 20:11:47Z behrisch $
This script rebuilds "../../build/msvc/python.props", the file which
gives information about the python ... | cathyyul/sumo-0.18 | tools/build/pythonPropsMSVC.py | Python | gpl-3.0 | 1,517 | 0.005274 |
# -*- coding: utf-8 -*-
"""Module providing views for the folderish content page type"""
from Acquisition import aq_inner
from Products.Five.browser import BrowserView
from zope.component import getMultiAdapter
IMG = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs='
class ContentPageView(Brows... | a25kk/stv | src/stv.sitecontent/stv/sitecontent/browser/contentpage.py | Python | mit | 4,948 | 0 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
exts = [Extension("cython_hello_world",
["cython_hello_world.pyx"],
)]
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = exts,
)
| jeffzhengye/pylearn | speed/cython/scipy2013-cython-tutorial-master/exercises/hello-world/setup.py | Python | unlicense | 299 | 0.020067 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | reeshupatel/demo | keystone/common/serializer.py | Python | apache-2.0 | 13,041 | 0.000077 |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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
#
# U... | ChristopheVuillot/qiskit-sdk-py | qiskit/qasm/_node/_customunitary.py | Python | apache-2.0 | 1,893 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | thomasaarholt/hyperspy | hyperspy/models/eelsmodel.py | Python | gpl-3.0 | 38,199 | 0.000052 |
from .util import bucket as tokenbucket
from . import wrappers
class Limit(object):
def __init__(self, command_limiting_initial_tokens, command_limiting_message_cost, command_limiting_restore_rate, override, permissions):
"""limit(20, 4, 0.13, ["admin"], {"admin": "user!*@*"})
Limits the use of c... | IndigoTiger/ezzybot | ezzybot/limit.py | Python | gpl-3.0 | 1,649 | 0.004245 |
'''winnow/values.py
vivify and normalize each of the different field types:
- string
- collection (values are strings, left operand is collection)
- numeric
- bool
- date
To vivify is to turn from a string representation into a
live object. So for '2014-01-21T16:34:02', we would make a
datetime ... | bgschiller/winnow | winnow/values.py | Python | mit | 3,473 | 0.004319 |
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 = "MovingAverage", cycle_length = 0, transform = "Quantization", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_MovingAverage/cycle_0/ar_/test_artificial_1024_Quantization_MovingAverage_0__20.py | Python | bsd-3-clause | 272 | 0.084559 |
#!/usr/bin/env python
"""
poncho.common.utils : Utility Functions
"""
from datetime import datetime
def readable_datetime(dt):
"""Turn a datetime into something readable, with time since or until."""
if dt is None:
return ""
dt = dt.replace(microsecond=0)
now = datetime.now().replace(microsecon... | magellancloud/poncho | poncho/common/utils.py | Python | bsd-3-clause | 1,121 | 0.00446 |
# AUTOGENERATED FILE - DO NOT MODIFY!
# This file generated by Djinni from map.djinni
from djinni.support import MultiSet # default imported in all files
from djinni.exception import CPyException # default imported in all files
from djinni.pycffi_marshal import CPyObject, CPyObjectProxy, CPyPrimitive, CPyRecord, CPySt... | trafi/djinni | test-suite/generated-src/python/map_record.py | Python | apache-2.0 | 1,058 | 0.007561 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | jtopjian/st2 | st2common/st2common/util/misc.py | Python | apache-2.0 | 1,245 | 0 |
#!/home/ela/Python_Django/coworkok/coworkok/bin/python
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an op... | elatomczyk/dook | coworkok/bin/pilconvert.py | Python | gpl-3.0 | 2,354 | 0.002124 |
# $Id: 969e4c5fd51bb174563d06c1357489c2742813ec $
"""
Base classes for enhanced DB drivers.
"""
from __future__ import absolute_import
__docformat__ = "restructuredtext en"
# ---------------------------------------------------------------------------
# Imports
# ------------------------------------------------------... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/grizzled/grizzled/db/base.py | Python | bsd-3-clause | 32,027 | 0.001186 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | python/GafferTest/UndoTest.py | Python | bsd-3-clause | 5,828 | 0.053706 |
# Copyright (C) 2015, Carlo de Franchis <carlo.de-franchis@cmla.ens-cachan.fr>
# Copyright (C) 2015, Gabriele Facciolo <facciolo@cmla.ens-cachan.fr>
# Copyright (C) 2015, Enric Meinhardt <enric.meinhardt@cmla.ens-cachan.fr>
from __future__ import print_function
import os
import numpy as np
from s2plib import common
... | jmichel-otb/s2p | s2plib/sift.py | Python | agpl-3.0 | 5,706 | 0.001577 |
"""Nearest Neighbor Regression"""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.ac... | asnorkin/sentiment_analysis | site/lib/python2.7/site-packages/sklearn/neighbors/regression.py | Python | mit | 11,000 | 0 |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.http import HttpResponse
from smsbrana import SmsConnect
from smsbrana import signals
from smsbrana.const import DELIVERY_STATUS_DELIVERED, DATETIME_FORMAT
from smsbrana.models import SentSms
def smsconnect_notification(request):
sc = SmsConnect()
... | vlinhart/django-smsbrana | smsbrana/views.py | Python | bsd-3-clause | 1,174 | 0.001704 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
... | nistormihai/superdesk-core | tests/io/feed_parsers/dpa_test.py | Python | agpl-3.0 | 2,118 | 0.000472 |
import attr
import pandas as pd
import re
from ..base import TohuBaseGenerator
from ..logging import logger
__all__ = ['get_tohu_items_name', 'make_tohu_items_class']
def make_tohu_items_class(clsname, attr_names):
"""
Parameters
----------
clsname: string
Name of the class to be created
... | maxalbert/tohu | tohu/v6/custom_generator/utils.py | Python | mit | 3,014 | 0.00365 |
#!/usr/bin/env python
#
# Copyright 2014 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.
"""
Invokes concatenate_application_code for applications specified on the command line.
"""
from os import path
import concatenate_... | hujiajie/chromium-crosswalk | third_party/WebKit/Source/devtools/scripts/build_applications.py | Python | bsd-3-clause | 1,259 | 0.003971 |
from .meta import BaseModelDependent
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.special import i0 as bessi0
class BaseSource(BaseModelDependent):
pass
class FakeSource(BaseSource):
def __call__(self, loc):
return loc
class SimpleSource(BaseSourc... | uwoseis/anemoi | anemoi/source.py | Python | mit | 8,029 | 0.011085 |
# This module imports names for backwards compatibility and to ensure
# that pickled objects in existing sessions can be unpickled.
__all__ = ['DAObject', 'DAList', 'DADict', 'DAOrderedDict', 'DASet', 'DAFile', 'DAFileCollection', 'DAFileList', 'DAStaticFile', 'DAEmail', 'DAEmailRecipient', 'DAEmailRecipientList', 'DA... | jhpyle/docassemble | docassemble_base/docassemble/base/core.py | Python | mit | 790 | 0.002532 |
"""
Django settings for chatbot_website project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... | Catherine-Chu/DeepQA | chatbot_website/chatbot_website/settings.py | Python | apache-2.0 | 4,300 | 0.00093 |
# MIT License
#
# Copyright (C) IBM Corporation 2019
#
# 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... | IBM/differential-privacy-library | diffprivlib/models/__init__.py | Python | mit | 1,558 | 0.005777 |
#
# Copyright 2014-2015 Boundary, 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... | wcainboundary/boundary-api-cli | boundary/source_list.py | Python | apache-2.0 | 856 | 0 |
import torch
from base_model import Loss
from train import dboxes300_coco
from opt_loss import OptLoss
# In:
# ploc : N x 8732 x 4
# plabel : N x 8732
# gloc : N x 8732 x 4
# glabel : N x 8732
data = torch.load('loss.pth')
ploc = data['ploc'].cuda()
plabel = data['plabel'].cuda()
gloc = data['gloc'].cuda()
glabe... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/ssd/implementations/pytorch/test/opt_loss_test.py | Python | apache-2.0 | 1,453 | 0.003441 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Session',
... | hydroshare/hydroshare | hs_tracking/migrations/0001_initial.py | Python | bsd-3-clause | 1,731 | 0.002889 |
import random
from ..simulator import Simulator
class RandomMover(Simulator):
ACTIONS = ('up', 'down', 'left', 'right')
def start(self):
self.init_game()
while True:
self._check_pygame_events()
for drone in self.drones:
drone.do_move(random.choice(sel... | dev-coop/plithos | src/plithos/simulations/random_mover.py | Python | mit | 388 | 0 |
import logging
import re
import markdown
from django.conf import settings
from django.db import models
from django.template import Template, Context, loader
import sys
from selvbetjening.core.mail import send_mail
logger = logging.getLogger('selvbetjening.email')
class EmailSpecification(models.Model):
BODY_FO... | animekita/selvbetjening | selvbetjening/core/mailcenter/models.py | Python | mit | 6,200 | 0.001774 |
#!/usr/bin/env python3
# Copyright 2019 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | google/graphicsfuzz | python/src/main/python/test_scripts/inspect_compute_results_test.py | Python | apache-2.0 | 15,285 | 0.004122 |
from qcodes.instrument.base import Instrument
from qcodes.utils import validators as vals
from qcodes.instrument.parameter import ManualParameter
import numpy as np
class SimControlCZ(Instrument):
"""
Noise and other parameters for cz_superoperator_simulation_new
"""
def __init__(self, name, **kw):
... | DiCarloLab-Delft/PycQED_py3 | pycqed/instrument_drivers/virtual_instruments/sim_control_CZ.py | Python | mit | 11,275 | 0.001508 |
import numpy
import chainer
from chainer import backend
from chainer import function_node
from chainer.utils import type_check
def _as_mat(x):
if x.ndim == 2:
return x
return x.reshape(len(x), -1)
def _ij_ik_il_to_jkl(a, b, c):
ab = chainer.functions.matmul(a[:, :, None], b[:, None, :]) # ijk
... | okuta/chainer | chainer/functions/connection/bilinear.py | Python | mit | 9,015 | 0 |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2021 OzzieIsaacs
#
# 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... | janeczku/calibre-web | cps/services/Metadata.py | Python | gpl-3.0 | 3,837 | 0.000784 |
# coding: utf-8
from __future__ import unicode_literals, absolute_import
try:
import requests as r
except:
r = None
class TigrisSession(object):
"""
Base session layer for Tigris.
"""
def __init__(self,
base_url,
default_headers={}):
"""
:pa... | jogral/tigris-python-sdk | tigrissdk/session/tigris_session.py | Python | apache-2.0 | 5,263 | 0.00019 |
"""
This is a subscriber meant for the 'weather' messages example.
It uses a custom code loop to get and process messages.
"""
from __future__ import print_function
import sys
import threading
import time
import Pyro4
from messagebus.messagebus import Subscriber
from Pyro4.util import excepthook
sys.excepthook = excep... | irmen/Pyro4 | examples/messagebus/subscriber_manual_consume.py | Python | mit | 2,432 | 0.002467 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | Lekensteyn/buildbot | master/buildbot/steps/mtrlogobserver.py | Python | gpl-2.0 | 18,336 | 0.000545 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/models.py | Python | mit | 360 | 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
#
# Unless required by applicable law or agreed to in writing, software
# d... | SUSE-Cloud/glance | glance/tests/integration/legacy_functional/base.py | Python | apache-2.0 | 7,145 | 0 |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from compose.config.config import ConfigDetails
from compose.config.config import ConfigFile
from compose.config.config import load
def build_config(contents, **kwargs):
return load(build_config_details(contents, **kwargs))... | sdurrheimer/compose | tests/helpers.py | Python | apache-2.0 | 1,309 | 0.000764 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... | williamHuang5468/QuicklyLearnDjango | mysite/mysite/settings.py | Python | mit | 2,686 | 0 |
from django.core.management.base import BaseCommand, CommandError
from xmodule.contentstore.utils import restore_asset_from_trashcan
class Command(BaseCommand):
help = '''Restore a deleted asset from the trashcan back to it's original course'''
def handle(self, *args, **options):
if len(args) != 1 an... | htzy/bigfour | cms/djangoapps/contentstore/management/commands/restore_asset_from_trashcan.py | Python | agpl-3.0 | 480 | 0.004167 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import Environment, Rule
from sentry.testutils import APITestCase
class ProjectRuleListTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
... | mvaled/sentry | tests/sentry/api/endpoints/test_project_rules.py | Python | bsd-3-clause | 5,710 | 0.002627 |
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | jasonzzz/ansible | lib/ansible/module_utils/junos.py | Python | gpl-3.0 | 9,209 | 0.000869 |
# -*- coding: utf-8 -*-
"""
pid - example of PID control of a simple process with a time constant
Copyright (c) 2016 - RocketRedNeck.com RocketRedNeck.net
RocketRedNeck and MIT Licenses
RocketRedNeck hereby grants license for others to copy and modify this source code for
whatever purpose other's deem worthy as l... | RocketRedNeck/PythonPlayground | pid_dot.py | Python | mit | 2,665 | 0.01651 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "garelay.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| smn/garelay | manage.py | Python | bsd-2-clause | 259 | 0 |
"""
Format the current file with black or isort.
Available in Tools/Python/Black and Tools/Python/Isort.
"""
from __future__ import annotations
import logging
import subprocess
import traceback
from functools import partial
from pathlib import Path
from tkinter import messagebox
from porcupine import menubar, tabs,... | Akuli/porcupine | porcupine/plugins/python_tools.py | Python | mit | 2,238 | 0.002234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.