src stringlengths 721 1.04M |
|---|
"""
The MIT License (MIT)
Copyright (c) 2015-2021 Kim Blomqvist
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... |
from abc import ABCMeta, abstractmethod
from flask_babel import gettext
from sipa.model.fancy_property import ActiveProperty, Capabilities
from sipa.units import format_money
from sipa.utils import compare_all_attributes
class BaseFinanceInformation(metaclass=ABCMeta):
"""A Class providing finance information a... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Episode.title_en'
db.add_column('serie_episode', 'title_en', self.gf('django.db.models.fie... |
'''
* Author: Lukasz Jachym
* Date: 9/14/13
* Time: 5:40 PM
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/.
'''
from collections import namedtuple
from brandi... |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from graphics.generic import Colors
class Pause(QWidget):
def __init__(self):
super().__init__()
self.background_color = "white"
self.create_background()
def create_background(self):
pal = Q... |
from unittest import TestCase
from unittest import TestSuite
from unittest import main
from unittest import makeSuite
from mwstools.parsers.feeds import GetFeedSubmissionListResponse, FeedSubmissionInfo
class TestGetFeedSubmissionListResponseNoNextToken(TestCase):
body = """
<GetFeedSubmissionListRespo... |
"""
This file is very long and growing, but it was decided to not split it yet, as
it's still manageable (2020-03-17, ~1.1k LoC). See gh-31989
Instead of splitting it was decided to define sections here:
- Configuration / Settings
- Autouse fixtures
- Common arguments
- Missing values & co.
- Classes
- Indices
- Serie... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2013 Fabrice Desclaux
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any ... |
#!/usr/bin/env python
# Copyright (c) 2013 Red Hat, 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 applic... |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import pytest
import pytablewriter as ptw
from ...._common import print_test_result
from ....data import (
Data,
headers,
mix_header_list,
mix_value_matrix,
null_test_data_list,
value_matrix,
value_matrix_iter,
va... |
import unittest
import random
import pyrtl
from pyrtl.rtllib import barrel
class TestBarrel(unittest.TestCase):
# @classmethod
# def setUpClass(cls):
# # this is to ensure reproducibility
# random.seed(777906374)
def setUp(self):
pyrtl.reset_working_block()
self.inp_val =... |
import pytest
import fauxfactory
from widgetastic_patternfly import Dropdown
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.markers.env_markers.provider import ONE_PER_TYPE
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.log import logger
pytestmark = [
pyt... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
"""Read an xlsx file into Python"""
# Python stdlib imports
from zipfile import ZipFile, ZIP_DEFLATED, BadZipfile
from sys import exc_info
from io import BytesIO
import os.path
import warnings
# compatibility imports
from openpyxl.compat impor... |
# Generated by Django 2.1.11 on 2021-02-06 22:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pokemon_v2", "0008_auto_20201123_2045"),
]
operations = [
migrations.CreateModel(
name="Pokemo... |
from operator import attrgetter
from nose.tools import assert_raises
from syn.tree.b import Tree, Node, TreeError, do_nothing, identity
from syn.base.b import check_idempotence, Attr
from syn.base_utils import get_typename
from syn.tree.b.tests.test_node import Tst2, tree_node_from_nested_list,\
tree_node_from_nest... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014 Etherios, Inc. All rights reserved.
# Etherios, Inc. is a Division of Digi International.
from se... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Node'
db.create_table(u'nodes_node', (
(u'id', self.gf('django.db.models.fields.... |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... |
# -*- coding: utf-8 -*-
import decimal
from collections import OrderedDict
import textwrap
def isNum(val): # is val number or not ?
"""Check if val is number or not
:param val: value to check
:return: Boolean
"""
try:
float(val)
except ValueError:
return False
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008-2009 Benoit Chesneau <benoitc@e-engura.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... |
#
# Copyright (C) 2010, 2014, 2015 Smithsonian Astrophysical Observatory
#
#
# 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 late... |
# Tuple data structure
sample_tuple = ('Glenn', 'Sally', 'John')
print(sample_tuple)
# First Element of the tuple
print(sample_tuple[0])
y = (1, 9, 15) # New tuple
print(max(y)) # Max value of the tuple
# Tuples are immutable like strings, cannot change the value of tuples
# You cannot sort, reverse or ... |
import numpy as np
import torch
import logging
from eight_mile.utils import listify
import os
import glob
from argparse import ArgumentParser
import baseline
from transformer_utils import TiedEmbeddingsSeq2SeqModel, find_latest_checkpoint
from eight_mile.pytorch.serialize import load_transformer_seq2seq_npz
from eight_... |
# -*- coding: utf-8 -*-
from fabric import api as fabric_api
from fabric.state import env
import os
from solar.core.log import log
from solar.core.handlers.base import TempFileHandler
from solar import errors
# otherwise fabric will sys.exit(1) in case of errors
env.warn_only = True
class AnsibleTemplate(TempFileHa... |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... |
import numpy as np
from scipy.stats import kstest, norm
class LinearRegression(object):
'''Ordinary Least Squares...'''
def __init__(self, X, y, fit_intercept=True):
self.X = X
self.y = y
self.fit_intercept = fit_intercept
self._coeff = None
def fit(self, check_residuals=T... |
from Cython.Distutils import build_ext
import numpy as np
from glob import glob
from setuptools import setup, Extension
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved
Programming Language :: Python
Programming... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import division, print_function, unicode_literals
from collections import defaultdict
fro... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import numpy as np
import sympy as sym
import functools as ft
import atexit
from pymatopt.optimmatlab import init, deinit, fmincon
from utils import print
import nonlinprog.spec as spec
import settings
in... |
import dilap.geometry.tools as dpr
from dilap.geometry.vec3 import vec3
from dilap.geometry.quat import quat
import dilap.core.plotting as dtl
import matplotlib.pyplot as plt
import unittest,numpy,math,random
#python3 -m unittest discover -v ./ "*tests.py"
class test_vec3(unittest.TestCase):
# given a vec3, ... |
# coding: utf-8
#
# Copyright 2017 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 requi... |
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
#!/usr/bin/env python
# XML Report Generator Module for Wapiti Project
# Wapiti Project (http://wapiti.sourceforge.net)
#
# David del Pozo
# Alberto Pastor
# Copyright (C) 2008 Informatica Gesfor
# ICT Romulus (http://www.ict-romulus.eu)
#
# This program is free software; you can redistribute it and/or modify
# it und... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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 ... |
import argparse
import tensorflow as tf
from docqa.data_processing.qa_training_data import ParagraphAndQuestion, ParagraphAndQuestionSpec
from docqa.data_processing.text_utils import NltkAndPunctTokenizer
from docqa.elmo.lm_qa_models import ElmoQaModel
from docqa.model_dir import ModelDir
"""
Script to run a model o... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from django.utils.translation import ugettext as _
from biz.djangoapps.gx_member.models import Member
FIELD_GROUP_CODE = 'group_code'
FIELD_CODE = 'code'
FIELD_EMAIL = 'email'
FIELD_FIRST_NAME = 'first_name'
FIELD_LAST_NAME = 'last_name'
FIELD_PASSWORD = 'pas... |
# Test name = Settings
# Script dir = R:\Stingray\Tests\Settings\11-Antenna\11-Antenna.py
from time import sleep
from device import handler, updateTestResult
import RC
import UART
import DO
import GRAB
import MOD
import os
from DO import status
def runTest():
status("active")
TestName = "Settings"
Scrip... |
"""
This file contains the outline of an implementation to load environment modules
(http://modules.sourceforge.net/).
This is a community contributed feature and the core Galaxy team does utilize
it, hence support for it will be minimal. The Galaxy team eagerly welcomes
community contribution and maintenance however.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from sys import path
from django.db import models, migrations
from django.core import serializers
fixture_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../fixtures'))
fixture_filename = 'emailtemplate.json'
def deserialize_fi... |
from PyQt5.QtCore import pyqtProperty, pyqtSlot, pyqtSignal, QObject, Q_CLASSINFO
from PyQt5.QtQml import QQmlListProperty
import os
HEADER_SIZE = 21
PNG_HEADER = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00'
JPG_HEADER = b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff'
class ImageDescriptor(Q... |
#! /usr/bin/env python
from sphinxcontrib import mat_documenters as doc
from nose.tools import eq_, ok_
import os
from pprint import pprint
DIRNAME = doc.MatObject.basedir = os.path.abspath(os.path.dirname(__file__))
def test_ellipsis_after_equals():
"""
test function with ellipsis after equals
... |
#!/usr/bin/python
# interpolate scalar gradient onto nedelec space
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from dolfin import *
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
#import matplotlib.pylab as plt
import PETScIO as IO
import common
import ... |
# ylplines - Clarity for Yelp
# Copyright (C) 2016 Jeff Lee
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This ... |
#!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... |
from EndiciaXmlBuilder import EndiciaXmlBuilder
from EndiciaXmlBuilder import ValueToLongError
from lxml.builder import E
class ChangePassPhraseXmlBuilder( EndiciaXmlBuilder ):
xml = {}
def __init__( self ):
EndiciaXmlBuilder.__init__( self )
def setPartnerID( self, __id ):
if len( __id ) <= 50:
self.xml[... |
import codecs
import os
import re
from setuptools import setup, find_packages
###################################################################
NAME = "nicetypes"
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", "nicetypes", "__init__.py")
KEYWORDS = ["class", "attribute", "boilerplate"]
CLAS... |
#!/usr/bin/env python
#
# Copyright (C) 2011-2016 Nexedi SA
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This ... |
# Copyright 2020 Jigsaw Operations 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 i... |
# 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 Li... |
__author__ = 'Lucian'
from poker_combinations import get_combo_name
from sort import sort_high_to_low, sort_by_color
from const import values, colors, color_names
import time
def get_deck():
deck = []
for i, color in enumerate(colors):
for value in list(reversed(values)):
deck.a... |
from .Nodes import *
# Begin -- grammar generated by Yapps
import sys, re
from yapps import runtime
class R7RSScanner(runtime.Scanner):
patterns = [
('"do"', re.compile('do')),
('"if"', re.compile('if')),
('"set!"', re.compile('set!')),
('""', re.compile('')),
('"\\."', re.... |
"""
Copyright 2010 Daniel Graziotin <daniel.graziotin@acm.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 a... |
# import logging
# logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
#
# from gensim import corpora
#
# documents = ["Human machine interface for lab abc computer applications",
# "A survey of user opinion of computer system response time",
# "The EPS ... |
# -*- encoding: utf-8 -*-
from django.shortcuts import render, redirect
from django.contrib.auth import logout
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.views.decorators.csrf import csrf_exempt
import json
from... |
"""
Test the SLURM options generator.
"""
import unittest
import benchbuild.utils.requirements as req
class TestSlurmOptions(unittest.TestCase):
"""
Checks base slurm options methods.
"""
def test_script(self):
"""
Checks that the correct sbatch option get's generated.
"""
... |
#-*- coding: utf-8 -*-
from pyplotter import __version__
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
import subprocess
def convert(source, from_format, to_format):
p = subprocess.Popen(['pandoc', '--from=' + from_format, '--... |
import unittest
import django
from django.db import IntegrityError
from django.conf import settings
from django_migration_testcase import MigrationTest
from django_migration_testcase.base import InvalidModelStateError, idempotent_transaction
class ExampleMigrationTest(MigrationTest):
before = '0001_initial'
... |
from latex import LatexParser
class TestLatexParser:
def test_parser(self):
self.parser = LatexParser(self.document)
assert self.parser.getResult().getDocument() == r"""\documentclass[11pt,a4paper,oneside]{report}
\usepackage{pslatex,palatino,avant,graphicx,color}
\usepackage[margin=2cm]{geometry}... |
# 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... |
""" Class to work with Salesforce Metadata API """
from base64 import b64encode, b64decode
from xml.etree import ElementTree as ET
import sfdclib.messages as msg
class SfdcMetadataApi:
""" Class to work with Salesforce Metadata API """
_METADATA_API_BASE_URI = "/services/Soap/m/{version}"
_XML_NAMESPACES... |
# Get prefix sum array, find n-k window for which n-k is minimum.
class Solution:
def maxScore(self, cardPoints: List[int], k: int) -> int:
n = len(cardPoints)
pSum = [0] * n
pSum[0] = cardPoints[0]
for i in range(1, n):
pSum[i] = cardPoints[i] + pSum[i-1]
... |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2017 Nest Labs, 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/lic... |
__author__ = 'bromix'
from six import string_types
import xbmc
import xbmcgui
from ..abstract_context_ui import AbstractContextUI
from .xbmc_progress_dialog import XbmcProgressDialog
from .xbmc_progress_dialog_bg import XbmcProgressDialogBG
from ... import constants
from ... import utils
class XbmcContextUI(Abstra... |
import mauto
from nose import with_setup
def setup():
return mauto.new_macro("testsuite")
def setup_in_memory():
return mauto.new_macro("testsuite", save=False)
def teardown():
mauto.remove_macro("testsuite")
@with_setup(setup, teardown)
def test_list_macros():
return len(mauto.list_macros()) >=... |
import pygame
from Game.Scenes.Scene import Scene
from Game.Shared import *
from Game import Highscore
class GameOverScene(Scene):
def __init__(self, game):
super(GameOverScene, self).__init__(game)
self.__playerName = ""
self.__highscoreSprite = pygame.image.load(GameConst... |
# -*- coding: utf-8 -*-
"""
Django settings for zshoes project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_lite... |
#!/usr/bin/env python3
from adc import ADS1115, ADCFilter
from settings import UR, SUPPLY_TANK_CONFIG
class LinearInterpolation:
"""
Interpolate a 1-D function.
`x` and `y` are arrays of values used to approximate some function f: ``y = f(x)``.
"""
def __init__(self, x, y):
if len(x) !=... |
# Standard Library Imports
from datetime import datetime
# 3rd Party Imports
# Local Imports
from PokeAlarm import Unknown
from PokeAlarm.Utilities import MonUtils
from PokeAlarm.Utils import (
get_gmaps_link, get_move_type, get_move_damage, get_move_dps,
get_move_duration, get_move_energy, get_pokemon_size,
... |
"""Support for Z-Wave."""
import asyncio
import copy
from importlib import import_module
import logging
from pprint import pprint
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import callback, CoreState
from homeassistant.helpers import discovery
from homeassistant.helpers.... |
# Copyright 2014 The Android Open Source Project
#
# 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 a... |
from pybuilder.core import use_plugin, init, Author
use_plugin("python.install_dependencies")
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.distutils")
use_plugin('copy_resources')
use_plugin("python.coverage")
authors = [Author('Marco Hoyer', 'marco.hoyer@immobilienscout24.de')]
descript... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... |
from __future__ import unicode_literals
import Queue as queue
import logging
import os
import stat
import string
import threading
import urllib
import urlparse
import glib
logger = logging.getLogger(__name__)
XDG_DIRS = {
'XDG_CACHE_DIR': glib.get_user_cache_dir(),
'XDG_CONFIG_DIR': glib.get_user_config_d... |
import time
import logging
import datetime
import paho.mqtt.client as mqtt
from apscheduler.schedulers.background import BlockingScheduler
logging.basicConfig(format=u'%(filename)s [LINE:%(lineno)d]#%(levelname)-8s [%(asctime)s] %(message)s',
level=logging.WARNING, filename='./alarm.log')
BROKER... |
from lxml.html import fromstring as etree_fromstring
import requests
from argparse import ArgumentParser
from pathlib import Path
from os import chdir
from sys import exit
import pprint
import subprocess
parser = ArgumentParser()
parser.add_argument("url", type=str, help="Url of the Erome Playlist")
parser.add_argumen... |
#! /usr/bin/env python
# ===========================================================================================#
# This script tests the offset angle dependence of the instrumental response function.
#
# ===========================================================================================#
from gammalib impo... |
import wx
from gears import Gear, InternalGear
class GearPanel(wx.Panel):
def __init__(self, parent, gear=None, margin=10):
self.gear = gear
wx.Panel.__init__(self, parent, -1)
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.Bind(wx.EVT_SIZE, self.on_size)
self.Bind(wx.EVT_... |
# Copyright (C) 2015-2019 Magenta ApS, https://magenta.dk.
# Contact: info@magenta.dk.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import tempfile
i... |
# -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... |
def get_building(quadrangle, room_number):
"""Finds and returns the building that a room is in for a specific quadrangle, or None"""
quadrangle = quadrangle.lower()
def in_ranges(ranges):
"""Determines if a room is in a list of ranges (each specified by tuples)"""
for first, last in ranges... |
#!/usr/bin/env python
from __future__ import print_function
import sys
import traceback
from chickenpie import opcodes
from chickenpie.vm import Machine
def boot(argv=sys.argv):
m = Machine()
m.load_file(argv[1])
if len(argv) >= 3:
m.load_input(argv[2])
return m
def input_reader():
EX... |
# encoding: utf-8
import couchdb
from optparse import make_option
from hudjango.management.couchdb.support import CouchDBBaseCommand
from django.core.management.base import CommandError
class Command(CouchDBBaseCommand):
help = """ Creates a new couchdb database. """
option_list = CouchDBBaseCommand.option_l... |
# -*- coding: utf-8 -*-
# Author: Mikhail Polyanskiy
# Last modified: 2017-04-09
# Original data: Adachi and Taguchi 1991, https://doi.org/10.1103/PhysRevB.43.9569
import numpy as np
import matplotlib.pyplot as plt
π = np.pi
# parameters from table II
E0 = 2.69 #eV
Δ0 = 3.10-E0 #eV
G0 = 0.017 #eV
A = 23.4 ... |
##############################################################################
#
# 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 ... |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
from typing import List
import astroid
from pylint import checkers, interfaces
from pylint.checkers import utils
class LenChecker(checkers.BaseChecker):
"""Checks f... |
"""This module serves as a mock object for the DB-API 2 module"""
threadsafety = 2
class Error(Exception):
pass
class DatabaseError(Error):
pass
class OperationalError(DatabaseError):
pass
class InternalError(DatabaseError):
pass
class ProgrammingError(DatabaseError):
pass
def connect(d... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Stock Transactions"),
"items": [
{
"type": "doctype",
"name": "Stock Entry",
"description": _("Record item movement."),
},
{
"type": "doctype",
"name": "Delivery Note",
... |
# Copyright 2015 Jared Rodriguez (jared.rodriguez@rackspace.com)
# 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/LICENS... |
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# 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 Found... |
import numpy as np
import matplotlib.pyplot as plt
from grid_world import standard_grid, negative_grid
from iterative_policy_evaluation import print_values, print_policy
# NOTE: this is only policy evaluation, not optimization
# we'll try to obtain the same result as our other MC script
from monte_carlo_random import... |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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:... |
#!/usr/bin/env python
#
# http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
#
import sys, os, time, atexit
from signal import SIGTERM
class Daemon(object):
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""
def __init__(self, pidfile, stdi... |
"""
Tests for the Certificate REST APIs.
"""
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from certificates.models import CertificateStatuses
from certificates.tests.factories import GeneratedCertificateFactory
from course_modes.models impor... |
#!/usr/bin/python3
from IPython import embed
from gi.repository import Gst
from gi.repository import Gtk
import subprocess
from gi.repository.Gtk import Stack, StackTransitionType
from gi.repository import Gtk, Gio, GLib, Gdk, Notify
from .window import Window
class Application(Gtk.Application):
def __init__(self... |
# Copyright 2012 Lukas Kemmer
#
# 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... |
from payex.handlers import BaseHandler
class PxAgreementHandler(BaseHandler):
"""
Base handler for PxAgreement methods.
"""
production_url = 'https://external.payex.com/pxagreement/pxagreement.asmx?WSDL'
testing_url = 'https://external.externaltest.payex.com/pxagreement/pxagreement.asmx?WSDL'
... |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
"""Factories for models"""
import random
import factory
from ggrc import db
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.