content
stringlengths
0
894k
type
stringclasses
2 values
import unittest from datetime import datetime from pyopenrec.comment import Comment class TestComment(unittest.TestCase): c = Comment() def test_get_comment(self): dt = datetime(2021, 12, 21, 0, 0, 0) data = self.c.get_comment("n9ze3m2w184", dt) self.assertEqual(200, data["status"]) ...
python
from numpy.testing import * import time import random import skimage.graph.heap as heap def test_heap(): _test_heap(100000, True) _test_heap(100000, False) def _test_heap(n, fast_update): # generate random numbers with duplicates random.seed(0) a = [random.uniform(1.0, 100.0) for i in range(n /...
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-01-25 23:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0014_auto_20181116_0716'), ] operations = [ migrations.AlterField(...
python
import discord from discord.ext import commands import chickensmoothie as cs class Pet: def __init__(self, bot): self.bot = bot @commands.command() @commands.guild_only() async def pet(self, ctx, link: str = ''): # Pet command pet = await cs.pet(link) # Get pet data if pet ...
python
# ---------------------------------------- # Created on 3rd Apr 2021 # By the Cached Coder # ---------------------------------------- ''' This script defines the function required to get a the email ids to send the mail to from the GForms' responses. Functions: getAllResponses(): No Inputs Returns ...
python
import numpy as np from simulation_api import SimulationAPI from simulation_control.dm_control.utility import EnvironmentParametrization from simulation_control.dm_control.utility import SensorsReading # Check if virtual_arm_environment API works with a given step input sapi = SimulationAPI() sapi.step(np.array([0, 0...
python
def pg(obs, num_particles=100, num_mcmc_iter=2000): T = len(obs) X = np.zeros([num_mcmc_iter, T]) params = [] # list of SV_params # YOUR CODE return X, params
python
# -*- coding: utf-8 -*- import sys import numpy as np import scipy.io.wavfile def main(): try: if len(sys.argv) != 5: raise ValueError("Invalid arguement count"); if sys.argv[1] == "towave": toWave(sys.argv[2], sys.argv[3], float(sys.argv[4])) elif sys....
python
# # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # 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 ...
python
# ===- test_floats.py ----------------------------------*- python -*-===// # # Copyright (C) 2021 GrammaTech, Inc. # # This code is licensed under the MIT license. # See the LICENSE file in the project root for license terms. # # This project is sponsored by the Office of Naval Research, One Liberty # Center, 875 ...
python
# Copyright Tom SF Haines # # 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, soft...
python
import json import numpy as np import boto3 import scipy import scipy.sparse from io import BytesIO import os ACCESS_KEY = os.environ['ACCESS_KEY'] SECRET_ACCESS_KEY = os.environ['SECRET_ACCESS_KEY'] def getData(): BUCKET = 'personal-bucket-news-ranking' client = boto3.client('s3', ...
python
B = input().strip() B1 = '' for b in B: if b in ['X', 'L', 'C']: B1 += b else: break if B1 == 'LX': B1 = 'XL' B2 = B[len(B1):] if B2 == 'VI': B2 = 'IV' elif B2 == 'I' and B1.endswith('X'): B1 = B1[:-1] B2 = 'IX' if B1 == 'LX': B1 = 'XL' print(B1+B2)
python
from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from django.conf import settings import pymongo from . import permissions @api_view(['GET']) def root(request, **kwargs): permitted_user_types = ['interviewer'] if permissions.check(r...
python
import unittest import sys import inspect from unittest.mock import Mock from io import StringIO from math import ceil from damage import Damage from classes import Paladin from spells import PaladinSpell from models.spells.loader import load_paladin_spells_for_level class PaladinTests(unittest.TestCase): def se...
python
# -*- coding: UTF-8 -*- import pika if __name__ == '__main__': connection = pika.BlockingConnection(pika.ConnectionParameters("localhost")) channel = connection.channel() channel.exchange_declare(exchange="tang",type="fanout") message = "You are awsome!" for i in range(0, 100): # 循环100次发送消息 ...
python
import torch.nn as nn import config from utils.manager import PathManager class BaseModel(nn.Module): def __init__(self, model_params: config.ParamsConfig, path_manager: PathManager, loss_func, data_source, **kwargs): s...
python
import pandas as pd from IPython.display import display_html, Image import weasyprint as wsp import matplotlib.pyplot as plt import os import math experiment_pref = 'experiment-log-' test_file_pref = 'test_file_' csv_ext = '.csv' txt_ext = '.txt' def display_best_values(directory=None): real_list = [] oracl...
python
'''Collects tweets, embeddings and save to DB''' from flask_sqlalchemy import SQLAlchemy from dotenv import load_dotenv import os import tweepy import basilica from .models import DB, Tweet, User TWITTER_USERS = ['calebhicks', 'elonmusk', 'rrherr', 'SteveMartinToGo', 'alyankovic', 'nasa', 'sadserver...
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
python
import logging from contextlib import contextmanager from unittest import mock import pytest import hedwig.conf from hedwig.backends.base import HedwigPublisherBaseBackend from hedwig.backends.import_utils import import_module_attr from hedwig.testing.config import unconfigure from tests.models import MessageType t...
python
# author: Drew Botwinick, Botwinick Innovations # license: 3-clause BSD import os import sys # region Daemonize (Linux) # DERIVED FROM: http://code.activestate.com/recipes/66012-fork-a-daemon-process-on-unix/ # This module is used to fork the current process into a daemon. # Almost none of this is necessary (or ad...
python
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 14:57 from __future__ import unicode_literals import cms.models.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('cms', '0016_au...
python
import pandas as pd #%% print('hello')
python
import pygeoip gip = pygeoip.GeoIP("GeoLiteCity.dat") res = gip.record_by_addr('192.168.29.160') for key, val in res.items(): print('%s : %s' % (key, val))
python
""" Simple data container for a observable """ from tcvx21 import Quantity import numpy as np class MissingDataError(Exception): """An error to indicate that the observable is missing data""" pass class Observable: def __init__(self, data, diagnostic, observable, label, color, linestyle): """Si...
python
import numpy as np from scipy.special import loggamma from scipy.spatial import KDTree from matplotlib import pyplot as plt from scipy.optimize import minimize from mpl_toolkits import mplot3d from math import frexp from mpmath import mp, hyper, nstr, hyperu from exactlearning import BFGS_search, analyse mp....
python
#!/usr/bin/env python3 # coding: utf-8 """ @author: Ping Qiu qiuping1@genomics.cn @last modified by: Ping Qiu @file:test_find_markers.py @time:2021/03/16 """ import sys sys.path.append('/data/workspace/st/stereopy-release') from stereo.tools.spatial_pattern_score import * import pandas as pd from anndata import Ann...
python
import timeit import functools import numpy as np def timefunc(number=10000): def _timefunc(func): @functools.wraps(func) def time_func_wrapper(*args, **kwargs): t0 = timeit.default_timer() for _ in range(number): value = func(*args, **kwargs) t1...
python
#!/usr/bin/env python """ This module provides File.GetID data access object. """ from WMCore.Database.DBFormatter import DBFormatter from dbs.utils.dbsExceptionHandler import dbsExceptionHandler class GetID(DBFormatter): """ File GetID DAO class. """ def __init__(self, logger, dbi, owner): """...
python
class Solution: def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int: cnt = 0 m = {} for num1 in nums1: for num2 in nums2: m[num1 + num2] = m.get(num1 + num2, 0) + 1 for num3 in nums3: for num4 i...
python
DEBUG = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = 'na2Tei0FoChe3ooloh5Yaec0ji7Aipho' INSTALLED_APPS=( 'mailrobot', ) TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_...
python
VERSION = "2.0.113" VERSION_APP = "1265" API_KEY = "270072d0fb4811ebacd96f6726fbdbb1" API_SECRET = "2d0288d0fb4811ebabfbd57e57c6ae64" ENDPOINT = "https://api.myxplora.com/api"
python
from .dataset_evaluator import DatasetEvaluator __all__ = [ 'DatasetEvaluator' ]
python
cities = [ 'Tallinn', 'Tartu', 'Narva', 'Kohtla-Jaerve', 'Paernu', 'Viljandi', 'Rakvere', 'Sillamaee', 'Maardu', 'Kuressaare', 'Voru', 'Valga', 'Haapsalu', 'Johvi', 'Paide', 'Keila', 'Kivioli', 'Tapa', 'Polva', 'Jogeva', 'Tueri', 'E...
python
#!/usr/bin/env python3 """ * Example demonstrating the Position closed-loop servo. * Tested with Logitech F350 USB Gamepad inserted into Driver Station] * * Be sure to select the correct feedback sensor using configSelectedFeedbackSensor() below. * * After deploying/debugging this to your RIO, first use the left...
python
#!/usr/bin/env python3 from copy import deepcopy from queue import Queue from pickle import dump, load from colorama import Fore, Style class GoBoard(object): black = 1 space = 0 white = -1 featureCount = 22 printDic = {space : '.', black : 'B', white : 'W'} colorDic = {space : Fore.WHITE + S...
python
from flask_login.utils import confirm_login from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField from wtforms.validators import DataRequired, Email, EqualTo from wtforms import ValidationError from myproject.models import User class loginForm(FlaskForm): email = StringF...
python
import unittest from function.piecewise_linear_function import PiecewiseLinearFunction class Test(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_basic_plf(self): array = [(5, 1), (7, 3), (10, 6), (12, 8)] f = PiecewiseLinearFunction(array) ...
python
from collections.abc import Iterable from collections.abc import Mapping from xml.dom import minidom from xml.dom.minidom import Element import pandas as pd from trainerroad.Utils.Str import * class Workout: def __init__(self): pass def add_workout_to_document(self, workouts: Iterable, document: mi...
python
import torch import torch.nn as nn from torch.quantization.observer import MinMaxObserver, PerChannelMinMaxObserver import warnings class _InputEqualizationObserver(nn.Module): r"""Observer for tracking the running min/max values of input columns, and computing the quantization parameters for the overall min...
python
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch from torch.distributions import constraints from torch.distributions.utils import lazy_property from pyro.distributions.torch import Chi2 from pyro.distributions.torch_distribution import TorchDistributio...
python
""" The :mod:`sklearn.feature_selection` module implements feature selection algorithms. It currently includes univariate filter selection methods and the recursive feature elimination algorithm. """ from ._univariate_selection import chi2 from ._univariate_selection import f_classif from ._univariate_selectio...
python
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-04-28 19:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('osf', '0026_rename_preprintservice_subjects'), ] operations = [ migrations.Alt...
python
import requests from crawl_service.util.config import CONFIG def new_session() -> requests.Session: session = requests.Session() session.proxies = CONFIG.get('proxies', dict()) return session
python
#!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
python
# =============================================================================== # Copyright 2014 Jake Ross # # 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...
python
from django.core.management.base import BaseCommand, CommandError from game.models import * import settings from PIL import Image import random def hex_to_rgb(value): value = value.lstrip('#') lv = len(value) if lv == 1: v = int(value, 16)*17 return v, v, v if lv == 3: return tu...
python
'''ইউজার একটি পুর্ন সংখ্যা ইনপুট দিবে সংখ্যা জোর হলে আউটপুট হবে(even) আর বিজোড় হলে আউটপুট হবে (odd)''' #input num=int(input("Enter the number:")) #logic if (num%2==0): print(f"{num} is even") else: print(f"{num} is odd")
python
# # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
python
# Generated by Django 2.2.9 on 2020-01-11 21:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bio_app', '0013_auto_20200111_2035'), ] operations = [ migrations.AlterField( model_name='clusters', name='cluster_i...
python
import pandas as pd from bokeh.io import show, curdoc from bokeh.layouts import layout from bokeh.models import ColumnDataSource, FactorRange from bokeh.plotting import figure from bokeh.sampledata.degrees import data from bokeh.themes import Theme data = data.set_index('Year') categories = data.columns.tolist() cate...
python
from django import template from django.forms.utils import flatatt from django.template.loader import render_to_string from django.utils.html import format_html, format_html_join from core.constants import VIDEO_DURATION_DATA_ATTR_NAME register = template.Library() def _get_poster_attribute(video): if video and...
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import neurovault.apps.statmaps.models import neurovault.apps.statmaps.storage class Migration(migrations.Migration): dependencies = [ ('statmaps', '0073_auto_20161111_0033'), ] operations =...
python
#!/usr/bin/env python3 # # Copyright 2021 Xiaomi Corporation (author: Wei Kang) # # See ../../../LICENSE for clarification regarding multiple 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...
python
#!/usr/local/bin/python import os, sys, time space = ' ' # read file by filename def read_file(filename): f = open(filename, 'r') content = f.readlines() f.close() return content def handleTemp(temp): # extract content from <TEXT> and void <TEXT>content</TEXT> start = temp.find('<TEXT>') + ...
python
# -*- coding: utf-8 -*- from icemac.addressbook.interfaces import IPerson import icemac.addressbook.testing import pytest import zope.component.hooks # Fixtures to set-up infrastructure which are usable in tests, # see also in ./fixtures.py (which are imported via src/../conftest.py): @pytest.yield_fixture(scope='fu...
python
log_enabled = True # 1 = print everything # 2 = print few stuff # 3 = print fewer stuff log_level = 2 def log(message, message_type="info", level=3): if not log_enabled: return log_message_type_symbols = { "info": "[*]", "warning": "[!]", "error": "[x]", "success": "[+...
python
from diary.views import get_next_or_none from django.urls import reverse def test_get_next_or_none__last(note): assert get_next_or_none(note) is None def test_get_next_or_none__next_exists(note2): assert get_next_or_none(note2).title == 'My Title' def test_NoteListView(client, note): response = client.g...
python
# # Control an RFSpace SDR-IP, NetSDR, or CloudIQ. # # Example: # sdr = sdrip.open("192.168.3.125") # sdr.setrate(32000) # sdr.setgain(-10) # sdr.setrun() # while True: # buf = sdr.readiq() # OR buf = sdr.readusb() # # Robert Morris, AB1HL # import socket import sys import os import numpy import scip...
python
# # This file is part of Python Client Library for STAC. # Copyright (C) 2019 INPE. # # Python Client Library for STAC is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Python Client Library for STAC.""" from .stac import Stac from...
python
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 NTT DOCOMO, INC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apach...
python
from __future__ import print_function import os import sys from distutils.dir_util import copy_tree from pathlib import Path import pytest from _pytest.pytester import Testdir from pytest import ExitCode from tests.util import RESOURCES pytest_plugins = "pytester" NB_VERSION = 4 import shutil @pytest.fixture def f...
python
import os import re import subprocess ######################################## # Globals ############################## ######################################## g_verbose = False IGNORE_PATHS = ("/lib/modules",) ######################################## # Functions ############################ ######################...
python
import random import time import cv2 from abc import ABC, abstractmethod from core.dataClasses.frame import Frame class ImageProcessingInt(ABC): """ Base Abstract class aka Interface for Image processing class """ @abstractmethod def process(self, _observer, _scheduler): """ Imp...
python
from .attckobject import AttckObject class AttckTactic(AttckObject): def __init__(self, attck_obj = None, **kwargs): '''The AttckTactic class is used to gather information about all Mitre ATT&CK Framework Tactics. To access this class directly you must first instantiate it and provide the appr...
python
from sys import argv script, input_file = argv def print_all(f): print(f.read()) # This will reset the position of the pointer to the start def rewind(f): f.seek(0) def print_a_line(line_no,f): print(line_no, f.readline()) current_file = open(input_file) print("First print the whole file: ") print_all...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of Advent of Code 2020 # https://github.com/scorphus/advent-of-code-2020 # Licensed under the BSD-3-Clause license: # https://opensource.org/licenses/BSD-3-Clause # Copyright (c) 2020, Pablo S. Blum de Aguiar <scorphus@gmail.com> SEA_MONSTER = ( ...
python
# Copyright © 2019 Province of British Columbia # # 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 agr...
python
#!/usr/bin/env python # # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utility for static analysis test of dart packages generated by dart-pkg""" import argparse import errno import json import multip...
python
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean CLI v1.0. Copyright 2021 QuantConnect Corporation. # # 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...
python
from django.shortcuts import render from django.http import HttpResponse from django.utils import translation from challenge.models import Challenge from codingPage.models import Log, Command from connections.models import Feedback def convert_to_code(data): translation = '' for char in data: action =...
python
#!/usr/bin/python import optparse, os, shutil, sys, tempfile, glob, shlex, vcf, pysam from subprocess import * import subprocess, math, random CHUNK_SIZE = 2**20 #1mb def createOutputHTML (outputF, sampleNames): ofh = open(outputF, "w") print outputF ofh.write( '<html>\n<head>\n<title>Galaxy - CNVKIT VCF...
python
from enum import Enum class ApiCode(Enum): SUCCESS = 1000 JINJA2_RENDER_FAILURE = 1001 DEPLOY_START_FAILURE = 1002 DEPLOY_STOP_FAILURE = 1003 DEPLOY_STATUS_FAILURE = 1004 DEPLOY_REPLAY_FAILURE = 1005 GET_FILE_FAILURE = 1006 GET_CONTAINER_FILE_FAILURE = 1007 COMMAND_EXEC_FAILURE = 1...
python
import torch import torch.nn as nn from torch_geometric.nn import global_mean_pool import torch.nn.functional as F from models.nn_utils import chebyshev class SCNLayer(nn.Module): def __init__(self, feature_size, output_size, enable_bias=True, k=1): super().__init__() self.k = k self.conv ...
python
import os from base64 import urlsafe_b64decode, urlsafe_b64encode from pathlib import Path from github import Github gh_access_token = '' def get_project_root(): """Returns project root folder.""" return Path(__file__).parent def gh_session(): """Returns a PyGithub session.""" if gh_access_token:...
python
""" Test DB.py in isolation. Call with twisted.trial eg. trial test_DB.py In the context of evoke, and by extension in evoke apps, only init_db and execute are used by external functions. The aim of the current exercise is to maintain the current interface whilst rationalising code and int...
python
import platform from global_graph_parser.G_grammarListener import G_grammarListener from graphviz import Digraph class MyListener(G_grammarListener): """ There are 2 methods (enter and exit) for each rule of the grammar. As the walker encounters the node for rule Choice, for example, it triggers enter...
python
def async_volunteer_group_adder(volunteer_group,volunteers): through_model = volunteers[0].groups.through dups = through_model.objects.all().filter(volunteergroup_id=volunteer_group.pk).values_list('volunteer_id', flat=True) data = [] for pk in volunteers.values_list('pk', flat=True): if pk n...
python
from django import forms from . models import Comment class CommentForm(forms.ModelForm): class Meta: model = Comment exclude = ["post"] labels = { "user_name": "Your Name", "user_email": "Your E-Mail", "text": "Your Comment", }
python
from django.core.management.base import BaseCommand, CommandError import pandas as pd import os import time import json from sdap.studies.models import ExpressionStudy, ExpressionData, Database, JbrowseData, Species from django.core.files import File from sdap.users.models import User from django.conf import settings...
python
""" The module for loading a dataset from a given file and parsing it into a dictionary. The offered functions allow to receive a list of pairs of samples with their labels """ import random def load_file(file_name, test_file): print(file_name); sample_folder = "../samples"; file_path = sample_folder + "/" + fi...
python
# Generated by the pRPC protocol buffer compiler plugin. DO NOT EDIT! # source: isolated.proto import base64 import zlib from google.protobuf import descriptor_pb2 # Includes description of the isolated.proto and all of its transitive # dependencies. Includes source code info. FILE_DESCRIPTOR_SET = descriptor_pb2.F...
python
from aiozk import protocol from aiozk.exc import TransactionFailed class Transaction: """Transaction request builder""" def __init__(self, client): """ :param client: Client instance :type client: aiozk.ZKClient """ self.client = client self.request = protocol...
python
from src.util.config import ( load_config, save_config, ) from argparse import ArgumentParser from typing import Dict from src.util.default_root import DEFAULT_ROOT_PATH def make_parser(parser: ArgumentParser): parser.add_argument( "--set-node-introducer", help="Set the introducer for nod...
python
from gym.spaces import Box, MultiDiscrete import logging import numpy as np import ray import ray.experimental.tf_utils from ray.rllib.agents.ddpg.ddpg_tf_policy import ComputeTDErrorMixin, \ TargetNetworkMixin from ray.rllib.agents.dqn.dqn_tf_policy import postprocess_nstep_and_prio from ray.rllib.agents.sac.sac_e...
python
import unittest from test.testutil import set_default_576_324_videos_for_testing, \ set_default_576_324_videos_for_testing_scaled, \ set_default_cambi_video_for_testing_b, \ set_default_cambi_video_for_testing_10b from vmaf.core.cambi_feature_extractor import CambiFeatureExtractor, CambiFullReferenceFeatur...
python
import os.path import sys base_path = os.path.abspath('..') aragog_app = os.path.join(base_path, 'app') sys.path.insert(0, aragog_app)
python
import os import sys from argparse import ArgumentParser from typing import List, Tuple from requests import HTTPError # noqa from adventofcode.config import ROOT_DIR from adventofcode.scripts.get_inputs import get_input from adventofcode.util.console import console from adventofcode.util.input_helpers import get_in...
python
########################### # # #327 Rooms of Doom - Project Euler # https://projecteuler.net/problem=327 # # Code by Kevin Marciniak # ###########################
python
from setuptools import setup package_name = "simdash" description = "A web based dashboard for visualizing simulations" with open("README.md", "r") as fh: long_description = fh.read() setup( name=package_name, description=description, maintainer="Parantapa Bhattacharya", maintainer_email="pb+pyp...
python
from django import views from django.contrib import admin from django.urls import path,include from . import views from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register('profile', views.Profile_viewSet) router.register('posts', views.Post_viewSet) router.register('users', views.User...
python
# -*- coding: utf-8 -*- ''' (c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights Reserved. The copyright to the software program(s) is property of Telefonica I+D. The program(s) may be used and or copied only with the express written consent of Telefonica I+D or in accordance with the terms and co...
python
from gerais import * from tkinter import messagebox # ===================Usuarios============== # ====Verifica se usuario existe==== def existeUsuario(dic,chave): if chave in dic.keys(): return True else: return False # ====Insere usuario==== def insereUsuario(dic): email = input("Digite ...
python
from freezegun import freeze_time from rest_framework import test from waldur_mastermind.common.utils import parse_datetime from waldur_mastermind.marketplace import callbacks, models from waldur_mastermind.marketplace.tests import factories @freeze_time('2018-11-01') class CallbacksTest(test.APITransactionTestCase)...
python
#!/usr/bin/env python3 class TypedList: ''' List-like class that allows only a single type of item ''' def __init__(self, example_element, initial_list = []): self.type = type(example_element) if not isinstance(initial_list, list): raise TypeError("Second argument of TypedList must ...
python
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. from typing import List import torch from reagent import types as rlt from reagent.models.base import ModelBase from reagent.models.fully_connected_network import FullyConnectedNetwork class FullyConnectedCritic(ModelBase...
python
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from .models import * import apiclient from apiclient.discovery import build from django.core.mail import send_mail,EmailMessage from apiclient.errors import HttpError from oauth2client.tools import argparser from django.core...
python
def BSDriver(LoadCase): # BoundingSurface J2 with kinematic hardening # Written by Pedro Arduino, Mar. 22 2019 # Copyright Arduino Computational Geomechanics Group # Ported into Python/Jupyter Notebook by Justin Bonus, Jul. 2019 # # # LoadCase: # 1 ... proportionally increasing strai...
python
# -*- coding: utf-8 -*- # Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np from pandapower.control.controller.trafo_control import TrafoController class ContinuousTapControl(TrafoContro...
python