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 |
|---|---|---|---|---|---|
from django import forms
from ..models import GiftSettings
class GiftSettingsForm(forms.ModelForm):
class Meta:
model = GiftSettings
exclude = ['event', ]
def __init__(self, *args, **kwargs):
super(GiftSettingsForm, self).__init__(*args, **kwargs)
if self.instance.event.arch... | helfertool/helfertool | src/gifts/forms/giftsettings.py | Python | agpl-3.0 | 421 |
import termios, fcntl, sys, os
from brainsquared.publishers.PikaPublisher import PikaPublisher
host = "localhost"
username = "guest"
pwd = "guest"
user = "brainsquared"
device = "openbci"
metric = "tag"
routing_key = "%s:%s:%s" % (user, device, metric)
pub = PikaPublisher(host, username, pwd)
pub.connect()
pub.regi... | CloudbrainLabs/htm-challenge | brainsquared/tests/debug_tools/publishers/tag_publisher.py | Python | agpl-3.0 | 1,100 |
import logging
from copy import copy
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate, get_user_model, login
from django.contrib.auth.views import (
LoginView as LoginBuiltinView,
PasswordChangeDoneView as... | tejoesperanto/pasportaservo | core/views.py | Python | agpl-3.0 | 29,296 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import report_price_list
| Gebesa-Dev/Addons-gebesa | report_price_list/report/__init__.py | Python | agpl-3.0 | 152 |
#!/usr/bin/python
"""
Exp5_Bumpers -- RedBot Experiment 5
Now let's experiment with the whisker bumpers. These super-simple switches
let you detect a collision before it really happens- the whisker will
bump something before your robot crashes into it.
This sketch was written by SparkFun Electronics, with l... | MrYsLab/pymata-aio | examples/sparkfun_redbot/sparkfun_experiments/Exp5_Bumpers.py | Python | agpl-3.0 | 2,938 |
# -*- coding: utf-8 -*-
from flask.ext.restful import fields
from flasgger.utils import swag_from
from flask import g, jsonify
from .. import app
from ..ratelimit import ratelimit
from ..base_resources import BaseItem
from .decorators import requires_auth, generate_auth_token
user_resource_fields = {
"id": fields... | GoteoFoundation/goteo-api | goteoapi/auth/resources.py | Python | agpl-3.0 | 770 |
from django.test import TestCase
from ophasebase.models import Ophase
from staff.models import Person
class StaffModelTests(TestCase):
def setUp(self):
self.ophase = Ophase.objects.create(name="Testophase", is_active=True)
def test_delete(self):
""" On delete of a person object all TUIDs whi... | d120/pyophase | staff/tests/test_model.py | Python | agpl-3.0 | 1,332 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/hazardlib/tests/gsim/boore_atkinson_2008_test.py | Python | agpl-3.0 | 2,453 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import sys
import glob
import argparse
import requests
def convert_ini_to_profile(input_path):
count = 0
# CHANGE THE KEY BEFORE USING THE SCRIPT
headers = {'X-Api-Key': '2EBDBD9A3C224992A9B058DA2C9705C1'}
for filename in glob.glob(input_path + "/*.ini"):
in... | beeverycreative/BEEweb | src/octoprint/server/util/ini_profile_tool.py | Python | agpl-3.0 | 1,229 |
# Copyright 2017 Tecnativa - Pedro M. Baeza
# Copyright 2020 Onestein - Andrea Stirpe
# Copyright 2021 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from werkzeug.urls import url_join
from odoo import _
from odoo.tests import common, tagged
@tagged("-at_... | OCA/social | mail_debrand/tests/test_mail_debrand_digest.py | Python | agpl-3.0 | 2,700 |
##############################################################################
#
# Copyright (c) 2008-2010 SIA "KN dati". (http://kndati.lv) All Rights Reserved.
# General contacts <info@kndati.lv>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the who... | cherrygirl/micronaet7 | crm_quotation/report/quotation_parser.py | Python | agpl-3.0 | 2,489 |
"""
Tests for functionality in openedx/core/lib/courses.py.
"""
import ddt
import six
from django.test.utils import override_settings
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
f... | stvstnfrd/edx-platform | openedx/core/lib/tests/test_courses.py | Python | agpl-3.0 | 3,119 |
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from datetime import datetime, timedelta
from odoo import _, fields, models
from odoo.exceptions import UserError
from odoo.tools.date_utils import date_range
class ResPartner(models.Model):
_name = "res.partner"
_i... | OCA/sale-workflow | sale_delivery_date/models/res_partner.py | Python | agpl-3.0 | 4,411 |
__tags__ = ['SDL1_ignore']
| mark-me/Pi-Jukebox | venv/Lib/site-packages/pygame/tests/touch_tags.py | Python | agpl-3.0 | 28 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User, Group
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save, post_delete
from django.dispatch.dispatcher import receiver
from taggit.models import TaggedItem
from taggit.managers import TaggableM... | atiberghien/makerscience-server | makerscience_profile/models.py | Python | agpl-3.0 | 4,409 |
#!/usr/bin/env python
import codecs
import os
import re
from setuptools import setup, find_packages
def read(*parts):
return codecs.open(os.path.join(os.path.dirname(__file__), *parts), encoding='utf8').read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^_... | jonchang/best-trees | setup.py | Python | agpl-3.0 | 1,084 |
# coding: utf-8
# maposmatic, the web front-end of the MapOSMatic city map generation system
# Copyright (C) 2018 Hartmut Holzgraefe
# 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, eit... | hholzgra/maposmatic | www/maposmatic/apis.py | Python | agpl-3.0 | 20,063 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Romain Bignon, Laurent Bachelier
#
# This file is part of assnet.
#
# assnet 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... | laurentb/assnet | assnet/files.py | Python | agpl-3.0 | 6,662 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('za_hansard', '0003_remove_unique_constraint_with_question_id_number'),
]
operations = [
migrations.AlterField(
m... | mysociety/pombola | pombola/za_hansard/migrations/0004_auto_20190322_1856.py | Python | agpl-3.0 | 458 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | base/tests/models/test_exam_enrollment.py | Python | agpl-3.0 | 6,096 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | learning_unit/ddd/domain/learning_unit_year.py | Python | agpl-3.0 | 6,662 |
# -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2015 Sebastian Ramacher <sramacher@debian.org>
#
# 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 ... | xtaran/debian-devel-changes-bot | DebianDevelChangesBot/utils/madison.py | Python | agpl-3.0 | 1,137 |
#!env/python3
# coding: utf-8
import os.path
from mongoengine import *
from bson.objectid import ObjectId
class User(Document):
firstname = StringField(max_length=255)
lastname = StringField(max_length=255)
email = EmailField(max_length=255)
is_admin = BooleanField()
def export_data(self):
return {
... | REGOVAR/Sandbox | tests/pirus-aio/model.py | Python | agpl-3.0 | 4,450 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 (a... | nischu7/paramiko | paramiko/primes.py | Python | lgpl-2.1 | 5,644 |
import unittest
from unittest.mock import Mock, call
from .storage_backends import FilesystemBackend, BackendFailureException
from ..env import constants
class TestLVMBackend(unittest.TestCase):
def test_lvmcreate_new(self):
dev = FilesystemBackend("uuid", "type")
dev.lvsize = Mock()
dev... | oVirt/ovirt-hosted-engine-ha | ovirt_hosted_engine_ha/lib/storage_backends_test.py | Python | lgpl-2.1 | 2,609 |
# 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)
class Opencv(CMakePackage, CudaPackage):
"""OpenCV is released under a BSD license and hence it's free for both
aca... | iulian787/spack | var/spack/repos/builtin/packages/opencv/package.py | Python | lgpl-2.1 | 18,057 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 (a... | dorianpula/paramiko | paramiko/pkey.py | Python | lgpl-2.1 | 13,906 |
"""Rest API for submitting qarnot jobs in Python."""
# Copyright 2016 Qarnot computing
#
# 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
#
#... | MercenariesEngineering/Coalition | qarnot/__init__.py | Python | lgpl-2.1 | 2,821 |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
# generated by build_iso639a()
LANGUAGECODES = {
'aa': u'Afar',
'ab': u'Abkhazian',
'af': u'Afrikaans',
'ak': u'Akan',
'sq': u'Albanian',
'am': u'Amharic',
'ar': u'Arabic',
'an': u'Aragonese',
'hy': u'Armenian',
'as': u'Assamese',
'av': u'Avaric',
'a... | xiangke/pycopia | core/pycopia/ISO/iso639a.py | Python | lgpl-2.1 | 4,341 |
import sys
from traceHandler import sizeError
try:
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
except RuntimeError as re:
print(re)
sys.exit()
#from inspyred.ec import analysis
from inspyred.ec.analysis ... | KaliLab/optimizer | optimizer/graphic.py | Python | lgpl-2.1 | 113,966 |
#! /usr/bin/env python2
""" The agent bundle, contains all metric classes and agent running code """
from optparse import OptionParser
import base64
import logging
import os
import glob
import re
import socket
import subprocess
import sys
import time
from threading import Thread
import traceback
import signal
import C... | ei-grad/yandex-tank | yandextank/plugins/Monitoring/agent/agent.py | Python | lgpl-2.1 | 25,081 |
from __future__ import absolute_import, print_function, unicode_literals
from . import mode, notation
__all__ = ['mode', 'notation']
del absolute_import, print_function, unicode_literals
| gpg/gpgme | lang/python/src/constants/sig/__init__.py | Python | lgpl-2.1 | 189 |
import clutter
from clutter import cogl
class MultiTexture(clutter.Actor):
__gtype_name__ = 'MultiTexture'
def __init__(self):
clutter.Actor.__init__(self)
self.alpha_tex = self._load_texture('redhand_alpha.png')
self.redhand_tex = self._load_texture('redhand.png')
self.light_... | pmarti/pyclutter | examples/test-multitexture.py | Python | lgpl-2.1 | 2,359 |
# Copyright (c) 2013 Martin Abente Lahaye. - martin.abente.lahaye@gmail.com
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any ... | tchx84/gpaste | gpaste/paste.py | Python | lgpl-2.1 | 1,962 |
#!/usr/bin/env python
"""Moving target over a spinning drum."""
############################
# Import various modules #
############################
from VisionEgg import *
start_default_logging(); watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation, Controller, FunctionC... | visionegg/visionegg | demo/targetBackground.py | Python | lgpl-2.1 | 2,969 |
# Add Polygon
import math
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
import salome_notebook
# create an empty mesh structure
mesh =... | FedoraScientific/salome-smesh | doc/salome/examples/modifying_meshes_ex09.py | Python | lgpl-2.1 | 1,035 |
'''
Tests for the ``gtkunixprint.PrintUnixDialog`` class.
'''
import gtkunixprint
import utils
def test_current_page_number():
'''
Ensure that getting and setting the current page number attribute
works as expected.
'''
printdialog = gtkunixprint.PrintUnixDialog()
for page in range(1, 200):
... | GNOME/testinggtk | tests/test_print_dialog_unix.py | Python | lgpl-2.1 | 1,168 |
#!/usr/bin/python
# vi:si:et:sw=4:sts=4:ts=4
# -*- coding: UTF-8 -*-
# -*- Mode: Python -*-
#
# Copyright (c) 2013 Pietro Bertera <pietro@bertera.it>
# This file is covered by the LGPLv3 or later, read COPYING for details.
import socket
import struct
import re
import sys
import select
import ConfigParser
import os
imp... | pbertera/vq-collector | src/vq-collector/vq-collector.py | Python | lgpl-3.0 | 10,042 |
### XOR problem example for ffnet ###
from __future__ import print_function
from ffnet import ffnet, mlgraph
# Generate standard layered network architecture and create network
conec = mlgraph((2,2,1))
net = ffnet(conec)
# Define training data
input = [[0.,0.], [0.,1.], [1.,0.], [1.,1.]]
target = [[1.], [0.], [0.],... | mrkwjc/ffnet | examples/xor.py | Python | lgpl-3.0 | 1,361 |
from twister_geom import *
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.corbaserver.rbprm.rbprmfullbody import FullBody
from hpp.gepetto import Viewer
from hpp.gepetto import PathPlayer
from numpy import array, sort
from numpy.linalg import norm
import twister_spidey_path as path_planner
import spid... | rlefevre1/hpp-rbprm-corba | script/scenarios/demos/siggraph_asia/twister/twister_spidey.py | Python | lgpl-3.0 | 5,419 |
# -*- coding: utf-8 -*-
"""
This script uses brute force to verify what actions take to make a correct
calibration.
Operations:
Perfect Screen Quadrants Invert X Invert Y Swap XY
+---+---+ +---+---+ +---+---+ +---+---+
| 1 | 2 | | 2 | 1 | ... | MSA-Argentina/adamo-calibrator | adamo_calibrator/tools/axes_inversion_verification.py | Python | lgpl-3.0 | 2,098 |
# Copyright (C) 2007 Jan-Klaas Kollhof
# Copyright (C) 2011-2015 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be ... | ddrager/python-bitcoinlib | bitcoin/rpc.py | Python | lgpl-3.0 | 22,111 |
"""Progress bar allows you to see the progress of long-term operations."""
import concert.config as cfg
import inspect
try:
import tqdm
from tqdm.asyncio import tqdm as atqdm
except ImportError:
cfg.PROGRESS_BAR = False
def wrap_iterable(iterable, **kwargs):
"""Wrap *iterable* so that a progress ba... | ufo-kit/concert | concert/progressbar.py | Python | lgpl-3.0 | 556 |
from pycp2k.inputsection import InputSection
class _each37(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/_each37.py | Python | lgpl-3.0 | 1,113 |
import re
import pytest
from path import Path
import nodely
TEST_DIR = (
Path(__file__) # pylint: disable=no-value-for-parameter
.realpath().dirname())
exec((TEST_DIR / 'variables.py').text())
@pytest.fixture
def node_package():
return NODE_PACKAGE # pylint: disable=undefined-varia... | zimmermanncode/nodely | test/conftest.py | Python | lgpl-3.0 | 694 |
from pycp2k.inputsection import InputSection
from ._point27 import _point27
class _distance_function2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Atoms = None
self.Coefficient = None
self.Pbc = None
self.POINT_list = []
self._name = "DISTANCE... | SINGROUP/pycp2k | pycp2k/classes/_distance_function2.py | Python | lgpl-3.0 | 1,089 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) 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.
#
# This program is distributed in the hope that it will ... | wadobo/suds | suds/properties.py | Python | lgpl-3.0 | 16,229 |
'''
Created on Jun 8, 2018
@author: acaproni
'''
from enum import Enum
class Validity(Enum):
'''
The validity as defined in IasValidity.java
'''
RELIABLE = 1
UNRELIABLE = 0
@staticmethod
def fromString(validityString):
'''
@param validityString: the string repre... | IntegratedAlarmSystem-Group/ias | BasicTypes/src/main/python/IasBasicTypes/Validity.py | Python | lgpl-3.0 | 1,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2006-2013 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/li... | sebastienhupin/qxrad | qooxdoo/tool/pylib/ecmascript/transform/check/check_globals.py | Python | lgpl-3.0 | 2,132 |
from adshli.connection import ads_connection
import adshli.protocol as adsprotocol
from adshli.hli import ads_device, ads_var_single, idx_grp, ads_var_group
import time
plc_ams_id="10.23.23.57.1.1"
plc_ams_port=851
plc_ip_adr="127.0.0.1"
plc_ip_port=48898
pc_ams_id="10.23.23.57.1.12"
pc_ams_port=801
timeou... | simonwaid/adshli | sample_code.py | Python | lgpl-3.0 | 3,890 |
"""Unit tests for intersection computation"""
# Copyright (C) 2013 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN 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 Licens... | akshmakov/Dolfin-Fijee-Fork | test/unit/geometry/python/Issues.py | Python | lgpl-3.0 | 1,717 |
"""
:mod:`dotFsm` -- Generate a graph of a moddy finite state machine
=======================================================================
.. module:: dotFsm
:synopsis: Generate a graph of a moddy finite state machine
.. moduleauthor:: Klaus Popp <klauspopp@gmx.de>
"""
import subprocess
import os
from .fsm imp... | KlausPopp/Moddy | src/moddy/dot_fsm.py | Python | lgpl-3.0 | 5,770 |
"""Raw representations of every data type in the AWS Cloud9 service.
See Also:
`AWS developer guide for Cloud9
<https://docs.aws.amazon.com/cloud9/latest/user-guide/index.html>`_
This file is automatically generated, and should not be directly edited.
"""
from attr import attrib
from attr import attrs
from ... | garyd203/flying-circus | src/flyingcircus/_raw/cloud9.py | Python | lgpl-3.0 | 1,408 |
# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from .src import DigitalFactoryFileProvider, DigitalFactoryOutputDevicePlugin, DigitalFactoryController
def getMetaData():
return {}
def register(app):
... | Ultimaker/Cura | plugins/DigitalLibrary/__init__.py | Python | lgpl-3.0 | 611 |
import unittest
from _parser._word import Word
from _parser._whitespace import WhiteSpace
class TestWordParser(unittest.TestCase):
def setUp(self):
pass
def test_word_parser(self):
string = "this is 0nly."
word_parser = Word()
res1 = word_parser.parse(string)
self.asse... | KenetJervet/rato | test/test_word_parser.py | Python | lgpl-3.0 | 669 |
#!/usr/bin/python
from ovsylib import cliparse, datastruct, fileadding_utils, info
from ovsylib.aggressive_threading import Broker
from gui import mainview
import os,sys
def extractJob(pac, fid, cmdline, filename):
with open(filename, "rb") as binfile:
pac.extract_file_id(fid, cmdline.extract, binfile, d... | agentOfChaos/oversized_syringe | oversized_syringe.py | Python | lgpl-3.0 | 5,007 |
from pycp2k.inputsection import InputSection
class _ic5(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Print_ic_list = None
self.Eps_dist = None
self.Optimize_homo_lumo = None
self.Gw_eigenvalues = None
self.Gw_eigenvalues_beta = None
se... | SINGROUP/pycp2k | pycp2k/classes/_ic5.py | Python | lgpl-3.0 | 850 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of box-linux-sync.
#
# Copyright (C) 2013 Vítor Brandão <noisebleed@noiselabs.org>
#
# box-linux-sync 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... | noiselabs/box-linux-sync | src/noiselabs/box/pms/pacman.py | Python | lgpl-3.0 | 1,225 |
from odoo import api, fields, models
class MailComposer(models.TransientModel):
_inherit = 'mail.compose.message'
@api.onchange('template_id')
def set_partner_ids_domain(self):
template = self.template_id.sudo()
default_partner_domain = {
'domain': {
'partner_... | thinkwelltwd/care_center | care_center_mattermost/models/mail_compose_message.py | Python | lgpl-3.0 | 878 |
import mcpi.minecraft as minecraft
import mcpi.block as Block
import serial
import mcpi.vec3 as vec3
import time
from mcpi_pin import McPin
# The location where redstone torches needs to spawn.
input_pins = {"A5": vec3.Vec3(-22, 1, -44),
"A6": vec3.Vec3(-22, 1, -42),
"A7": vec3.Vec3(-22, 1... | FoamyGuy/mcpi_with_espruino | examples/example_5_virtual_pico/example5_pico_input.py | Python | unlicense | 2,230 |
"""
Returns the array of probability mass function values
for the Random-Integer probability distribution
using the given arrays for the abscissa or template
values and each of the parameters values.
"""
import numpy
import pyferret
import pyferret.stats
DISTRIB_NAME = "Random-Integer"
FUNC_NAME = "pmf"
def ferret_i... | NOAA-PMEL/PyFerret | pyfermod/stats/stats_randint_pmf.py | Python | unlicense | 741 |
from demoapp import app_settings
from demoapp.views import login_view
from django.shortcuts import redirect
from demoapp.utils import get_salt
class PasswordMiddleware(object):
def process_request(self, request):
if request.path in app_settings.UNPROTECTED_PATHS:
return None
if not app... | dboczek/django-demo | demoapp/middleware.py | Python | unlicense | 714 |
from __future__ import unicode_literals
import time
from util import hook, timesince
def db_init(db):
"check to see that our db has the tell table and return a dbection."
db.execute("create table if not exists tell"
"(user_to, user_from, message, chan, time,"
"primary key(user_... | TeamPeggle/ppp-helpdesk | plugins/tell.py | Python | unlicense | 2,187 |
#!/usr/bin/env python3
"""
Pymatrix
========
A lightweight, easy-to-use matrix module in pure Python. Supports a range of
basic linear algebra operations.
Sample syntax::
from pymatrix import matrix
m = matrix([
[1, 2],
[3, 4]
])
a = m + m * 2
b = m * m
c = m ** 3
d = m... | dmulholland/pymatrix | setup.py | Python | unlicense | 1,481 |
import os
@command("notes", man="Usage: '!notes', '!notes add <note>', '!notes remove <line>', '!notes clear'.")
def notes(nick, user, channel, message):
filename = "files/notes/" + user + ".txt"
if message.startswith("add"):
try:
f = open(filename, "a")
f.write(message[4:] + "... | ccowmu/botler | commands/notes.py | Python | unlicense | 1,798 |
# -*- coding: utf-8 -*-
"""Download helper object implementations."""
from __future__ import unicode_literals
import re
from l2tdevtools.download_helpers import project
class GitHubReleasesDownloadHelper(project.ProjectDownloadHelper):
"""Helps in downloading a project with GitHub releases."""
_VERSION_EXPRES... | Onager/l2tdevtools | l2tdevtools/download_helpers/github.py | Python | apache-2.0 | 9,151 |
import sys, getopt
def convert(input_lines):
to_replace={
'ebp': 'rbp',
'ebx':'rdi', 'esp': 'rsp',
'pushl':'pushq', 'movq':'movl',
'ecx':'rsi'}
output_lines=[]
lines_to_exclude=['cfi_restore', 'leave']
for index in range(len(input_lines)):
if 'cfi_def_cfa_offset' in input_lines[index]:
output_l... | scorpionhiccup/201301129_cloud_assignments | Assignment1/translator.py | Python | apache-2.0 | 2,163 |
#!/usr/bin/python
# Filename: mymodule.py
def sayhi():
print('Hi, this is mymodule speaking.')
version = '0.1'
| EstherLacan/jiangfw | python/primary/模块/mymodule.py | Python | apache-2.0 | 116 |
# 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... | chemelnucfin/tensorflow | tensorflow/python/keras/mixed_precision/experimental/keras_test.py | Python | apache-2.0 | 43,595 |
import os
from tests.test_marathon_lb import TestMarathonUpdateHaproxy
def template_option(opt):
return ' option {opt}\n'.format(opt=opt)
base_config_prefix = '''global
log /dev/log local0
log /dev/log local1 notice
spread-checks 5
max-spread-checks 15000
maxconn 50000
tune.ssl.default-... | mesosphere/marathon-lb | tests/test_marathon_lb_haproxy_options.py | Python | apache-2.0 | 3,685 |
# Copyright 2020 Google Research. 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... | google/automl | efficientdet/backbone/efficientnet_builder_test.py | Python | apache-2.0 | 3,951 |
#!/usr/bin/env python
# ******************************************************************************
# Copyright 2014-2018 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
... | NervanaSystems/neon | examples/char_rae.py | Python | apache-2.0 | 5,774 |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS 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
#
#... | epam/DLab | infrastructure-provisioning/src/edge/scripts/reupload_ssh_key.py | Python | apache-2.0 | 2,968 |
# Copyright 2012 Martijn Grendelman <m@rtijn.net>
#
# 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... | tinuzz/taggert | taggert/tsettings.py | Python | apache-2.0 | 1,785 |
"""TcEx Registry"""
# standard library
import functools
from collections.abc import Container
from typing import TYPE_CHECKING, Any, Callable, Tuple, Type, Union
if TYPE_CHECKING:
# third-party
from redis import Redis
# first-party
from tcex.exit.exit import ExitService
from tcex.input.input impor... | ThreatConnect-Inc/tcex | tcex/pleb/registry.py | Python | apache-2.0 | 7,137 |
# 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... | chengduoZH/Paddle | python/paddle/fluid/tests/unittests/test_dyn_rnn.py | Python | apache-2.0 | 12,277 |
#!/usr/bin/env python
a = [2, 4, 6]
b = [3 * num for num in a]
print b
| nkysg/Asenal | script/python/plist2.py | Python | apache-2.0 | 71 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/synthtool | noxfile.py | Python | apache-2.0 | 1,622 |
# Copyright 2014 CloudFounders NV
#
# 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 writ... | mflu/openvstorage_centos | ovs/extensions/db/arakoon/CheckArakoonTlogMark.py | Python | apache-2.0 | 19,580 |
from typing import List
import stp
from rj_gameplay.tactic import pass_tactic
from rj_msgs.msg import RobotIntent
from enum import Enum, auto
class State(Enum):
INIT = auto()
ACTIVE = auto()
ASSIGN_ROLES = auto()
class Keepaway(stp.play.Play):
"""Play that passes repeatedly, effectively playing ... | RoboJackets/robocup-software | rj_gameplay/rj_gameplay/play/keepaway.py | Python | apache-2.0 | 2,552 |
# Copyright 2017 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
#
# Unless required by... | openstack/ironic | ironic/tests/unit/drivers/modules/redfish/test_utils.py | Python | apache-2.0 | 24,004 |
# Copyright 2012 Pinterest.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | adamchainz/pymemcache | pymemcache/test/test_client.py | Python | apache-2.0 | 26,726 |
__author__ = 'Wei Xie'
__email__ = 'linegroup3@gmail.com'
__affiliation__ = 'Living Analytics Research Centre, Singapore Management University'
__website__ = 'http://mysmu.edu/phdis2012/wei.xie.2012'
_stop_words = set([line.strip() for line in open('./twitter-stopwords.txt')])
def contains(word):
return word in ... | linegroup/topicsketch | topicsketch/stop_words.py | Python | apache-2.0 | 332 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2013 TrilioData, Inc.
#
# Licensed under the Apache License, Versio... | DPaaS-Raksha/horizon | openstack_dashboard/api/raksha.py | Python | apache-2.0 | 3,614 |
#! /usr/bin/python
#
# Download all Datafiles from a Dataset from IDS.
#
# The script takes an investigation identifier, a dataset name, and a
# method name files as arguments. The investigation identifier may
# contain one colon, then it is taken as name:visitid, otherwise it is
# taken as the investigation name. Th... | icatproject/python-icat | doc/examples/downloaddata.py | Python | apache-2.0 | 4,853 |
# coding=utf-8
"""Operations for storing and retrieving formatting info on ast nodes."""
# Copyright 2021 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... | google/pasta | pasta/base/formatting.py | Python | apache-2.0 | 1,355 |
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
# pylint: disable=too-many-return-statements
# pylint: disable=too-many-instance-attributes
#
"""A library which provides the ServiceCheck class."""
import subprocess
import time
import logging
import traceback
from threading import Thread
impo... | unixsurfer/anycast_healthchecker | anycast_healthchecker/servicecheck.py | Python | apache-2.0 | 14,073 |
# copyright 2016 twitter. 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 or agree... | srkukarni/heron | integration_test/src/python/integration_test/topology/none_grouping.py | Python | apache-2.0 | 1,365 |
#!/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
"License");... | keedio/keedio-stacks | KEEDIO/1.4/services/GRAFANA/package/scripts/params.py | Python | apache-2.0 | 2,981 |
# coding=utf-8
# Copyright 2018 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... | vthorsteinsson/tensor2tensor | tensor2tensor/layers/common_video.py | Python | apache-2.0 | 20,985 |
from __future__ import division
import numpy as np
class VogelsteinClassifier(object):
"""Oncogene and TSG classifier based on the 20/20 rule.
Essentially the 20/20 rule states that oncogenes have at least
20% recurrent missense mutations. While tumor suppressor genes
have atleast 20% deleterius mutat... | KarchinLab/2020plus | src/classify/python/vogelstein_classifier.py | Python | apache-2.0 | 7,309 |
"""Service Model"""
# standard library
from typing import Optional
# third-party
from pydantic import BaseModel, Field
# first-party
from tcex.input.field_types.sensitive import Sensitive
class ServiceModel(BaseModel):
"""Input Service Model
Supported runtimeLevel:
* ApiService
* TriggerService
... | ThreatConnect-Inc/tcex | tcex/input/models/service_model.py | Python | apache-2.0 | 2,716 |
# -*- coding: utf-8 -*-
#
# 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... | tswast/google-cloud-python | spanner/tests/unit/gapic/v1/test_spanner_client_v1.py | Python | apache-2.0 | 26,426 |
# Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
"""
Unit tests for :mod:`OpenSSL.SSL`.
"""
import datetime
import sys
import uuid
from gc import collect, get_referrers
from errno import ECONNREFUSED, EINPROGRESS, EWOULDBLOCK, EPIPE, ESHUTDOWN
from sys import platform, getfilesystemencoding, version_in... | hynek/pyopenssl | tests/test_ssl.py | Python | apache-2.0 | 141,036 |
# 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
# ... | NeCTAR-RC/heat | heat/tests/test_volume.py | Python | apache-2.0 | 41,457 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# Copyright 2011 Piston Cloud Computing, 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 o... | paulmathews/nova | nova/tests/api/openstack/compute/test_servers.py | Python | apache-2.0 | 200,650 |
""" Auction REST resources """
from flask import g
from flask_restful import Resource, fields, marshal, reqparse
from penelophant import app, auther, crud
from penelophant.helpers.invoice import get_invoice_by_id_or_abort
from penelophant.exceptions import InvoiceAlreadyPaid
import balanced
invoice_fields = {
'id':... | kevinoconnor7/penelophant | penelophant/api/invoice.py | Python | apache-2.0 | 2,333 |
from osdk import osdk
from uuid import UUID
from datetime import datetime
def get_timestamp(o):
return datetime.fromtimestamp(o.metadata['timestamp']).strftime('%Y-%m-%d %H:%M:%S')
def convert_size(size_in_bytes):
sizes = {4: " TiB", 3: " GiB", 2: " MiB", 1: "KiB", 0: "B"}
for i in range(len(sizes), 1, -... | SamYaple/osdk | print.py | Python | apache-2.0 | 1,226 |
###############################################################################
#
# file: stat.py
#
# Purpose: holds base classes used by screens in termsaver
# refer to module documentation for details
#
# Note: This file is part of Termsaver-Figlet plugin, and should not be
# used or exec... | brunobraga/termsaver-figlet | figlet/screen/stat.py | Python | apache-2.0 | 7,524 |
#!/usr/bin/env python
#
# Copyright 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 require... | anthrotype/nototools | nototools/lint_cmap_reqs.py | Python | apache-2.0 | 7,216 |