content
stringlengths
5
1.05M
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2012,2013,2014,2015,2016 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
from kaggle_environments.envs.hungry_geese.hungry_geese import Action, Configuration, Observation import numpy as np from pathlib import Path from scipy import stats import sys import time import torch from torch import nn import torch.nn.functional as F # See https://www.kaggle.com/c/google-football/discussion/191257...
from functools import wraps from ..utils.isaac import is_live_site from ..utils.log import log, TEST, INFO, ERROR from collections import OrderedDict __all__ = ['TestWithDependency'] class TestWithDependency(object): """Declares a Regression Test item with dependencies and tracks results. Use as a decora...
#Main Program for encryption. from sys import argv import os import sys from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric i...
import sys from .core import Kreta from .utils import splash, log __version__ = "0.1.0" __help__ = """\ usage: kreta [--version] [--help] <command> KRÉTA Ellenőrző CLI General: usage: kreta login log in to kréta kreta ping show latency to kreta servers Options: ...
# Generated by Django 2.2.6 on 2019-11-06 13:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('review', '0001_initial'), ] operations = [ migrations.AlterField( model_name='review', name='category'...
# -*- coding: utf-8 -*- """ Last update: Sep. 2, 2020 @author: Asieh Abolpour Mofrad This code is used for simulation results reported in an article entitled: ''Enhanced Equivalence Projective Simulation: a Framework for Modeling Formation of Stimulus Equivalence Classes" in Neural Comput...
""" A collection of convenient methods when working with dicts """ from collections import defaultdict from typing import Any, Dict, TypeVar, Callable, Iterable, Hashable, List # 'Recursive types not fully supported yet, nested types replaced with "Any"' TreeT = Dict[str, Any] DEFAULT_SEP = "/" def inflate(deflated...
import trio from time import sleep async def parent(): while True: print("parent: started!") async with trio.open_nursery() as nursery: # spawning sax soundbot print("parent: spawning sax bot ...") nursery.start_soon(bot_stuff, 'sax') # spawning ba...
import subprocess def get_output(cmd): cmdl = cmd.strip().split(' ') child = subprocess.Popen(cmdl, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return str(child.stdout.read(), encoding='utf-8')
''' Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value. Example 1: Input: [1,12,-5,-6,50,3], k = 4 Output: 12.75 Explanation: Maximum average is (12-5-6+50)/4 = 51/4 = 12.75 Note: 1 <= k <= n <= 30...
#!/bin/env python # -*- coding: utf-8 -*- ## # test_cirq.py: Tests for Cirq plugin ## # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. ## import mock import unittest import warnings import pytest import numpy as np from cirq import ParamResolver from azure.quantum.job.job...
import pytest import autofit as af def _make_grid_paths( grid_search, mapper ): jobs = list( grid_search.make_jobs( mapper, None, grid_priors=[ mapper.component.one_tuple.one_tuple_0, mapper.component.one_tuple.one_tuple_...
x = 3.5 print(x)
"""The API's fuzzer endpoint.""" import binascii def test_fuzzer(webapp): """Test the fuzzer.""" domain = 'www.example.com' hexdomain = binascii.hexlify(domain) response = webapp.get('/api/fuzz/{}'.format(hexdomain)).json # Remove most of the results for the fuzzy domains response['fuzzy_do...
""" ParameterWidget :Authors: Berend Klein Haneveld 2013 """ from PySide.QtGui import QWidget from PySide.QtGui import QVBoxLayout from PySide.QtGui import QPushButton from PySide.QtGui import QIcon from PySide.QtCore import Qt from core.AppVars import AppVars from ui.widgets import ButtonContainer from ui.transforma...
#!/usr/bin/env python import os import sys import inspect file_path = os.path.dirname(inspect.getfile(inspect.currentframe())) sys.path.insert(0, os.path.split(os.path.split(file_path)[0])[0]) import sys import unittest from unittest.mock import patch import datetime from parameterized import parameterized_class fro...
import json import random from dataclasses import dataclass from typing import Any, cast import numpy as np from srl.base.define import RLObservationType from srl.base.env.base import EnvRun from srl.base.rl.algorithms.discrete_action import DiscreteActionConfig from srl.base.rl.base import RLParameter, RLTrainer, RLW...
#!/usr/local/bin/python3 __author__ = 'andreipachtarou' import json import sys import urllib3 from bs4 import BeautifulSoup import os import codecs from dataformater import DataFormater from dataextractor import DataExtractor from datalinks import DataLinks def jdefault(o): return o.__dict__ # targetDir = "./et...
# Author : OFShare # E-mail : OFShare@outlook.com # Created Time : 2020-04-20 22:59:25 PM # File Name : P1018.py import math import numpy as np # number = [] # dp = [] def dfs(i, j): global number, dp # 递归的边界 if j == 0: return number[1][i] # 记忆化 if dp[i][j] != -1: return dp[i...
from torch.autograd import Variable import torchvision.models as models import torch.nn.functional as F import torch.optim as optim import torch.nn as nn import numpy as np import random import torch import copy import pdb def preprocess_views(pano, mean, std): """ This function preprocesses the input views b...
import os # python source path and root path SRC_PATH = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] ROOT_PATH = os.path.split(SRC_PATH)[0] USB_MOUNT_POINT = "/mnt/usb0" DCIM_PATH = os.path.join(USB_MOUNT_POINT, "DCIM") IMG_CARD_PATH = os.path.join(DCIM_PATH, "PRINT") def mkdir_if_not_exist(dir_path...
import cv2 import numpy as np colormaps = { 'jet': cv2.COLORMAP_JET, 'summer': cv2.COLORMAP_SUMMER } def cvt_rel(rel, c='summer'): rel_map = rel.copy() if len(rel_map.shape) == 3: rel_map = rel_map.reshape(rel_map.shape[2], rel_map.shape[3]) max_rel = rel_map.max() min_rel = rel_map.m...
import gym class RewardCountLimit(gym.Wrapper): def __init__(self, env, max_reward_count=None): """ Returns done once a number of nonzero rewards have been received :param env: the env to wrap :param max_reward_count: the """ super().__init__(env) self.max_r...
import errno import os import stat import time from beaver.utils import REOPEN_FILES, eglob class Worker(object): """Looks for changes in all files of a directory. This is useful for watching log file changes in real-time. It also supports files rotation. Example: >>> def callback(filename, lin...
"""emulates a the web service exposed by blackvue dashcams""" import flask from collections import namedtuple import datetime import re app = flask.Flask(__name__) # represents a recording: filename and metadata Recording = namedtuple("Recording", "filename base_filename datetime type direction extension") # dashc...
import sys from collections import defaultdict as dd sys.setrecursionlimit(10**7) N = int(input()) edge = dd(list) leaf = 1 ans = [0] * N def dfs(x, last=-1): global leaf ans[x] = [leaf, leaf] for t in edge[x]: if t == last: continue dfs(t, x) ans[x][1] = max(ans[x][1...
from .subject import Subject from .behaviorsubject import BehaviorSubject from .replaysubject import ReplaySubject from .asyncsubject import AsyncSubject
# Generated by Django 2.2.dev20190109180446 on 2019-01-09 18:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('hearthstone', '0004_auto_20190109_1729'), ('hearthstone', '0003_profile_elo'), ] operations = [ ]
# 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, software # d...
#!/usr/bin/python3 import gi gi.require_version ("Gtk", "3.0") from gi.repository import Gtk from page1 import Page1 from page2 import Page2 from page3 import Page3 class ArbolDecision(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Árbol De Decisión") self.set_de...
print("Hello, World!") phase = "Hello" print(phase.replace("hello","hi"))
import yaml def load_yaml(path): """ Reads a YAML file and converts its contents into a Python datatype. """ with open(path, 'r') as f: data = yaml.load(f.read()) return data
# Unless explicitly stated otherwise all files in this repository are licensed # under the Apache License Version 2.0. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019 Datadog, Inc. import os import sys import json import time import base64 import logging import bot...
#create tidy version of the poverty overview table: percent and number of people below the poverty level #create vars for Google Drive ids googleDriveIDForImport = 'insert_here' googleDriveIDForExport = 'insert_here' #import from Google Drive #create variable for the file within the folder df_file =[] file_list = dri...
# packages import os, sys, datetime sys.path.append("C:/BERTVision/code/torch") from data.bert_processors.processors import Tokenize_Transform from common.evaluators.bert_glue_evaluator import BertGLUEEvaluator from utils.collate import collate_BERT from torch.cuda.amp import autocast import torch from torch.utils.data...
from sentry_sdk import init, capture_message init("https://mydsn@sentry.io/123") capture_message("Hello World")
''' Created on Apr 26, 2011 @author: woosanguk ''' from django.template import RequestContext, loader from django.http import HttpResponse,HttpResponseRedirect from common import constants,user def handler_Index(request): aAdminUser = user.adminUser() if not aAdminUser.getAdminUser(): ...
alien_0 = {'x_position': 0, 'y_position': 25, 'speed': 'medium'} print(f"Original position: {alien_0['x_position']}") if alien_0['speed'] == 'slow': x_increment = 1 elif alien_0['speed'] == 'medium': x_increment = 2 else: x_increment = 3 alien_0['x_position'] = alien_0['x_position'] + x_increment print(f"New ...
import networkx as nx import pytest np = pytest.importorskip("numpy") def test_non_randomness(): G = nx.karate_club_graph() np.testing.assert_almost_equal(nx.non_randomness(G, 2)[0], 11.7, decimal=2) np.testing.assert_almost_equal( nx.non_randomness(G)[0], 7.21, decimal=2 ) # infers 3 commu...
from mock import MagicMock, ANY, call from scanpointgenerator import LineGenerator, CompoundGenerator from malcolm.core import call_with_params, Context, Process from malcolm.modules.ADSimDetector.blocks import sim_detector_driver_block from malcolm.modules.ADSimDetector.parts import SimDetectorDriverPart from malcol...
from models import User, Post User.create(name='Amy', email='Amy@gmail.com') # return an instance of User User.create(User.name == 'Join', User.email == 'Join@gmail.com') user = User(name='Mark', email='Mark@github.com') user.save() post = Post() post.name = 'Hello World' post.user_id = 1 post.save()
from lojaintegrada import Api def test_get_order_status(mocker): mock_make_request = mocker.patch.object(Api, '_make_request') api = Api(api_key='fake-api-key', app_key='fake-app-key') order = api.get_order_status(12345) mock_make_request.assert_called_with( 'GET', 'https://api.awsli.com.br/...
import azure.cosmos.cosmos_client as cosmos_client import azure.cosmos.documents as documents import requests import azure.cosmos.errors as errors import azure.cosmos.http_constants as http_constants import requests from datetime import date import os import json class DatabaseManagement(): url = 'https://coedemo4.do...
from datetime import datetime from enum import Enum from typing import Optional from pydantic import BaseModel class NewsType(str, Enum): dengue = 'dengue' marketClosure = 'marketClosure' ccEvents = 'ccEvents' upgradingWorks = 'upgradingWorks' class NewsItem(BaseModel): id: str newstype: N...
import json import os import sys import warnings from typing import List, Optional import torch from torch.optim import Optimizer from torch.utils.data import ConcatDataset from tsts.cfg import get_cfg_defaults from tsts.collators import Collator, build_collator from tsts.core import ContextManager from tsts.dataloade...
from .obje import * from .devi import * from .objs.lifi import LifiTag from supyr_struct.defs.tag_def import TagDef # replace the object_type enum one that uses # the correct default value for this object obje_attrs = dict(obje_attrs) obje_attrs[0] = dict(obje_attrs[0], DEFAULT=9) lifi_body = Struct("tagdat...
import torch import torch.nn as nn import torch.nn.functional as F class UNetDownsample(nn.Module): def __init__(self, in_channels, out_channels, normalize=True, dropout=0.0): super(UNetDownsample, self).__init__() layers = [nn.Conv2d(in_channels, out_channels, 4, 2, 1, bias=False)] if nor...
text = ''' <?xml version="1.0" encoding="utf-8" ?> <body copyright="All data copyright San Francisco Muni 2015."> <route tag="all"> <message id="16279" sendToBuses="false" priority="Low"> <text>Go to sfmta.com 4 Email/Text Alerts.</text> </message> <message id="17177" startBoundary="1433203200000" ...
#!/usr/bin/env python """ A ROS planning node that subscribes to a costmap and generates a path by using the Djikstra algorithm""" import sys import math import rospy import tf from visualization_msgs.msg import Marker from geometry_msgs.msg import Point, PoseStamped from nav_msgs.msg import OccupancyGrid, Path fro...
import wikipedia from . import * @beast.on(beastx_cmd(pattern="wikipedia (.*)")) async def _(event): if event.fwd_from: return await event.edit("Processing ...") input_str = event.pattern_match.group(1) result = "" results = wikipedia.search(input_str) for s in results: ...
""" Reader for WikitableQuestions (https://github.com/ppasupat/WikiTableQuestions/releases/tag/v1.0.2). """ from typing import Dict, List, Any import gzip import json import logging import os from overrides import overrides from allennlp.common.checks import ConfigurationError from allennlp.common.util import JsonDi...
import sys solutionsFile = sys.argv[1] with open(solutionsFile,'r') as f : f.readline() f.readline() numSolutions = 0 numOnes = 0 for line in f : lineList = line.strip('\n').split(',') numSolutions += 1 numOnes += int(lineList[2]) print("number of Solutions: ", numSolut...
from django.http import HttpResponseRedirect from django.views.generic.base import View from django.views.generic.list import ListView, MultipleObjectMixin from django.views.generic.detail import DetailView, SingleObjectMixin from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.urls imp...
import functools import json import os from django.contrib.staticfiles.storage import StaticFilesStorage from django.utils.module_loading import import_string from . import environments from .settings import artifacts_settings class BaseFinder: """ A base file finder to be used for custom artifacts finder c...
import time try: from .exception import WrongOrderError except: from exception import WrongOrderError class StopWatch(): def __init__(self, error=True): self.start_time = 0 self.stop_time = 0 self.time = 0 self.isStop = True self.error = error def start(self): ...
from django.db import models # Create your models here. class Post(models.Model): value=models.CharField(max_length=20) key=models.CharField(max_length=20, unique=True) def __unicode__(self): return self.key class Parameters(models.Model): value=models.CharField(max_length=20) key=models....
from flask import request from flask import current_app as app # import requests import random from twilio.twiml.messaging_response import MessagingResponse import requests from urllib.parse import quote as urlencode class BOTResponse(object): def __init__(self, phone_number): self.phone_number = phone_number i...
# Author: Simon Blanke # Email: simon.blanke@yahoo.com # License: MIT License import os import sys import inspect import pandas as pd import streamlit as st import plotly.graph_objects as go from tde_wrapper import open_tde from data_io import Paths def search_data_statistics(search_data): scores = search_data...
"""lg-rez / features / Process d'inscription Étapes préliminaires pour les joueurs avant le début de saison """ from lgrez import config from lgrez.blocs import tools, env, gsheets from lgrez.bdd import Joueur, Role, Camp, Statut async def new_channel(member): """Crée et renvoie un nouveau salon pr...
#!/usr/bin/python # +----------------+ #---| Fun With Lists |--- # +----------------+ # Assignment to slices is also possible, and this can even change the size of # the list or clear it entirely: a = range(1,12) b = ['omg', 'wtf', 'abc', 'xyz'] # THESE ONLY WORK IN PYTHON2 (python3 gets "TypeError: 'range' ob...
import sys from distutils.core import setup from distutils.extension import Extension if sys.version_info[0] != 3: print("This module is only compatible with python 3!") sys.exit() setup( name='cobs', version='1', description='A fixed version of Craigs MqQueen\'s COBS module', author='Frédéri...
#!/bin/env python2 # -*- coding: utf-8 -*- """ Fetches, parses and stores the data from the austrian aid projects website since January 1st 2010. """ import urllib2 import bs4 from bs4 import BeautifulSoup from datetime import datetime import re import json import os import string import time __author__ = "Christia...
from django.db import models class NaturalKeyManager(models.Manager): def get_by_natural_key(self, name): return self.get(name=name) class BaseNameModel(models.Model): name = models.CharField(max_length=32, unique=True, null=False, blank=False) objects = NaturalKeyManager() def __str__(self...
# Generated by Django 3.1.3 on 2021-02-11 03:47 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('snpdb', '0017_new_columns'), ] operations = [ migrations.CreateModel( name='VariantAlleleCollec...
from random import shuffle from typing import List, Union from unify_eval.model.deep_model import DeepModel from unify_eval.model.mixins.sequences.language_models import LayeredLanguageModel from unify_eval.training.callback import TrainerCallback from unify_eval.training.seq2seq.seq2seq_data import Seq2SeqData from u...
import argparse import scipy.sparse as sp import numpy as np from pprint import pformat from gensim.corpora import MmCorpus from gensim.matutils import corpus2csc from scripts.utils.utils import init_logger from scripts.utils.plot import get_quantile, bar_plot logger = init_logger() def main(): parser = ...
class Signal(object): def __init__(self, name, width=0, low=0, asc=False, vec=0): self.name = name self.width=width self.low = low self.asc = asc def range(self): if self.width > 0: l = self.width+self.low-1 r = self.low if self.asc: ...
# # Created on Thu Jan 13 2022 # # The MIT License (MIT) # Copyright (c) 2022 Maatuq # # 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 ri...
# @copyright@ # Copyright (c) 2006 - 2019 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ # import stack.commands import stack.gen import stack.redhat.gen class Implementation(stack.commands.list.host.profile.implementation): def ...
import os import sys sys.path.append(os.getcwd()) import logging import random import time import wandb import numpy as np from datetime import datetime from game.game import Game from data.replay_buffer import ReplayBuffer from trainers.helpers import ARGS, dotdict # importing agents for training from data.agent ...
from leetcode_tester import Tester from typing import Optional, List class Solution: # # Mask array # def isValidSudoku(self, board: List[List[str]]) -> bool: # rows = [[False for _ in range(9)] for _ in range(9)] # cols = [[False for _ in range(9)] for _ in range(9)] # boxes = [[Fals...
#!/usr/bin/env python """ """ ### imports ### import argparse import numpy as np import os import time import scipy import matplotlib from itertools import combinations matplotlib.use('Agg') from matplotlib import pyplot as plt import seaborn as sns from scipy import ndimage import pandas as pd import Bio from Bio im...
from __future__ import absolute_import, division, print_function import json import os import random import datasets random.seed(42) # This is important, to ensure the same order for concept sets as the official script. _CITATION = """\ @article{lin2019comgen, author = {Bill Yuchen Lin and Ming Shen and Wang...
# coding=utf-8 ''' Problem 53 15 August 2003 There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3 = 10. In general, nCr = n! r!(n−r)! ,where r ≤ n, n! = n×(n−1)×...×3×2×1, and 0! = 1. It is n...
# Copyright 2019 Gabriele Valvano # # 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...
"""Add type column values constraint to grouping table.""" from alembic import op revision = "6882c201b56e" down_revision = "4a4c2539c666" constraint_name = "grouping_type_must_be_a_valid_value" table_name = "grouping" def upgrade(): op.create_check_constraint( constraint_name, table_name=table_...
import adsk.core import adsk.fusion import adsk.cam # Import the entire apper package import apper # import config # Alternatively you can import a specific function or class # from apper import apper.AppObjects import json import vex_cad allParameterManagers = [] def defineParameterManagers(): ao = apper.App...
# -*- coding: utf-8 -*- # CALaws from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.db.models import Q from django.http import Http404, HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext from laws import models fr...
import wx from src.wizard.controller.frmSampFeatSelectPanel import SampFeatSelectPanel from src.wizard.controller.frmVariableSelectPanel import VariableSelectPanel from src.wizard.controller.frmUnitSelectPanel import UnitSelectPanel from src.wizard.controller.frmProcLevelSelectPanel import ProcLevelSelectPanel from src...
import errno import functools import grp import logging import os import pwd import re import six from leapp.libraries.common import repofileutils from leapp.libraries.stdlib import api, CalledProcessError, run from leapp.models import ( ActiveKernelModule, ActiveKernelModulesFacts, FirewallsFacts, Fi...
import bson import pymongo import json from bson import ObjectId from pymongo import MongoClient import string import tangelo def run(host,database,collection): # Create an empty response object. response = {} collectionNames = ['select a run to examine'] # look through the collection and return a li...
import unittest ##import unittest module from user import User ##import User class from user.py file class TestUser(unittest.TestCase): def setUp(self): ''' method to run before each test case ''' self.new_user = User("twitter","iankabugi","1234pass") #create user object def tear...
import json import pytest from werkzeug.wrappers import Request, Response from now_python_wsgi import handler # Test applications @Request.application def application(request): return Response(json.dumps({ 'args': request.args, 'query_string': request.query_string.decode('utf-8') })) @Req...
from json import loads, dumps import spacy from bs4 import BeautifulSoup from kafka import KafkaConsumer, KafkaProducer from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer class TweetCleanSentiment(object): def __init__(self): super().__init__() # listen to topic from LiveTweet....
import re from prody import parsePDB from Bio import pairwise2, SeqIO from typing import Tuple def get_gaps_and_coverage(pdb_file: str, full_sequence: str, chain: str = 'A') -> Tuple: ''' Given a pdb file and a protein sequence, performs an alignment be...
from functools import reduce def eq_dice(set_): product=reduce(lambda x, y: x*y, set_) res=helper(product, [], set()) return len(res)-1 if (tuple(sorted(set_)) in res) else len(res) def factors(n): res=set() for i in range(2, int(n**0.5)+1): if n%i==0: res.add(i) res....
from __future__ import unicode_literals from textplusstuff import registry from .models import RegisteredModel from .serializers import RegisteredModelSerializer class RegisteredModelStuff(registry.ModelStuff): # The queryset used to retrieve instances of TestModel # within the front-end interface. For inst...
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "Osman Baskaya" import sys import os import gzip inp = os.path.join(sys.argv[1], "%s.tok.gz") curr = "" f = None for line in sys.stdin: inst, tw, ln, offset = line.split() ln = int(ln) - 1 offset = int(offset) if curr != tw: curr = tw ...
# Advent of Code 2017 # Day 1, Part 2 # @geekygirlsarah # Files to run through # input.txt being the input the puzzle provides inputFile = "input.txt" # inputFile = "testinput.txt" # Process file with open(inputFile) as f: contents = f.readline(-1) if not contents: print("End of file") quit() ...
import win32file, win32api, winerror import os def ReadCallback(input_buffer, data, buflen): fnamein, fnameout, f = data ## print fnamein, fnameout, buflen f.write(input_buffer) ## python 2.3 throws an error if return value is a plain int return winerror.ERROR_SUCCESS def WriteCallback(output_bu...
from rest_framework.exceptions import NotFound from django.utils.translation import ugettext_lazy as _ from openbook_common.utils.helpers import hashtags_regexp from openbook_common.utils.model_loaders import get_hashtag_model def hashtag_name_exists(hashtag_name): Hashtag = get_hashtag_model() if not Hashta...
import cv2 import numpy as np def nothing(x): pass cap = cv2.VideoCapture(0) cv2.namedWindow("frame") cv2.createTrackbar("test", "frame", 50, 500, nothing) cv2.createTrackbar("color/gray", "frame", 0, 1, nothing) while True: ret, frame = cap.read() if not ret: break test = cv2.getTrackbarP...
from .aerodynamic_fundamental_equations import get_lift, get_drag, get_moment
# Generated by Django 3.2.7 on 2021-09-10 17:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stlViwerApp', '0002_stlfilemodel_title'), ] operations = [ migrations.CreateModel( name='FileModel', fields=[ ...
from flask import Flask, render_template, redirect, url_for from .config import Configuration from .shipping_form import ShippingForm from flask_wtf.csrf import CSRFProtect from flask_migrate import Migrate from .models import db, Package app = Flask(__name__) app.config.from_object(Configuration) csrf = CSRFProtect()...
from enum import IntEnum import shutil import glob import pandas as pd TAGS = IntEnum("TAGS", "RUN EXIT") def aggregate_results(): dfs = list() for subdir in glob.glob("subdir_child_*"): rank = subdir.split("_")[-1] df = pd.read_pickle(f"{subdir}/rslt_child_{rank}.pkl") df["rank"] ...
from Tools.scripts.ndiff import fail from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.keys import Keys import time def clico_excluir(driver): excluir = driver.find_el...
weekdays_names = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"] months_names = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь']
from ROOT import TFile, heppy, Double import os import logging import pprint class TauMVAID(object): def __init__(self, gbrforest_fname, norm_fname, mva, mva_opt, working_points, verbose=True): '''constructor gbrforest_fname : path to the root file containing...