content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
"""Support for Xiaomi Mi Air Quality Monitor (PM2.5) and Humidifier."""
from __future__ import annotations
from dataclasses import dataclass
import logging
from miio import AirQualityMonitor, DeviceException
from miio.gateway.gateway import (
GATEWAY_MODEL_AC_V1,
GATEWAY_MODEL_AC_V2,
GATEWAY_MODEL_AC_V3,
... | nilq/baby-python | python |
import subprocess
import sys
import getopt
import os
from datetime import datetime, time
def substring(s, debut, fin):
pos = s.find(debut)
if pos >= 0:
if fin == "":
return s[pos+len(debut):]
else:
pos2 = s.find(fin, pos)
if pos2 >= 0:
return... | nilq/baby-python | python |
from twitchstream.outputvideo import TwitchBufferedOutputStream
import argparse
import time
import numpy as np
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
required = parser.add_argument_group('required arguments')
required.add_argument('-s', '--streamkey',
... | nilq/baby-python | python |
from __future__ import unicode_literals
from .base import Base
from trustar2.base import fluent, ParamsSerializer, Param, get_timestamp
from trustar2.trustar_enums import AttributeTypes, ObservableTypes
@fluent
class Entity(Base):
FIELD_METHOD_MAPPING = {
"validFrom": "set_valid_from",
"validTo... | nilq/baby-python | python |
# Copyright (c) 2019, Digi International, Inc.
#
# 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
# to use, copy, modify, merge, pu... | nilq/baby-python | python |
# Copyright 2017 The Wallaroo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 by University of Kassel, Tu Dortmund, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.
import numpy as np
import pandas as pd
... | nilq/baby-python | python |
"""Hacs models."""
| nilq/baby-python | python |
# -*- encoding: utf-8 -*-
import json
import logging
import shlex
from aws_gate.constants import (
AWS_DEFAULT_PROFILE,
AWS_DEFAULT_REGION,
DEFAULT_OS_USER,
DEFAULT_SSH_PORT,
DEFAULT_KEY_ALGORITHM,
DEFAULT_KEY_SIZE,
PLUGIN_INSTALL_PATH,
DEBUG,
DEFAULT_GATE_KEY_PATH,
)
from aws_gate.... | nilq/baby-python | python |
import json
from flask import make_response
def get_response(status, body):
response = make_response(str(body), status)
response.headers['Content-Type'] = 'application/json'
response.headers['Access-Control-Allow-Origin'] = '*'
return response
def error_handler(message, status=400):
return get_r... | nilq/baby-python | python |
# Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
# **InsertLicense** code
__author__ = 'gchlebus'
from data.cityscapes.cityscapes_labels import Label
labels = [
Label("background", 0, 0, "bg", 0, False, False, (0, 0, 0)),
Label("liver", 1, 1, "liver", 0, False, False, (255, 255, 255)),
]
| nilq/baby-python | python |
import picamera
from time import sleep
import face_recognition
from time import time
import os
# https://picamera.readthedocs.io/en/release-1.0/api.html
def get_number_faces():
time_now = int(time())
# take picture
camera = picamera.PiCamera()
# set resolution
camera.resolution = (1024, 768)... | nilq/baby-python | python |
from rest_framework import serializers
from . import models
class LabeledImageSerializer(serializers.ModelSerializer):
class Meta:
model = models.LabeledImage
fields = '__all__'
class ImageSerializer(serializers.ModelSerializer):
labeled_images = LabeledImageSerializer(many=True, read_only... | nilq/baby-python | python |
from setuptools import setup, find_packages
setup(
version='0.6.3',
name='vinepy',
description='Python wrapper for the Vine Private API',
license='MIT',
author='David Gomez Urquiza',
author_email='david.gurquiza@gmail.com',
install_requires=['requests'],
url='https://github.com/davoclav... | nilq/baby-python | python |
from .jschemalite import match, sample_match, to_json_schema
__all__ = ['match','sample_match','to_json_schema']
| nilq/baby-python | python |
# Copyright 2022 Kaiyu Zheng
#
# 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 writin... | nilq/baby-python | python |
"""
Harness for GP Bandit Optimisation.
-- kandasamy@cs.cmu.edu
"""
# pylint: disable=import-error
# pylint: disable=no-member
# pylint: disable=invalid-name
# pylint: disable=relative-import
# pylint: disable=super-on-old-class
from argparse import Namespace
import numpy as np
# Local imports
from bo import acqu... | nilq/baby-python | python |
from rec_to_nwb.processing.nwb.components.iterator.multi_thread_data_iterator import MultiThreadDataIterator
from rec_to_nwb.processing.nwb.components.iterator.multi_thread_timestamp_iterator import MultiThreadTimestampIterator
from rec_to_nwb.processing.nwb.components.position.old_pos_timestamp_manager import OldPosTi... | nilq/baby-python | python |
import gmpy2
n = 61460246439415037572177153632567252974745825750571288306818039521504649853292397058615041720699737467645963503594622773977391347884815005023877160625719128613453317553969604006686164013006897862637976548043387891127509135486424826628097846027041745648859637224222999183046451259665159100806312570205297... | nilq/baby-python | python |
import pandas as pd
class ProjectSQLiteHandler:
def __init__(self, database='project_manager'):
import sqlite3 as lite
self.connection = lite.connect(database)
self.cursor = self.connection.cursor()
def closeDatabase(self):
self.cursor.close()
self.connection.close()
... | nilq/baby-python | python |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | nilq/baby-python | python |
# Specific imports.
from ml_util import split_dataset_at_feature
# Public interface.
__all__ = ['ID3']
# Current version.
__version__ = '0.0.1'
# Author.
__author__ = "Michalis Vrettas, PhD - Email: michail.vrettas@gmail.com"
# ID3 class definition.
class ID3(object):
"""
Description:
TBD
"""
... | nilq/baby-python | python |
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# ---------------------------------------------------------------------... | nilq/baby-python | python |
"""Base class for deriving trainable modules."""
# local
from ivy.stateful.module import Module
class Sequential(Module):
def __init__(self, *sub_modules, device=None, v=None):
"""A sequential container. Modules will be added to it in the order they are
passed in the constructor.
:param ... | nilq/baby-python | python |
import os
current_path = os.path.abspath(os.path.dirname(__file__))
filelist_path = current_path + "/filelist.txt"
filelist = open(filelist_path, "w")
for filename in os.listdir(current_path):
if filename.split(".")[1] == "mp4":
if filename.find("[") != -1:
print(filename.find("["))
... | nilq/baby-python | python |
'''
Bank Transfer System
'''
__author__ = 'Dilmuratjohn'
import sys
import pymysql
class Transfer(object):
def __init__(self,connection):
self.connection = connection
def check_account(self,account):
print("checking account[%s]..." %(account))
cursor=self.connection.cursor()
... | nilq/baby-python | python |
import graphene
from .. import type_
from .... import ops
##__________________________________________________________________||
class CommonInputFields:
"""Common input fields of mutations for creating and updating file paths"""
path = graphene.String()
note = graphene.String()
class CreateProductFil... | nilq/baby-python | python |
from django.conf import settings
from wq.db.patterns.models import LabelModel
if settings.WITH_GIS:
from django.contrib.gis.db import models
class GeometryModel(LabelModel):
name = models.CharField(max_length=255)
geometry = models.GeometryField(srid=settings.SRID)
class PointModel(Label... | nilq/baby-python | python |
import collections
import event_model
import itertools
from bluesky.plans import count
from intake.catalog.utils import RemoteCatalogError
import numpy
import ophyd.sim
import os
import pytest
import time
import uuid
def normalize(gen):
"""
Converted any pages to singles.
"""
for name, doc in gen:
... | nilq/baby-python | python |
from flask import Flask, request
import json
import webbrowser, random, threading
import base64
import io
import matplotlib.image as mpimg # TODO: remove matplotlib dependency
import numpy as np
from laserCAM import Project, Image, Engraving, Laser, Machine, Preprocessor
import os
app = Flask(__... | nilq/baby-python | python |
from terrascript import _resource
class circonus_check(_resource): pass
check = circonus_check
class circonus_contact_group(_resource): pass
contact_group = circonus_contact_group
class circonus_graph(_resource): pass
graph = circonus_graph
class circonus_metric(_resource): pass
metric = circonus_metric
class circo... | nilq/baby-python | python |
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from .views import CreateView, DetailsView
from rest_framework.authtoken.views import obtain_auth_token
urlpatterns = {
url(r'^bucketlists/$', CreateView.as_view(), name="create"),
url(r'^bucketlists/(?P<p... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to ... | nilq/baby-python | python |
# -*-coding:Utf-8 -*
# Sprites display
import harfang as hg
class Sprite:
tex0_program = None
spr_render_state = None
spr_model = None
vs_pos_tex0_decl = None
@classmethod
def init_system(cls):
cls.tex0_program = hg.LoadProgramFromAssets("shaders/sprite.vsb", "shaders/sprite.fsb")
cls.vs_pos_tex0_decl = ... | nilq/baby-python | python |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
from transformers import glue_processors as processors
from transformers import glue_output_modes as output_modes
from transformers import glue_convert_exampl... | nilq/baby-python | python |
''' watchsnmp.py
set snmp device(s) to monitor
set snmp oid list to monitor
get snmp info from devices using oid list
save snmp data
read saved snmp data
diff from prev smp data
graph snmp data
send alert email
'''
from snmp_helper import snmp_get_oid_v3,snmp_extract
from watchdata import WatchData
import time
ip='1... | nilq/baby-python | python |
from . import mod_process
from . import sn_constant
from . import sn_phossite
from . import sn_result
from . import sn_utils
from .sn_lib import SpectronautLibrary
| nilq/baby-python | python |
import re
import logging
import munch
from . import shell
from builtins import staticmethod
import os
LSPCI_D_REGEX = re.compile("(([0-9a-f]{4}):([0-9a-f]{2}):([0-9a-f]{2}).([0-9a-f]))\s*")
class Device(munch.Munch):
def __init__(self, domain, bus, slot, function, info):
super().__init__(dict(domain=dom... | nilq/baby-python | python |
import numpy as np
from PIL import Image as Image
from scipy.ndimage import median_filter as _median_filter
from skimage.restoration import denoise_tv_bregman as _denoise_tv_bregman
import tensorflow as tf
def _get_image_from_arr(img_arr):
return Image.fromarray(
np.asarray(img_arr, dtype='uint8'))
def ... | nilq/baby-python | python |
#!/usr/bin/env python
import os
import sys
import matplotlib.pyplot as plt
import nibabel as nib
import nilearn.image as nimage
import numpy as np
import pandas as pd
import seaborn as sns
import scipy.linalg as la
from glob import glob
from budapestcode.utils import compute_tsnr
from budapestcode.viz import make_mo... | nilq/baby-python | python |
import ConfigParser
import os
from core.basesingleton import BaseSingleton
from core.settings import Settings
class ConfigurationManager(BaseSingleton):
@classmethod
def load_configuration(cls):
cls.get_instance()._load_configuration()
@classmethod
def save_configuration(cls):
cls.ge... | nilq/baby-python | python |
###############################################################################
#
# \file ResultProcessor.py
# \author Sudnya Diamos <sudnyadiamos@gmail.com>
# \date Saturday August 12, 2017
# \brief Class that converts a probability distribution over classes to class
# label and returns result as a j... | nilq/baby-python | python |
# Generated by Django 3.0.6 on 2020-05-16 17:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('confesion', '0004_remove_confesion_comentarios'),
]
operations = [
migrations.AddField(
model_name='comentario',
nam... | nilq/baby-python | python |
import pytest
MODEL = 'ecmwf'
class VariableInfo:
def __init__(self):
self.name = 'Product'
@pytest.mark.parametrize("key", [
'cf_V', 'cf_A', 'cf_V_adv', 'cf_A_adv'])
def test_get_cf_title(key):
from model_evaluation.plotting.plotting import _get_cf_title
var = VariableInfo()
field_name... | nilq/baby-python | python |
#! -*- codinf:utf-8 -*-
import time
import pandas as pd
import numpy as np
import torch
from numba import njit
from pyteomics.mgf import read
from pyteomics.mgf import read_header
"""
This script is used to compare the use-time of NDP and DLEAMS
"""
@njit
def caculate_spec(bin_spec):
ndp_spec = np.math.sqrt(np.do... | nilq/baby-python | python |
import pylab
import numpy
import ardustat_library_simple as ard
import time
import sys
from glob import glob
import os
def get_latest():
data_files = glob("*.dat")
high_time = 0
recent_file = "foo"
for d in data_files:
if os.path.getmtime(d) > high_time:
high_time = os.path.getmtime(d)
recent_file = d
re... | nilq/baby-python | python |
import numpy as np
from ..prediction import *
def test_predict_seebeck():
try:
predict_seebeck(1234, 62, 400)
except(TypeError):
pass
else:
raise Exception("Bad input allowed",
"Error not raised when `compound` isn't a string")
try:
predict_se... | nilq/baby-python | python |
import numpy as np
import pandas as pd
import pytest
from scipy.sparse import coo_matrix
from collie.cross_validation import random_split, stratified_split
from collie.interactions import ExplicitInteractions, Interactions
def test_bad_random_split_HDF5Interactions(hdf5_interactions):
with pytest.raises(Assertio... | nilq/baby-python | python |
from .loader import TableData
class MeasurementTypeData(TableData):
DATA = [
{"measurement_type_id": 0, "name": "generic measurement"},
{"measurement_type_id": 1, "name": "generic liquid sample"},
{"measurement_type_id": 2, "name": "whole blood"},
{"measurement_type_id": 3, "name":... | nilq/baby-python | python |
import matplotlib.pyplot as plt
from torchvision import transforms, datasets
from torchvision.models import vgg19, densenet121, vgg16
from torchvision import datasets, models, transforms
import torchvision
from torch import nn, optim
import torch
import torch.nn.functional as F
from collections import OrderedDi... | nilq/baby-python | python |
import subprocess
import os
import signal
import psutil
import time
class ShellProcessRunner(object):
def __init__(self):
self.cmd = None
self.started = False
def start(self):
if self.started:
return
if self.cmd is None:
raise Exception("Process cmd is ... | nilq/baby-python | python |
import os
import fnmatch
import re
import subprocess
import sys
import readline
import shutil
import random
settings_file = '%s/.infinispan_dev_settings' % os.getenv('HOME')
upstream_url = 'git@github.com:infinispan/infinispan.git'
### Known config keys
local_mvn_repo_dir_key = "local_mvn_repo_dir"
maven_pom_xml_namesp... | nilq/baby-python | python |
import pandas as pd
import torch
from torch import nn
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print("Device Being used:", device)
torch.autograd.set_detect_anomaly(True)
from torch.autograd import Variable
import numpy as np
from torch import optim
from sklearn import metrics
impo... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Copyright 2016 Google Inc. 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 require... | nilq/baby-python | python |
# Copyright 2021 Miljenko Šuflaj
#
# 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 t... | nilq/baby-python | python |
# Generated by Django 2.2.7 on 2020-04-10 05:42
import blog.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MOD... | nilq/baby-python | python |
from __future__ import absolute_import
import tangos.testing.simulation_generator
from tangos import parallel_tasks as pt
from tangos import testing
import tangos
import sys
import time
from six.moves import range
from nose.plugins.skip import SkipTest
def setup():
pt.use("multiprocessing")
testing.init_blan... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for PL-SQL recall file parser."""
import unittest
from plaso.formatters import pls_recall as _ # pylint: disable=unused-import
from plaso.lib import timelib
from plaso.parsers import pls_recall
from tests.parsers import test_lib
class PlsRecallTest(test_lib.Parse... | nilq/baby-python | python |
from predicate import predicate
class Annotation(predicate):
"""
"""
| nilq/baby-python | python |
"""
Tests the geomeTRIC molecule class.
"""
import pytest
import geometric
import os
import numpy as np
from . import addons
datad = addons.datad
def test_blank_molecule():
mol = geometric.molecule.Molecule()
assert len(mol) == 0
class TestAlaGRO:
@classmethod
def setup_class(cls):
try: cls... | nilq/baby-python | python |
from amep.commands.make_dataset.sub_command import MakeDataset # NOQA
| nilq/baby-python | python |
import argparse
import numpy as np
import pandas as pd
import joblib
from src import config
TRAINING_DATA = config.TRAINING_DATA
TEST_DATA = config.TEST_DATA
FOLDS = config.FOLDS
def predict(MODEL, FOLDS):
MODEL = MODEL
df = pd.read_csv(TEST_DATA)
text_idx = df["id"].values
predictions = None
... | nilq/baby-python | python |
# INI handling sample
import configparser
config = configparser.ConfigParser()
config.read('python-test.ini', encoding="UTF-8")
sections = config.sections()
print(sections)
pt3 = config.get('RECT', 'pt3', fallback = '855,774') # don't care : 'RECT' section or 'pt3' option not exists, default value = '855,774'
print(p... | nilq/baby-python | python |
import os
import warnings
import sys
import pandas as pd
import numpy as np
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.naive_bayes import GaussianNB
import mlflow
import mlflow.sklearn
import logging
logging.basicConfig(level=logg... | nilq/baby-python | python |
# Copyright 2019 Mycroft AI 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 writin... | nilq/baby-python | python |
"""
`neo_blue`
========================================================
Copyright 2020 Alorium Technology
Contact: info@aloriumtech.com
Description:
This is a very simple CircuitPython program that turns the
Evo M51 NeoPixel blue.
"""
from aloriumtech import board, digitalio, neopixel
neo = neopixel.NeoPixel(board... | nilq/baby-python | python |
import os
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.nn import DataParallel
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
from networks.discriminator import get_discriminator
from networks.resnet i... | nilq/baby-python | python |
import os
import numpy as np
from PIL import Image
from tensorflow.python.keras.models import load_model
from scripts.util import normalise_data
def get_character(label):
if label == 10:
return '+'
elif label == 11:
return '-'
elif label == 12:
return '*'
elif label == 13:
... | nilq/baby-python | python |
from setuptools import setup, find_packages
import os
import glob
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
VERSIONFILE="gdelttools/_version.py"
with open(VERSIONFILE, "rt") as vfile:
f... | nilq/baby-python | python |
# Copyright (c) 2020 kamyu. All rights reserved.
#
# Google Code Jam 2008 Round 3 - Problem C. No Cheating
# https://code.google.com/codejam/contest/32002/dashboard#s=p2
#
# Time: O(E * sqrt(V)) = O(M * N * sqrt(M * N))
# Space: O(V) = O(M * N)
#
import collections
# Time: O(E * sqrt(V))
# Space: O(V)
# Source code... | nilq/baby-python | python |
# Generated by Django 3.0.3 on 2020-03-13 11:01
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('eadmin', '0004_auto_20200313_0713'),
]
operations = [
migrations.CreateModel(
name='Products',
... | nilq/baby-python | python |
# BSD 3-Clause License
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrig... | nilq/baby-python | python |
if __name__ == "__main__":
print('HELLO WORLD')
| nilq/baby-python | python |
def aumentar(preco=0, taxa=0, sit=False):
"""
->> Calcular o aumento de um valor
:param preco: Valor a aumentar
:param taxa: Valor (porcentagem) do aumento
:param sit: Valor (opcional) informando se deve ou não realizar a formatação.
:return: O valor aumentado conforme a taxa
"""
res ... | nilq/baby-python | python |
from abc import abstractmethod
from typing import List, Union, Tuple
import numpy as np
from sc2 import Result, UnitTypeId
from sharpy.managers.extensions import ChatManager
from sharpy.plans import BuildOrder
from sharpy.plans.acts import ActBase
from tactics.ml.agents import BaseMLAgent
REWARD_WIN = 1
REWARD_LOSE =... | nilq/baby-python | python |
class HalfAdder(DynamicNetwork):
#-- This creator HalfAdder(a,b) takes two nodes a,b that
# are inputs to the half-adder.
def __init__(inst, a, b):
#-- Add the two input nodes to the set of nodes associated
# with the current full-adder network.
inst.addNodes(a, b... | nilq/baby-python | python |
import json
import argparse
import matplotlib.pyplot as plt
import math
from typing import Dict
plt.switch_backend("agg")
def plot_bleu_score_data(bleu_score_dict: Dict, language_dict: Dict, picture_path: str):
fig_num_per_picture = 6
lang_list = list(bleu_score_dict.keys())
num_picture = int(math.cei... | nilq/baby-python | python |
import pprint
from zolware_data import user_manager
from zolware_data import datasource_manager
from zolware_data import signal_manager
from zolware_data import datasource_reader
user_manager = user_manager.UserManager()
user = user_manager.find_user_by_email('snclucas@gmail.com')
datasource_manager = datasource_mana... | nilq/baby-python | python |
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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 th... | nilq/baby-python | python |
"""
file: 'time_align.py'
author: David Fairbairn
date: June 2016
The need for a script that looks at timestampdata (currently only relevant for
the Saskatoon SuperDARN radar) to the errlog files' erroneous timestamps
compelled me to write this script.
This script approaches the problem by identifying the times durin... | nilq/baby-python | python |
# String; Backtracking
# Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
#
# A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
#
#
#
# Example:
#
# Input: "23"
# Outpu... | nilq/baby-python | python |
from dagster import asset
# start_example
@asset(metadata={"cereal_name": "Sugar Sprinkles"})
def cereal_asset():
return 5
# end_example
| nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 4 18:26:36 2019
@author: Juan Sebastián Herrera Cobo
This code solves the scheduling problem using a genetic algorithm. Implementation taken from pyeasyga
As input this code receives:
1. T = number of jobs [integer]
2. ni = number of oper... | nilq/baby-python | python |
import os
from pydu.dt import timer
class TestTimer(object):
def test_context_manager(self):
timeit = timer()
with timeit:
os.getcwd()
assert timeit.elapsed is not None
def test_decorator(self):
timeit = timer()
@timeit
def foo():
os.... | nilq/baby-python | python |
# Imports
import sys
import torch
import os
import numpy as np
import time
from sbi.inference import SNRE_B, prepare_for_sbi
# Initial set up
lunarc = int(sys.argv[1])
seed = int(sys.argv[2])
print("Input args:")
print("seed: " + str(seed))
if lunarc == 1:
os.chdir('/home/samwiq/snpla/seq-posterior-approx-w-nf-d... | nilq/baby-python | python |
class RMCError(Exception):
def __init__(self, message):
Exception.__init__(self, message)
self.__line_number=None
def set_line_number(self, new_line_number):
self.__line_number=new_line_number
def get_line_number(self):
return self.__line_number
... | nilq/baby-python | python |
__author__ = 'Milo Utsch'
__version__ = '0.1.0'
from setuptools import setup, find_packages
from euler import __name__ as name
from euler import __author__ as author
from euler import __doc__ as doc
from euler import __email__ as author_email
from euler import __version__ as version
from euler import __license__ as l... | nilq/baby-python | python |
# Masters Research Project
# Kenneth Young
# FSBF MIP Model of the SUALBSP-2
# This file contains:
# -A MIP model of the SUALBSP-2
# -This model was adapted from Esmaeilbeigi et al. (2016),
# specifically their FSBF-2 model.
# Packages
import sys
import pdb
import time
# import itertools
import csv
import argpars... | nilq/baby-python | python |
# https://leetcode.com/problems/count-number-of-pairs-with-absolute-difference-k/
class Solution:
def countKDifference(self, nums: List[int], k: int) -> int:
count = 0
for i in range(0, len(nums)-1):
for j in range(i+1, len(nums)):
if abs(nums[i]-nums[j... | nilq/baby-python | python |
import glob
import re
import time
import os
from utils.config_utils import *
from utils.colors import *
import shutil
from datetime import datetime
import smtplib
from email.mime.text import MIMEText
from email.header import Header
import socket
import subprocess
current_path = os.path.dirname(os.path.abspath(__file__... | nilq/baby-python | python |
__author__ = 'Benjamin Knight'
__license__ = 'MIT'
__version__ = '0.1'
| nilq/baby-python | python |
#!/usr/bin/env python3
import yaml
import torch
import random
import argparse
import json
import numpy as np
import datetime
from pathlib import Path
from src.marcos import *
from src.mono_interface import MonoASRInterface
from src.utils import get_usable_cpu_cnt
import src.monitor.logger as logger
# Make cudnn det... | nilq/baby-python | python |
from distutils.core import setup
setup(name='tf-easy-model-saving',
version='1.0',
author='Philippe Remy',
packages=['easy_model_saving'],
zip_safe=False)
| nilq/baby-python | python |
# type: ignore
import colorsys
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Dict, List, Optional, Union, Type
from pydantic import constr
from labelbox.schema import project
from labelbox.exceptions import InconsistentOntologyException
from labelbox.orm.db_object import DbOb... | nilq/baby-python | python |
from django.conf.urls import url, include
from . import views
from project import views
urlpatterns = [
url('signIn', views.signIn, name='signIn'),
url('signUp', views.signUp, name='signUp')
]
| nilq/baby-python | python |
__version__ = u'0.1.2'
| nilq/baby-python | python |
import os
import types
from ledger.util import STH
from ledger.ledger import Ledger
def checkLeafInclusion(verifier, leafData, leafIndex, proof, treeHead):
assert verifier.verify_leaf_inclusion(
leaf=leafData,
leaf_index=leafIndex,
proof=proof,
sth=STH(**treeHead))
def checkCons... | nilq/baby-python | python |
from __future__ import absolute_import, print_function
from . import camx, cmaq
__all__ = ['camx', 'cmaq']
__name__ = 'models'
#
| nilq/baby-python | python |
from bangtal import *
import time
setGameOption(GameOption.INVENTORY_BUTTON, False)
setGameOption(GameOption.MESSAGE_BOX_BUTTON, False)
game_scene = Scene('Othello', 'Images/background.png')
transparent_screen = Object('Images/transparent_screen.png')
BLANK = -1
BLACK = 0
WHITE = 1
BLACK_POS = 3
WHITE_POS = 4
BASE... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 7 00:53:29 2019
@author: yoelr
"""
from ... import Unit
__all__ = ('extend_summary', )
def extend_summary(cls):
"""Extends the Unit class with the following abstract methods:
**_end():**
Finish setting purchase prices and utility costs.
... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.