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 |
|---|---|---|---|---|---|---|
"""add unique key to username
Revision ID: c19852e4dcda
Revises: 1478867a872a
Create Date: 2020-08-06 00:39:03.004053
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c19852e4dcda'
down_revision = '1478867a872a'
branch_labels = None
depends_on = None
def upgr... | hackerspace-silesia/cebulany-manager | migrations/versions/c19852e4dcda_add_unique_key_to_username.py | Python | mit | 953 | 0.001049 |
#!/bin/env python
# Copyright 2013 Zynga 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... | zbase/disk_mapper | dm_server/lib/urlmapper.py | Python | apache-2.0 | 2,103 | 0.000951 |
"""
Django settings for mysite 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, ...)
imp... | HayaoSuzuki/django-tutorial | mysite/mysite/settings.py | Python | mit | 2,134 | 0 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | cloudbase/nova-virtualbox | nova/tests/unit/conf_fixture.py | Python | apache-2.0 | 3,169 | 0 |
# Copyright (c) 2010-2011 Joshua Harlan Lifton.
# See LICENSE.txt for details.
# TODO: add tests for all machines
# TODO: add tests for new status callbacks
"""Base classes for machine types. Do not use directly."""
import binascii
import threading
import serial
from plover import _, log
from plover.machine.keymap... | openstenoproject/plover | plover/machine/base.py | Python | gpl-2.0 | 8,198 | 0.000732 |
# -*- coding: utf-8 -*-
from folium.plugins.marker_cluster import MarkerCluster
from folium.utilities import if_pandas_df_convert_to_numpy, validate_location
from jinja2 import Template
class FastMarkerCluster(MarkerCluster):
"""
Add marker clusters to a map using in-browser rendering.
Using FastMarkerC... | ocefpaf/folium | folium/plugins/fast_marker_cluster.py | Python | mit | 3,954 | 0.000506 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 01 10:45:09 2014
Training models remotely in cloud
@author: pacif_000
"""
from kafka.client import KafkaClient
from kafka.consumer import SimpleConsumer
import os
import platform
if platform.system() == 'Windows':
import win32api
else:
import signal
import thread
... | xumiao/pymonk | tests/kafka_tester.py | Python | mit | 1,929 | 0.007258 |
# Copyright (c) 2013 - 2020 Adam Caudill and Contributors.
# This file is part of YAWAST which is released under the MIT license.
# See the LICENSE file or go to https://yawast.org/license/ for full license details.
import re
from typing import List
from yawast.reporting.enums import Vulnerabilities
from yawast.sc... | adamcaudill/yawast | yawast/scanner/plugins/http/servers/rails.py | Python | mit | 1,712 | 0.001752 |
#因为首尾相连, 考虑第一位抢或不抢 两种情况分开
class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return nums[0]
if len(nums) == 2:
return max(nums)
l = []
... | MingfeiPan/leetcode | dp/213.py | Python | apache-2.0 | 1,077 | 0.003865 |
import unittest
from mock import Mock
from cartodb_services.tomtom.isolines import TomTomIsolines, DEFAULT_PROFILE
from cartodb_services.tools import Coordinate
from credentials import tomtom_api_key
VALID_ORIGIN = Coordinate(-73.989, 40.733)
class TomTomIsolinesTestCase(unittest.TestCase):
def setUp(self):
... | CartoDB/geocoder-api | server/lib/python/cartodb_services/test/test_tomtomisoline.py | Python | bsd-3-clause | 992 | 0 |
# -*- coding: utf-8 -*-
class Ledger(object):
def __init__(self, db):
self.db = db
def balance(self, token):
cursor = self.db.cursor()
cursor.execute("""SELECT * FROM balances WHERE TOKEN = %s""", [token])
row = cursor.fetchone()
return 0 if row is None else row[2]
... | Storj/accounts | accounts/ledger.py | Python | mit | 1,481 | 0.00135 |
#!/usr/bin/python
#
#
from distutils.core import setup
from spacewalk.common.rhnConfig import CFG, initCFG
initCFG('web')
setup(name = "rhnclient",
version = "5.5.9",
description = CFG.PRODUCT_NAME + " Client Utilities and Libraries",
long_description = CFG.PRODUCT_NAME + """\
Client Utilities
Incl... | PaulWay/spacewalk | client/solaris/rhnclient/setup.py | Python | gpl-2.0 | 610 | 0.029508 |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from . import BedLevelMachineAction
from . import UMOUpgradeSelection
def getMetaData():
return {}
def register(app):
return { "machine_action": [
BedLevelMachineAction.BedLevelMachineAction(),
UMO... | Ultimaker/Cura | plugins/UltimakerMachineActions/__init__.py | Python | lgpl-3.0 | 366 | 0.008197 |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="scatter.line", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/line/_width.py | Python | mit | 523 | 0.001912 |
n=int(input('Enter any number: '))
if n%2!=0:
n=n+1
for i in range(n):
for j in range(n):
if (i==int(n/2)) or j==int(n/2) or ((i==0)and (j>=int(n/2))) or ((j==0)and (i<=int(n/2))) or ((j==n-1)and (i>=int(n/2))) or ((i==n-1)and (j<=int(n/2))):
print('*',end='')
else:
... | rohitjogson/pythonwork | assign27.09.py | Python | gpl-3.0 | 355 | 0.059155 |
from PyQt4.QtCore import QSize
from PyQt4.QtGui import QVBoxLayout
# This is really really ugly, but the QDockWidget for some reason does not notice when
# its child widget becomes smaller...
# Therefore we manually set its minimum size when our own minimum size changes
class MyVBoxLayout(QVBoxLayout):
def __init... | bitmingw/FindYourSister | sloth/sloth/gui/utils.py | Python | bsd-2-clause | 994 | 0.002012 |
# Copyright (c) 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | barnsnake351/neutron | neutron/tests/unit/extensions/test_agent.py | Python | apache-2.0 | 7,027 | 0 |
#!/bin/env python
# \author Hans J. Johnson
#
# Prepare for the future by recommending
# use of itk::Math:: functions over
# vnl_math:: functions.
# Rather than converting vnl_math_ to vnl_math::
# this prefers to convert directly to itk::Math::
# namespace. In cases where vnl_math:: is simply
# an alias to std:: func... | zachary-williamson/ITK | Utilities/Maintenance/VNL_ModernizeNaming.py | Python | apache-2.0 | 3,528 | 0.014172 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Defines custom errors and exceptions used in `astropy.samp`.
"""
import xmlrpc.client as xmlrpc
from astropy.utils.exceptions import AstropyUserWarning
__all__ = ['SAMPWarning', 'SAMPHubError', 'SAMPClientError', 'SAMPProxyError']
class SAMPWarn... | pllim/astropy | astropy/samp/errors.py | Python | bsd-3-clause | 637 | 0 |
#Author: Miguel Molero <miguel.molero@gmail.com>
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class ObjectInspectorWidget(QWidget):
def __init__(self, parent = None):
super(ObjectInspectorWidget, self).__init__(parent)
layout = QVBoxLayout()
self.ta... | mmolero/pcloudpy | pcloudpy/gui/components/ObjectInspectorWidget.py | Python | bsd-3-clause | 1,774 | 0.012401 |
import unittest
from collections import namedtuple
from io import BytesIO
import codecs
import sha2
import hmac
class TestSHA2(unittest.TestCase):
# test vectors from https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
TestVector = namedtuple('TestVector', ['digestcls', 'text'... | olbat/o1b4t | coding/crypto/test_hmac.py | Python | gpl-3.0 | 10,162 | 0.000098 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def plot_decision_regions(X, y, clf, res=0.02):
x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1
y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, res),
np.arang... | wyzekid/Python_Projects | Perceptron/Rosenblatt_perceptron.py | Python | gpl-3.0 | 1,928 | 0.015659 |
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import Client
from .....checkout.tests import BaseCheckoutAppTests
from .....delivery.tests import TestDeliveryProvider
from .....order import handler as order_handler
from .....payment imp... | fusionbox/satchless | satchless/contrib/checkout/singlestep/tests/__init__.py | Python | bsd-3-clause | 7,298 | 0.00274 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import pytest
import backend_common
@pytest.fixture(scope='session')
def app():
... | La0/mozilla-relengapi | src/shipit/api/tests/conftest.py | Python | mpl-2.0 | 1,089 | 0.000918 |
import sys
import argparse
import numpy as np
import pylab as pl
import netCDF4
import logging
import pymqdatastream.connectors.todl.todl_data_processing as todl_data_processing
try:
from PyQt5 import QtCore, QtGui, QtWidgets
except:
from qtpy import QtCore, QtGui, QtWidgets
#https://matplotlib.org/3.1.0/gall... | MarineDataTools/pymqdatastream | pymqdatastream/connectors/todl/tools/todl_quickview.py | Python | gpl-3.0 | 9,129 | 0.011173 |
# Copyright (c) 2017-2020 Glenn McKechnie <glenn.mckechnie@gmail.com>
# Credit to Tom Keffer <tkeffer@gmail.com>, Matthew Wall and the core
# weewx team, all from whom I've borrowed heavily.
# Mistakes are mine, corrections and or improvements welcomed
# https://github.com/glennmckechnie/weewx-wxobs
#
# rsync code b... | glennmckechnie/weewx-wxobs | bin/user/wxobs.py | Python | gpl-3.0 | 27,446 | 0.000911 |
# © 2017 Sergio Teruel <sergio.teruel@tecnativa.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from .hooks import pre_init_hook
from . import models
from . import report
| OCA/margin-analysis | account_invoice_margin/__init__.py | Python | agpl-3.0 | 194 | 0 |
# Copyright (c) 2014, Max Zwiessele, James Hensman
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from paramz.transformations import *
from paramz.transformations import __fixed__
| befelix/GPy | GPy/core/parameterization/transformations.py | Python | bsd-3-clause | 194 | 0 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... | mganeva/mantid | scripts/AbinsModules/CalculateS.py | Python | gpl-3.0 | 2,205 | 0.004989 |
# coding: utf-8
from __future__ import unicode_literals
import hashlib
import math
import random
import time
import uuid
from .common import InfoExtractor
from ..compat import compat_urllib_parse
from ..utils import ExtractorError
class IqiyiIE(InfoExtractor):
IE_NAME = 'iqiyi'
IE_DESC = '爱奇艺'
_VALID_U... | atomic83/youtube-dl | youtube_dl/extractor/iqiyi.py | Python | unlicense | 9,558 | 0.000745 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-15 16:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('isisdata', '0019_auto_20160427_1520'),
]
operations = [
migrations.AddField(... | upconsulting/IsisCB | isiscb/isisdata/migrations/0020_auto_20160615_1630.py | Python | mit | 15,648 | 0.000831 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-14 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Documen... | kyunooh/JellyBlog | lifeblog/migrations/0001_initial.py | Python | apache-2.0 | 900 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Azure/azure-sdk-for-python | sdk/edgegateway/azure-mgmt-edgegateway/azure/mgmt/edgegateway/models/upload_certificate_response.py | Python | mit | 3,198 | 0.001876 |
'''Todo:
* Add multiple thread support for async_process functions
* Potentially thread each handler function? idk
'''
import sys
import socket
import re
import threading
import logging
import time
if sys.hexversion < 0x03000000:
#Python 2
import Queue as queue
BlockingIOError = socket.error
else:
imp... | codetalkio/TelegramIRCImageProxy | asyncirc/ircbot.py | Python | mit | 5,983 | 0.00234 |
from django.http import HttpRequest
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
try:
from allauth.account import app_settings as allauth_settings
from allauth.utils import (email_address_exists,
get_username_max_length)
from allaut... | saurabhVisie/appserver | rest_auth/registration/serializers.py | Python | mit | 6,316 | 0.000792 |
#!/Users/shreyashirday/Personal/openmdao-0.13.0/bin/python
# EASY-INSTALL-SCRIPT: 'docutils==0.10','rst2odt_prepstyles.py'
__requires__ = 'docutils==0.10'
__import__('pkg_resources').run_script('docutils==0.10', 'rst2odt_prepstyles.py')
| HyperloopTeam/FullOpenMDAO | bin/rst2odt_prepstyles.py | Python | gpl-2.0 | 237 | 0.004219 |
#!/usr/bin/env python2.7
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | tst-mswartz/earthenterprise | earth_enterprise/src/server/wsgi/search/common/exceptions.py | Python | apache-2.0 | 1,602 | 0.006866 |
#! /usr/bin/env python
# coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
import os
#config
#change the GPIO Port number
gpioport=24
sdate = time.strftime("%H:%M:%S")
stime = time.strftime("%Y-%m-%d")
GPIO.setmode(GPIO.BCM)
GPIO.setup(gpioport, GPIO.IN)
def sysshutdown(channel):
msg="System shutdown GPIO.Low ... | BaileySN/Raspberry-Pi-Shutdown-Button | shutdown_script.py | Python | gpl-3.0 | 586 | 0.030717 |
#!/usr/bin/env python
from __future__ import print_function
from collections import defaultdict
from collections import deque
from itertools import islice
#from subprocess import call
import subprocess
from optparse import OptionParser
from tempfile import mkstemp
import glob
import os
import random
import re
import sh... | cmhill/q-compression | src/compress.py | Python | mit | 50,746 | 0.005656 |
"""Prepare rendering of popular smart grid actions widget"""
from apps.widgets.smartgrid import smartgrid
def supply(request, page_name):
"""Supply view_objects content, which are the popular actions from the smart grid game."""
_ = request
num_results = 5 if page_name != "status" else None
#cont... | yongwen/makahiki | makahiki/apps/widgets/popular_tasks/views.py | Python | mit | 997 | 0.008024 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-02-29 16:58
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sa_api_v2', '0004_dj... | openplans/shareabouts-api | src/sa_api_v2/migrations/0005_add_dimensions_to_attachments.py | Python | gpl-3.0 | 702 | 0 |
"""Authentication and authorization."""
from haas.errors import AuthorizationError
from haas import model
from abc import ABCMeta, abstractmethod
import sys
_auth_backend = None
class AuthBackend(object):
"""An authentication/authorization backend.
Extensions which implement authentication/authorization b... | meng-sun/hil | haas/auth.py | Python | apache-2.0 | 4,101 | 0.000244 |
"""
Author: Seyed Hamidreza Mohammadi
This file is part of the shamidreza/uniselection software.
Please refer to the LICENSE provided alongside the software (which is GPL v2,
http://www.gnu.org/licenses/gpl-2.0.html).
This file includes the code for putting all the pieces together.
"""
from utils import *
from extra... | shamidreza/unitselection | experiment.py | Python | gpl-2.0 | 3,464 | 0.018764 |
import os
import os.path
from raiden.constants import RAIDEN_DB_VERSION
def database_from_privatekey(base_dir, app_number):
""" Format a database path based on the private key and app number. """
dbpath = os.path.join(base_dir, f"app{app_number}", f"v{RAIDEN_DB_VERSION}_log.db")
os.makedirs(os.path.dirna... | hackaugusto/raiden | raiden/tests/utils/app.py | Python | mit | 351 | 0.002849 |
# coding=utf-8
from datetime import datetime, date, time
from decimal import Decimal
import json
import django
from django.forms import IntegerField
from django.test import TransactionTestCase, Client
from django.utils.functional import curry
from django.utils.translation import ugettext_lazy
import pytz
from formapi... | 5monkeys/django-formapi | formapi/tests.py | Python | mit | 8,355 | 0.001078 |
'''
20140213
Import CSV Data - Dict
Save as JASON?
Basic Stats
Save to file
Find Key Words
Generate Reports...
Generate Plots
'''
import csv
import numpy as np
import matplotlib as mpl
from scipy.stats import nanmean
filename = '20140211_ING.csv'
###____________ Helper ___________###
def number_fields(data):
... | Jim-Rod/csv_summary | csv_summary.py | Python | mit | 2,979 | 0.006378 |
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2009-09-19
# Copyright 2010 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://... | hsoft/musicguru | qt/ignore_box.py | Python | bsd-3-clause | 1,816 | 0.008811 |
"""The WaveBlocks Project
Compute the transformation to the eigen basis for wavefunction.
@author: R. Bourquin
@copyright: Copyright (C) 2012, 2016 R. Bourquin
@license: Modified BSD License
"""
from WaveBlocksND import BlockFactory
from WaveBlocksND import WaveFunction
from WaveBlocksND import BasisTransformationWF... | WaveBlocks/WaveBlocksND | WaveBlocksND/Interface/EigentransformWavefunction.py | Python | bsd-3-clause | 2,041 | 0.00294 |
try:
import ossaudiodev
except:
print "ossaudiodev not installed"
ossaudiodev = None
try:
import FFT
except:
print "FFT not installed"
ossaudiodev = None
try:
import Numeric
except:
print "Numeric not installed"
ossaudiodev = None
import struct, math, time, threading, copy
def add(s... | emilydolson/forestcat | pyrobot/tools/sound.py | Python | agpl-3.0 | 6,306 | 0.014589 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# (c) 2014, James Cammarata, <jcammarata@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 ... | kaarolch/ansible | test/units/parsing/vault/test_vault_editor.py | Python | gpl-3.0 | 6,376 | 0.000941 |
def main():
a=raw_input()
print a.lstrip()
print "Hello world"
main()
| kumarisneha/practice_repo | techgig_rstrip.py | Python | mit | 83 | 0.024096 |
from __future__ import absolute_import
from jinja2 import Markup
from rstblog.programs import RSTProgram
import typogrify
class TypogrifyRSTProgram(RSTProgram):
def get_fragments(self):
if self._fragment_cache is not None:
return self._fragment_cache
with self.context.open_source_fil... | ericam/sidesaddle | modules/typogrify.py | Python | mit | 620 | 0.001613 |
from aiida import load_dbenv
load_dbenv()
from aiida.orm import Code, DataFactory
import numpy as np
StructureData = DataFactory('structure')
ParameterData = DataFactory('parameter')
codename = 'lammps_md@boston'
############################
# Define input parameters #
############################
a = 5.404
cell... | abelcarreras/aiida_extensions | plugins/launcher/launch_lammps_md_si.py | Python | mit | 2,634 | 0.002278 |
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'riak_repl', '__about__.py')) as f:
exec(f.read(), ABOUT)
# Get the long description from... | DataDog/integrations-extras | riak_repl/setup.py | Python | bsd-3-clause | 2,385 | 0.000839 |
import os,sys,re
# EXTRACTING ALL FILENAMES AND THEIR CLIENTS
# ---------------------------------------------------
# read in the log
# ---------------------------------------------------
f=open(sys.argv[1],'rb')
data=f.readlines()
f.close()
n=0
t=len(data)
clients = []
filename = None
for l in data :
n = n... | khosrow/metpx | sundew/doc/pds_conversion/routing_step1.py | Python | gpl-2.0 | 1,705 | 0.039883 |
# -*- coding: utf-8 -*-
import webapp2
from boilerplate import models
from boilerplate import forms
from boilerplate.handlers import BaseHandler
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from google.appengine.api import users as googleusers
from collections impor... | nortd/bomfu | admin/users.py | Python | lgpl-3.0 | 4,033 | 0.002727 |
import asyncio
from unittest import mock
from aiorpcx import RPCError
from server.env import Env
from server.controller import Controller
loop = asyncio.get_event_loop()
def set_env():
env = mock.create_autospec(Env)
env.coin = mock.Mock()
env.loop_policy = None
env.max_sessions = 0
env.max_subs... | erasmospunk/electrumx | tests/server/test_api.py | Python | mit | 2,877 | 0 |
"""
================================================================================
Logscaled Histogram
================================================================================
| Calculates a logarithmically spaced histogram for a data map.
| Written By: Matthew Stadelman
| Date Written: 2016/03/07
| Last Mod... | stadelmanma/netl-ap-map-flow | apmapflow/data_processing/histogram_logscale.py | Python | gpl-3.0 | 2,486 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Roboterclub Aachen e.V.
# All rights reserved.
#
# The file is part of the xpcc library and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# ----------------------------------------------... | dergraaf/xpcc | tools/device_file_generator/avr_generator.py | Python | bsd-3-clause | 1,677 | 0.019678 |
from rest_framework import relations, serializers
import amo
import mkt.carriers
import mkt.regions
from addons.models import Category
from mkt.api.fields import SplitField, TranslationSerializerField
from mkt.api.serializers import URLSerializerMixin
from mkt.collections.serializers import (CollectionSerializer, Slug... | wagnerand/zamboni | mkt/feed/serializers.py | Python | bsd-3-clause | 2,948 | 0.002035 |
#!/usr/bin/env python
import os
import glob
import unittest
import pysmile
import json
__author__ = 'Jonathan Hosmer'
class PySmileTestDecode(unittest.TestCase):
def setUp(self):
curdir = os.path.dirname(os.path.abspath(__file__))
self.smile_dir = os.path.join(curdir, 'data', 'smile')
... | jhosmer/PySmile | tests/pysmile_tests.py | Python | apache-2.0 | 11,679 | 0.004196 |
import nmrglue as ng
import matplotlib.pyplot as plt
# read in data
dic, data = ng.pipe.read("test.ft2")
# find PPM limits along each axis
uc_15n = ng.pipe.make_uc(dic, data, 0)
uc_13c = ng.pipe.make_uc(dic, data, 1)
x0, x1 = uc_13c.ppm_limits()
y0, y1 = uc_15n.ppm_limits()
# plot the spectrum
fig = plt.figure(figsi... | atomman/nmrglue | examples/jbnmr_examples/s4_2d_plotting/plot_2d_pipe_spectrum.py | Python | bsd-3-clause | 929 | 0 |
#!/usr/bin/env python3
#
# Copyright (c) 2012 Timo Savola
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
... | tsavola/concrete | python/concrete/tools.py | Python | lgpl-2.1 | 3,421 | 0.030108 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the photometry module.
"""
import pytest
import numpy as np
from numpy.testing import (assert_allclose, assert_array_equal,
assert_array_less)
from astropy.coordinates import SkyCoord
from astropy.io import fits
f... | astropy/photutils | photutils/aperture/tests/test_photometry.py | Python | bsd-3-clause | 32,618 | 0 |
# -*- coding: utf-8 -*-
import time
from django.conf import settings
from django.template import Context
from sekizai.context import SekizaiContext
from cms.api import add_plugin, create_page, create_title
from cms.cache import _get_cache_version, invalidate_cms_page_cache
from cms.cache.placeholder import (
_g... | FinalAngel/django-cms | cms/tests/test_cache.py | Python | bsd-3-clause | 37,055 | 0.001538 |
#!/usr/bin/python
import cgi
from redis import Connection
from socket import gethostname
from navi import *
fields = cgi.FieldStorage()
title = "Message Box"
msg_prefix = 'custom.message.'
def insert_msg(cust, tm, msg):
conn = Connection(host=gethostname(),port=6379)
conn.send_command('set', msg_prefix+cust... | Zex/Starter | cgi-bin/leave_message.py | Python | mit | 1,575 | 0.010159 |
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import controllers
| OCA/social | website_mass_mailing_name/__init__.py | Python | agpl-3.0 | 91 | 0 |
import struct
import unittest
from zoonado.protocol import response, primitives
class ResponseTests(unittest.TestCase):
def test_deserialize(self):
class FakeResponse(response.Response):
opcode = 99
parts = (
("first", primitives.Int),
("second",... | wglass/zoonado | tests/protocol/test_response.py | Python | apache-2.0 | 731 | 0 |
import os
MOZ_OBJDIR = 'obj-firefox'
config = {
'default_actions': [
'clobber',
'clone-tools',
'checkout-sources',
#'setup-mock',
'build',
#'upload-files',
#'sendchange',
'check-test',
'valgrind-test',
#'generate-build-stats',
... | Yukarumya/Yukarum-Redfoxes | testing/mozharness/configs/builds/releng_sub_linux_configs/64_valgrind.py | Python | mpl-2.0 | 1,603 | 0.004367 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('training', '0006_auto_20160627_1620'),
]
operations = [
migrations.RemoveField(
model_name='trainesscourserecord... | akademikbilisim/ab-kurs-kayit | abkayit/training/migrations/0007_auto_20160628_1243.py | Python | gpl-3.0 | 617 | 0 |
"""
Proctored Exams Transformer
"""
from django.conf import settings
from edx_proctoring.api import get_attempt_status_summary
from edx_proctoring.models import ProctoredExamStudentAttemptStatus
from openedx.core.lib.block_structure.transformer import BlockStructureTransformer, FilteringTransformerMixin
class Proct... | shabab12/edx-platform | lms/djangoapps/course_api/blocks/transformers/proctored_exam.py | Python | agpl-3.0 | 2,327 | 0.003008 |
from panda3d.core import LPoint3
# EDIT GAMEMODE AT THE BOTTOM (CHESS VARIANTS)
# COLORS (for the squares)
BLACK = (0, 0, 0, 1)
WHITE = (1, 1, 1, 1)
HIGHLIGHT = (0, 1, 1, 1)
HIGHLIGHT_MOVE = (0, 1, 0, 1)
HIGHLIGHT_ATTACK = (1, 0, 0, 1)
# SCALE (for the 3D representation)
SCALE = 0.5
PIECE_SCALE = 0.3
BOARD_HEIGHT = ... | guille0/space-chess | config.py | Python | mit | 5,079 | 0.024808 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import sqlite3
except ImportError:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
f... | V11/volcano | server/sqlmap/plugins/dbms/sqlite/connector.py | Python | mit | 3,003 | 0.00333 |
""" SQLAlchemy support. """
from __future__ import absolute_import
import datetime
from types import GeneratorType
import decimal
from sqlalchemy import func
# from sqlalchemy.orm.interfaces import MANYTOONE
from sqlalchemy.orm.collections import InstrumentedList
from sqlalchemy.sql.type_api import TypeDecorator
try:... | Nebucatnetzer/tamagotchi | pygame/lib/python3.4/site-packages/mixer/backend/sqlalchemy.py | Python | gpl-2.0 | 8,887 | 0.000675 |
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com>
# 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... | NcLang/vimrc | sources_non_forked/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/compatibility.py | Python | mit | 2,108 | 0.019924 |
import unittest
import sys
import numpy as np
from opm.util import EModel
try:
from tests.utils import test_path
except ImportError:
from utils import test_path
class TestEModel(unittest.TestCase):
def test_open_model(self):
refArrList = ["PORV", "CELLVOL", "DEPTH", "DX", "DY", "DZ", "PORO", "... | blattms/opm-common | python/tests/test_emodel.py | Python | gpl-3.0 | 5,037 | 0.010125 |
# (c) 2014, Nandor Sivok <dominis@haxor.hu>
# (c) 2016, Redhat Inc
#
# ansible-console 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.
... | filipenf/ansible | lib/ansible/cli/console.py | Python | gpl-3.0 | 16,263 | 0.003136 |
from abc import ABCMeta, abstractmethod
class ProgressMessage(object):
def __init__(self, path, bytes_per_second, bytes_read, bytes_expected):
self._path = path
self._bytes_per_second = bytes_per_second
self._bytes_read = bytes_read
self._bytes_expected = bytes_expected
@prope... | Sybrand/digital-panda | digitalpanda/bucket/abstract.py | Python | mit | 2,411 | 0 |
from direct.directnotify import DirectNotifyGlobal
from BaseActivityFSM import BaseActivityFSM
from activityFSMMixins import IdleMixin
from activityFSMMixins import RulesMixin
from activityFSMMixins import ActiveMixin
from activityFSMMixins import DisabledMixin
from activityFSMMixins import ConclusionMixin
from activit... | ksmit799/Toontown-Source | toontown/parties/activityFSMs.py | Python | mit | 3,442 | 0.004067 |
# -*- coding: utf-8 -*-
"""
tomorrow night blue
---------------------
Port of the Tomorrow Night Blue colour scheme https://github.com/chriskempson/tomorrow-theme
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Text, \
Number, Operator, Generic, Whitespace, ... | thergames/thergames.github.io | lib/tomorrow-pygments/styles/tomorrownightblue.py | Python | mit | 5,509 | 0.000363 |
import unittest
from PyFoam.Applications.ConvertToCSV import ConvertToCSV
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Applications/test_ConvertToCSV.py | Python | gpl-2.0 | 106 | 0.009434 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | tests/python/contrib/test_ethosn/test_mean.py | Python | apache-2.0 | 2,066 | 0.001452 |
# 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
# distributed under the Li... | HonzaKral/warehouse | warehouse/legacy/tables.py | Python | apache-2.0 | 12,359 | 0 |
#!/usr/bin/env python
import os
import os.path
path = "source"
import doctest
for f in os.listdir(path):
if f.endswith(".txt"):
print f
doctest.testfile(os.path.join(path, f), module_relative=False)
| tectronics/mpmath | doc/run_doctest.py | Python | bsd-3-clause | 222 | 0.004505 |
"""
Virtualization installation functions.
Copyright 2007-2008 Red Hat, Inc.
Michael DeHaan <mdehaan@redhat.com>
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... | ssalevan/cobbler | koan/qcreate.py | Python | gpl-2.0 | 7,315 | 0.008612 |
'''
Created on Nov 21, 2013
@author: ezulkosk
'''
from FeatureSplitConfig import ers_optional_names, bdb_optional_names, \
webportal_optional_names, eshop_optional_names, ers_config_split_names, \
webportal_config_split_names, eshop_config_split_names, bdb_config_split_names
from consts import METRICS_MAXIMIZE... | ai-se/parGALE | epoal_src/parallelfeaturesplitGIA.py | Python | unlicense | 33,034 | 0.009293 |
import load_data as ld
import sys
import os
f_list = os.listdir(sys.argv[1])
data = ld.loadIntoPandas(ld.processAllDocuments(sys.argv[1], f_list))
data.to_pickle(sys.argv[2])
| lbybee/vc_network_learning_project | code/gen_load_data.py | Python | gpl-2.0 | 177 | 0 |
from fractions import gcd
def greatest_common_divisor(*args):
args = list(args)
a, b = args.pop(), args.pop()
gcd_local = gcd(a, b)
while len(args):
gcd_local = gcd(gcd_local, args.pop())
return gcd_local
def test_function():
assert greatest_common_divisor(6, 10, 15) == 1, "12"
a... | denisbalyko/checkio-solution | gcd.py | Python | mit | 635 | 0.001575 |
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.osv import expression
from openerp.tools import float_is_zero
from openerp.tools import float_compare, float_round
from openerp.tools.misc import formatLang
from openerp.exceptions import UserError, ValidationError
import time
import math... | angelapper/odoo | addons/account/models/account_bank_statement.py | Python | agpl-3.0 | 47,237 | 0.004573 |
class APIError(Exception):
"""Represents an error returned in a response to a fleet API call
This exception will be raised any time a response code >= 400 is returned
Attributes:
code (int): The response code
message(str): The message included with the error response
http_error(goo... | cnelson/python-fleet | fleet/v1/errors.py | Python | apache-2.0 | 1,594 | 0.002509 |
# Copyright (C) 2018, Yu Sheng Lin, johnjohnlys@media.ee.ntu.edu.tw
# This file is part of Nicotb.
# Nicotb 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 opti... | johnjohnlin/nicotb | sim/ahb/Ahb_test.py | Python | gpl-3.0 | 2,569 | 0.024912 |
# Copyright 2012 Nebula, 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 agree... | ChinaMassClouds/copenstack-server | openstack/src/horizon-2014.2/horizon/browsers/breadcrumb.py | Python | gpl-2.0 | 1,803 | 0 |
# Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... | MSEMJEJME/Get-Dumped | renpy/display/im.py | Python | gpl-2.0 | 45,147 | 0.005759 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Criado em 19 de Novembro de 2016
@author: Denis Varise Bernardes & Eder Martioli
Descricao: esta biblioteca possui as seguintes funcoes:
mkDir_saveCombinedImages: pela chamada da funcao LeArquivoReturnLista retorna a lista de todas as imagens ad... | DBernardes/ProjetoECC | Eficiência_Quântica/Codigo/QE_reduceImgs_readArq.py | Python | mit | 7,313 | 0.012585 |
import os
from .PBX_Base_Reference import *
from ...Helpers import path_helper
class PBXLibraryReference(PBX_Base_Reference):
def __init__(self, lookup_func, dictionary, project, identifier):
super(PBXLibraryReference, self).__init__(lookup_func, dictionary, project, identifier);
| samdmarshall/xcparse | xcparse/Xcode/PBX/PBXLibraryReference.py | Python | bsd-3-clause | 307 | 0.019544 |
##############################################################################
# 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... | lgarren/spack | var/spack/repos/builtin/packages/fastqvalidator/package.py | Python | lgpl-2.1 | 2,230 | 0.000897 |
"""
WSGI config for server 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", "server.settings")
from django.core.wsg... | iscarecrow/sb | server/wsgi.py | Python | mit | 387 | 0.002584 |
00000 0 output/lattice.py.err
32074 1 output/lattice.py.out
| Conedy/Conedy | testing/createNetwork/expected/sum_lattice.py | Python | gpl-2.0 | 68 | 0 |
# -*- coding: utf-8 -*-
# Copyright 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 ... | anthonysandrin/kafka-utils | tests/kafka_cluster_manager/partition_count_balancer_test.py | Python | apache-2.0 | 26,033 | 0 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | annarev/tensorflow | tensorflow/python/ops/numpy_ops/integration_test/benchmarks/micro_benchmarks.py | Python | apache-2.0 | 5,557 | 0.007558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.