content stringlengths 5 1.05M |
|---|
import peo_pycuda.chordal_gen as cg
for i in range(10):
n = (i+1) * 10
G = cg.generateChordalGraph(n, 0.5)
cg.exportGraphCsr(G, filename="graph_"+str(n)+".txt") |
# -*- coding: utf-8 -*-
"""
Created on Mon May 18 01:59:23 2020
@author: dreis
"""
import datetime
import time
def met_append():
caminho = open(r'C:\Users\dreis\Desktop\Estudos\Projetos\words.txt', 'r')
t = list()
for palavra in caminho:
t.append(palavra.strip())
return t
def met_mais():
... |
# Copyright (C) 2018 Pierre Jean Fichet
# <pierrejean dot fichet at posteo dot net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE I... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: query/query.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... |
'''
Created on Jul 23, 2021
@author: mballance
'''
class WildcardBinFactory(object):
@classmethod
def str2bin(cls, val) -> tuple:
# val is string in oct, hex, or bin
value = 0
mask = 0
if val.startswith("0o") or val.startswith("0O"):
# octal format
... |
from ...UI.Base import Document
from ...UI.Elements import div,img,label
from ...Core.DataTypes.UI import EventListener
from ...UI.CustomElements import AspectRatioPreservedContainer
class MainMenu(Document):
Name = "Pong/MainMenu"
StyleSheet = "Styles/MainMenu/MainMenu.json"
ResourceKey = "MainMenu"
d... |
from typing import Dict, Any
import pandas as pd
import streamlit as st
import core.formatter as fm
def _impact_results(impact: Dict[str, str]) -> None:
"""
Reports impact of current filters vs. original table.
:param impact: Dictionary with filter and value.
:return: None
"""
df = pd.DataFra... |
import threading as thr
import huion.daemon.daemon as daemon
import huion.events.buttons as buttons
import huion.events.touchstrip as touchstrip
import huion.gui.gui as gui
class Main:
def __init__(self):
self.gui = gui.Gui()
self.buttons = buttons.Buttons(self.gui)
self.touchstrip = touchstrip.Touchstr... |
from __future__ import generators
from spark.internal.version import *
from spark.internal.parse.usagefuns import *
from spark.pylang.implementation import Imp
from spark.internal.common import SOLVED
################################################################
# Conditional
class IfOnce(Imp):
__slo... |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... |
from fractions import Fraction
def sum_fracts(lst):
res = 0
for i in lst:
res =res + Fraction(i[0],i[1])
if res.numerator == 0:
return None
if res.denominator != 1:
return [res.numerator, res.denominator]
else:
return res.numerator
def sum_fractsB(lst):
... |
"""
File storage config
"""
from django_cleanup.signals import cleanup_pre_delete
from storages.backends.s3boto3 import S3Boto3Storage
class MediaStorage(S3Boto3Storage):
location = "media"
def sorl_delete(**kwargs):
"""
Function to delete thumbnails when deleting the original photo
"""
from so... |
"""
Mapsforge map file parser (for version 3 files).
Author: Oliver Gerlich
References:
- http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile
- http://mapsforge.org/
"""
from hachoir.parser import Parser
from hachoir.field import (Bit, Bits, UInt8, UInt16, UInt32, Int32, UInt64, String,
... |
"""Sets the version number of paci."""
__version__ = "1.10.5"
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.model.naming import set_name_by_naming_series
from frappe import _, msgprint
import frappe.defaults
from frappe.ut... |
#!/usr/bin/env python
# Copyright 2017 Calico 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
from django.contrib import admin
from django.contrib import admin
from .models import Budget, Transaction
# Register your models here.
admin.site.register((Budget, Transaction)) |
import sys
V = [0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f, 0x41, 0x2c, 0x2e,
0x69, 0x79, 0x65, 0x77, 0x72, 0x6b, 0x6c, 0x64, 0x4a, 0x4b, 0x44,
0x48, 0x53, 0x55, 0x42, 0x73, 0x67, 0x76, 0x63, 0x61, 0x36, 0x39,
0x38, 0x33, 0x34, 0x6e, 0x63, 0x78, 0x76, 0x39, 0x38, 0x37, 0x33,
0x32, 0x35, 0x34, 0x6b,... |
#! /usr/bin/python
import sys
fo = open(sys.argv[1])
ifo = iter(fo)
size = 0
num = 0
for line in ifo:
num += 1
size += len(line)
print size, num
|
from typing import List
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
missing = duplicated = 0
for i, num in enumerate(nums):
val = abs(num)
duplicated ^= (i+1) ^ val
index = val - 1
if nums[index] < 0:
missi... |
#!/usr/bin/env
"""
ConfigParser.py
Parse .pyini files (custom generated user ini files)
These files are JSON created and are flat files which can be edited by any text reader
Using Anaconda packaged Python
"""
#System Stack
import json
import sys
def get_config(infile):
""" Input - full path to config fil... |
import numpy as np
import torch
from scipy.integrate import solve_ivp
from experiments.hnn.data import plot_test2, integrate_model, plot_training2, get_dataset_osc
from experiments.hnn.data import m, g
from modelzoo.hnn import HNN, MLP
def train(args):
# set random seed
torch.manual_seed(args.seed)
np.ra... |
"""A set of views every cart needs.
On success, each view returns a JSON-response with the cart
representation. For the details on the format of the return value,
see the :meth:`~easycart.cart.BaseCart.encode` method of the
:class:`~easycart.cart.BaseCart` class.
If a parameter required by a view is not present in th... |
from alsaaudio import Mixer
from datetime import datetime
import i3ipc
import re
import socket
import struct
import subprocess
from time import time
import gi
gi.require_version('Playerctl', '1.0')
from gi.repository import Playerctl
import sys
class Base:
is_callback_block = False
display = True
def _... |
from colusa.etr import Extractor, register_extractor
@register_extractor('//xp123.com')
class XP123Extractor(Extractor):
def _find_main_content(self):
return self.bs.find('article', attrs={'class': 'post'})
def cleanup(self):
self.remove_tag(self.main_content, 'header', attrs={'class': 'entry... |
import unittest
import time
from .lrucache import LRUCache, CacheData
class LRUCacheTest(unittest.TestCase):
def test_get1(self):
count = 0
def dummyLoadCB(key):
nonlocal count
count += 1
return {"mydata": key}
cache = LRUCache(dummyLoadCB, 0.5)
v... |
import json
from gevent import monkey
monkey.patch_all()
import base64
import requests
import time
from gevent.pool import Pool
import argparse
parser = argparse.ArgumentParser(description='Inferenc Server: Client')
parser.add_argument('--url', type=str, default='http://localhost:8000/predict', help='test server')
p... |
import argparse
import math
import numpy as np
import os
import pandas as pd
import sys
import yaml
## valid workflow id and minimum versions supported
VALID_WORKFLOWS = {
162: 16.67, ## 'NerveMarking1'
}
TASK_KEY_DISK_BOX = (162, 'T1')
TASK_KEY_MARK_FOVEA = (162, 'T3')
TASK_KEY_CUP_BOUNDAR... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import time
import redis
from ...utils import s, d
class EventStore(object):
def __init__(self):
pass
def add(self, event, pk, ts=None):
raise NotImplementedError
def replay(self, event, ts=0, end_ts=None, ... |
class MessageErrors(Exception):
def __init__(self, message):
self.message = message
class MessageBodyEmpty(MessageErrors):
pass |
from dsmpy.dataset import Dataset
from dsmpy import rootdsm_psv
from dsmpy import rootdsm_psv, rootdsm_sh
if __name__ == '__main__':
parameter_files = [
rootdsm_psv + 'test2.inf',
rootdsm_psv + 'test3.inf']
dataset = Dataset.dataset_from_files(parameter_files)
counts, displacements = datase... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import pyaudio
import wave
class Record():
def record(wav_output_filename):
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
RECORD_SECONDS = 6
WAVE_OUTPUT_FILENAME = wav_output_filename
p = pyaudio.Py... |
import dataclasses
import typing
import time
import itertools
import numpy as np
from numpy import linalg as LA
import pandas as pd
from sklearn.cluster import KMeans
from .example import Example, Vector
from .cluster import Cluster
def minDist(clusters, centers, item):
assert type(clusters) is list or len(clust... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
while True:
try:
e = str(input()).split()
d = e[0]
l = e[1]
p = e[2]
g = ''
if d == l == p or d != l != p != d: g = 'e'
else:
if d == l == 'papel':
if p == 'pedra': g = 'e'
elif p == 'tesoura': g = 'p'
e... |
#!/usr/bin/env python3
import fitparse
import sys
import time
import os
start = time.time()
fitfile = fitparse.FitFile( sys.argv[1] )
records = []
laps = []
for record in fitfile.get_messages( 'record' ):
records.append( record )
for lap in fitfile.get_messages( 'lap' ):
laps.append( lap )
print( 'record... |
import pytest
from verta.endpoint.resources import Resources
@pytest.mark.parametrize("data", [3, 64, 0.25])
def test_cpu_milli(data):
Resources(cpu=data)
@pytest.mark.parametrize("data", [-12, 0])
def test_cpu_milli_negative(data):
with pytest.raises(ValueError):
Resources(cpu=data)
@pytest.mark... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 12 08:10:00 2021
@author: Swapnanil Sharma, https://github.com/swapnanilsharma
"""
__version__ = 0.1 |
__author__ = "Thomas Bell"
__version__ = (0, 2, 0)
__version_info__ = ".".join(map(str, __version__))
APP_NAME = "saving-place"
APP_AUTHOR = "/u/isurvived12"
APP_VERSION = __version_info__
USER_AGENT = "desktop:{}:v{} (by {})".format(
APP_NAME, APP_VERSION, APP_AUTHOR)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import numpy as np
from collections import deque, namedtuple
import os
import torch
import torch.nn.functional as F
import torch.optim as optim
import math
from itertools import count
import gc
from agent import Agent
from dqn_model import DQN
from dueling_dq... |
if __name__ == "__main__":
# Criase a var "n_times_de_futebol" para representar o numero de times
n_times_de_futebol = int(input("Digite o numero de times de futebol \n"))
# Criase a var "ranking_de_gols_de_cada_time" para representar o numero
# de gols de cada time
ranking_de_gols_de_cada_time = []... |
"""Check access to the source files of virtual datasets
When you read a virtual dataset, HDF5 will skip over source files it can't open,
giving you the virtual dataset's fill value instead.
It's not obvious whether you have a permissions problem, a missing file, or
a genuinely empty part of the dataset.
This script c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
from constants import Fields as F
from constants import NaN
def get(dic, key):
# Get value from a dic, if key not exists, set as NaN
if key not in dic:
if key == F.PLANS:
dic[key] = []
else:
dic[key] = NaN
return dic[key]
def process_plan(explain_list):
for e in... |
import json
from calm.dsl.builtins import Project
from calm.dsl.builtins import Provider, Ref, read_local_file
DSL_CONFIG = json.loads(read_local_file(".tests/config.json"))
NTNX_LOCAL_ACCOUNT = DSL_CONFIG["ACCOUNTS"]["NTNX_LOCAL_AZ"]
ACCOUNT_NAME = NTNX_LOCAL_ACCOUNT["NAME"]
SUBNET_NAME = NTNX_LOCAL_ACCOUNT["SUBNE... |
import format
import parcel_info
import ups
import usps
import yaml
import sys
with open(r'config.yml') as file:
# The FullLoader parameter handles the conversion from YAML
# scalar values to Python the dictionary format
CONFIG = yaml.load(file, Loader=yaml.FullLoader)
if len(sys.argv)>1:
tracking_file = sys.... |
from tkinter import *
from src.cliente import Client
from src.servido import Server
def Interfce():
janela = Tk()
janela.title("Socket")
janela.geometry("500x500")
janela.resizable(0, 0)
#Ip ou DNS
Label(janela,text="IP").place(x=5,y=4)
ip = Entry()
ip.place(x=5,y=20)
#Usuário
... |
from ..schema.nexusphp import NexusPHP
from ..schema.site_base import SignState, NetworkState, Work
from ..utils.net_utils import NetUtils
class MainClass(NexusPHP):
URL = 'https://pt.hd4fans.org/'
USER_CLASSES = {
'downloaded': [805306368000, 3298534883328],
'share_ratio': [3.05, 4.55],
... |
from nonbonded.library.factories.inputs.inputs import InputFactory
__all__ = [InputFactory]
|
from flask import Flask, render_template , render_template, url_for , request, redirect
app = Flask(__name__)
# Routing de toutes les pages HTML pour que l'application puisse nous rediriger sur les bonnes pages depuis le site
@app.route('/', methods=['POST', 'GET'])
def index():
return render_template('index.ht... |
__all__ = ["decryptor", "encryptor", "characters_keys", "answer", "introduce"] |
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import login as auth_login
from django.views.generic import FormView, CreateView
from django.utils.decorators import method_decorator
from django.views.decorators.ca... |
#
# Script that tries to find to which function given address belongs. (in a messy way :P)
#
import os
import re
import sys
swosppDir = os.getenv('SWOSPP', r'c:\swospp');
swosDir = os.getenv('SWOS', r'c:\games\swos');
hexRe = '[a-fA-F0-9]+'
def getAddress():
if len(sys.argv) < 2:
sys.exit('Usage {} <ad... |
# coding=utf-8
import re
def remove_comment(text):
text = re.sub(re.compile("#.*"), "", text)
text = "\n".join(filter(lambda x: x, text.split("\n")))
return text
|
f = 1.0; print(f.hex())
f = 1.5; print(f.hex())
|
# stdlib
import glob
import json
import os
from pathlib import Path
import platform
import sys
from typing import Any
from typing import Dict
from typing import List
from typing import Union
# third party
from jinja2 import Template
from packaging import version
# this forces the import priority to use site-packages ... |
# SVM = Support Vector Machine
import numpy as np
from sklearn import preprocessing, cross_validation, neighbors, svm
import pandas as pd
df = pd.read_csv('breast-cancer-wisconsin.data')
df.replace('?', -99999, inplace=True)
df.drop(['id'], 1, inplace=True)
X = np.array(df.drop(['class'], 1))
y = np.array(df['class'... |
#!/usr/bin/env python3
def nl_to_string(n,l,elec):
l_dict = {0:'s',1:'p',2:'d',3:'f'}
return str(n)+l_dict[l]+str(elec)
def print_string(entry_list):
conf_strings = []
for entry in entry_list:
string = nl_to_string(entry['n'],entry['l'],entry['elec'])
conf_strings.append(string)
print('.'.join(conf_string... |
# Problem Set 4A
# Name: <your name here>
# Collaborators:
# Time Spent: x:xx
def get_permutations(sequence):
'''
Enumerate all permutations of a given string
sequence (string): an arbitrary string to permute. Assume that it is a
non-empty string.
You MUST use recursion for this par... |
#!/usr/bin/env python3
import pytest
import create_release as cr
# unit test
def test_version_from_string():
assert cr.version_from_string("") == [0, 0, 0]
assert cr.version_from_string("vffdf") == [0, 0, 0]
assert cr.version_from_string("v1.1.1") == [1, 1, 1]
assert cr.version_from_string("v999.9999... |
from django.urls import path
from .views import base
urlpatterns = [
path('', base, name='base'),
]
|
import pytest
import time
from datetime import date, datetime
from unittest.mock import MagicMock, Mock, PropertyMock, patch
from hubbypy.hubbypy.hub_api import HubSpot
from hubbypy.hubbypy.contact_properties import (
AccessorProperty,
BaseUserProperty,
ConstantProperty,
FunctionProperty,
UserPrope... |
from .models import MixerBlock, MlpBlock, MlpMixer # noqa
__version__ = "0.0.1"
|
from rtl.tasks.divide import divide
from dummy_data import KWARGS, CONTENTS
def test_divide():
KWARGS = {
'operations': [
{
'a': 'a',
'b': 'b',
'column': 'c1'
},
{
'a': 'a',
'b': 2,
... |
from __future__ import annotations
import pytest
import coredis
@pytest.fixture
def s(redis_cluster_server):
cluster = coredis.RedisCluster(
startup_nodes=[{"host": "localhost", "port": 7000}], decode_responses=True
)
assert cluster.connection_pool.nodes.slots == {}
assert cluster.connection... |
import os
import datetime
import logging
import sqlite3
import pytest
from utils import setup_mdb_dir, all_book_info, load_db_from_sql_file, TESTS_DIR
from manga_db.manga_db import MangaDB
from manga_db.manga import Book
from manga_db.ext_info import ExternalInfo
from manga_db.constants import LANG_IDS
@pytest.mark.p... |
from adapt.intent import IntentBuilder
from mycroft import MycroftSkill, intent_handler
from mycroft.tts.espeak_tts import ESpeak
from os.path import join, dirname
class StephenHawkingTributeSkill(MycroftSkill):
def __init__(self):
super().__init__()
try:
self.espeak = ESpeak("en-uk", ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Let's create a set
aset1 = {'one', 'two', 'three', 'four', 'five'}
print(aset1) # Notice that the printed order is different (sets are unordered)
# We can create a set from anything iterable
alist = ['one', 'two', 'three']
aset2 = set(alist)
# We can add a new eleme... |
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a < b < c < d:
print("Fish Rising")
elif a > b > c > d:
print("Fish Diving")
elif a == b == c == d:
print("Fish At Constant Depth")
else:
print("No Fish")
|
import pandas as pd
import os.path
local = True
data_set_url = '/nethome/kkrishnan8/multi-sensor-data/data/raw/PEACHData/'
if local:
data_set_url = '/Users/koushikkrishnan/Documents/CODE/multi-sensor-data/data/raw/PEACHData/'
user_profiles = pd.read_csv(os.path.join(data_set_url, 'User Profiles/up_explicit_data.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<... |
#!/usr/bin/env python3
import sys
from PyQt5.QtCore import QUrl, QCoreApplication
from PyQt5.QtWidgets import QVBoxLayout
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineView
from PyQt5.QtWidgets import QApplication, QMainWindow,QPushButton, QWidget
import threading
x_size = 1366
y_size = 768
class E... |
from netmiko import ConnectHandler
from getpass import getpass
ios_devices = [
{
"host": "x",
"username": "x",
"password": getpass(),
"device_type": "cisco_nxos",
#"session_log": "my_session.txt",
}
# ,
#{
#"host": "x",
#"username": "x",
#"password": getpass(),
#"device_type": "ci... |
from os import listdir
from os.path import isfile, join
import re
import random
import os
import sys, getopt
def get_filenames(data_dir, regex):
# Create list with the training filenames
return [f for f in listdir(data_dir) if test_file(data_dir, f, regex)]
def test_file(data_dir, file, regex):
# Match ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Félix Chénier
# 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 requ... |
import argparse
import os
import time
from shutil import copyfile
import numpy as np
import torch
import torch.optim as optim
from torchvision.utils import make_grid, save_image
from datasets import UnpairDataset, denorm
from models import FUnIEUpGenerator, FUnIEUpDiscriminator
from torch.utils.tensorboard import Sum... |
nome = input("Digite o nome do cliente: ")
dia_v = input("Digite o dia de vencimento: ")
mes_v = input("Digite o mês de vencimento: ")
fatura = input("Digite o valor da fatura: ")
print("Olá,",nome)
print("A sua fatura com vencimento em",dia_v,"de",mes_v,"no valor de R$",fatura,"está fechada.") |
import os
import astropy.io.fits as fits
from astropy.convolution import Gaussian2DKernel, convolve_fft, convolve
import matplotlib.colors as colors
from matplotlib.patches import Ellipse
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
try:
import progres... |
try:
import subprocess32 as sp
except ModuleNotFoundError:
import subprocess as sp
import shlex
def run_command(cmd):
p = sp.run(shlex.split(cmd), stdout=sp.PIPE, stderr=sp.PIPE)
return p.stdout, p.stderr
|
from runners.python import Submission
class MathieuSubmission(Submission):
def run(self, s):
variables=dict()
inputs=[line.split() for line in s.split('\n')]
for line in inputs:
var = line[4]
if var not in variables:
variables[var] = 0
c... |
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(BASE_DIR))
sys.path.append(os.path.join(BASE_DIR,'contact_graspnet'))
sys.path.append(os.path.join(BASE_DIR, 'pointnet2', 'tf_ops/grouping'))
sys.path.append(os.path.join(BASE_DIR, 'pointnet2', 'u... |
# ----------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License
# ----------------------------------------------------------------------
"""Contains the scalar type info objects"""
import os
import textwrap
... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
from discord.ext import commands
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
|
# -*- coding: utf-8 -*-
import asyncio
from paco import curry
from .helpers import run_in_loop
def task(x, y, baz=None, *args, **kw):
return x + y, baz, kw
@asyncio.coroutine
def coro(x, y, baz=None, *args, **kw):
return task(x, y, baz=baz, *args, **kw)
def test_curry_function_arity():
num, val, kw = ... |
from pathlib import Path
import warnings
from pynwb import NWBHDF5IO, validate
from pynwb.testing import TestCase
class TestReadOldVersions(TestCase):
def test_read(self):
"""
Attempt to read and validate all NWB files in the same folder as this file. The folder should contain NWB files
... |
import numpy as np
from advent.utils.serialization import json_load
from davsn.dataset.base_dataset import BaseDataset
class SynthiaSeqDataSet(BaseDataset):
def __init__(self, root, list_path, set='all',
max_iters=None, crop_size=(321, 321), mean=(128, 128, 128)):
super().__init__(root, l... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
""" `pipeline` module provides tools to create a pipeline of tasks
a pipeline can be composed of one or several branches, but
everything runs in a single thread. The initial goal of this
framework is to provide a simple and direct way of defining task
typ... |
def is_polyndromic(number: int) -> bool:
new_number = str(number)
for i in range(len(new_number) // 2):
if new_number[i] != new_number[len(new_number) - i - 1]:
return False
return True
def calculate_polyndromic(n: int) -> int:
return sum(i for i in range(1, n)
if ... |
''' *********************** USER-PARAMETERS FOR FT CALIBRATION *********************** '''
rfw = 10. # Vertical force (N) applied by the right foot when robot in the air.
lfw = 10. # Vertical force (N) applied by the left foot when robot in the air.
|
"""A macro to configure Vulkan SDK deps"""
load("@rules_cc//cc:defs.bzl", "cc_library")
VULKAN_LINKOPTS = select({
"@bazel_tools//src/conditions:linux_x86_64": ["-lvulkan"],
"//conditions:default": [],
})
VULKAN_LIBRARIES = select({
"@bazel_tools//src/conditions:windows": ["@vulkan_windows//:vulkan_cc_li... |
import pretty_midi
import numpy as np
import librosa
import pyworld
from scipy.io.wavfile import read as wav_read
from scipy import signal
from pysndfx import AudioEffectsChain
def parse_midi(path: str) -> np.ndarray:
"""
simple parsing function to make piano-roll from midi file
:param path: the MIDI file... |
#!/usr/bin/env python
import rospy
import random
import math
import rospkg
from tf.transformations import quaternion_from_euler
from gazebo_msgs.srv import GetPhysicsProperties
from gazebo_msgs.srv import SetPhysicsProperties
from gazebo_msgs.srv import GetModelState
from gazebo_msgs.srv import SetModelState
from gaz... |
import logging
import os
import time
import timeit
import numpy as np
import matplotlib.pyplot as plt
from argparse import ArgumentParser
import paddle
import paddle.nn as nn
# user
from builders.model_builder import build_model
from builders.dataset_builder import build_dataset_train
from utils.utils import setup_s... |
from itertools import combinations
class Solution:
def readBinaryWatch(self, num):
"""
:type num: int
:rtype: List[str]
"""
rls = []
for c in combinations(range(10), num):
p = ['0'] * 10
for t in c:
p[t] = '1'
hour ... |
#! /usr/bin/env python
# -*- python -*-
"""Support for retrieving useful information about XML data, including the
public and system IDs and the document type name.
There are parts of this module which assume the native character encoding is
ASCII or a superset; this should be fixed.
"""
__version__ = "$Revision: 1... |
import pathlib
import shutil
import tempfile
from anymail.message import AnymailMessage
from django.conf import settings
from django.core.management import BaseCommand, call_command
from django.template import loader as template_loader
from django.utils.translation import gettext_lazy as _, activate, get_language
from... |
import itertools
class SeleneModelGenerator:
def __init__(self, teller_count: int, voter_count: int, cand_count: int, formula: int):
self._teller_count: int = teller_count
self._voter_count: int = voter_count
self._cand_count: int = cand_count
self._formula: int = formula
def ... |
#
# PySNMP MIB module SONUS-RTCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONUS-RTCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:02:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
import psycopg2
from logger import Logger
from dataclasses import dataclass
from constants.app_constants import Database
logger = Logger.get_info_logger()
@dataclass
class DatabaseServer(object):
"""
Gets data from the Postgres database server.
"""
@staticmethod
def connect_database_and_fetch_da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.