content
stringlengths
0
894k
type
stringclasses
2 values
from Instrucciones.Instruccion import Instruccion from Instrucciones.Declaracion import Declaracion from Expresion.Terminal import Terminal from Tipo import Tipo class Procedure(Instruccion): def __init__(self,nombre,params,instrucciones): self.nombre=nombre self.params=params self.instruc...
python
""" This example shows how to upload a model with customized csv schedules Put all the relevant schedules under one folder and then add the folder directory to the add_files parameter. """ import BuildSimHubAPI as bshapi import BuildSimHubAPI.postprocess as pp bsh = bshapi.BuildSimHubAPIClient() project_api_key = 'f...
python
# Generated by Django 3.2.11 on 2022-01-12 08:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0004_auto_20201221_1213'), ] operations = [ migrations.AlterField( model_name='broadcast', name='id', ...
python
from pyrosm.data_manager import get_osm_data from pyrosm.frames import prepare_geodataframe import warnings def get_network_data(node_coordinates, way_records, tags_as_columns, network_filter, bounding_box): # Tags to keep as separate columns tags_as_columns += ["id", "nodes", "timestamp"...
python
class UnionFind(object): def __init__(self, n): self.u = list(range(n)) def union(self, a, b): ra, rb = self.find(a), self.find(b) if ra != rb: self.u[ra] = rb def find(self, a): while self.u[a] != a: a = self.u[a] return a class Solution(ob...
python
for _ in range(int(input())): n = int(input()) s = input() alpha = set(s) ans = n countImpossible = 0 for i in alpha: curr = 0 lb, ub = 0, n - 1 while lb < ub: if s[lb] == s[ub]: lb += 1 ub -= 1 continue ...
python
#!/usr/bin/env python # Copyright (c) 2020, Xiaotian Derrick Yang # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """Package build and install script.""" from setuptools import find_packages, setup def get_re...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """Description """ import torch from scipy import stats from ptranking.metric.adhoc_metric import torch_ap_at_ks, torch_nDCG_at_ks, torch_kendall_tau, torch_nerr_at_ks def test_ap(): ''' todo-as-note: the denominator should be carefully checked when using AP@k '...
python
import logging from kubernetes import client from kubernetes.client import V1beta1CustomResourceDefinition, V1ObjectMeta, V1beta1CustomResourceDefinitionSpec, \ V1Deployment, V1DeploymentSpec, V1LabelSelector, V1PodTemplateSpec, V1PodSpec, V1Service, V1ServiceSpec, \ V1ServicePort, V1DeleteOptions, V1Persisten...
python
# Generated by Django 2.1.5 on 2019-01-28 03:31 from django.db import migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('configurations', '0017_d3mconfiguration_description'), ] operations = [ migrations.AddField( model_name='d3mconf...
python
from agrirouter.auth.enums import BaseEnum class CertificateTypes(BaseEnum): PEM = "PEM" P12 = "P12" class GateWays(BaseEnum): MQTT = "2" REST = "3"
python
"""yaml templates for DataFrame plotting.""" from os.path import (join, dirname) import yaml _filename = join(dirname(__file__), 'palette.yaml') with open(_filename, 'r') as f: lineplot_dict = yaml.load(f, Loader=yaml.SafeLoader) style_overide = lineplot_dict.pop('style_overide', {}) __all__ = ['lineplot_dic...
python
#!/usr/bin/env python3 # Importation des librairies TM1637 et time from tm1637 import TM1637 from time import sleep # Stockage de la duree dans des variables print("- Duree du minuteur -") minutes = int(input("Minutes : ")) secondes = int(input("Secondes : ")) print("- Demarage du minuteur : " + str(minutes...
python
from unittest import TestCase from daily_solutions.year_2020.day_5 import parse_seat_id class Day5TestCase(TestCase): def test_parse_row_column(self) -> None: self.assertEqual(567, parse_seat_id("BFFFBBFRRR"))
python
from flask_wtf import FlaskForm from wtforms import ( widgets, HiddenField, BooleanField, TextField, PasswordField, SubmitField, SelectField, SelectMultipleField, DateTimeField, ) from wtforms.validators import Email, Length, Required, EqualTo, Optional day_map = { "0": "Mon", ...
python
# File: __init__.py # Aim: Package initial # Package version: 1.0 # %% from .defines import Config CONFIG = Config() # CONFIG.reload_logger(name='develop') # %%
python
from dataclasses import dataclass from enum import Enum class TokenEnum(Enum): LPAREN = 0 RPAREN = 1 NUMBER = 2 PLUS = 3 MINUS = 4 MULTIPLY = 5 DIVIDE = 6 INTEGRAL_DIVIDE = 7 EXPONENTIAL = 8 @dataclass class Token: type: TokenEnum val: any = None def __repr__(self): ...
python
#------------------------------------------------------------------------------- import collections import copy import warnings import inspect import logging import math #------------------------------------------------------------------------------- class MintError(Exception): pass class MintIndexError(MintError): pa...
python
"""Remote""" from os import path import uuid import time import json import tornado.ioloop import tornado.websocket import tornado.web from models.led_strip import LedStrip from models.color import Color strip = LedStrip(14) def start(): """animation""" strip.stop_animation() print("start_animation") ...
python
# -*- coding: utf-8 -*- from unittest import TestCase class DataTest(TestCase): """Obey the testing goat.""" def test_something(self): """ A testing template -- make to update tests.yml if you change the testing name. """ matches = True expected_matches = Tru...
python
from selenium.webdriver.common.by import By from seleniumpm.webpage import Webpage from seleniumpm.webelements.textfield import TextField from seleniumpm.locator import Locator class GooglePage(Webpage): """ This is an Google page that extends SeleniumPM WebPage. This class acts as a container for the differe...
python
import unittest from ArrayQueue import ArrayQueue, Empty class TestArrayQueue(unittest.TestCase): def setUp(self): self.q = ArrayQueue() self.q.enqueue(1) self.q.enqueue(2) self.q.enqueue(3) def test_instantiation(self): print('Can create an instance') self.as...
python
"""Unit tests for memory-based file-like objects. StringIO -- for unicode strings BytesIO -- for bytes """ import unittest from test import support import io import _pyio as pyio import pickle class MemorySeekTestMixin: def testInit(self): buf = self.buftype("1234567890") bytesIo = self.ioclass(...
python
# Generated by Django 3.1.3 on 2022-01-18 13:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('onlinecourse', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='choice', name='question_id', ...
python
"""Tools to turn atmospheric profiles into their record representation. MonoRTM takes gas amounts either as column density in molecules/cm² or as molecular/volume mixing ratios in molecules/molecules. Internally the two are separated by checking if the given value is smaller or larger than one (monortm.f90, lines 421-...
python
import numpy as np import argparse import cv2 from cnn.neural_network import CNN from keras.utils import np_utils from keras.optimizers import SGD from sklearn.datasets import fetch_mldata from sklearn.model_selection import train_test_split # Parse the Arguments ap = argparse.ArgumentParser() ap.add_argu...
python
# -*- coding: utf-8 -*- """ Integrate with Google using openid :copyright: (c) 2014 by Pradip Caulagi. :license: MIT, see LICENSE for more details. """ import logging from flask import Flask, render_template, request, g, session, flash, \ redirect, url_for, abort from flask import Blueprint from fla...
python
# # Copyright (c) 2021 Arm Limited and Contributors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """PyPI Package definition for greentea-host (htrun).""" import os from io import open from distutils.core import setup from setuptools import find_packages DESCRIPTION = ( "greentea-host (htrun) is a ...
python
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
python
import protocol import helpers import hashes as h import bloom_filter as bf import garbled_bloom_filter as gbf import PySimpleGUI as sg sg.change_look_and_feel('DarkBlue2') perform_protocol = sg.ReadButton('Start Simulation', font=('Segoe UI', 12), key='-RUN-') stepTracker = 0 Protocol = None disableChecks = False ...
python
def reverses(array, a, b): while a < b: array[a], array[b] = array[b], array[a] a += 1 b -= 1 def rotate(nums, k): n = len(nums) k = k % n reverses(nums, 0, n-k-1) reverses(nums, n-k, n-1) reverses(nums, 0, n-1) return nums if __name__ == '__main__': nums = [i ...
python
""" XVM (c) www.modxvm.com 2013-2017 """ # PUBLIC def getAvgStat(key): return _data.get(key, {}) # PRIVATE _data = {}
python
import logging logger = logging.getLogger(__name__) import click, sys from threatspec import app def validate_logging(ctx, param, value): levels = { "none": 100, "crit": logging.CRITICAL, "error": logging.ERROR, "warn": logging.WARNING, "info": logging.INFO, "debug"...
python
import torch import numpy as np import re from collections import Counter import string import pickle import random from torch.autograd import Variable import copy import ujson as json import traceback import bisect from torch.utils.data import Dataset, DataLoader IGNORE_INDEX = -100 NUM_OF_PARAGRAPHS = 10 MAX_PARAG...
python
import pytest @pytest.mark.e2e def test_arp_packet_e2e(api, utils, b2b_raw_config): """ Configure a raw TCP flow with, - sender_hardware_addr increase from 00:0c:29:e3:53:ea with count 5 - target_hardware_addr decrement from 00:0C:29:E3:54:EA with count 5 - 100 frames of 1518B size each - 10% ...
python
import os import pytest import json import regal _samples_simple = [ ("and.v", "and.jed"), ("nand.v", "nand.jed"), ("not.v", "not.jed"), ("or.v", "or.jed"), ("xor.v", "xor.jed"), ("v1.v", "v1.jed"), ("v0.v", "v0.jed"), ("fb.v", "fb.jed"), ] _samples_registered = [ ("clk.v", "clk.j...
python
from setuptools import setup from setuptools import find_namespace_packages with open(file="README.md", mode="r") as fh: long_description = fh.read() setup( name='fin-news', author='Alex Reed', author_email='coding.sigma@gmail.com', version='0.1.1', description='A finance news aggregator used ...
python
# -*- coding: utf-8 -*- """ Created on Tue Jul 11 17:33:22 2017 @author: Martin """ import collections new_otus = collections.defaultdict(list) with open('unique_renamed_otus.txt') as data: for d in data: d = d.strip("\n") # remove newline char line = d.split("\t") # split line at tab char ...
python
"""Role testing files using testinfra""" import pytest @pytest.mark.parametrize("config", [ ( "NTP=0.debian.pool.ntp.org " "1.debian.pool.ntp.org " "2.debian.pool.ntp.org " "3.debian.pool.ntp.org" ), ( "FallbackNTP=0.de.pool.ntp.org " "1.de.pool.ntp.org " ...
python
''' Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1: Input: "bbbab" Output: 4 One possible longest palindromic subsequence is "bbbb". Example 2: Input: "cbbd" Output: 2 ''' ''' This is a standard problem of Dynamic Programm...
python
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
python
# # Copyright (C) 2012-2020 Euclid Science Ground Segment # # This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General # Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) # any ...
python
from django.conf.urls import patterns, url urlpatterns = patterns('scheduler.views', url(r'^list/$', 'job_list', (), 'job_list'), )
python
from django.apps import AppConfig class PhonebooksApiConfig(AppConfig): name = 'phonebooks_api'
python
from os import listdir from os.path import isfile, isdir, join from typing import List from bs4 import BeautifulSoup from .model import Imagenet, Imagenet_Object from ...generator import Generator from ...helper import grouper ## Configure paths out_dir = '/data/streamable4' in_dir = '/data/ILSVRC' in_dir_kaggle = '...
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2014 Mikael Sandström <oravirt@gmail.com> # Copyright: (c) 2021, Ari Stark <ari.stark@netcourrier.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_functio...
python
# Copyright 2021 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...
python
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] ans = 0 for xy1, xy2 in zip(xy, xy[1:]): ans += abs(xy1[0] - xy2[0]) ans += abs(xy1[1] - xy2[1]) print(ans) if __name__ ...
python
# -------------------------- # UFSC - CTC - INE - INE5603 # Exercício calculos # -------------------------- # Classe responsável por determinar se um número é primo. from view.paineis.painel_abstrato import PainelAbstrato from model.calculos import primo class PainelPrimo(PainelAbstrato): def __init__(self): ...
python
import os from dotenv import find_dotenv from dotenv import load_dotenv load_dotenv(find_dotenv()) BASE_URL = os.getenv("BASE_URL") CURRENCY = os.getenv("CURRENCY") API_URL = BASE_URL + CURRENCY OUTPUT_FILE = os.getenv("OUTPUT_FILE") REQUEST_TIMEOUT = int(os.getenv("REQUEST_TIMEOUT")) CANCEL_ON_FAILURE = os.getenv("...
python
from ctypes import PyDLL, py_object, c_int from os import path from sys import exit import numpy as np my_path = path.abspath(path.dirname(__file__)) path = path.join(my_path, "./bin/libmotion_detector_optimization.so") try: lib = PyDLL(path) lib.c_scan.restype = py_object lib.c_scan.argtypes = [py_objec...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- from subprocess import Popen processes = [] for counter in range(10): chrome_cmd = 'export BROWSER=chrome && python test_search.py' firefox_cmd = 'export BROWSER=firefox && python test_search.py' processes.append(Popen(chrome_cmd, shell=True)) processes....
python
import re """ # Line based token containers As denoted by `^` in the regex """ BLANK = re.compile(r"^$") #TODO this will fail to match correctly if a line is `<div><p>foo bar</p></div>` HTML_LINE = re.compile( r""" \s{0,3} (?P<content>\<[...
python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """ This example demonstrates how to instantiate the Adafruit BNO055 Sensor using this library and just the I2C bus number. This example will only work on a Raspberry Pi and does require the i2c-gpio kernel module to be insta...
python
import os import json SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) DEPENDS_PATH = os.path.join(SCRIPT_DIR, '.depends.json') FLAGS = [ '-Wall', '-Wextra', '-x', 'c++', '-std=c++17', '-isystem', '/usr/include/c++/8.2.1', '-isystem', '/usr/include/c++/8.2.1/x86_64-pc-linux-gnu', '...
python
from .quantizer import * from .api import *
python
# Считаем, сколько раз встречается то или иное число в массиве. # Зная эти количества, быстро формируем уже упорядоченный массив. # Для этой сортировки нужно знать минимум и максимум в массиве. # Тогда генерируются ключи для вспомогательного массива, в котором # и фиксируем чего и сколько раз встретилось. def count_sor...
python
# Generated by Django 2.1.7 on 2019-03-27 15:22 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
python
names= ('ali', 'ahmet') sayı=int(input("sayı giriniz:")) if sayı>=10 : print(names[0]) else : print(names[1])
python
# 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 use ...
python
nums = [int(i) for i in input().split()] prefixsum = [0] * (len(nums) + 1) mi = prefixsum[0] ma = -100000 msum = nums[0] for i in range(1, len(nums) + 1): prefixsum[i] = prefixsum[i-1] + nums[i-1] if prefixsum[i-1] < mi: mi = prefixsum[i-1] if prefixsum[i] - mi > msum: msum = prefixsum[i...
python
import psycopg2 from config import config class PostgresConnector: def __init__(self): # read connection parameters self.params = config() def connect(self): """ Connect to the PostgreSQL database server """ conn = None try: # connect to the PostgreSQL serve...
python
from gopygo.parser import parse from gopygo.unparser import unparse __version__ = '0.3.2'
python
import random from scicast_bot_session.client.scicast_bot_session import SciCastBotSession from scicast_bot_session.common.utils import scicast_bot_urls import botutils from time import sleep import datetime import sys def getinfo(site,bot='',roundid:str='', percent=0.005): try: api_key = botutils.lookup_k...
python
import sys import os from pathlib import Path import locale from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import QLocale from configs import Configurator from gui.appwidget import App from pa import generate_pa_test CONFIG_FILE = 'duet_pressure_advance.cfg' def generate(cfg): pass if __name__ == '...
python
from tkinter import * root=Tk() root.geometry("600x500") addno=StringVar() e1=Entry(root) e1.grid(row=0,column=1) e2=Entry(root) e2.grid(row=1,column=1) def add(): res1 = int(e1.get())+int(e2.get()) addno.set(res1) n1=Label(root,text="num1").grid(row=0) n2=Label(root,text="num2").grid(row=1) n3=Label(r...
python
import re from random import randrange from model.contact import Contact def test_random_contact_home_page(app): old_contacts = app.contact.get_contact_list() index = randrange(len(old_contacts)) contact_from_home_page = app.contact.get_contact_list()[index] contact_from_edit_page = app.contact.get_co...
python
import json from flask import request from flask_restful import Resource, reqparse from database.interface import FirebaseInterface from models.Service import Service class ServicesController(Resource): def __init__(self): self.parser = reqparse.RequestParser() self.interface = FirebaseInterface(...
python
from hashlib import sha256 from tornado.web import HTTPError from .db import Model, DoesNotExistError, NonUniqueError from .game import Game from .player import Player from .location import Location from .template import templater, inside_page class Admin(Model): _table = 'admin' def __init__(self, id, name, passw...
python
"""Orcaflex output plugin - using orcaflex API.""" import numpy as np def to_orcaflex(self, model, minEnergy=1e-6): """Writes the spectrum to an Orcaflex model Uses the orcaflex API (OrcFxAPI) to set the wave-data of the provided orcaflex model. The axis system conversion used is: - Orcaflex global ...
python
import subprocess import sys with open('out.txt','w+') as fout: with open('err.txt','w+') as ferr: out=subprocess.call(["./bash-script-with-bad-syntax"],stdout=fout,stderr=ferr) fout.seek(0) print('output:') print(fout.read()) ferr.seek(0) print('error:') pr...
python
#esperava um ident depois do ':' def x(y): z=1
python
# encoding: utf-8 # Copyright 2011 California Institute of Technology. ALL RIGHTS # RESERVED. U.S. Government Sponsorship acknowledged. '''Curator: interface''' from zope.interface import Interface from zope import schema from ipdasite.services import ProjectMessageFactory as _ class ICurator(Interface): '''A pe...
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('wod_rules', '0006_auto_20150414_1606'), ] operations = [ migrations.RemoveField( model_name='merit', ...
python
#!/usr/bin/env python # Copyright 2019 The Vitess 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 applicabl...
python
from django.shortcuts import redirect, render from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.messages.views import SuccessMessageMixin from django.views.generic import (CreateView, UpdateView, DetailView, TemplateView, View, DeleteView,ListView) from django.shortcuts import render, redire...
python
import logging # Setup basic logging logging.basicConfig( format='%(asctime)s : %(levelname)s : %(name)s : %(message)s', level=logging.WARNING ) from flask import Flask from flask_uuid import FlaskUUID from flask_migrate import Migrate from simple_events.apis import api from simple_events.models ...
python
import graphene class SystemQueries(graphene.ObjectType): hello = graphene.String(name=graphene.String(default_value="stranger")) def resolve_hello(self, info, name): return 'Hello ' + name root_schema = graphene.Schema(query=SystemQueries)
python
from .version import VERSION from .SoapLibrary import SoapLibrary class SoapLibrary(SoapLibrary): """ SoapLibrary is a library for testing SOAP-based web services. SoapLibrary is based on [https://python-zeep.readthedocs.io/en/master/|Zeep], a modern SOAP client for Python. This library ...
python
import argparse from os import path from datetime import datetime import logging from logging.config import fileConfig import tempfile from dicom.dataset import Dataset from pydicom.datadict import tag_for_name, dictionaryVR from mip import Pacs, DicomAnonymizer # parse commandline parser = argparse.ArgumentParser(de...
python
# Copyright (c) 2013, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) from .kern import Kern from ...core.parameterization import Param from ...core.parameterization.transformations import Logexp import numpy as np from ...util.linalg import tdot from ...util.caching import C...
python
from .socket_provider import SocketProvider from .pcapy_provider import PcapyProvider from .provider import Provider from core.exceptions import * class ProviderType(): Socket = "SocketProvider" Pcapy = "PcapyProvider" def create(providerType, device=None): return globals()[providerType](device)
python
# Python3 Finding Lowest Common Ancestor in Binary Tree ----> O(N) def find_lca_bt(root, n1, n2): if not root: return None left_lca = find_lca_bt(root.left, n1, n2) right_lca = find_lca_bt(root.right, n1, n2) if left_lca and right_lca: return root return left_lca if left_lca else right_lca # Python3 Findi...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. moduleauthor:: hbldh <henrik.blidh@nedomkull.com> Created on 2015-11-13 """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from pkg_resources import resource_fi...
python
#!/usr/bin/env python # Copyright 2020 Naoyuki Kanda # MIT license import sys import os import json import soundfile import librosa import numpy as np def get_delayed_audio(wav_file, delay, sampling_rate=16000): audio, _ = soundfile.read(wav_file) delay_frame = int(delay * sampling_rate) if delay_frame ...
python
""" api for running OpenCL ports of nervana neon convolutional kernels status: in progress approximate guidelines/requirements: - caller should handle opencl context and queue setup - caller should allocate cl buffers - library can/should provide a means to provide required dimensions of buffers to caller - library w...
python
# Created By: Virgil Dupras # Created On: 2007-10-06 # Copyright 2013 Hardcoded Software (http://www.hardcoded.net) # This software is licensed under the "BSD" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # =============================================================== # Copyright (C) 2018 HuangYk. # Licensed under The MIT Lincese. # # Filename : torchsoa.py # Author : HuangYK # Last Modified: 2018-08-12 14:15 # Description : # # ================================...
python
import unittest import sys from ctypeslib import clang2py class ToolchainTest(unittest.TestCase): if sys.platform == "win32": def test_windows(self): clang2py.main(["clang2py", "-c", "-w", "-m", "ctypes.wintypes",...
python
import random import numpy as np import math from collections import deque import time import pickle from sklearn.linear_model import LinearRegression from Simulations.GameFeatures import GameFeatures as GF from BehaviouralModels.BehaviouralModels import BehaviouralModelInterface MIN_REPLAY_MEMORY_SIZE = 16_384 MAX...
python
# -*- coding: utf-8 -*- # Copyright 2015 Donne Martin. 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. A copy of # the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "lice...
python
from selenium import webdriver import unittest import os import sys PACKAGE_ROOT = '../..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) PACKAGE_PATH = os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_R...
python
# encoding: UTF-8 ''' v1:yalinwang 针对bitfinex 接口进行了改进与优化,增加了部分日志功能 本文件中实现了CTA策略引擎,针对CTA类型的策略,抽象简化了部分底层接口的功能。 关于平今和平昨规则: 1. 普通的平仓OFFSET_CLOSET等于平昨OFFSET_CLOSEYESTERDAY 2. 只有上期所的品种需要考虑平今和平昨的区别 3. 当上期所的期货有今仓时,调用Sell和Cover会使用OFFSET_CLOSETODAY,否则 会使用OFFSET_CLOSE 4. 以上设计意味着如果Sell和Cover的数量超过今日持仓量时,会导致出错(即用户 希望通过一...
python
################################################################################ # # Copyright (C) 2019 Garrett Brown # This file is part of pyqudt - https://github.com/eigendude/pyqudt # # pyqudt is derived from jQUDT # Copyright (C) 2012-2013 Egon Willighagen <egonw@users.sf.net> # # SPDX-License-Identifier: BS...
python
import json, subprocess from .... pyaz_utils import get_cli_name, get_params def start(account_name=None, account_key=None, connection_string=None, sas_token=None, auth_mode=None, destination_blob, destination_container, timeout=None, destination_if_modified_since=None, destination_if_unmodified_since=None, destinati...
python
import csv, json import to_json # LOD preparations # Import the LOD library. from lod import lod # The object_manager contains every object that has been created in this Scenario so far. object_manager = lod.get_object_manager() def main(lod_manager): # # Get the arguments that were given to this Program. ...
python
import berrl as bl import pandas as pd import numpy as np d=pd.read_csv('STSIFARS.csv') d=d[d.STANAME=='WEST VIRGINIA'] d.to_csv('wv_traffic_fatals.csv')
python
##parameters=title=None, description=None, event_type=None, effectiveDay=None, effectiveMo=None, effectiveYear=None, expirationDay=None, expirationMo=None, expirationYear=None, start_time=None, startAMPM=None, stop_time=None, stopAMPM=None, location=None, contact_name=None, contact_email=None, contact_phone=None, event...
python
class ColorTranslator(object): """ Translates colors to and from GDI+ System.Drawing.Color structures. This class cannot be inherited. """ @staticmethod def FromHtml(htmlColor): """ FromHtml(htmlColor: str) -> Color Translates an HTML color representation to a GDI+ System.Drawin...
python
from functools import wraps #PUBLIC COMMAND def init(fn): def wrapper(*args,**kwargs): message = args[0].message if message.chat.type == 'supergroup' or message.chat.type == 'group': return fn(*args,**kwargs) else: return False return wrapper
python