content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python3
from ctypes import cdll, c_char_p, c_int, create_string_buffer, c_long
SO_PATH="/home/***************/libAdAuth/libAdAuth.so"
username = create_string_buffer(b"********")
password = create_string_buffer(b"********")
host = create_string_buffer(b"*********.uk")
domain = create_string_buffer(b"**... |
# rearrange name of data in anat directories,
# delete repeated task-name pattern, add missing pattern
import os
# change to main directory
main_directory = '/mindhive/saxelab3/anzellotti/forrest/forrest_bids/'
#main_directory = '/Users/chloe/Documents/test10/'
os.chdir(main_directory)
# get all subject folders in main... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.ohio import ohio
def test_ohio():
"""Test module ohio.py by downloading
ohio.csv and testing shape of
extracted data has 2148 rows and 4 c... |
class User:
"""
This class will contain all the details of the user
"""
def __init__(self,login,password):
"""
This will create the information of (Levert) the user
"""
self.login = login
self.password = password
# Levert
def user_exists(self,password):
"""Levert Co
... |
# 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 pytest
import numpy as np
class DataGenerator:
def __init__(self, fs=100e3, n_iter=10, sample_duration=1):
self.fs = fs
self.n_iter = n_iter
self.sample_duration = sample_duration
self.n_samples = int(round(sample_duration * fs))
def _iter(self):
self.generate... |
#
# Copyright (c) Sinergise, 2019 -- 2021.
#
# This file belongs to subproject "field-delineation" of project NIVA (www.niva4cap.eu).
# All rights reserved.
#
# 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 re
from setuptool... |
import time
import base64
def normalize_scope(scope):
return ' '.join(sorted(scope.split()))
def is_token_expired(token, offset=60):
return token['expires_at'] - int(time.time()) < offset
def get_authorization_headers(client_id, client_secret):
auth_header = base64.b64encode(f'{client_id}... |
"""
# 100daysCodingChallenge
Level: Medium
Kevin and Stuart want to play the 'The Minion Game'.
Game Rules
Both players are given the same string, S
.
Both players have to make substrings using the letters of the string S
.
Stuart has to make words starting with consonants.
Kevin has to make words starting with vow... |
'''
Date: 2021-08-02 22:38:28
LastEditors: xgy
LastEditTime: 2021-08-15 16:12:14
FilePath: \code\ctpn\src\CTPN\BoundingBoxDecode.py
'''
import mindspore.nn as nn
from mindspore.ops import operations as P
class BoundingBoxDecode(nn.Cell):
"""
BoundintBox Decoder.
Returns:
pred_box(Tensor): decoder ... |
'''In this exercise, the task is to write a function that picks a random word from a list of words from the
SOWPODS dictionary. Download this file and save it in the same directory as your Python code.
This file is Peter Norvig’s compilation of the dictionary of words used in professional Scrabble tournaments.
Each lin... |
from django.db import models
# Create your models here.
class Post(models.Model):
title = models.CharField('Titulo', max_length=150)
description = models.TextField('Description')
# author = models.ForeignKey(User, verbose_name = 'Autor')
is_published = models.BooleanField('Publicado?', default = False... |
# from os.path import dirname
import os,sys,pytest
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from Page.login_page import Login_Page
from Base.init_driver import get_driver
from Base.read_data import Op_Data
from time import sleep
from loguru import logger
# sys.path.append(os.getcwd())
def get_data... |
from unittest import TestCase
import pytest
import pandas as pd
import numpy as np
from pipelines.wine_quality_preparers import WinesPreparerETL, WhiteWinesPreparer
inputs = [7.0, 0.27, 0.36, 20.7, 0.045, 45.0, 170.0, 1.0010, 3.00, 0.45, 8.8, 6]
np_inputs = np.array(inputs)
class TestWinesPreparerETL(TestCase):... |
from openfermion_dirac import MolecularData_Dirac, run_dirac
from openfermion.transforms import jordan_wigner
from openfermion.utils import eigenspectrum
import os
# Set molecule parameters.
basis = 'STO-3G'
bond_length = 0.5
charge = 1
data_directory=os.getcwd()
delete_input = True
delete_xyz = True
delete_output = ... |
# Copyright (c) 2021-present, Ethan Henderson
# 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 of condit... |
# -*- coding: utf-8 -*-
# :Project: pglast -- DO NOT EDIT: automatically extracted from struct_defs.json @ 13-2.1.0-0-gd1d0186
# :Author: Lele Gaifax <lele@metapensiero.it>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2021 Lele Gaifax
#
from collections import namedtuple
from decima... |
"""
mqtt_base_client.py
====================================
Base MQTT Client
"""
import paho.mqtt.client as mqtt
from helper import run_async
import _thread
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
def on_subscribe_callback(client, userdata, mid, granted_qos):
""... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, DateField,IntegerField, FloatField, SelectField, SelectMultipleField, RadioField, TextAreaField, Form, FieldList, FormField
from wtforms.fields.html5 import DateField
from wtforms.widgets import ListWidget, CheckboxInput
from wtforms.validato... |
"""Thread function's arguments
When target function you want to call to run in a thread
has arguments.
"""
import threading, time
def pause(seconds):
i = 0
while i < seconds:
print('Run thread: ' + threading.currentThread().name)
i = i + 1
time.sleep(1)
print('Start main')
threading.T... |
import logging
import os
import sys
from constants.dbpedia import LINKS_FILE
from extras.dbpedia.loader import start_crawling
log = logging.getLogger( __name__ )
if __name__ == '__main__':
if not os.path.isfile( LINKS_FILE ):
log.error( 'File with links to DBpedia-related files not found. nothing to do'... |
# -*- coding: utf-8 -*-
"""
site.py
~~~~~~~
Flask main app
:copyright: (c) 2015 by Vivek R.
:license: BSD, see LICENSE for more details.
"""
import os
import datetime
from urlparse import urljoin
from collections import Counter, OrderedDict
from flask import Flask
from flask_frozen import Freezer
from werkzeug... |
from allennlp.predictors.predictor import Predictor
from typing import List
from allennlp.common.util import JsonDict, sanitize
from allennlp.data import Instance
@Predictor.register("rationale_predictor")
class RationalePredictor(Predictor) :
def _json_to_instance(self, json_dict):
raise NotImplementedEr... |
from setuptools import setup, find_packages
with open("README.md", "r") as f:
long_description = f.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='alfrodull',
version='0.1.0',
author='Philip Laine',
author_email='philip.laine@gmail.com',
descri... |
annoy_index_db_path = 'cache/index.db'
already_img_response = 'there are not math image'
success_response = 'success'
dim_800x800 = (800,800) |
#!/usr/bin/env python3
# (C) Copyright 2022 European Centre for Medium-Range Weather Forecasts.
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunit... |
from typing import Any, Dict
import pytest
from nuplan.common.utils.testing.nuplan_test import NUPLAN_TEST_PLUGIN, nuplan_test
from nuplan.planning.metrics.evaluation_metrics.common.ego_yaw_acceleration import EgoYawAccelerationStatistics
from nuplan.planning.metrics.utils.testing_utils import metric_statistic_test
... |
import pandas as pd
import numpy as np
from src.configs import *
from src.features.transform import categorical_to_ordinal
import collections
class HousePriceData:
'''
Load House Price data for Kaggle competition
'''
def __init__(self, train_path, test_path):
self.trainset = pd.read_csv(train_... |
#!/usr/bin/env python
# coding=utf-8
import os
import shutil
from src.core.setcore import *
# Py2/3 compatibility
# Python3 renamed raw_input to input
try: input = raw_input
except NameError: pass
dest = ("src/html/")
url = ("")
debug_msg(mod_name(), "entering src.html.templates.template'", 1)
#
# used for pre-def... |
from typing import Any, Optional
from fastapi import HTTPException
class NotFoundHTTPException(HTTPException):
"""Http 404 Not Found exception"""
def __init__(self, headers: Optional[dict[str, Any]] = None) -> None:
super().__init__(404, detail="Not Found", headers=headers)
class BadRequestHTTPExce... |
from setuptools import setup
setup(name="spikerlib",
version="0.8",
description="Collection of tools for analysing spike trains",
author="Achilleas Koutsou",
author_email="achilleas.k@gmail.com",
#package_dir={'': 'spikerlib'},
packages=["spikerlib", "spikerlib.metrics"]
)
|
"""Parse CaffeModel.
Helped by caffe2theano, MarcBS's Caffe2Keras module.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function
from collections import OrderedDict
import numpy as np
from scipy.io import loadmat
from transcaffe import caffe_pb2, utils
from google.protobuf.text_fo... |
#
# 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, software
# distributed under the ... |
import json
from dejavu import Dejavu
from dejavu.logic.recognizer.file_recognizer import FileRecognizer
from dejavu.logic.recognizer.microphone_recognizer import MicrophoneRecognizer
# load config from a JSON file (or anything outputting a python dictionary)
config = {
"database": {
"host": "db",
... |
#!/usr/bin/env python
# coding: utf-8
# # Exercises 9: Functions
#
# There are some tricky questions in here - don't be afraid to ask for help. You might find it useful to work out a rough structure or process on paper before going to code.
#
# ## Task 1: Regular functions
#
# 1. Write a function to find the maximu... |
# Copyright 2017 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... |
import pytorch_lightning as pl
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import WandbLogger
from deperceiver.models.debug_model import DebugModel
if __name__ == '__main__':
model = DebugModel()
wandb_logger = WandbLogger(
name='debug_cifar',
project='DePerceiver',
... |
def img_to_encoding(image_path, model):
# loading the image with resizing the image
img = load_img(image_path, target_size=(160, 160))
print('\nImage data :',img)
print("\nImage Data :",img.shape)
# converting the img data in the form of pixcel values
img = np.around(np.array(img) / 255.0, dec... |
from styx_msgs.msg import TrafficLight
from keras.models import load_model
import cv2
import numpy as np
import tensorflow as tf
import os
import rospy
from PIL import Image
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
class TLSimClassifier(object):
def __init__(self):
#TODO load classifier
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import galaxy.main.fields
import galaxy.main.mixins
class Migration(migrations.Migration):
dependencies = [('main', '0049_auto_20161013_1744')]
operations = [
migrations.CreateModel(
... |
from __future__ import annotations
import numpy as np
from bqskitrs import Circuit as Circ
from bqskit.ir.circuit import Circuit
from bqskit.qis.unitary.unitarymatrix import UnitaryMatrix
def check_gradient(circ: Circuit, num_params: int) -> None:
totaldiff = [0] * num_params
eps = 1e-5
repeats = 100
... |
"""WMEL diagrams."""
# --- import --------------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
# --- define --------------------------------------------------------------------------------------
# --- subplot --------------------------... |
import torch.utils.data as data
import cv2
import numpy as np
import math
from lib.utils import data_utils
from pycocotools.coco import COCO
import os
from lib.utils.tless import tless_utils, visualize_utils, tless_config
from PIL import Image
import glob
class Dataset(data.Dataset):
def __init__(self, ann_file, ... |
"""
Proxy discovery operations
"""
import os
import socket
import logging
import functools
from contextlib import closing
from dataclasses import dataclass
from typing import Mapping, Tuple, List
from urllib.parse import urlparse
from nspawn import CONFIG
logger = logging.getLogger(__name__)
@dataclass
class ProxyC... |
"""
Partition the numbers using a very simple round-robin algorithm.
Programmer: Erel Segal-Halevi
Since: 2022-02
"""
from typing import Callable, List, Any
from prtpy import outputtypes as out, objectives as obj, Bins
def roundrobin(
bins: Bins,
items: List[any],
valueof: Callable[[Any], float] = lambd... |
import cv2
import dlib
import threading
import numpy as np
from keras.models import load_model
from scipy.spatial import distance as dist
from imutils import face_utils
import sys
from tensorflow import Graph, Session
import utils.logging_data as LOG
'''
Blink frequence, This file predicts blinking
Make sure models a... |
import sys
import argparse
import os
import re
import yaml
from . import workflow
class Runner(object):
tasks = [
]
out_and_cache_subfolder_with_sumatra_label = True
def run(self):
parser = argparse.ArgumentParser(description='Run workflow')
parser.add_argument('config_path', type... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2018 Nortxort
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,... |
import json
from dotenv import load_dotenv
from os import getenv
from plex_trakt_sync.path import config_file, env_file, default_config_file
from os.path import exists
class Config(dict):
env_keys = [
"PLEX_BASEURL",
"PLEX_FALLBACKURL",
"PLEX_TOKEN",
"PLEX_USERNAME",
"TRAKT... |
import datetime
from random import randint
from telegram.chat import Chat
from telegram.message import Message
from telegram.user import User
class MockBot:
last_message = {}
def send_message(self, chat_id, text, **kwargs):
self.last_message[chat_id] = text
def sendMessage(self, *args, **kwargs... |
def pairs(k, arr):
result = 0
arr = sorted(arr)
j = 1
for i in range(len(arr)-1):
while j<len(arr):
if arr[j] - arr[i] == k:
result += 1
j += 1
elif arr[j] - arr[i] > k:
break
elif arr[j] - arr[i] < k:... |
# MINLP written by GAMS Convert at 04/21/18 13:54:23
#
# Equation counts
# Total E G L N X C B
# 19 18 1 0 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
from org.mowl.Parsers import TaxonomyWithRelsParser as Parser
from org.semanticweb.owlapi.model import OWLOntology
from mowl.graph.edge import Edge
import sys
from mowl.graph.graph import GraphGenModel
class TaxonomyWithRelsParser(GraphGenModel):
r'''
This class will project the ontology considering the fo... |
import numpy as np
import matplotlib.pyplot as plt
from de_expl import de_expl
from es_expl import es_expl
from gwo_expl import gwo_expl
from hho_expl import hho_expl
from mfo_expl import mfo_expl
from pso_expl import pso_expl
from p5_base import plot_progress, plot_objs
fevals = 10000
#de_x, de_y, de_hist, de_res,... |
# Create a mapping of state to abbreviation
states = {
'Oregon': 'OR',
'Florida': 'FL',
'California': 'CA',
'New York': 'NY',
'Michigan': 'MI',
}
# Careate a basic set of states and some cities in them
cities = {
'CA': 'San Farncisco',
'MI': 'Detroit',
'FL': 'JAcksonsville',
}
# Add so... |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from modules.execution.models import *
class Project(models.Model):
PROJECT_TYPES = (
("internal", "internal"),
("public", "public")
)
name = models.CharField(max_length=100, unique=... |
from datasets.parties.all import df_regions_votes_and_parties
from datasets.regions.province import df_community_and_provice |
# Link - https://www.hackerrank.com/challenges/designer-door-mat/problem
inp = input().split()
N = int(inp[0])
M = int(inp[1])
for i in range(1, N, 2):
print((i * ".|.").center(M, "-"))
print("WELCOME".center(M,"-"))
for i in range(N-2, -1, -2):
print((i * ".|.").center(M, "-"))
|
#
# 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 us... |
import time
import uuid
import six
from mazepa.queue import Queue
from mazepa.job import Job, AllJobsIndicator
class Scheduler:
def __init__(self, queue_name=None, completion_queue_name=None,
queue_region=None, threads=1):
self.queue = Queue(queue_name=queue_name,
completion_qu... |
"""Main module which implements the components of graph-based autoconstraint model.
"""
import torch
from sketchgraphs.pipeline.graph_model import target, scopes_from_offsets
from sketchgraphs_models.graph.model import EdgePartnerNetwork, numerical_features, message_passing
from sketchgraphs_models import nn as sg_n... |
# Ensures the validity of blocks inside a blockchain
# Copyright (c) 2022 gparap
from Blockchain import Blockchain
class Validator:
def __init__(self, blockchain: Blockchain):
self.blockchain = blockchain
# the previous hash of the current block must match the hash of the previous block
def valid... |
from pdb import set_trace as T
import numpy as np
from itertools import chain
from neural_mmo.forge.blade import core
from neural_mmo.forge.blade.lib import material
from random import randint
import os
numsent = 0
class Map:
'''Map object representing a list of tiles
Also tracks a sparse list of tile up... |
# encoding: cinje
: from .template import page
: from .letterscountsbar import letterscountsbar
: from .namelist import namelist
: def browsetemplate title, ctx, letterscountslist, names=None
: using page title, ctx, lang="en"
<div class="row">
: if letterscountslist is not None
: use ... |
# [그리디] 거스름돈
#========== input ===========
# n : 거스름돈 금액
#========== output ==========
# result : 금액에 해당되는 최소의 동전 개수
# 풀이 : 가장 큰 동전부터, 거스를 수 있을 만큼 거슬러 주기
n = int(input())
result = 0
coin_list = [500, 100, 50, 10]
for coin in coin_list:
result += n//coin
n %= coin
print(result)
|
from collections import namedtuple
from copy import copy
from datetime import *
from geojson import Feature, Point, FeatureCollection, LineString
from geojson.mapping import to_mapping
from typing import List, Dict
import functools
import os
import struct
import pyall
from hyo2.mate.lib.scan import Scan, A_NONE, A_PAR... |
import argparse
import sys
class ContactsCLI():
"""Parse command line arguments for contacts program"""
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument(
'-f',
'--filter',
default=None,
type=str,
h... |
from client import Client
import pprint
"""
MAIN INSTANCE (petition)
"""
tenant_id = ""
client_id = ""
client_secret = ""
dynamics_resource = ""
CRM_resource = ""
refresh_token = ""
token = ""
petition = Client(client_id=client_id, client_secret=client_secret, token=token)
"""
API ENDPOINTS EXAMPLES
"contacts", "acco... |
# */
# * 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import combinations, permutations
import logging
import networkx as nx
import numpy as np
import pandas as pd
# +
# generate a random adjacency matrix
# traces: Number or Domino Traces
# If traces>1 the output will be a data frame of list
# nodes: Number ... |
# AUTOGENERATED FILE - DO NOT MODIFY!
# This file generated by Djinni from foo_client_interface.djinni
from djinni.support import MultiSet # default imported in all files
from djinni.exception import CPyException # default imported in all files
from djinni.pycffi_marshal import CPyPrimitive, CPyRecord
from PyCFFIlib_c... |
import numpy as np
a = np.array([[0, 1, 2, 3],
[4, 5, 6, 7],
[8, 9, 10, 11]])
print(np.cumsum(a)) # 1 次元 array に変換してから累積和を計算
'''
[ 0 1 3 6 10 15 21 28 36 45 55 66]
'''
print(np.cumsum(a, axis=0)) # 縦方向に累積和を計算
'''
[[ 0 1 2 3]
[ 4 6 8 10]
[12 15 18 21]]
'''
print(np.cumsum(a, axi... |
import pytest
try:
import simplejson as json
except ImportError:
import json
from click.testing import CliRunner
from diderypy.cli import main
from diderypy.lib import generating as gen
def parsOutput(data):
return list(filter(None, data.split('\n')))
def testValidConfigFile():
runner = CliRunner()... |
import time
import heapq
def curr_time():
return round(time.time() * 1000)
class GameEventPQueue:
''' singleton event queue for the game, event listeners handle different game event types
game events are scheduled in a pqueue for certain events can be handled before others
uses minpqueue since... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This contains a 128x128 px thumbnail in PNG format
# Taken from http://www.zwahlendesign.ch/en/node/20
# openoffice_icons/openoffice_icons_linux/openoffice11.png
# License: Freeware
import base64
iconstr = """\
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAAG0OVFdAAAABGdBTUEAANbY1E9Y... |
import os
from my_lib import Object, Object2, Object3
def is_unique(s):
s = list(s)
s.sort()
for i in range(len(s) - 1):
if s[i] == s[i + 1]:
return 0
else:
return 1
if __name__ == "__main__":
print(is_unique(input()))
|
def get_names():
names = []
while True:
name = input("Enter players name: ")
if name != 'done':
print(f'{name} added to the list of players')
names.append(name)
continue
else:
break
return names
def get_player_scores(players):
for... |
#! /usr/bin/env python
from eclib.elgamal import *
key_length = 20
params, pk, sk = keygen(key_length)
delta = 1e-2
print('========== ElGamal parameter ==========')
print(f'key length = {key_length} bit')
print(f'p = {params.p}')
print(f'q = {params.q}')
print(f'g = {params.g}')
print(f'h = {pk}')
print(f's = {sk}')... |
import numpy as np
import cv2
import os
from src.types.parent_slide import SlideImage
class FluorescenceSlide(SlideImage):
def __init__(self, img, **kwargs):
"""
Arguments:
img (ndarray): uint16 array of shape (h,w,3)
"""
self.img = img
self.height, self.width, ... |
from typing import List, Optional, Type
from ape.types import AddressType
from .base import abstractdataclass, abstractmethod
from .providers import ProviderAPI, ReceiptAPI, TransactionAPI
@abstractdataclass
class AddressAPI:
_provider: Optional[ProviderAPI] = None
@property
def provider(self) -> Provi... |
""" capture_faces.py
Author: Gonçalo S. Martins
This script implements the basic face detection and extraction features
needed for this work. The main section of the script illustrates its usage
in extracting faces from pre-recorded videos.
This script was tested using Python 3.5 and OpenCV 3.1.
Video capture code i... |
#!/usr/bin/python3
"""
Made by Facundo Diaz - Tomas De Castro - Tadeo Grach for Holberton School 2021 """
""" IMPORTS EXTERN MODULES """
import time
from datetime import datetime
import os
""" IMPORTS FILES """
import persistence
import entities
import mail
import info
import percent
""" In case url 1 is not worki... |
#Based on https://github.com/alexandrebarachant/muse-lsl/blob/master/notebooks/N170%20with%20Muse.ipynb
import sys
from collections import OrderedDict
from mne import create_info, concatenate_raws
from mne.io import RawArray
from mne.channels import read_montage
import pandas as pd
import numpy as np
from glob impor... |
#https://www.hackerrank.com/challenges/mark-and-toys/problem?isFullScreen=true
def maximumToys(prices, k):
# Write your code here
prices.sort()
count = 0
sum = 0
i = 0
while sum < k:
sum += prices[i]
i += 1
count += 1
return count - 1
|
import hassapi as hass
import datetime
import re
"""
Class Phone_Manager handles sending call to voice notfyng service
"""
__NOTIFY__ = "notify/"
SUB_TTS = [("[\*\-\[\]_\(\)\{\~\|\}\s]+", " ")]
class Phone_Manager(hass.Hass):
def initialize(self):
self.dict_lingua = {
"it-IT": "it-IT-Standar... |
"""
Export biomedical data from a relational database to an Avro file.
An Avro file stores the data schema as a JSON blob and the data in a
binary format
See https://avro.apache.org for details
In this case, the Avro file is called a PFB
(Portable Format for Bioinformatics) file because the data in the Avro file
con... |
from urlparse import urljoin
from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen
from kivy.utils import platform
from pytt.tools import Tool, RectangleTool
from pytt.pasteimage import PasteImageScreen, get_png_from_clipboard
class DMScreen(Screen):
mapfile = StringProperty('')
... |
import adv.adv_test
from core.advbase import *
import marth
def module():
return Marth
class Marth(marth.Marth):
comment = 'dodge*2 to miss s2p3 then dodge*2 back to attack'
def s2_proc(self, e):
if self.stance == 0:
self.stance = 1
Selfbuff('s21',0.1,10).on()
... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\fame\fame_commands.py
# Compiled at: 2020-06-01 23:01:55
# Size of source mod 2**32: 8751 bytes
from... |
from django.apps import AppConfig
class ReportConfig(AppConfig):
name = "reports"
verbose_name = "Django Model Reports"
def ready(self):
from .base import reports
reports.discover()
|
#!/usr/bin/env python
import rospy
import numpy as np
import cv2
from subprocess import call
import sys
from std_msgs.msg import String
import cv2.cv as cv
import os
class martin_aimas_interface:
def __init__(self):
self.speechRecognitionFlag = True
self.subSpeech = rospy.Subscriber('/recognizer/output', String,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 22 00:29:48 2018
@author: Hiba Lubbad
"""
animals = { 'a': ['horse'], 'b': ['baboon'], 'c': ['giraffe']}
animals['d'] = ['donkey']
animals['d'].append('dog')
animals['d'].append('dingo')
def howmany(di):
count = 0
for i in di.values():
... |
# Get the data from:
# https://archive.ics.uci.edu/ml/datasets/Airfoil+Self-Noise
from __future__ import print_function, division
from future.utils import iteritems
from builtins import range, input
import os
# Note: you may need to update your version of future
# sudo pip install -U future
# just in case we need it... |
# 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
import inspect
from abc import ABC, abstractmethod
from typing import Dict, Generator, List, Type, TypeVar
from libcst impor... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import tensorflow as tf
from itl.layers.core import Layer
from itl import logging
# from itl.decorators import deprecated_alias
__all__ = [
'UpSampling2dLayer',
'DownSampling2dLayer',
]
class UpSampling2dLayer(Layer):
"""The :class:`UpSampling2dLayer` class ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Author : xuqiang
@License : (C) Copyright 2020-, H3C
@Contact : xu.qiang@h3c.com
@Software: f8s
@File : config.py
@Time : 20200211
@Desc :
'''
#k8s cfg
K8S_CFG = "/root/f8s/kubeconfig.yaml"
FISCO_HOME = '/root/fisco_network'
NFS = "1... |
import cfm_api_utils
token = get_token()
print token
|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# --------------------------------------------------------------------------... |
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName #initialization of first number ,last number as done in the constructor
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)# #printout stat... |
'''
Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
'''
import torch
# from transformers import MT5ForConditionalGeneration, MT5Config, MT5EncoderModel, MT5Tok... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.