text stringlengths 2 999k |
|---|
import logging
import os
import aiohttp
import discord
from discord.ext import commands
PRILOG_TOKEN = os.environ["PRILOG_TOKEN"]
class PriLog(commands.Cog):
"""Prilog APIを利用します。"""
def __init__(self, bot):
self.bot = bot
self.logger = logging.getLogger('discord.PriLog')
... |
TT_INT = 'INT'
TT_FLOAT = 'FLOAT'
TT_GEO = 'GEO'
TT_STR = 'STR'
TT_IDENTIFIER = 'IDENTIFIER'
TT_LISTENER = 'LISTENER'
TT_PLUS = 'PLUS'
TT_MINUS = 'MINUS'
TT_MUL = 'MUL'
TT_DIV = 'DIV'
TT_POW = 'POW'
TT_EQUALS = 'EQUALS'
TT_DEQUALS = 'DEQUALS'
TT_NEQUALS = 'NEQUALS'
TT_LTE = 'LTE'
TT_GTE = 'GTE'
TT_LT = 'LT'
TT_GT = 'G... |
l = [10, 20, 30, 40, 50, 60]
print(f"l[:2]: {l[:2]}")
print(f"l[2:]: {l[2:]}")
print(f"l[:3]: {l[:3]}")
print(f"l[3:]: {l[3:]}")
print(f"l[2:5]: {l[2:5]}")
|
#!/usr/bin/python
from lxml import etree
from utils.misc import downloadWithProgressBar, UnicodeXMLURL, InlineAxisOperatorsURL
import json, re
from utils import mathfont
NonBreakingSpace = 0x00A0
def parseHexaNumber(string):
return int("0x%s" % string, 16)
def parseHexaSequence(string):
return tuple(map(par... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: MapServer
# Purpose: Regression test for mapio
# Author: Even Rouault
#
###############################################################################
# Copyright (c) 2... |
# -*- coding: utf-8 -*-
"""
Translate pykit types to C types.
"""
from __future__ import print_function, division, absolute_import
from pykit.types import (Boolean, Integral, Float32, Float64, Struct, Pointer,
Function, VoidT, resolve_typedef)
def c_type(type):
ty = type.__class__
i... |
from django.urls import include, path
from rest_framework import routers
from django_analyses import views
app_name = "django_analyses"
router = routers.DefaultRouter()
router.register(r"analysis", views.AnalysisViewSet)
router.register(r"analysis_version", views.AnalysisVersionViewSet)
router.register(r"category", v... |
# python3 train.py --lr_g 1e-4 --lr_d 5e-5 --gan_type wasserstein --n_epochs 250 --weight_decay 1e-4 --lamda3 0.5 --lamda1 1
# python3 train.py --lr_g 1e-4 --lr_d 5e-5 --gan_type wasserstein --n_epochs 250 --weight_decay 0 --lamda3 0.5 --lamda1 1 --lr_c 5e-4
from __future__ import print_function, absolute_import, divis... |
# -*- coding: utf-8 -*-
import sys
import os
import json
version = '0.0.0'
download_url = ''
with open(sys.argv[1]) as data_file:
data = json.load(data_file)
version = data['info']['version']
name = data['info']['name']
for i in data['releases'][version]:
if i['url'].endswith('tar.gz') or i[... |
#!/usr/bin/env python3
# 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.
# pyre-strict
import asyncio
import logging
from typing import Any, Dict, List, Optional
from fbpcs.entity.container_... |
#!/usr/bin/env python
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import random
import subprocess
import sys
import unittest
import v8_commands
import v8_foozzie
import v8_fuzz_config
impo... |
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
verbose_name = "用户管理"
def ready(self):
# 在这里配置信号量
import users.signals
|
# CIFAR10 Downloader
import logging
import pickle
import math
import os
import errno
import tarfile
import shutil
import numpy as np
import urllib3
from sklearn.model_selection import train_test_split
from utils.adapt_data import adapt_labels_outlier_task
logger = logging.getLogger(__name__)
def get_train(label=-1, ... |
from hana_ml.algorithms.pal import metrics
from hana_ml.algorithms.pal.metrics import accuracy_score
from hana_ml.algorithms.pal.neighbors import KNNClassifier
from hana_ml.ml_base import ListOfStrings
from hana_automl.algorithms.base_algo import BaseAlgorithm
class KNeighborsCls(BaseAlgorithm):
def __init__(sel... |
# -*- coding: UTF-8 -*-
import base64
import synapse.cores.common as s_cores_common
import synapse.common as s_common
import synapse.lib.types as s_types
from synapse.tests.common import *
class DataTypesTest(SynTest):
def test_datatype_basics(self):
tlib = s_types.TypeLib()
self.true(tlib.isDat... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_1_0.models.dedupe_... |
example_board = [
[1, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 4, 0, 0],
[0, 0, 0, 9, 1, 5, 0, 0, 0],
[0, 0, 4, 5, 3, 0, 0, 0, 0],
[8, 0, 0, 0, 0, 0, 3, 0, 0],
[0, 0, 6, 4, 8, 2, 1, 5, 0],
[0, 8, 0, 0, 2, 1, 6, 0, 0],
[0, 3, 0, 0, 0, 6, 0, 0, 0],
[2, 0, 5, 3, 0, 0, 8, 0, 1],
]
#... |
# coding=utf-8
# Copyright 2021 The Tensor2Tensor 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... |
import os
import argparse
import logging
import torch.nn.functional as F
import numpy as np
import pymia.data.assembler as assembler
import SimpleITK as sitk
import common.trainloop.data as data
import common.evalutation.eval as ev
import common.trainloop.steps as step
import common.trainloop.context as ctx
import co... |
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Populates an op registry for ATen ops.
Typically callers will import and use the 'populate' function to add known
o... |
#import libraries
import pygame
import random
#initialise pygame
pygame.init()
#game window dimensions
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 600
#create game window
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption('Jumpy')
#set frame rate
clock = pygame.time.Clock()
FPS = 60
... |
def _strftime(fmt, sec, min=None, hour=None, mday=None, mon=None, year=None, wday=0, yday=0, isdst=0):
"""Implementation of perl strftime"""
if min is None:
min = sec[1]
hour = sec[2]
mday = sec[3]
mon = sec[4]
year = sec[5]
sec = sec[0]
tl = _timel... |
from qmpy import *
import django.db as ddb
i = 0
for c in Calculation.objects.filter(
converged=True, label__in=["static", "standard"], formationenergy=None
):
f = c.compute_formation()
f.save()
print(f)
i += 1
if i % 1000 == 0:
ddb.reset_queries()
|
import json
from dojo.models import Finding
class HadolintParser(object):
def __init__(self, json_output, test):
tree = self.parse_json(json_output)
if tree:
self.items = [data for data in self.get_items(tree, test)]
else:
self.items = []
def parse_json(self,... |
# Copyright (c) 2020 - present Vitor Oriel <https://github.com/VitorOriel>
#
# 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 ... |
from datetime import datetime
import click
from flask.cli import with_appcontext
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, \
check_password_hash
db = SQLAlchemy()
# User
# Users and passwords
class User(UserMixin, db.Model):
... |
#!/usr/bin/python3
import feedparser
from datetime import datetime
from dateutil import parser
from configparser import ConfigParser
import sys
# Allow insecure connections to sites (especially after letsencrypt fiasco)
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
# Function grabs th... |
import torch
import torch.nn as nn
from torch.nn.modules.utils import _pair
from ..utils import ConvModule
from mmdet.core import (auto_fp16)
from ..registry import HEADS
@HEADS.register_module
class GlobalContextSemanticHead(nn.Module):
"""Simplest RoI head, with only two fc layers for semantic a... |
"""The Airly integration."""
from __future__ import annotations
from datetime import timedelta
import logging
from math import ceil
from aiohttp import ClientSession
from aiohttp.client_exceptions import ClientConnectorError
from airly import Airly
from airly.exceptions import AirlyError
import async_timeout
from ho... |
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import re
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
from cfnlint.helpers import REGEX_ALPHANUMERIC
class Name(CloudFormationLintRule):
"""Check if Mappings are ... |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoin-cli"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.... |
import os
import sys
import json
import random
from random import randint
from time import sleep
from crawler import *
# These constants are used by the application to randomily pick a number
# in between on of these ranges.
MIN_PAGE_VIEW_SLEEP = 1
MAX_PAGE_VIEW_SLEEP = 240
AVG_PAGE_VIEW_SLEEP = 120
class Simulated... |
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import logout
from django.urls import reverse
''' for email validation only
from django.contrib.auth import login
from django.contrib.sites.shortcuts import get_current_site
from django.temp... |
# -*- coding: utf-8 -*-
"""
Created by yangshuanglong@wecash.net on 2017/11/12
"""
import logging
logger = logging.getLogger(__name__)
|
# pylint: disable=invalid-name,missing-docstring
# Generated by Django 2.2.13 on 2020-06-24 02:28
from django.db import migrations
from django.db import models
import leaderboard.models
class Migration(migrations.Migration):
dependencies = [('leaderboard', '0012_auto_20200623_1629')]
operations... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""
Graph coloring
This module gathers all methods related to graph coloring. Here is what it can
do :
**Proper vertex coloring**
.. csv-table::
:class: contentstable
:widths: 30, 70
:delim: |
:meth:`all_graph_colorings` | Computes all `n`-colorings a graph
:meth:`first_coloring` | Returns the f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Mobvoi Inc. All Rights Reserved.
# Author: di.wu@mobvoi.com (DI WU)
"""Encoder definition."""
from typing import Tuple, List, Optional
import torch
from typeguard import check_argument_types
from wenet.transformer.attention import MultiHeadedAttention
f... |
import random
import discord
from discord.ext import commands
from utilities.file_data_reader import file_open_read
from utilities.persondefinition import PersonDefinition
class Person(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.color = int('f03c3c', 16)
@commands.command()
... |
# TO DO
# In compile_expression(), any other expression exits??
# Move constants/codes to new file
# " should be " ?????
from Tokenizer import Tokenizer
class ParserXML:
"""
Receives tokens from the Tokenizer, identifies grammar, and generates XML.
"""
KEYWORD = 0
IDENTIFIER = 1
SY... |
'''
Copyright (c) 2021 caoccao.com Sam Cao
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 applicab... |
from rest_framework import serializers
class TokenSerializer(serializers.Serializer):
token = serializers.CharField()
|
# Copyright 2016 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... |
import unittest
from rx import Observable
from rx.testing import TestScheduler, ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscribed
disposed = ReactiveTest.disposed
created = React... |
import argparse
import asyncio
import json
import logging
import os
import ssl
import uuid
import drowsiness_stable.dd as dd
import cv2
from aiohttp import web
from av import VideoFrame
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription
from aiortc.contrib.media import MediaBlackhole, Media... |
from hexagon import Hexagon, Color
from enum import Enum
class Direction(Enum):
up = "up"
down = "down"
left_up = "left_up"
left_down = "left_down"
right_up = "right_up"
right_down = "right_down"
class LinkedHexagon(Hexagon):
def __init__(self, value: int, color: Color = None):
s... |
"""
Defines the PaneBase class defining the API for panes which convert
objects to a visual representation expressed as a bokeh model.
"""
from __future__ import absolute_import, division, unicode_literals
from functools import partial
import param
from bokeh.io import curdoc as _curdoc
from bokeh.models.layouts imp... |
from aguaclara.design.pipeline import *
from aguaclara.core.units import unit_registry as u
import pytest
pipe_20 = Pipe(q = 20.0 * u.L / u.s, size = 6 * u.inch)
pipe_60 = Pipe(q = 60.0 * u.L / u.s, size = 6 * u.inch)
elbow_20 = Elbow(q =20.0 * u.L / u.s, size = 6 * u.inch)
elbow_60 = Elbow(q = 60.0 * u.L / u.s, size... |
from torch.utils.data import DataLoader
from sequence.data.datasets import brown
from sequence.data.utils import DatasetInference, Tokens, Language
from sequence.test import language, words, dataset, paths
import pytest
import numpy as np
import random
def test_dataset_torch_compatible(dataset):
dl = DataLoader(d... |
import os
import discord
import pickle
import re
from datetime import datetime, timedelta
import asyncio
import json
import requests
import yfinance as yf
token = os.getenv("TOKEN")
client = discord.Client()
@client.event
async def on_ready():
print("Logged in as " + str(client.user))
@c... |
#!/usr/bin/env python3
# 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 os
import shutil
import tempfile
import unittest
import PIL
from classy_vision.dataset import build_dataset
fro... |
#!/usr/bin/env python3 -u
# 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.
"""
Train a new model on one or across multiple GPUs.
"""
import collections
import math
import random
import numpy... |
import numpy as np
import pandas as pd
import sys
sys.path.append(".") # Path of xlogit library root folder.
from xlogit import MixedLogit, MultinomialLogit
print("""
**EXPECTED:
MultinomialLogit
convergence=True LL=-4958.6491193376105 electricity
convergence=True LL=-1311.9796171079972 fishing
pred pier base: 0.09... |
import os
port = 80
check_nginx_status = 'sudo netstat -ntulp | grep {} | grep nginx'.format(port)
nginx_status = os.system(check_nginx_status)
# print(nginx_status)
if nginx_status == 0:
print('OK - nginx server is working')
elif nginx_status == 256:
print('ERROR - nginx server is stopped')
else:
print... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix, f1_score
from sklearn.base import BaseEstimator
from typing import Text, Tuple
def evaluate(df= pd.DataFrame, target_column= Text, clf= BaseEstimator) -> Tuple[float, np.ndarray]:
y_test = df.loc[:, 'target'].values.astype('int32... |
"""
A restricted Hartree-Fock script using the Psi4NumPy Formalism
"""
__authors__ = "Daniel G. A. Smith"
__credits__ = ["Daniel G. A. Smith"]
__copyright__ = "(c) 2014-2017, The Psi4NumPy Developers"
__license__ = "BSD-3-Clause"
__date__ = "2017-9-30"
import time
import numpy as np
np.set_printoptions(precision=5, ... |
import cv2
#load input image
source_input = "/Users/nhant/Google Drive/OnlineLearning/selflearning_CV_with_Python/practice_sources/images/input.jpg"
image = cv2.imread(source_input)
cv2.imshow('Original', image)
cv2.waitKey()
#use cvtColor to convert to grayscale
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
... |
name = "cardiopy" |
import glob
import os
import re
import socket
import time
from xmlrpc.client import ServerProxy
import psycopg2
import ujson as json
from kombu import Connection
from kombu import Exchange
from kombu import Queue
from kombu import serialization
from kombu import uuid
from kombu.utils.compat import nested
RABBITMQ_USE... |
"""Plot commodities matrices
"""
import os
import cartopy.crs as ccrs
import pandas
from atra.utils import load_config
def main(config):
"""Read data, plot charts
"""
data_path = config['paths']['data']
od_file = os.path.join(data_path, 'usage', 'economic_od.csv')
od = pandas.read_csv(od_file)
... |
import time
import uuid
from thundra import constants
from thundra.config import config_names
from thundra.config.config_provider import ConfigProvider
from thundra.context.execution_context import ExecutionContext
from thundra.plugins.invocation import invocation_trace_support
from thundra.plugins.invocation.invocati... |
import numba
import numpy as np
import scipy as sp
from . import utils
from .CPAlgorithm import CPAlgorithm
class Surprise(CPAlgorithm):
"""Core-periphery detection by Surprise.
J. van Lidth de Jeude, G. Caldarelli, T. Squartini. Detecting Core-Periphery Structures by Surprise. EPL, 125, 2019
.. highli... |
import json
import os
from pprint import pprint
from pysnmp.hlapi.asyncio import *
from colored_print import ColoredPrint
try:
from snmp_collector.utility.utility import MWT
except:
from utility.utility import MWT
log = ColoredPrint()
__author__ = "aGn"
__copyright__ = "Copyright 2018, Planet Earth"
def f... |
import sys, os
sys.path.insert(1, os.path.join("..",".."))
import h2o
from tests import pyunit_utils
def imbalance():
print "Test checks if Deep Learning works fine with an imbalanced dataset"
covtype = h2o.upload_file(pyunit_utils.locate("smalldata/covtype/covtype.20k.data"))
covtype[54] = covtype[54].asfacto... |
import os
import pytest
import subprocess
import filecmp
import json
import os.path as op
from spot.verify_files import get_dir_dict, read_metrics_file
from spot.verify_files import checksum
from spot.verify_files import read_file_contents
from spot.verify_files import get_conditions_dict
from spot.verify_files impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
import qqbot
from qqbot.core.util.yaml_util import YamlUtil
test_config = YamlUtil.read(os.path.join(os.path.dirname(__file__), "config.yaml"))
async def _recall_handler(event, message: qqbot.Message):
msg_api = qqbot.AsyncMessageAPI(t_token, False)
... |
# 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.
#
# Description: an implementation of a deep learning recommendation model (DLRM)
# The model input consists of dense and sparse features. The ... |
import webapp2
import os,jinja2
from google.appengine.api import users
import gc
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__),'..','views')),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
def dump_garbage():
gc.collect()
res... |
from functools import lru_cache
from PoEQuery.cache import cache_results
import requests
@cache_results("ninja_overview", key=lambda league, type: (league, type))
def item_overview(league: str, type: str):
url = "https://poe.ninja/api/data/ItemOverview"
response = requests.get(url, params={"league": league, ... |
#!/usr/bin/python
# Classification (U)
"""Program: server_updmstrepstat.py
Description: Unit testing of Server.upd_mst_rep_stat in mysql_class.py.
Usage:
test/unit/mysql_class/server_updmstrepstat.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.ver... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import os
from PIL import Image, ImageDraw
def average_color_of_frame(file_path):
image = Image.open(file_path, 'r')
width, height = image.size
pixels = list(image.getdata())
r = 0
g = 0
b = 0
total_pixels = width * height
for i in range(len(pixels)):
r += pixels[i][0]
g... |
# -*- coding: utf-8 -*-
# for localized messages
from __init__ import _
import os
from enigma import eTimer
from Components.Console import Console
from Components.Harddisk import harddiskmanager #global harddiskmanager
from xml.etree.cElementTree import parse as cet_parse
XML_FSTAB = "/etc/enigma2/automounts.xml"
de... |
from picamera import PiCamera
from picamera.array import PiRGBArray
from time import sleep
import cv2
import numpy as np
# Camera Setup:
cam = PiCamera()
cam.resolution = (320,240)
cam.framerate = 32
raw = PiRGBArray(cam)
# Camera Warmup:
sleep(0.1)
for frame in cam.capture_continuous(raw,format='bgr'... |
from .get_relative_to_indices import get_relative_to_indices, get_relative_to_indices_regions
|
CRC_poly = 0x04C11DB7
def bitreverse(size, value):
out = 0
for i in range(size):
if (value & (1 << i)): out |= 1 << (size - i - 1)
return out
def create_table():
a = [0 for i in range(16)]
for i in range(16):
k = i
crc = 0
value = bitreverse(4,i)
for j in r... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from skiprnn_pytorch.rnn_cells.custom_cells import CMultiSkipLSTMCell,CSkipLSTMCell, \
CMultiSkipGRUCell, CSkipGRUCell, \
... |
"""
HX711 Load cell amplifier Python Library
Original source: https://gist.github.com/underdoeg/98a38b54f889fce2b237
Documentation source: https://github.com/aguegu/ardulibs/tree/master/hx711
Adapted by 2017 Jiri Dohnalek
This program is free software; you can redistribute it and/or modify
it under the terms of the GN... |
"""
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : __init__.py
# Abstract :
# Current Version: 1.0.0
# Date : 2021-03-19
###... |
"""
retroarch_m3u_generator
Generates M3U files from .cue files with multi-disc games
included in the same M3U. Writes out M3U files to a new ./m3u
directory within the provided source directory.
:param SourceDir: The source directory containing .cue files.
"""
import os
import os.path
from sys import arg... |
import concurrent.futures
from espionage.console.input import Input
from espionage.modules import UrlParser
from espionage.console import cDetailedDns
class DetailedDns:
"""
We will collect information about all the available domain name records. Later these records
will be sent for json and console tabl... |
import numpy as np
import pandas as pd
from PIL import Image
import matplotlib.pyplot as plt
import re
import os
def load_image(location,flatten=True):
img = None
try:
img = Image.open(location).convert('RGB')
img = img.resize((64,64))
img = np.asarray(img,dtype=np.int)
#plt.imshow(img ,interpolation='neare... |
from ptrlib import *
def set_key(key):
sock.recvuntil(">>> ")
sock.sendline("1")
sock.recvline()
sock.send(key)
def encrypt(msg):
sock.recvuntil(">>> ")
sock.sendline("2")
sock.recvline()
sock.send(msg)
sock.recvline()
return sock.recvline().rstrip()
libc = ELF("./libc-2.27.so... |
import requests
import pandas as pd
import urllib.parse
import time
import bs4
HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"
}
# base url for search companies (finanzen.net)
# note: this is only for illustrati... |
import base64
import os
from flask import Flask, request, render_template, send_from_directory
app = Flask(__name__)
def get_png_b64(): # here we encode the qr.png image to base64
with open('qr.png', 'rb') as f:
png_bytes = f.read()
png_b64 = base64.encodebytes(png_bytes)
return png_b64
# jus... |
"""
Works with flespi-connected GPS devices.
Inspired by https://www.home-assistant.io/components/device_tracker.mqtt_json/
More details about flespi on https://flespi.com/platform
"""
from __future__ import annotations
from collections.abc import Awaitable, Callable
import json
import logging
import voluptuous as vo... |
# Copyright (c) Meta Platforms, Inc. and 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
import logging
import os
from pathlib import Path
from typing import List, Optional
# pyre-ignore[21]
from utils import run... |
# Copyright 2019 kubeflow.org.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
import csv
import os
def main():
print_the_header()
filename = get_filename()
age_min, age_max = get_age_cutoff()
gender = get_gender_cutoff()
out_filename= filename+'.valid'
num_pats = 0
# Open file and start reader
with open(filename, mode="r") as handle:
... |
# coding: utf-8
# Copyright (c) 2019-2020 Latona. All rights reserved.
import os
import sys
try:
from aion.logger import lprint
except:
lprint = print
import numpy as np
import cv2
# CONST PARAMETER
DETECT_ABNORMAL_RATIO = 0.3
ABNORMAL_THRESHOLD_BASE = 38
ABASE = ABNORMAL_THRESHOLD_BASE
ENV_TEMP_XP = [0, 5... |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from . import option_list
def test_tf_import():
"""
Tests if tensorflow can be imported, returns if it went okay and optional error.
"""
try:
import tensorflow # noqa
return True
... |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="width", parent_name="sunburst.marker.line", **kwargs
):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=pa... |
import os
from flask import Flask
from flask_marshmallow import Marshmallow
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
# instantiate the db
db = SQLAlchemy()
ma = Marshmallow()
migrate = Migrate()
def create_app(script_info=None):
# instantiate the app
app = Flask(__name__)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""From the package "python3.6-examples" in the Ubuntu repositories.
Minor modifications for :mod:`flake8`, :mod:`pydocstyle` etc.
Mar 10, 2019:
Added logging.
Make a copy of a directory tree with symbolic links to all files in the
original tree.
All symbolic links... |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outp... |
import os
import pymongo
import datetime
import requests
import urllib.parse
from twilio.twiml.messaging_response import MessagingResponse
from bson.objectid import ObjectId
from flask import Flask, request
from flask import send_file
from twilio.rest import Client
from io import BytesIO
from PIL import Image
app = F... |
#!/usr/bin/env python
from setuptools import setup
setup(
name="pyporscheconnectapi",
version="0.0.17",
author="Johan Isaksson",
author_email="johan@generatorhallen.se",
description="Python library and CLI for communicating with Porsche Connect API.",
include_package_data=True,
url="https:... |
import os
import sys
from pathlib import Path
from PIL import Image
import pytest
import numpy as np
from imagededup.methods.hashing import Hashing, PHash, DHash, AHash, WHash
p = Path(__file__)
PATH_IMAGE_DIR = p.parent / 'data/mixed_images'
PATH_IMAGE_DIR_STRING = os.path.join(os.getcwd(), 'tests/data/mixed_image... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.