text stringlengths 475 200k |
|---|
from unipath import Path
from pyolite.repo import Repo
from pyolite.models.user import User
ACCEPTED_PERMISSIONS = set('RW+CD')
class ListUsers(object):
def __init__(self, repository):
self.repository_model = repository
self.repo = Repo(Path(repository.path,
"conf/repos/%s.conf"... |
# coding:utf-8
from file import file
import json
from qcloud_cos import *
class upload:
"""
:type cos_client:CosClient
"""
appid = 0
secret_id = u""
secret_key = u""
region_info = u""
cos_client = None
bucketname = u""
bucketPath = u""
def initSetting(self):
# COS设... |
import xerus as xe
class InternalSolver :
def __init__(self, A, x, b):
self.A = A
self.b = b
self.x = x
self.d = x.degree()
self.solutionsNorm = b.frob_norm()
self.leftAStack = [ xe.Tensor.ones([1,1,1]) ]
self.leftBStack = [ xe.Tensor.ones([1,1]) ]
self.rightAStack = [ xe.Tensor.ones([1,1,1]) ]
s... |
import sys
import _pytest._code
import py
import pytest
def test_ne():
code1 = _pytest._code.Code(compile('foo = "bar"', '', 'exec'))
assert code1 == code1
code2 = _pytest._code.Code(compile('foo = "baz"', '', 'exec'))
assert code2 != code1
def test_code_gives_back_name_for_not_existing_file():
... |
#!/usr/bin/env python
import os
import re
import logging
from time import sleep
import tornado.httpserver
import tornado.ioloop
from tornado.options import define, options
from tornado_utils.routes import route
import redis.client
from rq import Queue
import motor
import settings
import handlers
import api_handlers
im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012-2013, Timothy Appnel <[EMAIL]>
#
# 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) any later... |
import re
from base64 import b32decode
from urlparse import urlparse, parse_qs
from oath import hotp
from sst import config
from sst.actions import (
add_cleanup,
assert_element,
assert_url,
click_button,
click_link,
exists_element,
fails,
get_current_url,
get_element,
get_elem... |
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import pylab as pl
import random as rd
import scipy as sp
import networkx as nx
import numpy as np
import math as mt
import pprint as ppt
time_list = []
energy_state = []
perturbation_period = 164
pert_accu = 0
def init_full():
global time,... |
import logging; logger = logging.getLogger("morse." + __name__)
from morse.core.services import service
import morse.core.actuator
import mathutils
from morse.helpers.filt2 import Filt2
class StabilizedQuadrotorActuatorClass(morse.core.actuator.MorseActuatorClass):
""" Motion controller using linear model of a sta... |
from datetime import datetime
import os
import ssl
import sys
try:
from pathlib import Path
except ImportError:
# removed in django version 3
from django.utils._os import upath
from django.core.servers.basehttp import WSGIRequestHandler
from django.core.management.base import CommandError
from django.cor... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import operator
import string
import six
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from mptt import models as mptt
from polymorphic.models import PolymorphicModel
from simple_history imp... |
import click
def test_progressbar_strip_regression(runner, monkeypatch):
label = ' padded line'
@click.command()
def cli():
with click.progressbar(tuple(range(10)), label=label) as progress:
for thing in progress:
pass
monkeypatch.setattr(click._termui_impl, 'i... |
# -*- coding: utf-8 -*-
"""
celery.utils.term
~~~~~~~~~~~~~~~~~
Terminals and colors.
"""
from __future__ import absolute_import, unicode_literals
import platform
from functools import reduce
from kombu.utils.encoding import safe_str
from celery.five import string
__all__ = ['colored']
BLACK, RED, GR... |
import unittest
import random, sys, time, os
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e
def write_syn_dataset(csvPathname, rowCount, colCount, SEED):
r1 = random.Random(SEED)
dsf = open(csvPathname, "w+")
for i in range(rowCount):
... |
# Copyright 2014 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 ag... |
#!/usr/bin/env python
""":mod:`irianas_client.main` -- Program entry point
"""
import sys
sys.path[0:0] = [""]
import os
from OpenSSL import SSL
from flask import Flask
from flask.ext import restful
from irianas_client.api.api_services import \
(ApacheServiceAPI, MySQLServiceAPI, vsFTPServiceAPI, BINDServiceAPI,
... |
from __future__ import print_function
from sys import exit
from wellpapp import Client, InheritValue, vtparse
from optparse import OptionParser
def main(arg0, argv):
p = OptionParser(usage="Usage: %prog [options] set_tag implied_tag [priority]", prog=arg0)
p.add_option("-d", "--delete", help="Delete implication", a... |
import os
import unittest2
from random_music import random_music, utils
class TestWhich(unittest2.TestCase):
def setUp(self):
"""
Mock os.environ['PATH'] & os.path.exists to have predictable
outputs.
"""
self.old_path = utils.os.environ['PATH']
utils.os.environ['... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
"""
sphinx.writers.html
~~~~~~~~~~~~~~~~~~~
docutils writers handling Sphinx' custom nodes.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
import posixpath
import os
from docutils import nodes
from d... |
# Copyright (c) 2010 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... |
# foto powerup
pw1 = pygame.image.load('pw1.png')
pw2 = pygame.image.load('pw2.png')
pw3 = pygame.image.load('pw3.png')
pw4 = pygame.image.load('pw4.png')
pw5 = pygame.image.load('pw5.png')
pw6 = pygame.image.load('pw6.png')
pw7 = pygame.image.load('pw7.png')
pw8 = pygame.image.load('pw8.png')
pw9 = pygame.image.load('... |
from binascii import b2a_hex
try:
import cPickle as pickle
except ImportError:
import pickle
from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, OGRException,
OGRIndexError, SpatialReference, CoordTransform, GDAL_VERSION)
from django.contrib.gis.gdal.prototypes.geom import GEOJSON
from django.co... |
import sys
import os
from collections import defaultdict
from math import sqrt
import operator
def sim_func(v1, v2, _MODE):
val = 0.0
if _MODE == 'dot':
### dot product:
val = sum( [v1[i]*v2[i] for i in range(len(v1))] )
elif _MODE == 'cosine':
### cosine sim:
norm1 = sqrt... |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyri... |
'''
Pull movie metadata from `The Open Movie Database` API
for films that were scraped from `The Numbers` website
'''
import time
import json
import requests
import pandas as pd
from src.my_aws import S3
KEY_OMDB = 'OMDB_API.csv'
KEY_NUM = 'TheNumbers_budgets.csv'
BUCKET = 'movie-torrents'
class OMDBApi():
'''
... |
# Copyright 2012 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... |
import pytz
from urllib import urlencode
from urlparse import urlparse, parse_qsl
from datetime import datetime, timedelta
from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from django.shortcuts import Http404, HttpResponseRedirect
from django.contrib.auth.models import An... |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the memory layer provider.
.. note:: 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 vers... |
from filecmp import cmp
import re
from scripttest import TestFileEnvironment
bindir = "bin/"
datadir = "test/data/"
testdir = "test/testenv_rm_spurious_events/"
env = TestFileEnvironment(testdir)
# relative to test file environment
bindir_rel = "../../" + bindir
datadir_rel = "../../" + datadir
def test_call_without... |
# Copyright (c) The OpenTracing Authors.
#
# 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, merge, publish,... |
# -*- coding: utf-8 -*-
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(... |
from django.conf import settings as django_settings
def get_override_settings(attributes=None):
"""
Overrides settings by attribute keys
:param attributes: attribute = keys of dictionary
:return: built override settings
"""
# runtime parameters should be const
if not attributes:
at... |
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import scipy.stats as stats
from bandits.agent import BetaAgent
class Environment(object):
def __init__(self, bandit, agents, label='Multi-Armed Bandit'):
self.bandit = bandit
self.agents = agents
self.label = label
... |
# This file is part of Pyrakoon, a distributed key-value store client.
#
# Copyright (C) 2010 Incubaid BVBA
#
# 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/lice... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
"""
Default key bindings.::
key_bindings = load_key_bindings()
app = Application(key_bindings=key_bindings)
"""
from prompt_toolkit.filters import buffer_has_focus
from prompt_toolkit.key_binding.bindings.basic import load_basic_bindings
from prompt_toolkit.key_binding.bindings.cpr import load_cpr_bindings
fro... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import autoslug.fields
from decimal import Decimal
import django_countries.fields
import courselib.json_fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Con... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
"""
Utility function to facilitate testing.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import re
import operator
import warnings
from functools import partial, wraps
import shutil
import contextlib
from tempfile import mkdtemp, mkstemp
from unittest.case import SkipTest
... |
import base64
import binascii
from typing import List
from pcs.common.services.interfaces import ServiceManagerInterface
from pcs.common.services.errors import ManageServiceError
from pcs.common import reports
from pcs.common.reports import (
codes as report_codes,
ReportProcessor,
)
from pcs.common.reports.i... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals, absolute_import
from builtins import str
import os
import argparse
import inspect
import sys
from ..interfaces.base import Interface, InputMultiPath, traits
from .misc import str2bool
def listClasses(module=None):
if modul... |
#!/usr/bin/env python
#
# Copyright 2007 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 o... |
import deep_architect.core as co
class SurrogateModel:
"""Abstract class for a surrogate model.
"""
def eval(self, feats):
""" Returns a prediction of performance (or other relevant metrics),
given a feature representation of the architecture.
"""
raise NotImplementedError... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from autonetkit.design.layer2 import build_l2, build_l2_conn
from autonetkit.design.routing import build_ospf, build_ebgp, build_ibgp
from autonetkit.design.validation.validation import check_layer2_conn
from autonetkit.network_model.network_model import NetworkModel
class Builder:
"""
"""
def __init__(... |
"""SCons.Job
This module defines the Serial and Parallel classes that execute tasks to
complete a build. The Jobs class provides a higher level interface to start,
stop, and wait on jobs.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted,... |
import keras
import os
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.utils import *
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
# returns train/test data (x = data, y = label) and encoder an... |
import string
import win32con
import win32api
import win32ui
MAPVK_VK_TO_CHAR = 2
key_name_to_vk = {}
key_code_to_name = {}
_better_names = {
"escape": "esc",
"return": "enter",
"back": "pgup",
"next": "pgdn",
}
def _fillvkmap():
# Pull the VK_names from win32con
names = [entry for entry in ... |
import py
from rpython.memory.gctransform.test.test_transform import rtype, rtype_and_transform, getops
from rpython.memory.gctransform.test.test_transform import LLInterpedTranformerTests
from rpython.memory.gctransform.refcounting import RefcountingGCTransformer
from rpython.rtyper.lltypesystem import lltype
from rpy... |
#-*- coding:utf-8 -*-
'''
-----------------------------------------------------------------------------
Create:
-----------------------------------------------------------------------------
|Description: 爬取古诗文网宋词300首,保存为csv文件
|Author: huangwei
|Date: 2016-5-19
|Ver... |
from pype.ast import *
from symtab import *
from lib_import import LibraryImporter
class SymbolTableVisitor(ASTVisitor):
def __init__(self):
self.symbol_table = SymbolTable()
self.scope='global'
def return_value(self):
return self.symbol_table
def visit(self, node):
if isinstance(node, ASTImpor... |
from time import time
import math
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers
'''Building the CIFAR-10 VGG-Net
Summary of available functions:
'''
BATCH_SIZE = 64
NUM_ITERATION = 200000
NUM_CLASS = 10
NUM_IMAGE_CHANNEL = 3
NUM_IMAGE_WIDTH = 32
NUM_IMAGE_HEIGHT = 32
CACHE_DIR = '... |
# Copyright 2016-2021 Peppy Player [EMAIL]
#
# This file is part of Peppy Player.
#
# Peppy Player 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 l... |
""" hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
from pluggy import HookspecMarker
from .deprecated import PYTEST_NAMESPACE
hookspec = HookspecMarker("pytest")
# -------------------------------------------------------------------------
# Initialization hooks called for ever... |
from pygeo import *
v=display(scale=50)
# testing of factory function for array of circles in 3d space
# CLASS being called
#--------------------------------------------------
""" pickable points in space at initial x,y,z coords """
p1 = FreePoint(10.... |
"""Tests for the Input slider component."""
# pylint: disable=protected-access
import asyncio
import datetime
import pytest
import voluptuous as vol
from homeassistant.core import CoreState, State, Context
from homeassistant.setup import async_setup_component
from homeassistant.components.input_datetime import (
... |
# 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... |
# -*- coding: utf-8 -*-
from django.utils import translation
from django.core.cache import cache
from unittest import TestCase
from olympia.lib.cache import (
Message, Token, memoize, memoize_key, cache_get_or_set,
make_key)
def test_make_key():
with translation.override('en-US'):
assert make_key... |
import os
import pkg_resources
from pyramid.compat import string_types
from pyramid.path import (
package_path,
package_name,
)
def resolve_asset_spec(spec, pname='__main__'):
if pname and not isinstance(pname, string_types):
pname = pname.__name__ # as package
if os.path.isabs(spec):
... |
# -*- coding: utf8 -*-
from __future__ import print_function
from __future__ import absolute_import
import calendar
import logging
import platform
from pprint import pprint
if platform.system() == 'Windows':
from threading import Thread as Process
else:
from multiprocessing import Process
import json
import ... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2013 Intel Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
#!/usr/bin/python
# 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 program is distributed in the hope that it w... |
# coding=utf8
"""
Formato fasta, supportata lettura e scrittura
@note: il resto delle feature dell'extended fasta della ncbi vengono ignorati,
solo il primo (l'id) viene usato come nome della sequenza
"""
import os
TEXT_WRAP_DEFAULT = 80
"""
Il numero di caratteri per riga nello scrivere la sequenza, evitare ... |
#
# Copyright 2004,2005,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later ... |
from collections import defaultdict
import pymongo
from bson import SON
from mongoengine.base.fields import UPDATE_OPERATORS
from mongoengine.connection import get_connection
from mongoengine.common import _import_class
from mongoengine.errors import InvalidQueryError
from mongoengine.python_support import IS_PYMONGO... |
from pontoon.base.tests import ProjectFactory, RepositoryFactory, TestCase
from pontoon.base.utils import aware_datetime
from pontoon.sync.models import ProjectSyncLog
from pontoon.sync.tests import (
ProjectSyncLogFactory,
RepositorySyncLogFactory,
SyncLogFactory,
)
class SyncLogTests(TestCase):
def ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: OpenDrive Ltda
# Copyright (c) 2013 Opendrive Ltda
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# cons... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 29/03/17 at 11:40 AM
@author: neil
Program description here
Version 0.0.0
"""
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
from tqdm import tqdm
import itertools
try:
import periodogram_functions2 as pf2
except Modul... |
# coding=utf-8
# Copyright 2014 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 hashlib
impor... |
#!/usr/bin/env python
#!/usr/bin/python
import h5py
from matplotlib import pylab
import matplotlib.pylab as plt
import sys
from matplotlib.font_manager import FontProperties
import math
import numpy as np
import h5py
import matplotlib.pylab as plt
import matplotlib as mpl
import sys
import numpy as np;
plt.rcParams.u... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
from __future__ import absolute_import, print_function, division
import operator
from petl.compat import text_type
from petl.errors import DuplicateKeyError
from petl.util.base import Table, asindices, asdict, Record, rowgetter
def _setup_lookup(table, key, value):
# obtain iterator and header row
it = i... |
#! python2
# StaSh utility - Dutcho, 16-17 Apr 2017
'''Display output one screen page at a time (optionally with numbered lines)'''
from __future__ import print_function
import argparse, console, fileinput, sys
def msi(chars):
'''Set terminal screen by ANSI code "MSI", and ignore for non-terminal output'''
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import checker
class QC(object):
"""
quay crane class
* `ID`: is a class attribute to count how may quay cranes has been created
* `PROPERTY`: is a tuple of the available instance attributes for a quay crane object
"""
ID = 1
PROPERTY = (
... |
import pytest
from .helpers.movie_data import Movie,Actor,Director
from .fixtures import *
from blitzdb.backends.file import Backend as FileBackend
def test_array_queries(backend):
francis_coppola = Director({'name' : 'Francis Coppola'})
backend.save(francis_coppola)
the_godfather = Movie({'title' : ... |
# -*- 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 unique constraint on 'ClassRoom', fields ['slug']
db.create_unique('classroom_classroom', ['slug'])... |
# Sphesihle Makhathini <[EMAIL]>
import os
import sys
import subprocess
import argparse
import time
import tempfile
import glob
import math
import json
import logging
import io
import shlex
# I want to replace error() in argparse.ArgumentParser class
# I do this so I can catch the exception raised when too few argum... |
# -*- coding: utf-8 -*-
"""
togglwrapper.mixins
-------------------
This module contains mixins for TogglObject subclasses. The common CRUD
(create, read, update, delete) methods are all used by different Toggl objects,
but in different combinations. Some objects have endpoints for all four
methods, but some only imp... |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
# NOTE: If you make changes to this file, be sure to restart Mr. Do!
import os
import re
import shutil
import sys
import time
import zipfile
import conf
import g
from merge.ccp_import import Ccp_Import
fro... |
from typing import Dict
def state_name_to_fips(name: str) -> int:
"""Take state name and return fips as int
Args:
x (str): State name (e.g., Arizona).
Returns:
int: FIPS code.
"""
return _name_to_fips_xwalk[name]
def state_name_to_abbr(name: str) -> str:
"""Take state name,... |
# This file is part of Lerot.
#
# Lerot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Lerot is distributed in the hope tha... |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable, ln
from numpy import int32, less_equal, ones, bool8, float32, where, zeros
from scipy.ndimage import correlate, distance_transform_edt, label,... |
#!/usr/bin/env python
# This file is part of the xxdiff package. See xxdiff for license and details.
# If this file is found independently as svn-foreign, here are the licensing
# terms:
#
# svn-foreign
# Copyright (C) 2006 Martin Blais
# URL: http://furius.ca/xxdiff/
#
# This program is free software; you can ... |
from PIL import Image, ImageDraw
import numpy as np
import random
import os.path
import pickle
from copy import deepcopy
def ComputeSSD(TODOPatch, TODOMask, textureIm, patchL):
patch_rows, patch_cols, patch_bands = np.shape(TODOPatch)
tex_rows, tex_cols, tex_bands = np.shape(textureIm)
ssd_rows = int(tex_r... |
"""
Django settings for blog project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
#!/usr/bin/env python
import pygame
import time
import random
import math
from GameObjects import *
gamestate = 0 # 0 Main menu
# 1 Game
# 2 Choose race
playerrace = 0 # 0 Knights
# 1 Zombies
# 2 Robots
def setGameState(state):
global gamestate
gamestate = state
def getGameState():
global gamestate
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# [EMAIL], modified by David Laval
# gplv2+
## XMPP notification
#define command{
# command_name notify-host-by-xmpp
# command_line $PLUGINSDIR$/notify_by_xmpp.py -a $PLUGINSDIR$/notify_by_xmpp.ini "Host '$HOSTALIAS$' is $HOSTSTATE$ - Info : $HOSTOUTPUT$" $CONT... |
#!/usr/bin/python2.5
#
# Copyright 2009 Roman Nurik
#
# 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... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic.base import RedirectView
from django.contrib import admin
from django.conf import settings
import os.path
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtailadmin import urls a... |
# -*- test-case-name: twisted.trial.test.test_trial -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
# Author/Maintainer: Jonathan D. Simms <[EMAIL]>
# Originally written by: Jonathan Lange <[EMAIL]>
# and countless contributors
import sys, os, inspect, typ... |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio ([EMAIL])`
salt.utils.filebuffer
~~~~~~~~~~~~~~~~~~~~~
This utility allows parsing a file in chunks.
'''
from __future__ import absolute_import
# Import salt libs
import salt.utils
from salt.exceptions import SaltException
class Inval... |
#!/usr/bin/env python
#
# Copyright 2010 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 o... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-24 11:25
from __future__ import unicode_literals
import common.arrayfields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
mig... |
import tornado.web
import subprocess
class SlurmCmdMixin:
# This class will contain any methods necessary
# for running slurm commands and parsing output.
def run_sacct(self,**kwargs):
# Handle keyword arguments, translate them into
# corresponding options for sacct via subprocess
... |
# ##### BEGIN MIT LICENSE BLOCK #####
# Copyright (C) 2011 by Lih-Hern Pang
# 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 ... |
# Copyright (c) 2016 Jamie Bull
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
"""
Integration te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.