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 |
|---|---|---|---|---|---|
import io
import os
from datetime import datetime, timezone
from unittest.mock import patch
from django.conf import settings
from django.core.files.base import ContentFile
from repomaker.models import RemoteRepository, App, RemoteApp, Screenshot
from repomaker.models.screenshot import PHONE
from .. import datetime_is... | fdroidtravis/repomaker | repomaker/tests/models/test_app.py | Python | agpl-3.0 | 7,888 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Wil Mahan <wmahan+fatics@gmail.com>
#
# This file is part of FatICS.
#
# FatICS 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 Lice... | ecolitan/fatics | src/command/message_command.py | Python | agpl-3.0 | 8,797 |
from django.db import connection
from django.utils.translation import gettext_lazy
from judge.contest_format.legacy_ioi import LegacyIOIContestFormat
from judge.contest_format.registry import register_contest_format
from judge.timezone import from_database_time
@register_contest_format('ioi16')
class IOIContestForma... | DMOJ/site | judge/contest_format/ioi.py | Python | agpl-3.0 | 4,314 |
# REST API Backend for the Radiocontrol Project
#
# Copyright (C) 2017 Stefan Derkits <stefan@derkits.at>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License... | Horrendus/radiocontrol | api/api/models.py | Python | agpl-3.0 | 3,622 |
#!/usr/bin/env python3
# Script to upload a playlist & all it's songs to the radiocontrol API
#
# Copyright (C) 2018 Stefan Derkits <stefan@derkits.at>
#
# 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
# Fou... | Horrendus/radiocontrol | frontends/python_cmdline/read_and_upload_m3u.py | Python | agpl-3.0 | 3,446 |
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse
from django.db.models import Count, F
from django.utils import timezone
import datetime
from notifications.signals import notify
from exams.models import *
class Command(BaseCommand):
def add_arguments(self, parser):... | Zahajamaan/Fudulbank | core/management/commands/notification_demon.py | Python | agpl-3.0 | 8,773 |
# -*- coding: utf-8 -*-
from datetime import datetime
import lxml
import random
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.addons.website.models.website import slug
from openerp.osv import osv, fields
from openerp.tools.translate import _
class Blog(osv.Model):
_name = 'blog.blog'
... | mkieszek/odoo | addons/website_blog/models/website_blog.py | Python | agpl-3.0 | 10,878 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import json
import frappe
import six
from datetime import datetime
from frappe.model.document import Document
from frappe.email import s... | gsnbng/erpnext | erpnext/non_profit/doctype/membership/membership.py | Python | agpl-3.0 | 4,317 |
# -*- coding: utf-8 -*-
import ddt
import json
from mock import ANY, MagicMock, patch
from StringIO import StringIO
from django.conf import settings
from django.core.urlresolvers import reverse as django_reverse
from django.test.utils import override_settings
from certificates.tests.factories import GeneratedCertific... | nttks/edx-platform | lms/djangoapps/ga_operation/tests/test_api.py | Python | agpl-3.0 | 34,534 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class SyncConfig(AppConfig):
name = 'sync'
| tdfischer/organizer | sync/apps.py | Python | agpl-3.0 | 148 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mozaik_mandate, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mozaik_mandate is free software:
# you can redistribute it and/or
# modify it u... | acsone/mozaik | mozaik_mandate/wizard/allow_incompatible_mandate_wizard.py | Python | agpl-3.0 | 2,070 |
# -*- coding: utf-8 -*-
# (c) 2016 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import openerp.tests.common as common
class TestMrpInverse(common.TransactionCase):
def setUp(self):
super(TestMrpInverse, self).setUp()
self.production_model = self.env[... | esthermm/odoo-addons | mrp_inverse/tests/test_mrp_inverse.py | Python | agpl-3.0 | 3,074 |
# Generated by Django 1.11.11 on 2018-05-22 13:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0083_auto_20180511_1406'),
]
operations = [
migrations.AlterModelOptions(
name='course',
options={'ord... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0084_auto_20180522_1339.py | Python | agpl-3.0 | 1,686 |
import re
whitespace_re = re.compile(r'[\x00-\x20\s]')
non_alnum_re = re.compile(r'[^0-9a-zA-Z]')
def normalize_whitespace(s):
"""Strip the string and replace all whitespace sequences and other
non-printable characters with a single space."""
assert isinstance(s, str) or isinstance(s, unicode)
ret... | dkm/skylines | skylines/lib/string.py | Python | agpl-3.0 | 834 |
#coding: utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | prhod/navitia | source/tyr/tyr/resources.py | Python | agpl-3.0 | 35,849 |
# -*- coding:Utf-8 -*-
from tastypie import fields as base_fields
from tastypie_mongoengine import fields
from invoicing.models import DownPaymentInvoice
from invoicing.api.resources.invoice import InvoiceResource
from invoicing.api.doc import HELP_TEXT
__all__ = (
'DownPaymentInvoiceResource',
)
class DownPa... | Naeka/vosae-app | www/invoicing/api/resources/down_payment_invoice.py | Python | agpl-3.0 | 1,095 |
# Copyright 2014-2015 Boxkite Inc.
# This file is part of the DataCats package and is released under
# the terms of the GNU Affero General Public License version 3.0.
# See LICENSE.txt or http://www.fsf.org/licensing/licenses/agpl-3.0.html
from os.path import isdir, exists, join
from os import makedirs, remove, envir... | poguez/datacats | datacats/environment.py | Python | agpl-3.0 | 38,655 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2014 eXtensive Testing Organization
#
# author : Jean-Vianney OBLIN
# mail :
#
# This file is part of the XTC Project
# -------------------------------------------------------------------... | JVO80/xtcli | xtcpyrc/xtcpyrc.py | Python | lgpl-2.1 | 4,798 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2011 Ulrich von Zadow
#
# 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
#... | lynxis/libavg | src/samples/invertfx.py | Python | lgpl-2.1 | 1,307 |
# -*- coding: utf-8 -*-
#
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2014-2015, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Pub... | ben-albrecht/cclib | cclib/parser/mopacparser.py | Python | lgpl-2.1 | 61,886 |
# $Id$
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""gp_macosx -- an interface to the command line version of gnuplot
used under Mac OS X.
The only difference between this interface a... | jrk/gnuplot-py | gp_macosx.py | Python | lgpl-2.1 | 4,519 |
#!/usr/bin/env python
###
# Copyright (C) 2015 The University of Texas at Austin and the
# Institute of Human Machine Cognition. All rights reserved.
#
# This program 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 S... | liangfok/controlit | controlit_goal_generators/nodes/SineWaveGenerator.py | Python | lgpl-2.1 | 7,382 |
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgarren/spack | var/spack/repos/builtin/packages/hpgmg/package.py | Python | lgpl-2.1 | 3,253 |
# ***************************************************************************
# * *
# * Copyright (c) 2015 - Przemo Firszt <przemo@firszt.eu> *
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
# * ... | wood-galaxy/FreeCAD | src/Mod/Fem/FemToolsCcx.py | Python | lgpl-2.1 | 13,533 |
# 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 Libtheora(AutotoolsPackage):
"""Theora Video Compression."""
homepage = "http://www.t... | iulian787/spack | var/spack/repos/builtin/packages/libtheora/package.py | Python | lgpl-2.1 | 1,257 |
import json
import uuid
import etcd
job_id = str(uuid.uuid4())
job = {
"integration_id": "89604c6b-2eff-4221-96b4-e41319240240",
"run": "ceph.flows.CreateECProfile",
"status": "new",
"parameters": {
"ECProfile.name": "ecprofile1",
"ECProfile.k": 3,
"ECProfile.m": 2
},
... | r0h4n/ceph-integration | etc/create_ec_profile.py | Python | lgpl-2.1 | 629 |
import os
from hotdoc.core.extension import Extension
from hotdoc.core.tree import Page
from hotdoc.core.formatter import Formatter
from schema import Schema, SchemaError, And, Use, Optional
PNAME = 'comment-on-github'
HERE = os.path.abspath(os.path.dirname(__file__))
Page.meta_schema[Optional('github-issue-id')] = ... | hotdoc/hotdoc | hotdoc/extensions/comment_on_github/comment_on_github_extension.py | Python | lgpl-2.1 | 2,042 |
import bisect
from enum import Enum
# from markupx.entities.expansion import Expansion
class ExpansionEnum(Enum):
EXPANSION, RESYNC = range(2)
class LineMapper():
def __init__(self, root_expansion):
self._root_expansion = root_expansion
self._process()
def _process(self):
pass... | delins/tweakmark | tweakmark/document.py | Python | lgpl-3.0 | 6,914 |
# Copyright (C) 2016 Thomas H. Gibson
#
# This file is part of FIAT (https://www.fenicsproject.org)
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import numpy as np
from FIAT.discontinuous_lagrange import DiscontinuousLagrange
from FIAT.dual_set import DualSet
from FIAT.finite_element import FiniteElement
from FIA... | FEniCS/fiat | FIAT/hdiv_trace.py | Python | lgpl-3.0 | 15,505 |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: LGPL-3.0-only
class Plan:
def __init__(self, data):
self.id = data.get("id")
self.name = data.get("name")
self.slug = data.get("slug")
self.line = data.get("line")
self.pricing = data.get("pricing")
self.specs = dat... | packethost/packet-python | packet/Plan.py | Python | lgpl-3.0 | 585 |
"""Module for retrieving node information from API."""
from pyvlx.log import PYVLXLOG
from .api_event import ApiEvent
from .frames import (
FrameGetAllNodesInformationConfirmation,
FrameGetAllNodesInformationFinishedNotification,
FrameGetAllNodesInformationNotification,
FrameGetAllNodesInformationReque... | Julius2342/pyvlx | pyvlx/api/get_all_nodes_information.py | Python | lgpl-3.0 | 1,597 |
from pycp2k.inputsection import InputSection
class _each53(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Metad... | SINGROUP/pycp2k | pycp2k/classes/_each53.py | Python | lgpl-3.0 | 1,113 |
"""ZAP Authenticator integrated with the tornado IOLoop.
.. versionadded:: 14.1
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full li... | ellisonbg/pyzmq | zmq/auth/ioloop.py | Python | lgpl-3.0 | 1,369 |
# -*- coding: utf-8 -*-
import btcpay
import names
import pickle
import pprint
import random
import shutil
import tempfile
import uuid
from datetime import datetime, timedelta
from dateutil.relativedelta import *
from PIL import Image, ImageDraw, ImageFont
from flask import Blueprint, current_app, flash, g, jsonify, ... | ser/beton | beton/user/views.py | Python | lgpl-3.0 | 43,165 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'preferences.ui'
#
# Created: Fri Aug 21 20:53:15 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
import commands
import fileinput
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore impo... | GeorgeGkas/WifiFactoryPass-GreekTool | wifitools/preferences.py | Python | lgpl-3.0 | 10,859 |
# Copyright 2016 Casey Jaymes
# This file is part of Expatriate.
#
# Expatriate 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 License, or
# (at your option) any later version.... | cjaymes/expatriate | src/expatriate/model/xshfp/__init__.py | Python | lgpl-3.0 | 1,308 |
"""
Generate address space c++ code from xml file specification
xmlparser.py is a requirement. it is in opcua folder but to avoid importing all code, developer can link xmlparser.py in current directory
"""
import sys
import logging
# sys.path.insert(0, "..") # load local freeopcua implementation
#from opcua import xm... | iirob/python-opcua | schemas/generate_address_space.py | Python | lgpl-3.0 | 14,655 |
from api.v1.pagination import get_pagination_results
from database import db
from database.models import User
def get_users(page=1, per_page=10):
return get_pagination_results(User, page, per_page)
def create_user(data):
name = data['login']
password = data['password']
user_row = User(name, password... | milerjanek/flask_restapi_start_project | api/v1/business/user.py | Python | lgpl-3.0 | 925 |
#!/usr/bin/python
###############################################################################
## contact: abram@isola.mn || https://github.com/aisola/ObjectWeb
## license: LGPLv3
## summary: This document displays an example form with working validation.
## maintainer: Abram C. Isola <abram@isola.mn>
## contrib: Ab... | aisola/ObjectWeb | examples/form-validation.py | Python | lgpl-3.0 | 1,605 |
import yaml
from cfnjsontoyaml.parser.subbuilder import SubBuilder
from cfnjsontoyaml.yamlobject.cfnfunction import CfnFunction
class Sub(CfnFunction):
yaml_tag = u'!Sub'
def __init__(self, value, use_literal=False):
pattern, substitutions = value
if substitutions is None:
value ... | drewsonne/cfn-json-to-yaml | cfnjsontoyaml/yamlobject/sub.py | Python | lgpl-3.0 | 1,572 |
from odoo import models, fields, api
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
base_saas_domain = fields.Char('Base SaaS domain')
current_domain = fields.Char(readonly=True)
domain_change_link = fields.Html(readonly=True)
# current_domain
@api.model
... | thinkopensolutions/odoo-saas-tools | saas_client/models/res_config.py | Python | lgpl-3.0 | 873 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from copy import deepcopy
from typing import cast, Dict, List, Optional
from UM.Application import Application
from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Math.Polygon import Polygon #For typing.
from UM.Scen... | Patola/Cura | cura/Scene/CuraSceneNode.py | Python | lgpl-3.0 | 7,114 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | tests/eve_obj_builder/validator_preconvert/test_rack_collision.py | Python | lgpl-3.0 | 2,585 |
from layout import *
import tkinter
class Image: pass
class PPMImage(Image):
def __init__(self, width, height):
self.pixels = [(255, 255, 255)]*(width*height)
self.height = height
self.width = width
def set_pixel(self, x, y, color):
self.pixels[int(x) + int(y)*self.width] = color
def get_pixel(self, x, y... | tuomas56/garrulous-octo-broccoli | src/painting.py | Python | lgpl-3.0 | 3,613 |
# -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2009 Rene Liebscher
#
# This program 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 License, or (at your option) any
# later ver... | arruda/pyfuzzy | fuzzy/storage/fcl/__init__.py | Python | lgpl-3.0 | 843 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell 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 Foundat... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/test/api/unit/test_unassign_unit.py | Python | lgpl-3.0 | 2,024 |
# -*- coding: utf-8 -*-
"""FIXME: document"""
# Copyright (C) 2017 Chris N. Richardson and Garth N. Wells
#
# Distributed under the terms of the GNU Lesser Public License (LGPL),
# either version 3 of the License, or (at your option) any later
# version.
import dolfin.cpp as cpp
# Extend cpp.Parameters with a __ge... | FEniCS/dolfin | python/dolfin/parameter/__init__.py | Python | lgpl-3.0 | 2,314 |
"""
Integration tests for stem.descriptor.server_descriptor.
"""
from __future__ import with_statement
import os
import datetime
import unittest
import stem.control
import stem.exit_policy
import stem.version
import stem.descriptor.server_descriptor
import test.runner
import test.integ.descriptor
class TestServerDe... | eoinof/stem | test/integ/descriptor/server_descriptor.py | Python | lgpl-3.0 | 14,214 |
#
# GdbLib - A Gdb python library.
# Copyright (C) 2012 Fernando Castillo
#
# This program 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 License, or
# (at your option) any la... | skibyte/gdblib | gdblib/cmdtestcase.py | Python | lgpl-3.0 | 9,531 |
from wakasha import main
if __name__ == '__main__':
main()
| tb0hdan/wakasha | wakasha.py | Python | unlicense | 64 |
# 24/05/2021
def abacaba(n):
r = ""
for i in range(n):
r = r + chr(97 + i) + r
return r
assert abacaba(1) == "a"
assert abacaba(2) == "aba"
assert abacaba(3) == "abacaba"
assert abacaba(4) == "abacabadabacaba"
assert abacaba(5) == "abacabadabacabaeabacabadabacaba"
if __name__ == "__main__":
... | tlgs/dailyprogrammer | Python/easy/e391.py | Python | unlicense | 341 |
# The follwoing file will do in python something similar what is done in
# matllab + CAP. The basic idea is that you can load .root trees using
# the functionality provided by the very nice root_numpy package.
#
# Written by Peter Redl. For comments please Email me at: redl@stanford.edu
# Version 0.0 06/09/2013
#
#... | durcan/capy | LoadFunction.py | Python | unlicense | 11,142 |
from django.conf.urls import patterns, url
from blog import views
from mysite import settings
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^post/(?P<entry_id>\d+)/$', views.detail, name='detail'),
url(r'^(?P<year>\d{4})/(?P<month>(?:\d{1}|\d{2}))$', views.month, name='month'),
... | paulmouzas/blogodrone | blog/urls.py | Python | unlicense | 1,031 |
from rest_framework import viewsets
from .serializers import KidSerializer
from .models import Kid
class KidViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = Kid.objects.all()
serializer_class = KidSerializer
def get_queryset(self):
... | bfrick22/monetary-rewards | mysite/kids/views.py | Python | unlicense | 436 |
import praw
import os
import time
import configparser
#TODO: implement OAuth??? But its so stupid difficult.
class Poster:
def __init__(self):
self.config = configparser.ConfigParser()
self.config.read('authoriteh.ini')
name = self.config.get('reddit_stuff', 'name')
password = se... | xvang/reddit-bots | Thread_bot/poster.py | Python | unlicense | 8,567 |
'''
https://leetcode.com/contest/weekly-contest-185/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons/
'''
class Solution:
def numOfArrays(self, n: int, m: int, k: int) -> int:
mod = 10**9 + 7
sols = dict()
def sol(i, m, k, maxm):
if i == n:
... | jan25/code_sorted | leetcode/weekly185/4_comp_algo.py | Python | unlicense | 806 |
from __future__ import division,print_function
from dm import *
@ok
def _weights():
m= [[1 ,2 ,3 ,4, 0],
[1.1,2.1,3.1,4.1,0],
[1.2,2.1,3.2,4.2,0],
[1 ,2 ,3 ,4, 0],
[1.1,2.1,3.1,4.1,0],
[1.2,2.1,3.2,4.2,0],
[1 ,2 ,3 ,4, 0],
[1.1,2.1,3.1,4.1,0],
[1.2,2.1,3.2,... | txt/evil | dmok.py | Python | unlicense | 591 |
import math
def getQuadNum(n, a, b):
return n**2 + a*n + b
def isPrime(n):
if n > 0:
sqrtN = int (math.sqrt(n))
else:
sqrtN = n
ceil_of_n = math.ceil(sqrtN)
if (n % 2 == 0):
return False
for i in xrange(2, int(ceil_of_n)):
if (n % i == 0):
return False... | arvganesh/Project-Euler-Log | Python/027.py | Python | unlicense | 695 |
#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
... | amitsaha/learning | thrift/gen-py/hello/UserExchange.py | Python | unlicense | 17,721 |
import numpy as np
from collections import OrderedDict
from logger import logger
from seriesly import Seriesly
class MetricHelper(object):
def __init__(self, test):
self.seriesly = Seriesly(
test.test_config.stats_settings.seriesly['host'])
self.test_config = test.test_config
... | dkao-cb/perfrunner | perfrunner/helpers/metrics.py | Python | apache-2.0 | 24,590 |
import logging
import uuid
from kubernetes import client
from kubeflow.fairing import utils
from kubeflow.fairing.builders.base_builder import BaseBuilder
from kubeflow.fairing.builders import dockerfile
from kubeflow.fairing.constants import constants
from kubeflow.fairing.kubernetes.manager import KubeManager
logg... | kubeflow/fairing | kubeflow/fairing/builders/cluster/cluster.py | Python | apache-2.0 | 4,646 |
#!/usr/bin/env python3
import os
import textwrap
import unittest
from pathlib import Path
from python.pip_install.extract_wheels.lib.annotation import Annotation, AnnotationsMap
class AnnotationsTestCase(unittest.TestCase):
maxDiff = None
def test_annotations_constructor(self) -> None:
annotations... | bazelbuild/rules_python | python/pip_install/extract_wheels/lib/annotations_test.py | Python | apache-2.0 | 2,761 |
def profile(s):
""" Takes in a survey and returns a profile of a respondent. A profile of a respondent is a map of questions to preferred answer. A respondent with this profile will answer the given question with some probability in the range (1/m, 1), where m is the number of options. The respondent will choose an... | SurveyMan/SMPy | evaluation/simulation.py | Python | apache-2.0 | 3,014 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | grehx/spark-tk | regression-tests/sparktkregtests/testcases/scoretests/pipeline_funcs.py | Python | apache-2.0 | 1,166 |
__author__ = 'psteam'
"""
Management class for basic vPar operations.
"""
import pxssh
import re
from nova.compute import power_state
from nova import context
from nova import db
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.vir... | leilihh/nova | nova/virt/hpux/vparops.py | Python | apache-2.0 | 22,647 |
from django.db import models
class Item(models.Model):
name = models.CharField(max_length = 50)
def __unicode__(self):
return self.name
class Subitem(models.Model):
item = models.ForeignKey(Item, related_name = 'subitems')
name = models.CharField(max_length = 50)
def __unicode__(... | iamsteadman/bambu-api | testproject/testproject/myapp/models.py | Python | apache-2.0 | 351 |
# -*- coding: utf-8 -*-
#
# Satori documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 5 16:08:17 2017.
#
# 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.
#
# Al... | kadashu/satori | doc/conf.py | Python | apache-2.0 | 5,255 |
from ArubaCloud.base import Request
from datetime import datetime
class GetLoadBalancerNotifications (Request):
def __init__(self, startDate, endDate, loadBalancerID, loadBalancerRuleID, *args, **kwargs):
"""
Get the load balancer notifications for a specific rule within a specifying window time f... | Arubacloud/pyArubaCloud | ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancerNotifications.py | Python | apache-2.0 | 955 |
# ===============================================================================
# Copyright 2016 Jake Ross
#
# 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... | UManPychron/pychron | pychron/canvas/canvas2D/detector_block_canvas.py | Python | apache-2.0 | 1,654 |
# Copyright 2014 Brocade Communications System, 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
#
#... | seamicro/seamicro-ml2 | seamicro_ml2/db/models.py | Python | apache-2.0 | 3,892 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/tests/test_cli/test_operations.py | Python | apache-2.0 | 5,298 |
"""
mapper to map task/job to a work queue
"""
import re
from six import iteritems
from .WorkQueue import WorkQueue, RESOURCE, ACTIVE_FUNCTIONS
class WorkQueueMapper:
# constructor
def __init__(self):
# Initialize maps
self.work_queue_map = {}
self.work_queue_global_dic_by_name = {... | PanDAWMS/panda-jedi | pandajedi/jedicore/WorkQueueMapper.py | Python | apache-2.0 | 7,554 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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... | tensorflow/tensor2tensor | tensor2tensor/data_generators/vqa_utils.py | Python | apache-2.0 | 8,154 |
#!/usr/bin/env python
"""PyQt4 port of the dialogs/findfiles example from Qt v4.x"""
from PySide import QtCore, QtGui
class Window(QtGui.QDialog):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.browseButton = self.createButton("&Browse...", self.browse)
... | cherry-wb/SideTools | examples/dialogs/findfiles.py | Python | apache-2.0 | 6,202 |
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright 2014 CryptoIM Development Team
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
... | oskopek/CryptoIM | cryptoim/xmpp.py | Python | apache-2.0 | 8,198 |
# 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... | DavidNorman/tensorflow | tensorflow/python/data/kernel_tests/dataset_test.py | Python | apache-2.0 | 20,984 |
#!/usr/bin/env python
"""
Converts an image to fit a style given by a texture.
Usage:
convert.py convert <texture> <source> <destination>
convert.py build <source> <destination>
"""
from __future__ import print_function
import numpy as np
import scipy.ndimage as nd
import sys
import skimage.io
from PIL import Im... | jczhang/2dglasses | tools/convert.py | Python | apache-2.0 | 7,065 |
# Copyright 2015 PLUMgrid
#
# 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, softwar... | tuxology/bcc | src/python/bcc/table.py | Python | apache-2.0 | 38,030 |
import enum
from typing import Any, Dict, Iterable, List, Type
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# TODO (SQLAlchemy 1.3). See
# https://bitbucket.org/zzzeek/sqlalchemy/issues/3906/
def enum_values(enum: Type[enum.Enum]) -> List[str]:
return [v.value for v in enum.__members__.valu... | adi-foundry/nycodex | nycodex/db/utils.py | Python | apache-2.0 | 1,263 |
# Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error
# in multiprocessing/util.py _exit_function when running `python
# setup.py test` (see
# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
try:
import multiprocessing
except ImportError:
pass
from setuptools import setup,... | dcramer/django-data-tools | setup.py | Python | apache-2.0 | 856 |
import math
import numpy as np
from filterpy.kalman import unscented_transform, MerweScaledSigmaPoints
from filterpy.kalman import UnscentedKalmanFilter as UKF
class UKF_sigma_model(object):
def __init__(self, dt=0.25, w=1.0):
self.fx_filter_vel = 0.0
self.fy_filter_vel = 0.0
self.fz_filte... | francisc0garcia/autonomous_bicycle | src/old/UKF_sigma_model.py | Python | apache-2.0 | 4,610 |
from contextlib import contextmanager
from subprocess import run, PIPE
def has_changes():
output = run(["git", "status", "--porcelain=2"], check = True, stdout=PIPE).stdout
return len(output) > 0
def force_add(paths):
run(["git", "add", "--force", "--"] + paths, check = True)
def push(remote, force = Fal... | BardurArantsson/bg-stats | build/git.py | Python | apache-2.0 | 817 |
# Copyright 2022 The jax3d 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 wr... | google-research/jax3d | jax3d/projects/nesf/nerfstatic/models/nerf_utils.py | Python | apache-2.0 | 13,141 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-security-private-ca | samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py | Python | apache-2.0 | 1,610 |
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | raybuhr/python-docs-samples | tests/utils.py | Python | apache-2.0 | 4,249 |
# 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... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_tensor.py | Python | apache-2.0 | 13,064 |
#!/usr/bin/env python3
import sys
from scapy.all import (
FieldLenField,
IntField,
IPOption,
Packet,
PacketListField,
ShortField,
get_if_list,
sniff
)
from scapy.layers.inet import _IPOption_HDR
def get_if():
ifs=get_if_list()
iface=None
for i in get_if_list():
if ... | p4lang/tutorials | exercises/mri/receive.py | Python | apache-2.0 | 1,499 |
import unittest
class FooTest(unittest.TestCase):
def test_test(self):
assert 123 == 456
| throwable-one/teamcity-messages | tests/guinea-pigs/diff_assert_error_nums.py | Python | apache-2.0 | 103 |
# Copyright 2016 EMC Corporation
# 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 ... | eharney/cinder | cinder/tests/unit/api/v3/test_snapshots.py | Python | apache-2.0 | 11,628 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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... | platformio/platformio-core | platformio/debug/config/native.py | Python | apache-2.0 | 967 |
import sys
sys.path.insert(1, "../../../")
import h2o
import random
def covtype_getModel(ip,port):
# Connect to h2o
h2o.init(ip,port)
#Log.info("Importing covtype.20k.data...\n")
covtype = h2o.import_frame(path=h2o.locate("smalldata/covtype/covtype.20k.data"))
Y = 54
X = [x for x in range(0,5... | bikash/h2o-dev | h2o-py/tests/testdir_algos/glm/pyunit_NOFEATURE_covtype_getModelGLM.py | Python | apache-2.0 | 1,393 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | vam-google/google-cloud-java | google-cloud-clients/google-cloud-asset/synth.py | Python | apache-2.0 | 1,620 |
#!/usr/bin/env dls-python2.7
"""Write coordinated magnet moves to different outputs.
A PvWriter and a Simulation writer are available to take magnet_jogs.Moves
and apply them to their respective interfaces.
"""
from cothread.catools import caput
from controls import PvReferences, PvMonitors, Arrays
import magnet_jo... | dls-controls/i10switching | writers.py | Python | apache-2.0 | 4,309 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... | Jay-Jay-D/LeanSTP | Algorithm.Python/QuandlImporterAlgorithm.py | Python | apache-2.0 | 3,139 |
#Christian Ng
import random
class Door(object):
wins = 0
losses = 0
wins_Switch = 0
losses_Switch = 0
def __init__(self, type):
self.type = type
def Reveal(self):
if self.type == 1:
Door.wins = Door.wins + 1
else:
Door.losses = Door.losses + 1
def Reveal_Switch(self):
if self.type == 1:
Door.wi... | Laserbear/Python-Scripts | montyhall.py | Python | apache-2.0 | 981 |
from core.api import API
from core.exceptions import *
from core.utils.Colorize import Colorize
from core.utils.check_sanity import *
def main():
# Order of checks is important
checks = [
(
check_environment,
'Check current shell environment',
OPAMConfigurationError... | onyb/dune | runapiserver.py | Python | apache-2.0 | 2,003 |
# 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 ... | oppia/oppia | core/domain/email_manager_test.py | Python | apache-2.0 | 278,880 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/output/elastic.py | Python | apache-2.0 | 8,188 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-error-reporting | google/cloud/errorreporting_v1beta1/types/report_errors_service.py | Python | apache-2.0 | 4,726 |
import tempfile
from pathlib import Path
from pywps import Process, LiteralInput, FORMATS
from pywps.inout.outputs import MetaFile, MetaLink4
from flyingpigeon.subset_base import Subsetter
from flyingpigeon.processes.wpsio import resource, variable, start, end, output, metalink
import ocgis
import ocgis.exc
class S... | bird-house/flyingpigeon | flyingpigeon/processes/wps_subset_wfs_polygon.py | Python | apache-2.0 | 3,342 |