content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
"""
Defines a function to randomly generate particle positions according to
the desired surface density profile (sigma vs r) and the vertical profile
(rho vs r,z).
Created on Mon Jan 27 18:48:04 2014
@author: ibackus
"""
# External packages
import pynbody
SimArray = pynbody.array.SimArray
im... |
import itertools
import os
import sqlite3
from pprint import pformat
from ..log import log
from ..utils import get_env_override, get_resource_path, get_storage_path
from ..version import __version__
from .db_base import YtdlDatabase, YtdlDatabaseError
class YtdlSqliteDatabase(YtdlDatabase):
def __init__(self):
... |
""" run direct from cli interactive w/o ee
"""
import os
import pytest
from typing import List
from .base import BaseClass
from .base import inventory_path
from .base import playbook_path
CLI_RUN = f"ansible-navigator run {playbook_path} -i {inventory_path}"
testdata_run: List = [
(0, CLI_RUN, "ansible-navigator... |
#8
row=0
while row<11:
col=0
while col<6:
if (row==0 and col!=0 and col!=5) or (col==0 and row!=10 and row!=0 and col!=5 and row!=5)or (row==5 and col==1)or (row==5 and col==2)or (row==5 and col==3)or (row==5 and col==4) or(col==5 and row!=10 and row!=5 and row!=0)or (row==10 and col==1)or (row==... |
"""Work-A-Holic (WAH)
for that feeling of "WAH, how did I spend 200 hours on this?"
Adapted from https://github.com/acoomans/gittime
Work in progress
"""
import argparse
import yaml
from colorama import init, Fore, Style, Back
from git import Repo
from git.objects.commit import Commit # typing
from pathlib import Pa... |
from importlib import import_module
from typing import Optional
from fabric import Task
from fabric.connection import Connection
from patchwork.files import directory, exists
import plush.fabric_commands
from plush.fabric_commands.git import clone
from plush.fabric_commands.permissions import set_permissions_f... |
from PyEasyQiwi.qiwi_service.recourse import * |
from main.utils.celery_tasks import celery_analyze_shots
from vision_video_analyzer.settings import MEDIA_ROOT
from django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.utils.safestring import mark_safe
from django.contrib import mes... |
def keep_odds(iterable):
return [item for item in iterable if item % 2 == 1]
|
# to be executed in the fleur/ directory
from glob import glob
files = []
files.extend(glob("**/*.f90"))
files.extend(glob("**/*.F90"))
cmake_files = glob("**/CMakeLists.txt")
def rm_comments(line):
comm_pos = line.find("#")
if comm_pos == -1:
return line
else:
return line[:comm_pos]
def in_cmake(cm... |
import time
from dagster import In, Out, Output, graph, op
def nonce_op(name, n_inputs, n_outputs):
"""Creates an op with the given number of (meaningless) inputs and outputs.
Config controls the behavior of the nonce op."""
@op(
name=name,
ins={"input_{}".format(i): In() for i in range... |
import random
from app.genetic.genes.fundamental.yy_change.gene_yy_change import GeneYYChange
class PSyy(GeneYYChange):
def __init__(self):
super().__init__()
self.indicator = "P/S"
self.compared_value = random.uniform(0.8, 1.8)
|
# -*- coding: utf-8 -*-
# Spider Lv4
# Author: Yue H.W. Luo
# Mail: yue.rimoe@gmail.com
# License : http://www.apache.org/licenses/LICENSE-2.0
# More detial: https://blog.rimoe.xyz/2019/03/14/post01/
"""
## NOTE
Created on Mon Mar 11 19:07:03 2019
This programme is used to get data from Tencent street view.
... |
from worker import Worker
import json
import pyspark as sp
import logging
logger = logging.getLogger()
class SparkWorker(Worker):
def __init__(self):
self.context = sp.SparkContext(appName="SparkWorker")
self.context.setLogLevel("ERROR")
def preparar_codigo(self, codigo, num_archivos):
... |
# See http://maggotroot.blogspot.ch/2013/11/constrained-linear-least-squares-in.html for more info
"""
A simple library to solve constrained linear least squares problems
with sparse and dense matrices. Uses cvxopt library for
optimization
"""
__author__ = "Valeriy Vishnevskiy"
__email__ = "valera.vishnevs... |
#Radhika PC
#5/25/2016
#Homework 2- dictionaries
movie = { 'title': 'spy', 'release': '2015', 'director': 'Paul Feig', 'budget': '65000000' , 'revenue': '233125712' }
# TA-COMMENT: (-0.5) We can add entries to a dictionary AFTER making it. We wanted to see:
# movie['budget'] = 65000000
# rather than "hard coding" bu... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 12:07:00 2020
@author: acrog
"""
'''
Notes: try joining box top and bottom edges together
first box top edge should be at y =0
last box bottom edge should be at y = height of image
**determine the letter each box is closest to then use max height
... |
"""
Module: 'microWebTemplate' on esp32_LoBo
MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.24', version='ESP32_LoBo_v3.2.24 on 2018-09-06', machine='ESP32 board with ESP32')
Stubber: 1.0.0 - updated
"""
from typing import Any
class MicroWebTemplate:
""""""
def Execute(self, *args) -> Any:
... |
import unittest
import orca
import os.path as path
from setup.settings import *
from pandas.util.testing import *
class Csv:
pdf_csv = None
odf_csv = None
class SeriesTakeTest(unittest.TestCase):
def setUp(self):
self.PRECISION = 5
@classmethod
def setUpClass(cls):
# configure d... |
# Standard library
import unittest.mock
# Installed
import click.testing
import pytest
# Own modules
from dds_cli.user import User
from dds_cli.__main__ import dds_main
@pytest.fixture
def retrieve_token():
"""Fixture to mock authentication by having a None token for every user."""
with unittest.mock.patch.... |
import numpy as np, pandas as pd, torch
def save_emb(d, experiment, data_dir):
emb = dict()
if experiment.Model.name == "ConEx":
for e in d.entities:
emb[e] = np.array(experiment.Model.cpu().emb_e_real(torch.tensor(experiment.entity_idxs[e])).detach().tolist()+experiment.Model.cpu().emb_e_img(torch.tenso... |
from rest_framework import serializers
from mneia_admin_backend.models import AreaURL
class AreaURLSerializer(serializers.ModelSerializer):
class Meta:
model = AreaURL
fields = ("id", "area", "url", "type")
|
from .web3_top_class import Web_Class_IPC
import redis
import datetime
class Save_Block_Chain_Data(object):
def __init__(self):
redis_handle = redis.StrictRedis( db=1 )
signing_key = '/mnt/ssd/ethereum/dev_data/keystore/UTC--2019-12-08T20-29-05.205871190Z--75dca28623f88b105b8d0c718b4bfde0f15... |
#this script does the following:
#for each library
#get oligos
#add typeIIs cutters (BtsI)
#check that no new restriction sites added
#pad the oligos to same length
#add barcode with nicking sites (Nt.BspQI)
#check that no new restriction sites added
#add amplification primers
#check that no new restriction sites adde... |
"""Unit tests for day 4 submission"""
from aoc2021 import day4
from aoc2021.day4 import BingoBoard
INPUT_FILE_PATH = 'tests/inputs/day4_tst.txt'
TEST_FILE_EXPECTED_NUMBERS = [7, 4, 9, 5, 11, 17, 23, 2, 0, 14,
21, 24, 10, 16, 13, 6, 15, 25, 12, 22, 18, 20, 8, 19, 3, 26, 1]
TEST_FILE_EXPE... |
"""
Tests common to list and UserList.UserList
"""
import sys
import os
from test import test_support, seq_tests
class CommonTest(seq_tests.CommonTest):
def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), self.type2test())
# Init clears previous values
... |
class Puck(object):
def __init__(self):
self.x = width / 2
self.y = height / 2
self.r = 12
self.reset()
self.rightscore = 0
self.leftscore = 0
def checkPaddleLeft(self, p):
if self.y - self.r < p.y + p.h / 2 and self.y + self.r > p.y - p.h / 2 and self.x... |
# -*- coding: utf-8 -*-
import logging
import simplejson
import os
import openerp
from openerp.addons.web.controllers.main import manifest_list, module_boot, html_template
class PointOfSaleController(openerp.addons.web.http.Controller):
_cp_path = '/pos'
@openerp.addons.web.http.httprequest
def app(self,... |
from flask import render_template,request,redirect,url_for,abort
from . import main
from .forms import BlogForm,UpdateProfile,CommentForm
from ..models import User,Blog,Comment,Subscribe
from flask_login import login_required,current_user
from .. import db
from ..request import get_quotes
# from ..email import mail_me... |
from app.http.api.middlewares import login_required, admin_or_owner
from app.servers.models import db
from app.plugins.pinger import Pinger
from app.servers.models import Server, ServerActivity
from app.servers.tasks import add_activity_log
def _update_status_callback(future):
status = future.serverinfo.r... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!C:\Users\jjwri\PycharmProjects\mapping\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'ogrtools==0.7.3','console_scripts','ogr'
__requires__ = 'ogrtools==0.7.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sy... |
"""
Functions for managing configuration and sytem setup.
Do not import any django code in this file, if you must, inline the imports
in the function, NEVER at the top!!!
"""
import os
import re
import sys
from datetime import datetime
from typing import Optional, Dict, Union, Set, IO, List, Any
import shutil
impor... |
# ----------------------------------------------------------------------
# ReportObjectAttrubuteResolver datasource
# ----------------------------------------------------------------------
# Copyright (C) 2007-2017 The NOC Project
# See LICENSE for details
# -------------------------------------------------------------... |
#!/usr/bin/env python3
"""
Generates Netscape bookmark dumps
See:
- https://github.com/shaarli/netscape-bookmark-parser
"""
from argparse import ArgumentParser
from random import randint
from faker import Faker
HEADER = '''<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be r... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import RealEstate, Property
from property.serializers import RealEstateSerializer
REAL_ESTATE_URL = reverse('pr... |
#!/usr/bin/env python3.8
#
########################################
#
# Python Tips, by Wolfgang Azevedo
# https://github.com/wolfgang-azevedo/python-tips
#
# Loop For
# 2020-03-07
#
########################################
#
#
import time
vendors = ["CISCO", "HUAWEI", "JUNIPER", "ERICSSON", "MICROTIK"]
for i in ven... |
import tensorflow as tf
import numpy as np
import os, sys, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from pgn.model import PGN
from pgn.train_helper import train_model, get_train_msg
from utils.c... |
"""Graph a histogram of a remotely sensed image"""
# http://git.io/vqs41
# uses output from swap-bands.py script
from gdal import gdal_array
import turtle as t
def histogram(a, bins=list(range(0, 256))):
"""
Histogram function for multi-dimensional array.
a = array
bins = range of numbers to match
... |
def _tmpfile():
"""Implementation of File::Temp tmpfile()"""
return tempfile.TemporaryFile()
|
# from dynaconf import settings
# from dynaconf.loaders.redis_loader import load as dc_redis_load
# from util.config.base_dynaconf_config import init_all_dynaconf_redis_config
# 根据需要初始化所有的dynaconf在redis中的config
# init_all_dynaconf_redis_config()
# 再次读取redis存储的dynaconf配置
# dc_redis_load(settings, key="DYNACONF_DEVELOP... |
# Generated by Django 2.1.9 on 2019-08-27 08:24
import datetime
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import resources.models.utils
class Migration(migrations.Migration):
initial =... |
from uuid import uuid4
from django.db import models
class Shifts(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid4, editable=False)
name = models.CharField(
max_length=200,
blank=False, null=False)
start = models.TimeField(
blank=False, null=F... |
import csv
import urbackup_api
import time
import datetime
import logging
excel_output = True
def count_cbt_clients_server(serverurl, username, password):
server = urbackup_api.urbackup_server(serverurl, username, password)
clients = server.get_status()
if clients==None:
print("Getting client... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2021, Manuel Widmer <mawidmer@cisco.com>
# Copyright: (c) 2021, Anvitha Jain (@anvitha-jain) <anvjain@cisco.com>
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, pri... |
def readLines(filename):
list = []
count = 0;
with open(filename, encoding="utf8") as f:
while True:
count += 1
# Get next line from file
line = f.readline()
list.append(line)
# if line is empty
# end of file is reached
... |
import torch
from models.common import AutoShape
class Yolo:
_instance = None
path_weights = "../data/weights/best.pt" # path to model weights 'path/to/best.pt'
def __init__(self) -> object:
pass
# Make yolo model
self.model = None
self.__model_load()
def __new__(cls... |
# Import pandas as pd
import pandas as pd
# Import the cars.csv data: cars ,including index_col.
cars=pd.read_csv("cars.csv")
# Print out cars
print(cars)
# Import pandas as pd
import pandas as pd
# Fix import by including index_col ,excluding index_col;
cars = pd.read_csv('cars.csv',index_col=0)
# Print out car... |
from queue import Queue
from glouton.shared.logger import logger
from glouton.workers.pageScanWorker import PageScanWorker
from glouton.shared import threadHelper
from glouton.infrastructure.satnogNetworkClient import SatnogNetworkClient
from threading import Event
class ObservationRepo:
def __init__(self, cmd, r... |
import os
import sys
import json
import torch
import logging
import traceback
from tqdm import tqdm
from . import loader_utils
from .loader_utils import load_dataset, flat_rank_pos, limit_scope_length, stemming
from ..constant import BOS_WORD, EOS_WORD
from torch.utils.data import Dataset
logger = logging.getLogger()... |
#!/usr/bin/env python3
"""Detects time conflicts in Zoom meetings and posts a summary to a webhook.
A meeting conflicts with another meeting if the (start, end) ranges overlap
and if the host is the same user.
"""
import collections
import datetime
import itertools
import logging
import json
import requests
import os... |
import os
SITE_SLUG = "bluetail"
CORE_APP_NAME = "bluetail"
SITE_NAME = 'bluetail'
LIVE_ROOT = ''
SHARE_IMAGE = ''
TWITTER_SHARE_IMAGE = ''
SITE_DESCRIPTION = ''
SITE_TWITTER = ''
GOOGLE_ANALYTICS_ACCOUNT = ''
SASSC_LOCATION = 'sassc'
# Preferred company identifier scheme
COMPANY_ID_SCHEME = os.getenv("COMPANY_ID_SCHE... |
#
# This is Seisflows
#
# See LICENCE file
#
###############################################################################
# Import system modules
import sys
# Import Numpy
import numpy as np
# Local imports
from seisflows.tools import unix
from seisflows.tools.tools import exists
from seisflows.config import cust... |
##from pathlib import Path
import requests
startI = int(input("Enter starting Index Number: "))
endI = int(input("Enter ending Index Number: "))
i = startI
while i < endI:
header = {
"authority": "admission.doenets.lk",
"method": "POST",
"path": "/api/admission",
"schem... |
import os
from pathlib import Path
cwd = Path(__file__).parent
download_path = Path('inputs')
sas_url = os.environ.get('SAS_SIDS_CONTAINER')
azure_container = sas_url.split('?')[0]
azure_sas = sas_url.split('?')[1]
epsg = os.environ.get('EPSG', '4326')
xmin = os.environ.get('CLIP_XMIN', '-180')
xmax = os.environ.ge... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import os
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils import json
try:
from flexget.plugins.api_tvdb impo... |
import decimal
from django.db import models
from django.db.models import Sum
class Marathon(models.Model):
DONATION_MINIMUM_DEFAULT = decimal.Decimal(1.0)
EURO = "EUR"
USD = "USD"
SEK = "SEK"
CURRENCY_CHOICES = [(EURO, "Euro"), (USD, "U.S. Dollar"), (SEK, "Swedish Krona")]
start_time = model... |
import shelve
db = shelve.open('class-shelve')
sue = db['sue']
sue.giveRaise(.25)
db['sue'] = sue
tom = db['tom']
tom.giveRaise(.20)
db['tom'] = tom
db.close()
|
from copy import deepcopy
from cpl import INF
from cpl.graph import AdjMatrix
def floyd_warshall(graph: AdjMatrix):
N: int = len(graph)
cost: AdjMatrix = deepcopy(graph)
for k in range(N):
for i in range(N):
for j in range(N):
if cost[i][k] == INF or cost[k][j] == INF:... |
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_mlp(in_channels, mlp_channels, act_builder=nn.ReLU, last_act=True):
c_in = in_channels
module_list = []
for idx, c_out in enumerate(mlp_channels):
module_list.append(nn.Linear(c_in, c_out))
if last_act or idx < len... |
from flopz.core.function import Function
from flopz.core.module import Module, SequentialModule
from flopz.core.shellcode import Shellcode
from flopz.core.assembler import Assembler
from flopz.arch.ppc.vle.e200z0 import E200Z0
from flopz.arch.ppc.vle.instructions import *
from flopz.core.label import Label, LabelRef
f... |
# Copyright 2020 Neoinvest.ai
#
# 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,... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
class Sequence(object):
def __init__(self, identifier, comment, seq):
self.id = identifier
self.comment = comment
self.seq = self._clean(seq)
def _clean(self, seq):
"""
remove newline from the string representing the sequence
:param seq: the string to clean
... |
from .server import Batch, EvaluatorServer
__all__ = [Batch, EvaluatorServer]
|
from tornado.web import Application, RequestHandler
import json
import asyncio
import pandas as pd
import datetime
from ..db import db_conn, dumper_job, job_interface
from ..appconfig import AppConfig
from dateutil import parser
from pathlib import Path
config = AppConfig()
from collections import OrderedDict
impor... |
# -*- coding: UTF-8 -*-
"""
Tesselect module based on Delaunay tesselation and provides
some grain analysis techniques for microscopy images.
Dependencies:
-------------
Python 3.x
NumPy
SciPy
Matplotlib
Shapely (optional - only for one function)
Available functions:
--------------------
- MinusND - substract N... |
n = input('Enter the name of the student: ')
marks = int(input('Enter the marks: '))
phoneNumber = int(input("Enter student's phone number: "))
print ('The name of the student is {},his marks are {} and phone number is {}.'.format(n, marks, phoneNumber))
|
from .version import VERSION
from .template_code import template_main
__all__ = ['template_main']
__version__ = VERSION
|
#!/anaconda2/bin/python
from units import Units
class Commodity( object):
def __init__( self, price, units):
self.price = price
self.units = Units( units)
def inverse( self):
return 1.0/self.price, self.units.inverse()
class Triarb():
def __init__( self, sideOne, sideTwo, sideThr... |
import tensorflow as tf
import numpy as np
import skimage.io
import itertools
import os
import bz2
import argparse
import scipy
import skimage.transform
CONTENT_LAYERS = ['4_1']
LOCAL_STYLE_LAYERS = ['1_1','2_1','3_1','4_1']
GLOBAL_STYLE_LAYERS=['1_1','2_1','3_1','4_1']
def conv2d(input_tensor, kernel, bias):
ke... |
# -*- coding: utf-8 -*-
# @Time : 2019/1/2 0002 12:47
# @Author : __Yanfeng
# @Site :
# @File : views.py
# @Software: PyCharm
from flask import redirect, render_template, url_for, request
from flask_login import login_required,current_user
from . import post
from .forms import PostForm
from apps.models impo... |
# -----------------------------------------------------
# -*- coding: utf-8 -*-
# @Time : 8/22/2018 5:27 PM
# @Author : sunyonghai
# @Software: ZJ_AI
# -----------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Correl J. Roush, Gerónimo Oñativia
import base64
import os
import sys
import threading
import common
import search
import json
import xbmc
import xbmcgui
from basictypes.bytes import Bytes
_ = sys.modules["__main__"].__language__
__settings__ = sys.modules["__main__"].__s... |
i=3
j=2
print(i < j + 5 > j ** 5)
#False
#3<2+5 is True and 7>2**5 is False |
"""
Module used to test the base configuration class.
"""
import os
import pytest
from clickandobey.dockerized.webservice.configuration.webservice_configuration import WebserviceConfiguration
@pytest.mark.unit
@pytest.mark.WebserviceConfiguration
class TestWebserviceConfiguration:
"""
Class used to test the... |
from blueprints import create_app
from config import config
api = create_app(config) |
# -*- coding: utf-8 -*-
from fabric.api import env, run, local, settings
from datetime import datetime
def github(m='Commit something to master...'):
'''github:m = "COMMIT LOGGING"\t(default as 'Commit something to master...')
'''
local('pwd'
'&& git add -A'
'&& git commit -am "{msg}"'
'&& ... |
# -*- coding: utf-8 -*-
import abc
class BaseLearningRate(metaclass=abc.ABCMeta):
@abc.abstractmethod
def get(self, t):
""" Get the learning rate for time t """
class ConstantLearningRate(BaseLearningRate):
def __init__(self, lr):
self.lr = lr
def get(self, t):
return self.... |
from dotenv import load_dotenv
import requests
import json
from dict2xml import dict2xml
import os
file_path = os.path.dirname(os.path.abspath(__file__))
env_path = os.path.join(file_path, "..", ".env")
load_dotenv(env_path)
server_name = os.getenv("SEVER_NAME")
user_name = os.getenv("USER_NAME")
password = os.geten... |
from re import findall
from typing import Dict, List, Optional, Tuple, Union
from PIL import Image, ImageFont, ImageColor
from .errors import (
FontNotFound,
InvalidColorFormat,
InvalidFieldLength,
InvalidFormatOption,
InvalidProfilePicturePath,
InvalidProfilePictureDimensions,
InvalidTweetN... |
import taos
from datetime import datetime, timezone, timedelta
def bind_params(num_columns: int, tz_offset, fields: list, **kwargs):
params = taos.new_bind_params(num_columns)
i = 0
for f in fields:
if f['Note'] == "":
param = kwargs.get(f['Field'])
if param is None:
... |
from django.shortcuts import render
def resume_index(request):
return render(request, "resume_index.html")
|
"""
File: hangman.py
-----------------------------
This program plays hangman game.
Users sees a dashed word, trying to
correctly figure the un-dashed word out
by inputting one character each round.
If the user input is correct, show the
updated word on console. Players have N_TURNS
to try in order to win this game.
""... |
from setuptools import setup
setup(
name='devpotato-bot',
version='0.6.1',
description='Telegram bot for cryptopotato chat',
packages=['devpotato_bot'],
python_requires='>=3.8',
install_requires=[
'python-telegram-bot>=13.0',
'ujson>=3.0.0',
'cachetools>=4',
'py... |
import pytest
from clearml_agent.helper.repo import VCS
@pytest.mark.parametrize(
["url", "expected"],
(
("a", None),
("foo://a/b", None),
("foo://a/b/", None),
("https://a/b/", None),
("https://example.com/a/b", None),
("https://example.com/a/b/", None),
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from manga_dl.addons import mangabz
from manga_dl import config
proxy = 'socks5://127.0.0.1:1086'
proxies = {"http": proxy, "https": proxy}
config.init()
config.set("proxies", proxies)
def test_mangabz():
api = mangabz.Mangabz
manga_urls = api.fetch_keyword("關... |
import unittest
from pytown_core.runners import MyThread
import logging
class MyThreadTest(unittest.TestCase):
def setUp(self):
self.subject = Subject()
def test_my_thread_init(self):
self.subject.start()
self.subject.join()
self.assertEqual(self.subject.compteur, 10)
... |
re.search(r'ab*c', 'abc ac adc abbbc')
re.search(r'b.*d', 'abc ac adc abbbc')
re.search(r'b.*d', 'abc ac adc abbbc')
re.search(r'b.*d', 'abc ac adc abbbc')[0]
re.search(r'b.*d', 'abc ac adc abbbc').group(0)
m = re.search(r'a(.*)d(.*a)', 'abc ac adc abbbc')
m[2]
m.groups()
re.sub(r'(a|b)\^2', lambda m: m[0].uppe... |
# coding: utf-8
"""
SignRequest API
API for SignRequest.com
OpenAPI spec version: v1
Contact: tech-support@signrequest.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import signrequest_python_client
from signrequ... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from sendim.models import Event
@login_required
def events(request) :
"""
List events and do processing on them.
Processes are in POST method :
- sendmail_q : Send a mail for a given event.
... |
import logging
from git_project_updater_business.settings.settings_repository import SettingsRepository
from git_project_updater_business.scanners.projects_scanner_factory import ProjectScannerFactory
class ProjectsRepository:
__instance = None
@staticmethod
def instance(settings_repository: SettingsRep... |
from unittest import TestCase
class TBase (TestCase):
pass
|
def foodtobring(ponds):
bring=0
foods={}
for p in xrange(ponds):
A,B = map(int,raw_input().split())
if A==B:
continue
foods.setdefault(A,0)
foods.setdefault(B,0)
foods[A]=foods[A]+1
if foods[B]>0:
foods[B]=foods[B]-1
else:
... |
"""Utilities for interpretability tools."""
import numpy as np
from scipy import ndimage
def gaussian_blur(image: np.ndarray, sigma: float) -> np.ndarray:
"""Applies a Gaussian blur to a 3D (WxHxC) image.
Args:
image: 3 dimensional ndarray / input image (W x H x C).
sigma: Standard deviation for Gaussian... |
# Generated by Django 3.2.2 on 2021-06-03 14:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('etudiorder', '0003_auto_20210603_1546'),
]
operations = [
migrations.RemoveField(
model_name='descricao',
name='slug... |
from django.db import models
from django.utils import timezone
class Position(models.Model):
"""
Table generated by SkyBoT which has the solar system objects identified
in DES images (for more detailssee:http://vo.imcce.fr/webservices/skybot/?conesearch)
"""
name = models.CharField(
... |
from qgis.core import QgsRasterLayer
from qgis.PyQt.QtCore import QFileInfo
from qgis.core import QgsProject
class Result():
def __init__(self, path=None):
self.path = path
def display(self):
"""
Displays an image from the given path on a new created QGIS Layer.
"""
#... |
import enum
import typing
T = typing.TypeVar('T')
@typing.runtime_checkable
class Provider(typing.Protocol[T]):
"""Client Adapter Interface Accepted by SyncContext"""
state_name: typing.ClassVar[str]
def is_closed(self, client: T) -> bool:
"""Returns if client is closed or released"""
.... |
import refine.refine as refine
import requests
import hashlib
import json
import csv
import os
import re
#############################################
dataset_e = []
dataset_p = []
#############################################
def generate_sha(fpath):
sha1 = hashlib.sha1()
f = open(fpath, 'rb')
try... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.