text stringlengths 957 885k |
|---|
<gh_stars>0
import math
from abc import ABC, abstractmethod
from copy import copy
from functools import reduce
from inspect import getfullargspec
from itertools import count
from numbers import Real
from operator import and_
from typing import Dict, Tuple, Iterator
from typing import Optional, Union, Type, List
import... |
<filename>eda_plugin/examples/main.py
"""Main functions that assemble a full EDA pipeline."""
import sys
import eda_plugin.utility.settings
from eda_plugin.actuators.micro_manager import TimerMMAcquisition
from eda_plugin.interpreters.frame_rate import BinaryFrameRateInterpreter
from eda_plugin.utility.eda_gui import... |
# Copyright 2018 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... |
<filename>manimlib/utils/color.py
import random
from colour import Color
import numpy as np
from manimlib.constants import WHITE
from manimlib.utils.bezier import interpolate
from manimlib.utils.simple_functions import clip_in_place
from manimlib.utils.space_ops import normalize
def color_to_rgb(color):
if isin... |
<reponame>banjin/FluentPython-example
"""
A multi-dimensional ``Vector`` class, take 4
A ``Vector`` is built from an iterable of numbers::
>>> Vector([3.1, 4.2])
Vector([3.1, 4.2])
>>> Vector((3, 4, 5))
Vector([3.0, 4.0, 5.0])
>>> Vector(range(10))
Vector([0.0, 1.0, 2.0, 3.0, 4.0, ...])
Test... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import long
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_raises
)
from numpy.lib.type_check import (
common_type, mintypecode, isreal, iscomplex, isposinf, isneginf,
na... |
# Copyright 2019 New Relic, 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 writi... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
'''
cls : aeroplane|| Recall: 0.9473684210526315 || Precison: 0.0006199030196164867|| AP: 0.826992691184208
____________________
cls : cow|| Recall: 0.9631147540983607 || Precison: 0.00053545266256... |
<reponame>paledger/CSS
from django import forms
from django.core.mail import send_mail
from css.models import CUser, Room, Course, SectionType, Schedule, Section, Availability, FacultyCoursePreferences
from django.http import HttpResponseRedirect
from settings import DEPARTMENT_SETTINGS, HOSTNAME
import re
from django.... |
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import torch
import torch.optim as optim
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(4, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 64, 3, padding=1)
self.con... |
#%%
import argparse
import itertools as it
import os
import requests
import yaml
from bs4 import BeautifulSoup
from bokeh.models import ColorBar, ColumnDataSource, HoverTool, LabelSet, Legend
from bokeh.models import LinearColorMapper, FactorRange
from bokeh.palettes import Magma, d3
from bokeh.plotting import figure,... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
from ..patch.pint import ureg
from . import compound
from . import types
from ..sources import emspectrum
from ..utils import instance
from ..simulation.classfactory import with_metaclass
from ..math import noisepropagation
class Scintillator(with_metaclass(... |
<reponame>henrystoldt/MAPLEAF
#Created by: <NAME>
# August 2020
import math
import unittest
from MAPLEAF.SimulationRunners import Simulation
from MAPLEAF.ENV import (FlatEarth, NoEarth, SphericalEarth,
WGS84)
from MAPLEAF.Motion import Vector
from test.testUtilities import assertVe... |
<reponame>Zholistic/Lithium6<filename>kristian_python_virial_bisection_fit.py
def virial_fit_residuals2(beta_eb_lower, beta_eb_upper, eb, density, potential):
import subprocess
beta_eb = np.zeros(3)
beta_eb[0] = beta_eb_lower
beta_eb[2] = beta_eb_upper
beta_eb[1] = beta_eb[0] + ((beta_eb_upper - b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE... |
#!/usr/bin/env python3
# Copyright (c) 2021 oatsu
"""
eval.list と dev.list と train.list を生成する。
utt_list.txtは作らなくていい気がする。
data/list/eval.list
data/list/dev.list
data/list/train.list
全ファイルから12個おきにevalとdevに入れる。dev以外の全ファイルをtrainに入れる。
"""
from glob import glob
from os import makedirs
from os.path import basename, expandus... |
import numpy as np
from sklearn.tree import DecisionTreeClassifier
import unittest as ut
import nnetsauce as ns
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_breast_cancer, load_wine
from sklearn.linear_model import LogisticRegression
class TestRandomBag(ut.TestCase):
def ... |
<reponame>nizz009/pywikibot
"""Bot tests."""
#
# (C) Pywikibot team, 2015-2021
#
# Distributed under the terms of the MIT license.
#
import sys
from contextlib import suppress
import pywikibot
import pywikibot.bot
from pywikibot import i18n
from pywikibot.tools import suppress_warnings
from tests.aspects import (
... |
<filename>ansible/library/helm_toolbox.py<gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright 2020 Caoyingjun
#
# 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/l... |
<gh_stars>1-10
#!/usr/bin/env python
# Filename tools.py
__author__ = '<EMAIL> (duanqz)'
### Import blocks
import os
import shutil
import commands
import tempfile
import signal
import subprocess
import time
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
... |
<gh_stars>0
import argparse
import datetime
import json
import os
import os.path
import praw
import requests as r
FIELDS_TO_UPDATE = [
'locked',
'num_comments',
'num_crossposts',
'over_18',
'pinned',
'score',
'selftext',
'spoiler',
'stickied',
'subreddit_subscribers',
]
class ... |
<filename>gtsfm/scene_optimizer.py
"""The main class which integrates all the modules.
Authors: <NAME>, <NAME>
"""
from gtsfm.common.gtsfm_data import GtsfmData
import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import dask
import matplotlib
from gtsam import Pose3, ... |
#Code based on Andres code from November 2017
import numpy as np
from six.moves import xrange
def part2dens3d(part_pos, box_l, bin_x=128):
"""
Calculate 3D matter density using numpy histograms
:param part_pos: particle positions in the shape (N, D), where N is particle number and D is dimension
:para... |
<gh_stars>0
# -*- coding: utf-8 -*-
import pygame
from src.scenes.Stage import *
from src.scenes.stage.StageState import *
from src.scenes.stage.OnBossRoomState import *
# -------------------------------------------------
# Clase OnTransitionState
class OnTransitionState(StageState):
def __init__(self, connectio... |
import tweepy
from tweepy import OAuthHandler
import json
import datetime as dt
import time
import os
import sys
'''
In order to use this script you should register a data-mining application
with Twitter. Good instructions for doing so can be found here:
http://marcobonzanini.com/2015/03/02/mining-twitter-data-with-... |
import tkinter as tk
from tkinter import ttk, INSERT, DISABLED, GROOVE, CURRENT, Radiobutton, \
NORMAL, ACTIVE, messagebox, Menu, IntVar, Checkbutton, FLAT, PhotoImage, Label,\
SOLID, N, S, W, E, END, LEFT, Scrollbar, RIGHT, Y, BOTH
import Globals
import re
import CoMet_functions, intro_tab_functions, Map_D... |
<reponame>yasirkose/Hand-Gesture
import PyQt5,sys
from PyQt5 import QtGui,QtWidgets,uic,QtCore,Qt
from PyQt5.QtWidgets import *
import cv2
import time
import numpy as np
import HandTrackingModule as htm
import math
from ctypes import cast, POINTER
from comtypes import CLSCTX_ALL
from pycaw.pycaw import AudioUtilities, ... |
# Copyright 2017 Red Hat, 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, ... |
from typer.testing import CliRunner
from manifestoo.commands.check_dev_status import (
CORE_DEV_STATUS,
check_dev_status_command,
)
from manifestoo.main import app
from manifestoo.odoo_series import OdooSeries
from .common import mock_addons_selection, mock_addons_set, populate_addons_dir
def test_missing_d... |
<gh_stars>0
# -*- coding=utf8 -*-
"""
V1.
一、查询功能:当期开出的号,可以计算(显示)出遗漏的总和,篮球的遗漏不计算在内。
如本期开:1 2 3 4 5 6 遗漏和为3+1+0+4+16+6=30
二、选号功能:两个条件(1.遗漏和,2.号段内出的个数)
将号码分为三段 1-11;12-22;23-33(此号段先暂定,最好以后可修改,根据实际情况划分三个或四个号段)
选号程序设计为:2+3+1;3+2+1;2+2+2,(这个先定这个三个模式,后期最好可以随时调整)
2+3+1即号段1为2个数,号段2为3个数,号段3为1个数
举例:本期买遗漏和30,号段1内出6个数,一种可能就是1 2 3 ... |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.http import JsonResponse
from django.views.generic import FormView, TemplateView, DeleteView, View, DetailView, ListView
from accounts.models import Profile
from .forms import AddForm
from .models import RequestCall, Friend
cla... |
import lshlink as lsh
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from sklearn import datasets
from scipy.cluster.hierarchy import dendrogram, linkage, cophenet
from scipy.spatial.distance import pdist
from functools import reduce, lru_cache
import datetime
import pickle
impor... |
from logger import logger
logging = logger.getChild('sessions.twitter.buffers.users')
import core.sessions.buffers.field_metadata as meta
from core.sessions.buffers.buffer_defaults import buffer_defaults
from core.sessions.buffers.update_type import set_update_type
from core.sessions.buffers.buffers import Buffe... |
"""This file contains code used in "Think Stats",
by <NAME>, available from greenteapress.com
Copyright 2011 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import math
import numpy
import cPickle
import random
import brfss
import correlation
import Cdf
import myplot
import Pmf
import thinkstats
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 12:14:23 2020
Elemento de placa de Reissner-Mildlin com 4 nós e interpolação linear
Resultados coerentes dos deslocamentos, mas reações de apoio estranhas...
Momentos e cortes muito estranhos... ??!?!?!?!
@author: markinho
"""
import sympy as... |
#!/usr/bin/env python
"""Basic pipeline building blocks.
This modules provides the basic building blocks in a JIP pipeline and a way
to search and find them at run-time. The basic buiding blocks are instances
of :py:class:`Tool`. The JIP library comes with two sub-classes that can be
used to create tool implementation... |
# Copyright 2018 The Bazel 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 applicable la... |
'''
Create raw data pickle file
data_raw is a dict mapping image_filename -> [{'class': class_int, 'box_coords': (x1, y1, x2, y2)}, {...}, ...]
'''
import numpy as np
import pickle
import re
import os
from PIL import Image
# Script config
RESIZE_IMAGE = True # resize the images and write to 'resized_images/'
GRAYSCAL... |
import numpy
global ELEV#=[[0 for x in range(17)]for y in range(79)]
ELEV=[[0 for x in range(17)]for y in range(79)]
global NSDEG#[17]
global AA#[17]
global BB#[17]
global SCR,SCR1
#COMMON/MIXC/
global PRSH#(6,3,17,17)
global ESH#(6,3,17)
global AUG#(6,3,17,17,17)
global RAD#[6,3,17,17]
global PRSHBT#(6,3,17)
global I... |
import itertools
from dataclasses import dataclass
from typing import List, TypeVar, Tuple, Optional, Iterator, Set
from adventofcode.util.exceptions import SolutionNotFoundException
from adventofcode.util.helpers import solution_timer
from adventofcode.util.input_helpers import get_input_for_day
T = TypeVar("T")
... |
<filename>ttskit/waveglow/mel2samp.py
# *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... |
from bs4 import BeautifulSoup
from dedoc.readers.docx_reader.styles_extractor import StylesExtractor
from dedoc.readers.docx_reader.properties_extractor import change_paragraph_properties, change_run_properties
from dedoc.readers.docx_reader.data_structures import BaseProperties
from typing import List, Dict, Union
imp... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# @Author : <NAME>
# @Email : <EMAIL>
import cmath
from typing import List
def refine_celegans_posture(neurons: List[List],
ccords: List
):
"""Correct posture of C.elegans
:param neurons: value is Cartesian... |
import numpy as np
from netCDF4 import Dataset
from datetime import datetime
from datetime import timedelta
import os
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from tools_BAIU import get_lonlat, prep_proj_multi, get_arain, get_var, def_cmap, draw_rec
from scipy.interpolate... |
<gh_stars>1-10
"""Test the Panasonic Viera config flow."""
from unittest.mock import patch
from panasonic_viera import SOAPError
from openpeerpower import config_entries
from openpeerpower.components.panasonic_viera.const import (
ATTR_DEVICE_INFO,
DEFAULT_NAME,
DOMAIN,
ERROR_INVALID_PIN_CODE,
)
from ... |
# ImageNet-CoG Benchmark
# Copyright 2021-present NAVER Corp.
# 3-Clause BSD License
import argparse
import copy
import logging
import math
import os
import shutil
import time
import optuna
import torch as th
import feature_ops
import metrics
import utils
from iterators import TorchIterator
from meters import Avera... |
<reponame>OlafTitz/vdrnfofs<filename>vdrnfofs/vdrnfofs.py
# -*- coding: utf-8 -*-
#
# VDR-NFO-FS creates a file system for VDR recordings, which maps each
# recording to a single mpg-file and nfo-file containing some meta data.
#
# Copyright (c) 2010 - 2011 by <NAME>
#
# Redistribution and use in source and binary form... |
# imported from github.com/ravana69/PornHub to userbot by @heyworld
# please don't nuke my credits 😓
import asyncio
import logging
import os
import time
from datetime import datetime
from urllib.parse import quote
import bs4
import requests
from justwatch import JustWatch
from telethon import *
from telethon import e... |
<reponame>john-james-sf/nlr<gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# ======================================================================================================================== #
# Project : Natural Language Recommendation ... |
<filename>ofspy/test/test_context.py
"""
Copyright 2015 <NAME>, Massachusetts Institute of Technology
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
... |
"""aospy.Run objects for simulations from the GFDL HiRAM model."""
import datetime
from aospy import Run
from aospy.data_loader import GFDLDataLoader
hiram_cont = Run(
name='cont',
description=(
'1981-2000 HadISST climatological annual cycle of SSTs '
'and sea ice repeated annually, with PD a... |
#!/usr/bin/python -tt
# vim:set ts=4 sw=4 expandtab:
#
# NodeManager plugin for creating credentials in slivers
# (*) empower slivers to make API calls throught hmac
# (*) also create a ssh key - used by the OMF resource controller
# for authenticating itself with its Experiment Controller
# in order to avoid spam... |
<reponame>cqsl/Entanglement-Forging-with-GNN-models<filename>Forging_helper_Circuits_TFIM.py
#!/usr/bin/env python
# coding: utf-8
import netket as nk
from netket.operator.spin import sigmax,sigmaz
from netket import jax as nkjax
import jax
import jax.numpy as jnp
from functools import partial
# from jax import random
... |
""" ref:
https://gist.github.com/bjpirt/9666d8c623cb98e755c92f1fbeeb6118
https://groups.google.com/group/mearm/attach/18a4eb363ddaa/MeArmPiTechnicalOverviewV0-2DRAFT.pdf?part=0.1
"""
import math
import pigpio
from logging import getLogger, basicConfig, DEBUG
logger = getLogger(__name__)
basicConfig(
level=DEBUG, ... |
# 一个小程序,Secret Message. 文件夹alphabet中是英文26个字母及部分标点符号的照片。运行程序过中,提示用户输入文件夹名称(比如test_folder)以及Secret Message的内容(比如“love you python”)。运行完程序后,在test_folder文件夹下的照片是“love you python”这个Secret Message中所有的字母和标点符号,但是顺序是杂乱无章的,所以这个时候它仍然是SECRET message. 但是在test_folder_copy文件中的照片排列顺序是正确的,message不再secret,其中我们可以看到message的内容是“love you pyt... |
<filename>main.py
import string
from pymongo import MongoClient
from deep_translator import GoogleTranslator
import pysrt
from kivy.core.window import Window
from kivy.properties import StringProperty, ColorProperty
from kivy.utils import rgba
from kivymd.app import MDApp
from kivymd.theming import ThemableBehavior
fro... |
<filename>sbol2/location.py
from .identified import Identified
from .constants import *
from .property import IntProperty
from .property import OwnedObject
from .property import ReferencedObject
from .property import URIProperty
from rdflib import URIRef
class Location(Identified):
"""The Location class specifies... |
<reponame>ishine/DeepPhonemizer<filename>dp/model/predictor.py
from typing import Dict, List, Tuple
import torch
from torch.nn.utils.rnn import pad_sequence
from dp import Prediction
from dp.model.model import load_checkpoint
from dp.model.utils import _get_len_util_stop
from dp.preprocessing.text import Preprocessor... |
# -*- coding: utf-8 -*-
import unittest
from smsapi.exception import EndpointException, SendException
from smsapi.models import ResultCollection, RemoveMessageResult, InvalidNumber
from smsapi.sms.api import flash_force_params, fast_force_params
from tests import SmsApiTestCase
from tests.unit.doubles import api_resp... |
###################################
# 6.00.2x Problem Set 1: Space Cows
from ps1_partition import get_partitions
import time
# ===============================
# Part A: Transporting Space Cows
# ===============================
def load_cows(filename):
"""
Read the contents of the given file. Assumes the fi... |
# Convenience functions to perform Image Magicks
from subprocess import run, PIPE
from glob import glob
from neuralstyle.utils import filename
def convert(origin, dest):
"""Transforms the format of an image in a file, by creating a new file with the new format"""
if ismultilayer(origin):
raise ValueEr... |
<filename>src/ipssihelp/worker/migrations/0001_initial.py
# Generated by Django 3.0.3 on 2020-04-21 19:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel... |
'''
Copyright 2022 Airbus SAS
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, software
dis... |
import os
import unittest
import tempfile
import users
import app
import json
from db import DB
# The bcrypt hashing process was making the tests run slowly so I've statically set the data to save time
# test_create_users still hits the bcrypt code path
hashed_passwords = [
<PASSWORD>", #user1
<PASSWORD>", #... |
# increasing paths in an array
def f1_3(array): # O(N^2)
if len(array) <= 1:
return
ans = []
start_idx, idx = 0, 1
prenum = array[start_idx]
while idx < len(array):
if array[idx] >= prenum:
for i in range(start_idx, idx):
ans.append(array[i:idx + 1])... |
##
# Copyright (c) 2006-2018 Apple 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
#!/usr/bin/env python2
"""Forest training."""
# pylint: disable=wrong-import-order, redefined-outer-name, line-too-long, invalid-name
import os
import sys
import os.path as path
import h5py
import numpy as np
import sys
import logging
import click
from up_tools.model import landmarks_91
import joblib
import pyximport; ... |
<reponame>soran-ghaderi/Chromusic_search_engine<filename>tase/telegram/telegram_client.py
from enum import Enum
from typing import Optional, Coroutine, Union, List, Iterable
import pyrogram
from pyrogram.handlers.handler import Handler
from tase.my_logger import logger
from tase.telegram import handlers
from .methods... |
# -*- mode: python; coding: utf-8 -*-
import os
import datetime
import logging
import string
from drydrop_handler import DRY_ROOT
from drydrop.app.core.controller import BaseController
from drydrop.lib.json import json_parse
from drydrop.app.core.events import log_event
class HookController(BaseController):
# see... |
"""
Dataset from Pandaset (Hesai)
"""
import pickle
import os
try:
import pandas as pd
import pandaset as ps
except:
pass
import numpy as np
from ..dataset import DatasetTemplate
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
import torch
def pose_dict_to_numpy(pose):
... |
<reponame>zhupangithub/WEBERP<filename>Code/odooerp/odoo-8.0/openerp/addons/website_event_sale/controllers/main.py
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.... |
<reponame>gocept/batou_ext<gh_stars>1-10
"""Helper for Jenkins pipeline deployments."""
import configparser
import argparse
import json
import subprocess
import sys
def git_resolve(url, version):
if len(version) == 40:
# revision.
try:
int(version, 16)
except ValueError:
... |
<gh_stars>1-10
#!/usr/bin/env python
import sys, os, time, yaml
import pprint as pp
import subprocess, math
import numpy as np
import os.path, re
from scipy import stats
from argparse import ArgumentParser
import matplotlib.pyplot as plt
np.set_printoptions(edgeitems=10, linewidth=100000)
# peak BW for mrstem (GB) =... |
##########################################################################
#
# Copyright (c) 2012-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
#!/usr/bin/python
'''
saufh.py
MIT License
Copyright (c) 2018 <NAME>
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, mo... |
import re
from django.utils.functional import memoize
from django.utils.crypto import get_random_string
from django.conf import settings
from django.core.urlresolvers import (
RegexURLResolver, NoReverseMatch,
get_callable, normalize, force_unicode,
get_urlconf, get_script_prefix,
get_ns_resolver, iri... |
<reponame>Saketkr21/epiabm
#
# Infection due to contact in between people in different cells
#
import random
import numpy as np
import logging
import typing
from pyEpiabm.core import Cell, Parameters, Person
from pyEpiabm.property import InfectionStatus, SpatialInfection
from pyEpiabm.utility import DistanceFunction... |
<filename>single_train.py
import os
import torch
import pandas as pd
from transformers import AdamW
from annlp import fix_seed, ptm_path, get_device, Trainer, BertForMultiClassification, print_sentence_length
from sklearn.model_selection import train_test_split
def read_data(path, test_size=0.1, random_state=42):
... |
import torch
import torch.nn.functional as F
import numpy as np
import torch.nn
def dice_loss(input,target):
'''
make the soft dice loss
:param input: input
:param target: mask label
:return:
'''
input=torch.sigmoid(input)
smooth=1.0#for soft
flat_input=input.view(-1)
... |
<filename>softwares/blender_wizard/wizard_menu.py
# coding: utf-8
# Author: <NAME>
# Contact: <EMAIL>
# Blender modules
import bpy
import bpy.utils.previews
# Wizard modules
from blender_wizard import wizard_plugin
from blender_wizard import wizard_tools
bl_info = {
"name": "Wizard",
"author": "<NAME>",
... |
<gh_stars>0
import logging
import os
from flask import jsonify, redirect
from flask_themes2 import render_theme_template, static_file_url
from werkzeug.routing import BaseConverter
from cert_viewer import certificate_store_bridge
from cert_viewer import introduction_store_bridge
from cert_viewer import verifier_bridg... |
from __future__ import print_function
import FWCore.ParameterSet.Config as cms
class MassSearchReplaceAnyInputTagVisitor(object):
"""Visitor that travels within a cms.Sequence, looks for a parameter and replace its value
It will climb down within PSets, VPSets and VInputTags to find its target"""
def __... |
<gh_stars>1-10
import constants
import collections
def get_doas_from_category(category_prediction):
doa_list = []
for doa, category in constants.class_ids.items():
if category == category_prediction:
doa_list.append(float(doa))
if float(doa) == 180.0:
doa_list.... |
# -*- coding: utf-8 -*-
# Copyright 2017 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
from functools import wraps
from urllib.parse import urlencode, urlsplit, urlunsplit
from collections import (defaultdict, namedtuple)
import aiohttp
from aiohttp import web
from aiohttp.web_exceptions import HTTPUnauthorized
from aiohttp.test_utils import unused_port
_LOGGER = logging.getLogger(__name... |
import os
import pickle
import tarfile
from functools import partial
from abc import abstractmethod, ABCMeta
from cakechat.utils.logger import get_logger, WithLogger
_logger = get_logger(__name__)
DEFAULT_CSV_DELIMITER = ','
class AbstractFileResolver(object, metaclass=ABCMeta):
def __init__(self, file_path):
... |
# Copyright 2019 Nexenta Systems, 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.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
<reponame>calebsander/RuddockWebsite
import flask
import http
from datetime import datetime # ugh
from decimal import Decimal
from ruddock.resources import Permissions
from ruddock.decorators import login_required, get_args_from_form
from ruddock.modules.budget import blueprint, helpers
from .helpers import PaymentT... |
<gh_stars>0
from json.tool import main
from msilib.schema import ODBCAttribute
from unittest.mock import patch
from bs4 import BeautifulSoup as bs
import os
import json
mainPath = os.path.dirname(__file__) #main path to root folder
folderOdds = r'\pages\odds' #str of the path to odds
folderResults = r'\pages\result... |
"""
oblique.py - Web Services Interface
Copyright 2008-9, <NAME>, inamidst.com
Licensed under the Eiffel Forum License 2.
http://willie.dftba.net
"""
import re
import urllib
import willie.web as web
from willie.module import commands, example
definitions = 'https://github.com/nslater/oblique/wiki'
r_item = re.compi... |
import firebase_admin
from firebase_admin import credentials, auth, messaging
from firebase_admin import firestore, storage
from House import House, Utility, Amenity, Profile, Tenant
from Landlord import Landlord
from Location import Location
from RepairRating import RepairRating
from Prediction import Prediction
impor... |
<reponame>MISTCARRYYOU/PythonPDEVS
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
<gh_stars>0
"""This module contains commands related to Phabricator."""
import json # FIX THIS
import requests # FIX THIS
from sopel.module import commands, example, interval, rule
from sopel.config.types import StaticSection, ValidatedAttribute
import sys
class PhabricatorSection(StaticSection):
host = Valida... |
"""Replay Orchestrator
.. moduleauthor:: <NAME> <<EMAIL>>, <NAME> (<EMAIL>)
"""
import json
import threading
import logging
import queue
import time
import sys
import srcs.lib.logger as logger
import srcs.lib.defines as defines
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandle... |
#!/usr/bin/python3
import sys, getopt
import os
import subprocess
import os.path
keep_change = False
debug = False
clean = False
code_generated = False
skip_build = False
generated_directory = r'./test/integration/generated/'
swagger_directory = r'./node_modules/@microsoft.azure/autorest.testserver/swagger/'
warning... |
#!/usr/bin/env python
#
# Copyright 2014 - 2016 The BCE Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the license.txt file.
#
import bce.parser.common.error as _pe
import bce.parser.molecule.ast.bfs as _ast_bfs
import bce.parser.molecule.abbreviati... |
import numpy as np
np.random.seed(0)
import pandas as pd
import matplotlib.pyplot as plt
import gym
env = gym.make('Taxi-v3')
env.seed(0)
print('观察空间 = {}'.format(env.observation_space))
print('动作空间 = {}'.format(env.action_space))
print('状态数量 = {}'.format(env.observation_space.n))
print('动作数量 = {}'.format(env.action_s... |
<reponame>cty9999/VITAE-mm-pi
#!/usr/local/bin/python
import dynclipy
task = dynclipy.main()
# avoid errors due to no $DISPLAY environment variable available when running sc.pl.paga
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import numpy as np
import h5py
import json
import scanpy as sc
import annd... |
<filename>catfacts.py
#!/usr/bin/env python3
import random
import time
import email
import smtplib
import imaplib
import textwrap
import shutil
import tempfile
import traceback
import sys
import argparse
import os.path
import re
import configparser
import logging
from email.utils import parseaddr
from email.mime.text i... |
import attitude_utils as attu
import env_utils as envu
import numpy as np
from time import time
class Dynamics_model_6dof(object):
"""
The dynamics model take a agent model object (and later an obstacle object) and modifies
the state of the agent.
The agent object instantiates an engin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.