content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# -*- coding: utf-8 -*-
from flask import render_template, redirect, request, url_for, flash, jsonify, abort
from flask_login import login_user, logout_user, login_required, current_user
from . import estate
from .. import db
from ..models import SzEstate
import urllib
import os
import time
import math
from datetime i... | nilq/baby-python | python |
# Freetype library
freetype = StaticLibrary( 'freetype', sources = [ 'src/base/*', 'src/gzip/ftgzip.c', 'src/winfonts/winfnt.c', 'src/cid/type1cid.c' ], defines = [ 'FT2_BUILD_LIBRARY', 'FT_CONFIG_OPTION_SYSTEM_ZLIB' ] )
freetype.include( 'include' )
# Add Freetype modules sources
prefix = { 'gzip': 'ft', 'cid': ... | nilq/baby-python | python |
"""
Created on Wednesday Septebmer 25 17:07 2019
tools to work with XRF data from the Geotek MSCL (Olympus head)
@author: SeanPaul La Selle
"""
import os
import sys
import glob
import tkinter
from tkinter import filedialog
import numpy as np
import csv
import pandas
import matplotlib as matplotlib
import matplotlib.... | nilq/baby-python | python |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'fútū'
CN=u'扶突'
NAME=u'futu41'
CHANNEL='largeintestine'
CHANNEL_FULLNAME='LargeIntestineChannelofHand-Yangming'
SEQ='LI18'
if __name__ == '__main__':
pass
| nilq/baby-python | python |
class Bar():
pass
| nilq/baby-python | python |
import os
import core.settings as st
from flask import Flask
from api.login import app as login_router
from api.create_account import app as account_router
from api.products import app as products_router
from api.producer import app as producer_router
from api.shop_car import app as shop_car_router
from api.order impor... | nilq/baby-python | python |
# Copyright (c) 2017 Presslabs SRL
#
# 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 writ... | nilq/baby-python | python |
from .logic import *
from .notifications import *
from .preprocessors import *
from .vigil import *
| nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2021.03.22
Start operation.
@author: zoharslong
""" | nilq/baby-python | python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import sys
import os
import time as t
import numpy as np
import theano as th
import theano.tensor as T
import theano.ifelse
import theano.compile
import theano.compile.mode
import hand_io
############## Objective in theano ##################
... | nilq/baby-python | python |
# Copyright 2018 Cisco and its affiliates
#
# 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... | nilq/baby-python | python |
import logging,uuid
from exchangemanager import ExchangeManager
from result import Result
from order import Order
class BacktestManager(ExchangeManager):
def __init__(self, config = {} ):
ExchangeManager.__init__(self, "BTEST", config )
self.balance = None
self.log = logging.getLogger('cry... | nilq/baby-python | python |
# Import libraries
import matplotlib.pyplot as plt
import numpy as np
# Draw
plt.title("Lines") # put title on plot
plt.plot([-4,2], [-2,-2], "b") # Plot the lines to draw a house
plt.plot([-4,-1], [2,3], "b")
plt.plot([-1,1], [3,5], "b")
plt.plot([2,4], [-2,0], "b")
plt.plot([1,4], [5,4], "b")
plt.plot([1,-2], [5,4... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser;
from xml.dom import minidom;
import re
import os
import csv
import hashlib
import shutil
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from HorizonBuildFileUtil import HorizonBuildFileUtil
import subprocess
class HorizonUE4Buil... | nilq/baby-python | python |
"""Flategy - a basic playable strategy game & bot."""
import os
import io
import subprocess
import tempfile
import cairo
import IPython.display
import numpy as np
class State:
__slots__ = ['position', 'radius', 'world_shape']
def __init__(self, position, radius, world_shape):
self.position = positi... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from transformers import BertModel, RobertaModel
class EmbeddingGeneratorGLOVE(nn.Module):
def __init__(self, config, path):
super(EmbeddingGeneratorGLOVE, self).__init__()
self.config = config
print('Loa... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import time as builtin_time
import pandas as pd
import numpy as np
# ==============================================================================
# ==============================================================================
# ===============================================================... | nilq/baby-python | python |
import workalendar.africa
import workalendar.america
import workalendar.asia
import workalendar.europe
import workalendar.oceania
import workalendar.usa
from pywatts.core.exceptions.util_exception import UtilException
def _init_calendar(continent: str, country: str):
""" Check if continent and country are corre... | nilq/baby-python | python |
from django.shortcuts import render
from morad.models import Car
from django.views.generic import (ListView,DetailView,DeleteView,UpdateView,CreateView)
from django.urls.base import reverse_lazy
class ListCars(ListView):
template_name = 'cars/cars.html'
model = Car
class DetailCar(DetailView):
template_nam... | nilq/baby-python | python |
"""
Tests for string_utils.py
"""
import pytest
from django.test import TestCase
from common.djangoapps.util.string_utils import str_to_bool
class StringUtilsTest(TestCase):
"""
Tests for str_to_bool.
"""
def test_str_to_bool_true(self):
assert str_to_bool('True')
assert str_to_bool(... | nilq/baby-python | python |
import sys
from datetime import timedelta
def print_expected_call_message(additional_message):
print(f"""{additional_message}
Expected application call:
python3 regex_text.py [searched phrase] [left_padding] [right_padding]
Example call:
python3 regex_text.py "I don't know" 2 3""")
def handle_arguments():
i... | nilq/baby-python | python |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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 |
from import_export import resources
from electricity.models import FeedBack
class FeedBackResource(resources.ModelResource):
class Meta:
model = FeedBack
| nilq/baby-python | python |
from nose import with_setup
from pybbn.causality.ace import Ace
from pybbn.graph.dag import Bbn
from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.node import BbnNode
from pybbn.graph.variable import Variable
def setup():
"""
Setup.
:return: None.
"""
pass
def teardown():
"""
... | nilq/baby-python | python |
__author__ = 'elsabakiu, neilthemathguy, dmorina'
from rest_framework import status, viewsets
from rest_framework.response import Response
from crowdsourcing.serializers.project import *
from rest_framework.decorators import detail_route, list_route
from crowdsourcing.models import Module, Category, Project, Requeste... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from layers import ImplicitGraph
from torch.nn import Parameter
from utils import get_spectral_rad, SparseDropout
import torch.sparse as sparse
class IGNN(nn.Module):
def __init__(self, nfeat, nhid, nclass, num_node, dropout, kappa=0.9, adj_orig=N... | nilq/baby-python | python |
from PIL import Image
import argparse
import os
import sys
current_directory = os.getcwd()
def args_check(args = None):
if(args == None):
print("Arguments are reqiured for execution")
parser = argparse.ArgumentParser(description="Resizer - A lightweight Image size and resolution resizer")
parse... | nilq/baby-python | python |
a,b = 1,2
print a+b
| nilq/baby-python | python |
import shlex
import json
from .BaseClient import BaseClient
from .Response import JSONResponse
from . import typchk
DefaultTimeout = 10 # seconds
class ContainerClient(BaseClient):
class ContainerZerotierManager:
def __init__(self, client, container):
self._container = container
... | nilq/baby-python | python |
import tensorflow as tf
import keras
# print(tf.__version__, keras.__version__)
amv_model_path = "model/frmodel.h5"
export_path = "model/ArtMaterialVerification/2"
model = tf.keras.models.load_model(amv_model_path)
with tf.keras.backend.get_session() as sess:
tf.saved_model.simple_save(
sess,
ex... | nilq/baby-python | python |
import pandas as pd
import numpy as np
import scipy as sp
import random
from scipy.spatial.distance import mahalanobis
class TrainOutlier:
data = None
percentilek = None
valuecountsdict = None
colsum = None
median = None
invcovmx = None
cols = None
threshold = None
... | nilq/baby-python | python |
import os
from twisted.logger import FilteringLogObserver, LogLevelFilterPredicate, LogLevel, jsonFileLogObserver
from twisted.python import logfile
from twisted.python.log import FileLogObserver
log_dir = os.environ.get("LOG_DIR", '/var/log/')
log_level = os.environ.get("TWISTED_LOG_LEVEL", 'INFO').lower()
log_rotat... | nilq/baby-python | python |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import os
import pytest
from datadog_checks.redisdb import Redis
from . import common
pytestmark = pytest.mark.e2e
def assert_common_metrics(aggregator):
tags = ['redis_host:{}'.format(common.HOST), 'r... | nilq/baby-python | python |
import os
from oelint_adv.cls_rule import Rule
from oelint_parser.helper_files import expand_term
from oelint_parser.helper_files import get_layer_root
class RubygemsTestCase(Rule):
TESTCASE_DIR = "lib/oeqa/runtime/cases"
def __init__(self):
super().__init__(id="rubygems.testcase",
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Sonos Alarms."""
from __future__ import unicode_literals
import logging
from datetime import datetime
import re
import weakref
from .core import discover, PLAY_MODES
from .xml import XML
log = logging.getLogger(__name__) # pylint: disable=C0103
TIME_FORMAT = "%H:%M:%S"
def is_valid_rec... | nilq/baby-python | python |
"""The core event-based simulation engine"""
import heapq
from abc import abstractmethod
from dataclasses import dataclass, field
from enum import Enum, auto
from typing import Iterator, List, NamedTuple, Optional, Protocol, runtime_checkable
# from .event import EventError, EventLike, StopEngineError
__all__ = [
... | nilq/baby-python | python |
import pdb
import copy
import json
import numpy as np
from utils import game_util
import constants
class ActionUtil(object):
def __init__(self):
self.actions = [
{'action' : 'MoveAhead', 'moveMagnitude' : constants.AGENT_STEP_SIZE},
{'action' : 'RotateLeft'},
... | nilq/baby-python | python |
import requests
apikey = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYwODE4ODU1YTcxOGRmNGVkMTkwZjE1ZSIsImlhdCI6MTYxOTEwMTc4MSwiZXhwIjoxNjIxNjkzNzgxfQ.SlyayNaXu8PTPYAtyR9h7tIlR9ooXn72DRn6EAwcgV6rNY1rZQCoSs_d2EESIJs3kb0LwCSfU9o5lWMW9_Twigj3FxX99iAg7_gB1m6TReJ2moZ-rYIst6RTtJtWQWBezZ-37RyACH9s44WQ9qnlrXBYKgnW6LyVi18Kdf... | nilq/baby-python | python |
# coding: utf-8
from distutils.core import setup
__version__ = '0.2.3'
short_description = 'Statistics for Django projects'
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = short_description
install_requires = [
'Djang... | nilq/baby-python | python |
import os
sd = None
def set_sd(new_sd):
global sd
sd = new_sd
tmp_dir = "tmp/"
export_tmp = tmp_dir + "dashboard_export.csv"
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
| nilq/baby-python | python |
# Seasons
SEASONS = [
"PRESEASON 3",
"SEASON 3",
"PRESEASON 2014",
"SEASON 2014",
"PRESEASON 2015",
"SEASON 2015",
"PRESEASON 2016",
"SEASON 2016",
"PRESEASON 2017",
"SEASON 2017",
"PRESEASON 2018",
"SEASON 2018",
"PRESEASON 2019",
"SEASON 2019",
]
| nilq/baby-python | python |
import fire
from .utils import *
tfd=test_font_dir
if __name__ == '__main__':
fire.Fire() | nilq/baby-python | python |
print('='* 40)
print('{:^40}'.format('Listagem de Preços!!'))
print('='* 40)
listagem = ('Espeto de Carne', 8.00,
'Espeto de Frango', 5.00,
'Espeto de Linguiça', 5.50,
'Espeto de Kafta', 6.00,
'Espeto de Queijo', 6.50,
'Espeto de Medalhão Frango', 6.00,
... | nilq/baby-python | python |
from django.shortcuts import render
from django.http import HttpResponse
from random import randint
def big(): return randint(0, 1_000_000)
def index(request):
return HttpResponse("Hello, there! Welcome to the base of the project! Your big ugly number is " + str(big()))
| nilq/baby-python | python |
import os
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from settings import CLIENT_NAME, Client, LAUNCH_MODE, LaunchMode, URL, LocatorType
class LauncherNotSu... | nilq/baby-python | python |
import logging
import subprocess
import os
import platform
import sys
from cmd2 import utils
logger = logging.getLogger(__name__.split(".")[-1])
class Command:
"""
Provides a way to run bash commands on local or remote side
Remote execution of commands is done over SSH protocol for given username and ho... | nilq/baby-python | python |
# print ' name ' , multiple times
# for loop
for i in range(1,11):
i = 'Omkar'
print(i)
# while loop
i = 1
while (i<11) :
print('Omkar)
i = i + 1
| nilq/baby-python | python |
# see https://www.codewars.com/kata/614adaedbfd3cf00076d47de/train/python
def expansion(matrix, n):
for _ in range(n):
rows = [x + [sum(x)] for x in matrix]
extraRow = [sum([x[i] for x in rows]) for i in range(len(matrix))] + [sum([matrix[i][i] for i in range(len(matrix))])]
rows.append(extraRow)
mat... | nilq/baby-python | python |
"""
Multi-core and Distributed Sampling
===================================
The choice of the sampler determines in which way parallelization is performed.
See also the `explanation of the samplers <sampler.html>`_.
"""
from .singlecore import SingleCoreSampler
from .mapping import MappingSampler
from .multicore impo... | nilq/baby-python | python |
from game_state import GameState
import arcade as ac
import math
class DrawingManager:
@classmethod
def tick(cls):
if "entities" in GameState.current_state:
for ent in GameState.current_state["entities"]:
if "pos" in ent and "rot" in ent and "drawing" in ent:
... | nilq/baby-python | python |
#!/usr/bin/python3
#
# Copyright 2012 Sonya Huang
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | nilq/baby-python | python |
import os, sys
# add NADE to path
nade_path = os.path.join(os.path.abspath('.'), 'bench_models', 'nade')
sys.path.append('./bench_models/nade/')
| nilq/baby-python | python |
"""
Part of BME595 project
Program:
Show statistics of dataset
"""
from collections import Counter
from data import data_loader, _preprocess_dataset_small, _preprocess_dataset_large
def show_distribution(max_len=60, deduplicate=False):
small_sentences, small_polarities, purposes, _ = _preprocess_dataset_small(m... | nilq/baby-python | python |
import re
from behave import given, when, then
from django.core import mail
from {{ cookiecutter.project_slug }}.apps.myauth.tests.factories import VerifiedUserFactory
from {{ cookiecutter.project_slug }}.apps.profile.models import Profile
from features.hints import BehaveContext
@given("a registered user")
def ste... | nilq/baby-python | python |
from mle_monitor import MLEProtocol
meta_data = {
"purpose": "Test MLEProtocol",
"project_name": "MNIST",
"exec_resource": "local",
"experiment_dir": "log_dir",
"experiment_type": "hyperparameter-search",
"base_fname": "main.py",
"config_fname": "tests/fixtures/base_config.json",
"num_s... | nilq/baby-python | python |
"""
Module: 'sys' on esp32 1.9.4
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.9.4', version='v1.9.4 on 2018-05-11', machine='ESP32 module with ESP32')
# Stubber: 1.2.0
argv = None
byteorder = 'little'
def exit():
pass
implementation = None
maxsize = 2147483647
modules = None
path = None
platform = 'es... | nilq/baby-python | python |
import pickle
filename = './data/29_header_payload_all.traffic'
with open(filename, 'r') as f:
traffic = f.readlines()
with open('./data/29_payload_all.traffic','w') as f:
for i in range(len(traffic)):
s_traffic = traffic[i].split()
if s_traffic[10] == '11':
payload = s_traffic[0... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later version.
... | nilq/baby-python | python |
import falcon
from chromarestserver.resource import (
ChromaSdkResource,
SessionRootResource,
HeartBeatResource,
KeyboardResource
)
from chromarestserver.model import (
KeyboardModel,
SessionModel
)
app = falcon.API()
usb_keyboard = KeyboardModel()
session = SessionModel()
chromasdk = Chroma... | nilq/baby-python | python |
import os
import json
from typing import Optional
from requests import post,get
from fastapi import FastAPI
app = FastAPI()
ha_ip = os.environ['HA_IP']
ha_port = os.environ['HA_PORT']
ha_entity = os.environ['HA_ENTITY'] #must be a sensor
ha_token = os.environ['HA_TOKEN']
ha_friendly_name = os.environ['HA_FRIENDLY_N... | nilq/baby-python | python |
# ISC
#
# Copyright (c) 2022 Adir Vered <adir.vrd@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS... | nilq/baby-python | python |
from huobi.client.trade import TradeClient
from huobi.constant import *
from huobi.utils import *
trade_client = TradeClient(api_key=g_api_key, secret_key=g_secret_key)
symbol_test = "eosusdt"
i = 0
n = 3
order_id_list = []
while i < n:
order_id = trade_client.create_order(
symbol=symbol_test,
ac... | nilq/baby-python | python |
from Utils import *
'''
On Adamson data
'''
Data_dir = "/home/luodongyang/SCData/Perturb/Adamson/"
#------------------------------------------------------------------------#
# Read Data
## Matrix
mat=mmread(os.path.join(Data_dir, "GSM2406677_10X005_matrix.mtx.txt"))
cell_ident = pd.read_csv(os.path.join(Data_dir, "GSM2... | nilq/baby-python | python |
# debug_importer.py
import sys
class DebugFinder:
@classmethod
def find_spec(cls, name, path, target=None):
print(f"Importing {name!r}")
return None
sys.meta_path.insert(0, DebugFinder)
| nilq/baby-python | python |
import json
import os
import unittest
from netdice.common import Flow, StaticRoute
from netdice.explorer import Explorer
from netdice.input_parser import InputParser
from netdice.problem import Problem
from netdice.properties import WaypointProperty, IsolationProperty
from netdice.reference_explorer import ReferenceEx... | nilq/baby-python | python |
import os
from datetime import datetime
from flask import Flask, render_template, redirect, flash, abort, url_for, request
from flask.ext.restless import APIManager
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import UserM... | nilq/baby-python | python |
from setuptools import setup, find_packages
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='ciscoaplookup',
version="0.10.0",
author="Steffen Schumacher",
aut... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 28 11:07:41 2019
@author: Kevin
"""
import numpy as np
import pickle
from shapely.geometry import Point
class TileCreator(object):
def __init__(self, configuration, polygon):
self.output_path = configuration['tile_coords_path']
# A... | nilq/baby-python | python |
from setuptools import setup
setup(
name='YAFN',
version='0.0.1',
author='txlyre',
author_email='me@txlyre.website',
packages=['yafn', 'yafn-tracker'],
url='https://github.com/txlyre/yafn',
license='LICENSE',
description='Yet another p2p file network protocol.',
install_requires=[
'cbor2',
'p... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 14 14:47:38 2021
@author: cxue2
"""
import torch
from xfdlfw import Result
from xfdlfw.metric import ConfusionMatrix, Accuracy, MeanSquaredError, MeanAbsoluteError, CrossEntropy
acc = Accuracy('acc')
ce_ = CrossEntropy('ce_')
mse = MeanSquaredErro... | nilq/baby-python | python |
"""BleBox sensor entities."""
# pylint: disable=fixme
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.entity import Entity
from . import CommonEntity, async_add_blebox
async def async_setup_platform(hass, config... | nilq/baby-python | python |
from CHECLabPy.spectrum_fitters.gentile import sipm_gentile_spe, \
calculate_spectrum, SiPMGentileFitter, SpectrumParameter
import numpy as np
from numpy.testing import assert_allclose
from numba import typed
def test_sipm_gentile_spe():
x = np.linspace(-1, 20, 1000, dtype=np.float32)
y = sipm_gentile_spe... | nilq/baby-python | python |
# the url address of the REST API server
CDS_LB='https://rest-endpoint.example.com'
# location of client certificate and key
CDS_CERT='../certs/cds_cert.pem'
CDS_KEY='../certs/cds_key.pem'
# the endpoint url of REST server, multiple version can and will be available
CDS_API='/v2.0/DetectionRequests'
CDS_URL=CDS_LB+CDS... | nilq/baby-python | python |
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
import json
import pandas as pd
import numpy as np
import plotly
app = dash.Dash()
app.scripts.config.serve_locally=True
DF_WALMART = pd.read_csv('https:/... | nilq/baby-python | python |
from pathlib import Path
import pytest
RESOURCES_DIR = Path(__file__).parent / "resources"
@pytest.fixture
def users_path():
return RESOURCES_DIR / "test-users.json"
@pytest.fixture
def tweets_path():
return RESOURCES_DIR / "test-tweets.json"
| nilq/baby-python | python |
import pandas as pd
__all__ = ["calc_embedding_size"]
def calc_embedding_size(df: pd.DataFrame) -> int:
"""
Calculates the appropriate FastText vector size for categoricals in `df`.
https://developers.googleblog.com/2017/11/introducing-tensorflow-feature-columns.html
Parameters
------... | nilq/baby-python | python |
import mailparser
import re
from nltk.tokenize import word_tokenize
from nltk import pos_tag
# #### typo_parser
def typo_parser(x):
"""
1. replace irrelevant symbol "|" or "*"
2. remove extra space " "
3. replace extra \n "\n\n" into "\n"
4. replace "> *>" into ">>" for further analysis
@pa... | nilq/baby-python | python |
"""API package.
Contains controller and model definitions.
Modules:
models
routes
views
"""
| nilq/baby-python | python |
from transformers import AutoModelForSequenceClassification, Trainer, AutoTokenizer
from sklearn.metrics import accuracy_score, precision_recall_fscore_support
from datasets import load_from_disk
import tarfile
import os
if len(os.listdir('model')) == 0:
with tarfile.open('model.tar.gz') as tar:
tar.extrac... | nilq/baby-python | python |
"""
Visualize
=========
pypesto comes with various visualization routines. To use these,
import pypesto.visualize.
"""
from .reference_points import (ReferencePoint,
create_references)
from .clust_color import (assign_clusters,
assign_clustered_colors,
... | nilq/baby-python | python |
import boto3
import pytest
import uuid
acm = boto3.client('acm')
@pytest.fixture(scope="module")
def certificate():
name = 'test-%s.binx.io' % uuid.uuid4()
alt_name = 'test-%s.binx.io' % uuid.uuid4()
certificate = acm.request_certificate(DomainName=name, ValidationMethod='DNS', SubjectAlternativeNames=[a... | nilq/baby-python | python |
import numpy as np
from nlpaug.util import Method
from nlpaug import Augmenter
class SpectrogramAugmenter(Augmenter):
def __init__(self, action, name='Spectrogram_Aug', aug_min=1, aug_p=0.3, verbose=0):
super(SpectrogramAugmenter, self).__init__(
name=name, method=Method.SPECTROGRAM, action=a... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from flask import jsonify, request
from pronto import utils
from . import bp
@bp.route("/<path:accessions>/proteins/")
def get_proteins_alt(accessions):
accessions = set(utils.split_path(accessions))
try:
comment_id = int(request.args["comment"])
except KeyError:
... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 8 18:04:51 2021
@author: jm
"""
# required libraries
import pytest
import pandas as pd
import numpy as np
from task1.helpers import Helper
# sample rate values for different currencies
rates = {'USD': 1.067218}
# sample data frame
df = pd.DataFr... | nilq/baby-python | python |
from ctypes import cdll, c_int, c_size_t
my_lib = cdll.LoadLibrary('target/debug/librust_ffi.so')
int_array_size = c_size_t(256)
int_array = (c_int * int_array_size.value)()
my_lib.produce_us_some_numbers(int_array, int_array_size)
for i,n in enumerate(int_array):
print(str(n) + ' ', end='')
if (i + 1) % 16... | nilq/baby-python | python |
shapes = [
# Grosses L
[ (0, 0, 0), (1, 0, 0), (2, 0, 0), (0, -1, 0) ],
# T
[ (0, 0, 0), (1, 0, 0), (2, 0, 0), (1, -1, 0) ],
# Eck aka kleines L
[ (0, 0, 0), (1, 0, 0), (0, -1, 0) ],
# Treppe
[ (0, 0, 0), (1, 0, 0), (1, 1, 0), (2, 1, 0) ],
# Asymmetrische Ecken
[ (0, 0, 0), ... | nilq/baby-python | python |
import sys
import time
import datetime
lines = open(sys.argv[1], 'r')
for line in lines:
line = line.replace('\n', '').replace('\r', '')
if len(line) > 0:
a, b = sorted([datetime.datetime.strptime(x, "%H:%M:%S") for x in line.split(' ')])
hours, remainder = divmod((b - a).seconds, 3600... | nilq/baby-python | python |
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""The multi-process processing engine."""
import abc
import ctypes
import os
import signal
import sys
import threading
import time
from plaso.engine import engine
from plaso.engine import process_info
from plaso.lib import definitions
from plaso.multi_process import logger
from plaso.multi_pr... | nilq/baby-python | python |
#!/usr/local/bin/python2.7
##
# OOIPLACEHOLDER
#
# Copyright 2014 Raytheon Co.
##
from mi.core.versioning import version
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.driver.cg_stc_eng.stc.mopak_o_dcl_common_driver import MopakDriver
from mi.dataset.parser.mopak_o_dcl import \
Mopak... | nilq/baby-python | python |
# Aula 08 (Usando Módulos do Python)
from math import sin, cos, tan, radians # para seno, cosseno e tangente
# é preciso converter o ângulo para radians
angulo = float(input('Digite um Ângulo qualquer: '))
print('Ângulo: {:.2f}'
'\nSeno: {:.2f}'
'\nCosseno: {:.2f... | nilq/baby-python | python |
from consola import leer_caracter
from consola import leer_entrada_completa
from consola import obtener_caracter
from consola import avanzar_caracter
from consola import hay_mas_caracteres
from consola import imprimir
from consola import cambiar_color_texto
min_C3_BAscula = None
may_C3_BAscula = None
def Buscar_vocal... | nilq/baby-python | python |
import os
ls=["python main.py --configs configs/train_ricord1a_unetplusplus_timm-regnetx_002_fold0_noda.yml",
"python main.py --configs configs/train_ricord1a_unetplusplus_timm-regnetx_002_fold1_noda.yml",
"python main.py --configs configs/train_ricord1a_unetplusplus_timm-regnetx_002_fold2_noda.yml",
"python main.py -... | nilq/baby-python | python |
nCr = [[0 for j in range(101)] for i in range(101)]
for i in range(101):
for j in range(i+1):
if i==j or j==0:
nCr[i][j] = 1
else:
nCr[i][j] = nCr[i-1][j-1] + nCr[i-1][j]
while True:
n,r = list(map(int,input().split()))
if n==0 and r==0:
break
print(str(n... | nilq/baby-python | python |
print("hola")
kjnkjk | nilq/baby-python | python |
from setuptools import setup, find_packages
setup(
name="django-allmedia",
url="http://github.com/suselrd/django-allmedia/",
author="Susel Ruiz Duran",
author_email="suselrd@gmail.com",
version="1.0.20",
packages=find_packages(),
include_package_data=True,
zip_safe=False,
descriptio... | nilq/baby-python | python |
"""
cloudalbum/app.py
~~~~~~~~~~~~~~~~~~~~~~~
AWS Chalice main application module
:description: CloudAlbum is a fully featured sample application for 'Moving to AWS serverless' training course
:copyright: © 2019 written by Dayoungle Jun, Sungshik Jou.
:license: MIT, see LICENSE for more details... | nilq/baby-python | python |
# noqa: E501 ported from https://discuss.pytorch.org/t/utility-function-for-calculating-the-shape-of-a-conv-output/11173/7
import math
def num2tuple(num):
return num if isinstance(num, tuple) else (num, num)
def conv2d_output_shape(h_w, kernel_size=1, stride=1, pad=0, dilation=1):
h_w, kernel_size, stride, ... | nilq/baby-python | python |
resposta = 42
print('A resposta para tudo é: ', resposta)
| nilq/baby-python | python |
# -*- coding: utf8 -*-
#
# Copyright (c) 2016 Linux Documentation Project
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import unittest
import argparse
from argparse import Namespace
from tldptesttools import TestToolsFilesystem
from tldptesttools import CCT... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.