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 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... | keras-team/keras | keras/layers/preprocessing/benchmarks/hashed_crossing_benchmark.py | Python | apache-2.0 | 2,754 |
from os.path import join
from tempfile import mkdtemp
import unittest
from shutil import rmtree
import pandas as pd
from feagen.data_wrappers.pandas_hdf import get_shape_from_pandas_hdf_storer
class Test(unittest.TestCase):
def setUp(self):
self.test_output_dir = mkdtemp(prefix="feagen_test_output_")
... | ianlini/feagen | feagen/data_wrappers/tests/test_pandas_hdf.py | Python | bsd-2-clause | 4,476 |
# -*- coding: utf-8 -*-
import pytest
import pandas as pd
import warnings
class TestConfig(object):
@classmethod
def setup_class(cls):
from copy import deepcopy
cls.cf = pd.core.config
cls.gc = deepcopy(getattr(cls.cf, '_global_config'))
cls.do = deepcopy(getattr(cls.cf, '_... | louispotok/pandas | pandas/tests/test_config.py | Python | bsd-3-clause | 16,237 |
# 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 AtomDft(MakefilePackage):
"""ATOM is a program for DFT calculations in atoms and pseudopot... | LLNL/spack | var/spack/repos/builtin/packages/atom-dft/package.py | Python | lgpl-2.1 | 1,050 |
# -*- coding: utf-8 -*-
""" S3 SQL Forms
@copyright: 2012-15 (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
restrict... | anurag-ks/eden | modules/s3/s3forms.py | Python | mit | 156,053 |
from django.conf.urls import patterns, url, include
from dashboard import views
urlpatterns = patterns('',
url(r'^', views.index, name='index'),
)
| jcfausto/django-ionic-dashboard | dashboard/urls.py | Python | mit | 157 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2017-09-12
git sha ... | lcoandrade/DsgTools | gui/CustomWidgets/BasicInterfaceWidgets/shortcutChooserWidget.py | Python | gpl-2.0 | 5,522 |
from . import unittest
from shapely.geometry.base import BaseGeometry, EmptyGeometry
import shapely.geometry as sgeom
from shapely.geometry.polygon import LinearRing
empty_generator = lambda: iter([])
class EmptinessTestCase(unittest.TestCase):
def test_empty_class(self):
g = EmptyGeometry()
self... | jdmcbr/Shapely | tests/test_emptiness.py | Python | bsd-3-clause | 2,120 |
# Copyright 2014 The Oppia 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 applicable ... | anggorodewanto/oppia | core/controllers/feedback.py | Python | apache-2.0 | 7,540 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import setuptools
import sys
from distutils.version import StrictVersion
version_file_path = os.path.join(
os.path.dirname(__file__),
'abjad',
'_version.py'
)
with open(version_file_path, 'r') as file_pointer:
file_contents_string = file_poi... | andrewyoung1991/abjad | setup.py | Python | gpl-3.0 | 2,910 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | MarkusTeufelberger/openobject-server | openerp/tools/misc.py | Python | agpl-3.0 | 39,743 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Justin Santa Barbara
# 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... | salv-orlando/MyRepo | nova/api/openstack/extensions.py | Python | apache-2.0 | 17,647 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_professional/specialty/__init__.py | Python | agpl-3.0 | 1,438 |
# Copyright 2013-2020 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 Zfs(AutotoolsPackage):
"""OpenZFS is an advanced file system and volume manager which was
... | iulian787/spack | var/spack/repos/builtin/packages/zfs/package.py | Python | lgpl-2.1 | 1,214 |
# -*- coding: utf-8 -*-
import requests
import lxml
from lxml import html
main_url = "http://www.skoob.com.br"
def books_for_author(url=None):
"return the books of a given author"
print "acessing: %s" % url
books_found = []
r = requests.get(url)
root = lxml.html.fromstring(r.content)
... | arruda/rmr | rmr/scripts/skoob_crawler.py | Python | mit | 1,068 |
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. 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 Foundation; version 2 of the License.
#
# This program is distributed in th... | mysql/mysql-utilities | mysql-test/suite/performance/t/copy_db_multithreaded.py | Python | gpl-2.0 | 3,191 |
# Date: Friday 02 June 2017 05:04:00 PM IST
# Email: nrupatunga@whodat.com
# Name: Nrupatunga
# Description: Basic regressor function implemented
from __future__ import print_function
import os
import glob
import numpy as np
import sys
import cv2
from ..helper import config
sys.path.insert(0, config.CAFFE_PATH)
impor... | nrupatunga/PY-GOTURN | goturn/network/regressor.py | Python | mit | 5,623 |
#
# 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 us... | herval/zeppelin | spark/interpreter/src/main/resources/python/zeppelin_pyspark.py | Python | apache-2.0 | 2,494 |
from flask import Flask, render_template, request, redirect, url_for, jsonify
app = Flask(__name__)
shopping_list = ['Milk', 'Eggs', 'Bread', 'Butter']
@app.route('/', methods=['GET', 'POST', 'DELETE'])
def index():
global shopping_list
if request.method == 'POST':
shopping_list.append(request.form[... | eschleicher/flask_shopping_list | shopping.py | Python | mit | 744 |
from copy import deepcopy
from itertools import dropwhile
import logging
from regparser.notice.diff import DesignateAmendment
from regparser.tree.struct import Node
from regparser.tree.xml_parser.appendices import process_appendix
def _is_appendix_amend(al):
"""Serves as a guard/filter to distinguish appendix am... | willbarton/regulations-parser | regparser/notice/build_appendix.py | Python | cc0-1.0 | 2,341 |
"""
Has the built-in activation functions,
code for using them,
and code for adding new user-defined ones
"""
from __future__ import division
import math
import types
def sigmoid_activation(z):
z = max(-60.0, min(60.0, 5.0 * z))
return 1.0 / (1.0 + math.exp(-z))
def tanh_activation(z):
z = max(-60.0, mi... | drallensmith/neat-python | neat/activations.py | Python | bsd-3-clause | 3,053 |
# -*- coding: utf-8 -*-
import json
import os
from listenbrainz.db.model.feedback import Feedback
import listenbrainz.db.feedback as db_feedback
import listenbrainz.db.user as db_user
from listenbrainz.db.testing import DatabaseTestCase
class FeedbackDatabaseTestCase(DatabaseTestCase):
def setUp(self):
... | Freso/listenbrainz-server | listenbrainz/db/tests/test_feedback.py | Python | gpl-2.0 | 9,691 |
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path
from django_th.forms.wizard import DummyForm, ProviderForm, ConsumerForm, ServicesDescriptionForm
from django_th.views import Tri... | foxmask/django-th | django_th/urls.py | Python | bsd-3-clause | 6,183 |
import os
from flask import Flask, render_template_string, request
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
from flask_user import login_required, SQLAlchemyAdapter, UserManager, UserMixin
from flask_user import roles_required
# Use a Class-based config to avoid needing a 2nd file
# os.gete... | jamescarignan/Flask-User | example_apps/user_auth_app.py | Python | bsd-2-clause | 6,986 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id$
import sys, select, time
import pycurl
c1 = pycurl.Curl()
c2 = pycurl.Curl()
c3 = pycurl.Curl()
c1.setopt(c1.URL, "http://www.python.org")
c2.setopt(c2.URL, "http://curl.haxx.se")
c3.setopt(c3.URL, "http://slashdot.org")
c1.body = open("doc1", "w... | ashumkin/pycurl-cvs | tests/test_multi6.py | Python | lgpl-2.1 | 1,480 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
import time
import threading
import os
from .serverCommunication import ServerCommunication
# this clas... | sqall01/alertR | shared_code/clients_all/lib/client/receiver.py | Python | agpl-3.0 | 1,160 |
import logging
import logging.config
# TODO: add rotate file log
DEFAULT_CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '[%(levelname)s] %(asctime)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
}
},
'handlers': {
'console': {
... | invinst/ResponseBot | responsebot/utils/log_utils.py | Python | apache-2.0 | 626 |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... | startcode/apollo | modules/tools/map_gen/map_gen_two_lanes_right_ext.py | Python | apache-2.0 | 8,664 |
"""Class that holds static constants for LTM server scripts."""
import os
class LTM(object):
server_log_file = '/var/log/lgtm/lgtm.log'
test_log_dir = '/var/log/lgtm/ltm_logs/'
ltm_username = 'ltm'
@staticmethod
def create_log_dir(log_file_path):
if not os.path.exists(os.path.dirname(log_file_path)):
... | dmonakhov/xfstests-bld | kvm-xfstests/test-appliance/files/usr/local/lib/gce-ltm/ltm.py | Python | gpl-2.0 | 423 |
from pathod import pathoc_cmdline as cmdline
import tutils
from six.moves import cStringIO as StringIO
import mock
@mock.patch("argparse.ArgumentParser.error")
def test_pathoc(perror):
assert cmdline.args_pathoc(["pathoc", "foo.com", "get:/"])
s = StringIO()
with tutils.raises(SystemExit):
cmdline... | tdickers/mitmproxy | test/pathod/test_pathoc_cmdline.py | Python | mit | 1,841 |
#globalP.py
#GENERAL PARAMETERS
Filename = "DCamSeq"
N = 100 # Training queue
imageSize = (480,640)
#DEBUG PARAMETERS
evalOne = True #Only evaluates first image before training
createKernelFile = False
debug = False # creates random kernel visualization images
debugAll = -3 # if 0 only create background, el... | bmalcover/npbg | globalP.py | Python | apache-2.0 | 345 |
lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"name": "Tyler",
"homework":... | orwa1902/code-exemples | class-managment.py | Python | apache-2.0 | 1,457 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is the module where the main solver object for the
nonlinear solver of bolt is defined. This solver object
stores the details of the system defined under physical_system,
and is evolved using the methods of this module.
The solver has the option of using 2 dif... | ShyamSS-95/Bolt | bolt/lib/nonlinear/nonlinear_solver.py | Python | gpl-3.0 | 29,921 |
# Copyright 2019 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... | davidzchen/tensorflow | tensorflow/python/keras/distribute/multi_worker_callback_tf2_test.py | Python | apache-2.0 | 14,004 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Sylvain Afchain <sylvain.afchain@enovance.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.apach... | netscaler/neutron | neutron/services/metering/drivers/iptables/iptables_driver.py | Python | apache-2.0 | 11,352 |
from __future__ import unicode_literals
from rbpkg.utils.matches import matches_current_system, matches_version_range
class PackageRules(object):
"""A set of rules for installing and managing packages.
The rules provide rbpkg with the information needed to install or manage
packages, and to handle non-P... | reviewboard/rbpkg | rbpkg/repository/package_rules.py | Python | mit | 10,097 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Abstract class for AES."""
class AES(object):
def __init__(self, key, mode, IV, implementation):
if len(key) not in (16, 24, 32):
raise AssertionError()
if mode != 2:
raise A... | valurhrafn/chrome-sync-server | tlslite/utils/aes.py | Python | mit | 1,064 |
# -*- coding: utf-8 -*-
from django.contrib.auth import authenticate, login, logout
from django.core.exceptions import ValidationError
from django.shortcuts import redirect, render
from django.utils.translation import ugettext_lazy as _
from django.views import generic
from account.forms import SignInForm, SignUpForm
... | viprip/clintya | account/views.py | Python | gpl-3.0 | 2,245 |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.db.models import Q
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirect, get_object_or_404
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.vi... | indexofire/gork | src/gork/application/know/plugins/attachments/views.py | Python | mit | 13,497 |
#!/usr/bin/python
#
# 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
# "Li... | denis-vilyuzhanin/selenium-fastview | py/test/selenium/webdriver/common/correct_event_firing_tests.py | Python | apache-2.0 | 5,463 |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Copyright (c) 2014 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Given a list of JAR files passed via --jars, produced one single JAR ... | PeterWangIntel/crosswalk | build/android/merge_jars.py | Python | bsd-3-clause | 1,551 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# b... | fracpete/python-weka-wrapper-examples | src/wekaexamples/flow/dump_instances.py | Python | gpl-3.0 | 2,538 |
from flask.ext.appbuilder import Model
from datetime import timedelta
from flask.ext.appbuilder.models.mixins import AuditMixin
from flask import request, redirect, flash, Response
from sqlalchemy import Column, Integer, String, ForeignKey, Text, Boolean, DateTime
from sqlalchemy import create_engine, MetaData, desc
fr... | wbchn/panoramix | panoramix/models.py | Python | apache-2.0 | 26,355 |
from __future__ import absolute_import
# defaults and constants
from .utils import DEFAULT_PALETTE
from ._chart_options import default_options as defaults
# main components
from ._chart import Chart
# operations and attributes for users to input into Charts
from ._attributes import color
from .operations import stac... | srinathv/bokeh | bokeh/charts/__init__.py | Python | bsd-3-clause | 948 |
# coding: utf-8
from queue import Empty
import threading
import wx
import modder
import modder.manager
from .trayicon import TrayIcon
class ModderGuiApp(wx.App):
def OnInit(self):
modder.GUI_MODE = True
self._manager = modder.manager.ModManager()
self._tray = TrayIcon()
self._... | JokerQyou/Modder2 | modder/gui/app.py | Python | mit | 1,240 |
import logging
from django.conf import settings
from django.contrib.auth import logout
from .mixins import JWTCookieActionMixin
from metrics import inc_logouts
logger = logging.getLogger(__name__)
class LogoutBaseAction(object):
"""Logout base action"""
def do(self, action_context, view, *args, **kwargs):
... | qdqmedia/wiggum | wiggum/authorization/actions/logout.py | Python | bsd-3-clause | 1,648 |
from __future__ import absolute_import
from copy import copy
import django
from django import template
from django.conf import settings
from django.template import Context
from django.template.base import Node, VariableNode, TextNode, NodeList
from django.template.defaulttags import IfNode
from django.template.loader ... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/compressor/offline/django.py | Python | bsd-3-clause | 5,960 |
for _ in range(int(raw_input())):
_length, K = map(int, raw_input().split())
arr = [int(i) for i in raw_input().split()]
if min(arr) < K:
print K - min(arr)
else:
print '0'
| Faraaz54/python_training_problems | hacker_earth/data_structures/array_update.py | Python | mit | 214 |
libname = 'scenarios'
srcFiles = [
]
hppFiles = [
]
pyconfigs = [
'scenarios/__init__.py',
'scenarios/interfaces.py',
'scenarios/antenna/__init__.py',
'scenarios/antenna/isotropic.py',
'scenarios/placer/__init__.py',
'scenarios/placer/hexagonal.py',
'scenarios/placer/circular.py',... | creasyw/IMTAphy | framework/scenarios/config/libfiles.py | Python | gpl-2.0 | 1,672 |
"""
SoftLayer.CLI.routes
~~~~~~~~~~~~~~~~~~~~~
This is how all commands are registered with the CLI.
:license: MIT, see LICENSE for more details.
"""
ALL_ROUTES = [
('shell', 'SoftLayer.shell.core:cli'),
('call-api', 'SoftLayer.CLI.call_api:cli'),
('account', 'SoftLayer.CLI.account'),
... | allmightyspiff/softlayer-python | SoftLayer/CLI/routes.py | Python | mit | 21,040 |
import fnmatch
import os
from glob import glob
import numpy as np
from datetime import datetime as dt
import scipy as sp
from scipy import signal
from fastrms import fastrms
import matplotlib.pyplot as plt
nch = 64
def basename(val):
return os.path.basename(val)
def getAllFilepathsWith(dir, str):
return [y ... | degoldschmidt/ribeirolab-codeconversion | python/flyPAD/process_data.py | Python | gpl-3.0 | 25,721 |
import itertools
import boto
import sure # noqa
from moto import mock_ec2
@mock_ec2
def test_instance_launch_and_terminate():
conn = boto.connect_ec2('the_key', 'the_secret')
reservation = conn.run_instances('ami-1234abcd')
instance = reservation.instances[0]
instance.add_tag("a key", "some value"... | andresriancho/moto | tests/test_ec2/test_tags.py | Python | apache-2.0 | 1,078 |
from flask.views import View
from flask import Response
from urllib2 import urlopen
from gpv import utils
class TreeMapPrice(View):
def dispatch_request(self, komuna, year):
api_base_url = utils.get_api_url()
url = "%s/%s/treemap/price/%d" % (api_base_url, komuna, year)
result = urlopen(... | opendatakosovo/municipality-procurement-visualizer | gpv/views/json/treemapprice.py | Python | gpl-2.0 | 497 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | openstack/horizon | openstack_dashboard/dashboards/identity/roles/views.py | Python | apache-2.0 | 3,930 |
import latus.preferences
import latus.nodedb
import latus.util
import latus.folders
def create(app_data_folder, cloud_folder, latus_folder):
node_id = latus.util.new_node_id()
pref = latus.preferences.Preferences(app_data_folder)
pref.set_cloud_root(cloud_folder)
pref.set_latus_folder(latus_folder)
... | latusrepo/latus | latus/node_management.py | Python | gpl-3.0 | 548 |
#for line in tlines:(),
# ss=line.split()),
# print "(%-10r,%7r,%12r):( %.1f,"%(ss[0],ss[1],ss[2],float(ss[3]))
yoffset_delta ={ # from f2offsets.fits for yoffset and from nsappwave.fits for
# Delta (original dispersion)
#(grism filter slit (yoffset, Delta)
('JH_G5801', 'JH', '1pix-sli... | pyrrho314/recipesystem | trunk/dontload-astrodata_Gemini/ADCONFIG_Gemini/lookups/F2/F2offsets.py | Python | mpl-2.0 | 3,831 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/cloud | demo/word2vec/train.py | Python | apache-2.0 | 5,940 |
###############################################################################
# SteadyLogSpiralPotential: a steady-state spiral potential
###############################################################################
import numpy
from ..util import conversion
from .planarPotential import planarPotential
_degtorad=... | jobovy/galpy | galpy/potential/SteadyLogSpiralPotential.py | Python | bsd-3-clause | 7,342 |
import tensorflow as tf
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import random
import math
np.random.seed(1234)
random.seed(1234)
plt.switch_backend("TkAgg")
def plotScatter(points, color):
xs = [x[0] for x in points]
ys = [y[1] for y in points]
plt.scatter(xs, ys, c=colo... | garibaldu/boundary-seekers | Boundary Hunter Ideas/TensorFlow/Single-TH-BH.py | Python | mit | 5,863 |
#########################
# py.test test functions
#########################
from __future__ import absolute_import
import pytest
from Qpyl.core.qpotential import *
from Qpyl.core.qstructure import PosVector as P
def is_close(a, b, rel_tol=1e-09, abs_tol=0.0):
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)... | mpurg/qtools | tests/Qpyl/core/qpotential_test.py | Python | mit | 1,522 |
################################################################################
### Copyright © 2012-2013 BlackDragonHunt
###
### This file is part of the Super Duper Script Editor.
###
### The Super Duper Script Editor is free software: you can redistribute it
### and/or modify it under the terms of the GNU Genera... | ThunderGemios10/The-Super-Duper-Script-Editor-2 | word_count.py | Python | gpl-3.0 | 1,322 |
#!/usr/bin/env python
"""
Set up the logging
"""
import logging
import tempfile
import os
def initialize_logging():
"""
Set up the screen and file logging.
:return: The log filename
"""
# set up DEBUG logging to file, INFO logging to STDERR
log_file = os.path.join(tempfile.gettempdir()... | superphy/backend | app/modules/loggingFunctions.py | Python | apache-2.0 | 1,056 |
# Copyright 2014 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 required by applica... | yuewko/neutron | neutron/tests/unit/tests/test_base.py | Python | apache-2.0 | 1,600 |
'''
A rst2pdf extension to implement something similar to sphinx's plantuml extension
(see http://pypi.python.org/pypi/sphinxcontrib-plantuml)
Therefore, stuff may be copied from that code.
Ergo:
:copyright: Copyright 2010 by Yuya Nishihara <yuya@tcha.org>.
:license: BSD, (he says see LICENSE but the file is ... | rst2pdf/rst2pdf | rst2pdf/extensions/plantuml_r2p.py | Python | mit | 3,148 |
# 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.
from telemetry.page import page_set as page_set_module
from measurements import polymer_load
class TopekaPage(polymer_load.PageForPolymerLoad):
def __i... | guorendong/iridium-browser-ubuntu | tools/perf/page_sets/topeka.py | Python | bsd-3-clause | 881 |
from socket import *
import binascii
import tongue
class TcpClient:
HOST = '127.0.0.1'
PORT = 12345
BUFSIZ = 1024
ADDR = (HOST, PORT)
def __init__(self):
self.client = socket(AF_INET, SOCK_STREAM)
self.client.connect(self.ADDR)
self.register_data = '7E010000250186017525040... | land-pack/jtt808 | simulate/terminal.py | Python | gpl-2.0 | 830 |
import json
import re
from girder_worker.app import app
from girder_worker.utils import girder_job
from gaia.parser import deserialize
@girder_job()
@app.task(bind=True)
def gaia_task(self, kwargs):
datasetId = str(kwargs['dataset']['_id'])
token = kwargs['token']
analysis = json.loads(kwargs['analysis'])... | Kitware/minerva | gaia_tasks/tasks.py | Python | apache-2.0 | 1,013 |
from amcat.tools import amcattest
from amcat.tools.table import tableoutput
from amcat.tools.table.table3 import Table, ListTable, ObjectTable, ObjectColumn, \
SortedTable
class TestTable(amcattest.AmCATTestCase):
def test_init(self):
"""Does init use 'empty' parameters?"""
a = []
t = ... | amcat/amcat | amcat/tools/table/tests/test_table3.py | Python | agpl-3.0 | 2,580 |
__author__ = 'fahadadeel'
import jpype
import os.path
from WorkingWithCharts import SetLabelDistance
asposeapispath = os.path.join(os.path.abspath("../../../"), "lib")
print "You need to put your Aspose.Slides for Java APIs .jars in this folder:\n"+asposeapispath
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext... | asposeslides/Aspose_Slides_Java | Plugins/Aspose-Slides-Java-for-Python/tests/WorkingWithCharts/SetLabelDistance/SetLabelDistance.py | Python | mit | 405 |
from __future__ import unicode_literals
import datetime
import operator
try:
from urllib.parse import urlencode
except ImportError: # python 2
from urllib import urlencode
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.db.models import Q
from django.db.mod... | rizumu/django-user-accounts | account/models.py | Python | mit | 13,425 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | fenglu-g/incubator-airflow | tests/www/test_views.py | Python | apache-2.0 | 66,432 |
from base64 import b64encode
import json
from urllib import urlencode
from twisted.internet.defer import inlineCallbacks
from twisted.web import http
from vumi.utils import http_request, http_request_full
from vumi.tests.helpers import VumiTestCase
from vumi.transports.api import (
OldSimpleHttpTransport, OldTemp... | TouK/vumi | vumi/transports/api/tests/test_oldapi.py | Python | bsd-3-clause | 5,374 |
# Copyright 2013 Rackspace
#
# 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... | racker/python-raxcli | raxcli/apps/loadbalancer/constants.py | Python | apache-2.0 | 909 |
from datetime import datetime, time
import pytz
from mailsync.libs.dates import utc_unixtime_to_localtime
from mailsync import settings
# Converts unix time to readable date format
# Used in the tooltips on the frontend
def dateformat(value, format="%d-%m-%Y-%H:%M"):
try:
_ = datetime.fromtimestamp(value, pytz.utc... | rebelact/mailsync-app | mailsync/template.py | Python | mit | 841 |
import operator
class Operation:
_name_to_func = {
'<': operator.lt,
'<=': operator.le,
'==': operator.eq,
'!=': operator.ne,
'>=': operator.ge,
'>': operator.gt,
'not': operator.not_,
'bool': operator.truth,
'abs': operator.abs,
'+':... | asherbar/json-plus-plus | jpp/parser/operation.py | Python | mit | 920 |
from tests import ResTest
from res.enkf import EnsembleConfig, ResConfig
from res.enkf import ConfigKeys
from ecl.util.test import TestAreaContext
from res.enkf.enums import GenDataFileType
class EnsembleConfigTest(ResTest):
def setUp(self):
self.case_directory = self.createTestPath("local/simple_config... | Statoil/libres | python/tests/res/enkf/test_ensemble_config.py | Python | gpl-3.0 | 5,360 |
from unittest import result
from unittest.util import strclass
class TreeTextTestResult(result.TestResult):
indent = ' ' * 4
test_class = None
separator1 = '=' * 70
separator2 = '-' * 70
def __init__(self, stream, descriptions, verbosity):
super(TreeTextTestResult, self).__init__(stream, d... | ntruessel/qcgc | test/runner/TreeTextTestResult.py | Python | mit | 2,681 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 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.... | aristanetworks/arista-ovs-quantum | quantum/tests/unit/test_agent_rpc.py | Python | apache-2.0 | 5,185 |
import openmc
import openmc.capi
from openmc.stats import Box
from openmc.material import Materials
import pytest
from tests.testing_harness import PyAPITestHarness
pytestmark = pytest.mark.skipif(
not openmc.capi._dagmc_enabled(),
reason="DAGMC CAD geometry is not enabled.")
class UWUWTest(PyAPITestHarness)... | wbinventor/openmc | tests/regression_tests/uwuw/test.py | Python | mit | 1,025 |
#!/usr/bin/python
#
# Script written by Legoktm, 2011
# Released into the Public Domain on November, 16, 2011
# This product comes with no warranty of any sort.
# Enjoy!
#
from commands import getoutput
def notify(string, program=False):
if not program:
command = 'growlnotify Python -m "%s"' %string
else:
command... | legoktm/legoktm | icstalker/iclib/growl.py | Python | mit | 535 |
def itemTemplate():
return ['object/tangible/wearables/armor/nightsister/shared_armor_nightsister_bicep_r_s01.iff'] # needs correct iff still
| agry/NGECore2 | scripts/loot/lootItems/legendarylootchest/nightsister_melee_armguard.py | Python | lgpl-3.0 | 145 |
"""Google Cloud function that loads the Datastore data into BQ."""
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0... | google/centimani | cfs/reporting_data_extractor/main.py | Python | apache-2.0 | 5,698 |
# -*- 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... | erh3cq/hyperspy | hyperspy/_components/bleasdale.py | Python | gpl-3.0 | 2,498 |
import cgi
import datetime
import time
from tempfile import NamedTemporaryFile
from fabric.api import *
from fabric import colors
@task
def update():
"""Requires code_root env variable. Does a git pull and restarts the web server"""
require('code_root')
git_pull()
restart_web_server()
@task
def g... | paperreduction/fabric-bolt | fabric_bolt/fabfile.py | Python | mit | 5,177 |
# -*- coding: utf-8 -*-
#
# 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
... | holygits/incubator-airflow | airflow/contrib/operators/ssh_operator.py | Python | apache-2.0 | 3,889 |
from base import Plugin
class Graph(Plugin):
"Make pretty graphs of your requests"
active = False
def __init__(self):
super(Graph, self).__init__()
self.request_graph = self.data['request_graph'] = {}
import pygraphviz
self.graph = pygraphviz.AGraph(directed=True)
def ... | frac/django-test-utils | test_utils/crawler/plugins/graph.py | Python | mit | 830 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Red Hat, 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... | ramineni/myclient | ironicclient/v1/port_shell.py | Python | apache-2.0 | 3,685 |
import unittest
import accepton
class ClientTest(unittest.TestCase):
def test_configurable_environment(self):
client = accepton.Client(environment="development")
self.assertEqual("development", client.environment)
def test_defaults_to_production_environment(self):
client = accepton.C... | accepton/accepton-python | tests/test_client.py | Python | mit | 890 |
# Python - 3.6.0
def last_digit(n1, n2):
if not n2:
return 1
n1 %= 10
r = 1
while n2 > 1:
n2, m = n2 >> 1, n2 & 1
if m:
r = (r * n1) % 10
n1 = (n1 * n1) % 10
return (n1 * r) % 10
| RevansChen/online-judge | Codewars/5kyu/last-digit-of-a-large-number/Python/solutions1.py | Python | mit | 244 |
"""
Simulation of Game of Life with pygame
Instructions:
Press ESC or F4 to quit the game
Press RETURN to restart the game
Press SPACE to stop or resume the game
Press "p" or "+" to zoom in
Press "m" or "-" to zoom out
Press one of the letter below to change the color of the alive cells:
- r: red
- b: blue
... | DavideTonin99/pygameoflife | main.py | Python | mit | 7,534 |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
#
# __init__.py
#
# This file is part of Squilla
#
# Copyright (C) 2014 Thibault Cohen
#
# 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... | titilambert/harbour-squilla | squilla/__init__.py | Python | gpl-3.0 | 1,805 |
# Script to make "simple" geothermal models to show effects of shallow structures.
import numpy as np, sys, os, time, gzip, cPickle as pickle, scipy, gc
from glob import glob
#sys.path.append('/tera_raid/gudni/gitCodes/simpeg')
#sys.path.append('/tera_raid/gudni/gitCodes/simpegem')
import SimPEG as simpeg
import SimPEG... | simpeg/presentations | SciPy2016/MTwork/ForwardModeling_noExtension_Coarse/findDiam_MTforward_HKPK1.py | Python | mit | 3,007 |
class ConnectableRegistry():
def __init__(self):
self.registry = {}
@classmethod
def instance(cls):
try:
cls._instance
except AttributeError:
cls._instance = cls()
return cls._instance
@classmethod
def register(cls, klass_to_register):
... | Mause/circuitry | circuitry/connectable_registry.py | Python | mit | 447 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = "acpi",
version = "1.0.0",
url = 'https://github.com/ondrejsika/python-acpi',
license = 'MIT',
description = "Python acpi parser library",
author = 'Ondrej Sika',
author_email = 'ondrejs... | robertmuil/python-acpi | setup.py | Python | mit | 431 |
#! /usr/bin/env python
# scapy.contrib.description = Skinny Call Control Protocol (SCCP)
# scapy.contrib.status = loads
#############################################################################
# #
# scapy-skinny.py --- Skinny Call Contro... | smainand/scapy | scapy/contrib/skinny.py | Python | gpl-2.0 | 18,715 |
#python svm_train.py {--ID VEC_FILE.pkl ...} --ans TRAIN_ANSWERS --dev DEVNUM --output FILE
# trains an SVM to assign regression weights to tree-wise similarity vectors
# trains/tests on the splits denoted by DEVNUM {1-8}
# TRAIN_ANSWERS needs to be an X-by-1 numpy array of similarity training answers
# model is output... | vansky/azmat | scripts/svm_dev.py | Python | gpl-3.0 | 2,918 |
# Copyright 2010-2016, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
Panel presenting the configuration state for tor or nyx. Options can be edited
and the resulting configuration files saved.
"""
import curses
import os
import nyx.controller
import nyx.curses
import nyx.panel
import... | sammyshj/nyx | nyx/panel/config.py | Python | gpl-3.0 | 11,732 |
#!/usr/bin/env python
"""
Write an aggregation query to answer this question:
Of the users in the "Brasilia" timezone who have tweeted 100 times or more,
who has the largest number of followers?
The following hints will help you solve this problem:
- Time zone is found in the "time_zone" field of the user object in e... | benjaminsoellner/2015_Data_Analyst_Project_3 | Lesson_5_Analyzing_Data/10-Using_match_and_project/followers.py | Python | agpl-3.0 | 2,533 |
#!/usr/bin/python
#
# If missing 'pika' read how to download it at:
# http://www.rabbitmq.com/tutorials/tutorial-one-python.html
#
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='pmacct', type='d... | ervteng/pmacct-bugfixes | examples/amqp/amqp_receiver.py | Python | gpl-2.0 | 875 |
# -*- coding: utf-8 -*-
import os
from datetime import datetime
import sys
try:
from hashlib import sha1
except ImportError:
sys.exit('ImportError: No module named hashlib\n'
'If you are on python2.4 this library is not part of python. '
'Please install it. Example: easy_install hashli... | LamCiuLoeng/vat | vatsystem/model/auth.py | Python | mit | 4,258 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.