text
stringlengths
2
999k
import argparse import json import glob import logging import os from pathlib import Path import re from subprocess import check_call from azure_devtools.ci_tools.git_tools import get_diff_file_list from .change_log import main as change_log_main _LOGGER = logging.getLogger(__name__) _SDK_FOLDER_RE = re.compile(r"^(s...
""" Do not change anything if you dont have enough knowledge how to handle it, otherwise it may mess the server. """ from navycut.core import AppSister from navycut.utils import path from pathlib import Path from .urls import url_patterns __basedir__ = path.abspath(__file__).parent class KolkataSister(AppSister):...
from unittest import TestCase from app.secrets import validate_required_secrets, EXPECTED_SECRETS class TestSecrets(TestCase): def test_validate_required_secrets_fails_on_missing(self): secrets = {"secrets": {}} with self.assertRaises(Exception) as exception: validate_required_secre...
from __future__ import absolute_import, print_function, division import time from nose.plugins.skip import SkipTest from nose_parameterized import parameterized import numpy try: from scipy import ndimage except ImportError: ndimage = None from six.moves import xrange import theano from theano.gof.opt import ...
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 : # make.py # An Arma 3 addon build system ############################################################################### # The MIT License (MIT) # Copyright (c) 2013-2014 Ryan Schultz # Permission is hereby granted, free of charge, to any person obtaining a co...
# -*- coding: utf-8 -*- """Convert the AD graph for Hipathia.""" import os import click from pyobo.cli_utils import verbose_option import pybel import pybel.grounding from pybel.struct import get_subgraphs_by_annotation HERE = os.path.dirname(__file__) OUTPUT = os.path.join(HERE, 'output') os.makedirs(OUTPUT, exis...
import torch.nn.functional as F import torchvision.models as models import torch.utils.data.distributed import torch.utils.data import torch.multiprocessing as mp import torch.optim import torch.distributed as dist import torch.backends.cudnn as cudnn import torch.nn.parallel import torch.nn as nn import torch import w...
def convert_string_to_int(list_a): new_list = [] for item in list_a: num = int(item) new_list.append(num) return new_list str_num_list = input().split(",") rotate_times = int(input()) int_list = convert_string_to_int(str_num_list) len_of_list = len(int_list) val = rotate_times % len_of...
from base import BaseTest import os import stat import unittest import sys INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False) class TestUmask(BaseTest): """ Test default umask """ DEFAULT_UMASK = 0o027 def setUp(self): super(BaseTest, self).setUp() ...
""" Clean up & organize outputs from processing workflow batch. """ import logging import os import re import zipfile import shutil logger = logging.getLogger(__name__) class OutputCleaner(object): """ Moves, renames, and deletes individual output files from a workflow processing batch for a selected pro...
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # # Code generated. DO NOT EDIT! # template file: justice_py_sdk_codegen/__main__.py # pylint: disable=duplicate-code # pylint: disable=li...
# Copyright (c) 2017-present, Facebook, 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 or agreed...
# from gym_soccer.envs.soccer_env import SoccerEnv # from gym_soccer.envs.soccer_empty_goal import SoccerEmptyGoalEnv # from gym_soccer.envs.soccer_against_keeper import SoccerAgainstKeeperEnv from gym_rbdl.envs.half_cheetah_rbdl import HalfCheetahRBDLEnv # from gym_rbdl.envs.cartpole_rbdl import CartpoleRBDLEnv from g...
''' You can use this as a boilerplate for your test framework. Define your customized library methods in a master class like this. Then have all your test classes inherit it. BaseTestCase will inherit SeleniumBase methods from BaseCase. ''' from seleniumbase import BaseCase class BaseTestCase(BaseCase): def set...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F class SoftmaxCenterLoss(nn.Module): """ Cross Entropy + Center Loss module Reference: https://kpzhang93.github.io/papers/eccv2016.pdf :param device: a device in which to run the computatio...
{ 'targets': [ { 'target_name': 'hdf5', 'include_dirs': [ '../../hdf5/include' ], 'sources': [ 'src/hdf5.cc', 'src/h5_file.cc', 'src/h5_group.cc', ], 'link_sett...
def _imageSklearn(cls): def toImgReshape(X): if X is None: return None def fromImgReshape(X): if X is None: return None class ImageSklearn(object): def __init__(self,*args,**kwargs): # argument self.args = args se...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # 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 Licen...
#!/usr/bin/env python # Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Unit tests for the 'grit newgrd' tool.''' from __future__ import print_function import os import sys if __name__ == '__main__': ...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: queryservice.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _...
#!/usr/bin/python3 # -*- coding: utf-8 -*- #Arquivo para ler os links RSS, Fazer o Download das Imagens, Criar os Posts do IG e Publicar no IG from rssRead import RssRead import atoma, requests import json import datetime from Imagem import * from Instagram import postar_fotos from stories import upload_stories from sp...
from pytpp.attributes._helper import IterableMeta from pytpp.attributes.branch_base import BranchBaseAttributes class AgentRootAttributes(BranchBaseAttributes, metaclass=IterableMeta): __config_class__ = "Agent Root"
#!/usr/bin/env python import torch import torch.nn as nn import argparse from src.loadopts import * METHOD = "LinearSTD" SAVE_FREQ = 10 FMT = "{description}={finetune}-{bn_adv}={learning_policy}-{optim}-{lr}={epochs}-{batch_size}={transform}" parser = argparse.ArgumentParser() parser.add_argument("model", type=st...
from web3 import Web3 from ethereum.utils import privtoaddr from utils import encode_constructor_data, encode_transaction, compile_source_code from eth_utils import decode_hex class Contract(): def __init__(self, web3, private_key, network_id, gas_price, gas_limit): self.web3 = web3 self.private_k...
# generator for Langton's Ant rules # inspired by Aldoaldoz: http://www.youtube.com/watch?v=1X-gtr4pEBU # contact: tim.hutton@gmail.com import golly import random from glife.RuleTree import * opposite_dirs=[2,3,0,1] # index of opposite direction # encoding: # (0-n_colors: empty square) def encode(c,s,d): # turmi...
#!/usr/bin/env python3 # Copyright (c) 2015-2018 The Sfor Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import SforTestFramework from test_framework.util import * ''' llmq-dkge...
# Copyright 2018 The Bazel 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 la...
import os import copy import shutil import subprocess from troncli import utils, json_store from troncli.constants import * class Config: """handler for setup config files""" def __init__(self): self.root_path = os.getcwd() self.full_config = None self.sol_config = None self....
#!C:\Users\anane\PycharmProjects\WebTesting\venv\Scripts\python.exe # -*- coding: utf8 -*- # :Copyright: © 2015 Günter Milde. # :License: Released under the terms of the `2-Clause BSD license`_, in short: # # Copying and distribution of this file, with or without modification, # are permitted in any medium withou...
from marshmallow import missing from .instance import Instance from .frameworks import ( PyMongoInstance, TxMongoInstance, MotorAsyncIOInstance, MotorTornadoInstance, MongoMockInstance ) from .document import ( Document, pre_load, post_load, pre_dump, post_dump, validates_sch...
# Copyright (c) 2019 PaddlePaddle 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 appli...
# 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 fro...
"""ThreatConnect TI File""" from ..indicator import Indicator class File(Indicator): """Unique API calls for File API Endpoints""" def __init__(self, tcex, **kwargs): """Initialize Class Properties. Args: tcex (Tcex): A instance of TCEX md5 (str, optional): The md5 va...
""" The MIT License (MIT) Copyright (c) 2015-2020 Kim Blomqvist 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, ...
import sqlite3 import tensorflow as tf import numpy as np from geopy import geocoders import random from recruit_dao import * schools = [] n_nodes_hl1 = 400 n_nodes_hl2 = 400 n_nodes_hl3 = 400 n_classes = 419 batch_size = 100 x = tf.placeholder('float', [None, 481]) y = tf.placeholder('float') def neural_network_mod...
# Everything covered in oop class RegisterUser: # actual class attribute user_ref_id = 100 # class constructor | deifnes class attributes def __init__(self, username, email, passcode): self.username = username self.email = email self.passcode = passcode # basic class metho...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.core.validators from aldryn_apphooks_config.fields import AppHookConfigField from aldryn_categories.fields import CategoryManyToManyField from aldryn_categories.models import Category from aldryn_newsblog.utils.utilities import get_valid_la...
''' // ///////////////////////////////////// // Created on 06.09.2015 @author: DORF_RUST // ///////////////////////////////////// ''' #=============================================================================== # MESSAGE TYPES ARM #========================================================================...
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ # Test case ID : C4976200 # Test Case Title : Verify that with higher angular damping, the object in rotation c...
# Copyright (c) 2019 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> from __future__ import annotations from typing import Callable, Any, cast from collections.abc import Mapping, Collection import click Formatter = Callable[[Any], str] ...
# # SPDX-License-Identifier: GPL-2.0-only # from abc import ABCMeta, abstractmethod import os import re import bb class Manifest(object, metaclass=ABCMeta): """ This is an abstract class. Do not instantiate this directly. """ PKG_TYPE_MUST_INSTALL = "mip" PKG_TYPE_MULTILIB = "mlp" PKG_TYPE_L...
#!/usr/bin/env python # # Copyright 2019-2020 Flavio Garcia # Copyright 2016-2017 Veeti Paananen under MIT License # # 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...
import scipy.stats from .utils import * from scipy.stats import mannwhitneyu, ttest_ind, betabinom def calc_wilcoxon_fn(M, N, m, s, alpha = 0.05, n_sim = 10_000): """ :param M: number of patients, as a list :param N: number of cells, as a list :param m: mean for both groups, as a list :param s...
""" :class:`~allennlp.common.tqdm.Tqdm` wraps tqdm so we can add configurable global defaults for certain tqdm parameters. Adopted from AllenNLP: https://github.com/allenai/allennlp/blob/v0.6.1/allennlp/common/tqdm.py """ from tqdm import tqdm as _tqdm # This is neccesary to stop tqdm from hanging # when exceptio...
# SPDX-FileCopyrightText: 2021 easyDiffraction contributors <support@easydiffraction.org> # SPDX-License-Identifier: BSD-3-Clause # © 2021 Contributors to the easyDiffraction project <https://github.com/easyScience/easyDiffractionApp> import timeit from typing import Union from PySide2.QtCore import QObject, Signal, ...
# -*- coding: utf-8 -*- # @Author: yulidong # @Date: 2018-07-17 10:44:43 # @Last Modified by: yulidong # @Last Modified time: 2018-09-23 17:15:36 # -*- coding: utf-8 -*- # @Author: lidong # @Date: 2018-03-20 18:01:52 # @Last Modified by: yulidong # @Last Modified time: 2018-07-16 22:16:14 import time import tor...
# qubit number=5 # total number=45 import cirq import qiskit from qiskit.providers.aer import QasmSimulator from qiskit.test.mock import FakeVigo from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import ...
# -*- coding : utf-8 -*- import RPi.GPIO as gpio from abc import * ## # @file pwm_controller.py # @brief PWM制御用の抽象クラスと、スロットル、ステアリング制御用クラス ## # @class PWMController # @brief PWM制御クラス作成用の抽象クラス class PWMController(metaclass=ABCMeta): ## # PWM制御クラスの初期化 # @details PWMの最大、最小値および出力ピンの設定を行う. それぞれの値はconfig.ini内の'...
from ...typecheck import * from ...import core from ...import ui from .adapter import Adapter from .configuration import Configuration import sublime import json if TYPE_CHECKING: from ..debugger.debugger_interface import DebuggerInterface def insert_snippet(window: sublime.Window, snippet: dict) -> core.awaitabl...
# -*- coding: utf-8 -*- import os import mimetypes import urllib from pyramid.settings import asbool from zope.interface import implementer from . import utils from .exceptions import FileNotAllowed from .extensions import resolve_extensions from .interfaces import IFileStorage from .registry import register_file_st...
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ Example: Gaussian Process ========================= In this example we show how to use NUTS to sample from the posterior over the hyperparameters of a gaussian process. .. image:: ../_static/img/examples/gp.png :align: center...
import copy import os import numpy as np import SimpleITK as sitk import functions.image.image_processing as ip def img_converter(data_folder, data, type_im, cn, ext='.mha', mha_folder_name='mha', point_folder_name='points'): """ convert img images to mha. reading image: 1) Size and voxel spacing of t...
import os import json import hydra.utils import pandas as pd from scipy.stats import chi2, chi2_contingency import matplotlib.pyplot as plt import src.constants as constants from src.evaluate_bias_in_nlg.bias_eval_helpers import ( single_file_to_dict, mult_files_to_dict, plot_regard_ratios, ) def read_r...
from django.contrib.auth.signals import user_logged_in, user_logged_out from django.utils import timezone from rest_framework import status from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework.views impo...
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
"""Miscellaneous functions that deals with html processing.""" import HTMLParser import re def repair_equations(html): r""" Replace equations containing escaped unicode entities with unicode. Some images have nested math environments i.e. $\(\text{blah}\)$, remove the inner math delimiters. """ ...
from __future__ import print_function sampleName = "/RelValJpsiMM/CMSSW_3_5_0_pre2-STARTUP3X_V14-v1/GEN-SIM-RECO" import FWCore.ParameterSet.Config as cms process = cms.Process('HEAVYFLAVORVALIDATIONHARVESTING') process.load('Configuration/StandardSequences/Services_cff') process.load('FWCore/MessageService/MessageL...
"""Vue_Django URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/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 unittest.mock import MagicMock, PropertyMock import pytest from envoy.base import runner from envoy.gpg import identity, sign def test_packager_constructor(): packager = sign.PackageSigningRunner("x", "y", "z") assert isinstance(packager, runner.Runner) assert packager.maintainer_class == identity...
from pydantic import BaseModel class CaliforniaDataInstance(BaseModel): MedInc: float HouseAge: float AveRooms: float AveBedrms: float Population: float AveOccup: float Latitude: float Longitude: float
import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras process = cms.Process('DIGI',eras.Phase2) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.Mess...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def isSymmetric(self, root: TreeNode) -> bool: if not root: return True return self.checkNodes(root.left, root.right) ...
from time import time from django.test import TestCase from eth_account import Account from web3 import Web3 from ...eth import EthereumNetwork from ...eth.constants import NULL_ADDRESS from .. import GnosisProtocolAPI, Order, OrderKind class TestGnosisProtocolAPI(TestCase): @classmethod def setUpClass(cls...
"""Tests for pdu_primitives""" import codecs import logging import sys import pytest from pydicom.uid import UID from pynetdicom import _config, debug_logger from pynetdicom.pdu import ( A_ASSOCIATE_RQ, A_ASSOCIATE_AC, P_DATA_TF ) from pynetdicom.pdu_items import ( MaximumLengthSubItem, ImplementationCl...
import os from django.http import HttpResponse, Http404, StreamingHttpResponse, FileResponse # Create your views here. # Case 1: simple file download, very bad # Reason 1: loading file to memory and consuming memory # Can download all files, including raw python .py codes def file_download(request, file_path): #...
# -*- coding: utf-8 -*- import json import logging import re from ..utils.crawler import Crawler logger = logging.getLogger('WUXIA_ONLINE') search_url = 'https://wuxiaworld.online/search.ajax?type=&query=%s' class WuxiaOnlineCrawler(Crawler): base_url = 'https://wuxiaworld.online/' # DISABLING DUE TO CLOUDE...
import kivy from kivy.app import App from kivy.uix.screenmanager import ScreenManager, Screen from kivy.core.window import Window # Size and position for testing Window.size = (360, 640) # Size of Samsung s5 Window.left = 1500 # Right side of screen Window.clearcolor = (.94, 1, 1, 1) import changecolor # Change colo...
import os from glob import glob data_dirs = ["Training_Batch_Files","Prediction_Batch_files"] for dir in data_dirs: files = glob(dir+r"/*.csv") for filePath in files: print({filePath}) os.system(f"dvc add {filePath}") print("\n#### All files added to dvc ####")
# -*- coding: utf-8 -*- # Copyright 2017 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 ...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from datetime import datetime import operator import numpy as np from numpy import nan import pytest from pandas._libs.sparse import BlockIndex, IntIndex from pandas.compat import PY36 from pandas.errors import PerformanceWarning import pandas.util._test_decorators as td import pandas as pd from pandas import ( ...
# Copyright (c) 2018 SONATA-NFV, 5GTANGO, Paderborn University # 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 # # U...
# coding: utf-8 from __future__ import unicode_literals import fnmatch import os import logging from functools import cmp_to_key from mkdocs import utils log = logging.getLogger(__name__) class Files(object): """ A collection of File objects. """ def __init__(self, files): self._files = files ...
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# >>>>> See https://github.com/pypa/sampleproject/blob/master/setup.py <<<<<< from setuptools import setup setup( name='', version='0.0.1dev', description="", author="author", author_email="email", license='MIT', # >>>>>> See https://pypi.org/classifiers/ <<<<<<<< c...
import httplib import json import locale import platform import urllib import time import threading import uuid urlStr = "" appKey = "" deviceId = "" periodSecond = 0 connectionStr = "" events_queue_file = "events.txt" metrics_queue_file = "metrics.txt" uuid_file = "uuid.txt" #Countly main class for all process cla...
"""String-related Templatetags""" from django import template # pylint: disable=invalid-name register = template.Library() @register.filter("padded_slice", is_safe=True) def padded_slice_filter(value, page_number): """ Templatetag which takes a value and returns a padded slice """ try: bits =...
from django.test import TestCase from chatterbox.models import Service class FacebookApiTestCase(TestCase): fixtures = ("project/apps/chatterbox/fixtures/users.json", "project/apps/chatterbox/fixtures/dump.json") def setUp(self): self.service = Service.objects.get(key="tumblr") ...
# 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 ...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import warnings from django.db import models class People(models.Model): name = models.CharField(max_length=255) parent = models.ForeignKey('self') class Message(models.Model): from_field = models.ForeignKey(People, db_column='from_id') ...
#!/usr/bin/env python3 # Copyright (c) 2014-2020 The Zenacoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the listtransactions API.""" from decimal import Decimal from io import BytesIO from test_framew...
from .responses import TokenResponse url_bases = [r"https?://sts\.(.*\.)?amazonaws\.com"] url_paths = {"{0}/$": TokenResponse.dispatch}
import pandas from sklearn import model_selection from sklearn.linear_model import LogisticRegression dataframe = pandas.read_csv("results.csv") array = dataframe.values x = array[:,6] print("Performance summary based on", len(array), "evaluations:") print("Min: ", x.min(), "s") print("Max: ", x.max(), "s") print("Me...
import sys import json import numpy from haralyzer import HarParser, HarPage def get_number_of_requests(har_page, type): return len(har_page.filter_entries(request_type=type, status_code='2.*')) def get_load_time(har_page, type): return round(har_page.get_load_time(request_type=type, status_code='2.*', asynch...
# coding=utf-8 import os import struct from replay_unpack.core.pretty_print_mixin import PrettyPrintObjectMixin class Map(PrettyPrintObjectMixin): def __init__(self, stream): self.spaceId, = struct.unpack('i', stream.read(4)) self.arenaId, = struct.unpack('q', stream.read(8)) # something ...
"""""" from typing import Callable, Dict, List import pytz from datetime import datetime from time import sleep from ..api import ( MdApi, TdApi, USTP_FTDC_AF_Delete, USTP_FTDC_CAS_Accepted, USTP_FTDC_CAS_Rejected, USTP_FTDC_CAS_Submitted, USTP_FTDC_CHF_Speculation, USTP_FTDC_D_Buy, ...
# Time Version # Must be left running import nationstates import time #When to rerun days = 15 api = nationstates.Nationstates("YOUR USERAGENT") nation = api.nation("testlandia", password="YourPassword") while True: nation.get_shards("ping") time.sleep(days*24*60) # CRON JOB VERSION # configure OS to run ...
from ...bh_trees import Task class IsCargoFull(Task): def __init__(self): super(IsCargoFull, self).__init__() def run(self): object = self._blackboard.get_value('object') return True if object.get_cargo_space_left()==0 else False
from django.contrib import admin from .models import MemberBucks @admin.register(MemberBucks) class MemberBucksAdmin(admin.ModelAdmin): pass
#!/usr/bin/env python """ Test script. Evaluates idifference.py on a sequence of disk images. """ import sys, os, subprocess if __name__ == "__main__": from optparse import OptionParser parser = OptionParser() parser.usage = '%prog [options] dfxml_sequence_list.txt output_zip' parser.add_option("-p",...
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
# coding: utf-8 """ Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applica...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'conditions': [ # TODO(stuartmorgan): All dependencies from code built on iOS to # webkit/ should be removed, at which point this condition c...
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicabl...
import csv import tarfile # from transformers import cached_path import io # empd_file = "https://dl.fbaipublicfiles.com/parlai/empatheticdialogues/empatheticdialogues.tar.gz" EMOTION = 2 CONTEXT = 3 UTTERANCE = 5 def replace_comma(text): p = {'_comma_':' ,', '..':'.', '...':'.'} for k, v in p.items(): ...
from copy import deepcopy from collections import defaultdict from regolith.fsclient import FileSystemClient from regolith.mongoclient import MongoClient CLIENTS = { 'mongo': MongoClient, 'mongodb': MongoClient, 'fs': FileSystemClient, 'filesystem': FileSystemClient, } class ClientManager: ...
# base16-qutebrowser (https://github.com/theova/base16-qutebrowser) # Base16 qutebrowser template by theova and Daniel Mulford # Tomorrow scheme by Chris Kempson (http://chriskempson.com) base00 = "#ffffff" base01 = "#e0e0e0" base02 = "#d6d6d6" base03 = "#8e908c" base04 = "#969896" base05 = "#4d4d4c" base06 = "#282a2e...
import hypothesis from granula.pattern import Environment from tests.strategies import WORD @hypothesis.given(WORD, WORD, WORD) @hypothesis.example('..config', 'testing', 'yaml') # must ignore leading dots def test_no_environment(name, environment, extension): filename = u'{}.{}'.format(name, extension) a...
######################################################################## # Copyright (c) 2017 # Daniel Plohmann <daniel.plohmann<at>mailbox<dot>org> # All rights reserved. ######################################################################## # # This file is part of apiscout # # apiscout is free software: you can ...