content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# Copyright 2021 VMware, Inc.
# SPDX-License: Apache-2.0
import logging
import salt.exceptions
import saltext.vmware.utils.common as utils_common
import saltext.vmware.utils.esxi as utils_esxi
from salt.defaults import DEFAULT_TARGET_DELIM
from saltext.vmware.utils.connect import get_service_instance
log = logging.ge... | nilq/baby-python | python |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# 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... | nilq/baby-python | python |
a = int(input())
b = int(input())
cont = a
if a <= b:
for i in range(a, b+1):
for n in range(1, 10+1):
total = cont * n
print(f'{cont} x {n} = {total}')
print('-'*10)
cont += 1
else:
print('Nenhuma tabuada no intervalo!') ... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 6 07:51:51 2018
@author: tuheenahmmed
"""
def getWordScore(word, n):
"""
Returns the score for a word. Assumes the word is a valid word.
The score for a word is the sum of the points for letters in the
word, multiplied by the leng... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Снежинка / Snowflake
"""
# Оригинал: http://www.cyberforum.ru/pascalabc/thread994987.html
# uses graphABC;
# const k=8;
# var x,y:integer;
# procedure snow (x0,y0,r,n:integer);
# const t=2*pi/k;
# var i,x,y:integer;
# begin
# for i:=1 to ... | nilq/baby-python | python |
##
# Copyright (c) 2007-2016 Apple 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 required by applicable l... | nilq/baby-python | python |
'''Author: Brandon Trabucco, Copyright 2019
Helper functions to display and run a simple game'''
from game_engine.colors import *
from game_engine.tiles import *
from game_engine.stacks import *
from game_engine.drawable import Drawable
import random
random.seed(12345)
#####################################
# lets... | nilq/baby-python | python |
import rospy
from geometry_msgs.msg import Twist
from std_msgs.msg import String
import time
import sys, select, termios, tty
import donkeycar as dk
# import keyboard # using module keyboard
from pynput import keyboard
#############################################################################################
# ... | nilq/baby-python | python |
from os import getcwd
from re import findall
from re import match
def parseStep(line):
state = match(r"(on|off)", line).groups()[0]
x1, x2, y1, y2, z1, z2 = map(int, findall(r"(-?\d+)", line))
return state, (x1, x2), (y1, y2), (z1, z2)
def main():
with open(f"{getcwd()}/2021/day22/input.txt") as fi... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
" Help code for sl training "
import traceback
import numpy as np
import torch
import torch.nn as nn
from pysc2.lib.actions import RAW_FUNCTIONS as F
from alphastarmini.core.arch.agent import Agent
from alphastarmini.core.sl.feature import Feature
from alphastarmini.... | nilq/baby-python | python |
from ..catalogs.in_memory import Catalog
from .dataframe import DataFrameAdapter
import dask.dataframe
import pandas
class ExcelReader(Catalog):
"""
Read the sheets in an Excel file.
This maps the Excel file, which may contain one of more spreadsheets,
onto a "Catalog" of tabular structures.
Ex... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tool to manage local 3D Beacon install
.. currentmodule:: bio3dbeacon
.. moduleauthor:: Ian Sillitoe <i.sillitoe@ucl.ac.uk>
"""
from .version import __version__, __release__ # noqa
| nilq/baby-python | python |
import mido
import cv2
#Color library using dictionary from RGB to velocity value of the Launchpad MK2
from ClearLaunchpad import RemoveNotes, ClearScreen
from FirstMido import FillNotes
cap = cv2.imread("Velocity2RGB.png")
Complete = cap.copy()
while(True):
Mat = cv2.inRange(cap, (0, 0, 0), (254, 254, 254))
... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012, Rui Carmo
Description: In-process job management
License: MIT (see LICENSE.md for details)
"""
import os, sys, logging, time, traceback, multiprocessing, gc
from cPickle import loads, dumps
from Queue import PriorityQueue, Empty
from threading import T... | nilq/baby-python | python |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | nilq/baby-python | python |
#!/usr/bin/python
#
# Copyright 2019 Polyaxon, 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 o... | nilq/baby-python | python |
grk_tws = [['G946'],
['G5206'],
['G3428', 'G3429', 'G3430', 'G3431', 'G3432'],
['G3841'],
['G1041', 'G2379'],
['G281'],
['G32', 'G743', 'G2465'],
['G32', 'G743', 'G218', 'G1472', 'G2025', 'G3462', 'G5545', 'G5548'],
['G500'],
['G651', ' G652', ' G2491', ' G5376', ' G5570'],
['G322', 'G606', 'G1299', 'G1303', 'G1935', '... | nilq/baby-python | python |
import os
# os is only used for finding a dynamic absolute path to the I/O files
absolute_path = os.path.dirname(os.path.abspath(__file__))
inn = absolute_path + '/rom.in'
outt = absolute_path + '/rom.out'
# Open input files
fin = open(inn)
fout = open(outt, 'w')
# Get first line for array size
firstLine = fin.read... | nilq/baby-python | python |
import factory
from karp.domain.model import Entry, Resource
class ResourceFactory(factory.Factory):
class Meta:
model = Resource
entity_id = factory.
| nilq/baby-python | python |
#!/usr/bin/env python3
# Copyright 2020 Christian Henning
#
# 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 l... | nilq/baby-python | python |
import glob
import os
import pandas as pd
import pytz
from dateutil import parser, tz
from matplotlib import pyplot as plt
fp = "C:\\Users\\Robert\\Documents\\Uni\\SOLARNET\\HomogenizationCampaign\\rome\\"
file = os.path.join(fp, "data.csv")
data = pd.read_csv(file, delimiter=" ")
print(data)
converted_data = []
f... | nilq/baby-python | python |
from test.common_test_util import expected_result
from test.hquery.hquery_test_util import query_html_doc
def test_escapes_work_in_string_literals():
assert query_html_doc('', '"foo bar"') == expected_result("""
foo
bar""")
assert query_html_doc('', "'foo bar'") == expected_result("""
foo
... | nilq/baby-python | python |
import argparse
import sys
parser = argparse.ArgumentParser(description='Extract gold entities conll file.')
parser.add_argument('--input_file')
args = parser.parse_args()
reading = 0
golds = []
sentences = []
with open(args.input_file, 'r') as i_file:
for line in i_file:
line = line.strip()
if li... | nilq/baby-python | python |
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.contrib.auth.models import User
from django.http import Http404
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
pic = models.ImageField(upload_to='... | nilq/baby-python | python |
import torch
import torch.utils.data
import os
import numpy as np
from PIL import Image
from utils.util import *
def loaderAndResize(path):
return Image.open(path).resize((128, 128))
def loader(path):
return Image.open(path)
class GlassandAttrFaceImageLoader(torch.utils.data.Dataset):
def __init__(... | nilq/baby-python | python |
#!/usr/bin/env python
import pytest
from pytest import approx
import igrf13
time = "2010-07-12"
def test_igrf13():
mag = igrf13.igrf(time, 65, 85, 0, model=12)
assert mag.north.item() == approx(9295.100256)
assert mag.east.item() == approx(2560.199706)
assert mag.down.item() == approx(59670.251893... | nilq/baby-python | python |
import logging
import sdk_cmd
import sdk_tasks
import shakedown
from tests import config
log = logging.getLogger(__name__)
def broker_count_check(count, service_name=config.SERVICE_NAME):
def fun():
try:
if len(sdk_cmd.svc_cli(config.PACKAGE_NAME, service_name, 'broker list', json=True)) == ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
""" testunit 基础类
@Time : 2020/4/10 上午1:03
@File : testbase.py
@author : pchaos
@license : Copyright(C), pchaos
@Contact : p19992003#gmail.com
"""
import unittest
import datetime
import QUANTAXIS as qa
from .testbase import TestingBase
class qaTestingBase(TestingBase):
"""unittest... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import pytest
import os
import csv
import tempfile
from datetime import datetime
from nart.writer.builtins.csvwriter import CSVWriter
from nart.model.nartdata import NartData
from nart.model.nartitem import NartItem
@pytest.fixture
def csvwriter_fixture():
"""
csvrepo의 filepath를 생성하고,... | nilq/baby-python | python |
import torchvision.transforms as transforms
config = {
'params': {
"backbone": {
"kernel_size": 3,
"output_dim": 128,
"input_dim": 3,
"stride": 2,
"padding": 1,
"out_img_size": 16
},
"primary_capsules": {
"k... | nilq/baby-python | python |
"""
This file is part of tendril
See the COPYING, README, and INSTALL files for more information
"""
import os
import imp
dirname, fname = os.path.split(os.path.abspath(__file__))
def import_(filename):
(path, name) = os.path.split(filename)
(name, ext) = os.path.splitext(name)
(f, filename, data) = im... | nilq/baby-python | python |
# Copyright (C) 2021, Raffaello Bonghi <raffaello@rnext.it>
# All rights reserved
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list... | nilq/baby-python | python |
import logging
from typing import TYPE_CHECKING, Optional
from web3.types import BlockIdentifier
from rotkehlchen.assets.asset import Asset
from rotkehlchen.constants.assets import A_ALETH, A_ETH, A_WETH
from rotkehlchen.constants.ethereum import SADDLE_ALETH_POOL
from rotkehlchen.constants.misc import EXP18
from rot... | nilq/baby-python | python |
from .version import __version__ # scTenifoldXct.__version__
from scTenifoldXct.core import scTenifoldXct
from scTenifoldXct.visualization import get_Xct_pairs, plot_XNet
from scTenifoldXct.merge import merge_scTenifoldXct | nilq/baby-python | python |
# Copyright 2014-2017 Lionheart Software LLC
#
# 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 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# check_apcaccess.py - a script for checking a APC UPS
# using the apcaccess utility
#
# 2016 By Christian Stankowic
# <info at stankowic hyphen development dot net>
# https://github.com/stdevel
#
# Enhanced and error corrections by Chris Johnston 2017
# Tested on BX1300G ... | nilq/baby-python | python |
from tiltfile_runner import run_tiltfile_func
from unittest.mock import Mock
import unittest
import pytest
import yaml
class DockerLocalTest(unittest.TestCase):
def test_delegates_to_local_resource_for_build(self):
local_resource = Mock()
run_tiltfile_func("docker_task/Tiltfile",
... | nilq/baby-python | python |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : embedding.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 10/03/2018
#
# This file is part of NSCL-PyTorch.
# Distributed under terms of the MIT license.
import torch
import torch.nn as nn
__all__ = ['LearnedPositionalEmbedding']
class ... | nilq/baby-python | python |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.plant_heating_and_cooling_equipment import HeatPumpWaterToWaterEquationFitHeating
log = logging.getLogger(__name__)
class TestHeatPumpWaterToWaterEquationFitHeating(unittest.Tes... | nilq/baby-python | python |
#!/usr/bin/python
"""
Runs every day as crontab task to pull down previous day's log from
Google app engine, and uploads it to S3.
"""
import os
import sys
import shutil
import subprocess
import string
from pytz import timezone
from datetime import datetime, timedelta
settings = {
'appcfg' : '<path to ga... | nilq/baby-python | python |
#!/usr/bin/python
# Copyright (c) 2017, 2018 Michael De La Rue
# Copyright (c) 2017, 2018 Will Thames
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'communi... | nilq/baby-python | python |
# window.py
#
# Copyright 2020 Herpiko Dwi Aguno
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is d... | nilq/baby-python | python |
'''
Module for performing Stable Matching
it solves an instance of the stable marriage problem.
This is used as a utility for Text-Media Matching
'''
class StableMatcher:
''' Class to implement Stable matching
This Class implements the stable matching
using the gale shapley algorithm.
'''
def __... | nilq/baby-python | python |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
csv_files = os.listdir(os.getcwd())
csv_files = [f for f in csv_files if "Line" in f and ".csv" in f]
# Function to determine significance
def isSignificant(xval,yval, xthr = 1, ythr = 2):
if abs(xval) >= xthr and abs(yval) >= ythr:
... | nilq/baby-python | python |
x, y = map(int, input().split(" "))
if x == 0 and y == 0:
print("origem")
elif x > 0 and y > 0:
print("1 quadrante")
elif x < 0 and y > 0:
print("2 quadrante")
elif x < 0 and y < 0:
print("3 quadrante")
elif x > 0 and y < 0:
print("4 quadrante")
elif x == 0 and y != 0:
print("Eixo y")
eli... | nilq/baby-python | python |
from django.conf.urls import url
from web.views import get_index, fetch
urlpatterns = [
url(r'^$', get_index),
url(r'^fetch/$', fetch),
] | nilq/baby-python | python |
#!/usr/bin/env python
def part1(numbers, cards):
for number in numbers:
for card in cards:
mark(card, number)
if has_won(card):
return score(number, card)
def part2(numbers, cards):
for number in numbers:
iter_cards = cards.copy()
for card in i... | nilq/baby-python | python |
import json
import webapp2
from controllers.api.api_base_controller import ApiBaseController
from consts.district_type import DistrictType
from consts.event_type import EventType
from datetime import datetime
from database.district_query import DistrictsInYearQuery
from database.event_query import DistrictEventsQuer... | nilq/baby-python | python |
# coding=utf-8
from sys import exit
from pytun import *
from scapy.all import *
from MANGLE import *
from FenrirFangs import *
from Autoconf import *
import socket
import select
import time
from struct import *
from binascii import hexlify,unhexlify
class FENRIR:
def __init__(self):
if os.geteuid() != 0:
exit(... | nilq/baby-python | python |
from click.testing import CliRunner
import unittest
from mock import patch, Mock, PropertyMock
from floyd.cli.version import upgrade
class TestFloydVersion(unittest.TestCase):
"""
Tests cli utils helper functions
"""
def setUp(self):
self.runner = CliRunner()
@patch('floyd.cli.version.pi... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
EnigmaLight Plugin by Speedy1985, 2014
https://github.com/speedy1985
Parts of the code is from DonDavici (c) 2012 and other plugins:
all credits to the coders :-)
EnigmaLight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Li... | nilq/baby-python | python |
#! /usr/bin/env python3
import os, sys, time, re
pid = os.getpid()
os.write(1, ("About to fork (pid:%d)\n" % pid).encode())
rc = os.fork()
if rc < 0:
os.write(2, ("fork failed, returning %d\n" % rc).encode())
sys.exit(1)
elif rc == 0: # child
os.write(1, ("Child: My pid==%d. Parent'... | nilq/baby-python | python |
import sys
import math
import random
class leds:
def __init__(self, call):
self.call = call
def show_next(self, color, index):
data = [0x18, 0x05, 0x05, 0x02]
if(color == "white"):
data[2] = 0x01
elif(color == "red"):
data[2] = 0x02
elif(color =... | nilq/baby-python | python |
#!/usr/bin/python
from UcsSdk import *
import time
# This script shows how to monitor UCS Manager events and define your own call back to take specific action on the respective events.
ucsm_ip = '0.0.0.0'
user = 'username'
password = 'password'
def callback_all(mce):
print 'Received a New Event with ... | nilq/baby-python | python |
import yaml
import sys
import os
import time
import re
import copy
import pprint
"""
For each possible rule path
"""
class ParserError(ValueError):
pass
class ParserError(ValueError):
pass
class Context(object):
def __init__(self,level,name,parent=None):
self.level = level
self.name = ... | nilq/baby-python | python |
from typing import ClassVar, List, Tuple
from urllib.parse import quote as http_quote
from .base import BaseProtocol
from ..types import IPAddressType
# HTTP 1.1 only
class HTTPProtocol(BaseProtocol[IPAddressType]):
ports: ClassVar[Tuple[int, ...]] = (80,)
_TYPES: ClassVar[List[bytes]] = [
b"*/*; q=0... | nilq/baby-python | python |
'''
Leia a hora inicial e a hora final de um jogo. A seguir calcule a duração do jogo, sabendo que o mesmo pode começar em um dia e terminar em outro, tendo uma duração mínima de 1 hora e máxima de 24 horas.
| Input Sample | Output Samples |
| ------------ | ----------------------- |
| 16 2 | O JOGO D... | nilq/baby-python | python |
# stdlib imports
import logging
from datetime import datetime, timedelta
# third party imports
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import (Column, Integer, Float, String,
DateTime, ForeignKey, Boolean)
from sqlalchemy import create_engine
from sqlalchemy.orm ... | nilq/baby-python | python |
# Copyright (c) Xidian University and Xi'an University of Posts & Telecommunications. All Rights Reserved
import random
from .nasbench_101_cell import Cell as Cell_101
from .nasbench_201_cell import Cell as Cell_201
from gnn_lib.data import Data
from nas_lib.utils.utils_data import nas2graph
from nas_lib.utils.predict... | nilq/baby-python | python |
'''
Utility module.
'''
import yaml
import numpy as np
swap = lambda x1, x2: (x2, x1) if x1 > x2 else (x1, x2)
square = lambda x: x**2
def read_params(file) -> dict:
'''
Read yaml file.
Args:
file (str): Path to the yaml file.
Returns:
dict: Contents of the yaml file.
'''
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Example code showing how to control Thorlabs TDC Motors using PyAPT
V1.2
20141125 V1.0 First working version
20141201 V1.0a Updated to short notation
20150324 V1.1 Added more descriptions
20150417 V1.2 Implemented motor without serial
Michael Leung
mcleung@stanford.edu
"""
# Imp... | nilq/baby-python | python |
'''
Дополните приведенный код, так чтобы он вывел сумму квадратов элементов списка numbers.
numbers = [1, 78, 23, -65, 99, 9089, 34, -32, 0, -67, 1, 11, 111]
'''
numbers = [1, 78, 23, -65, 99, 9089, 34, -32, 0, -67, 1, 11, 111]
numbers2 = []
for i in range(len(numbers)):
numbers2.append(numbers[i] ** 2)
print(sum(n... | nilq/baby-python | python |
'''
Copyright (C) 2015 Ryan Gonzalez
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, publish, distribute,... | nilq/baby-python | python |
# Generated by Django 2.2.24 on 2021-08-16 09:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('landing', '0103_policyarticle'),
]
operations = [
migrations.AddField(
model_name='section',
name='prefix',
... | nilq/baby-python | python |
class Config:
"""Discriminator configurations.
"""
def __init__(self, steps: int):
"""Initializer.
Args:
steps: diffusion steps.
"""
self.steps = steps
# embedding
self.pe = 128
self.embeddings = 512
self.mappers = 2
# blo... | nilq/baby-python | python |
'''
Simple program to gather all the internal and external links. NOT to be confused with inlinks and outlinks.
Internal links are those links that point to another website within the same domain
External links are those links that point to another website that does NOT share the same domain
Reference link: https://www... | nilq/baby-python | python |
from setuptools import setup
setup(
name='simplejira',
version='1.0',
description='simplejira',
author='Brandon Squizzato',
author_email='bsquizza@redhat.com',
url='https://www.github.com/bsquizz/simplejira',
packages=['simplejira'],
install_requires=[
'jira',
'pyyaml',
... | nilq/baby-python | python |
import requests
import jwt
import binascii
from base58 import b58decode_check
from ecdsa import SECP256k1, VerifyingKey, SigningKey
def submitTransaction(signedTransactionHex, nodeURL):
endpointURL = nodeURL + "submit-transaction"
payload = {'TransactionHex': signedTransactionHex}
response = requests.post... | nilq/baby-python | python |
"""A module that provides methods for accessing the Auth API and providing the logged in user details."""
import http
import json
import logging
import fastapi
import fastapi.security
import fastapi.security.http
import requests
from pydantic import BaseModel # pylint:disable=no-name-in-module
import config
logge... | nilq/baby-python | python |
"""
Exercise 7 - Sequence Slicing
Question: List slicing is important in various data manipulation activities. Let's do a few more exercises on that.
Please complete the script so that it prints out the first three items of list letters.
letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
Expected out... | nilq/baby-python | python |
#!/usr/bin/env python3
# (C) 2021 gomachssm
import datetime
__copyright__ = f'(C) {datetime.date.today().year} gomachssm'
__version__ = 'dummy' # get from tag, matches v([0-9]+\.[0-9]+\.[0-9]+).
__license__ = 'Apache License, Version 2.0'
__author__ = 'gomachssm'
__url__ = 'https://github.com/gomachssm/twsqlparser'... | nilq/baby-python | python |
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import standard.analysis as sa
from tools import nicename
import tools
import task
import settings
mpl.rcParams['font.size'] = 7
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
mpl.rcParams['font.family'] = 'aria... | nilq/baby-python | python |
from django.shortcuts import render , reverse
from django.http import HttpResponseRedirect
# Create your views here.
def home(request):
return render(request , 'home.html') | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Root __init__
"""
__author__ = "Samuel Marks"
__version__ = "0.0.7"
__description__ = "CLI to replace HTTP GET on GitHub API with clones"
| nilq/baby-python | python |
import logging
from clx.analytics import detector_utils as du
log = logging.getLogger(__name__)
class DetectorDataset(object):
"""
Wrapper class is used to hold the partitioned datframes and number of the records in all partitions.
"""
def __init__(self, df, batch_size):
"""This function ins... | nilq/baby-python | python |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from dataclasses import dataclass
import os
from datasets import registry as datasets_registry
from foundations import desc
fr... | nilq/baby-python | python |
import logging
import numpy as np
import paddle
from ..common import get_logger
from .var_group import *
from .pruning_plan import *
from .filter_pruner import FilterPruner
__all__ = ['L1NormFilterPruner']
_logger = get_logger(__name__, logging.INFO)
class L1NormFilterPruner(FilterPruner):
def __init__(self, mo... | nilq/baby-python | python |
# Component to translate alias values into strings
import os, re, logging, json
from pathlib import Path, PosixPath, WindowsPath
_ValAliases = {} # Keeps track of classes which have been registered
def addAliasClass(aliasClass, tag=None):
'''Add a class to the supported alias list so that the ValAlias.makeAlias
m... | nilq/baby-python | python |
import json
import multiprocessing
import os
import shutil
from typing import Dict, List, Tuple
import cv2
import numpy as np
from flask import request
from tensorpack.utils import logger
from tqdm import tqdm
from werkzeug import FileStorage
from werkzeug.utils import secure_filename
from zipfile import ZipFile
from... | nilq/baby-python | python |
import numpy
def print_table(table, path):
f = open(path, 'w')
for row in range(len(table)):
for col in range(len(table[row])):
f.write(str(table[row][col]))
f.write(' ')
print(table[row][col], end=' ')
if col == len(table[row])-1:
print("... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# created: 2021-06-30
# creator: liguopeng@liguopeng.net
import asyncio
import logging
import threading
from abc import abstractmethod
from datetime import datetime
import paho.mqtt.client as mqtt
from gcommon.server.server_config import ServerConfig
from gcommon.utils import gtime
logger =... | nilq/baby-python | python |
from scipy.optimize import minimize
from numpy.random import random
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm, ticker
from matplotlib.colors import LogNorm
import numpy as np
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from matplotlib import py... | nilq/baby-python | python |
# Generated by Django 3.0.11 on 2020-11-11 20:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_auto_20201111_1505'),
]
operations = [
migrations.AlterField(
model_name='language',
name='listing',
... | nilq/baby-python | python |
## Written by Daniel Buscombe,
## MARDA Science
## daniel@mardascience.com
##> Release v1.3 (July 2020)
###===================================================
# import libraries
import sys, getopt, json, os
# set to False if you wish to use cpu (not recommended)
##True or False
USE_GPU = True
# PREDICT = False
#
#... | nilq/baby-python | python |
"""Expected errors."""
import inspect
import sys
UNREPRODUCIBLE_SUGGESTION_TEXT = (
'Here are things you can try:\n'
'- Run outside XVFB (e.g. you will be able to see the launched program '
'on screen.) with `--disable-xvfb`, which is especially useful for '
'Chrome.\n'
'- Run with the downloaded... | nilq/baby-python | python |
import tensorflow as tf
import fire
import json
import os
import numpy as np
import tensorflow as tf
from tensorflow.python.training.input import batch
import model, sample, encoder
import model
import numpy as np
import tensorflow as tf
from tensorflow.contrib.training import HParams
def interact_model(
model_nam... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | nilq/baby-python | python |
from datetime import date, datetime
from typing import Any, Dict
from dateutil import relativedelta
from django.db.models import Sum, Count
from em.models import Account, Transaction
class AccountHelper(object):
date_fmt = '%m-%Y'
day_fmt = '%Y-%m-%d'
@staticmethod
def get_spendings(overall_expns, ... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .type_convert import anything_to_string
from .type_convert import anything_to_bytes
from .spamc_header import SpamcHeader
from .spamc_body import SpamcBody
class SpamcProtocol(SpamcHeader, SpamcBody):
def __init__(self):
super().__init__()
def cre... | nilq/baby-python | python |
#!/usr/bin/python
#
# coveragePlot.py
#
# This program generates genomic coverage plots
# Chiu Laboratory
# University of California, San Francisco
# January, 2014
#
# Copyright (C) 2014 Charles Y Chiu - All Rights Reserved
# SURPI has been released under a modified BSD license.
# Please see license file for details.
... | nilq/baby-python | python |
# *******************************************************************************
# Copyright (C) 2020-2021 INAF
#
# This software is distributed under the terms of the BSD-3-Clause license
#
# Authors:
# Ambra Di Piano <ambra.dipiano@inaf.it>
# **************************************************************************... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
class Calculator:
def __init__(self, number1, number2):
self.number1 = int(number1)
self.number2 = int(number2)
def add(self):
print(self.number1 + self.number2)
return self.number1 + self.number2
def subtract(self):
print(self.number1 - self.number2)... | nilq/baby-python | python |
from flask import Blueprint
bp = Blueprint('auth', __name__)
from diploma.auth import auth, emails, forms, routes
| nilq/baby-python | python |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
""" This is the example of input record for the test_tranform_data. """
input_test_data = [
{
"targetingCriteria": {
"include": {
"and": [
{
"or": {
... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from mm.utils.opengl import Render
from mm.utils.mesh import generateFace
from mm.models import MeshModel
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, img_as_float
if __name__ == '__main__':
# Load the first image from the video
... | nilq/baby-python | python |
import copy
from cantoolz.module import CANModule
class ecu_switch(CANModule):
name = "CAN Switch"
help = """
This module emulating CAN Switch.
Init params (example):
{
'Cabin': { # From Cabin interface
'OBD2':[ # To OBD2 allowed next ID
0x... | nilq/baby-python | python |
from collections import defaultdict
start, end = 357253, 892942
num_digits = 6
def solve(start, end, strict=False):
length = end - start
count = 0
for i in range(length):
number = start + i
previous = number % 10
consecutives = defaultdict(int)
for j in range(1, num_digit... | nilq/baby-python | python |
# -----------------------------------------------------------------------------
# NDN Repo getfile client.
#
# @Author jonnykong@cs.ucla.edu
# @Date 2019-10-24
# -----------------------------------------------------------------------------
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
imp... | nilq/baby-python | python |
import attr
import logging
from typing import Callable
from mmds.exceptions import PackageNotFoundError
try:
from PIL import Image
except:
raise PackageNotFoundError("pillow", by="rgbs modality.")
from .ts import TimeSeriesModality
logger = logging.getLogger(__name__)
dumb_image = Image.new("RGB", (32, 32))... | nilq/baby-python | python |
all_teams = ["ANC", "APO", "CSU", "GUC", "LTI", "MIN", "MRL", "NAI", "POS", "RI1", "RAK", "SOS", "ZJU"]
semi_teams = ["APO", "CSU", "GUC", "MIN", "MRL", "POS", "SOS", "ZJU"]
team_names = {
# "BAS" : "Baseline (no agents)",
"ANC" : "anct_rescue2013",
"APO" : "Apollo-Rescue",
"CSU" : "CSU-YUNLU",
"GU... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.