src stringlengths 721 1.04M |
|---|
# Beware! Only tested for non-spin-polarized case
import re
import sys
import rlcompleter
import readline
#from numpy import *
from enterfi import enterfi
from outputfi import outputfi
gridfname = enterfi("Enter VASP field data (CHGCAR, LOCPOT, etc.)")
outfname = outputfi("Enter output file name ")
gridfi = open(grid... |
__author__ = 'xiefei'
import sys
import time
import datetime
import binascii
stu = {
'IDT_TT': 'TT' ,
'IDT_ST' : 'ST' ,
'IDT_RGZS' : 'RGZS' ,
'IDT_PIC' : 'PIC' ,
'IDT_DRP' : 'DRP' ,
'IDT_DRZ1' : 'DRZ1' ,
'IDT_DRZ2' : 'DRZ2' ,
'IDT_DRZ3' : 'DRZ3' ,
'I... |
"""
Convenient shortcuts to manage or check object permissions.
"""
from __future__ import unicode_literals
from django.contrib.auth.models import Group
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import... |
from PIL import Image
from copy import copy
from os.path import join
from glob import glob
import functools
__all__ = ["pack_images"]
class Rect(object):
"""Represent a rectangle in the BinPack tree."""
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1 # bottom
self.x2 = x... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... |
# coding: utf-8
#
# Copyright (C) 2016 Savoir-faire Linux Inc. (<www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licens... |
#!/usr/bin/env python3
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Dave Jones <dave@waveform.org.uk>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# i... |
import vtk
import time
import numpy as np
from director import transformUtils
from director.timercallback import TimerCallback
from director import propertyset
from collections import OrderedDict
class OrbitController(TimerCallback):
def __init__(self, view):
TimerCallback.__init__(self)
self.view... |
import json
import sys
from django.test import SimpleTestCase, ignore_warnings
from django.utils import text
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import lazystr
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy, override
I... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from translate.convert import po2mozlang, test_convert
from translate.misc import wStringIO
from translate.storage import po
class TestPO2Lang:
def po2lang(self, posource):
"""helper that converts po source to .lang source without requiring files"""
... |
# Standard library
from __future__ import print_function
import datetime
from functools import partial
import json
import random
import string
import sys
from textwrap import dedent
import uuid
from xml.sax.saxutils import escape as xml_escape
# Application modules
from txcas.ca_trust import createCustomPolicyFactoryF... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
depend... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import json
from datetime import timedelta
from erpnext.controllers.queries import get_match_cond
fr... |
"""
Copyright (c) 2017, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import (
Typed, ForwardTyped, Range, Instance, observe, set_default
)
from datetime import dateti... |
#!/usr/bin/env python
"""
Python tests for Mime-Type Parser.
This module loads a json file and converts the tests specified therein to a set
of PyUnitTestCases. Then it uses PyUnit to run them and report their status.
"""
import json
import unittest
import mimeparse
__version__ = "0.1"
__author__ = 'Ade Oshineye'
_... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indire... |
#
# Copyright (C) 2013 Savoir-Faire Linux Inc.
#
# This file is part of Sageo
#
# Sageo 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 optio... |
#
# Copyright (c) 2014-2015 The developers of Aqualid project
#
# 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, mo... |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
"""
based on
http://trac.edgewall.org/browser/plugins/0.12/spam-filter-captcha/tracspamfilter/filters/httpbl.py
BSD license: http://trac.edgewall.org/wiki/TracLicense
"""
import logging
from dns.resolver import query, Timeout, NXDOMAIN, NoAnswer, NoNameservers
log = logging.getLogger()
class HoneypotChecker(object):
... |
"""Exports proof logs to OCaml files to be loaded by HOL Light.
Processes multiple proof logs, but can generate at most one proof per theorem.
"""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import tensorflow as tf
from typing... |
#!/usr/bin/python
from __future__ import division
from pycious.widgets.system import BatteryTextWidget, DateTextWidget, CPUGraphWidget
from pycious.widgets.web import MailTextWidget, GrssTextWidget
from pycious.api.timer import Timer
from pycious.api.widget import ImageBoxWidget
if __name__ == "__main__":
# ... |
import contextlib
from builtins import object
import lexicon.client
from lexicon.common.options_handler import SafeOptions, env_auth_options
import pytest
import vcr
import os
# Configure VCR
provider_vcr = vcr.VCR(
cassette_library_dir='tests/fixtures/cassettes',
record_mode='new_episodes',
... |
"""Calculate P/L.
Relies on Python 3 float division.
"""
import math
import numpy as np
import pandas as pd
class PnL(object):
COMMISSION = 25 # basis points: see e.g. https://gemini.com/fee-schedule/
def calc_pnl(self, x, y, price_col="Open"):
"""Calculate P/L. x is dataframe of price, with pric... |
import openpnm as op
import scipy as sp
import pytest
class ExtrasTest:
def setup_class(self):
ws = op.Workspace()
def teardown_class(self):
ws = op.Workspace()
ws.clear()
def test_initialize_GenericNetwork_without_args(self):
net = op.network.GenericNetwork()
as... |
from eg_networksender import Send
class eg_tv_feature(object):
def __init__(self, device):
self._device = device
@property
def name(self):
return 'tv'
@property
def version(self):
return 1
@property
def description(self):
return "Control TV using evenghos... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from numpy import *
import sys
import datetime
datafile1="life_host_icc.out"
datafile2="life_host_gnu.out"
datafile3="life_host_pgi.out"
if len(sys.argv) > 1:
datafile=sys.argv[1]
plotfile="compilers_perf_eurora.png"
data1 = loadtxt(datafile... |
import shopify
from test.test_helper import TestCase
class ApiVersionTest(TestCase):
"""
Api Version Tests
"""
def tearDown(self):
shopify.ApiVersion.clear_defined_versions()
shopify.ApiVersion.define_known_versions()
def test_unstable_api_path_returns_correct_url(self):
... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Rack table.
"""
from datetime import datetime
from sqlalchemy import CHAR
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy impo... |
#!/usr/bin/python
#
# examples/xdamage.py -- demonstrate damage extension
#
# Copyright (C) 2019 Mohit Garg <mrmohitgarg1990@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... |
import collections
from .bundled.traitlets \
import \
HasTraits, Dict, Instance, List, Long, Unicode
from .errors \
import \
DepSolverError, MissingPackageInfoInPool
from .package \
import \
PackageInfo
from .repository \
import \
Repository
from .requirement \
impor... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications copyright (C) 2017 Uber Technologies, 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.apa... |
import io
import os
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
def read(*names, **kwargs):
"""Read a file."""
return io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
).read()
def pars... |
import copy
import json
import os
from collections import defaultdict
from subprocess import check_output
from time import strftime
from metal.utils import recursive_transform
class LogWriter(object):
"""Class for writing simple JSON logs at end of runs, with interface for
storing per-iter data as well.
... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# 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 requi... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
#!/usr/bin/python3
# coding: utf-8
import os
import sys
import subprocess as sp
if __name__ == "__main__":
if(len(sys.argv) == 1):
print("usage: python", sys.argv[0], "TAGET_DIR", "[N_ARRAY]")
exit(1)
parent_dir = sys.argv[1]
print("TARGET_DIR:", parent_dir)
if(len(sys.argv) > 2):
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo
import odoo.tests
class TestReports(odoo.tests.TransactionCase):
def test_reports(self):
product1 = self.env['product.product'].create({
'name': 'Mellohi',
'default_code':... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 8 20:25:18 2017
@author: sitibanc
"""
import numpy as np
from scipy import signal
from PIL import Image
def gen2DGaussian(stdv, mean, h, w):
x, y = np.meshgrid(np.linspace(-1, 1, w), np.linspace(-1, 1, h))
d = np.sqrt(x ** 2 + y ** 2)
... |
import xml.etree.ElementTree as ET
import ConfigParser
import SimpleHTTPServer
import SocketServer
import os
from LedWiz import LedWiz
from LedHttp import LedHttp
from gpio import ArcadeGpio
from GameData import GameData
from PinMap import PinMap
from DeviceManager import DeviceManager
from Sequencer import Sequencer
... |
"""Clowder command line status controller
.. codeauthor:: Joe DeCapo <joe@polka.cat>
"""
import argparse
from typing import Tuple
import clowder.util.formatting as fmt
from clowder.clowder_controller import CLOWDER_CONTROLLER, print_clowder_name, valid_clowder_yaml_required
from clowder.config import Config
from cl... |
import os
import platform
import textwrap
import unittest
import pytest
import six
from conans.client.runner import ConanRunner
from conans.client.tools import environment_append
from conans.test.utils.mocks import TestBufferConanOutput
from conans.test.utils.tools import TestClient
class RunnerTest(unittest.TestCa... |
from __future__ import absolute_import
import os
import tempfile
import hashlib
from ast import literal_eval
import base64
import datetime
import logging
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.db import models
from django.utils.translation import uge... |
# This file is part of the Perspectives Notary Server
#
# Copyright (C) 2011 Dan Wendlandt
# Copyright (C) 2011 Ondrej Mikle, CZ.NIC Labs
#
# 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 Founda... |
"""
Tests - Deuce Client - Common - Validation - Instances
"""
import mock
from unittest import TestCase
from stoplight import validate
import deuceclient.api as api
import deuceclient.common.validation_instance as val_instance
import deuceclient.common.errors as errors
from deuceclient.tests import *
from deuceclien... |
# Copyright 2015 Michael Frank <msfrank@syntaxjockey.com>
#
# This file is part of Mandelbrot.
#
# Mandelbrot 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 opti... |
#!/usr/bin/python2
# TODO: Add description.
import psycopg2
import networkx as nx
# TODO: Create a class for storing artists' SDN and path to avoid doing this.
SDN = 0
PATH = 1
# Load graph from disk
graph = nx.read_gexf("graph/sdn-unweighted.gexf")
# Initialize dictionary with the Snoop Dogg as the base case
arti... |
import numpy
import pypot.primitive
def sinus(ampl,t,freq=0.5, phase=0, offset=0):
pi = numpy.pi
return ampl * numpy.sin(freq * 2.0 * pi * t + phase * pi / 180.0 ) + offset
class SimpleBodyBeats(pypot.primitive.LoopPrimitive):
'''
Simple primitive to make Poppy shake its booty following a given beat... |
from pathlib import Path
from support import RpgTestCase
from rpg.command import Command
import subprocess
class PluginEngineTest(RpgTestCase):
def test_command_concat(self):
cmd = Command("cd %s" % self.test_project_dir)
cmd.append("cmake ..")
cmd.append(["make", "make test"])
se... |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
"""A multi-producer, multi-consumer queue."""
from time import time as _time
try:
import threading as _threading
except ImportError:
import dummy_threading as _threading
from collections import deque
import heapq
__all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']
class Empty(Exception):
"... |
#By: Guy Fisher, @guyisit
#More at https://github.com/guyisit/photobooth ; https://hackaday.io/project/6625-raspberry-pi-photobooth
#
#Inspired/ helped by:
#http://www.instructables.com/id/Raspberry-Pi-photo-booth-controller/?ALLSTEPS
#http://code.activestate.com/recipes/362879-watermark-with-pil/
#https://github.com/j... |
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# vim:fenc=utf-8:
"""The EC2 librart provide a number of functions and modules to
handle EC2 cloud resources, like instance, volumes and so on.
Example of usage in host definitions::
from mico.lib.aws.ec2 import *
ec2_run('ami-12345')
"""
import time
from os ... |
import atexit
import cmd
import ConfigParser
import os
import socket
import threading
import traceback
import sys
from ispyd.shell import RootShell
class ShellManager(object):
def __init__(self, config_file):
self.__config_file = config_file
self.__config_object = ConfigParser.RawConfigParser()
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import str
import argparse
import errno
import inspect
import os
import shutil
import sys
import time
from datetime import timedelta
from synapseclient.exce... |
# Copyright 2015 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... |
import os.path
import os
PATH = os.path.abspath(os.path.dirname(__file__))
def relative(path):
return os.path.abspath(os.path.join(PATH, path))
BUCKET_NAME = "pollcat"
DEBUG = True
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N ... |
from mpi4py import MPI
from pycuda import cumath, gpuarray, driver as cuda
from pycuda.gpuarray import GPUArray
from striate import util
from striate.cuda_kernel import gpu_copy_to, transpose
from striate.layer import ConvLayer, NeuronLayer, MaxPoolLayer, \
ResponseNormLayer, FCLayer, SoftmaxLayer, TRAIN, WeightedLay... |
import re, calendar, time
from datetime import datetime, date, timedelta
from genshi.builder import tag
from trac.core import *
from trac.web import IRequestHandler
from trac.web.chrome import INavigationContributor, ITemplateProvider
from trac.util.datefmt import to_datetime, utc
class TicketCalendarPlugin(Componen... |
import logging
import pytest
import nengo
from nengo.utils.functions import piecewise
from nengo.utils.numpy import rmse
from nengo.utils.testing import Plotter
logger = logging.getLogger(__name__)
def test_oscillator(Simulator, nl):
model = nengo.Network(label='Oscillator', seed=789)
with model:
... |
import numpy
from matplotlib import pyplot
import advection
import weno_coefficients
from scipy.integrate import ode
def weno(order, q):
"""
Do WENO reconstruction
Parameters
----------
order : int
The stencil width
q : numpy array
Scalar data to reconstruct
... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
# 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 agree... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'editor.ui'
#
# Created by: PyQt5 UI code generator 5.8.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow... |
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import range
from builtins import object
import time
from tkinter import *
from xymath.gui.double_wt_entrygrid import EntryGrid
from numpy import array, doubl... |
import re
import sys
from docutils import nodes
from docutils.core import publish_string
from docutils.frontend import OptionParser
from docutils.nodes import Text, field_body, field_name, rubric
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from doc... |
import subprocess
import os.path
from parse import LsParser, WebHdfsParser
class HlsSubprocess(object):
def list_status(self, path):
return self.hls(path)
def hls(self, path):
p = self.get_process(path)
hls_result = p.communicate()[0]
hls_result = hls_result.decode("utf-8")
... |
#!/usr/local/bin/python
#CHIPSEC: Platform Security Assessment Framework
#Copyright (c) 2010-2015, Intel Corporation
#
#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; Version 2.
#
#This program is... |
# Copyright 2018 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... |
# Copyright Dytech Solutions, 2005.
# This module is provided 'commercial-in-confidence' and may not be reproduced nor redistributed without
# express written permission from the copyright holder.
# Author: Adam Eijdenberg, Dytech Solutions <adam.eijdenberg@dytech.com.au>
# Note: This is a very basic ODBC database a... |
# -*- coding: utf-8 -*-
"""DoubleSpinSlider - a custom widget combining a slider with a spinbox
Copyright (C) 2014 Jan M. Simons <marten@xtal.rwth-aachen.de>
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... |
import os, cv2, numpy as np
import math
import time
#from scipy import weave
import sys
import re
# automatically set threshold using technique from
# http://www.pyimagesearch.com/2015/04/06/zero-parameter-automatic-canny-edge-detection-with-python-and-opencv/
# just saw URL, and have seen it before, so that's re-as... |
# Copyright 2010 Keywan Tonekaboni, Florian Fusco, Stefanie Schirmer, Alexander Lenhard, Erik Weitnauer <eweitnauer at gmail.com>
#
# This file is part of Soldering Skaters Nokia Push Project.
#
# Soldering Skaters Nokia Push Project is free software: you can redistribute it and/or modify
# it under the terms of the GN... |
"""Tasks for analyzing genome/genetic data files"""
# absolute_import prevents conflicts between project celery.py file
# and the celery package.
from __future__ import absolute_import
import bz2
import csv
import gzip
import os
from random import randint
from celery import shared_task
from django.conf import settin... |
# Copyright 2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Rack controller service.
A service that controllers the external services on a rack controller. Using
the Postgres listening service, it takes messages from the notifier and
pe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-19 10:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('admin', '... |
#
# webgateway/views.py - django application view handling functions
#
# Copyright (c) 2007, 2008, 2009 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle, which states you are
# free to use i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# 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, e... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 22 07:54:05 2014
@author: charleslelosq
Carnegie Institution for Science
"""
import sys
sys.path.append("/Users/charleslelosq/Documents/RamPy/lib-charles/")
import csv
import numpy as np
import scipy
import matplotlib
import matplotlib.gridspec as gridspec
from pylab ... |
import sys
import os
import time
try:
from pwd import getpwuid
except ImportError:
getpwuid = lambda x: ['<unknown>']
from pysmi import __name__ as packageName
from pysmi import __version__ as packageVersion
from pysmi.mibinfo import MibInfo
from pysmi.codegen.symtable import SymtableCodeGen
from pys... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-15 10:09
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... |
# gcompris - hydroelectric
#
# Copyright (C) 2010 Bruno Coudoin
#
# 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 versio... |
# -*- 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 field 'FormDefinitionField.choice_model_queryset'
db.add_column(u'form_designer_formdefinitionfield... |
#!/usr/bin/env python
"""
django-memoize
--------------
**django-memoize** is an implementation
of `memoization <http://en.wikipedia.org/wiki/Memoization>`_ technique
for Django. You can think of it as a cache for function or method results.
"""
from setuptools import setup, find_packages
setup(
name='django-me... |
# Task sink
# Binds PULL socket to tcp://localhost:5558
# Collects results from workers via that socket
import zmq
class Sink(object):
def __init__(self,
result_port,
send_port,
break_port="tcp://127.0.0.1:9999"):
context = zmq.Context()
# Sock... |
import logging
import os
from tempfile import TemporaryDirectory
from typing import List
from common_helper_files import get_files_in_dir
from common_helper_yara import compile_rules, get_all_matched_strings, scan
class SignatureTestingMatching:
def __init__(self):
self.tmp_dir = TemporaryDirectory(pref... |
import sys
import time
from cssigps.offlineclassifier import *
from cssigps.dataset import *
from cssigps.feature import *
from cssigps.experiments import *
from get_dropbox_path import *
def print_usage():
"""
Print the usage for the main script.
"""
print("USAGE: use the run.sh or the main.py direct... |
import yaml
import re
from ansible.module_utils.basic import *
# module: parse_backup_metadata
# description:
# - Return the Satellite version and Puppet version
# specified in a Satellite backup
# notes:
# - The Satellite version is determined from the Satellite rpm
# version using the backup's rpm l... |
#!/usr/bin/env python
import unittest
import simulation
def state(visitors_per_bucket, baseline_conversions, treatment_conversions):
return simulation.ExperimentState(
baseline_conversions,
visitors_per_bucket - baseline_conversions,
treatment_conversions,
visitors_per_bucket - tr... |
import pymel.core as pm
import System.utils as utils
reload(utils)
from functools import partial
class ControlModule:
def __init__(self, _moduleNamespace):
# Class variables
self.moduleContainer = None
self.blueprintNamespace = ''
self.moduleNamespace = ''
self.characterNamespace = ''
self.publishe... |
# The Hazard Library
# Copyright (C) 2012-2014, GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
... |
# 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/.
"""Wrapper functions around the RabbitMQ management plugin's REST API."""
import json
from urllib.parse import quote
i... |
import os
from setuptools import setup, find_packages
this_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_dir, 'README.md'), 'r') as f:
long_description = f.read()
setup(name='pyconfigparser',
version='0.1',
author='Bounouar Colin',
maintainer='Bounouar Colin',
... |
#!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for zencoin utils.
Runs automatically during `make check`.
Ca... |
from django import forms
from django.contrib.comments.forms import CommentForm
from django.utils.translation import ugettext_lazy as _
from django_comments_xtd.conf import settings
from django_comments_xtd.models import TmpXtdComment
class XtdCommentForm(CommentForm):
followup = forms.BooleanField(
requir... |
# gb_z80.py - GameBoy z80 Disassembler + configuration.
import struct
import re
from functools import partial as P
class GBZ80Disassembler:
def __init__(self):
def _disassemble_cb(op):
return self._cb_ops[op // 8] + self._cb_regs[op % 8]
def r(reg): return '%{reg}'.format(reg=reg)
... |
#!/usr/bin/env python
from fs.errors import ResourceNotFoundError
from fs.opener import opener
from fs.commands.runner import Command
import sys
from datetime import datetime
class FSInfo(Command):
usage = """fsinfo [OPTION]... [PATH]
Display information regarding an FS resource"""
def get_optpars... |
import unittest
import numpy as np
from sklearn.base import clone
from toolkit.hmm.impl_hmmlearn import GaussianHMM as HMMLearnGaussianHMM
from toolkit.hmm.impl_hmmlearn import SequentialGaussianFHMM
from toolkit.hmm.impl_pomegranate import GaussianHMM as PomegranateGaussianHMM
class TestHMMImplementations(unittest... |
# -*- coding: utf-8 -*-
# Subdivx.com subtitles, based on a mod of Undertext subtitles
# Adaptation: enric_godes@hotmail.com | Please use email address for your
# comments
# Port to XBMC 13 Gotham subtitles infrastructure: cramm, Mar 2014
from __future__ import print_function
from json import loads
import os
from os.p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.