content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import numpy as np import matplotlib.pyplot as plt import pandas as pd import pygsheets def boxplot(models_list, d_exp, xlabel='Models', ylabel='Mise Surv 0', option=0): n = len(models_list) if option == 0: input = [d_exp[f'mise_0_{model_name}'] for model...
nilq/baby-python
python
#coding=UTF-8 import argparse, sys from urllib.request import urlopen parse = argparse.ArgumentParser(description="Check vaadin.com version lists") parse.add_argument("version", help="Released Vaadin version number") args = parse.parse_args() if hasattr(args, "echo"): print(args.echo) sys.exit(1) prerelease = Non...
nilq/baby-python
python
''' Created on May 2, 2018 @author: hwase0ng ''' import settings as S import requests from BeautifulSoup import BeautifulSoup from utils.fileutils import getStockCode from common import loadMap WSJSTOCKSURL = 'https://quotes.wsj.com/company-list/country/malaysia' def connectStocksListing(url): ...
nilq/baby-python
python
#!/usr/bin/python3 # coding=utf-8 # Copyright 2021 getcarrier.io # # 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 req...
nilq/baby-python
python
# -*- coding: utf-8 -*- # (C) Copyright 2017 Hewlett Packard Enterprise Development LP # 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 # # Unl...
nilq/baby-python
python
casa = float(input('Qual valor da casa? R$')) s = float(input('Qual valor do seu salário? R$')) a = int(input('Em quantos anos deseja pagar a casa?')) parcela = casa / (a * 12) if parcela <= 0.3 * s: print(f'Parabéns, você está apto para compra da casa, vamos fechar negócio! \nVocê pagará em {a*12} parcelas de {pa...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Copyright (c) 2010-2016, MIT Probabilistic Computing Project # # 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/LICENS...
nilq/baby-python
python
from req import Service from service.base import BaseService import requests import json import config import datetime class DatetimeEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, datetime.datetime): return obj.strftime('%Y-%m-%d %H:%M:%S') elif isinstance(obj, da...
nilq/baby-python
python
from .case import * from .valkyrie_utils import * from .section_model import * from .cbr_cycle import * from .functions import * from .storage_unit import * from .valkyrie_ner import *
nilq/baby-python
python
import io import matplotlib as mpl mpl.use('Agg') import matplotlib.cm as cm import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from pandas.plotting import register_matplotlib_converters from sklearn.decomposition import PCA from sklearn.manifold import TSNE from sklearn.metri...
nilq/baby-python
python
#! /usr/bin/python2.4 # # Copyright 2017 Google 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 ...
nilq/baby-python
python
""" #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GUI application for Forward modelling 2D potential field profiles. Written by Brook Tozer, University of Oxford 2015-17. SIO 2018-19. Includes ability to import seismic reflection, well, surface ...
nilq/baby-python
python
from typing import List, Union import numpy as np import tf_conversions from geometry_msgs.msg import Pose, Quaternion def calc_homogeneous_matrix(pose: Pose) -> np.ndarray: angles = tf_conversions.transformations.euler_from_quaternion([ pose.orientation.x, pose.orientation.y, pose.orien...
nilq/baby-python
python
""" DBSCAN Clustering """ import numpy as np from sklearn.cluster import DBSCAN from sklearn.neighbors import NearestNeighbors def eps_est(data,n=4,verbose=True): """ Minimum data size is 1000 Methodology improvement opportunity: Better elbow locater """ if verbose:print("Calculating nearest n...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: fetchScheduler Description : Author : JHao date: 2019/8/6 ------------------------------------------------- Change Activity: 2019/08/06: ----------------------------------------...
nilq/baby-python
python
#!/usr/bin/env python # Written by Eric Ziegast # nxdomain.py - look at ch202 dnsqr data from a file and print out any # qname / type / rcode for data that's not rcode 0 ("NOERROR"). # Forgive awkward key processing. Sometimes an rcode or qtype key # doesn't exist and would cause the script to break if accessed th...
nilq/baby-python
python
lista = list() while True: lista.append(int(input("Digite um número inteiro:\t"))) while True: p = str(input("Digitar mais números?\t").strip())[0].upper() if p in 'SN': break else: print("\033[31mDigite uma opção válida!\033[m") if p == 'N': break par...
nilq/baby-python
python
""" A simple TCP echo server. """ import argparse import socket import time if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("listen_port", help="The port this process will listen on.", type=int) args = parser.parse_args() ...
nilq/baby-python
python
import os import io import shutil import base64 import subprocess import platform import logging import numpy as np import pandas as pd from tqdm import tqdm from glob import glob from pathlib import Path as P import wget import urllib3, ftplib from urllib.parse import urlparse from bs4 import BeautifulSoup import ...
nilq/baby-python
python
# Generated by Django 3.1.2 on 2020-11-09 15:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auctions', '0015_auto_20201106_1737'), ] operations = [ migrations.CreateModel( name='Post', fields=[ ...
nilq/baby-python
python
# Copyright 2009 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. import os import unittest from Bio import MissingExternalDependencyError...
nilq/baby-python
python
from zope.browserpage import ViewPageTemplateFile import pkg_resources import zeit.cms.related.interfaces import zeit.cms.workflow.interfaces import zeit.content.video.interfaces class Details(zeit.cms.browser.objectdetails.Details): index = ViewPageTemplateFile(pkg_resources.resource_filename( 'zeit.con...
nilq/baby-python
python
import requests import os import time from datetime import datetime def get_edgar_index_files(date_input, download_folder=None): date = datetime.strptime(str(date_input), '%Y%m%d') # Confirm that date format is correct error = 'Date format should be in YYYYMMDD. ' if date > datetime.now(): ...
nilq/baby-python
python
from pylab import * import tensorflow as tf from sklearn.datasets import make_moons from sklearn.datasets import load_digits import tensorflow as tf import sys sys.path.insert(0, '../utils') from layers import * from utils import * import cPickle import os SAVE_DIR = os.environ['SAVE_DIR'] runnb=int(sys.argv[-4]...
nilq/baby-python
python
#!/usr/bin/env python3 import os import unittest import boto3 from moto import mock_kms from psyml.awsutils import ( decrypt_with_psyml, encrypt_with_psyml, get_psyml_key_arn, ) from psyml.settings import PSYML_KEY_REGION, PSYML_KEY_ALIAS class TestAWSUtils(unittest.TestCase): @mock_kms def kms_...
nilq/baby-python
python
import json from job.model_template.utils import ModelTemplateDriver DEBUG = False class DeeFMTemplateDriver(ModelTemplateDriver): def __init__(self, output_file=None, args=None, local=False): super(DeeFMTemplateDriver, self).__init__("DeepFM model template" + ("(debuging)" if DEBUG else ""), ...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # __coconut_hash__ = 0x412948c # Compiled with Coconut version 1.5.0-post_dev62 [Fish License] # Coconut Header: ------------------------------------------------------------- from __future__ import print_function, absolute_import, unicode_literals, division import sys as...
nilq/baby-python
python
""" Feed File which implements the Hiven Feed type, which should contain social media information of a specific user and their linked acccounts. --- Under MIT License Copyright © 2020 - 2021 Luna Klatzer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated doc...
nilq/baby-python
python
from .flownets import FlowNetS __all__ = ['FlowNetS']
nilq/baby-python
python
import torch import torch.distributed as dist class GatherLayer(torch.autograd.Function): '''Gather tensors from all process, supporting backward propagation. ''' @staticmethod def forward(ctx, input): ctx.save_for_backward(input) output = [torch.zeros_like(input) \ ...
nilq/baby-python
python
from abc import ABC from typing import Callable, Dict, List, Optional, Sequence from guardpost.authentication import Identity class AuthorizationError(Exception): pass class AuthorizationConfigurationError(Exception): pass class PolicyNotFoundError(AuthorizationConfigurationError, RuntimeError): def ...
nilq/baby-python
python
import warnings import numpy as np from tqdm import tqdm from noise import pnoise3, snoise3 import vtk from vtk.util.numpy_support import numpy_to_vtk from vtk.numpy_interface import dataset_adapter as dsa def add_noise_to_sphere(poly_data, octaves, offset=0, scale=0.5): """ Expects sphere with radius 1 cent...
nilq/baby-python
python
import logging import os import sys from logging import fatal, debug, info, warning from os import path from . import utils from .argument_parser import build_argument_parser from .metadata_parser import MetadataParser from .settings import Settings def main(): # Read arguments argument_parser = build_argume...
nilq/baby-python
python
import click import questionary as q import docker import os import time import subprocess from threading import Thread from functools import wraps from colorama import (Fore, Style) from sqlalchemy.engine.url import make_url from vantage6.common import (info, warning, error, debug as debug_msg, ...
nilq/baby-python
python
from django.conf.urls import url, include from rest_framework.urlpatterns import format_suffix_patterns from . import views urlpatterns = [ url(r'^rides/$', views.RideList.as_view(), name='ride_list'), url(r'^rides/(?P<pk>\d+)/$', views.RideDetail.as_view(), name='ride_detail'), url(r'^users/$', views.Us...
nilq/baby-python
python
#!/usr/bin/env python # Demonstration GET friendships/lookup # See https://dev.twitter.com/rest/reference/get/friendships/lookup from secret import twitter_instance from json import dump import sys tw = twitter_instance() # [1] ids = ','.join((str(i) for i in (577367985, 1220723053, 1288619659))) response = tw.frie...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.BelongGreenMerchantInfo import BelongGreenMerchantInfo class AlipayCommerceGreenItemenergySendModel(object): def __init__(self): self._alipay_uid = None self....
nilq/baby-python
python
import random import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.utils.data import copy from MTLCNN_single import MTLCNN_single from MultitaskClassifier import MultitaskClassifier from Util import Util class Train_Classifier: def train_classifier(self, train_arguments...
nilq/baby-python
python
""" Name: jupyter.py Purpose: Installs a jupyter notebook Author: PNDA team Created: 03/10/2016 Copyright (c) 2016 Cisco and/or its affiliates. This software is licensed to you under the terms of the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apach...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_hdf5xltek.py Description: """ # Package Header # from src.hdf5objects.__header__ import * # Header # __author__ = __author__ __credits__ = __credits__ __maintainer__ = __maintainer__ __email__ = __email__ # Imports # # Standard Libraries # import datetime import...
nilq/baby-python
python
""" Provides basic logging functionality """ import logging import inspect from datetime import datetime import os, sys import traceback class Logger: """ generic logger class """ def __init__(self, logname=None, project_name=None): """ :param level: :param project_name: if pr...
nilq/baby-python
python
#!/usr/bin/env python3 import os import unittest import numpy as np import torch from pytorch_translate import rnn # noqa from pytorch_translate import train from pytorch_translate.tasks import pytorch_translate_task as tasks from pytorch_translate.test import utils as test_utils class TestRNNModel(unittest.TestCa...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ CRUD operation for fan model """ import database from DB import exception from DB.models import Fan from DB.api import dbutils as utils RESP_FIELDS = ['id', 'resource', 'status', 'created_at'] SRC_EXISTED_FIELD = { 'id': 'id', # 'uuid': 'uuid', 'status': 'status', 'resource_...
nilq/baby-python
python
#!/usr/bin/env python from random import choice temperaments = ["sanguine", "choleric", "melancholic", "phlegmatic"] personalities = ["introvert", "extrovert"] # Based on the former job will be the starting inventory former_jobs = ["a fireman", "a policeman", "a medic", "unemployed", "a doctor", "a demolitions expert...
nilq/baby-python
python
import os import traceback from concurrent.futures import CancelledError import numpy as np import cv2 from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph as pg import pyqtgraph.opengl as gl import sklearn.cluster from pebble import concurrent from mss import mss from src.constants import * from src.cv_img impo...
nilq/baby-python
python
#!/usr/bin/env python import argparse from Toggl.togglApi import getTogglReport if __name__ == '__main__': parser = argparse.ArgumentParser(description='Obtain report from Toggl.') parser.add_argument("--toggl-token", "-tt", help="Set Toggl token.") parser.add_argument("--toggl-workspace", "-w", help="S...
nilq/baby-python
python
""" Level generator utilities. """ import weakref from math import floor from random import randrange, choice from .blt.nice_terminal import terminal from .geom import Point, Rect, Size from .draw import draw_rect class BSPNode: """ Node in a binary space partitioning tree .. py:attribute:: rect ...
nilq/baby-python
python
from shortcodes import Shortcode # Allowed values for position options ALLOWED_POSITION = ['right', 'left'] class BevelShortcode(Shortcode): name = 'bevel' same_tag_closes = True standalone = True render_empty = True template = 'views/partials/bevel.j2' def _get_position(self, options): ...
nilq/baby-python
python
# Generated by Django 4.0.3 on 2022-03-15 20:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0007_alter_category_options'), ] operations = [ migrations.AlterField( model_name='tick...
nilq/baby-python
python
import random import math def prime_factor_generator(n): yield 2 for i in range(3, int(math.sqrt(n)) + 1, 2): yield i def prime_factors(n): for i in prime_factor_generator(n): if n % i == 0: yield i while True: n //= i if n % i != 0: ...
nilq/baby-python
python
def largest_palindrome_product(n): up_digits = "1" + n * "0" low_digits = "1" + (n-1) * "0" num_up_digits = int(up_digits) num_low_digits = int(low_digits) x = range(num_low_digits, num_up_digits) largest_num = 0 for i in x: for j in x: multi = i * j ...
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 the...
nilq/baby-python
python
import sys from importlib import import_module from bumps.pymcfit import PyMCProblem if len(sys.argv) != 2: raise ValueError("Expected name of pymc file containing a model") module =sys.argv[1] __name__ = module.split('.')[-1] model = import_module(module) problem = PyMCProblem(model)
nilq/baby-python
python
#!/usr/bin/env python import numpy as np from scipy.misc import imread, imresize import matplotlib.pyplot as plt import cv2 import scipy.io import scipy.stats as st from scipy import ndimage as ndi from skimage import feature from skimage.morphology import skeletonize import pdb def gkern(kernlen=21, nsig=3): ...
nilq/baby-python
python
"""Test a hydrogen-like atom.""" import jax import numpy as np import pytest import vmcnet.examples.hydrogen_like_atom as hla from vmcnet.mcmc.simple_position_amplitude import make_simple_position_amplitude_data from .sgd_train import sgd_vmc_loop_with_logging from .kfac_train import kfac_vmc_loop_with_logging def ...
nilq/baby-python
python
from django.conf import settings from cybox.objects.address_object import Address from cybox.objects.uri_object import URI cfg = settings.ACTIVE_CONFIG LOCAL_ALIAS = cfg.by_key('company_alias') OBJECT_FIELDS = { 'AddressObjectType': [['address_value']], 'DomainNameObjectType': [['value']], 'EmailMessageOb...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ @Author: oisc <oisc@outlook.com> @Date: 2018/5/4 @Description: """ import math from collections import namedtuple from copy import copy from interface import Annotator from transition import Session from transition.shiftreduce import SRTransition, SRConfiguration class SPINNTreeBuilder(A...
nilq/baby-python
python
import requests import StringIO import csv import urllib import json import datetime import md5 from time import sleep from limit import Limit from source_iterator import SourceIterator from source_row_manager import SourceRowManager class SourceReader: def __init__(self, date, product, catalogue, url, index, lo...
nilq/baby-python
python
""" A Python module for antenna array analysis ---------- AntArray - Antenna Array Analysis Module Copyright (C) 2018 - 2019 Zhengyu Peng E-mail: zpeng.me@gmail.com Website: https://zpeng.me ` ` -:. -#: -//:. -###: -////:. ...
nilq/baby-python
python
# importacion de librerias # constantes # funciones y metodos def es_primo(numero): primo = True for n in range(2, numero, 1): if numero % n ==0: primo = False break return primo # mi programa principal # ingreso de numero por teclado numero = int(input('Ingrese un num...
nilq/baby-python
python
# -*- coding: utf-8 -*- # vim: set fileencoding=utf-8:noet:tabstop=4:softtabstop=4:shiftwidth=8:expandtab """ python3 class """ # Copyright (c) 2010 - 2020, © Badassops LLC / Luc Suryo # All rights reserved. # BSD 3-Clause License : http://www.freebsd.org/copyright/freebsd-license.html from pprint import PrettyPrin...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2018 Taha Emre Demirkol Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights...
nilq/baby-python
python
from itertools import combinations class Edge: def __init__(self, frm, to, weight): self.from_vertex = frm self.to_vertex = to self.dist = weight def _get_edges(graph): edges = [] for a, b in combinations(range(len(graph)), 2): if graph[a][b]: edges.appen...
nilq/baby-python
python
# -*- coding: utf-8 -*- # File generated according to Generator/ClassesRef/Simulation/OPslip.csv # WARNING! All changes made in this file will be lost! """Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Simulation/OPslip """ from os import linesep from sys import getsizeo...
nilq/baby-python
python
#!C:/Python35/python.exe # -*- coding: UTF-8 -*- # # belmih 2016 # import threading import queue import argparse import os import time import zipfile import shutil import xml.etree.cElementTree as ET import csv abspath = os.path.abspath(__file__) workdir = os.path.dirname(abspath) os.chdir(workdir) CSV_ID_LEVEL = "...
nilq/baby-python
python
import itertools as it, operator as op, functools as ft from collections import ChainMap, Mapping, OrderedDict, defaultdict from pathlib import Path from pprint import pprint import os, sys, unittest, types, datetime, re, math import tempfile, warnings, shutil, zipfile import yaml # PyYAML module is required for tests...
nilq/baby-python
python
import aredis from ddtrace import config from ddtrace.vendor import wrapt from ...internal.utils.wrappers import unwrap from ...pin import Pin from ..redis.util import _trace_redis_cmd from ..redis.util import _trace_redis_execute_pipeline from ..redis.util import format_command_args config._add("aredis", dict(_def...
nilq/baby-python
python
import uuid import datetime import typing from abc import ABC, abstractmethod from sensory_cloud.config import Config from sensory_cloud.services.crypto_service import CryptoService import sensory_cloud.generated.common.common_pb2 as common_pb2 import sensory_cloud.generated.oauth.oauth_pb2_grpc as oauth_pb2_grpc imp...
nilq/baby-python
python
import IPython.nbformat.v4 as nbformat from IPython.nbformat import write as nbwrite import numpy as np def format_line(line): """ Format a line of Matlab into either a markdown line or a code line. Parameters ---------- line : str The line of code to be formatted. Formatting occurs accor...
nilq/baby-python
python
import os import sys from fabric.colors import cyan, red, yellow from fabric.api import task, env, sudo, get, hide, execute from dploy.context import ctx, get_project_dir from dploy.commands import manage as django_manage from dploy.utils import ( FabricException, version_supports_migrations, select_template, ...
nilq/baby-python
python
import IPython from google.colab import output display( IPython.display.HTML('''<div class="container"> <div class="circle red" color="red"></div> <div class="circle" color="yellow"></div> <div class="circle" color="green"></div> <div class="floating-text"> Intelligent Traffic Management System </div> <styl...
nilq/baby-python
python
import rq import numpy as np import time import subprocess import shlex import sys import redis import vislab.tests.testrqaux def get_redis_client(): host, port = ["0.0.0.0", 6379] try: connection = redis.Redis(host, port) connection.ping() except redis.ConnectionError: raise Except...
nilq/baby-python
python
import ctypes as ct from .base import Object, Error, ccs_error, _ccs_get_function, ccs_context, ccs_binding, ccs_hyperparameter, ccs_datum, ccs_datum_fix, ccs_hash, ccs_int from .hyperparameter import Hyperparameter ccs_binding_get_context = _ccs_get_function("ccs_binding_get_context", [ccs_binding, ct.POINTER(ccs_con...
nilq/baby-python
python
"""Example implementation of the Lorenz forecast model. References ---------- - Dutta, R., Corander, J., Kaski, S. and Gutmann, M.U., 2016. Likelihood-free inference by ratio estimation. arXiv preprint arXiv:1611.10242. https://arxiv.org/abs/1611.10242 """ from functools import partial import numpy as np impor...
nilq/baby-python
python
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT """ Read Signature Test - All this does is read the signature from the chip to check connectivity! """ import board import busio import pwmio import adafruit_avrprog spi = busio.SPI(board.SCK, board.MOSI, board.MISO) avrpro...
nilq/baby-python
python
from django.urls import path from rest_framework_simplejwt.views import ( TokenRefreshView, ) from social_network.views import RegisterView, PostView, LikeView, DislikeView, LoginView, UserActivityView, \ AnalyticsView, PostListView app_name = 'sn' urlpatterns = [ path('api/user/register/', RegisterView....
nilq/baby-python
python
""" Module to test the StackToken class. """ from pymarkdown.stack_token import StackToken def test_stack_token_equal(): """ Test to make sure two equal StackToken instances are equal. """ # Arrange token1 = StackToken("type1", extra_data="extra1") token2 = StackToken("type1", extra_data="ext...
nilq/baby-python
python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from distutils.spawn import find_executable from distutils import sysconfig, log import setuptools import setuptools.command.build_py import setuptools.command.develop im...
nilq/baby-python
python
available = "$AVAILABLE$" randomized = "$RANDOMIZED$" hashstring = "$HASHSTRING$" rand_ord = '$RANDORD$' from random import randint as rand def get_sum(value): sums = 0 for k, v in enumerate(value): sums += ord(v)+k return sums def get_activation(request): if not request[0] in randomized or len(request) <= ...
nilq/baby-python
python
'''Creates the wires and part objects''' import FreeCAD import Mesh import lithophane_utils from utils.resource_utils import iconPath from boolean_mesh import BooleanMesh from boolean_mesh import ViewProviderBooleanMesh from create_geometry_base import CreateGeometryBase class ProcessingParameters(object): def ...
nilq/baby-python
python
import pytest from yaml_loader import load_yaml_file from template_loader import load_template @pytest.fixture def values(): """ Loads values for the test template. """ return load_yaml_file('tests/data/values.yaml') @pytest.fixture def template(): """ Gets the template object for the test template...
nilq/baby-python
python
# -*- coding: utf-8 -*- ########################################################### # Elasticsearch Snack 1.1 # # A brief example case indexing recipes with Elasticsearch, # Python and Docker containers # # Copyright 2020 Borja González Seoane # # Contact: borja.gseoane@udc.es #########################################...
nilq/baby-python
python
def match(candidate, job): return candidate["min_salary"] * 9 <= job["max_salary"] * 10
nilq/baby-python
python
from django.conf import settings from django.contrib.auth import get_user_model from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from model_utils.models import TimeStampedModel from producto.models import Producto User = get_user_model() class Order(TimeStampedModel...
nilq/baby-python
python
def isLetter(c): return c >= "A" and c <= "Z" or c >= "a" and c <= "z" def plusOut(s,word): i = 0 value = "" booboo = False while i < len(s) - len(word) + 1: test = s[i:i + len(word)] if test == word: value += test booboo = True elif booboo == False: ...
nilq/baby-python
python
""" This module handles all interactions with Twitter. """ import logging import tweepy from hockeygamebot.helpers import arguments, utils from hockeygamebot.models.hashtag import Hashtag def get_api(): """ Returns an Authorized session of the Tweepy API. Input: None Output: tweep...
nilq/baby-python
python
''' This script elaborates more advanced operations on DataFrames. ''' import pandas as pnd import numpy as npy # Create a DataFrame: dict = {'Col1': [0, 0, 1, 0, 1, 1], 'Col2': ['A', 'B', 'C', 'D', 'E', 'F'], 'Col3': npy.random.randint(1,10,6)} dFrame = pnd.DataFrame(dict) print('The DataFrame is: \n', dFra...
nilq/baby-python
python
"""Module extracts ORB features from an input image and writes to .npz file. All code lifted from openSfM; namely files io.py, features.py and detect_features.py""" import os import cv2 import numpy as np def detect_features(img, nfeat, hahog_params=None): """ Extracts ORB features from image :param img...
nilq/baby-python
python
from enum import Enum class TimeValidity(Enum): DAY = (0,) GOOD_TILL_CANCEL = (1,) class Order: def __init__(self, instrument_code): self.instrumentCode = instrument_code def to_json(self): # replace ' with " for Trading212 compatibility return self.__dict__.__str__().replac...
nilq/baby-python
python
"""Test the LinearSystemComp.""" import unittest import numpy as np import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal class TestLinearSystemComp(unittest.TestCase): """Test the LinearSystemComp class with a 3x3 linear system.""" def test_basic(self): """Check agai...
nilq/baby-python
python
import datetime import json from itertools import count import scipy.io import numpy as np import pandas as pd import h5py from graphcnn.helper import * import graphcnn.setup.helper import graphcnn.setup as setup import math from math import radians, cos, sin, asin, sqrt from scipy import stats from tqdm import tqd...
nilq/baby-python
python
from math import sqrt def spiral_factor(x): return 1-1/sqrt(1+(91/90000)*x**2) file = open("spiral_array.h", "w") print("const float spiral_factor[] = { 0.0", end='', file=file) for x in range(1, 101): print(",", end='\n', file=file) print(spiral_factor(x), end='', file=file) print("};", end='\n', file...
nilq/baby-python
python
import os def post_register_types(root_module): root_module.add_include('"ns3/network-module.h"')
nilq/baby-python
python
import redis from django.conf import settings from .models import Product # connect to redis r = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB) class Recommender(object): def get_product_key(self, id): return 'produ...
nilq/baby-python
python
import logging import os from lightwood.encoders.image.helpers.nn import NnEncoderHelper import torch class NnAutoEncoder: def __init__(self, is_target=False): self._model = None self._pytorch_wrapper = torch.FloatTensor self._prepared = False def prepare_encoder(self, priming_data):...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ sphinx.directives.code ~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs import sys from difflib import unified_diff from docutils import nodes from docutils.parsers.rst import ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ SQLpie License (MIT License) Copyright (c) 2011-2016 André Lessa, http://sqlpie.com See LICENSE file. """ from flask import g import json import sqlpie import os class Document(object): __tablename = "documents" STATE = "state" IS_NOT_INDEXED = 0 IS_INDEXED = 1 PARSER...
nilq/baby-python
python
#!/usr/bin/python3 # -*- coding: utf-8 -*- import proc_criatividade as criatividade from dao.cenario import Cenario from dao.perssonagem import Perssonagem from dao.objeto import Objeto from dao.transporte import Transporte from dao.missao import Missao from...
nilq/baby-python
python
from kernel.local_alignment_kernel import LocalAlignmentKernel from kernel.spectrum_kernel import SpectrumKernel, SumSpectrumKernel from kernel.substring_kernel import SubstringKernel from kernel.base_kernel import KernelIPImplicit, KernelIPExplicit, SumKernelIPExplicit __all__ = ["LocalAlignmentKernel", "SpectrumKern...
nilq/baby-python
python
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sys import argparse import logging import json import importlib import base64 from .common import enable_multi_thread, enable_multi_phase from .constants import ModuleName, ClassName, ClassArgs, AdvisorModuleName, AdvisorClassNa...
nilq/baby-python
python