code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Argobots(AutotoolsPackage):
"""Argobots, which was developed as a part of the Argo project... | LLNL/spack | var/spack/repos/builtin/packages/argobots/package.py | Python | lgpl-2.1 | 3,177 |
from . import Model, CollectionModel
class Stat(Model):
"""
A Stat object model
"""
class MessagingStat(Stat):
"""
MessagingStat object model
.. attribute:: replyRate
.. attribute:: date
.. attribute:: deliveryRate
.. attribute:: costs
.. attribute:: messagesReceived
... | textmagic/textmagic-rest-python | textmagic/rest/models/stats.py | Python | mit | 2,255 |
# -*- coding: utf-8 -*-
"""
Unit tests for landlab.data_record.data_record.DataRecord
Dimension = time
Last updated 10/18/2018
"""
from landlab import RasterModelGrid
grid = RasterModelGrid((3, 3))
def test_dr_nodim_name(dr_nodim):
assert dr_nodim._name == "DataRecord"
| cmshobe/landlab | tests/data_record/test_data_record_nodim.py | Python | mit | 280 |
DEFAULT_DICT = \
[ "A", "ABE", "ACE", "ACT", "AD", "ADA", "ADD",
"AGO", "AID", "AIM", "AIR", "ALL", "ALP", "AM", "AMY",
"AN", "ANA", "AND", "ANN", "ANT", "ANY", "APE", "APS",
"APT", "ARC", "ARE", "ARK", "ARM", "ART", "AS", "ASH",
"ASK", "AT", "ATE... | mzdaniel/oh-mainline | vendor/packages/python-otp/otp/dict.py | Python | agpl-3.0 | 18,237 |
#!/usr/bin/python
#
# examples/security.py -- demonstrate the SECURITY extension
#
# Copyright (C) 2011 Outpost Embedded, LLC
# Forest Bond <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | alexer/python-xlib | examples/security.py | Python | gpl-2.0 | 2,717 |
import logging, os, marshal, json, cPickle, time, copy, time, datetime, re, urllib, httplib
from base64 import b64encode, b64decode
from lib.crypt import encrypt, decrypt
from uuid import uuid4
from node import Node, InvalidIdentity
class FriendNode(Node):
def __init__(self, *args, **kwargs):
... | pdxwebdev/yadapy | yadapy/friendnode.py | Python | gpl-3.0 | 3,507 |
import threading
import wx
import logging
from StringIO import StringIO
import HTMLParser
import os
import time
import subprocess
import sys
import requests
from logger.SubmitDebugReportDialog import SubmitDebugReportDialog
class Logger():
def __init__(self, name):
self.name = name
self.transport_... | CVL-dev/cvl-fabric-launcher | logger/Logger.py | Python | gpl-3.0 | 7,832 |
import numpy as np
import pandas as pd
import pytest
from .const import RANDOM_SEED, TARGET_COL
N_CATEGORY = 50
N_OBS = 10000
N_CAT_FEATURE = 10
N_NUM_FEATURE = 5
@pytest.fixture(scope="module")
def generate_data():
generated = False
def _generate_data():
if not generated:
assert N_C... | jeongyoonlee/Kaggler | tests/conftest.py | Python | mit | 1,121 |
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | intel-analytics/BigDL | python/chronos/test/bigdl/chronos/data/utils/test_roll_dataset.py | Python | apache-2.0 | 4,626 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import pandas
from sklearn import metrics
import tensorflow as tf
from tensorflow.contrib.layers.python.layers import encoders
from tensorflow.python.ops import nn
import setting
learn = tf... | sunmont/textclassifier | bow.py | Python | apache-2.0 | 2,357 |
#!/usr/bin/env python
# -*- coding: latin-1; py-indent-offset:4 -*-
################################################################################
#
# This file is part of Bfplusplus
#
# Bfplusplus is a graphical interface to the Betfair Betting Exchange
# Copyright (C) 2010 Daniel Rodriguez (aka Daniel Rodriksson)
... | mementum/bfplusplus | bfplusplus/guimods/mainframe/profitandloss.py | Python | gpl-3.0 | 7,203 |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
from pandas.core.arrays import (DatetimeArrayMixin,
TimedeltaArrayMixin,
PeriodArray)
# TODO: more freq variants
@pytest.fixture(params=['D', ... | amolkahat/pandas | pandas/tests/arrays/test_datetimelike.py | Python | bsd-3-clause | 7,938 |
import sys
import urllib
import json
import requests
class BingApiResult():
def __init__(self, json_result):
self.response = json.loads(json_result)['SearchResponse']['Web']
self.total = self.response['Total']
def find_libraries(self):
libraries = []
return self.r... | bluestemscott/librarygadget | librarygadget/librarybot/findlibraries/bing_finder.py | Python | mit | 1,859 |
#!/usr/bin/env python
# #
# Copyright 2009-2015 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://vscentrum.be/nl/en),
# the H... | torbjoernk/easybuild-framework | easybuild/main.py | Python | gpl-2.0 | 15,854 |
# -*- coding: utf-8 -*-
__params__ = {'la': 33, 'lb': 33, 'dima': 10, 'dimb': 10}
def protocol(client, server, params):
la = params['la']
lb = params['lb']
client.a = Signed(bitlen=la).input(src=driver, desc="a")
server.b = Signed(bitlen=lb).input(src=driver, desc="b")
client.ga = Garbled(val=cl... | tastyproject/tasty | tasty/tests/functional/protocols/conversions/signed-garbled-signed-client/protocol.py | Python | gpl-3.0 | 781 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# read data
#
reader ... | hlzz/dotfiles | graphics/VTK-7.0.0/IO/EnSight/Testing/Python/EnSightOfficeBin.py | Python | bsd-3-clause | 2,148 |
from .fft_tools import zoom
import numpy as np
import matplotlib.pyplot as pl
def iterative_zoom(image, mindiff=1., zoomshape=[10,10],
return_zoomed=False, zoomstep=2, verbose=False,
minmax=np.min, ploteach=False, return_center=True):
"""
Iteratively zoom in on the *minimum* position in an imag... | keflavich/image_registration | image_registration/iterative_zoom.py | Python | mit | 8,555 |
# -*- coding: utf-8 -*-
"""
addonpr config module
Copyright (C) 2012-2013 Team XBMC
http://www.xbmc.org
This Program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (a... | beenje/addon-pr | addonpr/config.py | Python | gpl-2.0 | 1,507 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-21 01:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("planner", "0013_auto_20170220_2045")]
operations = [
migrations.AddField(
mo... | mblayman/lcp | conductor/planner/migrations/0014_school_audit_notes.py | Python | bsd-2-clause | 561 |
"""
Course Outline page in Studio.
"""
import datetime
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from ..common.utils import click_css, confirm_prompt
from .course_page import ... | iivic/BoiseStateX | common/test/acceptance/pages/studio/overview.py | Python | agpl-3.0 | 27,908 |
"""This is a backport of shutil.get_terminal_size from Python 3.3.
The original implementation is in C, but here we use the ctypes and
fcntl modules to create a pure Python version of os.get_terminal_size.
"""
import os
import struct
import sys
from collections import namedtuple
__all__ = ["get_terminal_size"]
te... | vicky2135/lucious | oscar/lib/python2.7/site-packages/shutil_backports/get_terminal_size.py | Python | bsd-3-clause | 2,867 |
"""
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
from fabric.api import local, cd, env
from fabric.co... | Perkville/django-cache-machine | fabfile.py | Python | bsd-3-clause | 1,331 |
# This file is part of cldoc. cldoc 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 even the ... | kostyll/cldoc | cldoc/struct.py | Python | gpl-2.0 | 1,364 |
from django.contrib import admin
from django.forms import ModelForm
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin
from pagedown.widgets import Pag... | portnov/assethub | assethub/assets/admin.py | Python | bsd-3-clause | 1,916 |
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | informatik-mannheim/Moduro-CC3D | Simulation/ModuroModel/Sd/SdCdbPcdiInDa.py | Python | apache-2.0 | 1,535 |
# coding: utf-8
#!/usr/bin/python2.4
#
# Small script to show PostgreSQL and Pyscopg together
#
# https://wiki.postgresql.org/wiki/Psycopg2_Tutorial
#
# Notes:
# с транзакциями не так то просто. http://initd.org/psycopg/docs/connection.html#connection.autocommit
# http://stackoverflow.com/questions/5402805/error-when-... | zaqwes8811/coordinator-tasks | projects/python-desk/python_pq_bridge/driver_test.py | Python | apache-2.0 | 2,680 |
import formencode
__author__ = 'Chirag Mistry (Tessella)'
class UpdateUserForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
first_name = formencode.validators.String(not_empty=True, max=50)
last_name = formencode.validators.String(not_empty=True, max=50)
email = for... | NERC-CEH/ecomaps | ecomaps/model/create_new_user_form.py | Python | gpl-2.0 | 639 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2021 RERO
# Copyright (C) 2020 UCLouvain
#
# 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, version 3 of the License.
#
# This program ... | rero/reroils-app | rero_ils/modules/cli/reroils.py | Python | gpl-2.0 | 1,605 |
# 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 t... | ikargis/horizon_fod | openstack_dashboard/dashboards/admin/flavors/extras/tests.py | Python | apache-2.0 | 3,001 |
from io import BytesIO
import os
import zipfile
from django import forms
from django.contrib import messages
from django.db.models import Q
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy, ugettext as _
from towel impo... | matthiask/feincms-photos | photos/views.py | Python | bsd-3-clause | 3,759 |
# -*- coding: utf-8 -*-
# Generated from the Telepathy spec
"""Copyright © 2008-2009 Collabora Ltd.
Copyright © 2008-2009 Nokia Corporation
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 ... | epage/The-One-Ring | src/tp/_generated/Channel_Dispatcher.py | Python | lgpl-2.1 | 6,256 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: mac_latin2.py
""" Python Character Mapping Codec generated from 'LATIN2.TXT' with gencodec.py.
Written by Marc-Andre Lemburg ([email protected]).
(c)... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/mac_latin2.py | Python | unlicense | 3,180 |
#!/usr/bin/env python
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
d = generate_distutils_setup(
packages = ['ros_qml'],
package_dir = {'': 'src'},
scripts = ['sc... | bgromov/ros_qml | setup.py | Python | bsd-3-clause | 414 |
from flowp.testing import Behavior, expect, only, skip
from flowp import testing
from unittest import mock
import flowp.testing.dummy
import tempfile
import os
expect_alias = expect
class Expect(Behavior):
class ToBeMethod(Behavior):
def it_should_do_true_assets(self):
expect(True).to_be(True... | localmed/flowp | spec/spec_testing.py | Python | bsd-3-clause | 13,328 |
# 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 use ... | andrewsomething/libcloud | libcloud/compute/deployment.py | Python | apache-2.0 | 11,416 |
from os.path import join, dirname
dest = join(dirname(__file__), '../_static/generated')
from pystacia import lena
image = lena(128)
image.gamma(0.1)
image.write(join(dest, 'lena_gamma0.1.jpg'))
image.close()
image = lena(128)
image.gamma(0.3)
image.write(join(dest, 'lena_gamma0.3.jpg'))
image.close()
image = lena... | squeaky-pl/pystacia | doc/source/image/gamma.py | Python | mit | 588 |
import numpy as np
import npp
from itertools import combinations, chain
def make_data(N_R, N_P, P_parts, M, true_variances, noise_variance, combs, Pnoise_models,
P_models, use_mixing=True, orthogonalize=True, noise_scale=1.0, **etc):
# Generate timecourses for each partition
X_parts = [np.random... | alexhuth/n4cs-fa2017 | homeworks/homework_2/homework_2_utils.py | Python | gpl-3.0 | 2,791 |
'''
(Double) Deep Q-Learning Algorithm Implementation
Supports double deep Q-learning with on either GPU and CPU
'''
import numpy as np
import pickle # used to save the nets
from copy import deepcopy
class DQNLearner(object):
def __init__(self, settings, backend):
"""
Functions that must be def... | sisl/Chimp | chimp/learners/dqn_learner.py | Python | apache-2.0 | 3,187 |
#!/bin/python
import unittest
import logging
import os
from src.db_client import db_client
from src.channel import channel
from src.user_state import user_state
from src.message import message
from src.contact import contact
from src.config import config
class db_client_test(unittest.TestCase):
def test_init(self... | gavincyi/Telex | test/db_client_test.py | Python | apache-2.0 | 8,050 |
# Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <[email protected]>
#
# 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
#
# ... | yongshengwang/hue | build/env/lib/python2.7/site-packages/windmill-1.3-py2.7.egg/windmill/bin/admin_lib.py | Python | apache-2.0 | 13,002 |
import sounderinterface
import subprocess
@sounderinterface.register
class LinuxSounder(sounderinterface.SounderInterface):
osname='posix'
def __init__(self):
self.lastsound = None
def play(self,soundfile):
"""play a soundfile and return immediately"""
self.stop()
self.la... | BackupTheBerlios/intertrain | lib/plat/posix_sounder.py | Python | gpl-3.0 | 642 |
#!/usr/bin/env vpython3
# Copyright 2016 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 collections
import contextlib
import datetime
import json
import time
# Mutates sys.path.
import test_env
from ut... | endlessm/chromium-browser | tools/swarming_client/tests/auth_test.py | Python | bsd-3-clause | 3,933 |
from django.test import TestCase, Client
from django.conf import settings
from django.db import IntegrityError
from django.contrib.auth.models import User
from api.models import Project, Task, Resource
from tokenauth.authbackends import TokenAuthBackend
from datetime import date
import requests
import responses
imp... | TangentMicroServices/ProjectService | api/tests/tests.py | Python | gpl-2.0 | 6,753 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
class BlogPost(models.Model):
author = models.ForeignKey(User)
title = models.CharField(max_length=50)
timestamp = models.DateTimeField()
body = models.TextField()
summary = models... | dellsystem/wikinotes | blog/models.py | Python | gpl-3.0 | 888 |
import os
# <ref>
| siosio/intellij-community | python/testData/resolve/multiFile/relativeAndSameDirectoryImports/python2OrdinaryPackageImportPrioritizeSameDirectoryModuleOverSdk/ordinaryPackage/script.py | Python | apache-2.0 | 24 |
# -*- coding: utf-8 -*-
import json
import os
import platform
import sys
def format_full_version(info):
version = "{0.major}.{0.minor}.{0.micro}".format(info)
kind = info.releaselevel
if kind != "final":
version += kind[0] + str(info.serial)
return version
# Support for 508's implementation_... | kennethreitz/pipenv | pipenv/pep508checker.py | Python | mit | 1,220 |
'''
Integration test for testing power off mini hosts.
#1.operations & power off random hosts
#2.start hosts
#3.duplicated operation
@author: zhaohao.chen
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker... | zstackio/zstack-woodpecker | integrationtest/vm/mini/poweroff/test_poweroff_host_migrate.py | Python | apache-2.0 | 3,539 |
#!/usr/bin/env python
"""
Calculate entropies of each leaf on each branch node of a tree for each column
Usage:
entropy.py -a ali.s9t100.fa -n gpcrdb_gapped_tm_numbering.csv -t ali.s9t100.ph > ali.s9t100.entropies
"""
import argparse
import collections
import logging
import math
from Bio import Phylo, AlignIO
im... | 3D-e-Chem/snooker-alignment | scripts/entropy.py | Python | apache-2.0 | 4,710 |
from prompt_toolkit.shortcuts import prompt
from prompt_toolkit.styles import style_from_dict
from prompt_toolkit.token import Token
from prompt_toolkit.validation import Validator, ValidationError
class _OptionValidator(Validator):
def __init__(self, options, default):
super().__init__()
self.opti... | tmearnest/sbd | pdfs/Prompt.py | Python | mit | 2,116 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UserscloudCom(SimpleHoster):
__name__ = "UserscloudCom"
__type__ = "hoster"
__version__ = "0.01"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?userscloud\.com... | ace02000/pyload | module/plugins/hoster/UserscloudCom.py | Python | gpl-3.0 | 1,042 |
# -*- coding: utf-8 -*-
# Copyright 2021 OpenSynergy Indonesia
# Copyright 2021 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
| open-synergy/opnsynid-partner-contact | partner_contact_age/__init__.py | Python | agpl-3.0 | 196 |
"""
SASNets main file. Contains the main neural network code used for training
networks.
SASNets uses Keras and Tensorflow for the networks. You can change the backend
to Theano or CNTK through the Keras config file.
"""
# System imports
import argparse
import logging
import os
import sys
import time
import random
imp... | scattering/sasnets | sasnets/sasnet.py | Python | bsd-3-clause | 13,191 |
import collections
import ipaddress
from visidata import VisiData, vd, Sheet, options, Column, asyncthread, Progress, TsvSheet, getattrdeep, ColumnAttr, date, vlen, filesize
vd.option('pcap_internet', 'n', '(y/s/n) if save_dot includes all internet hosts separately (y), combined (s), or does not include the internet ... | saulpw/visidata | visidata/loaders/pcap.py | Python | gpl-3.0 | 14,150 |
AR = '/usr/bin/ar'
ARFLAGS = 'rcs'
CCFLAGS = ['-g']
CCFLAGS_MACBUNDLE = ['-fPIC']
CCFLAGS_NODE = ['-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64']
CC_VERSION = ('4', '6', '1')
COMPILER_CXX = 'g++'
CPP = '/usr/bin/cpp'
CPPFLAGS_NODE = ['-D_GNU_SOURCE']
CPPPATH_NODE = '/usr/local/include/node'
CPPPATH_ST = '-I%s'
CXX = [... | tparisi/Skybox | service/node_modules/faye/node_modules/hiredis/build/c4che/Release.cache.py | Python | mit | 1,461 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 opt... | sputnick-dev/weboob | modules/bp/pages/pro.py | Python | agpl-3.0 | 3,390 |
#!/usr/bin/env python
testdat = '../data/fm_train_real.dat'
traindat = '../data/fm_test_real.dat'
parameter_list=[[traindat,testdat,1.7],[traindat,testdat,1.8]]
def kernel_distance (train_fname=traindat,test_fname=testdat,width=1.7):
from shogun import RealFeatures, DistanceKernel, EuclideanDistance, CSVFile
feats... | OXPHOS/shogun | examples/undocumented/python/kernel_distance.py | Python | gpl-3.0 | 730 |
"""training_feedback URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
C... | mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.06 - Web Development/code/django/training/training/urls.py | Python | gpl-3.0 | 860 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | maoy/zknova | nova/api/openstack/compute/contrib/simple_tenant_usage.py | Python | apache-2.0 | 10,487 |
from . import repo
from . import issues
from . import comments
from . import hooks
from . import wiki
| alphagov/ghtools | ghtools/migrators/__init__.py | Python | mit | 102 |
import os
import subprocess
import pandas as pd
import numpy as np
from pathlib import Path
from subprocess import call, STDOUT
from .. import utils
from .. import printer
def extractLineFromROutput(output, key):
i = output.rfind(key)
return (output[i + len(key) + 1:].split("\n")[0]).split(" ")[1].strip()
de... | iwob/evoplotter | evoplotter/stats/nonparametric.py | Python | mit | 5,964 |
# Imports environment-specific settings.
import os
import sys
try:
from colorama import init as colorama_init
except ImportError:
def colorama_init(autoreset=False, convert=None, strip=None, wrap=True):
"""
Fallback function that initializes colorama.
"""
pass
try:
from t... | django-settings/django-settings | myproject/myproject/user_settings.py | Python | unlicense | 2,239 |
# $Id: benchmark.py 2923 2006-11-19 08:05:45Z fredrik $
# simple elementtree benchmark program
from elementtree import ElementTree, XMLTreeBuilder
try:
import cElementTree
except ImportError:
try:
from xml.etree import cElementTree
except ImportError:
cElementTree = None
try:
... | prats226/python-amazon-product-api-0.2.8 | tests/build/elementtree/benchmark.py | Python | bsd-3-clause | 2,170 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This module provides affiliations of the current user
"""
import logging
import traceback
from myuw.dao import log_err
from myuw.dao.exceptions import IndeterminateCampusException
from myuw.dao.enrollment import (
get_main_... | uw-it-aca/myuw | myuw/dao/affiliation.py | Python | apache-2.0 | 7,365 |
# Python 3 Spelling Corrector
#
# Copyright 2014 Jonas McCallum.
# Updated for Python 3, based on Peter Norvig's
# 2007 version: http://norvig.com/spell-correct.html
#
# Open source, MIT license
# http://www.opensource.org/licenses/mit-license.php
"""
File reader, concat function and dict wrapper
Author: Jonas McCallu... | phatpiglet/autocorrect | autocorrect/utils.py | Python | mit | 1,509 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
#
# ... | neumerance/deploy | horizon/templatetags/horizon.py | Python | apache-2.0 | 4,298 |
from pandas import Series, DataFrame
import os, json, common
"""
Iterate though the json data files, save the results and times for each prover.
Add these to the goal syntax metrics and save as a csv file for later.
Andrew Healy, Aug. 2016
"""
provers = common.PROVERS
here = os.getcwd()
folders = sorted([f for f ... | ahealy19/F-IDE-2016 | create_stats_df.py | Python | apache-2.0 | 1,333 |
from django.shortcuts import render
### Rest API setup
import rest_framework.routers
import rest_framework.viewsets
import rest_framework.filters
from voxel_globe.websockets.serializers import LogMessageSerializer
from voxel_globe.websockets.models import LogMessage
router = rest_framework.routers.DefaultRouter()
cl... | ngageoint/voxel-globe | voxel_globe/websockets/views.py | Python | mit | 705 |
"""Definition of metrics we care about.
"""
from collections import defaultdict
from statistics import mean, median
from datetime import timedelta, time, datetime
from django.utils import timezone
from monitoring.models import Metric
from learn.models import Action, Task, TaskSession
def get_last_measured_date():
... | adaptive-learning/robomission | backend/monitoring/metrics.py | Python | gpl-3.0 | 7,312 |
import six
from six import StringIO
from six.moves import configparser
from bamp.config.bumpversion import config_dump
def make_config(content):
config = configparser.ConfigParser()
input_file = StringIO(content)
if six.PY2:
config.readfp(input_file)
else:
config.read_file(input_file)... | inirudebwoy/bamp | tests/test_bumpversion_config.py | Python | mit | 1,259 |
""" BasePlugin definitions. """
import logging
import threading
import traceback
import os
import queue
from sjutils import threadpool
class BasePluginError(Exception):
"""Raised by BasePlugin."""
def __init__(self, error):
"""Init method."""
Exception.__init__(self, error)
class BasePlugi... | SmartJog/spvd | share/baseplugin.py | Python | lgpl-2.1 | 11,049 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This plugin fix problem described in
http://forum.ispsystem.com/ru/showthread.php?t=24014
There is a bug in ISPmanager with scheme
where nginx and apache+itk is used.
Private directories are not accesible
because config files passwd and .htaccess are
created with wrong ... | scopenco/isp-plugin-diraccess | addon/diraccess_fix_perms.py | Python | bsd-3-clause | 4,929 |
# cython: linetrace=True
import struct
import typing
rtphdr = struct.Struct('!HHII')
rtpevent = struct.Struct('!BBH')
class RTP(typing.NamedTuple):
version: int = 2
padding: bool = 0
ext: int = 0
csrc_items: int = 0
marker: bool = 0
p_type: int = 0
seq: int = 0
timestamp: int = 0
... | vodik/aiortp | aiortp/packet.py | Python | apache-2.0 | 1,959 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Sketches/MPS/HTTP/demo_http.py | Python | apache-2.0 | 3,182 |
# -*- coding: utf-8 -*-
from pyload.plugin.OCR import OCR
class ShareonlineBiz(OCR):
__name = "ShareonlineBiz"
__type = "ocr"
__version = "0.11"
__description = """Shareonline.biz ocr plugin"""
__license = "GPLv3"
__authors = [("RaNaN", "[email protected]")]
def __init__(s... | ardi69/pyload-0.4.10 | pyload/plugin/ocr/ShareonlineBiz.py | Python | gpl-3.0 | 917 |
'''
Generic message-based protocol used by Bitcoin and P2Pool for P2P communication
'''
import hashlib
import struct
from twisted.internet import protocol
from twisted.python import log
import p2pool
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import datachunker, variable
class TooLong(Exceptio... | GroestlCoin/p2pool-grs | p2pool/util/p2protocol.py | Python | gpl-3.0 | 4,140 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#######################################################
'''
original Created on Mar 15, 2011
'''
import tags as NMhtml
tagOld=NMhtml.tag
cssConditional="""
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html cl... | nickmilon/milonpy | milonpy/html_gen/page2011.py | Python | apache-2.0 | 10,463 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djing.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bashmak/djing | manage.py | Python | unlicense | 249 |
from webapp2_extras.appengine.auth.models import User
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
upload_url = blobstore.create_upload_url('/upload')
class User(User):
"""
Universal user model. Can be used with App Engine's default users API,
own auth or third party aut... | skumar07/Air-Share-Real | boilerplate/models.py | Python | lgpl-3.0 | 5,595 |
# Copyright (c) OpenMMLab. All rights reserved.
# flake8: noqa
import warnings
from .formatting import *
warnings.warn('DeprecationWarning: mmdet.datasets.pipelines.formating will be '
'deprecated, please replace it with '
'mmdet.datasets.pipelines.formatting.')
| open-mmlab/mmdetection | mmdet/datasets/pipelines/formating.py | Python | apache-2.0 | 293 |
# Copyright 2014 Cisco Systems, Inc.
# 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... | nuagenetworks/tempest | tempest/scenario/test_network_v6.py | Python | apache-2.0 | 10,197 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# audiodiskitem.py - Item for CD Audio Disks
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# Todo:
#
# --------------------------------------------------------------------... | freevo/freevo1 | src/audio/audiodiskitem.py | Python | gpl-2.0 | 4,512 |
# redminehelper: Redmine helper extension for Mercurial
#
# Copyright 2010 Alessio Franceschelli (alefranz.net)
# Copyright 2010-2011 Yuya Nishihara <[email protected]>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""helper commands... | sonico999/redmine-heroku | lib/redmine/scm/adapters/mercurial/redminehelper.py | Python | gpl-2.0 | 7,991 |
# Copyright © 2017 Lucas Hoffmann
# Copyright © 2018 Dylan Baker
#
# 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.
#
# T... | MacGyverNL/alot | tests/db/test_envelope.py | Python | gpl-3.0 | 3,652 |
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
__version__ = '0.24.0'
__version_info__ = (0, 24, 0)
| ctrlaltdel/neutrinator | vendor/asn1crypto/version.py | Python | gpl-3.0 | 154 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | mojwang/selenium | py/test/selenium/webdriver/common/click_scrolling_tests.py | Python | apache-2.0 | 7,393 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Jonathan Schultz
#
# 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 lat... | BarraQDA/twitterScrape | twitterScrape/twitterUserHydrate.py | Python | gpl-3.0 | 8,576 |
"""
The following functions provide a set of utilities for working with `Dependent`
and collections of `Dependent`.
* :func:`~revscoring.dependencies.solve` provides basic dependency solving
* :func:`~revscoring.dependencies.expand` provides minimal expansion of
dependency trees
* :func:`~revscoring.dependencies.dig... | wiki-ai/revscoring | revscoring/dependencies/functions.py | Python | mit | 10,779 |
# -*- coding: utf-8 -*-
""" Sahana Eden Setup Model
@copyright: 2015 (c) Sahana Software Foundation
@license: MIT
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 w... | gallifrey17/eden | modules/s3db/setup.py | Python | mit | 39,483 |
import _plotly_utils.basevalidators
class ValuessrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="valuessrc", parent_name="funnelarea", **kwargs):
super(ValuessrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/funnelarea/_valuessrc.py | Python | mit | 402 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/operations/_azure_firewalls_operations.py | Python | mit | 27,002 |
"""
Copyright (c) 2002 Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and t... | nmc-probe/emulab-nome | tbsetup/plab/libdslice/dslice/nodemgrproxy.py | Python | agpl-3.0 | 5,675 |
# Copyright 2017 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... | eadgarchen/tensorflow | tensorflow/compiler/tests/xla_test.py | Python | apache-2.0 | 9,399 |
# Copyright 2013 Donald Stufft
#
# 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, so... | mattrobenolt/warehouse | warehouse/__about__.tmpl.py | Python | apache-2.0 | 1,202 |
import simulation
import network
import power_distribution
import matplotlib.pyplot as plt
import numpy as np
import nodes
from matplotlib import cm
import background_visualisation
import node_visualisation_interpreters
import edge_visualisation_interpreters
import visualisation
hardGenNetwork = network.Network(network... | ABM-project/power-grid | power_grid/TestCases.py | Python | mit | 2,145 |
import batoid
import numpy as np
from test_helpers import timer, do_pickle, all_obj_diff, init_gpu, rays_allclose
@timer
def test_properties():
rng = np.random.default_rng(5)
for i in range(100):
R = rng.normal(0.0, 0.3) # negative allowed
sphere = batoid.Sphere(R)
assert sphere.R == ... | jmeyers314/batoid | tests/test_Sphere.py | Python | bsd-2-clause | 7,740 |
from matplotlib import pyplot as plt
from calculations import calculate_slope_and_intercept, calculate_error
from ..data import get_random_epoch
def launch():
x, y = get_random_epoch()
m, b = calculate_slope_and_intercept(x, y)
y_hats = [b + (val * m) for val in x]
print 'calculated slope: ' + str(... | DanielDeychakiwsky/python-machine-learning | src/linear_regression/ordinary_least_squares/launch.py | Python | mit | 660 |
from collections import deque
import datetime
import os
import re
import sys
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.conf import settings
from django.utils import importlib
from south import exceptions
from south.migration.utils import depends, dfs, flatten, ge... | edisonlz/fruit | web_project/base/site-packages/south/migration/base.py | Python | apache-2.0 | 16,120 |
# Copyright 2013 Huang Ying <[email protected]>
#
# 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.
import sys... | hying-caritas/ibutils | ibutils/imb/to_pdf.py | Python | gpl-2.0 | 1,161 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | addition-it-solutions/project-all | addons/product_margin/__init__.py | Python | agpl-3.0 | 1,024 |
class Foo:
class Bar:
def __init__(self):
print("__init__ from Bar")
def __init__(self):
print("__init__ from Foo")
Foo.Bar()
Foo()
Foo.Bar() | NeonMercury/python-lua | tests/nestedclass.py | Python | apache-2.0 | 191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.