text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
import os
import pytest
@pytest.fixture(scope='session')
def absolute_path():
"""Fixture to create full path relative to `contest.py` inside tests."""
def factory(*files):
dirname = os.path.dirname(__file__)
return os.path.join(dirname, *files)
return factory
|
#! /usr/bin/env python
# *-* encoding: utf-8
# ------------------------------------------------------------
# liuyang,mtime: 2012-11-29 15:01:39
# 这是一个python版本的简易lisp解释其的实现.
# 参考代码:http://www.googies.info/articles/lispy.html
# 利用python的特性,可以很方便的写出这个解释器,代码量相当之小
# 但是麻雀虽小,五脏俱全.
# 这个解释器完整的实现了,从输入,解析,环境,计算的过程.对理解编译过程,与语言... |
a = "Hello"
c = "!!! 🙋♂️ "
b = " Rayne"
print(a + b + c)
|
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import dash_table
import pandas as pd
import lorem
import pathlib
# Path
BASE_PATH = pathlib.Path(__file__).parent.resolve()
DATA_PATH = BASE_PATH.joinpath("Data").resolve()
## Rea... |
from dataclasses import dataclass, field
from typing import List, Optional
from xsdata.models.datatype import XmlDateTime
from siri.siri_model.siri_facility_v2_0 import (
FacilityChangeElement,
FacilityConditionElement,
)
from siri.siri_model.siri_journey_support_v2_0 import (
FirstOrLastJourneyEnumeration,... |
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import datetime
import unittest
import frappe
from frappe.utils import (
format_datetime,
format_time,
formatdate,
get_datetime,
get_time,
get_user_date_format,
get_user_time_format,
getdate,
)
test_date_obj = dat... |
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import six
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
class Configuration(CloudFormationLintRule):
"""Check if Mappings are configured correctly"""
id = 'E70... |
import numpy as np
import os
import pandas
import datetime
import h5io
from pyfileindex import PyFileIndex
from pyiron_base.generic.util import Singleton
from pyiron_base.database.generic import IsDatabase
def filter_function(file_name):
return ".h5" in file_name
class FileTable(IsDatabase, metaclass=Singleton)... |
import os
if 'DEBUG_SERVER' in os.environ:
# connect to debugger
import pydevd_pycharm
hostname, port = os.environ['DEBUG_SERVER'].split(':')
pydevd_pycharm.settrace(hostname, port=int(port),
stdoutToServer=True, stderrToServer=True)
|
import numpy as np
from .LETTERS import kor_phonemes, kor_re, eng_phonemes, eng_re
import numpy as np
# 일본어는 나중에
# https://m.blog.naver.com/PostView.nhn?blogId=aoba8615&logNo=140012660052&proxyReferer=https:%2F%2Fwww.google.com%2F
def check_encodings(string):
"""
문자열의 인코딩을 확인하는 함수
문자열이 유니코드가 아니면 디코드해서 변... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: proxyFetcher
Description :
Author : JHao
date: 2016/11/25
-------------------------------------------------
Change Activity:
2016/11/25: proxyFetcher
---------------------------... |
from datetime import datetime
import json
from django.conf import settings
from django.core import mail
from django.core.mail import EmailMultiAlternatives
from django.core.management import call_command
from django.test import TestCase, SimpleTestCase
from django.test.utils import override_settings
from django_dynami... |
"""Tests for `qdyn` package."""
import pytest
from pkg_resources import parse_version
import qdyn
def test_valid_version():
"""Check that the package defines a valid __version__"""
assert parse_version(qdyn.__version__) >= parse_version("0.3.0-dev")
|
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/melodic/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.... |
from math import tau
from random import choice
import pkgutil
import string
from .common import change_sprite_image
ROTS = {
(1, 0): 0,
(0, 1): 1,
(-1, 0): 2,
(0, -1): 3,
}
SYMBOLS = {}
text = pkgutil.get_data('mufl', 'text/symbols.txt').decode('utf-8')
for line in text.splitlines():
sym, codes =... |
"""
WSGI config for agender_ui project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... |
# -*- coding: utf-8 -*-
# Copyright Aaron Snoswell
#
# 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 py
import os, time, sys
from rpython.tool.udir import udir
from rpython.rlib.rarithmetic import r_longlong
from rpython.annotator import model as annmodel
from rpython.translator.c.test.test_genc import compile
from rpython.translator.c.test.test_standalone import StandaloneTests
posix = __import__(os.name)
def... |
# Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
import logging
import os
import sys
import json
import yaml
from twisted.internet import reactor
from piped import exceptions, resource, processing, service
logger = logging.getLogger('piped.service')
runtime_enviro... |
from .edsr import EDSR
from .edvr_net import EDVRNet
from .edvr_net_wopre import EDVRNet_WoPre
from .edvr_net_wopre2 import EDVRNet_WoPre2
from .edvr_net_test import EDVRNet_Test
from .rrdb_net import RRDBNet
from .sr_resnet import MSRResNet
from .srcnn import SRCNN
from .tof import TOFlow
__all__ = [
'MSRResNet',... |
import unittest
import csep
import os.path
import numpy
def get_datadir():
root_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(root_dir, 'artifacts', 'JMA-observed_catalog')
return data_dir
def test_JmaCsvCatalog_loading():
datadir = get_datadir()
csv_file = os.path.jo... |
# -*- coding: utf-8 -*-
# Compatible with Python 3.8
# Copyright (C) 2020-2021 Oscar Gerardo Lazo Arjona
# mailto: oscar.lazoarjona@physics.ox.ac.uk
r"""Miscellaneous routines."""
import numpy as np
import warnings
from scipy.interpolate import interp1d
from numpy import sinc as normalized_sinc
from scipy.special impor... |
"""globus URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
from dataclasses import dataclass
from bindings.csw.simple_literal import SimpleLiteral
__NAMESPACE__ = "http://purl.org/dc/elements/1.1/"
@dataclass
class Description2(SimpleLiteral):
"""An account of the content of the resource.
Examples of Description include, but are not limited to, an
abstract, tab... |
from time import sleep
from typing import Sequence, Iterator, Callable, TypeVar, Iterable
from typhoon.core import SKIP_BATCH
T = TypeVar('T')
def branch(branches: Sequence[T], delay: int = 0) -> Iterable[T]:
"""
Yields each item in the sequence with an optional delay
:param branches:
:param delay:
... |
import pprint
import sys
import os.path
sys.path.append(os.getcwd())
this_dir = os.path.dirname(__file__)
from lib.fast_rcnn.train import get_training_roidb, train_net
from lib.fast_rcnn.config import cfg_from_file, get_output_dir, get_log_dir
from lib.datasets.factory import get_imdb
from lib.networks.factory import... |
"""Tests for the Subaru component config flow."""
# pylint: disable=redefined-outer-name
from copy import deepcopy
from unittest import mock
from unittest.mock import patch
import pytest
from subarulink.exceptions import InvalidCredentials, InvalidPIN, SubaruException
from homeassistant import config_entries
from hom... |
"""
Triangle Numbers on Python
git-repository: https://github.com/360macky/seqCodes
author: Marcelo A.S.
"""
print("Triangle Numbers")
# Solicitamos el término
n = int(input("Ingresa el número de términos de la secuencia de números triangulares"))
i = 1
while i < n:
z = (i*(i+1))/2
print(z)
i+=1 |
class UnregisteredExperimentException(Exception):
"""Unregistered Experiment.
Thrown when experiment is not registered in the provided experiment path.
"""
def __init__(self, message, errors=None):
super().__init__(message)
self.errors = errors
class FieldException(Exception):
"... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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, ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
"""
Make sure that we handle an expression on a thread, if
the thread exits while the expression is running.
"""
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class TestExitDuringExpression(TestBase):
mydir = TestBase.compute_... |
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oschub.settings")
import django
django.setup()
import gspread
from google.oauth2 import service_account
from eventreg.models import EventUserData, Event
from accounts.models import MailList
import datetime
from decouple import config
import json
# creates... |
import requests
from os.path import basename
from urllib.parse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.management.base import BaseCommand, CommandError
from django.db.transaction import atomic
from olympia import amo
from olymp... |
"""Utilities for configuration."""
from copy import copy, deepcopy
from collections import namedtuple
import dill
import inspect
from vectorbt import _typing as tp
from vectorbt.utils import checks
from vectorbt.utils.attr import deep_getattr
def resolve_dict(dct: tp.DictLikeSequence, i: tp.Optional[int] = None) ->... |
import datetime
import logging
import operator as op
import os
import re
import shutil
from functools import partial
from itertools import chain, islice, ifilter, ifilterfalse
import antlr3
from antlr3.tree import CommonTree as AST
from grammar.JavaLexer import JavaLexer as Lexer
from grammar.JavaParser import JavaPar... |
#!/usr/bin/env python
import os
from query_string import query_string
__all__ = ["GET"]
def _get():
kwargs = dict()
if "QUERY_STRING" in os.environ:
QUERY_STRING = os.environ["QUERY_STRING"]
qs = query_string(QUERY_STRING)
for k in qs:
v = qs[k]
kwargs[k] = v
... |
""" Contains WikiPage type """
from __future__ import annotations
# noinspection PyPep8Naming
from mwclient import Site as API
from utils.ScorableItem import ScorableItem
# noinspection PyPep8Naming
TITLE_SAFE_CHARACTERS = "/ "
SPACE_REPLACEMENT = "_"
# noinspection PyShadowingBuiltins
# pylint: disable=too-few-... |
# SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
Built-in SecurityRisk definitions associated with FIT image functionality
"""
from textwrap import dedent
from .. import SecurityImpact
def _enabled_with_legacy_image(value: str, config: dict):
return value and... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from thumbor.ext.filters import _nine_patch
from thumbor.filters imp... |
import torch
from .manifold import Manifold
from frechetmean.utils import EPS, cosh, sinh, tanh, arcosh, arsinh, artanh, sinhdiv, divsinh
class Poincare(Manifold):
def __init__(self, K=-1.0, edge_eps=1e-3):
super(Poincare, self).__init__()
self.edge_eps = 1e-3
assert K < 0
if torc... |
# BSD 3-Clause License
#
# Copyright (c) 2012, the Sentry Team, see AUTHORS for more details
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Red... |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
from dagster_celery.executor import CELERY_CONFIG
from dagster_k8s import DagsterK8sJobConfig
from dagster import Field, Noneable, StringSource
from dagster.core.host_representation.handle import IN_PROCESS_NAME
from dagster.utils import merge_dicts
CELERY_K8S_CONFIG_KEY = "celery-k8s"
def celery_k8s_config():
... |
from common import *
|
import numpy as np
from . import constants
class Object:
def __init__(self, world, pos):
self.world = world
self.pos = np.array(pos)
self.random = world.random
self.health = 0
@property
def texture(self):
raise 'unknown'
@property
def walkable(self):
return constants.walkable
... |
import torch.utils.data as data
from PIL import Image
import os
import os.path
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
print('the data loader file has benn modified')
IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm']
def is_image_file(filename):
"""Checks if a file is ... |
"""
django-admin-tools is a collection of extensions/tools for the default django
administration interface, it includes:
* a full featured and customizable dashboard,
* a customizable menu bar,
* tools to make admin theming easier.
"""
VERSION = '0.4.0'
|
# Command line arguments
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('bnc_path', help='The path to the BNC corpus files')
ap.add_argument('dataset_path', help='The path to the dataset directory with the BNC IDs')
ap.add_argument('out_path', help='Where to save the dataset with the sentences from BNC'... |
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.datasets as dsets
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plot
import collections
import pandas as pd
def substrings_in_string(big_string, substrings):
for i in range(len(sub... |
import logging
from typing import Optional, DefaultDict, Dict, Tuple, Set, Any, Union, TYPE_CHECKING
from collections import defaultdict
import ailment
import pyvex
from ...block import Block
from ...codenode import CodeNode
from ...engines.light import SimEngineLight
from ...knowledge_plugins.functions import Funct... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_template_dev_22776.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
... |
#!/usr/bin/env python
from datetime import datetime
import os
#querying
import pandas as pd
import numpy as np
#plotting
#from plotly.offline import plot #to save graphs as html files, useful when testing
import plotly.graph_objs as go
#dashboarding
import dash
import dash_core_components as dcc
import dash_html_co... |
# Copyright 2013-2022 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 Librsb(AutotoolsPackage):
"""librsb : A shared memory parallel sparse matrix computations
... |
from copy import deepcopy
import json
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import Client, TestCase, override_settings
from django.urls import reverse
from spid_cie_oidc.entity.models import FederationEntityConfiguration
from spid_cie_oidc.relying_party.models ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
import tkinter as tk
from tkinter import ttk
class NoteListUi:
def __init__(self, frame, add_note, save_note_with_title, remove_note_with_title, select_note):
self.frame = frame
self.note_list = tk.Listbox(self.frame, width=30, height=15)
self.note_list.select_note = select_note
... |
# -*- coding: UTF-8 -*-
import time
import sys
# import terminalcomman
import terminalsize
class RunBar:
term_size = terminalsize.get_terminal_size()[1]
def __init__(self, total_size, total_pieces=1):
self.displayed = False
self.total_size = total_size
self.total_pieces = total_pieces
... |
# -*- coding: utf-8 -*-
import cv2
import sys
import gc
from train import Model
if __name__ == '__main__':
if len(sys.argv) != 1:
print("Usage:%s camera_id\r\n" % (sys.argv[0]))
sys.exit(0)
# 加载模型
model = Model()
model.load_model(file_path='../model/face.model.h5')
# 框住人脸的矩形边框颜色
... |
import numpy as np
from layer_utils import *
""" Super Class """
class Module(object):
def __init__(self):
self.params = {}
self.grads = {}
def forward(self):
raise ValueError("Not Implemented Error")
def backward(self):
raise ValueError("Not Implemented Error")
""" Cla... |
from enum import Enum
from typing import (
List,
Optional,
)
_Signals = Enum("Signals", ["DOT", "DASH"])
_Pauses = Enum("Pauses", ["SIGNAL", "LETTER", "WORD"])
_ON_TIMINGS = {
0.25: _Signals.DOT,
0.75: _Signals.DASH,
}
_OFF_TIMINGS = {
0.25: _Pauses.SIGNAL,
1.25: _Pauses.LETTER,
2.50: _P... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import base64
from ccxt.base.errors import ExchangeError
class luno (Exchange):
... |
from tests.functional.services.utils.http_utils import http_put, APIResponse
class TestSubscriptionsAPIPutReturns200:
def test_update_subscription(self, add_alpine_subscription):
subscription, api_conf = add_alpine_subscription
resp = http_put(
["subscriptions", subscription.get("subsc... |
"""SCons
The main package for the SCons software construction utility.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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 rest... |
# coding: utf-8
"""
OpsGenie REST API
OpsGenie OpenAPI Specification # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from opsgenie_swagger.models.base_response import BaseResponse ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... |
from __future__ import absolute_import
import json
import mock
import os.path
import responses
import pytest
import time
from datetime import datetime
from flask import current_app
from uuid import uuid5, UUID
from changes.config import db
from changes.constants import Status, Result
from changes.models import (
... |
import os
import sys
from types import ModuleType
from .module_loading import load_module
# we assume that our code is always run from the root dir of this repo and nobody tampers with the python path
# we use this to determine whether we should make a backup of the file of a class or not, because if it is from
# ou... |
# Copyright 2013-2019 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)
import os
import sys
from spack import *
class Vtk(CMakePackage):
"""The Visualization Toolkit (VTK) is an open-sou... |
import matrix
import digits
import urandom
import time
#assign randint function to r
r = urandom.randint
#create matrix class object
s = matrix.matrix
#create digits class object
d = digits
#initialize led matrix
s.init()
#clear led matrix
s.clear_all()
#show changes
s.show()
color = 0
whil... |
import pytest
from fastapi.applications import FastAPI
from httpx import AsyncClient
from starlette.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
from app.models.domain.users import UserInDB
pytestmark = pytest.mark.asyncio
async def test_user_successful_login(
app: FastAPI, client: AsyncClient, test_user: Us... |
from django.conf.urls import url, include
from .views import test
urlpatterns = [
url(r'^test/$', test, name='front-test'),
url(r'^i18n/', include('django.conf.urls.i18n')),
]
|
from pwn import *
# Bruteforce the index of the buffer
conn = remote("localhost", 50000)
print(conn.recv())
conn.send("I am not a robotBBAAAA%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x... |
def string_to_bool(string):
if string in ('True', 'true', 'yes', 'y'):
return True
elif string in ('False', 'false', 'no', 'n'):
return False
else:
raise ValueError('Invalid string passed to string_to_bool.')
|
class Solution(object):
def uniquePaths(self, m, n):
if m < n:
return self.uniquePaths(n, m)
ways = [1] * n
for i in xrange(1, m):
for j in xrange(1, n):
print("#####")
print(ways)
ways[j] += ways[j - 1]
... |
from ....models import Instrument
from baselayer.app.access import auth_or_token
from ...base import BaseHandler
class RoboticInstrumentsHandler(BaseHandler):
@auth_or_token
def get(self):
instruments = (
Instrument.query_records_accessible_by(self.current_user)
.filter(Instrum... |
from typing import Dict, Optional, Sequence, Union
from rastervision2.pipeline.config import Config, register_config, Field
ClassFilter = Sequence[Union[str, 'ClassFilter']]
@register_config('vector_source')
class VectorSourceConfig(Config):
default_class_id: Optional[int] = Field(
...,
descript... |
import unittest.mock as mock
from unittest import TestCase
from esrally import racecontrol, config, exceptions
class RaceControlTests(TestCase):
def test_finds_available_pipelines(self):
expected = [
["from-sources-complete", "Builds and provisions Elasticsearch, runs a benchmark and reports ... |
import unittest
import odatacameradeputados
class GetInfoCDProposicoes(unittest.TestCase):
def test_get_proposicoes_200OK(self):
proposicoes = odatacameradeputados.get_proposicoes()
self.assertTrue(proposicoes["status_code"] == 200)
def test_get_proposicoes_not_none(self):
proposicoes... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.FengdieActivityCreateData import FengdieActivityCreateData
class AlipayMarketingToolFengdieActivityCreateModel(object):
def __init__(self):
self._activi... |
# *****************************************************************
# Copyright 2015 MIT Lincoln Laboratory
# Project: SPAR
# Authors: OMD
# Description: Python script to configure an NTP client and run it
#
# Modifications:
# Date Name Modification
# ---- ... |
class JobService:
def update_status(self):
pass
|
'''
Implements base class for proxy managers. Inherit this to quickly create classes using different proxy APIs
'''
from pytimeparse.timeparse import timeparse
import datetime
from collections import deque
class ProxyManager():
def __init__(
self,
blacklist_cooldown='8hr',
reuse_cool... |
#!/usr/bin/env python
# Copyright (C) 2015 Wayne Warren
#
# 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... |
import time
from django.core.management.base import BaseCommand
from django.db import connections
from django.db.utils import OperationalError
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write('Waiting for the database...')
db_catch = False
while not db_ca... |
import random
import unittest
from hearthbreaker.agents.basic_agents import PredictableAgent, DoNothingAgent
from hearthbreaker.constants import CHARACTER_CLASS, MINION_TYPE
from hearthbreaker.engine import Game
from hearthbreaker.replay import playback, Replay
from tests.agents.testing_agents import CardTestingAgent,... |
from abc import ABC, abstractmethod
class StartableBase(ABC):
"""Abstract base class for Thread- and Process-like objects."""
__slots__ = ()
@abstractmethod
def start(self) -> None:
raise NotImplementedError
__all__ = ["StartableBase"]
|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-29 23:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0007_auto_20160228_1453'),
]
operations = [
migrations.RemoveField(... |
"""3D geometric functions used by the visualizer."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, List, Tuple, Union
import numpy as np
from ..label.typing import Box3D
def rotate_vector(
vector: np.ndarray,
rot_x: float = 0,
rot_y: float = 0,
rot_z:... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.nn as nn
from torch.distributions import MultivariateNormal, constraints
import pyro.distributions as dist
from pyro.contrib.timeseries.base import TimeSeriesModel
from pyro.nn import PyroParam, pyro_meth... |
import htcondor
import os
import shutil
import subprocess
import sys
from datetime import datetime, timedelta
from pathlib import Path
from .conf import *
from .dagman import DAGMan
# Must be consistent with job status definitions in src/condor_includes/proc.h
JobStatus = [
"NONE",
"IDLE",
"RUNNING",
... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
from . import models
from . import controllers
from . import reports
|
import numpy as np
import pytest
from ai_traineree.buffers import Experience, NStepBuffer
def generate_sample_SARS(iterations, obs_space: int=4, action_size: int=2, dict_type=False):
state_fn = lambda: np.random.random(obs_space)
action_fn = lambda: np.random.random(action_size)
reward_fn = lambda: float... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.10 Python SDK
Pure Storage FlashBlade REST 1.10 Python SDK. Compatible with REST API versions 1.0 - 1.10. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/... |
import unittest
from app.models import Blog
class BlogTest(unittest.TestCase):
'''
Blog Class to test the behaviour of the Quote class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_blog = Blog('Apostle Paul', 'Labour in the Lord is n... |
"""techCourse URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
from setuptools import setup
setup(
name="mywhopackage",
install_requires=["django==1.0",],
extras_require={"test": ["pytest==2.0",], "docs": ["Sphinx==1.0",],},
)
|
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from six import with_metaclass
from discogs_client.exceptions import HTTPError
from discogs_client.utils import parse_timestamp, update_qs, omit_none
class SimpleFieldDescriptor(object):
"""
An attribute that deter... |
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.