text stringlengths 2 999k |
|---|
"""
Première tentative d'implémenter A* pour le projet ASD1-Labyrinthes.
On part d'une grille rectangulaire. Chaque case est un "noeud". Les
déplacements permis sont verticaux et horizontaux par pas de 1, représentant
des "arêtes" avec un coût de 1.
Tout est basé sur une grille rectangulaire.
L'objet de base est une... |
#!/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... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import wx
import PyDatabase
import images
import types
import string
import pickle
import os
from PhrResource import strVersion, MyListCtrl
class FrmSubMaintain(wx.Frame):
def __init__(self):
title = strVersion
wx.Frame.__init__(self, None, -1, titl... |
import re
import os
import logging
import locale
import json
import datetime, time
from django import forms
from django.conf import settings
from django.db.models import CharField
from django.core.exceptions import ValidationError
from django.forms.utils import flatatt
from django.utils.safestring import mark_safe
l... |
#! /usr/bin/env awx-python
#
# !!! READ BEFORE POINTING THIS AT YOUR FOOT !!!
#
# This script attempts to connect to an AWX database and insert (by default)
# a billion main_jobevent rows as screamingly fast as possible.
#
# tl;dr for best results, feed it high IOPS.
#
# this script exists *solely* for the purpose of ... |
import requests
from tqdm import tqdm
from code.configs import proxy
def download(url: str, file_name: str):
'''
根据文件直链和文件名下载文件
Parameters
----------
url: 文件直链
file_name : 文件名(文件路径)
'''
# 文件下载直链
# 请求头
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) Apple... |
print ('coucou') |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v - 1)
v = api.db_version(SQLALCHEMY_DATABASE_... |
#
# CAMP
#
# Copyright (C) 2017, 2018 SINTEF Digital
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
import unittest
from mock import patch, MagicMock, PropertyMock, call
from camp.execute.command.commands import Sc... |
'''
CFFI-Wrapper for YAJL C library version 2.x.
'''
from cffi import FFI
import functools
import sys
from ijson import common, backends, compat
from ijson.compat import b2s
ffi = FFI()
ffi.cdef("""
typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);
typedef void (*yajl_free_func)(void *ctx, void * ptr);
type... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Ke Sun (sunk@mail.ustc.edu.cn), Jingyi Xie (hsfzxjy@gmail.com)
# ------------------------------------------------------------------------------
import os
import tor... |
import asyncio
from mavsdk import System
from mavsdk import mission
from mavsdk.mission import (MissionItem, MissionPlan)
recList=[]
recList.append((47.39784021120378, 8.545238500649148))
recList.append((47.398107245316595, 8.545437644493619))
recList.append((47.39834218286399, 8.54481176383957))
recList.append((47.... |
# -*- 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):
# Removing unique constraint on 'Project', fields ['slug']
db.delete_unique('sentry_project', ['slug'])
... |
# Generated by Django 3.0.14 on 2021-09-24 14:19
import json
from django.db import migrations
def update_config(apps, schema_editor):
StudyType = apps.get_model("studies.StudyType")
external = StudyType.objects.get(name="External")
config = json.loads(external.configuration)
config["metadata"]["fiel... |
#!/usr/bin/env python
# This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2020 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved.
#
... |
__author__ = 'mphilpot'
from dev import *
#SERVICE_DISCOVERY_PROVIDER='argos.libs.discovery.EtcdDiscoveryProvider'
ETCD_HOSTNAME = '192.168.59.103'
BROKER_URL = 'amqp://guest:guest@192.168.59.103:5672/'
AUTHENTICATION_BACKENDS = (
#'argos.apps.common.auth.AniketosAuthentication',
'django.contrib.auth.backen... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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 applicable... |
import textacy
import spacy
nlp = spacy.load('en_core_web_sm')
from textblob import TextBlob
import configs as cfg
import re
import nltk
VOCABULARY = cfg.word_list
OUTPUT_MESSAGES = {
'generalities': 'Generalities (i.e about, almost, bad, close, good, many, most, timely) weaken the specification. Higher the coun... |
import numpy as np
from scipy.io import wavfile
def normalize(data):
temp = np.float32(data) - np.min(data)
out = (temp / np.max(temp) - 0.5) * 2
return out
def make_batch(path):
data = wavfile.read(path)[1][:, 0]
return get_wavenet_data(data)
def get_wavenet_data(data, resolution=256):
d... |
from math import pi
import numpy as np
from scipy.spatial.transform import Rotation as R
from cadquery import Workplane, Location
from pythreejs import (
NumberKeyframeTrack,
AnimationAction,
AnimationClip,
AnimationMixer,
BooleanKeyframeTrack,
ColorKeyframeTrack,
QuaternionKeyframeTrack,
... |
import os
import warnings
import numpy as np
from astropy.io import ascii
from astropy.table import Table
from astropy.table import Column
from beast.observationmodel.vega import Vega
from beast.physicsmodel.grid import SEDGrid
def mag_limits(seds, faint_cut, Nfilter=1, bright_cut=None):
"""
Selects models w... |
import os
import subprocess
import sys
import re
from joblib import Parallel, delayed
from tqdm import tqdm
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Align.Applications import PrankCommandline
from Bio.Align.Applications import MafftCommandline
from Bio.Align.Applicat... |
import collections
import contextlib
import sys
import wave
import webrtcvad
import librosa
def read_wave(path):
with contextlib.closing(wave.open(path, 'rb')) as wf:
num_channels = wf.getnchannels()
assert num_channels == 1
sample_width = wf.getsampwidth()
assert sample_width ==... |
# Tests of the quasiisothermaldf module
from __future__ import print_function, division
import numpy
#fiducial setup uses these
from galpy.potential import MWPotential, vcirc, omegac, epifreq, verticalfreq
from galpy.actionAngle import actionAngleAdiabatic, actionAngleStaeckel
from galpy.df import quasiisothermaldf
aAA... |
from __future__ import unicode_literals
from django.apps import apps
from django.core.management import CommandError
from django.core.management.color import no_style
from django.core.management.sql import (
sql_all, sql_create, sql_delete, sql_destroy_indexes, sql_indexes,
)
from django.db import DEFAULT_DB_ALIAS... |
from conans import python_requires
import os
common = python_requires('llvm-common/0.0.3@orbitdeps/stable')
class LLVMDebugInfoCodeView(common.LLVMModulePackage):
version = common.LLVMModulePackage.version
name = 'llvm_debuginfo_codeview'
llvm_component = 'llvm'
llvm_module = 'DebugInfoCodeView'
l... |
import asyncio
import logging
from accuweather import (
AccuWeather,
ApiError,
InvalidApiKeyError,
InvalidCoordinatesError,
RequestsExceededError,
)
from aiohttp import ClientError, ClientSession
LATITUDE = 52.0677904
LONGITUDE = 19.4795644
LOCATION_KEY = "268068"
API_KEY = "xxxxx"
logging.basicC... |
from kivy_ios.toolchain import Recipe, shprint
import sh
from os.path import exists
import logging
logger = logging.getLogger(__name__)
class LibffiRecipe(Recipe):
version = "3.3"
url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
library = "build/Release-{arch.sdk}/libffi.a"
include_per... |
from __future__ import absolute_import, unicode_literals
from django import forms
class PasswordPageViewRestrictionForm(forms.Form):
password = forms.CharField(label="Password", widget=forms.PasswordInput)
return_url = forms.CharField(widget=forms.HiddenInput)
def __init__(self, *args, **kwargs):
... |
import sys
# Remove current dir from sys.path, otherwise setuptools will peek up our
# module instead of system's.
sys.path.pop(0)
from setuptools import setup
sys.path.append("..")
import sdist_upip
setup(name='micropython-tabnanny',
version='0.0.0',
description='Dummy tabnanny module for MicroPython',
... |
from .reward import Reward
class ConstantReward(Reward):
"""
Defines a constant reward on the StateActionSpace or a subset of it.
Subsets can be defined by explicitly specifying a Space object, or by providing a function that checks whether
the step should be rewarded.
"""
def __init__(self, s... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
#!/usr/bin/env python3
import isce
from isceobj.Sensor import createSensor
import shelve
import argparse
import glob
from isceobj.Util import Poly1D
from isceobj.Planet.AstronomicalHandbook import Const
import os
import datetime
import numpy as np
def cmdLineParse():
'''
Command line parser.
'''
pars... |
from django.urls import include, path, reverse
from django.utils.html import format_html
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from ... |
import socket
import network_lib
import sys
try:
file = open(sys.argv[2], 'r')
tar = file.read()
file.close()
except:
print "Error opening file. Ending script. (exited with code 1)"
sys.exit(1)
# create socket, get hostname, and bind server to localhost at port 14
s = socket.socket()
host = socket.gethostname()
... |
from handler.base_plugin import BasePlugin
import json
import motor.motor_asyncio
class sdict(dict):
"""Dictionary with field `changed`. `changed` is True when any element was
accessed."""
def __init__(self, *args, **kwargs):
self.changed = False
super().__init__(*args, **kwargs)
d... |
import os.path
import sqlite3
import pandas as pd
import numpy as np
import io
from typing import List
from models import *
# the values of these command line arguments are used to define the name of the experiments
# you can add more names in this list
EXPERIMENT_PARAMETERS = ["model", "type", "N", "flip", "restric... |
from flask import Flask, render_template
from os import getenv
from functools import reduce
from threading import Timer
from werkzeug.contrib.cache import RedisCache
import requests
import logging
app = Flask(__name__)
cache = RedisCache(host='redis', port=6379, password=None, db=0, default_timeout=300, key_prefix=No... |
from accounts.factories import UserFactory
from functional_tests import pages
from functional_tests.base import FunctionalTestCase
class PasswordResetTestCase(FunctionalTestCase):
def setUp(self):
super().setUp()
self.user = UserFactory()
self.password = self.fake.password()
def test... |
from fastapi import APIRouter, Body
router = APIRouter()
@router.post("/compute/")
def compute(a: int = Body(...), b: str = Body(...)):
return {"a": a, "b": b}
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Вариант6
# Использовать словарь, содержащий следующие ключи: название пункта назначения; номер
# поезда; время отправления. Написать программу, выполняющую следующие действия:
# ввод с клавиатуры данных в список, состоящий из словарей заданной структуры; записи до... |
import os
from functools import lru_cache
from pathlib import Path
from pydantic import BaseSettings
class Settings(BaseSettings):
PROJECT_NAME = "Book Search"
API_V1_STR = "/api/v1"
ES_HOST = "127.0.0.1:9200"
"""
.. _ES_HOST:
ElasticSearch hosts
"""
BACKEND_CORS_ORIGINS: str = ".*"... |
from __future__ import division, print_function
import numpy as np
import pygame
from highway_env.road.lane import LineType
from highway_env.vehicle.graphics import VehicleGraphics
class LaneGraphics(object):
"""
A visualization of a lane.
"""
STRIPE_SPACING = 5
""" Offset between stripes [m]... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
import random
#代理============
"""
123.115.120.182:9000#中国北京市
183.141.72.67:3128#中国浙江省嘉兴市
36.71.40.87:8080#印度尼西亚
112.249.... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Erik Johnson (erik@saltstack.com)`
tests.integration.states.npm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import s... |
import KratosMultiphysics as KM
import KratosMultiphysics.CoSimulationApplication as KMC
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.kratos_utilities as kratos_utils
from KratosMultiphysics.CoSimulationApplication.factories import data_transfer_operator_factory
from KratosMulti... |
from flask import render_template
from . import main
@main.app_errorhandler(404)
def not_found(error):
'''
function to render the 404 error page
'''
return render_template('not_found.html'), 404 |
"""Forwards to dol.filesys:
File system access
"""
from dol.filesys import *
|
"""Constants for the FMI Weather and Sensor integrations."""
from datetime import timedelta
import logging
_LOGGER = logging.getLogger(__package__)
DOMAIN = "fmi"
NAME = "FMI"
MANUFACTURER = "Finnish Meteorological Institute"
COORDINATOR = "coordinator"
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=30)
UNDO_UPDATE_LI... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013, Peter Sprygada <sprygada@gmail.com>
# 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_versio... |
# Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS", WIT... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: chirpstack-api/as_pb/external/api/internal.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
from itertools import chain
FORMAT_RE = re.compile(r"\`(\d*)\`")
def interpolate_string(text, get_param) -> str:
index = [1]
def get_item(index):
if 1 <= index <= len(args):
return args[index - 1]
else:
... |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
import base64
import sys
stSpam, stHam, stDump = 0, 1, 2
# The markers parameters is in form ('start1', 'stop1'), ('start2', 'stop2')...
# Return is (ma... |
#
# The Python Imaging Library.
# $Id$
#
# PDF (Acrobat) file handling
#
# History:
# 1996-07-16 fl Created
# 1997-01-18 fl Fixed header
# 2004-02-21 fl Fixes for 1/L/CMYK images, etc.
# 2004-02-24 fl Fixes for 1 and P images.
#
# Copyright (c) 1997-2004 by Secret Labs AB. All rights reserved.
# C... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Brocade.CER.get_config
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------... |
from .run import standard_run
from .offpg_run import offpg_run |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
print "[INFO] forms model init..."
# map for evidence type question ui-code and full question content
# TODO: all of this should be generated from a SPARQL query of the
# DIKB IC annotation properties in the DIDEO ontology. This will save
# maintainance time and utilize the hierarchical structure of the
# ontology
glo... |
from django.conf.urls import include, url
from careplus.medications import views
from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSetView
# app_name = 'medications'
urlpatterns = [
url(r'^$', views.active_medications, name='activeMedications'),
url(r'^create_medication/(?P... |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# 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/LIC... |
"""
MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
Copyright (C) 2012 University of Auckland
This file is part of MAP Client. (http://launchpad.net/mapclient)
MAP Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Genera... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, valiantsystems and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class Employee(Document):
pass
|
from floodsystem.station import MonitoringStation
#from floodsystem.stationdata import *
##Task 2B
def stations_level_over_threshold(stations, tol):
station_list = []
for station in stations:
if station.relative_water_level() is not None and station.relative_water_level() > tol:
stati... |
# qubit number=3
# total number=4
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from ... |
"""
Author: Grant Mitchell
Date: 10/23/19
PA #3 NLP
In this program we are going to read in the answers from the file created by decision-list-test.py and compare it to
the file sentiment-gold.txt which has the correct classification of each review to evaluate how well our classifier
worked.
input: ./decisi... |
import logging
import os
import time
import traceback
import argparse
from .inout import CravatReader
from .inout import CravatWriter
from .inout import AllMappingsParser
from cravat.config_loader import ConfigLoader
import sys
from .constants import crv_def
from .constants import crx_def
from .constants import crg_def... |
#!/usr/bin/env python3
# Copyright (c) 2017-2021 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 that the wallet can send and receive using all combinations of address types.
There are 5 nodes-u... |
#!/usr/bin/env python
# coding: utf-8
# This little project is hosted at: <https://gist.github.com/1455741>
# Copyright 2011-2020 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
import os
import sys
from email.encoders import encode_base64
from email.mime.base impor... |
import numpy as np
def get_strehl_from_focal(img, ref_img):
'''Get the Strehl ratio from a focal-plane image.
Parameters
----------
img : Field or array_like
The focal-plane image.
ref_img : Field or array_like
The reference focal-plane image without aberrations.
Returns
-------
scalar
The Strehl ratio... |
# -*- coding: utf-8 -*-
#
# geometric-smote documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 18 14:44:12 2016.
#
# 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 fil... |
from typing import Dict, List, Union
def get_config_value(
field_name: str, configuration: List[Dict[str, Union[str, bool]]]
) -> Union[str, bool, None]:
for elem in configuration:
if elem["name"] == field_name:
return elem["value"]
return None
|
from flask import Flask, request, Response
from flask_restful import Api
from data.data import Data
from visualization.wordCloudApi import WordCloudApi
import time
app = Flask(__name__)
api = Api(app)
api.add_resource(WordCloudApi, "/api/qqrv/v1/word_cloud")
@app.route("/upload", methods=["POST"])
def upload_file(... |
import errno
import mmap
import os
import shutil
import struct
import time
from binascii import hexlify, unhexlify
from collections import defaultdict
from configparser import ConfigParser
from datetime import datetime
from functools import partial
from itertools import islice
from .constants import * # NOQA
from .ha... |
#!/usr/bin/env python
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2020 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files ... |
from .utils import current_authenticated_entity
from .abstract import AbstractPrivilege
class AndPrivilege(AbstractPrivilege):
def __init__(self, *privileges):
self._privileges = privileges
def check(self):
for privilege in self._privileges:
if not privilege.check():
... |
"""!
@brief Common definition for CCORE.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import pyclustering.core as core
import os
import platform
from sys import platform as _platform
# Path to CCORE library - pyclustering core.
PATH_PYCLUSTERING_C... |
# Copyright 2021 DAI Foundation
#
# 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,... |
from h.models.user import (
DISPLAY_NAME_MAX_LENGTH,
EMAIL_MAX_LENGTH,
USERNAME_MAX_LENGTH,
USERNAME_MIN_LENGTH,
)
from h.schemas.base import JSONSchema
class CreateUserAPISchema(JSONSchema):
"""Validate a user JSON object."""
schema = {
"type": "object",
"properties": {
... |
"""
Idea taken from: https://github.com/mattupstate/overholt/blob/master/tests/utils.py
"""
from status_updater import StatusUpdater, MockStatusUpdater
from remote_job_manager import RemoteJobManager
from remote_job import RemoteJob
|
"""
本文件集中存放与测试业务相关的配置信息
"""
ecshop_homepage = "http://127.0.0.1/ecshop"
ecshop_regpage = "http://127.0.0.1/ecshop/user.php?act=register" |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Energenys-Ipasoft and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestCondominios(unittest.TestCase):
pass
|
"""
Created by Akshay Maheshwari
09/05/2017
Simulation analysis methods for 2D hard disk systems
"""
def loadOutputList(expt_name,outputType):
"""Loads a file containing all file names with a specified output data into a local list
Args:
expt_name (String): Name of experiment (which contains how ... |
import unittest
from typing import (
ClassVar,
Dict,
List,
Tuple,
Type,
)
from unittest.mock import (
Mock,
patch,
)
from setuptools import Command
from flutils.setuputils import add_setup_cfg_commands
from flutils.setuputils.cfg import SetupCfgCommandConfig
from flutils.setuputils.cmd imp... |
"""
author : Mayank Kumar Jha (mk9440)
"""
from typing import List
def find_max_sub_array(A, low, high):
if low == high:
return low, high, A[low]
else:
mid = (low + high) // 2
left_low, left_high, left_sum = find_max_sub_array(A, low, mid)
right_low, right_high, right_sum = fin... |
# coding=utf-8
# author: al0ne
# https://github.com/al0ne
import re
import base64
import urllib3
import glob
import itertools
import concurrent.futures
import logging
import ssl
import chardet
import socket
import OpenSSL
import requests
import random
from urllib import parse
from bs4 import BeautifulSoup
from lib.ver... |
import json
from metaflow.util import is_stringish
from . import (
MetaflowCheck,
AssertArtifactFailed,
AssertLogFailed,
assert_equals,
assert_exception,
truncate,
)
class MetadataCheck(MetaflowCheck):
def __init__(self, flow):
from metaflow.client import Flow, get_namespace
... |
'''
DoubleQAgentClass.py: Class for an RL Agent acting according to Double Q Learning from:
Hasselt, H. V. (2010). Double Q-learning.
In Advances in Neural Information Processing Systems (pp. 2613-2621).
Author: David Abel
'''
# Python imports.
import random
from collections import defaultdict
# Other impor... |
def V(i,j):
return 'V%d_%d' % (i,j)
def domains(Vs):
return [ q + ' in 1..9' for q in Vs ]
def all_different(Qs):
return 'all_distinct([' + ', '.join(Qs) + '])'
def get_column(j):
return [V(i,j) for i in range(9)]
def get_raw(i):
return [V(i,j) for j in range(9)]
def ho... |
# Copyright (c) 2015-2019 Patricio Cubillos and contributors.
# MC3 is open-source software under the MIT license (see LICENSE).
from .gelman import *
from .stats import *
from .time_averaging import *
__all__ = (
gelman.__all__
+ stats.__all__
+ time_averaging.__all__
)
# Clean up top-level namespace-... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright 2017 Spotify AB
#
# 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, softw... |
from django.apps import AppConfig
class UsersAppConfig(AppConfig):
name = "gemtown.users"
verbose_name = "Users"
def ready(self):
try:
import users.signals # noqa F401
except ImportError:
pass
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... |
# pylint: disable=duplicate-code
"""
Buildings example
=================
.. Copyright:
Copyright Wirepas Ltd 2019 licensed under Apache License, Version 2.0
See file LICENSE for full license details.
"""
from utils import get_settings, setup_log
from connections import Connections
import j... |
import itertools
import math
import random
from sc2simulator import constants as c
mapDimensions = None
################################################################################
def defineLocs(locP1, locP2, d):
"""ensure both player locations are defined as map location tuples"""
global mapDimension... |
import mvc.model
import mvc.view
import random
class GameOfLifeController:
def __init__(self): # initializer (it's the first piece of code executed in a newly created instance of the class)
""" initialize variables """
self.model = mvc.model.GameOfLifeModel() # make an instance of the model clas... |
from django.core.checks import Error
from django.test import SimpleTestCase
from allianceutils.checks import check_db_constraints
from allianceutils.checks import ID_ERROR_DB_CONSTRAINTS
class TestCheckDBConstraints(SimpleTestCase):
def test_warning(self):
errors = check_db_constraints(None)
# E... |
"""
Copyright 2021 Dugal Harris - dugalh@gmail.com
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 applicab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.