text stringlengths 2 999k |
|---|
#! /usr/bin/env python3
#Copyright 2018 Google LLC
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed... |
import re
from typing import Any, List, Match, Optional
from markdown import Markdown
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
from zerver.lib.markdown.preprocessor_priorities import PREPROCESSOR_PRIORITES
# There is a lot of duplicated code between this file and
# he... |
import math
class Robo:
def __init__(self,nome):
self.__nome = nome
self.__posicao = [0.0,0.0]
self.__em_op = False
@property
def nome(self):
return self.__nome
@nome.setter
def nome(self, alterar_nome):
self.__nome = alterar_nome
@property
def... |
# from JumpScale.baselib.codeexecutor.CodeExecutor import CodeExecutor
import inspect
from JumpScale import j
from ClassBase import ClassBase, JSModelBase, JSRootModelBase
from TemplateEngineWrapper import TemplateEngineWrapper
from JumpScale.data.regex.RegexTools import RegexTools
from TextFileEditor import TextFile... |
# Copyright © 2014-2016 Jakub Wilk <jwilk@jwilk.net>
#
# 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, copy, modify, mer... |
# Copyright 2018 Google Inc.
#
# 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, ... |
# -*- coding: utf-8 -*-
from expects.testing import failure
from expects import *
from datetime import datetime
from dateutil.relativedelta import relativedelta
import json
import os
from esios import Esios
from esios.parsers import P48CierreParser
from pytz import timezone
LOCAL_TZ = timezone('Europe/Madrid')
UTC_... |
# -*- coding: utf-8 -*-
"""
Correa González Alfredo
De gatos y ratones
- Tengo k gatos (e I ratones) en casa.
- Les sirvo comida a mis gatos en m platos.
- Gatos y ratones han llegado a un acuerdo para repartirse el
tiempo y comida pero tienen que convencerme que están haciendo
su trabajo
- Los gatos pueden comer ... |
# This script reads a PNG file containing a single row of 26 x 26 tiles and outputs binary data.
# NumPy and Pillow are required as dependencies.
#
# Specify an input PNG file and an optional output file as arguments.
# If an output file is not given, the binary data will be written in the console.
#
# The original gra... |
# Copyright 2020 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import os
import sys
import logging
from .utils import path_from_root... |
from django.contrib.auth.models import AbstractUser
from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
class User(AbstractUser):
"""Default user for Redirink."""
#: First and last name do not cover name patterns around the globe
n... |
import numpy as np
import random
from dataLoader.batch import batcher
from transformers import BertTokenizerFast, ElectraTokenizerFast
from configs.WNUT_configs import *
from utils.ml_utils import *
from utils.data_utils import *
from utils.metric_utils import *
import argparse
from tqdm import tqdm
from pathlib import... |
# -*- coding:utf-8 -*-
import json, os
from shutil import rmtree
from datetime import datetime
from tensorboard_logger import configure as tbl_configure, log_value as tbl_log_value
class DDBoard:
"""Version 0.4
Converts logs to "TensorBoard compatible" data."""
# Default values
base_dir = "/opt/tensorboard/runs"... |
# Create a function named more_than_n that has three parameters named lst, item, and n.
# The function should return True if item appears in the list more than n times. The function should return False otherwise.
def more_than_n(lst, item, n):
if lst.count(item) > n:
return True
else:
return Fa... |
import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
def applySubstructure( process, postfix="" ) :
task = getPatAlgosToolsTask(process)
from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
from PhysicsTools.Pat... |
# This scripts assumes that the dataframe has been created and saved in data.txt
import pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from dataFrameUtilities import addInsultIntensityColumns, getInsultAboveThreshold, getPainAboveThreshold, selectColumns,selectTime
from sklearn.preproce... |
# Copyright (C) 2021, QuantStack
# SPDX-License-Identifier: BSD-3-Clause
version_info = (0, 7, 0)
__version__ = ".".join(map(str, version_info))
|
from django.core.urlresolvers import resolve, reverse
from django.db import transaction
from django.test import TestCase
from django.test import Client
from django.utils import translation
from django.contrib.auth.models import User, Group
from django.contrib.auth import authenticate, login, logout
from rest_framework ... |
OEMBED_ENDPOINTS = {
"https://speakerdeck.com/oembed.{format}": [
"^http(?:s)?://speakerdeck\\.com/.+$"
],
"https://alpha-api.app.net/oembed": [
"^http(?:s)?://alpha\\.app\\.net/[^#?/]+/post/.+$",
"^http(?:s)?://photos\\.app\\.net/[^#?/]+/.+$"
],
"http://www.youtube.com/oembe... |
"""
The MIT License (MIT)
Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-2021 Pycord Development
Copyright (c) 2021-present Texus
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 restri... |
import sqlalchemy as sa
from sqlalchemy import and_
from sqlalchemy import event
from sqlalchemy import exc
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import text
fr... |
import torch
import mxnet as mx
import numpy as np
from gluon2pytorch import gluon2pytorch
class SoftmaxTest(mx.gluon.nn.HybridSequential):
def __init__(self):
super(SoftmaxTest, self).__init__()
from mxnet.gluon import nn
with self.name_scope():
self.conv1 = nn.Conv2D(3, 32)
... |
"""
* SearchAThing.UnitTest, Copyright(C) 2015-2017 Lorenzo Delana, License under MIT
*
* The MIT License(MIT)
* Copyright(c) 2015-2017 Lorenzo Delana, https://searchathing.com
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "So... |
__source__ = 'https://leetcode.com/problems/letter-combinations-of-a-phone-number/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/letter-combinations-of-a-phone-number.py
# Time: O(n * 4^n)
# Space: O(n)
# Brute Force Search
#
# Description: Leetcode # 17. Letter Combinations of a Phone Number
#
# Given a ... |
r"""
Quiver mutation types
AUTHORS:
- Gregg Musiker (2012, initial version)
- Christian Stump (2012, initial version)
- Hugh Thomas (2012, initial version)
"""
#*****************************************************************************
# Copyright (C) 2011 Gregg Musiker <gmusiker@gmail.com>
# ... |
#!/usr/bin/python
# BSD LICENSE
#
# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of sourc... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015-2020 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
# Test for checking lak observation input. The following observation types:
# 'lak', 'wetted-area', and 'conductance,' require that ID2 be provided when
# ID is an integer corresponding to a lake number and not BOUNDNAME.
# See table in LAK Package section of mf6io.pdf for an explanation of ID,
# ID2, and Observation ... |
import tensorflow as tf
from model import vAe, decode
import util_sp as sp
from util_io import load_txt
import numpy as np
def analyze(z, use_dim=[], seed=25):
''' z = np.array[2, dim], mu of two sentences'''
''' use_dim = list of int describing which dimension should be used '''
# select random path fr... |
## @package onnx
# Module caffe2.python.onnx.backend
"""Backend for running ONNX on Caffe2
To run this, you will need to have Caffe2 installed as well.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
im... |
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from argocd_python_client.model_utils import ( # noqa: F401
ApiTypeError,
Mo... |
from flask import Flask, request
import json
app = Flask(__name__)
@app.route('/')
def hello():
outFile = {'Tittle' : "Simon Game", 'msg' : "Hello World!"}
outFile = json.dumps(outFile)
return json.loads(outFile) |
#
# Copyright (c) 2018 Via Technology Ltd. All Rights Reserved.
# Consult your license regarding permissions and restrictions.
#
"""
operations related to airspaces and intersections.
"""
from psycopg2 import Error, InternalError
from psycopg2.extensions import AsIs
from psycopg2.extras import DictCursor
from itertoo... |
import numpy as np
from tinygrad.tensor import Function
from extra.cherry import *
# ************* unary ops *************
class ReLU(Function):
def forward(ctx, input):
ctx.save_for_backward(input)
return cherry_unop(input, UnaryOps.RELU)
def backward(ctx, grad_output):
input, = ctx.saved_tensors
... |
from __future__ import print_function, division
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy
from lasagne.init import Uniform, Normal
from lasagne.layers import LSTMLayer, Dens... |
from terra_sdk.core.slashing import MsgUnjail
def test_deserializes_msg_unjail_examples(load_msg_examples):
examples = load_msg_examples(MsgUnjail.type, "./MsgUnjail.data.json")
for example in examples:
assert MsgUnjail.from_data(example).to_data() == example
|
from flask_restful import abort, Resource
from flask import request, g, session
from flask.json import jsonify
from whistle_server.models.user import User
def verify_password(password, hashed):
from werkzeug.security import check_password_hash
return check_password_hash(hashed, password)
class LoginEndpoint(R... |
import json
import os
from optparse import make_option
from cnntools.models import CaffeCNN
from cnntools.tasks import schedule_training
from django.core.management.base import BaseCommand
class Command(BaseCommand):
args = '<netid> <local?> <base_lr?> <weights?> <cpu?> <debug_info?> <desc?>'
help = 'Starts ... |
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.models.cam16_ucs` module.
"""
import unittest
from colour.models.tests.test_cam02_ucs import (
TestJMh_CIECAM02_to_UCS_Luo2006,
TestUCS_Luo2006_to_JMh_CIECAM02,
TestXYZ_to_UCS_Luo2006,
TestUCS_Luo2006_to_XYZ,
)
__author__ = 'Colo... |
"""
This file offers the methods to automatically retrieve the graph Dictyostelium discoideum.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 20... |
import importlib.util
import os
import stat
import typing
from email.utils import parsedate
import anyio
from starlette.datastructures import URL, Headers
from starlette.exceptions import HTTPException
from starlette.responses import FileResponse, RedirectResponse, Response
from starlette.types import Receive, Scope,... |
# Copyright (c) 2014 Johns Hopkins University Applied Physics Laboratory
#
# 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 ... |
#!/usr/bin/python
# TODO: issues with new oauth2 stuff. Keep using older version of Python for now.
# #!/usr/bin/env python
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
import datetime
from participantCollection import ParticipantCollection
# Edit Me!
participantFileNames =... |
import os
import torch
import torch.nn as nn
import numpy as np
from contextlib import contextmanager
from functools import partial
from torch.optim import Adam, SGD
from spirl.utils.general_utils import ParamDict, get_clipped_optimizer, AttrDict, prefix_dict, map_dict, \
nan_ho... |
import time
import emoji
from telegram import InlineKeyboardMarkup, ParseMode, InlineKeyboardButton
from telegram.ext import run_async, ConversationHandler
from telegram.error import TelegramError
from django.db.models import Q
from . import constants, authentication, renderers, models
def send_broadcast(admin, broad... |
"""
elasticapm.contrib.django.client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2017 Elasticsearch
Large portions are
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import django
fr... |
#!/usr/bin/env python
from distutils.core import setup, Extension
import glob
import os
# Get matfiles and images for testing
matfi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class ExSourceRateVO(object):
def __init__(self):
self._bid = None
self._currency_pair = None
self._currency_unit = None
self._expiry_time = None
s... |
#!/usr/bin/env python3
"""
Created on 15 Oct 2020
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
DESCRIPTION
The disk_volume utility is used to determine whether a volume is mounted and, if so, the free and used space on
the volume. Space is given in blocks. The volume is identified by its mount point.
... |
# Copyright 2013 IBM Corp.
#
# 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 agree... |
import cv2
import argparse
import numpy as np
def process_edge_image(input, output):
print('edge', input, output)
img = cv2.imread(input)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.GaussianBlur(img, (3, 3), 0)
ret, thr = cv2.threshold(img, 0, 255, cv2.THRESH_OTSU)
edges = cv2.Cann... |
"""Module for specifying the environmental variables."""
import os
DIRNAME = os.path.dirname(__file__)
DB_NAME = "items.csv"
DB_PATH = os.path.join(DIRNAME, "data", DB_NAME)
TEST_DB = "test_items.csv"
TEST_DB_PATH = os.path.join(DIRNAME, "data", TEST_DB)
INSTRUCTIONS = (
"\nValitse toiminto"
"\n (1) lisää"
... |
#!/usr/bin/env python
import asyncio
from collections import deque
import logging
import time
from typing import List, Dict, Optional, Tuple, Set, Deque
from hummingbot.client.command import __all__ as commands
from hummingbot.core.clock import Clock
from hummingbot.core.data_type.order_book_tracker import OrderBookT... |
# Copyright (C) GRyCAP - I3M - UPV
#
# 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... |
"""
Climate Change Project
"""
import plotly.graph_objects as go
from PIL import Image, ImageDraw, ImageFont
from computing_data import calc_high_actual_pd, \
calc_low_actual_pd, \
calc_median_actual_pd, \
make_high_rcp_list, make_low_rcp_list, \
make_median_rcp_list, rcp_to_slice, temp_to_rgb
from read... |
from __future__ import print_function, division
from numpy import array, argmax
from pyscf.nao import tddft_iter
class tddft_iter_x_zip(tddft_iter):
""" Iterative TDDFT with a high-energy part of the KS eigenvectors compressed """
def __init__(self, **kw):
from pyscf.nao.m_fermi_dirac import fermi_dirac_occu... |
class ProxyListException(Exception):
def __init___(self, extraArguments):
Exception.__init__(self, " was raised - {0}".format(extraArguments))
self.dErrorArguments = extraArguments |
"""
Functions and classes for managing a map saved in the .tmx format.
Typically these .tmx maps are created using the `Tiled Map Editor`_.
For more information, see the `Platformer Tutorial`_.
.. _Tiled Map Editor: https://www.mapeditor.org/
.. _Platformer Tutorial: http://arcade.academy/examples/platform_tutorial/... |
from typing import List, Set, Tuple
VertexSets = List[Set[int]]
EdgeList = List[Tuple[int, int]]
|
import pytest
from main_app.models import *
from main_app.tests.utils import *
# TESTS FOR CREATE MODELS:
@pytest.mark.django_db
def test_create_user():
# Given:
users_before = User.objects.count()
# When:
new_user = fake_user()
# Then:
assert User.objects.count() == users_before + 1
asse... |
"""
A sensor platform which detects underruns and capped status from the official Raspberry Pi Kernel.
Minimal Kernel needed is 4.14+
"""
import logging
from rpi_bad_power import UnderVoltage, new_under_voltage
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
... |
import numpy
import wave
class Audiostream(object):
def __init__(self, volume_prio=1):
self.volume_prio = volume_prio
def get_data(self, frame_count, channels, width, rate):
return "".join(["\x00"]*frames*self.channels*self.width)
def get_volume_priority(self)... |
# This class was generated on Mon, 23 Dec 2019 12:39:22 IST by version 0.1.0-dev+904328-dirty of Braintree SDK Generator
# payouts_item_get_request.py
# @version 0.1.0-dev+904328-dirty
# @type request
# @data H4sIAAAAAAAC/+xb63PbuBH/3r9ih9eZnGcoyXe5p795bF/j9pq4sZNOx/VYELkSUYMADwta4WTyv3fwIM2XHMdxdH3ok61dPPa3u1gsFuD76CX... |
from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
import requests
from django.db import models
from django.utils import timezone
from users.models import CustomUser
from datetime import datetime
def get_coordinate(gps, ref):
coordinate = gps[0] + gps[1]/60 + gps[2]/3600
if ref == 'W':
coordinate = -coordinate
return coordinate
def get_timestamp(t... |
a = [1, "a"]
print(list)
print(dir(list))
list = [1, "a"]
print(dir(list))
tuple = ("a", "b")
print(list)
print(tuple)
dictn = {"key": "dictionary",
"d" :a}
print(dictn)
def factorial(n):
"Factorial calculation string document string"
# print("Calculating factorial of ", n)
if n <= 1: return... |
import os
from maya import cmds
import avalon.maya
import pype.api
from pype.hosts.maya.lib import extract_alembic
class ExtractAnimation(pype.api.Extractor):
"""Produce an alembic of just point positions and normals.
Positions and normals, uvs, creases are preserved, but nothing more,
for plain and pr... |
import re
from passerine.db.common import ProxyObject, ProxyFactory, ProxyCollection
from passerine.db.repository import Repository
from passerine.db.entity import get_relational_map
from passerine.db.exception import IntegrityConstraintError, UnsupportedRepositoryReferenceError
from passe... |
import numpy as np
from numpy.core.numerictypes import typecodes
import inspect
import functools
import re
import builtins
import os
from concurrent.futures import ThreadPoolExecutor as thread_pool
from concurrent.futures import ProcessPoolExecutor as process_pool
from concurrent.futures import as_completed
def _iter... |
import datetime
import os
import re
from peewee import *
from playhouse.reflection import *
from .base import IS_SQLITE_OLD
from .base import ModelTestCase
from .base import TestModel
from .base import db
from .base import requires_models
from .base import requires_sqlite
from .base import skip_if
from .base_models i... |
import numpy as np
from .robot_model import RobotModel
from ...utils.mjcf_utils import xml_path_completion
class Panda(RobotModel):
"""Panda is a sensitive single-arm robot designed by Franka."""
def __init__(self, idn=0, bottom_offset=(0, 0, -0.913)):
"""
Args:
idn (int or str): ... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.19.15
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
f... |
import click
from doing.utils import get_config
from doing.utils import get_repo_name
from typing import Union
def cmd_open_pr(pullrequest_id: Union[str, int]) -> None:
"""
Open a specific PULLREQUEST_ID. '!' prefix is allowed.
"""
pullrequest_id = str(pullrequest_id).lstrip("!").strip()
project ... |
from abc import ABC
class AbcFacade(ABC):
"""Any interface will expect to be able to invoke the following methods."""
def count_rows(self):
pass
def get_rows(self):
pass
def get_last_workday(self):
pass
def delete_history(self):
pass
def disconnect(self):
... |
import builtins
import os
from rich.repr import RichReprResult
import sys
from array import array
from collections import Counter, defaultdict, deque, UserDict, UserList
import dataclasses
from dataclasses import dataclass, fields, is_dataclass
from inspect import isclass
from itertools import islice
import re
from typ... |
# coding=utf-8
# Copyright 2019 The TensorFlow GAN Authors.
#
# 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 applicabl... |
from flask import Flask, request, jsonify, render_template, make_response
from qual_id.pattern import Pattern
import random
app = Flask(__name__)
@app.route('/get/', methods=['GET'])
def get_response():
pattern = Pattern(request.args.get("pattern", ""))
number = int(request.args.get("number", 1))
response_obj... |
from flask_wtf import FlaskForm
from wtforms.validators import Required
from wtforms import TextAreaField,SubmitField,StringField
from ..models import User
class UpdateProfile(FlaskForm):
bio = TextAreaField('Update bio.',validators = [Required()])
submit = SubmitField('Update')
class PostAblog (FlaskForm):
... |
from . import controllers
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
#::: modules
import numpy as np
import os, sys
import ellc
from transitleastsquares import catalog_info
import astropy.constants as ac
import astropy.units as u
import lightkurve as lk
import pandas as pd
... |
# !/usr/bin/env python
#
# Copyright (C) 2012 Space Monkey, Inc.
#
# 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, copy,... |
import time
import sys
import os
import threading
try:
import ConfigParser as ConfigParsers
except ImportError:
import configparser as ConfigParsers
from common import CommonVariables
from pwd import getpwuid
from stat import *
import traceback
# [pre_post]
# "timeout" : (in seconds),
#
# ....... |
#!/usr/bin/env python3
# Copyright 2019 The Kubernetes Authors.
#
# 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 appl... |
import requests
import os
from consul import base
__all__ = ["Consul"]
class HTTPClient(base.HTTPClient):
def __init__(self, *args, **kwargs):
self.timeout = kwargs.pop("timeout", None)
super(HTTPClient, self).__init__(*args, **kwargs)
self.session = requests.session()
self._pid... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 numpy as np
from typing import Union, List, Callable
import logging
from multiBatelo.score_functions import create_exponential_score_function
DEFAULT_K_VALUE = 32
DEFAULT_D_VALUE = 400
DEFAULT_SCORING_FUNCTION_BASE = 1
_default_logger = logging.getLogger("multielo.multielo")
class MultiElo:
"""
Gen... |
# ===============================================================================
# NAME: InstanceTopologyHTMLVisitor.py
#
# DESCRIPTION: A visitor responsible for the generation of HTML tables
# of event ID's, etc.
#
# AUTHOR: reder
# EMAIL: reder@jpl.nasa.gov
# DATE CREATED : Sep. 13, 2016
#
# Copyrigh... |
# Copyright 2014 by Saket Choudhary. Based on test_Clustalw_tool.py by Peter
# Cock .
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# Last Checked with samtools [0.1.18 (r982:295)]
from Bio imp... |
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import numpy as np
import torch as th
from torch.nn import functional as F
from stable_baselines3.common.buffers import ReplayBuffer
from stable_baselines3.common.noise import ActionNoise
from stable_baselines3.common.off_policy_algorithm imp... |
# ./constants.py
import os
import enum
from dotenv import load_dotenv
load_dotenv()
@enum.unique
class InputConfig(enum.Enum):
'''
Config for the gameplay, Takes input from .env
Value should be something tha can be used by pyAutoGUI
If not available then, uses default input config (mine)
and Y... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright (c) 2021
#
# See the LICENSE file for details
# see the AUTHORS file for authors
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# ----------... |
# Install Notification Module - pip install notify2
import notify2
import time
import os
notify2.init('Notification')
icon_path = os.getcwd() + "/icon.ico"
def notiFunc():
noti = notify2.Notification("Welcome to Techix", "Techix is an Tech Dependent Youtube Channel, Please Subscribe to get more Videos Frequentl... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import re
class ToypicsIE(InfoExtractor):
IE_DESC = 'Toypics video'
_VALID_URL = r'https?://videos\.toypics\.net/view/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://videos.toypics.net/view/514/chancebulged,-2-1/',... |
# -*- coding: utf-8 -*-
# Copyright 2018 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
#
# Un... |
import logging
import os
import traceback
from datetime import datetime, time, timezone
from random import Random, choice
import disnake
from disnake.ext import tasks
from disnake.ext.commands import BucketType, cooldown, guild_only
from bot.bot import command, group, has_permissions
from bot.globals import PLAYLISTS... |
#!/usr/bin/env python
# Copyright (c) 2018, Michael Boyle
# See LICENSE file for details: <https://github.com/moble/quaternion/blob/master/LICENSE>
# Construct the version number from the date and time this python version was created.
from os import environ
from sys import platform
on_windows = ('win' in platform.low... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import textworld
from textworld.challenges import coin_collector
def test_making_coin_collector():
expected = {
1: {"quest_length": 1, "nb_rooms": 1},
100: {"quest_length": 100, "nb_rooms": 100},
... |
# django
from django import forms
from django.contrib.auth.models import User
# choices
from core.cooggerapp.choices import *
# models
from core.cooggerapp.models import (
Content, OtherAddressesOfUsers, UserProfile,
ReportModel, UTopic, Issue)
from .models.utils import send_mail
class UTopicForm(forms.Mod... |
from math import ceil, sqrt
def my_sqrt(input_num):
return ceil(sqrt(input_num))
def is_divisible(dividend, divisor):
return dividend % divisor == 0
def is_prime(input_num):
return True
|
"""
Phonon DOS and bandstructure analysis package.
"""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.