text stringlengths 12 6.59M |
|---|
import datetime
import os
import re
import shutil
from runcommands import command
from runcommands.commands import *
from runcommands.util import abort, confirm, printer, prompt
@command
def install(config, where='.env', upgrade=False):
pip = '{where}/bin/pip'.format(where=where)
local(config, (pip, 'install... |
# -*- coding: utf-8 -*-
"""
File: commands.py
Author: Arve Seljebu
Email: arve.seljebu@gmail.com
Github: arve0
Description: Class which gets all commands with translation from SVN.
"""
from urllib import urlopen
import json
import codecs
class Commands(object):
""" Class for commands """
# Variables
def... |
import re
import requests
import random
import shelve
import config
def help():
msg = """
*Command list*
`/js <library>` - checks if library is cool or not
`/help` - return this
`/sadness` - cry
`/puppy` - G O O D D O G G O
`/remember <keyword> <text>` - have memories
"""
return 'message', {'text': msg... |
# coding: utf-8
#
# commands.py
# Part of SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ryan Hileman and Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter3
# License: MIT
#
"""This module implements the Sublime Text commands provided by SublimeLinter."""
impor... |
#!/usr/bin/env python3
import getpass
import glob
import os
import shutil
import subprocess
import sys
import unittest
if os.path.abspath(sys.argv[0]) == os.path.abspath(__file__):
# When running this module directly via `./commands.py` or
# `python commands.py`:
#
# - Ensure virtual env is created an... |
from ceilometer import sample
from ceilometer_publisher_zeromq import queue
from urlparse import SplitResult
import os
import sys
import zmq
def stub_sample():
return sample.Sample(
"stub_name",
"gauge",
"MB",
"14",
"larry-id",
"larrys-project-id",
"larrys-bo... |
# Test file for linked_list.py
# Authors Mark, Efrain, Henry
import pytest # used for exception testing
import linked_list as ll
def test_init():
"""Test link_list class constructor."""
a = ll.Linked_list()
assert isinstance(a, ll.Linked_list)
def test_insert():
"""Test insert by adding node to e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... |
# coding=UTF-8
from squarespace import Squarespace
def test_squarespace():
store = Squarespace('test')
assert store.api_key == 'test'
assert store.useragent == 'Squarespace python API v0.0.2 by Zach White.'
def test_squarespace_useragent():
store = Squarespace('test')
store.useragent = 'Hello, W... |
from __future__ import absolute_import, division, print_function
import sys
import platform
import os
import _pytest._code
from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN
import pytest
_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")
def runpdb_and_get_report(testdir, source):
p = t... |
from django import forms
from django.contrib.auth.models import User
from django.db.models import Count, Sum
from jet.dashboard.modules import DashboardModule
from register.models import Application, STATUS
from reimbursement.models import Reimbursement, RE_SENT, RE_ACCEPTED, RE_NEEDS_CHANGE, RE_FRIEND_ACCEPTED
clas... |
__version__ = "2018.6"
__versionfull__ = __version__
|
#!/usr/bin/env python
import os
import subprocess
import shutil
import tornado.web
from traffic_cloud_utils.app_config import get_project_path, get_project_video_path, update_config_without_sections, get_config_without_sections
from traffic_cloud_utils.emailHelper import EmailHelper
from traffic_cloud_utils.statusHel... |
#!/usr/bin/python
import imp
import os
import sys
import re
import types
import subprocess
conaryPath = os.environ.get('CONARY_PATH', None)
if not conaryPath:
print >>sys.stderr, 'please set CONARY_PATH'
sys.exit(1)
if conaryPath not in sys.path:
sys.path.insert(0, conaryPath)
from conary.lib import util... |
# Copyright 2020-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later
##################################################################
# Various utility functions which are useful for multiple tests.
# Note that fixtures aren't here - they are in conftest.py.
import string
import random
import time
impor... |
import unittest
import datetime
import os
import pytz
from firmant.datasource.atom import AtomProvider, \
AtomBase, \
DatetimeFilter, \
AtomObjectFilter, \
AtomObjectListFilte... |
import os
import sys
import time
sys.path.append('../DDSP/')
from DDSP import DDSP
if __name__ == '__main__':
ddsp = DDSP('../../sent')
time.sleep(3)
ddsp.requestContent(b'123456789012345678901234567890123456789012345678901234567890abcd')
time.sleep(10)
print ("Reached the end of Subscriber.py") |
import functools
import importlib
import os
from bokeh.embed import components
from bokeh.model import Model
from flask import render_template
from app.main.date_range_form import DateRangeForm
_data_quality_items = dict()
def data_quality(name, caption, export_name=None, **kwargs):
"""Decorator for data quali... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import inspect
import mock
import pytest
import raven
import time
from socket import socket, AF_INET, SOCK_DGRAM
from raven.base import Client, ClientState
from raven.transport import AsyncTransport
from raven.utils.stacks import iter_stack_frames
from ra... |
__author__ = 'Federico Tomassetti'
import unittest
from lands.biome import *
class TestBiome(unittest.TestCase):
def setUp(self):
pass
def test_biome_by_name(self):
self.assertRaises(Exception, Biome.by_name, "unexisting biome")
self.assertTrue(isinstance(Biome.by_name("ocean"), Oce... |
from flask import jsonify, abort, request, current_app
from datetime import datetime, timedelta
from ...models import AuditEvent
from sqlalchemy import asc, desc, Date, cast
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import true, false
from ...utils import pagination_links, get_valid_page_... |
from app import db
class Spreadsheet(db.Model):
id = db.Column(db.Integer, primary_key=True)
filename = db.Column(db.String(500))
uploaded = db.Column(db.DateTime())
processed = db.Column(db.DateTime())
userId = db.Column(db.Integer, db.ForeignKey('user.id'))
def __init__(self, *args, **kwargs... |
from __future__ import unicode_literals
import functools
import logging
import os
import re
from rpaths import Path
import subprocess
import sys
import time
from tej.submission import make_unique_name
from tej.utils import unicode_
if hasattr(sys.stdout, 'buffer') and hasattr(sys.stdout.buffer, 'write'):
stdout... |
# -*- coding: utf-8 -*-
from APITaxi.extensions import redis_store_saved
from .skeleton import Skeleton
from .fake_data import dict_vehicle, dict_ads, dict_driver, dict_taxi, dict_hail as dict_
from APITaxi_models.hail import (Customer, Hail, rating_ride_reason_enum,
incident_customer_reason_enum, incident_taxi... |
from __future__ import print_function
import click
import functools
import os
import sys
import unittest
import ykman.descriptor
from ykman.util import (
is_cve201715361_vulnerable_firmware_version, TRANSPORT)
import test.util
_skip = True
_test_serials = os.environ.get('DESTRUCTIVE_TEST_YUBIKEY_SERIALS')
_no_pr... |
from keras.models import Sequential, load_model
from keras.layers import Dense, Reshape, Flatten, Conv2D, Conv2DTranspose, BatchNormalization, Activation
from keras.layers.advanced_activations import LeakyReLU
from keras.optimizers import Adam, SGD
from keras.backend import clear_session
import numpy as np
import os
i... |
#!/usr/bin/env python
from shinken_test import *
#
modulesctx.set_modulesdir(modules_dir)
# Special Livestatus module opening since the module rename
#from shinken.modules.livestatus import module as livestatus_broker
livestatus_broker = modulesctx.get_module('livestatus')
LiveStatus_broker = livestatus_broker.Live... |
from app import db
class GolfRound(db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
tee_id = db.Column(db.Integer, db.ForeignKey('tee.id'))
date = db.Column(db.DateTime)
notes = db.Column(db.String(128))
total_score = db.Column... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import base64
from odoo import fields, models, api, _
from odoo.addons.iap import jsonrpc
from odoo.tools.safe_eval import safe_eval
DEFAULT_ENDPOINT = 'https://iap-snailmail.odoo.com'
PRINT_ENDPOINT = '/iap/s... |
import pytest
from moulinette.actionsmap import (
CommentParameter,
AskParameter,
PasswordParameter,
PatternParameter,
RequiredParameter,
ExtraArgumentParser,
ActionsMap,
)
from moulinette.interfaces import GLOBAL_SECTION
from moulinette.interfaces import BaseActionsMapParser
from moulinet... |
# -*- coding: utf-8 -*-
# Copyright 2009-2015 MongoDB, 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 l... |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... |
"""Functional tests for WSGI app for Protocol RPC - custom API."""
import unittest
from webtest import TestApp
import app_engine_test_utils
from gae.room import custom_api
from test import test_models
app = TestApp(custom_api.application)
class CustomApiTest(unittest.TestCase):
def setUp(self):
app_engine_te... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Acts(CMakePackage, CudaPackage):
"""
A Common Tracking Software (Acts)
This proje... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from glob import glob
from llnl.util.filesystem import LibraryList
import os
import platform
import ll... |
import numpy as nm
try:
import dask.array as da
except ImportError:
da = None
try:
import opt_einsum as oe
except ImportError:
oe = None
from pyparsing import (Word, Suppress, oneOf, OneOrMore, delimitedList,
Combine, alphas, Literal)
from sfepy.base.base import output, Stru... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import numpy as nm
import opt_einsum as oe
from sfepy.base.base import Struct
from sfepy.terms.terms import Term
from sfepy.terms import register_term
class ETermBase(Struct):
def einsum(self, sexpr, *args, diff_var=None):
dc_type = self.get_dof_conn_type()
vvar = args[0]
uvars = args[1:... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pigz(MakefilePackage):
"""A parallel implementation of gzip for modern multi-processor,
... |
# -*- coding: utf-8 -*-
"""
Author
------
Bo Zhang
Email
-----
bozhang@nao.cas.cn
Created on
----------
- Fri Jul 3 13:13:06 2015 read_spectrum
Modifications
-------------
- Wed Jul 29 21:46:00 2015 measure_line_index
- Fri Nov 20 10:16:59 2015 reformatting code
- Sat Jan 16 19:55:57 2016 migrate from ... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pumi(CMakePackage):
"""SCOREC RPI's Parallel Unstructured Mesh Infrastructure (PUMI).
... |
from bot.action.core.action import IntermediateAction
class TextMessageAction(IntermediateAction):
def process(self, event):
text = event.message.text
if text is not None:
event.text = text
self._continue(event)
class VoiceMessageAction(IntermediateAction):
def proces... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ssht(CMakePackage):
"""ssht: Spin spherical harmonic transforms
The SSHT code provide... |
import sys
import os
from math import *
from panda3d.core import *
from panda3d.egg import *
from utils import *
def retrieveTexture(textureName, textureFolderName,
textureEnvType=EggTexture.ETUnspecified,
textureScale=1.0, textureFormat="png"):
if EggTexture.ETUnspecified ... |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... |
#!/usr/bin/env python3
import uuid
import random
import datetime
from faker import Factory
fake = Factory.create()
num_people = 1000
last_jump_start = datetime.datetime(2008, 9, 1)
last_jump_end = datetime.datetime(2016, 8, 1)
print('COPY members (uuid, name, email, phone_number, last_jump, created_at, updated_at) ... |
"""Test cases for Zinnia's markups"""
import warnings
try:
import builtins
except ImportError: # Python 2
import __builtin__ as builtins
from django.test import TestCase
from zinnia import markups
from zinnia.markups import html_format
from zinnia.markups import markdown
from zinnia.markups import restructur... |
#!/usr/bin/env python
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affer... |
#! /usr/bin/local/python
# -*- coding: utf-8 -*-
import breakmer.utils as utils
__author__ = "Ryan Abo"
__copyright__ = "Copyright 2015, Ryan Abo"
__email__ = "ryanabo@gmail.com"
__license__ = "MIT"
class Filter:
"""
"""
def __init(self):
self.name = None
self.svType = None
self... |
import math
import os
import shutil
import subprocess
from collections import deque
from cea import suppres_3rd_party_debug_loggers
suppres_3rd_party_debug_loggers()
import py4design.py2radiance as py2radiance
from py4design.py3dmodel.fetch import points_frm_occface
from cea.resources.radiation_daysim.geometry_gene... |
from ...tools import dropout, add_bias
from ..commons.utils import *
import numpy as np
import collections
import random
import math
["check_network_structure", "verify_dataset_shape_and_modify", "print_training_status", "print_training_results"]
def backpropagation_foundation(network, trainingset, testset, cost_fu... |
"""hug/types.py
Defines hugs built-in supported types / validators
Copyright (C) 2015 Timothy Edmund Crosley
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 witho... |
import numpy as np
import os
from singlecell_constants import DATADIR
# TODO pass metadata to all functions?
# TODO test and optimize read_exptdata_from_files
def read_datafile_simple(datapath, verbose=True, txt=False):
if txt:
assert datapath[-4:] == '.txt'
arr = np.loadtxt(datapath, skiprows=1... |
from __future__ import absolute_import, unicode_literals
from YAQueueProject.celery_app import app
@app.task
def add(x, y):
return x + y
i = 0
j = 0
@app.task
def inc(f):
if f % 2 == 0:
global i
i += 1
return i
else:
global j
j += 1
return j
|
#!/usr/local/bin/env python
# =============================================================================================
# MODULE DOCSTRING
# =============================================================================================
"""
Set up and run YANK calculation from script.
"""
# ======================... |
from os.path import join, dirname
from fabric.api import lcd, local
from fabric.decorators import task
import wikipedia
from .utils import optional_venv
SCRIPTS_DIR = "./scripts"
BROWN_DIR = SCRIPTS_DIR + "/" + "brown"
CORPUS_DIR = "./data/corpora/{lang}"
MODEL_DIR = "./data/model/{lang}"
@task
def clean_corpora(l... |
from __future__ import print_function
import re
import numpy as np
import pickle
from collections import defaultdict
from chainer.dataset.dataset_mixin import DatasetMixin
class LtrDataset(DatasetMixin):
"""
Implementation of Learning to Rank data set
Supports efficient slicing on query-level data. Note... |
import os
import time
from testtools import TestCase
from testtools.matchers import Contains
from . import makeprefs, _temp_home
from mock import MagicMock, Mock, patch
from StringIO import StringIO
from contextlib import nested
class CommandTest(TestCase):
def setUp(self):
super(CommandTest, self).setUp... |
# -*- coding: utf-8 -*-
"""Project metadata."""
package = "lambdautils"
project = "lambdautils"
version = '0.3.0'
description = "Simple utilities for AWS Lambda functions"
authors = ["Innovative Travel Ltd"]
authors_string = ', '.join(authors)
emails = ['german@innovativetravel.eu']
license = 'MIT'
copyright = '2016 '... |
#!/usr/bin/env python
# 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, softwar... |
# -*- python -*-
# stdlib imports
import os
import os.path as osp
import sys
# waf imports ---
import waflib.Options
import waflib.Utils
import waflib.Logs as msg
from waflib.Configure import conf
_heptooldir = osp.dirname(osp.abspath(__file__))
# add this directory to sys.path to ease the loading of other hepwaf to... |
import numpy as np
def pca_lighting(img, sigma, eigen_value=None, eigen_vector=None):
"""AlexNet style color augmentation
This method adds a noise vector drawn from a Gaussian. The direction of
the Gaussian is same as that of the principal components of the dataset.
This method is used in training o... |
import logging
from dateutil import parser
from django.db import models, transaction
from django.db.models import Sum
from django.db.models.expressions import RawSQL
from django.utils import timezone
from framework.sessions import session
from osf.models.base import BaseModel, Guid
from osf.models.files import BaseFi... |
"""
Logging facilities
These are thin wrappers on top of Twisted's logging facilities; logs
are all directed either to stdout (if Evennia is running in
interactive mode) or to $GAME_DIR/server/logs.
The log_file() function uses its own threading system to log to
arbitrary files in $GAME_DIR/server/logs.
Note: All lo... |
import pytest
from addons.osfstorage import settings as osfstorage_settings
from osf.models import BaseFileNode, Folder, File
from osf_tests.factories import (
UserFactory,
ProjectFactory,
)
pytestmark = pytest.mark.django_db
@pytest.fixture()
def user():
return UserFactory()
@pytest.fixture()
def proje... |
# -*- coding: utf-8 -*-
"""
hyper/api
~~~~~~~~~
This file defines the publicly-accessible API for hyper. This API also
constitutes the abstraction layer between HTTP/1.1 and HTTP/2.0.
"""
try:
import http.client as httplib
except ImportError:
import httplib
class HTTPSConnection(object):
"""
An objec... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
# Copyright Kitware 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 t... |
"""
Waveform simulator ("FaX") - physics backend
The only I/O stuff here is pax event creation, everything else is in the WaveformSimulator plugins
"""
import logging
import math
import time
import numpy as np
from scipy import stats
from pax import units, utils, datastructure
from pax.utils import Memoize
log = l... |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... |
from nxdrive.tests.common_unit_test import UnitTestCase
class TestIntegrationLocalFilter(UnitTestCase):
def test_synchronize_local_filter(self):
"""Test that filtering remote documents is impacted client side
Just do a single test as it is the same as
test_integration_remote_deletion
... |
#!/usr/bin/env python
'''
Copyright 2011, 2015, 2016, 2017, 2018 (c) Timothy Savannah under LGPLv2.1, All Rights Reserved.
If a LICENSE file was not included in this distribution, the license can be found
at https://github.com/kata198/GoodTests/blob/master/LICENSE
'''
# vim: set ts=4 sw=4 st=... |
from six import string_types
from six.moves import cStringIO
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.layout import LAParams, LTChar, LTImage, LTPage
fro... |
import datetime
import os
import pytest
import re
import subprocess
from contextlib import contextmanager
from io import StringIO
from unittest import mock
from dcicutils.qa_utils import override_environ
from .. import generate_production_ini
from ..generate_production_ini import FourfrontDeployer
TEMPLATE_DIR = Fo... |
# Copyright (c) 2016, DjaoDjin 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 copyright notice,
# this list of conditions and t... |
import ipaddress
import logging
import napalm
from jinja2 import Template
from django.conf import settings
from django.db import models, transaction
from django.db.models import Q
from django.contrib.postgres.fields import ArrayField
from django.urls import reverse
from django.utils import timezone
from django.utils.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core import exceptions
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import Answer, AnswerChoice, Assignment, Question, Category
class AnswerChoiceInlineForm(fo... |
# -*- coding: utf-8 -*-
"""
===============
peony-twitter
===============
An asynchronous Twitter API client for Python 3.5+
"""
__author__ = "Florian Badie"
__author_email__ = "florianbadie@gmail.com"
__url__ = "https://github.com/odrling/peony-twitter"
__version__ = "2.0.1"
__license__ = "MIT License"
__keyw... |
# -*- coding: utf-8 -*-
"""
===============
peony-twitter
===============
An asynchronous Twitter API client for Python 3.6+
"""
__author__ = "Florian Badie"
__author_email__ = "florianbadie@gmail.com"
__url__ = "https://github.com/odrling/peony-twitter"
__version__ = "2.1.0-r1"
__license__ = "MIT License"
__k... |
# -*- coding: utf-8 -*-
##############################################################################
#
#
##############################################################################
{
'name': 'Asylum Seeker Center',
'version': '1.0',
'author': 'Threshold',
'category': 'Asylum',
'website': 'http... |
import csv
import glob
import os
from datetime import datetime
from lxml import etree
from openpyxl import load_workbook
from django.apps import apps
from django.conf import settings
from django.core.management import BaseCommand, CommandError
from django.db import connection, transaction
from django.db.models import... |
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
# Copyright (c) 2010-2013, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
#!/usr/bin/env python
import unittest
from unittest import TestCase
import getpass
import os
import shutil
import time
import tempfile
from binascii import unhexlify
from binascii import hexlify
from nose.plugins.skip import SkipTest
from ansible import errors
from ansible.utils.vault import VaultLib
# AES IMPORTS
tr... |
import json
from collections import OrderedDict, defaultdict
from enum import Enum
from functools import wraps
from pathlib import Path
from typing import Dict, List, Optional, TextIO, Union
from ._utils import _chained, _get_enum_str
from .errors import DuplicateError, NotFoundError, PegasusError
from .mixins import ... |
"""
Classes that represent different GEO entities
"""
from pandas import DataFrame
from sys import stderr, stdout
import abc
class DataIncompatibilityException(Exception): pass
class NoMetadataException(Exception): pass
class BaseGEO(object):
__metaclass__ = abc.ABCMeta
geotype = None
def __init__(s... |
#!/usr/bin/env python
#
# Copyright 2015 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 numpy as np
from optimization import Optimizer
from scipy import linalg, optimize
import copy
import sys
class opt_SGD(Optimizer):
"""
Optimize using stochastic gradient descent.
*** Parameters ***
model: reference to the model object
iterations: number of iterations
learning_rate: lear... |
"""
************************************************************************
FOR THE TIME BEING WHATEVER MODIFICATIONS ARE APPLIED TO THIS FILE
SHOULD ALSO BE APPLIED TO sdk_security IN ANY OTHER PARTNER REPOS
************************************************************************
"""
import logging
import os
import r... |
import os
DIRNAME = os.path.normpath(os.path.dirname(__file__))
# ===============
# Django settings
# ===============
#
# --------------
# Admin settings
# --------------
ADMINS = ()
MANAGERS = ADMINS
# -------------------
# Admin CRUD settings
# -------------------
ADMIN_MEDIA_PREFIX = '/admin-media/'
# ---------... |
# Django settings for testproject project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = 'database.db3' # Or path to database file i... |
lang_dicts = {
'endict' : {
"forgotten-articles-desc": "List of non-disambiguation, non-redirect oldest 1000 articles.",
"forgotten-articles-title": "Title",
"forgotten-articles-last-edited": "Last edited",
"forgotten-articles-editcount": "Number of edits",
"pagecount-desc": "The number of p... |
"""Leetcode 72. Edit Distance
Hard
URL: https://leetcode.com/problems/edit-distance/
Given two words word1 and word2, find the minimum number of operations
required to convert word1 to word2.
You have the following 3 operations permitted on a word:
- Insert a character
- Delete a character
- Replace a character
Ex... |
import os
from lcp.settings.base import * # noqa
# FIXME: The wildcard is only here while testing on Vagrant.
# Host header checking fails without it.
ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['POSTGRES_DB'],
'USER': os... |
"""
Django settings for leaderboard project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build ... |
# Copyright (c) 2014 Balazs Nemeth
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This file is distributed in the ho... |
from application import app, cache
from database import scoped_db
from flask.ext.restless import APIManager
from sqlalchemy import or_
from sqlalchemy.orm import Load
from sqlalchemy.orm.exc import NoResultFound
from models import classes
if classes:
from models import Uniprot, UniprotRegFull, PfamA, PdbPfamAReg, P... |
from bs4 import BeautifulSoup
def pretty_html(html_src):
parsed_html = BeautifulSoup(html_src)
return parsed_html.prettify()
_TOKEN_ANY = 'xxxany'
_TOKEN_OR = 'xxxor'
_PRE_PARSE_REPLACEMENTS = {
'(': '',
')': '',
'.*': _TOKEN_ANY,
'|': _TOKEN_OR
}
_POST_PARSE_REPLACEMENTS = {
_TOKEN_AN... |
#!/usr/local/bin/python
# Project : From geodynamic to Seismic observations in the Earth's inner core
# Author : Marine Lasbleis
""" geodyn.py
Define the base class for geodynamical models
CLass:
Model
def set_parameters
def verification
def proxy_singlepoint: NotImplemented
def d... |
"""This module contains the core functionalty of Phaseflow."""
import fenics
import h5py
import helpers
import globals
import default
import form
import solver
import bounded_value
import time
import refine
import output
'''@todo First add variable viscosity, later latent heat source term.
Conceptually... |
"""
Django settings for GuruTube 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, ...)
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.