content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
# # Copyright 2018 Analytics Zoo 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 to...
nilq/baby-python
python
""" Code is generated by ucloud-model, DO NOT EDIT IT. """ import pytest import logging from ucloud.core import exc from ucloud.testing import env, funcs, op, utest logger = logging.getLogger(__name__) scenario = utest.Scenario(279) @pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason()) def test_set_279(...
nilq/baby-python
python
# deliverable_spec.py # This file is auto-generated from the same code that generates # https://docs.patreon.com. Community pull requests against this # file may not be accepted. import pytest from patreon.schemas import deliverable @pytest.fixture def attributes(): return [ 'completed_at', 'deli...
nilq/baby-python
python
from base_automation import BaseAutomation from lib.core.monitored_callback import monitored_callback HOME_ZONE = "home" AWAY = "not_home" MESSAGE_LEFT_ZONE = "{} left {}" MESSAGE_ARRIVED_ZONE = "{} arrived {}" class ZoneChangeNotificationAutomation(BaseAutomation): def initialize(self): # args ...
nilq/baby-python
python
"""All widgets related to editing channels are here.""" from PyQt4 import QtGui, QtCore from ..ramps import Channel from CommonWidgets import QMultipleSpinBoxEdit, QNamedPushButton import rampage.format as fmt class QEditChannelInfoDialog(QtGui.QDialog): """Dialog to edit channel info. This dialog is called...
nilq/baby-python
python
import os import bpy import bpy_extras from ... import ops, plugin, plugin_prefs, registry, utils from ...version_utils import assign_props, IS_28 from .. import imp from . import utils as imp_utils, props op_import_object_props = { 'filter_glob': bpy.props.StringProperty( default='*.object', options={'...
nilq/baby-python
python
# Copyright (c) 2011-2020 Eric Froemling # # 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,...
nilq/baby-python
python
import shutil import optparse from os import listdir, mkdir from os.path import abspath, join, exists from codecs import open from lxml import etree from math import floor def voc2yolo(output_p, imgs_p, labels_p, split_ratios = None): img_filetype = ['.jpg', '.jpeg', '.png', '.tiff', '.tif'] classes_name = {}...
nilq/baby-python
python
from flask_wtf import FlaskForm from wtforms import SelectMultipleField, StringField, SubmitField, \ TextAreaField, ValidationError from wtforms.validators import DataRequired, Optional class GroupForm(FlaskForm): """Main form for Group GUI""" name = StringField('Name', validators=[DataRequired()]) de...
nilq/baby-python
python
from face_api.views import FaceApi from django.urls import path,include urlpatterns = [ path('',FaceApi.as_view()) ]
nilq/baby-python
python
from time import sleep print('CONTAGEM REGRESSIVA') for c in range(10, -1, -1): print(c) sleep(1) print('KABUM!!!')
nilq/baby-python
python
# -*- coding: utf-8 -*- from .didtx import ItemFromConfirmationId, ItemFromDid, Create, RecentItemsFromDid from .did_document import GetDidDocumentsFromDid, GetDidDocumentsFromCryptoname from .servicecount import GetServiceCountSpecificDidAndService, GetServiceCountAllServices
nilq/baby-python
python
import sys import argparse import collections from os import remove, path from subprocess import call def _compress_png(source_path, destination_path, is_quantization_allowed): PNG_CRUSH_TOOL = "./lib/pngcrush_1_8_11_w64.exe" PNG_QUANT_TOOL = "./lib/pngquant.exe" png_crush_source = source_path tempora...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from dehazer.core.DarkChannel import getDarkChannel def getTransmission(I, A, w=0.95, patchSize=15): """ Get the transmission t of the RGB image data from a numpy array # Arguments - I: 3 * M * N numpy array of the input image, whe...
nilq/baby-python
python
import telebot TOKEN = None with open("token.txt") as f: TOKEN = f.read().strip() bot = telebot.TeleBot(TOKEN) @bot.message_handler(commands=['help']) def send_welcome(message): bot.reply_to(message, "sorry. v1.1 it's not finish") bot.polling()
nilq/baby-python
python
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
nilq/baby-python
python
n = float(input('A number: ')) if n%2 == 0: print ('Even') else: print ('Odd')
nilq/baby-python
python
from machine import UART, Pin import time from httpParser import HttpParser ESP8266_OK_STATUS = "OK\r\n" ESP8266_ERROR_STATUS = "ERROR\r\n" ESP8266_FAIL_STATUS = "FAIL\r\n" ESP8266_WIFI_CONNECTED="WIFI CONNECTED\r\n" ESP8266_WIFI_GOT_IP_CONNECTED="WIFI GOT IP\r\n" ESP8266_WIFI_DISCONNECTED="WIFI DISCONNECT\r\n" ESP826...
nilq/baby-python
python
from easydict import EasyDict from copy import deepcopy hopper_dt_config = dict( exp_name='hopper_medium_expert_dt_seed0', env=dict( env_id='Hopper-v3', norm_obs=dict(use_norm=False, ), norm_reward=dict(use_norm=False, ), collector_env_num=1, evaluator_env_num=8, ...
nilq/baby-python
python
# import libraries import urllib2 import json #retrieve the information of a character an parse it into an character object name.data def getCharacter(name): Char = [] name = name.replace(' ', '+') charUrl = 'https://api.tibiadata.com/v2/characters/' + name + '.json' charPage = urllib2.urlopen(charUrl)...
nilq/baby-python
python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import logging import typing from collections import defaultdict import torch.nn as nn from .jit_handles import ( addmm_flop_jit, conv_flop_jit, einsum_flop_jit, get_jit_model_analysis, matmul_flop_jit, ) # A dictionary that ...
nilq/baby-python
python
from direct.directnotify import DirectNotifyGlobal from otp.chat.TalkAssistant import TalkAssistant from otp.chat.ChatGlobals import * class TTTalkAssistant(TalkAssistant): notify = DirectNotifyGlobal.directNotify.newCategory('TTTalkAssistant') def sendToonTaskSpeedChat(self, taskId, toNpcId, toonProgress, ms...
nilq/baby-python
python
import logging from aiocron import crontab @crontab("*/1 * * * *") def test_task(): logging.debug("Example task")
nilq/baby-python
python
#!/usr/bin/env python ''' Project: Geothon (https://github.com/MBoustani/Geothon) File: Vector/shp_info.py Description: This code gives shapefile information. Author: Maziyar Boustani (github.com/MBoustani) ''' try: import ogr except ImportError: from osgeo import ogr #example shapefi...
nilq/baby-python
python
import tkinter as Tk import sys sys.path.append("/Users/PeterLevett/Documents/My Actual Documents/SideProjects/ORDERM8/ORDERM8_V2/SQL_functions") import editentry class CustomerpageWindow(Tk.Frame): def __init__(self, parent): Tk.Frame.__init__(self, parent) self.parent = parent self.basic...
nilq/baby-python
python
from fractions import Fraction as fr, gcd def cancel_digits(num, den): is_cancelled = False numstr, denstr = str(num), str(den) for i in range(len(numstr)): for j in range(len(denstr)): if numstr[i] == denstr[j] and numstr[i] != '0': is_cancelled = True n...
nilq/baby-python
python
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' Layer ''' import poller class Layer(poller.Callback): ''' Classe abstrata herdeira de poller.Calback para acrescentar camadas ao protocolo ''' def __init__(self): self._top = None self._bottom = None def setBottom(self, bottom)...
nilq/baby-python
python
""" Orkut OAuth support. This contribution adds support for Orkut OAuth service. The scope is limited to http://orkut.gmodules.com/social/ by default, but can be extended with ORKUT_EXTRA_SCOPE on project settings. Also name, display name and emails are the default requested user data, but extra values can be specifie...
nilq/baby-python
python
import os.path import tempfile from youtube_dl import YoutubeDL def download_subtitles(video_id, lang): temp_dir = tempfile.gettempdir() file_name = f'{temp_dir}/{video_id}.{lang}.vtt' def read_file(): with open(file_name) as file: return file.read() if os.path.isfile(file_name)...
nilq/baby-python
python
"""MongoDB related commands for dhutil's CLI.""" import click from dhutil.drive_ops import ( sync_google_drive_acceptance_status_to_mongo, sync_uptodate_teams_from_mongo, send_conf_confirm_emails, ) @click.group(help="Google Drive related commands.") def drive(): """Google Drive related commands."""...
nilq/baby-python
python
from battleship.interface.tty import TTY from battleship.player.player import Player __author__ = 'jitrixis' class BattleShip: def __init__(self): self.__players = (Player(), Player()) TTY.cls() TTY.player_show_turn('PLAYER 1') self.__players[0].view_set_name() self.__pla...
nilq/baby-python
python
# various Amiga Math utils import struct import math def int32(x): st = struct.pack("I", x) return struct.unpack("i", st)[0] def int16(x): st = struct.pack("H", x) return struct.unpack("h", st)[0] def int8(x): st = struct.pack("B", x) return struct.unpack("b", st)[0] def signext16(x): ...
nilq/baby-python
python
from .consts import ActionType, ClaimingType, TILE_SET from .player_data import Action, Claiming str2act_dict = { 'PASS': ActionType.PASS, 'DRAW': ActionType.DRAW, 'PLAY': ActionType.PLAY, 'CHI': ActionType.CHOW, 'PENG': ActionType.PUNG, 'GANG': ActionType.KONG, 'BUGANG': ActionType.MELD_KO...
nilq/baby-python
python
import logging import requests from collections import namedtuple from contextlib import suppress from getpass import getuser from re import DOTALL, IGNORECASE, MULTILINE, compile as Regex from time import time, ctime from tkinter import _default_root,...
nilq/baby-python
python
"""Tests API to manage moderators.""" import json from django.contrib.auth import get_user_model from django.test import TestCase from machina.apps.forum_permission.shortcuts import assign_perm from ashley import SESSION_LTI_CONTEXT_ID from ashley.defaults import _FORUM_ROLE_MODERATOR from ashley.factories import For...
nilq/baby-python
python
""" 33. How to import only every nth row from a csv file to create a dataframe? """ """ Difficiulty Level: L2 """ """ Import every 50th row of BostonHousing dataset as a dataframe. """ """ """
nilq/baby-python
python
""" Example prediction file. """ import os import torch import csv import logging import hydra from tmb.data import AcclerationDataSetSchmutter from tmb.model import FC_FFT from sklearn.preprocessing import MaxAbsScaler from hydra.core.config_store import ConfigStore from config import tmbConfig from pathlib import ...
nilq/baby-python
python
from django.apps import AppConfig class SerialConfig(AppConfig): name = "controllers.serial"
nilq/baby-python
python
from typing import NamedTuple, Dict, List, Tuple import re from collections import defaultdict class Bag(NamedTuple): color: str contains: Dict[str, int] def parse_line(line: str) -> Bag: part1, part2 = line.split(" contain ") color = part1[:-5] part2 = part2.rstrip(".") if part2 == "no oth...
nilq/baby-python
python
import torchvision import os # 通过压缩包格式获得训练集和测试集的图片和相应标签 # 训练集图片在data\train_pic中,标签在data\train_label.txt # 测试集图片在data\test_pic中,标签在data\test_label.txt # 其中,标签数据用‘,’分隔,图片以i.jpg的方式进行存储,它代表标签文件的第i个数据就是这张图片的标签 def data_visual(): mnist_train=torchvision.datasets.MNIST('./data',train=True,download=True)#首先下载数据集,并数据分割成训练集...
nilq/baby-python
python
""" Python utilities to use it from ein.el Copyright (C) 2012- Takafumi Arakaki Author: Takafumi Arakaki <aka.tkf at gmail.com> ein.py 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 Lic...
nilq/baby-python
python
#!/usr/bin/env python import os import sys if __name__ == "__main__": if "DJANGO_SETTINGS_MODULE" not in os.environ: sys.exit("Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined") try: from django.core.management import execute_from_command_line ex...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('mapApp', '0006_auto_20150820_1631'), ] operations = [ migrations.RenameField( model_name='weather', ...
nilq/baby-python
python
from __future__ import unicode_literals from .quicksectx import Interval, IntervalNode, IntervalTree, distancex from .version import __version__
nilq/baby-python
python
from pydantic.dataclasses import dataclass from typing import List from .cost_center import CostCenter @dataclass class CostCenters: offset: int limit: int cost_centers: List[CostCenter]
nilq/baby-python
python
from contextlib import contextmanager import logging @contextmanager def all_logging_disabled(highest_level=logging.CRITICAL): """ A context manager that will prevent any logging messages triggered during the body from being processed. :param highest_level: the maximum logging level in use. This...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Wed Jun 26 14:24:59 2019 @author: chalbeisen This program is used for saving filenames of .wav files which are already downloaded into a numpy file """ import numpy as np import os import re #global variables #audio_src defines directory where .wav files are saved...
nilq/baby-python
python
import common.networking as networking from tqdm import tqdm from multiprocessing import Process, Manager, Semaphore from pymongo import MongoClient import os import zlib import re import Levenshtein from datetime import datetime # Compare the levenshtein distance difference percentage with threshold def compare_diff...
nilq/baby-python
python
import torch.nn as nn import torch.utils.model_zoo as model_zoo from utils import utils __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch....
nilq/baby-python
python
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
nilq/baby-python
python
name = "aoc_utils"
nilq/baby-python
python
import random import torch from collections import namedtuple Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward')) class ReplayMemory(object): def __init__(self, args, capacity): self.device = args.device self.capacity = capacity self.transitions = [] ...
nilq/baby-python
python
import argparse import json import pandas as pd from detoxify.bias_metrics import ( IDENTITY_COLUMNS, MODEL_NAME, TOXICITY_COLUMN, calculate_overall_auc, compute_bias_metrics_for_model, convert_dataframe_to_bool, get_final_metric, ) def main(): with open(TEST) as f: results = ...
nilq/baby-python
python
#%% import pandas as pd from pandas.core.frame import DataFrame import requests from bs4 import BeautifulSoup import Levenshtein as lev # %% # 검색 결과 불러오기 search_result = pd.read_csv("Web Crawling Data/메뉴검색결과.csv", index_col=0) search_result # %% # 정규 표현식을 통한 한글 외 문자 제거 search_result['검색결과'] = search_result['검색결과'].st...
nilq/baby-python
python
from discord import TextChannel, Role, User, utils from discord.ext.commands import Cog, Context, group, check, guild_only from bot.core.bot import Bot class Dungeon(Cog): """Quarantine the users with an account less than specified days of creation.""" def __init__(self, bot: Bot) -> None: self.bot =...
nilq/baby-python
python
import numpy import perfplot def test(): kernels = [lambda a: numpy.c_[a, a]] r = [2**k for k in range(4)] out = perfplot.bench( setup=numpy.random.rand, kernels=kernels, labels=['c_'], n_range=r, xlabel='len(a)' ) out.show() out = perfplot.bench( setup=numpy.rando...
nilq/baby-python
python
from sympy import I, Matrix, symbols, conjugate, Expr, Integer from sympy.physics.quantum.dagger import Dagger def test_scalars(): x = symbols('x',complex=True) assert Dagger(x) == conjugate(x) assert Dagger(I*x) == -I*conjugate(x) i = symbols('i',real=True) assert Dagger(i) == i p = symbol...
nilq/baby-python
python
import handler.handler as handler class ScalingHandler(handler.TemplateHandler): """ ScalingHandler inherits from the hander.TemplateHandler class. It displays an information page about scaling up a web application. """ def get(self): self.render("scaling.html")
nilq/baby-python
python
""" Database description. Session is performed by a subject. Session has multiple blocks. Block has multiple trials. Sessions, blocks, and trials have events of certain event type at certain time. Trial has parameters. """ import os import sys from sqlalchemy import Column, ForeignKey, Integer, String, Float, DateTi...
nilq/baby-python
python
import client new_client = client.Client(observations='Billy/#nHello Billy') print(new_client.encode_observations()) print(new_client.decode_observations(new_client.observations)) print(new_client.observations)
nilq/baby-python
python
import tkinter as tk from tkinter import * from tkinter.ttk import * from datetime import datetime, timedelta, date from app.models import session from app.models.booking import Booking from app.models.returns import Returns from app.models.tools import Tools from app.models.users import Users class Bookings(tk.Fram...
nilq/baby-python
python
#coding:utf-8 """DjangoAdmin URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name...
nilq/baby-python
python
""" Encountering some difficulties getting pytest to generate standard logging files. Exploring here """ import logging def test_logfile(): logging.log(logging.INFO, 'whattup test')
nilq/baby-python
python
# coding=utf-8 from mxnet.gluon import nn from .base import SegBaseResNet from mxnetseg.nn import FCNHead, PPModule from mxnetseg.utils import MODELS @MODELS.add_component class PSPNet(SegBaseResNet): """ Dilated ResNet50/101/152 based PSPNet. Reference: Zhao, H., Shi, J., Qi, X., Wang, X., &...
nilq/baby-python
python
#!/usr/bin/env python """ Write a Python script in a different directory (not the one containing mytest). a. Verify that you can import mytest and call the three functions func1(), func2(), and func3(). b. Create an object that uses MyClass. Verify that you call the hello() and not_hello() methods. """ impor...
nilq/baby-python
python
from django.contrib import admin from api.models import Category, Comment, Genre, Review, Title admin.site.register(Category) admin.site.register(Genre) admin.site.register(Title) admin.site.register(Comment) admin.site.register(Review)
nilq/baby-python
python
class Temperature: def __init__(self, value, scale): self.value = value self.scale = scale if scale == "C": self.value_kelvin = value + 273.15 elif scale == "F": self.value_kelvin = (value - 32) * 5 / 9 + 273.15 def __repr__(self): return f"Temper...
nilq/baby-python
python
import numpy as np from scipy.sparse.linalg import svds from numpy_groupies import aggregate # for accumarray type functionality import sparse def sparse_unfold(data, mode): ''' Unfolding of a sparse tensor ''' data = data.copy() # first step: swap axis with first if mode != 0: row_mode...
nilq/baby-python
python
import os import math import json import shutil import tempfile import subprocess import numpy as np from celery import shared_task from PIL import Image, ImageDraw from imagekit.utils import open_image, save_image from pilkit.utils import extension_to_format from pilkit.processors import ResizeToFit from django.db.m...
nilq/baby-python
python
from collections import namedtuple from unittest.mock import MagicMock, patch, PropertyMock from onap_data_provider.resources.esr_system_info_resource import ( CloudRegion, EsrSystemInfoResource, ) ESR_RESOURCE_DATA = { "esr-system-info-id": "Test ID", "user-name": "Test name", "password": "testp...
nilq/baby-python
python
import urwid class UserInfoBar(urwid.Text): PARTS = ( ('name', '{u.name}'), ('level', '{s.level} level'), ('hp', '{s.hp}/{s.max_hp} hp'), ('exp', '{s.exp}/{s.max_exp} exp'), ('mp', '{s.mp}/{s.max_mp} mp'), ('gold', '{s.gold:.2f} gold'), ) @classme...
nilq/baby-python
python
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import json; from pprint import pprint Settings = json.load(open('settings.txt')) import matplotlib.pyplot as plt import numpy as np import sys sys.path.insert(0,'../') from os.path import isdir root = Settings['data_root'] from pak.datasets.CAD_...
nilq/baby-python
python
class Counter: def __init__(self): self.count = 0 def count_up(self, channel): self.count += 1 print('GPIO%02d count=%d' % (channel, self.count)) def __eq__(self, other): return self.count == other def __lt__(self, other): return self.count < other def main()...
nilq/baby-python
python
import cv2 as cv import time import datetime import requests import json import pathlib import re API_ROUTE_URL = "http://localhost:5000/sendEmail" SECONDS_TO_RECORD_AFTER_DETECTION = 15 SECONDS_BETWEEN_RECORDINGS = 60 def drawRectangle(obj, frame): for (x, y, width, heigth) in obj: cv.rectangle(frame, (x...
nilq/baby-python
python
"""Optimizer for inlining constant values.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import ast from ..asttools import name as nametools from ..asttools import visitor from ..astwrappers import name as namew...
nilq/baby-python
python
from ctypes import * from vcx.common import do_call, create_cb, error_message from vcx.error import VcxError, ErrorCode from vcx.api.vcx_base import VcxBase import json class Schema(VcxBase): """ Object that represents a schema written on the ledger. Attributes: source_id: user generated unique ...
nilq/baby-python
python
# import socket # import time # from threading import * # def send_message(str): # s.send(str.encode()) # # data = '' # # data = s.recv(1024).decode() # # print (data) # print("START") # # Initialize host and port # host = "10.0.0.1" # port = 8000 # print (host) # print (port) # # Initialize windo...
nilq/baby-python
python
import json import click import pandas as pd @click.command() @click.argument('jsonfile') @click.argument('outfile') def main(jsonfile, outfile): with open(jsonfile, "r") as f: features = json.load(f)["features"] data = pd.DataFrame(None, index=range(len(features)), columns=["Name", "Long", "Lat"]) ...
nilq/baby-python
python
''' Vector Space Model stuff ''' from .base import Space, AggSpace from .mmspace import MMSpace import sim __all__ = ['Space', 'AggSpace', 'MMSpace']
nilq/baby-python
python
import os import redis from flask import Flask, g from flask_bootstrap import Bootstrap from app.facility_loader import load_facilities from app.mod_api import mod_api from app.mod_frontend import mod_frontend def create_app(config_filename): """Creates and initialize app. :param config_filename: Config to...
nilq/baby-python
python
"""Runs tests (encapsulated in a Test class) and documents results in `test_output/logs.txt`""" from datetime import datetime # for recording data and time of tests from selenium import webdriver # for testing web app import sqlite3 # for testing database import os # for navig...
nilq/baby-python
python
# coding: utf-8 """ HPC Web API Preview # noqa: E501 OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import hpc_acm from hpc_acm.api.default_api import DefaultApi # noqa: E501 from hpc_a...
nilq/baby-python
python
from export_env_variables import * import os import sys from os import path from utils import * from defs import * import shutil def save_logs_recursively(logs_root, dst_folder_name): if not path.exists(logs_root): print(logs_root + " doesn't exist") return logs_root_basename ...
nilq/baby-python
python
from __future__ import print_function import logging from ..address_translator import AT l = logging.getLogger('cle.backends.relocation') class Relocation(object): """ A representation of a relocation in a binary file. Smart enough to relocate itself. :ivar owner_obj: The binary this relocation wa...
nilq/baby-python
python
from __future__ import absolute_import import os from willow.image import Image, RGBImageBuffer def _cv2(): try: import cv2 except ImportError: from cv import cv2 return cv2 def _numpy(): import numpy return numpy class BaseOpenCVImage(Image): def __init__(self, image, si...
nilq/baby-python
python
# Django settings for clickwork project. import os DEBUG = True TEMPLATE_DEBUG = DEBUG try: from local_settings import BASE_PATH except ImportError: BASE_PATH = '.' ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASES = { "default": { "NAME": "default_db", ...
nilq/baby-python
python
import scipy.spatial.distance as distance import numpy as np import cPickle as pkl import os import sys root_dir = 'home_directory/VIC/track3/new_15000' fea_dir = os.path.join(root_dir, 'filtered_mot_mean_features') dis_dir = os.path.join(root_dir, 'filtered_mot_distances') # if not os.path.exists(fea_dir): # os.m...
nilq/baby-python
python
import numpy from chainer import cuda from chainer import function from chainer.utils import type_check class EmbedIDFunction(function.Function): def check_type_forward(self, in_types): type_check.expect(in_types.size() == 2) x_type, w_type = in_types type_check.expect( x_typ...
nilq/baby-python
python
from chainmodel.models.steem.operation import Operation class RequestAccountRecovery(Operation): tx_involves = ['account_to_recover', 'recovery_account'] tx_originator = 'account_to_recover'
nilq/baby-python
python
# Import standard Python Modules import sys import os import datetime # Import paho MQTT Client import paho.mqtt.client as mqtt # Import RPi.GPIO Module try: import RPi.GPIO as GPIO except RuntimeError: print("Error importing RPi.GPIO! This is probably because you need \ superuser privileges. You can achieve \ ...
nilq/baby-python
python
import sys import cv2 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import QPalette, QBrush, QPixmap import os scanning_face_path = os.path.join(os.path.dirname(__file__),'fw\FaceSwap') sys.path.append(scanning_face_path) from scanning_face impor...
nilq/baby-python
python
import logging import time from enum import Enum from iot.devices import DeviceType from iot.devices.base.multimedia import ( MultimediaKeyboardInterface, MultimediaDevice ) from iot.devices.errors import ( CommandNotFound, InvalidArgument, BrandNotFound ) logger = logging.getLogger(__name__) clas...
nilq/baby-python
python
#!/usr/bin/python # # Copyright 2014 University of Southern California # # 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
import setuptools from ipregistry import __version__ with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="ipregistry", version=__version__, author="Ipregistry", author_email="support@ipregistry.co", description="Official Python library for Ipregistry", l...
nilq/baby-python
python
from .openchemistryquery import OpenChemistryQuery, DEFAULT_BASE_URL
nilq/baby-python
python
""" QEMU machine module: The machine module primarily provides the QEMUMachine class, which provides facilities for managing the lifetime of a QEMU VM. """ # Copyright (C) 2015-2016 Red Hat Inc. # Copyright (C) 2012 IBM Corp. # # Authors: # Fam Zheng <famz@redhat.com> # # This work is licensed under the terms of the...
nilq/baby-python
python
import os import json import numpy as np import pandas as pd import time from hydroDL import kPath, utils from hydroDL.data import usgs, transform, dbBasin import statsmodels.api as sm sn = 1e-5 def loadSite(siteNo, freq='D', trainSet='B10', the=[150, 50], codeLst=usgs.varC): dirRoot = os.path.join(kPath.dirWQ, ...
nilq/baby-python
python
from django.urls import path from . import views urlpatterns = [ path('payment/status/', views.PaycommitView.as_view()), path('payment/<order_id>/', views.PayURLView.as_view()), ]
nilq/baby-python
python
# generate a random topo import sys import os import random import json class Node(): def __init__(self, nodeid): self.nodeid = nodeid self.neighbors = {} def connect(self, node, weight): self.neighbors[node.nodeid] = weight def topo_to_file(topo): buff = '' size = len(topo) ...
nilq/baby-python
python
#!/usr/bin/env python import os import click import clio # These would be ideally stored in some secure persistence accessToken = '' refreshToken = '' @click.group() @click.option('--debug/--no-debug', default=False) def cli(debug): click.echo(f"Debug mode is {'on' if debug else 'off'}") @cli.command() @click.op...
nilq/baby-python
python