code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | magic/config/multiview.py | Python | agpl-3.0 | 2,674 |
import military_status
| karim-omran/openerp-addons | military_status/__init__.py | Python | agpl-3.0 | 23 |
# -*- coding: utf-8 -*-
"""
Settings for Bok Choy tests that are used when running LMS.
Bok Choy uses two different settings files:
1. test_static_optimized is used when invoking collectstatic
2. bok_choy is used when running the tests
Note: it isn't possible to have a single settings file, because Django doesn't
sup... | philanthropy-u/edx-platform | lms/envs/bok_choy.py | Python | agpl-3.0 | 9,302 |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 6.2.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the op... | srange/SU2 | SU2_PY/SU2/run/adaptation.py | Python | lgpl-2.1 | 2,720 |
#
# (C) Copyright 2003-2011 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be u... | Jajcus/pyxmpp2 | pyxmpp2/exceptions.py | Python | lgpl-2.1 | 6,975 |
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU Lesser General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (LGPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# includin... | jortel/gofer | src/gofer/rmi/model/parent.py | Python | lgpl-2.1 | 4,959 |
# TessuMod: Mod for integrating TeamSpeak into World of Tanks
# Copyright (C) 2016 Janne Hakonen
#
# 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... | WorldOfTanksMods/wot-teamspeak-mod | tessumod/src/scripts/client/gui/mods/tessumod/adapters/wotgame.py | Python | lgpl-2.1 | 8,770 |
#!/usr/bin/python
"""Test of window title output."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("Down"))
sequence.append(PauseAction(3000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyPressAction(0, None, "KP_Insert"))
sequence.append... | GNOME/orca | test/keystrokes/gtk-demo/role_window.py | Python | lgpl-2.1 | 682 |
# -*- coding: utf-8 -*-
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees ... | qtproject/pyside-pyside | tests/QtWidgets/api2_test.py | Python | lgpl-2.1 | 2,985 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2019 Denis Machard
# This file is part of the extensive automation project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... | dmachard/extensive-testing | src/ea/libs/FileModels/GenericModel.py | Python | lgpl-2.1 | 4,751 |
#####################################################################
# app/controllers/dialog.py
#
# (c) Copyright 2015, Benjamin Parzella. All rights reserved.
#
# 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 F... | bparzella/gemma | app/controllers/dialog.py | Python | lgpl-2.1 | 1,551 |
#!/usr/bin/python
"""
PyTACS Error Classes
"""
class PyTACSError(Exception):
"The root of all PyTACS errors and exceptions"
pass
class ConfigurationError(PyTACSError):
"Something in a configuration file was incorrect"
pass
| kremlinkev/pytacs | pytacs/Errors.py | Python | lgpl-2.1 | 229 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Canvas3D
A QGIS plugin
3D canvas
-------------------
begin : 2013-08-12
copyright : (C) 2013 by Oslandia
... | Oslandia/horao | qgis_plugin/__init__.py | Python | lgpl-2.1 | 1,543 |
# python
# This file is generated by a program (mib2py).
import CISCO_SYSLOG_MIB
OIDMAP = {
'1.3.6.1.4.1.9.9.41': CISCO_SYSLOG_MIB.ciscoSyslogMIB,
'1.3.6.1.4.1.9.9.41.1': CISCO_SYSLOG_MIB.ciscoSyslogMIBObjects,
'1.3.6.1.4.1.9.9.41.1.1': CISCO_SYSLOG_MIB.clogBasic,
'1.3.6.1.4.1.9.9.41.1.2': CISCO_SYSLOG_MIB.clogHisto... | xiangke/pycopia | mibs/pycopia/mibs/CISCO_SYSLOG_MIB_OID.py | Python | lgpl-2.1 | 1,663 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021
#
# 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.
#... | davidh-ssec/pyresample | pyresample/test/test_dask_ewa.py | Python | lgpl-3.0 | 15,586 |
# encoding: utf8
# noinspection PyPep8Naming
from SmallScrewdriver import Point, Size, Rect
class Shelf(Rect):
def __init__(self, max_size, origin=Point()):
Rect.__init__(self, origin, Size())
self.maxSize = max_size
self.images = []
def addImage(self, image):
"""
До... | Ingener74/Small-Screwdriver | SmallScrewdriver/Shelf/Shelf.py | Python | lgpl-3.0 | 1,165 |
from django.test import TestCase
from django.test.client import Client
from django.conf import settings
from models import *
from views import *
import datetime
"""
class InstallationTest(TestCase):
def test_urls(self):
from django.conf.urls import patterns, include, url
good_urlpatterns = pat... | ccat/django_tinycms | tinycms/tests.py | Python | lgpl-3.0 | 5,389 |
from numpy import array, rot90, fliplr, array_equal
from checkerboardpuzzle_stone import Rotation
def generate_rotated_nparrays(nparray):
"""generate rotated and mirrored versions of given nparray."""
r1 = rot90(nparray)
r2 = rot90(r1)
r3 = rot90(r2)
f1 = fliplr(nparray)
f2 = fliplr(r1)
f3 ... | pirius/draught-board-puzzle-aka-checkerboard-puzzle-solver | python/source/checkerboardpuzzle_utils.py | Python | lgpl-3.0 | 1,570 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import os
extensions = [
Extension("*", [os.path.join(os.path.dirname(__file__), "CSXCAD","*.pyx")],
language="c++", # generate C++ code
libraries = ['CSXCAD',]),
]
setup(
n... | thliebig/CSXCAD | python/setup.py | Python | lgpl-3.0 | 1,243 |
import jsonrpclib
# server proxy object
url = "http://%s:%s/jsonrpc" % (HOST, PORT)
server = jsonrpclib.Server(url)
# log in the given database
uid = server.call(service="common", method="login", args=[DB, USER, PASS])
# helper function for invoking model methods
def invoke(model, method, *args):
args = [DB, uid, P... | tintumonmartin/OPAC | rpc/jsonrpc.py | Python | lgpl-3.0 | 643 |
###############################################################################
# Copyright 2016 - Climate Research Division
# Environment and Climate Change Canada
#
# This file is part of the "EC-CAS diags" package.
#
# "EC-CAS diags" is free software: you can redistribute it and/or modify
# it under... | neishm/EC-CAS-diags | eccas_diags/diagnostics/shortexper_diffcheck.py | Python | lgpl-3.0 | 5,308 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from .geostrophic_problem import GeostrophicProblem
from .geostrophic_reduced_problem import GeostrophicReducedProblem
from .geostrophic_pod_galerkin_reduced_problem import GeostrophicPODGale... | mathLab/RBniCS | tutorials/11_quasi_geostrophic/problems/__init__.py | Python | lgpl-3.0 | 456 |
############################ Copyrights and license ############################
# #
# Copyright 2019 Nick Campbell <nicholas.j.campbell@gmail.com> #
# ... | ahmad88me/PyGithub | github/TimelineEvent.py | Python | lgpl-3.0 | 6,237 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | ghorn/debian-casadi | experimental/joel/mx_codegen.py | Python | lgpl-3.0 | 1,646 |
#!/usr/bin/env python
# encoding: utf-8
import sys
from messages import notice, error
def options():
arq_input, arq_path = define_input()
output_choice, output = define_output()
return (arq_input, arq_path, output_choice, output)
def read_input(arq_input, arq_path):
if arq_input:
try:
fp = open(ar... | netcriptus/Canivete | lib/IOHandler.py | Python | lgpl-3.0 | 1,776 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Maximilian Köhl <mail@koehlma.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope th... | koehlma/uv | uv/handles/prepare.py | Python | lgpl-3.0 | 3,660 |
from ajenti.api import *
from ajenti.ui import *
class TutorialPlugin(CategoryPlugin):
text = 'Tutorial' # name for the left pane
icon = '/dl/tutorial/icon.png'
folder = 'apps'
def get_ui(self):
ui = self.app.inflate('tutorial:main')
return ui
| DmZ/ajenti | plugins/tutorial/main.py | Python | lgpl-3.0 | 283 |
## script to convert a lookup table of unicode characters from a javascript thing I found on
## github into a lookup table that can be stored in the flash on the oggbox
##
## https://github.com/yvg/js-replace-diacritics/blob/master/replace-diacritics.js
##
fr = open("diacritical_marks_js.txt", "rb")
d = fr.read()
fr... | hairymnstr/oggbox | font/convert_dict_to_c.py | Python | lgpl-3.0 | 1,124 |
# -*- coding: utf-8 -*-
# Python stdlib
import unittest
# py.test
import pytest
# Python tfstate
from tfstate.provider.aws import AwsResource, AwsSecurityGroupResource
from tfstate.exceptions import InvalidResource
# Unit tests
from unit_tests.base import BaseResourceUnitTest
@pytest.mark.provider_aws
class AwsSe... | rodynnz/python-tfstate | unit_tests/test_tfstate/test_provider/test_aws/test_aws_security_group.py | Python | lgpl-3.0 | 2,851 |
import os
from ajenti.com import *
from ajenti.utils import *
def is_installed():
return os.path.exists('/etc/samba/')
def restart():
shell('service smbd restart')
shell('service samba restart') # older samba packages
class SambaConfig(Plugin):
shares = {}
general = {}
users = {}
gene... | DmZ/ajenti | plugins/samba/backend.py | Python | lgpl-3.0 | 4,175 |
# -*- coding: utf-8 -*-
#
# Zaguan documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 21 15:51:32 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | MSA-Argentina/zaguan | zaguan/docs/conf.py | Python | lgpl-3.0 | 10,456 |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from datetime import datetime
from nose.tools import assert_equal
import leancloud
from leancloud import Conversation
from leancloud import SysMessage
def setup():
leancloud.c... | leancloud/python-sdk | tests/test_sys_message.py | Python | lgpl-3.0 | 1,405 |
# -*- coding: utf-8 -*-
# Copyright(C) 2015 Baptiste Delpey
#
# This file is part of a weboob module.
#
# This weboob module 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 3 of the... | vicnet/weboob | modules/bnpcards/browser.py | Python | lgpl-3.0 | 8,411 |
# Ifc4D - IFC scheduling utility
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of Ifc4D.
#
# Ifc4D 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 3 of the L... | IfcOpenShell/IfcOpenShell | src/ifc4d/ifc4d/msp2ifc.py | Python | lgpl-3.0 | 13,042 |
# Generated by Django 2.2.3 on 2019-09-06 12:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='order',
name='braintree_id',
... | ch1huizong/dj | onlineshop/myshop/orders/migrations/0002_order_braintree_id.py | Python | unlicense | 390 |
from setuptools import setup, find_packages
setup\
( name = 'kanone'
, version = '0.4.6'
, description = 'a validation library'
, long_description = open('README.txt').read()
, author = 'don`catnip'
, url = 'http://github.com/doncatnip/kanone'
, classifiers =\
[ "Development Status ... | doncatnip/kanone | setup.py | Python | unlicense | 853 |
from django.conf import settings
from django.views.generic.base import View
from restful.decorators import restful_view_templates
@restful_view_templates
class FaqView(View):
def get(self, request):
return {
"page": "inner about faq",
"projects": settings.FAKE_DB,
}
| tochev/obshtestvo.bg | web/views/faq.py | Python | unlicense | 313 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
# Creating reStructuredText Directives
# @see http://docutils.sourceforge.net/docs/howto/rst-directives.html
from docutils.parsers.rst import directives, Directive
from docutils import nodes
from pelican import signals
_CONTENT_PATH = None
_DEBUG = False
from os.path i... | siongui/pelican-template | plugins/adsense/adsense.py | Python | unlicense | 1,070 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy.item import Item, Field
class LacitySalariesItem(Item):
# define the fields for your item here like:
# name = Field()
department = Field()
position = Field()
em... | dgeske/lacity-salaries | lacity_salaries/items.py | Python | unlicense | 358 |
from importlib import import_module
from collapsar.const import CONST
from collapsar.exc import ImproperlyConfigured
from collapsar.config.scheme import Rel, InitArgs
__all__ = [
'ClassResolver',
'PropertiesResolver',
'ScopeResolver',
'FactoryResolver',
'BooleanResolver',
'InitArgsResolver',
... | minmax/collapsar | collapsar/config/resolvers.py | Python | unlicense | 3,505 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ++++++++++++++++++++++++++++++++++++++++++++++
# Authors:
#
# Sebastian Spaar <spaar@stud.uni-heidelberg.de>
# Dennis Ulmer <d.ulmer@stud.uni-heidelberg.de>
#
# Project:
# CrOssinG (CompaRing Of AngliciSmS IN German)
#
# ++++++++++++++++++++++++++++++++++++++++++++++
"""ang... | Eroica/crossing | bin/anglicisms.py | Python | unlicense | 5,083 |
import itertools
import unittest
from typing import List
import utils
# O(n * mlog(m)). O(nm) space. Anagram, sorting.
# n = strs.length
# m = strs[i].length
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
sorted_strs = sorted((sorted(s), s) for s in strs)
groups = it... | chrisxue815/leetcode_python | problems/test_0049_sort.py | Python | unlicense | 833 |
import unittest
class Solution:
def restoreIpAddresses(self, s):
"""
:type s: str
:rtype: List[str]
"""
result = []
slen = len(s)
# [0,p1) [p1,p2) [p2,p3) [p3,slen)
for p1 in range(1, 4):
for p2 in range(p1 + 1, p1 + 4):
f... | chrisxue815/leetcode_python | problems/test_0093_iterative_post_validate.py | Python | unlicense | 1,973 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014, Baidu Inc.
# Author: Zhong Yi <zhongyi01@baidu.com>
import sys
from HTMLParser import HTMLParser
filtered_tags = ['meta', 'div']
class EvernoteHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.list_prefix_ = []
def han... | elvestar/codelab | evernote2rst/html2rst.py | Python | unlicense | 1,363 |
import os
import string
from os import listdir
from os.path import isfile, join
from osgeo import gdal
from osgeo.gdalconst import *
import numpy
import numpy.ma as ma
# input the parent directory
root='/data/ifs/users/xcwu'
#Function to build vrt
def buildVrtFile (root1,root2,product):
file... | zhangyaonju/Global_GPP_VPM_NCEP_C3C4 | LSWImax/LSWImax_SouthH.py | Python | apache-2.0 | 13,248 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ResearcherConfig(AppConfig):
name = 'researcher'
| Goodly/TextThresher | researcher/apps.py | Python | apache-2.0 | 136 |
from django.conf import settings
def is_desktop(request):
desktopapp = not request.is_mobile and not request.is_tablet
return {
'is_desktop': desktopapp
}
| uw-it-aca/course-dashboards | coursedashboards/context_processors.py | Python | apache-2.0 | 179 |
#!/usr/bin/env python
#
# 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
# "... | SVADemoAPP/Server | WebContent/WEB-INF/python/MQReceiver.py | Python | apache-2.0 | 1,996 |
# Copyright 2016 Raytheon BBN Technologies
#
# 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
__all__ = ['Electromagnet']
import numpy as np
i... | BBN-Q/Auspex | src/auspex/instruments/magnet.py | Python | apache-2.0 | 2,530 |
# 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/... | 30loops/nova | nova/tests/api/openstack/test_image_metadata.py | Python | apache-2.0 | 7,983 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | danielfrg/jupyterhub-kubernetes_spawner | kubernetes_spawner/swagger_client/models/v1_component_status_list.py | Python | apache-2.0 | 6,270 |
import hashlib
import sys
input_filename = sys.argv[1]
with open(input_filename) as f:
input = f.read()
common_hash = hashlib.md5()
common_hash.update(input.encode())
i = 0
password = ['_'] * 8
while True:
hash = common_hash.copy()
hash.update(str(i).encode())
md5 = hash.hexdigest()
if md5.starts... | mofr/advent-of-code | 2016/day05.py | Python | apache-2.0 | 552 |
# Copyright 2015-2016 Google 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 by applicable law... | wklken/yapf | yapf/yapflib/format_token.py | Python | apache-2.0 | 8,807 |
"""
The Tile class is an object representation of a tile on the screen
"""
__author__ = 'William Fiset'
import pygame
class Tile(pygame.Rect):
floor_tile_img = pygame.image.load('images/tiles/surface_tile_gray.png')
wall_tile_img = pygame.image.load("images/tiles/dark_wall.png")
# Define all the dif... | william-fiset/Survival | Tile.py | Python | apache-2.0 | 1,675 |
# Copyright 2017 The UAI-SDK 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 applicabl... | ucloud/uai-sdk | examples/tensorflow/inference/east/code/east_multi_inference.py | Python | apache-2.0 | 1,765 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abst... | slyphon/pants | src/python/pants/backend/core/tasks/test_task_mixin.py | Python | apache-2.0 | 5,100 |
#! usr/bin/env python3
import os
import re
import shutil
from bs4 import BeautifulSoup
def map_the_assets(src_asset_dir, dest_asset_dir, docname=None, html_doc_path=None, html_source=None):
'''
Given an HTML file, take all image assets and remap for deconst.
'''
if not docname:
docname = 'tes... | nimbinatus/deconst-raml-preparer | ramlpreparer/builders/asset_mapper.py | Python | apache-2.0 | 1,682 |
from .cqsdk import *
| moondropx/dogbot | dogbot/cqsdk/__init__.py | Python | apache-2.0 | 21 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
async web application.
'''
import logging; logging.basicConfig(level=logging.INFO)
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
from config import configs
import orm
from cor... | kitianFresh/awesome-python3-webapp | www/app.py | Python | apache-2.0 | 5,548 |
import numpy as np
from BDSpace.Coordinates import Cartesian, transforms
from BDSpace.Coordinates.transforms import unit_vector
from BDSpace.Curve import Line, Arc, Helix
def line_between_two_points(coordinate_system, point1, point2):
direction = point2 - point1
distance = np.sqrt(np.dot(direction, direction... | bond-anton/Space | BDSpace/Pathfinder/__init__.py | Python | apache-2.0 | 3,109 |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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 o... | eayunstack/neutron | neutron/tests/unit/services/trunk/rpc/test_backend.py | Python | apache-2.0 | 3,069 |
#!/usr/bin/python2.7
# Copyright 2011 Google 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 requi... | googleapis/google-api-php-client-services | generator/src/googleapis/codegen/php_generator.py | Python | apache-2.0 | 14,317 |
from __future__ import absolute_import, division, print_function
import numpy as np
import pytest
from xarray.core import dtypes
@pytest.mark.parametrize("args, expected", [
([np.bool], np.bool),
([np.bool, np.string_], np.object_),
([np.float32, np.float64], np.float64),
([np.float32, np.string_], ... | jcmgray/xarray | xarray/tests/test_dtypes.py | Python | apache-2.0 | 1,508 |
import io
import json
import zipfile
from functools import cached_property
from typing import Callable, Dict, KeysView, List, NamedTuple, Set, Union
import requests
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ObjectDoesNotExist, Susp... | CenterForOpenScience/lookit-api | exp/views/responses.py | Python | apache-2.0 | 80,549 |
import collections
from .types import Range, Constraint
try:
unicode
except NameError: # python3
basestring = unicode = str
def mad_quote(value):
"""Add quotes to a string value."""
quoted = repr(value)
return quoted[1:] if quoted[0] == 'u' else quoted
def mad_parameter(key, value):
"""... | pymad/cpymad | src/cern/cpymad/_madx_tools.py | Python | apache-2.0 | 2,922 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.detailed_ground_heat_transfer import GroundHeatTransferBasementComBldg
log = logging.getLogger(__name__)
class TestGroundHeatTransferBasementComBldg(unittest.TestCase):
def... | rbuffat/pyidf | tests/test_groundheattransferbasementcombldg.py | Python | apache-2.0 | 4,351 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-05-15 17:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('inventory', '0037_auto_20180213_1407'),
... | zentralopensource/zentral | zentral/contrib/mdm/migrations/0012_auto_20180515_1749.py | Python | apache-2.0 | 4,153 |
"""
navdoon.collector
-----------------
Define collectors, that collect Statsd requests and queue them to be
processed by the processor.
"""
import os
import socket
from socket import socket as SocketClass
from abc import abstractmethod, ABCMeta
from threading import Event
from navdoon.pystdlib.queue import Queue
from... | farzadghanei/navdoon | navdoon/collector.py | Python | apache-2.0 | 10,313 |
# Copyright 2019 PerfKitBenchmarker 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 appli... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/gluster_fio_benchmark.py | Python | apache-2.0 | 6,058 |
#!/usr/bin/python3
import json
import time
import requests
import websocket
TIMEOUT = 1
class GenericElement(object):
def __init__(self, name, parent):
self.name = name
self.parent = parent
def __getattr__(self, attr):
func_name = '{}.{}'.format(self.name, attr)
def gener... | marty90/PyChromeDevTools | PyChromeDevTools/__init__.py | Python | apache-2.0 | 4,638 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.conf import settings
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.utils import timezone
from uw_saml.decorators import group_required
from uw_sws.models import Ter... | uw-it-aca/gradepage | course_grader/views/support/status.py | Python | apache-2.0 | 3,528 |
#!/usr/bin/env python3
"""
gftools gen-html aka diffbrowsers2.
Generate html documents to proof a font family, or generate documents to
diff two families.
Examples:
# Generate proofing documents for a single font
gftools gen-html proof font1.ttf
# Generate proofing documents for a family of fonts
gftools gen-html pr... | googlefonts/gftools | bin/gftools-gen-html.py | Python | apache-2.0 | 3,393 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yongshengwang/builthue | apps/security/src/security/api/hdfs.py | Python | apache-2.0 | 6,181 |
import config
def get_error_significance_score(value1, value2, distance_in_the_future, time_period):
"""
This method takes two values and calculates the absolute error between them. After that
it adjusts the importance of the error. The weight for each error depends on how far into
the future the dat... | googleinterns/inventory-visualizer | backend/classifiers/error_significance_classifier.py | Python | apache-2.0 | 1,316 |
import sys
from xml.sax.handler import ContentHandler
from xml.sax.xmlreader import Locator
import xml.sax
import xml.sax.handler
class AimlParserError(Exception): pass
class AimlHandler(ContentHandler):
# The legal states of the AIML parser
_STATE_OutsideAiml = 0
_STATE_InsideAiml = 1
... | mpetyx/pychatbot | AIML/PyAIML_CUSTOM_OVERLAY-SEMIOTICS/aiml/AimlParser.py | Python | apache-2.0 | 28,339 |
# Copyright 2021 The Kubeflow 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... | kubeflow/pipelines | samples/core/lightweight_component/lightweight_component_test.py | Python | apache-2.0 | 870 |
import logging
from org.openbaton.v2.cmd import BaseObCmd
from org.openbaton.v2.utils import get_result_to_list, get_result_to_show, parse_path_or_json, result_to_str
class Nsd(BaseObCmd):
"""Command to manage NSDs. It allows to:
* show details of a specific NSD passing an id
* list all saved NSD... | openbaton/openbaton-cli | org/openbaton/v2/nsd.py | Python | apache-2.0 | 1,773 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... | ntt-sic/heat | heat/tests/test_resource_group.py | Python | apache-2.0 | 7,257 |
# Copyright 2019 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
#
# Unless required by applicable law or agreed to in writing, s... | google/adcase | src/lib/adcase/login.py | Python | apache-2.0 | 2,608 |
# -*- 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | line/line-bot-sdk-python | examples/flask-echo/app.py | Python | apache-2.0 | 2,562 |
#!/usr/bin/env python
# Copyright 2015 Criteo. All rights reserved.
#
# The contents of this file are 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.... | cedric222/netcompare | ansible/library/netcompare.py | Python | apache-2.0 | 8,224 |
import gettext
gettext.install(
'example',
'locale',
names=['ngettext'],
)
print(_('This message is in the script.'))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_internationlization_and_localization/gettext_app_builtin.py | Python | apache-2.0 | 132 |
# Copyright 2013-present Barefoot Networks, 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 agre... | p4lang/p4c-bm | p4c_bm/util/topo_sorting.py | Python | apache-2.0 | 2,606 |
#!/usr/bin/env python
# we're using python 3.x style print but want it to work in python 2.x,
from __future__ import print_function
import os
import argparse
import sys
parser = argparse.ArgumentParser(description="Validates directory containing pocolm-format "
"language model, as pro... | wantee/pocolm | scripts/validate_lm_dir.py | Python | apache-2.0 | 4,017 |
from __future__ import print_function
import os
import re
import ujson
from typing import Any, Dict, List, Text
from django.core.management.commands import compilemessages
from django.conf import settings
import polib
from zerver.lib.i18n import with_language
class Command(compilemessages.Command):
def handl... | verma-varsha/zulip | zerver/management/commands/compilemessages.py | Python | apache-2.0 | 4,381 |
"""Bayesian p-value Posterior/Prior predictive plot."""
import numpy as np
from ..labels import BaseLabeller
from ..rcparams import rcParams
from ..utils import _var_names
from .plot_utils import default_grid, filter_plotters_list, get_plotting_function
from ..sel_utils import xarray_var_iter
def plot_bpv(
data,... | arviz-devs/arviz | arviz/plots/bpvplot.py | Python | apache-2.0 | 11,291 |
# Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@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
#
# ... | ept/windmill | windmill/bin/admin_lib.py | Python | apache-2.0 | 12,984 |
from gasp import * # import everything from the gasp library
begin_graphics() # open the graphics canvas
Box((20, 20), 100, 100) # the house
Box((55, 20), 30, 50) # the door
Box((40, 80), 20, 20) # the left window
Box((80, 80), 20, 20) # the right window
Line((20, 120), (70, ... | abhispra/python | hello_world/house_gasp.py | Python | apache-2.0 | 659 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import hashlib
import os
import shutil
import textwrap
import threading
from builtins imp... | foursquare/pants | src/python/pants/backend/jvm/tasks/bootstrap_jvm_tools.py | Python | apache-2.0 | 15,536 |
#
# 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... | mistercrunch/airflow | airflow/providers/amazon/aws/hooks/athena.py | Python | apache-2.0 | 11,213 |
from intelligine.synergy.object.ressource.Ressource import Resource
from intelligine.cst import TYPE, TYPE_RESOURCE_EXPLOITABLE, TYPE_RESOURCE_EATABLE, COL_EATABLE, COL_SMELL, SMELL_FOOD, \
TRANSPORTABLE
class Food(Resource):
def __init__(self, collection, context):
super().__init__(collection, conte... | buxx/intelligine | intelligine/synergy/object/Food.py | Python | apache-2.0 | 899 |
# 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 (t... | heiths/allura | Allura/allura/ext/admin/admin_main.py | Python | apache-2.0 | 55,792 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/vulncode-db | app/api/v1/routes.py | Python | apache-2.0 | 5,192 |
__source__ = 'https://www.thumbtack.com/challenges/simple-database'
Material = '''
https://github.com/PramodhN/simple-database-challenge
'''
# Time: O()
# Space: O()
#
# Description:
# Simple Database Challenge
# In the Simple Database problem, you'll implement an in-memory database similar to Redis.
# For simplicity'... | JulyKikuAkita/PythonPrac | newQ/SimpleDatabaseChallenge.py | Python | apache-2.0 | 1,961 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/hue | desktop/core/src/desktop/middleware.py | Python | apache-2.0 | 25,143 |
'''
Integration test for testing max allowed vscsi data volume to be attached on mini.
@author: zhaohao.chen
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecke... | zstackio/zstack-woodpecker | integrationtest/vm/mini/volume/test_max_allowed_attached_vscsi_volume.py | Python | apache-2.0 | 3,208 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | josephsuh/extra-specs | nova/compute/utils.py | Python | apache-2.0 | 8,578 |
import sys
def dft(dihedrals):
"""Writes dft calculations for nwchem. This is wrong. Uses dihedrals. Runs
Keyword Arguments:
dihedrals - The list of dihedrals to generate a nwchem output from. If the dihedral is marked as dft it will run
"""
dftfile = open('outputs/dft.nw','w')
sys.stdou... | sipjca/cmlparser_py | write_nwchem.py | Python | apache-2.0 | 1,749 |
"""
rhn_schema_version - Command ``/usr/bin/rhn-schema-version``
============================================================
Parse the output of command ``/usr/bin/rhn-schema-version``.
"""
from .. import parser
from insights.specs import rhn_schema_version
@parser(rhn_schema_version)
def rhn_schema_version(context... | wcmitchell/insights-core | insights/parsers/rhn_schema_version.py | Python | apache-2.0 | 778 |
# Copyright (c) 2012 - 2015 EMC Corporation, 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
#
# ... | Akrog/cinder | cinder/volume/drivers/emc/emc_cli_fc.py | Python | apache-2.0 | 9,214 |