content stringlengths 5 1.05M |
|---|
r"""
Tools
#####
**Helper Functions**
This module contains a variety of functions for manipulating images in
ways do NOT return a modified version of the original image.
.. currentmodule:: porespy
.. autosummary::
:template: mybase.rst
:toctree: generated/
tools.align_image_with_openpnm
tools.bbox_to_... |
import pytest
import os
from cclm.models import Embedder
def test_persist_embedder(tmp_path):
emb_dir = tmp_path / ".embedder_test"
emb = Embedder(max_len=5)
emb.save(emb_dir)
print(os.listdir(emb_dir))
emb2 = Embedder(load_from=emb_dir)
assert emb2.max_len == 5, "did not properly persist att... |
# flake8: noqa
from .tests_discoverer import load_tests
|
import sys
import os
import time
from PIL import Image
from pygame import mixer
def resize_image(img):
width, height = img.size
aspect_ratio = height / width
new_width = 120
new_height = int(aspect_ratio * new_width * 0.55)
return img.resize((new_width, new_height))
def image_to_ascii(img):
... |
# Version 0.2.0
# 2009/06/18
# Copyright Michael Foord 2005-2009
# akismet.py
# Python interface to the akismet API
# E-mail fuzzyman@voidspace.org.uk
# http://www.voidspace.org.uk/python/modules.shtml
# http://akismet.com
# Released subject to the BSD License
# See http://www.voidspace.org.uk/python/license.shtml
... |
labels = {
"X": [
"Q_AC_OFFICE",
"Q_HEAT_OFFICE",
"Q_PEOPLE",
"Q_EQP",
"Q_LIGHT",
"Q_AHU_C",
"Q_AHU_H",
"T_INT_OFFICE"
],
"Z": [
"ac_t_conf",
"ac_t_red",
"ac_mask",
"heat_t_conf",
"heat_t_red",
"h... |
""" Convenience functions to find the database and other system locations
without the user having to specify full paths.
"""
# std
import os
import collections
import datetime
import pathlib
from functools import lru_cache
import shutil
from typing import Union, Optional
# ours
from ankipandas.util.log import log
@... |
import asyncio
import json
import logging
from datetime import timedelta
from functools import partial
from typing import Optional
from collections import OrderedDict
import async_timeout
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from aiohttp import ClientSession
from homeassistant.... |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# 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 aiogram import types
from aiogram.dispatcher import FSMContext
from loader import dp, bot
from states import Request
from keyboards import create_kb_smart_choose_curr
# from keyboards import main_menu
from keyboards import create_kb_coustom_main_menu
@dp.message_handler(state=Request.how_much_give)
async def se... |
# ****数据预处理代码-第一步:数据清洗**** #
import pandas as pd
import numpy as np
import random
from collections import Counter
from sklearn import preprocessing
from matplotlib import pyplot as plt
import seaborn as sns
import missingno
from scipy import stats
import math
# 绘图预处理
plt.rcParams['font.sans-serif'] = ['... |
from radical.ensemblemd import Kernel
from radical.ensemblemd import Pipeline
from radical.ensemblemd import EnsemblemdError
from radical.ensemblemd import SingleClusterEnvironment
#Used to register user defined kernels
from radical.ensemblemd.engine import get_engine
#Import our new kernel
from new_kernel import MyU... |
import os
import tqdm
import pandas as pd
def load_records(path, results_fname='results', depth=1):
assert results_fname in ['results', 'meters']
records = []
def add_record(results_path):
try:
df = pd.read_pickle(results_path)
records.append(df)
# want to ignore ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
from core.base_page import BasePage
class SwaggerPage(BasePage):
"""
SwaggerPage logic
"""
templates_dir = "core/sys_modules/swagger/"
template = "Swagger_template.html"
group_access = ['ADMIN', 'DEVELOPER']
def get_data(self, req):
"""
Set up the data source
Args:... |
# coding=utf-8
from django.contrib.sitemaps import Sitemap
from blog.models import Entry
class BlogSitemap(Sitemap):
changefreq = "daily"
priority = 0.5
def items(self):
return Entry.objects.filter(public=True)
def lastmod(self, obj):
return obj.modified
|
# -*- coding: utf-8 -*-
# 09 April 2020
# Nicolò Stevanato - Politecnico di Milano - Fondazione Eni Enrico Mattei
#%% Definition of the inputs
from core import User, np
User_list = []
'''
This File contains the average appliances that charcterize a Primary School in Kenya, according to PoliMi field campaign - 2020
... |
import os
import torch
import numpy as np
from torch.utils.data import Dataset
from glob import glob
from copy import deepcopy
import data_util
import matplotlib.pyplot as plt
class NovelViewTriplets():
def __init__(self,
root_dir,
img_size,
sampling_pattern):
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from ...sync import sync_plans
class Command(BaseCommand):
help = "Make sure your Stripe account has the plans"
def handle(self, *args, **options):
sync_plans()
|
class Solution:
def isPalindrome(self, x: int) -> bool:
arr = str(x)
cnt = len(arr)
for i in range(0,cnt):
if arr[i] != arr[cnt-1-i]:
return 0
return 1
|
from Topsis_Harsimran_101903288.topsis import rank
__version__='v1.2'
|
# -*- coding: utf-8 -*-
"""
All database interactions are performed by Manager
"""
import logging
import datetime
import os
from sqlalchemy.orm import joinedload
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy import or_
from sqlalchemy import orm, func, over, Integer
from sqlalchemy.dialects.postgres imp... |
from ._CarlaActorInfo import *
from ._CarlaActorList import *
from ._CarlaCollisionEvent import *
from ._CarlaControl import *
from ._CarlaEgoVehicleControl import *
from ._CarlaEgoVehicleInfo import *
from ._CarlaEgoVehicleInfoWheel import *
from ._CarlaEgoVehicleStatus import *
from ._CarlaLaneInvasionEvent import *
... |
import unittest
from enum import Enum
from typing import List
class State(Enum):
DEATH = 0
LIVE = 1
class Transition(Enum):
DEATH_TO_DEATH = -1
DEATH_TO_LIVE = 0
LIVE_TO_DEATH = 1
LIVE_TO_LIVE = 2
class Solution:
@staticmethod
def gameOfLife(board: List[List[int]]) -> None:
... |
import re
import json
import copy
import mimetypes
import collections
from ashiba import utils
from lxml import etree
class Dom(collections.defaultdict):
def __init__(self, *args, **kwargs):
super(Dom, self).__init__(lambda: DomElement(''), *args, **kwargs)
for k in self:
self[k] = Dom... |
#Ejercicio GIT_DPG
#M.Carmen Delgado Muñoz y Ángela González Martín
def sumacuadrados(a,b):
return a**2+b**2
def multcuadrados(a,b):
return (a**2)*(b**2)
#Ahora vamos a añadir otra función
def sumacubos(a,b):
return a**3+b**3
|
import os
import shutil
from collections import defaultdict
from statistics import mean, stdev
import numpy as np
import pytest
from jina import Document, DocumentArray, Executor, requests, DocumentArrayMemmap
from pympler import asizeof, tracker
from .pages import Pages
from .utils.timecontext import TimeContext
NU... |
def book(k,i,a):
if k not in a:
a[i]=k
else:
print ("Seat Booked already")
def print_ticket(a):
print (a)
def cancel_ticket(t,a):
for i in range(0,len(a)-1):
if(a[i]==t):
del a[i]
print("ticket cancelled successfully and the ticket is",t)
def availablity(a):
for i in range(0,6):
if i n... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
from docutils import nodes
class category(nodes.Element):
pass
def category_role(name, rawtext, text, lineno, inliner,
o... |
import os
import re
import time
import requests
from bs4 import BeautifulSoup
import crower_table
def get_html(url):
"""
:param url: 爬取的网址参数,先将爬的内容缓存起来
:return: 返回一个soup类型
"""
out_time = time.strftime("%Y%m%d", time.localtime())
path_url = ''.join(re.findall(r'\w+', url))
path = 'temp/' +... |
import unittest
from project.factory.factory import Factory
from project.factory.paint_factory import PaintFactory
class TestPainFactory(unittest.TestCase):
def setUp(self):
self.paint = PaintFactory('Paint', 10)
self.paint.valid_ingredients = ["white", "yellow", "blue", "green", "red"]
def ... |
__author__ = 'NovikovII'
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from xml.etree import ElementTree
#print(os.getcwd())
print(dir(ElementTree))
file_route = 'C:\share\TestFAST\ptest_internet\configuration.xml'
file1 = open(file_route, 'r')
tree = ElementTree.parse(file1)
root = tree.getroot()
# pri... |
# -*- coding: utf-8 -*-
import os
import logging
from dotenv import find_dotenv, load_dotenv
from constants import *
from utils import json_from_file
from src.features.build_features import collect_feature
import shutil
from settings import *
def prepare_processed_training_data():
"""
Generate all features int... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_simulation_n.py
# Create Date: 2015-07-26 11:35:19
# Usage: AC_simulation_n.py
# Descripton:
class Solution:
# @param {integer[]} nums
# @return {string[]}
def summaryRanges(self, nums):
... |
from itertools import product
import numpy as np
import scipy.sparse
import numba
from ..utils import isscalar, PositinalArgumentPartial, _zero_of_dtype
from ..compatibility import range, zip, zip_longest
def elemwise(func, *args, **kwargs):
"""
Apply a function to any number of arguments.
Parameters
... |
from pydantic import BaseModel
from typing import Optional
from tottle.types.objects.location import Location
class Venue(BaseModel):
location: Optional[Location]
title: Optional[str] = None
address: Optional[str] = None
foursquare_id: Optional[str] = None
foursquare_type: Optional[str] = None
|
# import psycopg2 as psql
# import time
from abc import ABC
from typing import List
from ultitrackerapi import models
class Backend(ABC):
def get_user(self, username: str) -> models.User:
pass
def add_user(self, user: models.UserInDB) -> bool:
pass
def username_exists(self, username: st... |
def day1():
for i in range(0, len(numbers)-1):
for j in range(i, len(numbers)):
if numbers[i] + numbers[j] == 2020:
print("day 1\nNumbers: {},{}\nProduct: {}".format(numbers[i], numbers[j], numbers[i]* numbers[j]))
break
def day2():
for i in range(0, len(num... |
import unittest
from urwid.compat import B
from pyfx.view.json_lib import NodeFactory, DEFAULT_NODE_IMPLS
class ArrayNodeTest(unittest.TestCase):
"""
unit tests for :py:class:`pyfx.view.json_lib.array.array_node.ArrayNode`
"""
def setUp(self):
self._node_factory = NodeFactory(DEFAULT_NODE_I... |
import sys
sys.path.append(".")
from unittest import TestCase
from mykrobe.variants.schema.models import VariantCall
from mykrobe.variants.schema.models import Variant
from mykrobe.predict import TBPredictor
class AMRPredictTest(TestCase):
def setUp(self):
self.variant_snp = Variant.create(start=0, end... |
### rpg_queries.py
#
# runs exploratory queries on the MongoDB rpg database,
# answers questions from module 1
### ----- Connect to the database ------
# load environment variables for the MongoDB login
import os
from dotenv import load_dotenv
load_dotenv()
DB_USER = os.getenv("MONGO_USER", default="OOPS")... |
from itertools import combinations
from cpu import cpu, read, write
PRE = """south
take fixed point
north
west
west
west
take hologram
east
east
east
north
take candy cane
west
take antenna
south
take whirled peas
north
west
take shell
east
east
north
north
take polygon
south
west
take fuel cell
west"""
def aoc(dat... |
# -*- coding: utf-8 -*-
import re
from facebook import *
import str_formater
WORDS = ["FACEBOOK", "FEJSBUK", "POWIADOMIENIE", "POWIADOMIENIA"]
def handle(text, mic, profile, logger, modules):
"""
Responds to user-input, typically speech text, with a summary of
the user's Facebook notifications, i... |
import pandas as pd
import pytest
import os
from fuzzydata.core.generator import generate_schema
from tests.conftest import artifact_fixtures
@pytest.mark.dependency()
@pytest.mark.parametrize('artifact', artifact_fixtures)
def test_generate(artifact, request):
tmp_schema = generate_schema(20)
concrete_artif... |
from datetime import datetime, timedelta
from airflow.hooks import S3_hook
from typing import Optional
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class DataQualityOperator(BaseOperator):
"""
This operator e... |
import sys
import sqlite3
import binascii
import re
def check_task(task_db, info_hash_or_uri):
m = re.match(r'urn:btih:(\w+)', info_hash_or_uri)
if m:
info_hash = m.groups(1)
else:
info_hash = info_hash_or_uri
conn = sqlite3.connect(task_db)
c = conn.cursor()
bin_info_hash = ... |
from ._dispatch_wrapper import DispatchWrapper
class Page(DispatchWrapper):
""" The Page class manages properties for the document print out.
Example
-------
>>> import wellcad.com
>>> app = wellcad.com.Application()
>>> app.new_borehole()
<wellcad.com._borehole.Borehole object at 0x00000... |
import paddle
import paddle.nn.functional as F
from paddle.nn import Conv2D, ReLU, Linear, Layer
import gym_super_mario_bros
from gym.spaces import Box
from gym import Wrapper
from nes_py.wrappers import JoypadSpace
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
import cv2
import math
import numpy a... |
#NAME: NIRZARI IYER
#Assignment-3
#ID NUMBER: 1001117633
#BATCH TIME- 6:00 to 8:00 p.m.
import MySQLdb
import io
import os
import cloudstorage as gcs
import csv
import timeit
import json
from bottle import Bottle
from google.appengine.api import app_identity
from StringIO import StringIO
from bottle import route, reque... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 5 16:30:52 2019
@author: Ramon Barros
CE-QUAL-W2 Calibration Tool v0.0.1
MODEL ZOOPLANCTON GROUPS RATES & CONSTANTS
paramcontrol(name, calibrate, value, low, high, guess)
name = Parameter or setting name,
calibrate = boolean, True if the parameter must be calibrated (v... |
from . import Plugin
class UdpPlugin(Plugin):
targets = [
{
'targets': [
{
'match': '^servers\.(?P<server>[^\.]+)\.(?P<protocol>udp)\.(?P<type>In|Out)(?P<unit>Datagrams)$',
'configure': lambda self, target: self.fix_underscores(target, ['... |
#
# Copyright (c) 2019 UCT Prague.
#
# test_id_acl_unittests.py is part of Invenio Explicit ACLs
# (see https://github.com/oarepo/invenio-explicit-acls).
#
# 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 ... |
import json
import urllib
from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from crits.actors.forms import AddAct... |
""" MPI job submission
"""
from __future__ import absolute_import
import os, subprocess, logging
from threading import Thread
def sync_dir(local_dir, slave_node, slave_dir):
""" Sync the working directory from root node to slave node
"""
remote = slave_node + ":" + slave_dir
logging.info('rsync %s -> ... |
import pytest
from dagster_graphql import DagsterGraphQLClientError, ReloadRepositoryLocationStatus
from .conftest import MockClient, python_client_test_suite
@python_client_test_suite
def test_reload_repo_location_success(mock_client: MockClient):
response = {"reloadRepositoryLocation": {"__typename": "Reposito... |
dict_preposition={"अगला" :'Preposition',"ने":'Preposition',"ले":'Preposition',"टू":'Preposition',"इससे":'Preposition',
"अंदर" :'Preposition',"को":'Preposition',"वाले":'Preposition',
"अधीन " :'Preposition',
"अपेक्षा" :'Preposition',
"आगे" :'Preposition',
"आर-पार" :'Preposition',
"आस-पास" :'Preposition',
"उल्टा" :'Prepos... |
from argparse import ArgumentParser
from bbox_handler import BoundingBoxHandler
import json
import sys
import os
ap = ArgumentParser()
ap.add_argument('-i', '--input', required=True, help='File that contains PPOCR rotated bboxes')
ap.add_argument('-o', '--output', required=True, help='File name after combine rotated b... |
from __future__ import division
import difflib
import collections
import traceback
import sys
import ast
import re
from StringIO import StringIO
import sympy
from sympy.core.relational import Relational
import sympy.parsing.sympy_tokenize as sympy_tokenize
from token import NAME
OTHER_SYMPY_FUNCTIONS = ('sqrt',)
Arg... |
'''
# GIL,全局解释器锁
本质上是类似操作系统的互斥锁 Mutex
1. CPython 引进 GIL 其实主要就是这么两个原因:
一是设计者为了规避类似于内存管理这样的复杂的竞争风险问题(race condition);
二是因为 CPython 大量使用 C 语言库,但大部分 C 语言库都不是原生线程安全的
(线程安全会降低性能和增加复杂度)
2. GIL 是如何工作的
1 . 一个线程在开始执行时,都会锁住 GIL,以阻止别的线程执行;
同样的,每一个线程执行完一段后,会释放 GIL,以允许别的线程开始利用资源
2. check_interval,意思是 CPyt... |
from skills_ml.job_postings.corpora import Word2VecGensimCorpusCreator
import json
sample_documents = [{
"incentiveCompensation": "",
"experienceRequirements": "Here are some experience and requirements",
"baseSalary": {
"maxValue": 0.0,
"@type": "MonetaryAmount",
... |
from mmdet.apis import Inferencer
import mmcv
import cv2
from mmcv.runner import obj_from_dict
from mmdet import datasets
from mmdet.datasets.transforms import ImageTransform
config_file = 'configs/sipmask/sipmask_r50_caffe_fpn_gn_1x.py'
checkpoint_file = 'checkpoints/vis_sipmask_ms_1x_final.pth'
save_path = 'result... |
import requests
import time
from math import sin,cos,atan2,sqrt,pi
# VARIABLES GLOBALES
TOKEN = 'tu_token'
ETIQUETA = 'InternationalSpaceStation'
VARIABLE = "distancia"
URL_BASE = 'http://industrial.api.ubidots.com/api/v1.6/devices/'
# COORDENADAS
LAT = tu_latitud
LONG = tu_longitud
def get_iss_position():
# PO... |
#VERSION: 2.03
# AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Douman (custparasite@gmx.se)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... |
# Copyright 2020 William José Moreno Reyes
#
# 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... |
import sys
import os
import importlib
import tensorflow as tf
import pathlib
from pprint import pprint
from multiprocessing import Pool
from functools import partial
from datetime import datetime, timedelta, timezone
# This is so that the following imports work
sys.path.append(os.path.realpath("."))
import src.util... |
import asyncio
import json
import logging.config
import os
import time
from types import SimpleNamespace
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
import utils.orm as orm
from utils import coroweb
from utils.jinja_filter import datetime_filter
from utils.middleware import (
auth_fac... |
# On suppose que les adresses IPv4 & masques fournis sont sous leur répresentation classique, c-à-d xxx.xxx.xxx.xxx où xxx<=255
import re #expressions régulières
def conv_IPnum_vers_IPbin (ip) : #convertit une representation numérique d'adresse IP en binaire
return "".join ( [dec2bin(int(i)) for i in ip.sp... |
#!env python
import re
def c_to_mx_typename(c_type, special_map):
m = re.search("([a-zA-Z0-9]+)_t", c_type)
if m == None:
mx_type = c_type
else:
mx_type = m.groups()[0]
if c_type in special_map:
mx_type = special_map[c_type]
return mx_type.upper()
c_type = ('void', 'bool', 'double', 'float', 'uint64_t', '... |
EPOCHS = 3
LOG_ITER = 25
TEST_ITER = 50
WRITE_PERIOD = 100
#1440 train examples
#360 train examples |
tempoGasto = int(input())
velocidadeMedia = int(input())
consumoMedio = 12
calculoDistancia = velocidadeMedia*tempoGasto
consumoTotal = calculoDistancia/consumoMedio
print("%.3f"%consumoTotal) |
class CompareGraphAttrs:
CHANGE_COUNT = "_change_count"
CHANGED_ATTRIBUTES = "_attr_diff"
CHANGED_DEP = "_changed_dep"
CHANGED_CHILD = "_changed_child"
ONLY_IN = "_only_in"
|
#!/usr/bin/env python
from plasTeX import Command
class fancypagestyle(Command):
args = 'style'
class fancyhead(Command):
args = '[ pos ] text'
class fancyfoot(fancyhead):
pass
class fancyhf(Command):
args = 'text'
class rightmark(Command):
pass
class leftmark(Command):
pass
class chapte... |
import os
import getpass
import pathlib
CREDENTIAL_FILE = os.path.join(str(pathlib.Path(__file__).parent.absolute()),
'.env')
def get_credentials(credential_file: str = CREDENTIAL_FILE):
if os.path.exists(credential_file):
[url, username,
password] = [a.strip() for... |
#!/usr/bin/env python
#Code to generate a full shell of diffusion-weighted, eddy distorted images using FSL's possum, along with data that can be used to
#establish a ground truth.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Handle arguments (before i... |
def can_build(plat):
return plat == 'android'
def configure(env):
if env['platform'] == 'android':
env.android_add_dependency("compile 'com.google.firebase:firebase-core:9.8.0'")
env.android_add_dependency("compile 'com.google.firebase:firebase-messaging:9.8.0'")
env.android_add_dependency("c... |
import os
import torch
import numpy as np
import scipy.misc as m
from torch.utils import data
from PIL import Image
import sys
sys.path.append('.')
from collections import OrderedDict
import os
import numpy as np
import glob
import random
train_scenes = "scene_01"
test_scenes = ["scene_03","scene_07", "scene_10" ]... |
from django.conf.urls import url
from django.urls import path
from . import views
urlpatterns = [
url(r'^login/$', views.login, name='login'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^profile/$', views.user_profile_update, name='user_profile_update'),
url(r'^password-change/$', views.... |
from spaceone.identity.connector.auth_plugin_connector import AuthPluginConnector
|
"""
Copyright 2012 Daniel Lytkin.
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 wr... |
from typing import List, Optional, Tuple, Any
from itertools import chain
class SubstituteGeneratorsCombiner:
def __init__(self, subst_generators: List):
self.subst_generators = subst_generators
def generate_substitutes(
self,
sentences: List[List[str]],
target_ids: List[int],
... |
import asyncio
from pathlib import Path
import uuid
import pytest
from trinity.db.orm import (
SchemaVersion,
Base,
_setup_schema,
_check_is_empty,
_check_tables_exist,
_check_schema_version,
_get_session,
get_tracking_database,
)
from trinity.exceptions import BadDatabaseError
@pyte... |
# -*- coding: utf-8 -*-
from __future__ import annotations
import itertools
import collections
from abc import ABC, abstractmethod
from typing import (cast,
Any,
Callable,
Dict,
List,
Optional,
Sequ... |
# -*- coding: utf-8 -*-
"""
Tree IO compatibility utilities and classes.
"""
import base64
import io
import itertools
import json
import math
import os
import pathlib
import re
import struct
import sys
from typing import Callable, Optional, Tuple, Union
import cv2
import h5py
import numpy as np
import pandas as pd
i... |
"""add unique constraint to software table
Revision ID: 931e55599de8
Revises: f1e4fcb38055
Create Date: 2021-10-28 10:54:15.305576
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '931e55599de8'
down_revision = 'f1e4fcb38055'
branch_labels = None
depends_on = None
def upgrade():
... |
# temporary mapping algorithm of existing Canadian cases data to hospital occupancy rates
import json
import geocoder
import os
from dotenv import load_dotenv
import pandas as pd
from math import inf
from math import sin
from math import cos
from math import atan2
from math import sqrt
# firebase
import firebase_admi... |
# Copyright (c) 2015-2021 Agalmic Ventures LLC (www.agalmicventures.com)
#
# 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 u... |
# -*- coding: utf-8 -*-
from chai import Chai
from arrow import api, arrow, factory
class ModuleTests(Chai):
def test_get(self):
self.expect(api._factory.get).args(1, b=2).returns("result")
self.assertEqual(api.get(1, b=2), "result")
def test_utcnow(self):
self.expect(api._factory... |
class SemanticException(Exception):
pass
|
import sys
import auth
import testList
import testServer
def main(argv):
# testList.novaList()
# testList.glanceList()
serverName = "will_test"
testServer.createServer(serverName)
testServer.deleteServer(serverName)
if __name__ == "__main__":
main(sys.argv[1:])
|
def unique(l):
used = set()
return [x for x in l if x not in used and (used.add(x) or True)]
|
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 09:11:06 2020
@author: cgasca
"""
import csv
import numpy
import pandas as pd
def readCSV(filename):
raw_data = open(filename, 'rt')
reader = csv.reader(raw_data, delimiter=',', quoting=csv.QUOTE_NONE)
x = list(reader)
return x
def readXLSX(filename)... |
print('hola mundo :D')
print(5-2)
print(10//4)
print(2**4)
print(4+3)
x = 10
mi_string ="hola" |
#!/usr/bin/python
################################################################################
# 2137f054-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... |
#!/usr/bin/env python
"""
Continuous backup and recoverable trash can for Git
The aim of ``git-blackhole`` is to connect any of your repositories to
a single repository ("blackhole" repository) to which you can push any
commits --- WIP commits, branches no longer needed, and useless
stashes.
There are three main fea... |
while True:
n=int(input('Quer ver a tabuada de qual valor? '))
if n < 0:
print('Adeus')
break
print('-='*30)
for c in range(1, 11):
print(f'{n} x {c} = {c*n}')
print('-='*30)
|
"""
Module to create topo for this example.
Piecewise linear canonical beach and solitary wave.
"""
from pyclaw.geotools import topotools
import numpy as np
x0 = 19.85
slope = 1./x0
xs = 22.
H = 0.0185
nxpoints = 91
nypoints = 4
xlower = -20.e0
xupper = 60.e0
dx = (xupper-xlower)/(nxpoints-1)
ylower = 0.e0
yupper ... |
import random
import re
import sys
import bs4
import discord
import requests
from discord.ext import commands # Bot Commands Frameworkのインポート
# from datetime import datetime
sys.path.append('../')
class Nirezi(commands.Cog, name="nirezi"):
def __init__(self, bot):
self.bot = bot
@commands.Cog.list... |
#!/usr/bin/env python3
#from .logging import *
from BruteLoops.logging import *
from . import logging
from .brute_time import BruteTime
from . import sql
from .config import Config
from .db_manager import *
from sqlalchemy.orm.session import close_all_sessions
from pathlib import Path
from uuid import uuid4
from colle... |
"""
Use these variable to easily compare the values of the payload
"""
NULL: int = -1
NOT_IMPLEMENTED_YET: Exception = NotImplemented
ROUND_WIN_T_BOMB: str = "t_win_bomb"
ROUND_WIN_T_ELIMINATIONS: str = "t_win_elimination"
ROUND_WIN_CT_DEFUSE: str = "ct_win_defuse"
ROUND_WIN_CT_ELIMINATIONS: str = "ct_win_elimination... |
import numpy as np
import pandas as pd
import sys
import math
from tabulate import tabulate
def isValidPrior(data):
if (data.values < 0).any():
return False
elif data.sum(axis=1)[0] != 1.0:
return False
return True
def getN(filename):
data = pd.read_csv(filename, delimiter=";", header=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.