content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
from blackbox_mpc.policies.model_free_base_policy import ModelFreeBasePolicy import tensorflow as tf class RandomPolicy(ModelFreeBasePolicy): def __init__(self, number_of_agents, env_action_space): """ This is the random policy for controlling the agent Parameters --------- ...
nilq/baby-python
python
import ROOT import Analysis import AnalysisHelpers as AH import Constants #====================================================================== class ZAnalysis(Analysis.Analysis): """Analysis searching for events where Z bosons decay to two leptons of same flavour and opposite charge. """ def __init__(self, ...
nilq/baby-python
python
import uuid import os import shutil def create_tmp_dir() -> str: tmp_dir = f"/tmp/gitopscli/{uuid.uuid4()}" os.makedirs(tmp_dir) return tmp_dir def delete_tmp_dir(tmp_dir: str) -> None: shutil.rmtree(tmp_dir, ignore_errors=True)
nilq/baby-python
python
""" BeWilder - a *wild* text adventure game :: Main game module # Make a new player object that is currently in the 'outside' room. Write a loop that: - Prints the current room name - Prints the current description (the textwrap module might be useful here). - Waits for user input and decides what to do. - If th...
nilq/baby-python
python
import inspect import re import sys from builtins import object from operator import attrgetter from os import sep, path, mkdir try: from os import scandir except ImportError: from scandir import scandir from n_utils.git_utils import Git from n_utils.aws_infra_util import load_parameters class Component(obje...
nilq/baby-python
python
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # from abc import ABCMeta, abstractmethod import numpy as np from pytest import approx import torch from implicitresnet.utils.spectral import spectral_norm import implicitresnet.utils.calc as utils #############...
nilq/baby-python
python
# -*- coding: utf-8 -*- import logging from .api import PrivoxyAdapter, RetryPrivoxyAdapter # noqa: F401 from .version import __version__ # noqa: F401 logging.getLogger("urllib3").setLevel(logging.ERROR) __author__ = "Alexey Shevchenko" __email__ = 'otetz@me.com' __copyright__ = "Copyright 2017, Alexey Shevchenko...
nilq/baby-python
python
import os import unittest from pathlib import Path import pytest from paramak import RotateStraightShape, SweepSplineShape class TestSweepSplineShape(unittest.TestCase): def setUp(self): self.test_shape = SweepSplineShape( points=[(-10, 10), (10, 10), (10, -10), (-10, -10)], pat...
nilq/baby-python
python
""" TF sandbox for testing new stuff """ import math import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_boolean('fake_data', False, 'If true, uses fake data ' 'for unit testing.') flags.DEFIN...
nilq/baby-python
python
""" Example showing how to set up a semi-discretization with the spectral difference method and advect it. """ # Import libraries ################## from nodepy import semidisc from nodepy import * import numpy as np import matplotlib.pyplot as pl # Create spatial operator L (i.e. u' = L u) ########################...
nilq/baby-python
python
class pos: def __init__(self, r, c, is_blocked): self.r = r self.c = c self.is_blocked = is_blocked def robot_find_path(matrix, cur_pos, end): ''' Start at 0,0''' memo_path = dict memo_path[ (0,0) ] = (0,0) if (cur_pos == end): return pos if cur_pos.is_blocked: ...
nilq/baby-python
python
import maya.cmds as cmds #### XGEN DESCRIPTIONS - RENDER ONLY ##### def main(): xGen = getXgen() setVisibility(xGen) def getXgen(): node = cmds.ls(selection = True) children_nodes = cmds.listRelatives(allDescendents=True, type='xgmSplineDescription') if not children_nodes: print("No XGEN") ...
nilq/baby-python
python
from src.domain.interaction.interaction_phase_state import InteractionPhaseState class ExitPhase(InteractionPhaseState): def fetch_next_interaction_phase(self, input_text): return self def process_input_text(self, input_text, input_text_processor): return input_text_processor.process_exit_st...
nilq/baby-python
python
# --------------------------------------------------------------------- # Angtel.Topaz.get_vlans # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # Python m...
nilq/baby-python
python
""" makeblastdb -dbtype nucl -in nanoTRF_0.1M.fasta -out nanoTRF_0.1M.fasta blastn -query merged_TR_rank_all.fasta -outfmt 6 -db nanoTRF_0.1M.fasta -out merged_TR_rank_all_vs_nanoTRF_0.1M.out -window_size 22 -num_threads 100 -evalue 10 """ from bin.helpers.help_functions import getLog import os class run_BLAST(): ...
nilq/baby-python
python
import argparse import csv import itertools as it from operator import itemgetter import csv2xml as c2x def find_targeting(from_char, to_char): lineset, opponent_meta = c2x.load_character(from_char) rows = [] line_to_row = {} for stageset, case in c2x.iter_lineset(lineset): targeted_...
nilq/baby-python
python
# Copyright (c) 2015 Mirantis 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 to in writing, so...
nilq/baby-python
python
# -*- coding: utf-8 -*- ''' Easy and basic configure for print log ''' __author__ = 'lujiaying@baidu.com' import logging from logging.handlers import RotatingFileHandler import os ################################ # Conf to edit ################################ # To print into screen if DebugConf is True DebugConf = ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Common system settings # --------------------------------------------------------------------- # Copyright (C) 2007-2015 The NOC Project # See LICENSE for details # ---------------------------------------------------------...
nilq/baby-python
python
import numpy as np from scipy.optimize import minimize import dadapy.utils_.utils as ut def ML_fun_gPAk(params, args): """ The function returns the log-Likelihood expression to be minimized. Requirements: * **params**: array of initial values for ''a'', ''b'' * **args**: additional parameters '...
nilq/baby-python
python
class StockSpanner: def __init__(self): self.stack = [] # (price, span) def next(self, price: int) -> int: span = 1 while self.stack and self.stack[-1][0] <= price: span += self.stack.pop()[1] self.stack.append((price, span)) return span
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """This allows easy testing of the `projects` service of the application server. It can be run interactively or in 'simulation' mode. """ from __future__ import unicode_literals, division, print_function #Py2 import argparse import random import time import requests ...
nilq/baby-python
python
#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost","root","","zambia_weather") # prepare a cursor object using cursor() method cursor = db.cursor() insert = """INSERT INTO test (name, region) VALUES (%s, %s)""" sql = cursor.execute(insert, ("Hello", "World")) db.commit() #curs...
nilq/baby-python
python
import numpy as np from numpy import log, exp, sqrt from numpy.lib.shape_base import _expand_dims_dispatcher # import yahoo finance to pull stock and crypto data from import yfinance as yf import pandas as pd import matplotlib.pyplot as plt import scipy.optimize as optimization # bringing in these libraries in order to...
nilq/baby-python
python
# Copyright (C) 2019 LYNX B.V. All rights reserved. # Import ibapi deps from ibapi import wrapper from ibapi.client import EClient from ibapi.contract import * from threading import Thread from time import sleep CONTRACT_ID = 4001 class Wrapper(wrapper.EWrapper): def __init__(self): wrapper.EWrapper.__...
nilq/baby-python
python
import re # print(re.split(r'\s*', 'here are some words')) # print(re.split(r'(\s*)', 'here are some words')) # print(re.split(r'(s*)', 'here are some words')) # [a-z] find a range of characters # print(re.split(r'[a-hA-F0-9]', 'saldkfjeilksjdLKJSAEIAL;SDF', re.I | re.M)) ''' \d = digits \D = non-digits \s = Space ...
nilq/baby-python
python
## AUTHOR: Vamsi Krishna Reddy Satti ################################################################################## # Data loader ################################################################################## import numpy as np class DataLoader: def __init__(self, dataset, batch_size=1, shuffle=False):...
nilq/baby-python
python
import PHPTraceTokenizer import PHPProfileParser import PHPTraceParser import os traceDir = "test-data" def trace_and_profile_from_timestamp(traceDir, timestamp): return ( os.path.join(traceDir, "{}.xt".format(timestamp)), os.path.join(traceDir, "{}.xp".format(timestamp)) ) def create_trace(...
nilq/baby-python
python
""" EVM Instruction Encoding (Opcodes) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. contents:: Table of Contents :backlinks: none :local: Introduction ------------ Machine readable representations of EVM instructions, and a mapping to their implementations. """ import enum from typing import Callable, Dict from ....
nilq/baby-python
python
import tensorflow as tf import sys def get_id_feature(features, key, len_key, max_len): ids = features[key] ids_len = tf.squeeze(features[len_key], [1]) ids_len = tf.minimum(ids_len, tf.constant(max_len, dtype=tf.int64)) return ids, ids_len def create_train_op(loss, hparams): train_op = tf.contrib.layers.op...
nilq/baby-python
python
from __future__ import unicode_literals from celery import shared_task from isisdata.models import * from isisdata.tasks import _get_filtered_object_queryset from django.apps import apps from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.models import User from django.db import models imp...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import time import functools import random from multiprocessing import Pool import cProfile import pstats try: import networkx as nx except ImportError: print('This script requires NetworkX to be installed.') exit(1) try: import vkontakte...
nilq/baby-python
python
#!/env/bin/python import hashlib import json import random import string import sys import time import zmq from termcolor import colored import fnode # def check_files_node(node, my_id): # files_my_id = {} # delete = {} # for i in node['file']: # print i[0:7] + '-->>' + node['lower_bound'] # ...
nilq/baby-python
python
from django import forms from django.forms import SelectDateWidget from mopga.modules.project.models import Project class NewProject(forms.Form): title = forms.CharField(max_length=200) donationGoal = forms.IntegerField(label='Donation goal', min_value=0) description = forms.CharField(max_length=5000, wi...
nilq/baby-python
python
from ..systems import ContinuousSys from ..tools import nd_rand_init, sigmoid import numpy as np class JansenRit(ContinuousSys): def __init__(self, A=3.25, B=22, a_inv=10, b_inv=20, C=135, Crep=[1., 0.8, 0.25, 0.25], vmax=5, v0=6, r=0.56, n_points=5000, t_min=0, t_max=30): self.A = A self.B = B ...
nilq/baby-python
python
__all__ = ['Design', 'DesignTools', 'DesignSep2Phase', 'DesignSep3Phase']
nilq/baby-python
python
def kfilter(ar,kf): nx=shape(ar)[0];kx=fftshift(fftfreq(nx))*nx ny=shape(ar)[1];ky=fftshift(fftfreq(ny))*ny nz=shape(ar)[2];kz=fftshift(fftfreq(nz))*nz km=np.zeros((nx,ny,nz)) for x in range(nx): for y in range(ny): for z in range(nz): km[x,y,z]=sqrt(kx[x]**2+ky[y]**2+kz[z]**2)...
nilq/baby-python
python
# -*- coding: utf-8 -*- import yaml from pymodm import connect, fields, MongoModel, EmbeddedMongoModel def setup_db(environment): config = parse_db_config(environment) connect("mongodb://{0}/{1}".format(config['clients']['default']['hosts'][0], config['clients']['default']['database'])) def parse_db_config(...
nilq/baby-python
python
import psutil import gc # check if memory usage is over limit def check_memory_limit(limit: float = 90.): return psutil.virtual_memory()[2] > limit def memory_circuit_breaker(limit: float = 90.): # if over limit, garbage collect if check_memory_limit(limit): gc.collect() # if still above limi...
nilq/baby-python
python
# Boilerplate stuff: from pyspark import SparkConf, SparkContext conf = SparkConf().setMaster('local').setAppName('DegreesOfSeparation') sc = SparkContext(conf=conf) # The characters we wish to find the degree of separation between: START_CHARACTER_ID = 5306 # SpiderMan TARGET_CHARACTER_ID = 14 # ADAM 3,031 (who?)...
nilq/baby-python
python
from aiogram.types import Message, ReplyKeyboardRemove from aiogram.dispatcher.filters import ChatTypeFilter from app.loader import dp from app.keyboards import reply_bot_menu @dp.message_handler(ChatTypeFilter("private"), commands='menu') async def show_menu_command(msg: Message): return await msg.answer( ...
nilq/baby-python
python
from __future__ import print_function from __future__ import unicode_literals import errno import os from . import config def _get_address(instance_ip): username = config.get('ssh.username_prefix', '') + config.get('ssh.username', '') # Don't add the username to the address when it is the current user, ...
nilq/baby-python
python
import unittest from unittest import mock from betfairlightweight.streaming.stream import BaseStream, MarketStream, OrderStream from tests.unit.tools import create_mock_json class BaseStreamTest(unittest.TestCase): def setUp(self): self.listener = mock.Mock() self.listener.max_latency = 0.5 ...
nilq/baby-python
python
#! /usr/bin/env python3 # Copyright 2018 Red Book Connect LLC. operating as HotSchedules # # 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 # ...
nilq/baby-python
python
#!/usr/bin/env python3 from baselines.common import tf_util as U from baselines import logger from env.LaneChangeEnv import LaneChangeEnv from ppo_new import ppo_sgd import random, sys, os import numpy as np import tensorflow as tf if 'SUMO_HOME' in os.environ: tools = os.path.join(os.environ['SUMO_HOME'], 'tools')...
nilq/baby-python
python
import matplotlib.pyplot as plt import numpy as np from matplotlib.collections import LineCollection # In order to efficiently plot many lines in a single set of axes, # Matplotlib has the ability to add the lines all at once. Here is a # simple example showing how it is done. N = 50 x = np.arange(N) # Here are many ...
nilq/baby-python
python
#! /usr/bin/env python # -*- coding: utf-8 -*- import configparser import os class ConfigParser: def __init__(this, filePath = os.getcwd() + os.sep + 'config' + os.sep + 'config.ini'): this.fp = filePath this.conf = configparser.ConfigParser() this.conf.read(this.fp, encoding="utf-8-sig") ...
nilq/baby-python
python
## This file is part of Scapy ## See http://www.secdev.org/projects/scapy for more informations ## Copyright (C) Philippe Biondi <phil@secdev.org> ## This program is published under a GPLv2 license """ Clone of Nmap's first generation OS fingerprinting. """ import os from scapy.data import KnowledgeBase from scapy.c...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017 Ben Lindsay <benjlindsay@gmail.com> from distutils.core import setup desc = 'A module for automating flat or hierarchical job creation and submission' with open('README.rst', 'r') as f: long_desc = f.read() setup( name = 'job_tree', packag...
nilq/baby-python
python
#-------------------------------------# # Python script for BEST address # # Author: Marc Bruyland (FOD BOSA) # # Contact: marc.bruyland@bosa.fgov.be # # June 2019 # #-------------------------------------# from BEST_Lib import * def createTestFile(inputFile, outputFile): fi...
nilq/baby-python
python
import logging import re from string import punctuation import unicodedata from nltk.corpus import stopwords import contractions from spellchecker import SpellChecker from .article import get_article from .dictionary import get_extended_dictionary, valid_one_letter_words logger = logging.getLogger('django') def...
nilq/baby-python
python
import logging; log = logging.getLogger(__name__) import OpenGL.GL as gl from OpenGL.raw.GL.ARB.vertex_array_object import glGenVertexArrays, \ glBindVertexArray class VertexArray: """GL vertex array object.""" class _Binding: """Object returned by VertexArray.bound().""" def __init__(self, a...
nilq/baby-python
python
REDIS_URL = 'redis://redis:6379'
nilq/baby-python
python
# This program is public domain. """ Support for rarely varying instrument configuration parameters. Instrument configuration parameters will change throughout the lifetime of an instrument. For example, the properties of the beam such as wavelength and wavelength divergence will change when a new monochromator is i...
nilq/baby-python
python
import cv2 import glob, os import numpy as np import pandas as pd import tensorflow as tf from preprocessing import Preprocess import Model from matplotlib import pyplot as plt df_train = [] df_test = [] df_val = [] if os.path.exists("./dataset/train.npy"): df_train = np.load("./dataset/train.npy") df_test = ...
nilq/baby-python
python
import sys import numpy as np import h5py import random import os from subprocess import check_output # 1. h5 i/o def readh5(filename, datasetname): data=np.array(h5py.File(filename,'r')[datasetname]) return data def writeh5(filename, datasetname, dtarray): # reduce redundant fid=h5py.File(filename,...
nilq/baby-python
python
# シェルソート n = int(input()) lst = [int(input()) for _ in range(n)] def insertionSort(A, n, g): global cnt for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+g] = A[j] j = j - g cnt += 1 A[j+g] = v def shellSort(A, n): ...
nilq/baby-python
python
import json from flask import request, make_response, jsonify, session as loginSession from sqlalchemy.exc import IntegrityError from sqlalchemy.orm.exc import NoResultFound from config.flask_config import app from model.entities import Category from model.repository import CategoryRepo from exception.exception_help...
nilq/baby-python
python
s = input() index_A = float('inf') index_Z = float('inf') for i in range(len(s)): if s[i] == 'A': index_A = i break for i in range(len(s) - 1, -1, -1): if s[i] == 'Z': index_Z = i break print(len(s[index_A:index_Z + 1]))
nilq/baby-python
python
def evaluate_policy(env, model, render, turns = 3): scores = 0 for j in range(turns): s, done, ep_r, steps = env.reset(), False, 0, 0 while not done: # Take deterministic actions at test time a = model.select_action(s, deterministic=True) s_prime, r, done, inf...
nilq/baby-python
python
import os,sys import re import sympy import math import cmath from math import factorial as fact from sympy import factorial as symb_fact from sympy import factorial2 as symb_fact2 from scipy.special import binom as binomial from sympy import exp as symb_exp from sympy import I as symb_I def generate_cartesian_ls( L )...
nilq/baby-python
python
#Embedded file name: cmstop_inj.py import re if 0: i11iIiiIii def assign(service, arg): if service != '''cmstop''': return else: return (True, arg) if 0: O0 / iIii1I11I1II1 % OoooooooOO - i1IIi def audit(arg): o0OO00 = arg + decode('\xc5Y\x05K\xc5\xa8\x80\xac\x13\xc3=\r\x9...
nilq/baby-python
python
# encoding: utf-8 """ @author: liaoxingyu @contact: sherlockliao01@gmail.com """ import torch from torch import nn from torch.nn import functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import numpy as np import math import random from .backbones import * from .loss...
nilq/baby-python
python
# Confidential, Copyright 2020, Sony Corporation of America, All rights reserved. from .person_routines import DefaultPersonRoutineAssignment from ..environment import Home, GroceryStore, Office, School, Hospital, RetailStore, HairSalon, Restaurant, Bar, \ PandemicSimConfig, LocationConfig __all__ = ['town_config...
nilq/baby-python
python
from django.urls import path, include from .views import registration_view, login_view, logout_view urlpatterns = [ path("registration/", registration_view, name="registration_view"), path("login/", login_view), path("logout/", logout_view) ]
nilq/baby-python
python
from holdings.position import Position from collections import OrderedDict from holdings.transaction import Transaction class PositionHandler: """ Helper class to handle position operations in a Portfolio object. """ def __init__(self): self.positions = OrderedDict() def transact_positio...
nilq/baby-python
python
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
nilq/baby-python
python
''' Handling the data io ''' import argparse import torch import sys def read_vocab_idx(vocab_path): ''' build vocab ''' word2idx = {"_PAD" : 0} with open(vocab_path) as f: for line in f: tokens = line.strip("\n").split("\t") no = int(tokens[1]) word2idx[toke...
nilq/baby-python
python
class Serie: __slots__ = ("__weakref__", "_state", "_rooms", "id", "code", "name", "description", "difficulty", ) def __init__(self, state, data): self._state = state self._from_data(data) def _from_data(self, data): self.id = data.get("_id") self.code = data....
nilq/baby-python
python
import pathlib #import numpy as np test_data = 0 points = set() folds = [] path = str(pathlib.Path(__file__).parent.resolve()) with open(path+"/data{}.csv".format("_test" if test_data else ""), 'r') as file: for line in file.read().splitlines(): if line.startswith("fold"): folds.append((line[...
nilq/baby-python
python
class Attr(object): def __init__(self, name, type_): self.name = name self.type_ = type_ def __get__(self, instance, cls): return instance.__dict__[self.name] def __set__(self, instance, value): if not isinstance(value, self.type_): raise TypeError('expected an...
nilq/baby-python
python
from django.urls import path, include from django.contrib import admin from django.views.decorators.csrf import csrf_exempt from rest_framework import routers, urlpatterns from .views import * urlpatterns = [ path("register/", Register.as_view(), name="register-user"), ]
nilq/baby-python
python
import re import storage import args import requests import concurrent.futures from bs4 import BeautifulSoup from urllib.parse import urlparse, urljoin class NaiveCrawler: def __init__(self, initial_url, allowed_domains, depth, database, init=True): self.init = init self.initial_url = initial_url ...
nilq/baby-python
python
from django.urls import path from .views import DocumentAPIView, DocumentDetails urlpatterns = [ path('document/', DocumentAPIView.as_view()), path('document/<int:id>/', DocumentDetails.as_view()), ]
nilq/baby-python
python
# -*- coding: utf-8 -*- import os import sys import topology_sdk.api.view.create_view_pb2 import topology_sdk.api.view.delete_view_pb2 import topology_sdk.api.view.fetch_cmdb_business_view_pb2 import topology_sdk.model.topology.view_pb2 import topology_sdk.api.view.fetch_origin_view_pb2 import topology_sdk.api.v...
nilq/baby-python
python
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.ads.google_ads.v1.proto.resources import mobile_device_constant_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_resources_dot_mobile__device__constant__pb2 from google.ads.google_ads.v1.proto.services import mobile_devi...
nilq/baby-python
python
# Author: Aqeel Anwar(ICSRL) # Created: 10/14/2019, 12:50 PM # Email: aqeel.anwar@gatech.edu import numpy as np import os, subprocess, psutil import math import random import time import airsim import pygame from configs.read_cfg import read_cfg import matplotlib.pyplot as plt def close_env(env_process): process ...
nilq/baby-python
python
#! /usr/bin/env nix-shell #! nix-shell -i python3 -p "[python3] ++ (with pkgs.python37Packages; [ requests future ws4py pytest pylint coveralls twine wheel ])" # <<END Extended Shebang>> import json from pywebostv.discovery import * from pywebostv.connection import * from pywebostv.controls import * with open('/home/...
nilq/baby-python
python
NSIDE = 16 STRENGTH = 500 BACKGROUND = 1000 TILT = 45 ALTERNATING = False TEST = False TALK = True plot = True #%matplotlib inline only a notebook feature. """ Parameters ---------- NSIDE : int Must be a power of 2, corresponding to the number of pixels to occupy TSM (ie NSIDE = 8 => 768 pixels, etc.) STRENGTH : f...
nilq/baby-python
python
# -*- coding: utf-8 -*- """Script to run the experiment for anglicisms with different parameters""" import experiment_context_window_comparative as ecwc score_fns = ['binary', 'raw_count', 'chi_sq', 'dice'] score_lists = {} for window_size in [4,25,60,100]: # for window_size in [90,100,110]: for score_fn in ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Sun Jun 25 12:50:46 2017 @author: Sergio Cristauro Manzano """ from ..DB.MySQL_Aena import MySQLAccessAena as DBContext #Server #from self.db.MySQL import MySQLAccess as DBContext #Local class RepositoryVuelosEntrantesAena(): ############################################...
nilq/baby-python
python
import datetime import requests import lxml.html as lh import pandas as pd ## VARS # Code of meteo station station_code = 'CE' # year-month-day to start retrieving data from meteodate = (2021, 5, 13) # how many days of data do we retrieve? meteodays = 62 # name of excel file to write to excelfile = r'mete...
nilq/baby-python
python
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # AUTHOR: César Miranda Meza # COMPLETITION DATE: November 23, 2021. # LAST UPDATE: November 27, 2021. # # This code is used to apply the classification evalua...
nilq/baby-python
python
import csv import pickle callstate={} with open('call_state.dat') as fin: reader=csv.reader(fin, skipinitialspace=True, delimiter='|', quotechar="'") for row in reader: #print (row[0]) callstate[row[0]]=row[1:] print ('Done') print ("Saving Object") # Step 2 with open('callstate.dictionary...
nilq/baby-python
python
import json import directory def parse_key_group_name(key_group_name = 'Group.basic'): line = key_group_name.split('.') if len(line) != 2 or not line[0] or not line[1]: raise ValueError('key_group_name not correct, please see dtsk_python_load_demo.py') name_type = line[0] name_value = line[1] ...
nilq/baby-python
python
# coding: utf-8 import unittest from problems.power_of_two import Solution from problems.power_of_two import Solution2 from problems.power_of_two import Solution3 class TestCase(unittest.TestCase): def setUp(self): self.solution = Solution() def test(self): test_data = [ {'n': 0,...
nilq/baby-python
python
import unittest import numpy as np from pax import core, plugin from pax.datastructure import Event, Peak class TestPosRecTopPatternFunctionFit(unittest.TestCase): def setUp(self): self.pax = core.Processor(config_names='XENON1T', just_testing=True, ...
nilq/baby-python
python
# Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite. velocidade = int(input('Quantos Km/h você estava dirigindo ? ')) if velocidade >80: print('QUER VOAR ???') multa = (velocid...
nilq/baby-python
python
""" Unit tests for `dh.ejson`. """ import fractions import unittest import dh.ejson class Test(unittest.TestCase): def test_bytes(self): """ JSON serialization and de-serialization of byte arrays. """ x = bytes([225, 127, 98, 213]) j = dh.ejson.dumps(x) xHat = dh....
nilq/baby-python
python
# Universal Power Supply Controller # USAID Middle East Water Security Initiative # # Developed by: Nathan Webster # Primary Investigator: Nathan Johnson # # Version History (mm_dd_yyyy) # 1.00 03_24_2018_NW # ###################################################### # Import Libraries import Parameters from Initializatio...
nilq/baby-python
python
import tensorflow as tf from tensorflow.keras.layers import (Add, Conv2D, Input, Concatenate, TimeDistributed) from tensorflow.keras.models import Model from .blocks import (RecurrentConvBlock, ResidualBlock, ConvBlock, DenseBlock, TransitionBlock, LocalizedC...
nilq/baby-python
python
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
nilq/baby-python
python
from server import Server def start(port): def newServer(port): s = Server(port) return s server = newServer(port) server.start() if __name__ == '__main__': start(":9090")
nilq/baby-python
python
import logging from flask import ( Blueprint, jsonify, request, abort, current_app ) from onepiece.exceptions import ( ComicbookException, NotFoundError, SiteNotSupport ) from . import crawler from . import task from .const import ConfigKey logger = logging.getLogger(__name__) app = B...
nilq/baby-python
python
from flask import render_template,flash, redirect, request, jsonify from flask_wtf import FlaskForm from wtforms import TextField, validators, SubmitField, DecimalField, IntegerField, RadioField from app import app, controller #from .models import from random import randint import json from .controller import plotMete...
nilq/baby-python
python
import inspect from typing import Any, Dict import pytest from di.utils.inspection.abstract import AbstractInspector from tests.di.utils.inspection.module_abstract import ( CanonicalAbstract, DuckAbstract1, DuckAbstract2, DuckAbstract3, DuckAbstract4, DuckAbstract5, NormalClass, abstra...
nilq/baby-python
python
""" Surface Boolean Logic ~~~~~~~~~~~~~~~~~~~~~ Use a surface inside a volume to set scalar values on an array in the volume. Adopted from https://docs.pyvista.org/examples/01-filter/clipping-with-surface.html """ import numpy as np import pyvista as pv from pyvista import _vtk as vtk ###############################...
nilq/baby-python
python
import logging from typing import Union from xml.dom.minidom import Element import requests from huaweisms.api.config import MODEM_HOST from huaweisms.xml.util import get_child_text, parse_xml_string, get_dictionary_from_children logger = logging.getLogger(__name__) class ApiCtx: def __init__(self, modem_hos...
nilq/baby-python
python
''' Created on 16.3.2012 @author: Antti Vainio ''' from leader import leader from follower import follower from vector import vector from thinker import unitType class simulation(): ''' This class handles the calculation of simulation. A single frame can be calculated and executed just by calling ca...
nilq/baby-python
python
s=str(input()) n1,n2=[int(e) for e in input().split()] j=0 for i in range(len(s)): if j<n1-1: print(s[j],end="") j+=1 elif j>=n1-1: j=n2 if j>=n1: print(s[j],end="") j-=1 elif j<=k: print(s[j],end="") j+=1 k=n2-1
nilq/baby-python
python