content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
# -*- coding: utf-8 -*- from pydantic.datetime_parse import parse_datetime from .. import fhirtypes # noqa: F401 from .. import communication def test_Communication_1(base_settings): filename = ( base_settings["unittest_data_dir"] / "communication-example.canonical.json" ) inst = communication.C...
nilq/baby-python
python
import argparse import os from util import util import torch import models import numpy as np class BaseOptions(): """This class defines options used during both training and test time. It also implements several helper functions such as parsing, printing, and saving the options. It also gath...
nilq/baby-python
python
def qsort(arr): if len(arr) <= 1: return arr pivot = arr.pop() greater, lesser = [], [] for item in arr: if item > pivot: greater.append(item) else: lesser.append(item) return qsort(lesser) + [pivot] + qsort(greater)
nilq/baby-python
python
from .MyMplCanvas import * from .MyMplCanvas import MyMplCanvas from .DataCanvas import * from .FitCanvas import * from .KineticsCanvas import * from .SpectrumCanvas import *
nilq/baby-python
python
import pytest import pathlib from align.cell_fabric import Canvas, Pdk, Wire, Via mydir = pathlib.Path(__file__).resolve().parent pdkfile = mydir.parent.parent / 'pdks' / 'FinFET14nm_Mock_PDK' / 'layers.json' @pytest.fixture def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen( Wire( nm='m1', laye...
nilq/baby-python
python
from babelsubs.generators.base import register, BaseGenerator class DFXPGenerator(BaseGenerator): """ Since the internal storage is already in dfxp, the generator is just a small shim to keep the public interface between all generators regular. """ file_type = ['dfxp', 'xml' ] def __init_...
nilq/baby-python
python
from ..iorw import GCSHandler class MockGCSFileSystem(object): def __init__(self): self._file = MockGCSFile() def open(self, *args, **kwargs): return self._file def ls(self, *args, **kwargs): return [] class MockGCSFile(object): def __enter__(self): self._value = 'd...
nilq/baby-python
python
import boto3 exceptions = boto3.client('sdb').exceptions AttributeDoesNotExist = exceptions.AttributeDoesNotExist DuplicateItemName = exceptions.DuplicateItemName InvalidNextToken = exceptions.InvalidNextToken InvalidNumberPredicates = exceptions.InvalidNumberPredicates InvalidNumberValueTests = exceptions.InvalidNum...
nilq/baby-python
python
import re from basic import * from amino_acids import amino_acids from tcr_distances_blosum import blosum from paths import path_to_db from translation import get_translation gap_character = '.' verbose = False #verbose = ( __name__ == '__main__' ) ## look at imgt cdrs ## http://www.imgt.org/IMGTScientificChart/Nome...
nilq/baby-python
python
token = 'NDY2ODc4MzY3MTg3MDc1MDcz.DiqkoA.JVgJqYhnL6yyCnKeAnCHx5OvR3E' #Put Your bots token here prefix = '*' #put prefix here link = 'https://discordapp.com/api/oauth2/authorize?client_id=466878367187075073&permissions=0&scope=bot' #put bot invite link here ownerid = '329526048553172992' #put your id here
nilq/baby-python
python
import numpy as np import torch from torch.utils import data from kaldi_io import read_mat import h5py # PyTorch Dataset class SpoofDatsetEval(data.Dataset): ''' Evaluation, no label ''' def __init__(self, scp_file): with open(scp_file) as f: temp = f.readlines() content = [x....
nilq/baby-python
python
# lets create a class to hold our category data class Category: def __init__(self, name): self.name = name def __str__(self): return f"No Products in {self.name}" #How can you represent this class data as a string? My guess is __str__
nilq/baby-python
python
import ConfigParser import os from StringIO import StringIO homedir = os.getenv('APPDATA' if os.name.lower() == 'nt' else 'HOME', None) default_cfg = StringIO(""" [visual] background = black foreground = white height = 800 width = 800 cortex = classic default_view = lateral [overlay] min_thresh = 2.0 max_thresh = rob...
nilq/baby-python
python
import matplotlib.pyplot as plt import numpy as np def plot_bar_from_counter(counter, ax=None): """" This function creates a bar plot from a counter. :param counter: This is a counter object, a dictionary with the item as the key and the frequency as the value :param ax: an axis of matplotlib ...
nilq/baby-python
python
from django import forms class LoginCustomerForm(forms.Form): email_address = forms.CharField(label='Email address', max_length=100) password = forms.CharField(label='Password', max_length=100, widget=forms.PasswordInput) class RegisterCustomerForm(forms.Form): first_name = forms.CharField(label='First na...
nilq/baby-python
python
import datetime import textwrap import uuid from app_ccf.models import Application, StatusUpdate from app_ccf.models import VoucherCode, VoucherCodeBatch, VoucherCodeCheckStatus from shared.test_utils import DEFAULT_CCF_APP_FIELDS from . import base_test from . import utils class ApplicationTests(base_test.CcfBase...
nilq/baby-python
python
# coding: utf-8 from binance_api.servicebase import ServiceBase import json from binance.client import Client from binance.exceptions import BinanceAPIException class Order(ServiceBase): def _get_filter(self, symbol, filter_name): if symbol is None: return None exinfo = self.binance.exchange_info ...
nilq/baby-python
python
# Copyright 2019 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
nilq/baby-python
python
# -*- coding: utf-8 -*- import logging from datetime import datetime, timedelta from dateutil import tz from django.conf import settings from django.contrib.auth.models import Group from django.contrib.auth import authenticate from django.db.models import Q, Prefetch, Sum from django.utils.translation import ugettext_l...
nilq/baby-python
python
# Copyright (c) 2010 ActiveState Software Inc. All rights reserved. """Textual UI: progress bar and colprint""" import os import sys from datetime import datetime, timedelta from contextlib import contextmanager import logging import math import six LOG = logging.getLogger(__name__) __all__ = ['colprint', 'find_co...
nilq/baby-python
python
import tensorflow as tf import numpy as np def reset_graph(seed=42): tf.reset_default_graph() tf.set_random_seed(seed) np.random.seed(seed) def neuron_layer(X, n_neurons, name, activation=None): with tf.name_scope(name): n_inputs = int(X.get_shape()[1]) stddev = 2/ np.sqrt(n_inputs) ...
nilq/baby-python
python
import datetime import typing import uuid from commercetools import types from commercetools._schemas._api_client import ( ApiClientDraftSchema, ApiClientPagedQueryResponseSchema, ApiClientSchema, ) from commercetools.testing.abstract import BaseModel, ServiceBackend class ApiClientsModel(BaseModel): ...
nilq/baby-python
python
import os import pandas as pd def test_wildcard_filter(): from pachypy.utils import wildcard_filter, wildcard_match x = ['a', 'ab', 'b'] assert wildcard_match('', None) is True assert wildcard_match('', '*') is True assert wildcard_match('', '?') is False assert wildcard_match('a', '*') is Tr...
nilq/baby-python
python
import pytest def test_rnaseq_expression_init(): from genomic_data_service.rnaseq.domain.expression import Expression data = [ 'POMC', 'ENST000, ENST001', 0.03, 90.1, ] expression = Expression( *data ) assert isinstance(expression, Expression) assert...
nilq/baby-python
python
import sys, os import pandas as pd import numpy as np file_path = os.path.dirname(os.path.realpath(__file__)) ps_calcs_lib_path = os.path.abspath(os.path.join(file_path, "../../", "lib/ps_calcs")) sys.path.insert(0, ps_calcs_lib_path) import ps_calcs def rdo(ybi, yi, year, depths): rca_dist_opp = [] for ...
nilq/baby-python
python
# # Pyserini: Reproducible IR research with sparse and dense representations # # 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...
nilq/baby-python
python
import string class caesar(): def caesar_cipher(user_message, user_shift): alphabet = string.ascii_lowercase shifted_alphabet = alphabet[user_shift:] + alphabet[:user_shift] table = str.maketrans(alphabet, shifted_alphabet) return user_message.translate(table)
nilq/baby-python
python
from celery import Celery import consumer app_name = 'consumer' # take the celery app name app = Celery(app_name, broker=consumer.redis_url) # produce for i in range(100): a = 1 b = 2 consumer.consume.delay(a, b)
nilq/baby-python
python
import numpy as np from PIL import Image from matplotlib import pyplot as plt from matplotlib import image as mpimg from scipy import signal from scipy import fftpack import scipy.io class PSNR_calculator: def __init__(self,original_image,fixed_image): self.orig = original_image[:,:,0] self.fixed =...
nilq/baby-python
python
""" For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ Needs some environment strings in the live server. LIVE -- To know its in the live serv...
nilq/baby-python
python
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import cross_section_analysis.utils as cs_utils class WaterReferenceLinesOnRaster(): """ Processing of cross-section profiles to find water reference lines on the topography raster within user-specified topography intervals: ...
nilq/baby-python
python
#1.只负责写视图 import os import datetime from flask import render_template from main import app from models import Curriculum#导入这个表 from flask import redirect#跳转 即Django中的重定向功能 import functools from flask import session from models import * class Calendar: """ 当前类实现日历功能 1、返回列表嵌套列表的日历 2、安装日历格式打印日历 # 如果一...
nilq/baby-python
python
from kaplot import * import pymedia.audio.acodec as acodec import pymedia.muxer as muxer import sys import wave if False: file = open(sys.argv[1], 'rb') rawdata = file.read() wfile = wave.open('test.wav', 'wb') print muxer.extensions demuxer = muxer.Demuxer('mp3') frames = demuxer.parse(rawdata) decoder = ac...
nilq/baby-python
python
import numpy as np import pandas as pd import json from itertools import groupby from collections import namedtuple # NodeEdgeIncidence = namedtuple('NodeEdgeIncidence', ['nid', 'role', 'eid','meta']) class NodeEdgeIncidence(object): __slots__ = ("nid", "role", "eid", "meta") def __init__(self, nid, role,...
nilq/baby-python
python
from copy import deepcopy import csv from enum import Enum import inspect from os.path import join as joinpath from pprint import pprint from sys import version_info from typing import Any, Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, TypeVar, Union import dictdiffer from pandas import DataFrame import string...
nilq/baby-python
python
from typing import NamedTuple class User(NamedTuple): name: str age: int = 27 user1 = User('Jan') print(user1) print(dir(user1)) # user1.age = 30 # print(user1)
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """Sample Discourse Relation Classifier Train Train parser for suplementary evaluation Train should take three arguments $inputDataset = the folder of the dataset to parse. The folder structure is the same as in the tar file $inputDataset/parses.json $inputDataset...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Demonstrate a simple data-slicing task: given 3D data (displayed at top), select a 2D plane and interpolate data along that plane to generate a slice image (displayed at bottom). """ ## Add path to library (just for examples; you do not need this) import initExample import...
nilq/baby-python
python
from itertools import combinations from operator import mul f = open("input.txt") d = f.readlines() total = 0 for p in d: sides = [int(n) for n in p.split("x")] combos = list(combinations(sides, 2)) areas = [ mul(*a) for a in combos] areas.sort() total += areas[0] total += sum([2*a for a in are...
nilq/baby-python
python
# Copyright 2016 Cisco Systems, 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 wr...
nilq/baby-python
python
import numpy as np a = np.array([0, 0.5, 1.0, 1.5, 2.0]) type(a) a[:2] # Slicing works as for lists # Built in methods a.sum() a.std() a.cumsum() a.max() a.argmax() # Careful with np.max! np.max(2, 0) np.max(-2, 0) # silent fail :) second argument is the axis np.max(0, 2) # fail np.maximum(-2, 0) # Vectorized ope...
nilq/baby-python
python
import os import sys import logging import configparser import logging import numpy as np configfile_name ="NAAL_config" logger = logging.getLogger(__name__) if sys.platform.startswith('win'): config_dir = os.path.expanduser(os.path.join("~", ".NAAL_FPGA")) else: config_dir ...
nilq/baby-python
python
import socket import os from dotenv import load_dotenv import redis from flask import Flask, Blueprint, url_for from flask_caching import Cache from flask_login import login_required, LoginManager from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy import dash import dash_bootstrap_components as d...
nilq/baby-python
python
# coding=utf-8 __author__ = "Dimitrios Karkalousos" from abc import ABC import torch from omegaconf import DictConfig, OmegaConf from pytorch_lightning import Trainer from torch.nn import L1Loss from mridc.collections.common.losses.ssim import SSIMLoss from mridc.collections.common.parts.fft import ifft2c from mridc...
nilq/baby-python
python
"""empty message Revision ID: 073b3a3e8e58 Revises: 60c735df8d2f Create Date: 2019-09-06 08:45:01.107447 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '073b3a3e8e58' down_revision = '60c735df8d2f' branch_labels = None depends_on = None def upgrade(): # ...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess import select import time import json import requests import yaml import sys import os __PRODUCT_ID = "logslack 1.0 (c) 4k1/logslack" def get_value(r, key, default=None): if key in r: if type(r[key]) is int: return int(r[key]) ...
nilq/baby-python
python
# Generated by Django 2.2.9 on 2020-02-02 18:32 from django.db import migrations class Migration(migrations.Migration): dependencies = [("core", "0027_auto_20200202_1822")] operations = [ migrations.RemoveField(model_name="office", name="req_nominations"), migrations.RemoveField(model_name=...
nilq/baby-python
python
import ctypes import os import math from typing import Dict, List, cast from abc import ABC, abstractclassmethod import sdl2 from helpers import sdl, draw_texture, texture_from_bmp import config import entities class Component(ABC): """Interface that each component must adhere to. Strictly speaking, components ...
nilq/baby-python
python
import os import re import time import random import hashlib from multiprocessing import cpu_count from tandems import _tandems try: from urllib.parse import unquote except ImportError: from urlparse import unquote UNK_ID = 0 SQL_RESERVED_WORDS = [] with open("./SQL_reserved_words.txt", "rb") as f: for l...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 from typing import List from typing import Optional from typing import Union import numpy as np import pandas as pd from dataclasses import dataclass from sklearn import metrics from evidently import ColumnMapping from evidently.analyzers.base_analyzer import Analyzer from eviden...
nilq/baby-python
python
from django.shortcuts import render, redirect from django.contrib import messages from .forms import EveTimerForm from .models import EveTimer, EveTimerType from datetime import datetime, timedelta from django.utils import timezone from django.contrib.auth.decorators import login_required, permission_required @login_...
nilq/baby-python
python
#!/usr/bin/env python """ # ============================================================================== # Author: Carlos A. Ruiz Perez # Email: cruizperez3@gatech.edu # Intitution: Georgia Institute of Technology # Version: 1.0.0 # Date: Nov 13, 2020 # Description: Builds the search dat...
nilq/baby-python
python
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False, help_text='Optional.') last_name = forms.CharField(max_length=30, required=False, help_tex...
nilq/baby-python
python
from odc.geo.data import country_geom, data_path, gbox_css, ocean_geojson, ocean_geom def test_ocean_gjson(): g1 = ocean_geojson() g2 = ocean_geojson() assert g1 is g2 assert len(g1["features"]) == 2 def test_ocean_geom(): g = ocean_geom() assert g.crs == "epsg:4326" g = ocean_geom("ep...
nilq/baby-python
python
import os from hashkernel.bakery import CakeRole from hashstore.bakery.lite import dal from hashstore.bakery.lite.node import ( ServerConfigBase, GlueBase, CakeShardBase, User, UserType, UserState, Permission, Portal, ServerKey, PermissionType as PT) from hashstore.bakery.lite.node.blobs import BlobStore from...
nilq/baby-python
python
# -*- coding: utf-8 -*- import os, sys import time import pathlib import glob import cv2 import configparser import copy from datetime import datetime, timedelta from matplotlib.lines import Line2D import matplotlib.patches as patches import matplotlib.pyplot as plt import numpy as np #from matplotlib.ba...
nilq/baby-python
python
#!/usr/bin/python3 import asyncio import random import traceback import aiomas import hashlib import logging import errno from helpers.validator import * from helpers.chordInterval import * from helpers.storage import Storage from helpers.replica import Replica from helpers.messageDefinitions import * from jsonschema ...
nilq/baby-python
python
from Metodos import pontofixo from prettytable import PrettyTable from mpmath import * import random import matplotlib.pyplot as plt valerror1 = [] valerror2 = [] valerror3 = [] valerrors = [valerror1,valerror2,valerror3] i = 20 val = 2 def f(x): return (x-1)*exp(x-2)**2 - 1 def g1(x): retu...
nilq/baby-python
python
import logging from typing import Callable, Sequence, Set from . import formats logger = logging.getLogger(__name__) # type aliases FormatterType = Callable[[bool], formats.IFormatter] def negotiate(accepts_headers: Sequence[str]) -> FormatterType: """Negotiate a response format by scanning through a list of A...
nilq/baby-python
python
import redis redis_db = redis.StrictRedis(host="redis", port=6379, db=0) print(redis_db.keys()) redis_db.set('CT', 'Connecticut') redis_db.set('OH', 'Ohio') print(redis_db.keys()) ctstr = redis_db.get("CT").decode("utf-8") print(ctstr) print( "Good bye!" )
nilq/baby-python
python
from django.test import TestCase from .models import Category # Create your tests here. # category models test class CategoryTestCase(TestCase): def setUp(self): """ Create a category for testing """ Category.objects.create(name="Test Category") def test_category_name(self): ...
nilq/baby-python
python
from logging import ERROR, error from os import terminal_size import socket import threading import json HEADER = 1024*4 PORT = 5544 # SERVER = "192.168.1.104" SERVER = "localhost" # socket.gethostbyname(socket.gethostname()) ADDR = (SERVER, PORT) FORMAT = 'utf-8' DISCONNECT_MESSAGE = "!DISCONNECT" server = socket.s...
nilq/baby-python
python
# Um assassinato aconteceu, e o programa fará 5 perguntas para o usuário. # Se 2 respostas forem positivas, o usuário é considerado: "SUSPEITO" # Se responder entre 3 e 4 respostas positivas: "CÚMPLICE" # 5 respostas positivas, o usuário é considerado como: "ASSASSINO" # Caso o usuário tenha no máximo 1 resposta positi...
nilq/baby-python
python
from checkpoint.types import ModelVersionStage ANONYMOUS_USERNAME = "Anonymous" CHECKPOINT_REDIRECT_PREFIX = "checkpoint_redirect" CHECKPOINT_REDIRECT_SEPARATOR = ":" NO_VERSION_SENTINAL = "no_version" STAGES_WITH_CHAMPIONS = { ModelVersionStage.STAGING, ModelVersionStage.PRODUCTION, } INJECT_SCRIPT_TEMPL...
nilq/baby-python
python
import numpy as np import torch import torchvision.transforms as transforms transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]) ]) def convert_image_to_tensor(image): """convert an image to pytorch tensor Parameters: ---------- ...
nilq/baby-python
python
import argparse from clusterize import k_means def main(): args = parse_args() dataset = read_dataset(args.dataset) k_means(args.k, dataset, args.i) def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("-dataset", default="normal", choices=["normal", "unbalance"],...
nilq/baby-python
python
# -*- coding: utf-8 -*- """stem package. Word lemmatization and stemming. API: * PorterStemmer (class): Uses porter algorithm to find word stems. * porter_stem (function): For instant stemming a word using porter algorithm. * RegexStemmer (class): Uses regex pattern to find word stems. * regex_stem (function): For i...
nilq/baby-python
python
import wave import pyaudio import webrtcvad class AudioRecorder(object): def __init__(self): self.pyaudio = pyaudio.PyAudio() self.format = self.pyaudio.get_format_from_width(width=2) self.channels = 1 self.rate = 16000 self.chunk = 160 self.max_frame_count = 500 ...
nilq/baby-python
python
# # 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 # distributed under ...
nilq/baby-python
python
from typing import Any from typing import Callable from typing import List from typing import Optional from typing import Union import pytest import tornado from graphql import parse from opencensus.trace import execution_context from opencensus.trace import tracer as tracer_module from opencensus.trace.base_exporter ...
nilq/baby-python
python
import os from distutils.util import strtobool from os.path import join import dj_database_url from configurations import Configuration from corsheaders.defaults import default_headers BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class Common(Configuration): INSTALLED_APPS = ( ...
nilq/baby-python
python
import numpy as np from matplotlib import pyplot as plt from os import listdir def exp_moving_average(vec, a): """ Calculates EMA from given vector and alpha parameter. :param vec: input vector :param a: alpha parameter :return: calculated average """ # Create elements multipliers vector. ...
nilq/baby-python
python
from random import randint class King: def __init__(self, start, size): self.start = start self.size = size self.hole = (randint(0, size-1), randint(0, size-1)) def check(self, a, b): return a >= 0 and b >= 0 and a <= self.size - 1 and b <= self.size - 1 def near(self, wher...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Requires Python 3.8 or later """ __author__ = "Jorge Morfinez Mojica (jorge.morfinez.m@gmail.com)" __copyright__ = "Copyright 2021" __license__ = "" __history__ = """ """ __version__ = "1.21.H28.1 ($Rev: 1 $)" import re import time import threading from flask import Blueprint, json, reque...
nilq/baby-python
python
from rubicon_ml.client import Base class Parameter(Base): """A client parameter. A `parameter` is an input to an `experiment` (model run) that depends on the type of model being used. It affects the model's predictions. For example, if you were using a random forest classifier, 'n_estimators...
nilq/baby-python
python
# Mirror data from source MSN's to destination MSN on same Mark6 unit # Jan 29, 2017 Lindy Blackburn import argparse import subprocess import stat import os parser = argparse.ArgumentParser(description="mount drives and create commands to copy data from source MSN(s) to destination MSN.") parser.add_argument('source'...
nilq/baby-python
python
# Generated by Django 2.2.10 on 2020-04-26 14:55 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('pacientes', '0013_consulta_turno'), ] operations = [ migrations.CreateModel( ...
nilq/baby-python
python
"""Option handling polyfill for Flake8 2.x and 3.x.""" import optparse import os def register(parser, *args, **kwargs): r"""Register an option for the Option Parser provided by Flake8. :param parser: The option parser being used by Flake8 to handle command-line options. :param \*args: Pos...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on 2018/8/1 @author: xing yan """ from random import shuffle, sample, randint, choice administrative_div_code = ['110101', '110102', '110105', '110106', '110107', '110108', '110109', '110111', '110112', '110113', '110114', '110115', '110116', '110117', '110118', '110119'] surname ...
nilq/baby-python
python
#! /usr/bin/env python #S.rodney # 2011.05.04 """ Extrapolate the Hsiao SED down to 300 angstroms to allow the W filter to reach out to z=2.5 smoothly in the k-correction tables """ import os from numpy import * from pylab import * sndataroot = os.environ['SNDATA_ROOT'] MINWAVE = 300 # min wavelength for extrap...
nilq/baby-python
python
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
nilq/baby-python
python
# === Start Python 2/3 compatibility from __future__ import absolute_import, division, print_function, unicode_literals from future.builtins import * # noqa pylint: disable=W0401, W0614 from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614 # == End Python 2/3 compatibility import mmap import os...
nilq/baby-python
python
__version__ = "1.5.0" default_app_config = "oauth2_provider.apps.DOTConfig"
nilq/baby-python
python
import os, requests, json, redis from flask import Flask from openarticlegauge import config, licenses from flask.ext.login import LoginManager, current_user login_manager = LoginManager() def create_app(): app = Flask(__name__) configure_app(app) if app.config['INITIALISE_INDEX']: initialise_index(app) ...
nilq/baby-python
python
#!/usr/bin/env python3 import logging import sys import tempfile import threading import time import unittest import warnings from os.path import dirname, realpath sys.path.append(dirname(dirname(dirname(realpath(__file__))))) from logger.utils import formats # noqa: E402 from logger.readers.text_file_reader import ...
nilq/baby-python
python
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from flask import session from indico.core.db import db def ge...
nilq/baby-python
python
import math import time import copy import random import numpy as np import eugene as eu import pdb #Parent Sensor class VABSensor( object ): def __init__(self, dynamic_range): self._init_value = None self._range = dynamic_range def get_range(self): return self._range ################...
nilq/baby-python
python
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """Numbering formats for converted XML lists. :author: Shay Hill :created: 6/26/2019 I don't want to add non-ascii text to a potentially ascii-only file, so all bullets are '--' and Roman numerals stop at 3999. Doesn't capture formatting like 1.1.1 or b) or (ii). Only t...
nilq/baby-python
python
import info class subinfo(info.infoclass): def setTargets(self): self.versionInfo.setDefaultValues(gitUrl = "https://invent.kde.org/utilities/ktrip.git") self.description = "Public transport assistant" def setDependencies(self): self.buildDependencies["virtual/base"] = None se...
nilq/baby-python
python
def Predict(X_user) : # Libs import pandas as pd import numpy as np from sklearn.preprocessing import OneHotEncoder from sklearn.compose import ColumnTransformer from catboost import CatBoostClassifier X_user = np.array(X_user).reshape(1,-1) print(X_user) # Reading the dat...
nilq/baby-python
python
#!/usr/bin/env python3 def test_prime(test_value): if test_value == 2: return 1 for x in range(2, test_value): if test_value % x == 0: return 0 return 1 def main(): test_value = 179424673 if test_prime(test_value): print(test_value, "is prime.") else: ...
nilq/baby-python
python
from .color import * from .display import * from .patterns import *
nilq/baby-python
python
from api import views from django.contrib import admin from django.urls import include, path from rest_framework.routers import DefaultRouter from rest_framework.schemas import get_schema_view from rest_framework.documentation import include_docs_urls router = DefaultRouter() router.register(r'match', views.MatchView...
nilq/baby-python
python
# Generated by Django 2.1.5 on 2019-01-19 20:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('access', '0015_auto_20170416_2044'), ] operations = [ migrations.AddField( model_name='smtpserver', name='password_f...
nilq/baby-python
python
from earthnet_models_pytorch.setting.en21_data import EarthNet2021DataModule from earthnet_models_pytorch.setting.en22_data import EarthNet2022DataModule from earthnet_models_pytorch.setting.en21x_data import EarthNet2021XDataModule,EarthNet2021XpxDataModule from earthnet_models_pytorch.setting.en21_std_metric import...
nilq/baby-python
python
#!/usr/bin/env python3 """ This example shows how to generate basic plots and manipulate them with FEA In this case, we'll generate a 4D model and ruse FEA to find all possible 2D and 3D reduced models. We'll then solve for the solution spaces by breaking up each solution and finding the maximum and minimum values in...
nilq/baby-python
python
#!/usr/bin/env python3 # Intro & methodology: # # 自从几个月前大号被百度永封了就没怎么来hhy,来了也不发贴回贴。今天听说 # 有人统计了五选周期每人的直播次数,就来看了一下,发现受统计方法所限,原 # 贴数据问题很大(例:路人最爱的那位大人分明直播了两次——虽然都是外务要求; # 但原贴说那位大人直播了零次,以致收了很多酸菜,本人心痛不已),所以本人 # 决定小号出山,拿出箱底的数据拨乱反正一下,也顺便提供一点细节。 # # 还是老样子,本人先介绍数据来源、统计方法,指出局限性;然后提供数据,但 # 不多加主观发挥,由读者自行理解。 # # 本人数据来源是每整十分钟爬一次口袋的当...
nilq/baby-python
python
import multiprocessing import os import random import time import pytest import requests from finetuner.toydata import generate_fashion from finetuner import __default_tag_key__ from jina.helper import random_port os.environ['JINA_LOG_LEVEL'] = 'DEBUG' all_test_losses = ['SiameseLoss', 'TripletLoss'] def _run(fram...
nilq/baby-python
python
from .Layer import * class Slice(Layer): def __init__(self, model, *args, **kwargs): Layer.__init__(self, model, *args, **kwargs) self.axis = kwargs.get("axis", 1) if "slice_point" in kwargs: self.slice_points = [kwargs["slice_point"]] else: self.slice_points...
nilq/baby-python
python
class NaturalNumbers: def __init__(self): pass def get_first_n_for(self, n): # Ejemplo """ Obtener los primeros n naturales en una lista con for """ first_n = [] # Se declara una lista donde almacenaremos los numeros for i in range(n): # Se itera sobre range que ...
nilq/baby-python
python