src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Subclass of wx.Panel"""
#-----------------------------------------------------------------------------------------
#Import
try:
#wxPython
import wx
#python std library
import sys
#GRASS modules and packages
from modules.colorrules import Buffere... |
'''
Copyright 2015 University of Auckland
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agre... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... |
import requests
import json
import sys
import re
request_id = 0
def translate(text, source="auto", target=None, preferred_langs=[]):
paragraphs = _split_paragraphs(text)
sentences = _request_split_sentences(paragraphs, source, preferred_langs)
result = _request_translate(sentences, source, target, prefer... |
import sys
import json
import uuid
import base64
import boto3
from historical.constants import CURRENT_REGION
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
def determine_chunk_size(events):
"""Determines the number of event """
... |
<<<<<<< HEAD
def ack(m, n):
"""
Return the Ackermann-Peter function.
Arguments:
m: A nonnegative integer between 0 and 3 inclusive.
n: A nonnegative integer between 0 and 4 inclusive.
Return value: A nonnegative integer
"""
if (not isinstance(m, int)) or (not isinstance(n, int)):
... |
from __future__ import absolute_import, print_function
from datetime import timedelta
from django.db import models
from django.utils import timezone
from jsonfield import JSONField
from sentry.db.models import FlexibleForeignKey, Model
class AuthIdentity(Model):
user = FlexibleForeignKey('sentry.User')
auth... |
"""
Library edit page in Studio
"""
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from selenium.webdriver.support.select import Select
from .component_editor import ComponentEditorView
from .container import XBlockWrapper
fr... |
"""
AWS Lambda platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.aws_lambda/
"""
import base64
import json
import logging
import voluptuous as vol
from homeassistant.const import CONF_NAME, CONF_PLATFORM
import homeas... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.translation import pgettext_lazy
from cradmin_legacy import crapp
from cradmin_legacy.crinstance import reverse_cradmin_url
from cradmin_legacy.viewhelpers import listbuilder
from devilry.devilry_cradmin import devilry_lis... |
"""Manages invocation of ProvTranslator service.
"""
# Copyright (c) 2015 University of Southampton
#
# 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 ... |
# Copyright (c) 2013 Bull.
#
# 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, sof... |
class ICAPResponse (object):
def __init__ (self, version, code, status, headers, icap_header, http_header):
self.version = version
self.code = code
self.status = status
self.headers = headers
icap_len = len(icap_header)
http_len = len(http_header)
icap_end = icap_len
if http_header:
http_len_s... |
import numpy as np
import pytest
from rig.type_casts import (
float_to_fix, fix_to_float,
float_to_fp, fp_to_float,
NumpyFloatToFixConverter, NumpyFixToFloatConverter
)
import struct
sz = {
8: 'b',
16: 'h',
32: 'i',
}
SZ = {k: v.upper() for k, v in sz.items()}
class TestFloatToFix(object):
... |
"""
Student Views
"""
import datetime
import logging
import uuid
import json
import warnings
from collections import defaultdict
from urlparse import urljoin
from pytz import UTC
from requests import HTTPError
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authen... |
"""Test Automation config panel."""
import json
from homeassistant.bootstrap import async_setup_component
from homeassistant.components import config
from tests.async_mock import patch
from tests.components.blueprint.conftest import stub_blueprint_populate # noqa
async def test_get_device_config(hass, hass_client)... |
#! /usr/bin/env python
#
# Copyright (c) 2008-2012 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
# GENI Public License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without rest... |
import imp
from io import StringIO
from pluggdapps.plugin import Plugin, implements
from tayra import BaseTTLPlugin
def __traceback_decorator__( frames ):
from copy import deepcopy
from os.path import basename
def _map2ttl( frame ):
filename = frame.fil... |
# Copyright 2017 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, ... |
# coding:utf-8
#
# Copyright (c) 2010, guo.li <lycying@gmail.com>
# Site < http://code.google.com/p/seeking/ >
# All rights reserved.
# vim: set ft=python sw=2 ts=2 et:
#
import sys
from PyQt5.QtCore import QDir
from PyQt5.QtCore import QLocale
from PyQt5.QtCore import QTranslator
from PyQt5.QtCore import SIGNAL
from... |
#implimentation of a shitty ui system I made 2 years ago in lua
#should be fine
import pygame
true = True;
class Redam:
def __init__(self, telrus):
#create local instance of telrus
self.telrus = telrus;
#self.uielements = {};
self.pygame = telrus.pygame;
def createObject( self, ... |
#!/usr/bin/env python
from extensions import *
from config import page_info
def main():
# Form list of IDs of all posts made to the page
post_ids = [post["id"] for post in execute_query("select id from Posts")]
# Form reaction info for each post made to the page
users = {}
user_names = {}
for post_id in post_i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) 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 Sof... |
import difflib
import subprocess
from . import status
from . import filetype
import tempfile
import shutil
import os
class ChangedFile(object):
def __init__(self, filename, filetype, status):
"""filename is the name of the file relative to the base of the repo
newlines is an array of all the lines... |
import operator
from flask import url_for
import pytest
from talkoohakemisto import serializers
from talkoohakemisto.extensions import db
from tests import factories
@pytest.mark.usefixtures('request_ctx', 'database')
class TestTypeIndex(object):
@pytest.fixture
def types(self):
types = [
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hickle as hkl
import numpy as np
np.random.seed(2 ** 10)
from keras import backend as K
K.set_image_dim_ordering('tf')
from keras.layers import Dropout
from keras.models import Sequential
from keras.lay... |
from __future__ import absolute_import, unicode_literals
import json
import hashlib
from django import forms
from django.conf import settings
from django.db import connections
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.core.exceptions import Validation... |
import ocl
import pyocl
import camvtk
import vtk
import math
def drawPoints(myscreen, clpoints, ccpoints):
c=camvtk.PointCloud( pointlist=clpoints, collist=ccpoints)
c.SetPoints()
myscreen.addActor(c )
if __name__ == "__main__":
print ocl.version()
myscreen = camvtk.VTKScreen()
# tria... |
# 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 required by applicable law or a... |
"""Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The ... |
from __future__ import print_function
from show3d_balls import *
import argparse
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torc... |
#
# Cocos
# http://code.google.com/p/los-cocos/
#
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from pyglet import image
from pyglet.gl import *
from pyglet import font
from cocos.director import *
from cocos.menu import *
from cocos.scene import *
from cocos.layer import *
... |
"""
Represents geometry types/setups: Bragg diffraction, BraggTransmission, Laue diffraction, Laue transmission.
"""
class GeometryType(object):
def __init__(self, description):
"""
Constructor.
:param description: Description of the geometry type, e.g. "Bragg transmission"
"""
... |
"""
SQLite Database Interface for Information
Copyright (c) 2014, 2015 Andrew Hawkins
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
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
ๆๅก็ซฏ
ps:ๆๆฏๅ
็ๅฎlocal.pyๅ็server.py;
ๅ็ฐ๏ผ้คไบๅค็จๆท็ๆ่ทฏๅคๆญ๏ผๅซ็ไปฃ็ ๆ่ทฏๆฏไธ่ด็๏ผ้จๅๆฒกๆๆณจ้๏ผๅฏไปฅๅๅป็ฟป็ฟปlocal.py
'''
from __future__ import absolute_import, division, print_function, \
with_statement
import sys
import os
import logging
import signal
sys.path.insert(0, os.path.join(os.path.dirnam... |
from ...schema import X509_FILE_MODE
from ..base.backend import BaseBackend
from . import converters
from .parser import OpenVpnParser, config_suffix, vpn_pattern
from .renderer import OpenVpnRenderer
from .schema import schema
class OpenVpn(BaseBackend):
"""
OpenVPN 2.x Configuration Backend
"""
sch... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'portScanner.ui'
#
# Created: Tue Apr 29 18:10:30 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except At... |
from django.conf import settings
from celery import Celery, Task
from raven import Client
import usecases
client = Client(settings.SENTRY_DSN)
celery = Celery('tasks')
celery.conf.update(
AWS_ACCESS_KEY_ID=settings.AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY=settings.AWS_SECRET_ACCESS_KEY,
CELERY_TASK_SE... |
########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
from random import randint
from mock import patch
from workflow.steps.util.dns import ChangeTTL, ChangeTTLTo5Minutes, ChangeTTLTo3Hours
from . import TestBaseStep
class FakeDNSProvider(object):
dns_ttl = {}
@classmethod
def update_database_dns_ttl(cls, infra, seconds):
cls.dns_ttl[infra] = secon... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from abc i... |
#!/usr/bin/env python
################################################################################
# Created by Oscar Martinez #
# o.rubi@esciencecenter.nl #
#######################################################... |
from pynet.net import tree
from lxml import etree
import unittest
#TODO create multiple trees and their answer.
s1 = """<root>
<b>
<d></d>
<e></e>
</b>
<c>
<f></f>
</c>
<b>
<e></e>
... |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# 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 notice, this
# l... |
## \file
## \ingroup tutorial_pyroot
## \notebook -js
## This program creates :
## - a one dimensional histogram
## - a two dimensional histogram
## - a profile histogram
## - a memory-resident ntuple
##
## These objects are filled with some random numbers and saved on a file.
##
## \macro_image
## \macro... |
#!/usr/bin/python2
#
#~~Player Functions~~
from superRandom import superRandint, superChoice
from time import sleep
import actions
import monsters
class CreatePlayer(object):
def __init__(self, name):
self.health = 125
self.xp = 0 #TODO: use gained XP to gain levels
self.potions = 0
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import re
import json
import time
import shutil
import threading
import subprocess
import xbmc
import xbmcplugin
import xbmcgui
import xbmcaddon
import xbmcvfs
from resources.lib import chrome_cookies
trace_on = False
addon = xbmcaddon.Ad... |
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.template.defaultfilters import date as date_f
from django.utils.timezone import localtime
from django.utils.translation import ugettext_lazy ... |
#!python3
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read(... |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... |
import ctypes # provides low-level types
class DynamicArray:
"""A dynamic array class akin to a simplified Python list."""
def __init__(self):
"""Create an empty array."""
self._n = 0 # count actual elements
... |
from collections import OrderedDict
import logging
import json
import re
import itertools
import sublime
import sublime_plugin
from ..lib import inhibit_word_completions
from .commandinfo import (
get_command_name,
get_builtin_command_meta_data,
get_builtin_commands,
iter_python_command_classes,
g... |
# -*- coding:utf-8 -*-
_mapToCht = {
u"ๅ": u"ๅ",
u"้ฟ": u"้ฟ",
u"ๅ": u"ๅ",
u"ๆจ": u"ๆจ",
u"ๅ": u"ๅ",
u"ๅ": u"ๅ",
u"ๅ": u"ๅ",
u"็": u"็",
u"็": u"็",
u"่ผ": u"่น",
u"็ฎ": u"็ฎ",
u"่พ": u"่พ",
u"็ข": u"็ค",
u"็ฑ": u"ๆ",
u"้": u"้",
u"้": u"้",
u"ๆฐจ": u"ๆฐจ",
u"ๅฎ": u"ๅฎ",
u"ไฟบ": u"ไฟบ",
u"ๆ": u"ๆ",
... |
import unittest2 as unittest
from plone.testing.z2 import Browser
from Products.CMFCore.utils import getToolByName
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import login
from collective.anonfeedback.testing import\
COLLECTIVE_ANONFEEDBAC... |
from Cookie import SimpleCookie, CookieError
#=================================================================
class WbUrlBaseCookieRewriter(object):
""" Base Cookie rewriter for wburl-based requests.
"""
def __init__(self, url_rewriter):
self.url_rewriter = url_rewriter
def rewrite(self, co... |
# Copyright (c) since 2001, Kisio Digital and/or its affiliates. All rights reserved.
from os import path
from functools import wraps
from datetime import datetime, timedelta
import uuid
import json
import logging
from math import ceil
from flask import url_for, g
import flask
from aniso8601 import parse_datetime, par... |
import datetime
import time
import boto
import redis
import requests
import random
import zlib
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.template.loader import render_to_string
from django.db import IntegrityE... |
#####
# Script to poll API data for DC Metro station
#
# Author: Simon Prickett
#####
import json
import os
import requests
import sys
import time
#####
# Query the WMATA API for data for the station represented
# by stationCode e.g. N06 = Reston Wiehle East
#####
def getStationData(stationCode, apiKey):
url = 'http... |
import csv
from StringIO import StringIO
from projects.exceptions import ProjectImportError
from vcs_support.base import BaseVCS, VCSVersion
class Backend(BaseVCS):
supports_tags = True
supports_branches = True
fallback_branch = 'default'
def update(self):
super(Backend, self).update()
... |
from django.test import TestCase
from django.test.utils import override_settings
from decimal import Decimal as D
from oscar_vat_moss import vat
from mock import Mock
class AddressTest(TestCase):
ADDRESSES = (
# Shipping address attributes # Expected rate
({'line4': 'Vienna',
'country':... |
# This file is part of VertNet: https://github.com/VertNet/webapp
#
# VertNet 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.
#
# VertN... |
import base64
import time
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import tryUrlencode, ss
from couchpotato.core.logger import CPLog
from couchpotato.core.media.movie.providers.base import MovieProvider
from couchpotato.environment import Env
log = CPLog(__name__)... |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
# Work around some new quirk in Gecko that causes this test to fail if
# run via the test harness rather than manually.
sequence.append(KeyComboAction("<Con... |
"""
Form Widget classes specific to the Django admin site.
"""
import copy
from django import newforms as forms
from django.newforms.widgets import RadioFieldRenderer
from django.newforms.util import flatatt
from django.utils.datastructures import MultiValueDict
from django.utils.text import capfirst, truncate_words
... |
from fuel_extension_cpu_pinning.models import CpuPinOverride
from nailgun.api.v1.validators.base import BasicValidator
from nailgun.errors import errors
from nailgun.logger import logger
class CpuPinningValidator(BasicValidator):
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"ti... |
from dataprovider.dataprovider import RedisLiveDataProvider
import tornado.ioloop
import tornado.web
import dateutil.parser
class BaseController(tornado.web.RequestHandler):
def initialize(self):
self.stats_provider = RedisLiveDataProvider().get_provider()
def datetime_to_list(self, datetime):
"""Converts a d... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'generic_progress_bar.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _f... |
import sys
import poplib
import email.parser
import logging
import traceback
from email.message import Message
from typing import Iterable, Dict, Tuple
import gerrit_rest
from add_reviewer import ReviewerFactory, add_reviewers
logger = logging.getLogger('pop3bot')
def mkmailbox(debug=0):
import config
usern... |
# from 3.7 decompyle3/pytest/validate.py
# 3.7 changes changes "and" to use JUMP_IF_FALSE_OR_POP instead of
# POP_JUMP_IF_FALSE
# RUNNABLE!
def are_instructions_equal(a, b, c, d):
return a and (b or c) and d
for a, b, c, d, expect in (
(True, True, False, True, True),
(True, False, True, True, Tru... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 BigML
#
# 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 ... |
"""
Contains a really cheezy quasi-FSM for parsing URL bodies.
"""
def parse_linebreakless_url_str(url_str):
"""
Muddle through a string that contains at least one properly formed URL.
The example submission method results in the URLs running into one long,
un-delimited string.
Rather than requir... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_designer', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='formdefinition',
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Blockstack
~~~~~
copyright: (c) 2014-2015 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Blockstack
Blockstack is free software: you can redistribute it and/or modify
it under the terms of the GNU General... |
#!/bin/env python
#
# AutoPyfactory batch plugin for Condor
#
from CondorGRAM import CondorGRAM
from autopyfactory import jsd
class CondorGT2(CondorGRAM):
id = 'condorgt2'
"""
This class is expected to have separate instances for each PandaQueue object.
"""
def __init__(self, apfqueue, confi... |
"""`main` is the top level module for your Flask application."""
import logging
import json
from flask import Flask, request, redirect, url_for, jsonify
from flask_restful import Resource, Api
from google.appengine.api import users
from google.appengine.ext import deferred
from datetime import datetime
from models.u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python packaging."""
import os
import sys
from setuptools import setup
#: Absolute path to directory containing setup.py file.
here = os.path.abspath(os.path.dirname(__file__))
#: Boolean, ``True`` if environment is running Python version 2.
IS_PYTHON2 = sys.version_i... |
from infoporto.odoo.core.odoo import OdooInstance
class Odoo(object):
# settings
def getCurrency(self):
""" Retrieve currency from Odoo Company settings """
odoo_core = OdooInstance()
# company ID should be dynamic
return odoo_core.read('res.company', 1, ['currency_id'])
... |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import os, sys
from opus_core.database_management.configurations.database_server_configuration import DatabaseServerConfiguration
from opus_core.database_m... |
#!/usr/bin/python3
from pymongo import MongoClient
import os
import os.path
import re
import bs4
import itertools
from bs4 import BeautifulSoup
import utils
class ReferenceItem:
def __init__(self):
self.name = ""
self.module = ""
self.usage = ""
self.short = ""
self.full = ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#################
## Import modules
#################
# pyqt for everything graphical
from PyQt4 import QtGui, QtCore
# get command line parameters
import sys
# walk directories
import glob
# access to OS functionality
import os
# (de)serialize config file
import json
# ... |
import marshal
from time import time
class KVM:
def __init__(self,data=None):
self.data = data or {}
### WRITE ###
def set(self,k,v):
self.data[k] = v
def __setitem__(self,k,v):
self.set(k,v)
def __delitem__(self,k):
if k in self.data: del self.data[k]
def update(self,items):
self.data.update(it... |
"""
Usage:
apiapi.py (all|mutating) [--csv=output_file]
"""
import csv
from policyuniverse import global_permissions
import re
from tabulate import tabulate
TAGS = {
'DATA_PLANE': ['object', 'bucket'],
'CONTROL_PLANE': ['policy', 'attribute', 'permission'],
'MUTATING': ['create', 'delete', 'm... |
"""
Tests for dit.pid.immi.
"""
import pytest
from dit.pid.measures.immi import PID_MMI
from dit.pid.distributions import bivariates, trivariates
def test_pid_mmi1():
"""
Test immi on a generic distribution.
"""
d = bivariates['prob. 1']
pid = PID_MMI(d, ((0,), (1,)), (2,))
assert pid[((0,),... |
#!/usr/bin/env python
import argparse
import calendar
import json
import re
import time
import os
import sys
from datetime import datetime
from time import mktime
DODO_FILE = os.path.join(os.getcwd(), 'DODO')
VERSION = "0.99"
class TerminalColors(object):
"""
Color class for listing out dodos
"""
HE... |
#!/usr/bin/env python
# This file is licensed under the GNU General Public License found at <http://www.gnu.org/licenses>
# email: Mark Janssen <dreamingforward@gmail.com>
"""Dictionary with default values, collision function, and sorted string output."""
import exceptions
import copy
class KeyAlreadyE... |
import pyglet
from math import *
from random import randint
from lib.player import Player
from lib.enemy import Enemy
class Window(pyglet.window.Window):
player = None
enemy_qty = 100
enemy = []
label_mouse_xy = None
mouse_x = 0
mouse_y = 0
# Class initializer
def __init__(self, size_x, size_y, resize... |
from src.base.solution import Solution
from src.tests.part2.q106_test_construct_bitree_in_post_order import ConstructBiTreeInPostOrderTestCases
from src.structures.treenode import TreeNode
class ConstructBiTreeInPostOrder(Solution):
def gen_test_cases(self):
return ConstructBiTreeInPostOrderTestCases()
... |
# from app import db
# FALSE = 0
# TRUE = 1
# class User(db.Model):
# id = db.Column(db.Integer, primary_key = True)
# name = db.Column(db.String(65))
# passed_grader = db.Column(db.SmallInteger, default = FALSE)
# email = db.Column(db.String(120), unique = True)
# umich_id = db.Column(db.Integer,... |
import _plotly_utils.basevalidators
class CategoryorderValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="categoryorder", parent_name="layout.xaxis", **kwargs
):
super(CategoryorderValidator, self).__init__(
plotly_name=plotly_name,
... |
from django.apps.registry import apps as global_apps
from django.db import migrations, router
from .exceptions import InvalidMigrationPlan
from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor:
"""
End-to-end migration execution - ... |
from pycp2k.inputsection import InputSection
class _each13(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... |
import pandas as pd
import numpy as np
def normalize_features(array):
"""
Normalize the features in our data set.
"""
array_normalized = (array-array.mean())/array.std()
mu = array.mean()
sigma = array.std()
return array_normalized, mu, sigma
def compute_cost(features, values, theta):
"""
... |
def get_pca(resource):
"""
calculation of principal components
:param resource: netCDF file containing pressure values for a defined region and selected timesteps
:return pca: sklean objct
"""
from netCDF4 import Dataset, num2date
from flyingpigeon.utils import get_variable
var = get_variable(resource... |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2009-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be... |
"""Template config validator."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASSES_SCHEMA as SENSOR_DEVICE_CLASSES_SCHEMA,
DOMAIN as SENSOR_DOMAIN,
)
from homeassistant.config import async_log_exception, config_without_domain
from homeassistant.const import (... |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
import json
import logging
from django.core import urlresolvers
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext, loader
from django.utils.tra... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'UserPayments'
db.create_table(u'payments_userpayments', (... |
#!/usr/bin/python
# Copyright (c) 2017
# Author: Ray Stojonic
#
# 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, m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.