content
stringlengths
0
894k
type
stringclasses
2 values
#!/usr/bin/env python3 from calendar import monthrange year = int( input() ) ( startDay, endDay ) = monthrange( year-543, 2 ) print( endDay )
python
#!/usr/bin/python3 import os import time from datetime import datetime as dt import logging #from .database.database import * from threading import Thread class BloquearSites: def __init__(self): logging.basicConfig(filename="C:\\ConectaIT\\modules" + '\\logs\\logBloquearSites.log') #s...
python
#numeric integration using the 2-point trapezoidal rule from math import * EPSILON = .0001 #base length of trapezoids def evaluate_function(func, a): func_at_a = eval(func.replace('x', str(a))) return func_at_a #doesnt yet take into account ability of domain a,b to have b<a def integrate(func, domain): ...
python
__author__ = 'Jay Hennessy <tjay.hennessy@gmail.com>' __license__ = 'MIT' import os __version__ = '0.0.1' # fantraxpy version VERSION = '17.0.0' # fantrax version URL = 'https://www.fantrax.com/fxpa/req' FANTRAX_TOKEN = os.environ.get('FANTRAX_TOKEN', None)
python
""" This module contains tests for the utility functions in the test_mapping module. """ import pytest from sqlalchemy import ( Column, Index, Integer, UniqueConstraint, ) from sqlalchemy.orm import registry from galaxy.model import _HasTable from . import ( collection_consists_of_objects, has_...
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-22 14:40 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
python
# Mod01.py from MyCalc01 import Calc01 from MyCalc01.Calc01 import * x= 100; y= 200 print(Calc01.__name__) Calc01.Sum(x, y) Mul(x,y)
python
class ValidationException(Exception): pass class DataApiException(Exception): "For errors raised when reading from data api"
python
# Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is # licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
python
# -*- coding: utf-8 -*- """ Class for a multi-panel structure """ __version__ = '1.0' __author__ = 'Noemie Fedon' import sys import numpy as np sys.path.append(r'C:\BELLA') from src.BELLA.parameters import Parameters from src.BELLA.constraints import Constraints from src.BELLA.panels import Panel from s...
python
import warnings import dateutil.parser from requests import Session from time import sleep from .config import ( # noqa __version__, API_ROOT, DEFAULT_USER_AGENT, API_KEY_ENV_VAR, ENVIRON_API_KEY, ) session = Session() session.headers.update({"Accept": "application/json"}) session.headers.update(...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Distributed under the terms of the MIT License. """ Script to append window and cage COM's to a CIF. Author: Andrew Tarzia Date Created: 19 Feb 2019 """ import sys from ase.io import read import pywindow as pw import logging import os import atools def main(): i...
python
# Copyright (C) 2013 by Brian Neal. # This file is part of m209, the M-209 simulation. # m209 is released under the MIT License (see LICENSE.txt). """test_converter.py - Unit tests for the M209 class for the M-209 simulation.""" import unittest from .. import M209Error from ..converter import M209 # Data taken fro...
python
from os import listdir import json from pymongo import MongoClient prediction_output = '../data/prediction_output/' # Edit def connect_db(mode, db_name): client = MongoClient('localhost', 27017) db = client[db_name] collection = db['train'] if mode == 'train' else db['val'] return collection if __nam...
python
from wsgiref.util import FileWrapper from django.conf import settings from django.http import Http404, HttpResponse, StreamingHttpResponse from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.urls import reverse from wagtail.core import hooks from ...
python
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019-Present Datadog, Inc. from datadog_api_client.v1.model_utils import ( ModelNormal, cached_property, ...
python
import demistomock as demisto from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import] from CommonServerUserPython import * # noqa: E402 lgtm [py/polluting-import] # IMPORTS from typing import Tuple, Optional import traceback import dateparser import httplib2 import urllib.parse from oauth2client imp...
python
from django.shortcuts import render, redirect from django import forms from django.contrib import messages from django.contrib.auth.forms import PasswordChangeForm from django.contrib.auth import authenticate, login, update_session_auth_hash from django.contrib.auth.models import User from django.contrib.auth.decorator...
python
import math, itertools from functools import lru_cache def distance_squared(p1, p2): x1, y1 = p1 x2, y2 = p2 dx, dy = x1 - x2, y2 - y1 return dx * dx + dy * dy def points_up_tile_size_px(size): return math.floor(size * math.sqrt(3)), size * 2 def flats_up_tile_size_px(size): return size * ...
python
class Board: ROW_COL_BASE = 1 def __init__(self, board, N): """ Builds a Board from a list of blocks and the size of the board. The list must hold N^2 blocks. :param board: the list with the blocks. :param N: the size of the board (length = width = N) :return: a new B...
python
#!/usr/bin/env python3 """ Clean up (making tar) a single simulation directory after successful cybershake submissions """ import os import glob import shutil import tarfile import argparse from qcore import utils SUBMISSION_DIR_NAME = "submission_temp" SUBMISSION_TAR = "submission.tar" SUBMISSION_FILES = [ "fli...
python
# -*- coding: utf-8 -*- """ Spyder Editor APRI和FIB4推测肝纤维化或肝硬化情况 This is a temporary script file. """ import math #APRI缩写:AST to Platelet Ratio Index #AST单位iu/l #PRI单位10**9/L #如果APRI>2,可能有肝硬化 def APRI(AST,upper_AST,PRI): apri=((AST*1.0/upper_AST)*100)/PRI return apri #FIB-4缩写Fibrosis-4 #age单位:年 #AST和ALT单...
python
""" :class:`Registrable` is a "mixin" for endowing any base class with a named registry for its subclasses and a decorator for registering them. """ import importlib import logging from collections import defaultdict from typing import ( Callable, ClassVar, DefaultDict, Dict, List, Optional, ...
python
import functools import os import pickle # decorator for pickle-caching the result of a function def pickle_cache(cache_filename, compare_filename_time=None, overwrite=False): def decorator(func): @functools.wraps(func) def wrapper(*args, **kwargs): exists = os.path.exists(cache_filena...
python
# Generated by Django 3.0.4 on 2021-04-13 19:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('website', '0004_uploader_image_l'), ] operations = [ migrations.AlterField( model_name='uploader', name='id', ...
python
# "THE BEER-WARE LICENSE" (Revision 42): # <flal@melix.net> wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return # read a json describing people do the magic to pick two different peop...
python
''' Python program to add two positive integers without using the '+' operator ''' ''' x << y Returns x with the bits shifted to the left by y places (and new bits on the right-hand-side are zeros). This is the same as multiplying x by 2**y. x >> y Returns x with the bits shifted to the right by y places. This is the ...
python
import timer.helper.thread as thread class TestThreadIsNone(): def test_real_none(self) -> None: assert thread.is_none(None) is True def test_text_none_uppercase(self) -> None: assert thread.is_none("NONE") is True def test_text_none_lowercase(self) -> None: assert thread....
python
# Copyright (c) 2019, Stefan Grönke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
python
# todo
python
import pickle from pathlib import Path import torch import os from sklearn.model_selection import GroupKFold from torch.utils.data import DataLoader from classifier.config import get_conf from classifier.fracture_detector.data import get_meta, WristFractureDataset from classifier.fracture_detector.data._transform im...
python
# pylint: disable=all __version__ = "2.12.0" __author__ = "Criteo"
python
from ray.util.collective.collective import nccl_available, gloo_available, \ is_group_initialized, init_collective_group, destroy_collective_group, \ create_collective_group, get_rank, get_collective_group_size, \ allreduce, allreduce_multigpu, barrier, reduce, reduce_multigpu, \ broadcast, broadcast_mu...
python
from sys import argv, exit import sys sys.path.append('src') import os import pandas as pd import numpy as np import random from matplotlib import pyplot as plt from ag import Ag from graph import Graph from pprint import pprint from utils import readFiles if __name__=='__main__': vertexes, edges, cities_df, cit...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from Crypto.Cipher import AES import base64 import time import gzip from hashlib import md5 import sys import io sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8', line_buffering=True) def Decrypt(key:str, text:str) -> str: if len(key) < 32: key += ' '...
python
import pytest from time import time from bitmex_async_rest import BitMEXRestApi @pytest.fixture def testnet(): return BitMEXRestApi('testnet') async def test_throttle(testnet: BitMEXRestApi): # for i in range(120): # funding = await testnet.funding(count=1) # assert i == 119 assert True asyn...
python
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Unsupervised Kernel Regression (UKR) for Python. Implemented as a scikit-learn module. Author: Christoph Hermes Created on Januar 16, 2015 18:48:22 The MIT License (MIT) Copyright (c) 2015 Christoph Hermes Permission is hereby granted, free of charge, to any pers...
python
from typing import * @overload def check_array_indexer(array: geopandas.array.GeometryArray, indexer: numpy.ndarray): """ usage.geopandas: 4 """ ... @overload def check_array_indexer( array: geopandas.array.GeometryArray, indexer: slice[None, int, None] ): """ usage.geopandas: 2 """ ...
python
import pandas as pd from scipy import stats def my_oneway_anova(x): my_data = pd.read_csv(x) normal = my_data[my_data['condition']=='condition_a']['response_time'] degraded = my_data[my_data['condition']=='condition_b']['response_time'] return stats.f_oneway(normal, degraded)
python
#!/usr/bin/env python import argparse from argparse import RawTextHelpFormatter import bammend as bm def parse_args(): """Parse command-line arguments""" summary = ('Remove pulses from reads in Pacbio Bam. Annotation indices \n' 'are indexed from the beginning of the ZMW read (i.e. query \n' ...
python
""" The API, responsible for receiving the files, submitting jobs, and getting their results. """ import asyncio from contextlib import suppress import os from typing import Optional from uuid import UUID, uuid4 from fastapi import ( Depends, FastAPI, File, HTTPException, Path, Query, Resp...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Safe a commandline password manager using AES encryption, written in python. :: author Erick Daniszewski :: date 05 December 2015 """ import json import getpass import argparse import struct from os import mkdir, remove from os.path import join as join_path fr...
python
# coding: utf-8 from __future__ import absolute_import from unittest.mock import patch from xcube_hub import api from xcube_hub.controllers.callbacks import put_callback_by_cubegen_id from xcube_hub.models.callback import Callback from test import BaseTestCase class TestCallbacksController(BaseTestCase): """Ca...
python
"""AI Engines Here is a set of AI- and ML-patterns for adavanced research of business data. """
python
from unittest.mock import MagicMock class AsyncMock(MagicMock): async def __call__(self, *args, **kwargs): return super().__call__(self, *args, **kwargs)
python
from django.db import models from django.test import TestCase from django_fsm import FSMField, transition, can_proceed class TestExceptTargetTransitionShortcut(models.Model): state = FSMField(default="new") @transition(field=state, source="new", target="published") def publish(self): pass @t...
python
# Problem: https://www.hackerrank.com/challenges/py-check-strict-superset/problem set_A = set(input().split()) n = int(input()) ind = 0 for _ in range(n): set_n = set(input().split()) union_set = set_A.union(set_n) if (union_set == set_A) and (len(set_A) > len(set_n)): ind += 1 if ind == n: pri...
python
import sys import os import os.path import glob def compareOutputs( expected, actual, message ): expected = expected.strip().replace('\r','').split('\n') actual = actual.strip().replace('\r','').split('\n') diff_line = 0 max_line_to_compare = min( len(expected), len(actual) ) for index in xrange(0...
python
from unittest import mock import pytest from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django_countries.fields import Country from django_prices_vatlayer.models import VAT from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange from saleor.core.taxes.vatlayer im...
python
#These variables are needed to make local variables in functions global custom_end='' homework_end='' assignment_end='' test_end='' quiz_end='' final_end='' custom_advance_details='' def quizzes(): while True: quiz_weight=input('How much does your quizzes weigh? or if not applicable type n/a ') ...
python
from msal.authority import * from msal.exceptions import MsalServiceError from tests import unittest class TestAuthority(unittest.TestCase): COMMON_AUTH_ENDPOINT = \ 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' COMMON_TOKEN_ENDPOINT = \ 'https://login.microsoftonline.com/co...
python
#!/usr/bin/env python3 class BarItem(object): valid_options = set(['full_text', 'short_text', 'color', 'min_width', 'align', 'name', 'instance', 'urgent', 'separator', 'separator_block_width']) COLOR_DEFAULT = '#FFFFFF' def __init__(self, name): a...
python
# a1.py advice for manhattan distance taken from # https://stackoverflow.com/questions/39759721/calculating-the-manhattan-distance-in-the-eight-puzzle # https://www.geeksforgeeks.org/sum-manhattan-distances-pairs-points/ from search import * import time import random # ... SOLVED_STATE = (1, 2, 3, 4, 5, 6, 7, 8, 0) ...
python
from requests_oauthlib import OAuth2Session from flask import Flask, request, redirect, session, url_for from flask.json import jsonify import os from requests_oauthlib.compliance_fixes import facebook_compliance_fix app = Flask(__name__) # This information is obtained upon registration of a new GitHub OAuth # applic...
python
############################################################################ # This Python file is part of PyFEM, the code that accompanies the book: # # # # 'Non-Linear Finite Element Analysis of Solids and Structures' # # R. ...
python
#!/usr/bin/env python ''' @todo: turn this into a real test runner for everything in the test subdir. ''' import sys from aisutils.BitVector import BitVector from aisutils import binary import ais_msg_1 import ais_msg_8 import sls.waterlevel if __name__=='__main__': # Try to parse some binary message if Fal...
python
import streamlit as st import pandas as pd from itertools import groupby from datetime import datetime import re from pretty_html_table import build_table st.set_page_config(layout='wide') JIRA_REGEX= "[A-Z]{2,}-\d+" def parse_blame(chunk): branch = chunk[0].split()[0] line_start = chunk[0].split()[1] ...
python
import ast import csv import korbinian import korbinian.utils as utils import numpy as np import os import pandas as pd import sys import time # import debugging tools from korbinian.utils import pr, pc, pn, aaa def get_TM_indices_from_TMSEG_topo_str(topo_str, TM_symbol="H"): """Get TM indices from TMSEG topology ...
python
# -*- coding: utf-8 -*- """ Swets NDVI filtering author: Laust Færch @ DHI GRAS Created on 2020/08/29 Based on the article: Swets, D.L, Reed, B.C., Rowland, J.D., Marko, S.E., 1999. A weighted least-squares approach to temporal NDVI smoothing. In: Proceedings of the 1999 ASPRS Annual Conference, Portland, Oregon, pp. ...
python
import json from django import forms from commons.file import file_utils from commons import file_name_tools from wikis.attachments import attachment_tool from django.core.exceptions import ValidationError from datetime import datetime from uzuwiki.settings_static_file_engine import MAX_FILE_SIZE, MAX_FILE_SIZE_MESSAGE...
python
# Jared Dyreson # CPSC 386-01 # 2021-11-29 # jareddyreson@csu.fullerton.edu # @JaredDyreson # # Lab 00-04 # # Some filler text # """ This module contains a basic "factory" pattern for generating new Display instances """ import abc import dataclasses import functools import json import pathlib import pygame import sy...
python
from intent_parser.server.intent_parser_server import app, IntentParserServer import os import logging.config import os logger = logging.getLogger(__name__) def _setup_logging(): logging.basicConfig(level=logging.INFO, format="[%(levelname)-8s] %(asctime)-24s %(filename)-23s line:%(lineno)...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Aug 10 21:32:34 2019 @author: teddy """ from docx import Document from docx.shared import RGBColor #from docx.dml.color import ColorFormat def getText(filename): doc = Document(filename) fullText = [] for para in doc.paragraphs: ...
python
######################################################## # Copyright (c) 2015-2017 by European Commission. # # All Rights Reserved. # ######################################################## extends("BaseKPI.py") """ Consumption (Wh) ------------------ Indexed by * scope * deli...
python
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ ########################################################################## ZipMe : GAE Content Downloader ########################################################################## Just add this lines in your app.yaml : - url: /zipme script: zipme.py ####...
python
""" Models for mongo database """ # from pymongo.write_concern import WriteConcern from pymodm import MongoModel, fields class Testing(MongoModel): onefield = fields.CharField() # NOTE: do not touch connection here, see experiments/mongo.py # class Meta: # connection_alias = 'test' # # w...
python
# Generated by Django 2.2.1 on 2019-05-10 22:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('wells', '0082_auto_20190510_0000'), ('wells', '0082_merge_20190510_1926'), ] operations = [ ]
python
from unittest import TestCase from semanticpy.vector_space import VectorSpace from nose.tools import * class TestSemanticPy(TestCase): def setUp(self): self.documents = ["The cat in the hat disabled", "A cat is a fine pet ponies.", "Dogs and cats make good pets.","I haven't got a hat."] def it_sh...
python
#! /usr/bin/env python from yices import * cfg = Config() cfg.default_config_for_logic('QF_BV') ctx = Context(cfg) bv32_t = Types.bv_type(32) x = Terms.new_uninterpreted_term(bv32_t, 'x') y = Terms.new_uninterpreted_term(bv32_t, 'y') zero = Terms.bvconst_integer(32, 0) fmla0 = Terms.bvsgt_atom(x, zero) fmla1 = Te...
python
"""A virtual pumpkin which flash neopixels and play sound""" import random import math import time import board import digitalio import audioio import busio import adafruit_vl53l0x import adafruit_thermistor import neopixel ######################### # -- slide switch to enable/disable running loop slide_switch = digit...
python
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import os import json import ctypes as ct from .._constants import VSCODE_CREDENTIALS_SECTION def _c_str(string): return ct.c_char_p(string.encode("utf-8")) clas...
python
# -*- coding: utf-8 -*- # # Copyright (C) 2021 Northwestern University. # # invenio-subjects-mesh is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """MeSH subjects_mesh.yaml writer.""" from pathlib import Path import yaml def writ...
python
# Copyright (c) 2013 eBay Inc. # Copyright (c) 2013 OpenStack Foundation # # 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 # # ...
python
# Задача 3. Вариант 30. #Напишите программу, которая выводит имя "Илья Арнольдович Файзильберг", и запрашивает его псевдоним. # Shemenev A.V # 14.03.16 print("Герой нашей программы Илья Арнольдович Файзильберг") print("Под каким именем мы знаем этого человека? Ваш ответ:") x=input() print ("Все верно, псевдоним - " +x)...
python
from models.generators.fcn32s import FCN32s from models.generators.fcn16s import FCN16s from models.generators.fcn8s import FCN8s
python
from django.conf.urls import url from messenger import views urlpatterns = [ url(r'^messenger/send', views.send, name='send'), url(r'^messenger/read', views.read, name='read') ]
python
#!/usr/bin/env python3 import argparse import progressbar import requests import os import sys sourceapp = "AS50559-DIVD_NL" def rest_get(call,resource,retries=3): url = "https://stat.ripe.net/data/{}/data.json?resource={}&sourceapp={}".format(call,resource,sourceapp) try: response = requests.get(url, timeout = ...
python
# Every line of these files consists of an image, i.e. 785 numbers between 0 and 255. size 28 x 28 # first no is label import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.keras.datasets import mnist from tensorflow.keras.models import Sequential from tensorflow.keras.l...
python
#!/usr/bin/env python """ @package mi.dataset.parser.test @file marine-integrations/mi/dataset/parser/test/ @author Jeff Roy @brief Test code for a wc_sbe_cspp data parser wc_sbe_cspp is based on cspp_base.py test_wc_sbe_cspp.py fully tests all of the capabilities of the base parser. That level of testing is omitted...
python
from datetime import datetime from os.path import dirname, join import pytest # noqa from city_scrapers_core.constants import ADVISORY_COMMITTEE, PASSED from city_scrapers_core.utils import file_response from freezegun import freeze_time from city_scrapers.spiders.cuya_audit import CuyaAuditSpider test_response = f...
python
from django.db import models from djchoices import DjangoChoices, ChoiceItem class UserStatuses(DjangoChoices): enter_address = ChoiceItem() enter_name = ChoiceItem() start = ChoiceItem() allowed = ChoiceItem() enter_org_name = ChoiceItem() enter_role = ChoiceItem() allowed_group = ChoiceI...
python
my_list= [3, 4, 6, 2] my_list1 = list(("Hello World"))
python
from itertools import product as product from math import sqrt as sqrt import numpy as np import torch import torch.nn as nn import torch.nn.init as init from torch.autograd import Function # from utils.box_utils import decode, nms # from utils.config import Config class L2Norm(nn.Module): def __init__(self, n_c...
python
from django.shortcuts import render from django.template import RequestContext, loader from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings from django.http import JsonResponse import simplejson as json import requests from django import template import urllib from collections i...
python
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # This file should only be present in a source checkout, and never in a release # package, to allow us to determine whether we're running in a development or # production mode.
python
import math if __name__ != "common": from objects import glob import time import json from common.ripple import userUtils def load_achievement_data(ACHIEVEMENT_BASE, ACHIEVEMENT_KEYS, ACHIEVEMENT_STRUCT): LENGTH = 0 ACHIEVEMENTS = [] for struct in ACHIEVEMENT_STRUCT: LENGTH = max(LENGTH, len(ACHIEVEMENT_KEYS...
python
from hashlib import pbkdf2_hmac, md5 import binascii from Crypto.Cipher import AES import os import sys def generate_key(title_id, pwd): # remove 00 padding from title id title_idGen = title_id[2:] # get secret string, append title id, and convert to binary string secret = binascii.unhexlify('fd040105...
python
# https://github.com/python-poetry/poetry/issues/11 import glob import os from distutils.command.build_ext import build_ext from distutils.core import Extension from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError def filter_extension_module(name, lib_objs, lib_headers): return...
python
# -*- coding: utf-8 -*- # Created by: Michael Lan import os import sys import re from PySide2.QtWidgets import QApplication, QMainWindow from PySide2 import QtGui, QtWidgets, QtCore from ui_main import Ui_Dialog from pyside_material import apply_stylesheet from dbconnection import connect, insert_data, close, valida...
python
""" $lic$ Copyright (C) 2016-2017 by The Board of Trustees of Stanford University This program is free software: you can redistribute it and/or modify it under the terms of the Modified BSD-3 License as published by the Open Source Initiative. If you use this program in your research, we request that you reference th...
python
# Basic Frame Differencing Example # # Note: You will need an SD card to run this example. # # This example demonstrates using frame differencing with your OpenMV Cam. It's # called basic frame differencing because there's no background image update. # So, as time passes the background image may change resulting in iss...
python
import tetris.input.gamepad as gp import pygame pygame.init() if __name__ == "__main__": sticks = [] qs = gp.PygameEventReader.q for stick in gp.get_available(): print(gp.display_gamepad_info(stick) + '\n') sticks.append(gp.GamepadWrapper(stick.get_id())) print('Listening...') ...
python
import datetime # enables the start time elements in date and time format # Interaction for patient with learning disabilities # "psychol_assessment", # "iapt", # "cmh_for_smi" # Mental health interaction 1: Psychological assessment def psychol_assessment(patient, environment, patient_time): encounter = { ...
python
def temp(input, output): img = cv2.imread(input) xmap, ymap = utils.buildmap_1(Ws=800, Hs=800, Wd=800, Hd=800, fov=193.0) cv2.imwrite(output, cv2.remap(img, xmap,ymap,cv2.INTER_LINEAR))
python
from datetime import date # random person class Person: # def __new__(cls, name, age): # print("New object called") # # super.__new__(cls[name, age]) def __init__(self, name, age): print('__init__ called') self.name = name self.age = age @classmethod def from...
python
import logging from discord.ext import tasks, commands from naotomori.cogs.source.anime import _9anime, gogoanime from naotomori.cogs.sourcecog import SourceCog logger = logging.getLogger('NaoTomori') class AnimeCog(SourceCog): """ AnimeCog: extends the SourceCog. """ def __init__(self, bot): ...
python
def params_to_string(task: dict) -> dict: for k in task['parameters'].keys(): if (isinstance(task['parameters'][k], int) or isinstance(task['parameters'][k], float)): task['parameters'][k] = str(task['parameters'][k]) return task
python
from distutils.core import setup from Cython.Build import cythonize setup(ext_modules = cythonize('./source/cython_functions.pyx',compiler_directives={'language_level' : "3"}))
python
from .chem import BOND_TYPES, BOND_NAMES, set_conformer_positions, draw_mol_image, update_data_rdmol_positions, \ update_data_pos_from_rdmol, set_rdmol_positions, set_rdmol_positions_, get_atom_symbol, mol_to_smiles, \ remove_duplicate_mols, get_atoms_in_ring, get_2D_mol, draw_mol_svg, GetBestRMSD from ...
python
# -*- coding: utf-8 -*- """ Created on Thu June 17 11:53:42 2021 @author: Pavan Tummala """ import os, numpy as np import cv2 import random import torch import torch.utils.data as data import xml.etree.ElementTree as ET from abc import ABCMeta, abstractmethod import scipy.cluster.vq as vq import pickle import pandas a...
python