text stringlengths 957 885k |
|---|
"""The graphics module implements a simple GUI library."""
import sys
import math
try:
import tkinter
except Exception as e:
print('Could not load tkinter: ' + str(e))
FRAME_TIME = 1/30
class Canvas:
"""A Canvas object supports drawing and animation primitives.
draw_* methods return the id number o... |
<reponame>aviadlevis/bhnerf<gh_stars>0
import numpy as np
import xarray as xr
import functools
import math
import jax.numpy as jnp
import matplotlib.pyplot as plt
mse = lambda true, est: float(np.mean((true - est)**2))
psnr = lambda true, est: float(10.0 * np.log10(np.max(true)**2 / mse(true, est)))
normalize = lamb... |
"""Passive BLE monitor sensor platform."""
import asyncio
from datetime import timedelta
import logging
import queue
import statistics as sts
import struct
from threading import Thread
from Cryptodome.Cipher import AES
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_LIGHT,
DEVICE_CLASS_OPENI... |
# Generated by Django 2.2 on 2019-07-09 05:45
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... |
<gh_stars>10-100
import boto3
import datetime
import time
import json
from botocore.vendored import requests
import tweepy
import logging
from PIL import Image
from io import BytesIO
#from aws_xray_sdk.core import xray_recorder
#from aws_xray_sdk.core import patch_all
# Get the service resource
#sqs = boto3.resource('... |
"""
Copyright 2019 EUROCONTROL
==========================================
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and... |
<reponame>flipson/dd3d
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright 2021 Toyota Research Institute. All rights reserved.
import copy
import numpy as np
import torch
from fvcore.transforms import NoOpTransform
from torch import nn
from torch.nn.parallel import DistributedDataParallel
from detectron2... |
import os
import sys
import json
from os.path import expanduser, join, abspath
import subprocess
import datetime
import shutil
import paramiko
class ExpRunner:
def __init__(self, config) -> None:
""""""
self.config = config
self._config_parser(self.config)
self._init_host_ssh()
... |
<filename>temporalis/__init__.py
from temporalis.time import int_to_weekday
import pendulum
from pprint import pprint
class DataPoint:
def __init__(self, name, value, units,
min_val=None, max_val=None,
low_val=None, high_val=None,
time=None, min_time=None, max_ti... |
# A program to analyzing data of bladder cancer in human
# Author: <NAME>
# Date: 04/16/2017
import matplotlib.pyplot as pyplot
import numpy as np
def readData_gender(filename):
'''
The function reads the Clincal data of Bladder Cancer patients
data file from cbioportal
Parameter:
filename = a na... |
from django.shortcuts import get_object_or_404, render
from django.http import Http404
from django.http import HttpResponse
from django.http import JsonResponse
from django.core.mail import send_mail
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.template.loader impor... |
import torch
from .num_nodes import maybe_num_nodes
def contains_self_loops(edge_index):
r"""Returns :obj:`True` if the graph given by :attr:`edge_index` does not
contain self-loops.
Args:
edge_index (LongTensor): The edge indices.
:rtype: bool
"""
row, col = edge_index
mask = r... |
"""The RISC-V CPU"""
from baremetal import *
from chips_v.decode import decode
from chips_v.execute import execute
from chips_v.m_extension import m_extension
from chips_v.utils import *
def cpu(instruction, clk, bus, march="rv32im"):
master = bus.add_master()
debug = Debug()
# generate a global enable... |
<filename>CDN_Networking/cs5700_project5-master/dnsserver.py
#!/usr/bin/env python3
import sys
import socket
import dns.query
import dns.message
import dns.rrset
import threading
import geoip2.database
import math
import http.client
import time
import signal
# maxmind key: <KEY>
# key 2 : <KEY>
# get database comman... |
<filename>test/test_policy.py
import hashlib
import pytest
from datetime import date
from ssh_audit.policy import Policy
from ssh_audit.ssh2_kex import SSH2_Kex
from ssh_audit.writebuf import WriteBuf
class TestPolicy:
@pytest.fixture(autouse=True)
def init(self, ssh_audit):
self.Policy = Policy
... |
<reponame>thomasjpfan/sk_typing<gh_stars>1-10
from typing import Optional
from typing import Union
from collections.abc import Callable
import numpy as np
from .typing import RandomStateType
from .typing import Literal
class DictionaryLearning:
components_: np.ndarray
error_: np.ndarray
n_iter_: int
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 20:54:30 2019
@author: AR
"""
import cv2
import numpy as np
def get_color(image):
image = image.reshape(image.shape[0]*image.shape[1],3)
clf = cv2.kmeans(n_clusters = 1)
labels = clf.fit_predict(image)
counts = cv2.Counter(... |
<reponame>ovinc/imgbasics
"""Cropping image tools and related functions."""
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from drapo import Cursor, rinput
# ======================= IMCROP and related functions =======================
def _cropzone_draw(ax, cropzone, c='r', linewidth=2):
... |
# -*- coding: utf-8 -*-
"""
mslib.mscolab.seed
~~~~~~~~~~~~~~~~~~~~
Seeder utility for database
This file is part of mss.
:copyright: Copyright 2019 <NAME>
:copyright: Copyright 2019-2021 by the mss team, see AUTHORS.
:license: APACHE-2.0, see LICENSE for details.
Licensed under the... |
from pathlib import Path
from fastjsonschema import compile as compile_schema, JsonSchemaException
import jsonref as json
import pytest
SCHEMA_FOLDER = Path("../schema.igsn.org/json/registration/0.1/").absolute()
def get_validator(base_folder, schema_file, defn):
"Generate a schema for some definition fragment.... |
<filename>app/models.py
from sqlalchemy import Column, Integer, String, Table, ForeignKey, CHAR
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
Base = declarative_base()
class LexicalEntry(Base):
__tablename__ = "lexical_entries"
id = Column(CHAR(35), ... |
<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.ops import arb_batched_nms
from mmdet.core import obb2hbb
from mmdet.models.builder import HEADS
from .obb_anchor_head import OBBAnchorHead
from ..rpn_test_mixin import RPNTestMixin
@HEAD... |
import logging
import random
import numpy as np
import torchvision.transforms.functional as tf
from PIL import Image, ImageOps, ImageEnhance
logger = logging.getLogger("Logger")
def get_augmentation(cfg_aug):
if cfg_aug is None:
logger.info(f'[{"DATA".center(9)}] [augmentation] No Augmentations')
... |
<reponame>broadinstitute/scp-ingest-service
from bson.objectid import ObjectId
nineteen_genes_100k_cell_models = {
"data_arrays": {
"dense_matrix_19_genes_1000_cells.txt Cells": {
"name": "dense_matrix_19_genes_1000_cells.txt Cells",
"cluster_name": "dense_matrix_19_genes_1000_cells... |
#!/usr/bin/env python
# Kamek - build tool for custom C++ code in New Super Mario Bros. Wii
# All rights reserved (c) Treeki 2010
# Some function definitions by megazig
# Requires PyYAML
version_str = 'Kamek 0.1 by Treeki'
import binascii
import os
import os.path
import shutil
import struct
import subprocess
import... |
<reponame>dlee960504/nn_schematics
import sys
sys.path.append('../')
from pycore.tikzeng import *
arch = [
to_head('..'),
to_cor(),
to_begin(),
# Detail branch
to_Conv_color('detail1_attn', s_filer="CBAM", n_filer='', height=32, depth=32, width=1, color=5),
to_Conv_color('detail1', s_filer="I/2... |
<reponame>begeekmyfriend/cn-text-normalizer
# coding: utf-8
# The MIT License (MIT)
# Copyright (c) 2015 by <NAME> (<EMAIL>)
#
# 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 restric... |
from __future__ import absolute_import
import datetime
import httpretty
import pygerduty
import pygerduty.v2
import pytest
import uuid
###################
# Version 1 Tests #
###################
@httpretty.activate
def test_loads_with_datetime_v1():
body = open('tests/fixtures/incident_resp_v1.json').read()
... |
<reponame>zachjweiner/pystella<gh_stars>10-100
__copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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 wit... |
<gh_stars>0
"""
Collection of Two-View-Geometry Functions
"""
# global
import ivy_mech as _ivy_mech
from ivy.framework_handler import get_framework as _get_framework
# local
from ivy_vision import projective_geometry as _ivy_pg
from ivy_vision import single_view_geometry as _ivy_svg
MIN_DENOMINATOR = 1e-12
def pix... |
<gh_stars>1-10
import os
import logging
import json_config
import gi
gi.require_version('Gtk', '3.0') # nopep8
from pathlib import Path
from gi.repository import Gtk
from .login_window import LoginWindow
TOP_DIR = os.path.dirname(os.path.abspath(__file__))
config = json_config.connect('config.json')
class Watson... |
<reponame>mutazag/ilab1<filename>utils/config.py
# %%
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
class Config:
"""Config class encapsulate operations to manage folder paths for data sets
"""
__data_dir = ""
__predicted_300K = "300k_PREDICTED.csv"
__predicted_18M =... |
import sys, os
ROOT_PATH = os.path.abspath(".")
if ROOT_PATH not in sys.path:
sys.path.append(ROOT_PATH)
import pathlib
#print(pathlib.Path(__file__).parent.absolute())
#print(pathlib.Path().absolute())
import warnings
# this disables a warning in sklearn for linear models:
# FutureWarning: The default value of m... |
<filename>tests/test_dms.py
# Copyright 2017 Capital One Services, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
<gh_stars>1-10
# 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, softwa... |
# -*- coding: utf-8 -*-
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import json
import requests
import routing
import sys
from urllib.parse import quote, unquote
from .lib import helpers, lookups, auth
if sys.version_info.major < 3:
reload(sys)
sys.setdefaultencoding('utf8')
plugin = routing.Plu... |
<reponame>eo1989/VectorBTanalysis<filename>.venv/lib/python3.8/site-packages/beakerx/plots/tests/test_heatmap.py
# Copyright 2019 TWO SIGMA OPEN SOURCE, 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 t... |
import re
import sys
import nameparser
import sqlalchemy as sa
import sqlalchemy.orm as saorm
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.hybr... |
<reponame>inspire-group/wf-in-the-age-of-quic
#!/usr/bin/env python3
"""Usage: split-dataset [options] DATASET [OUTFILE]
Select TCP indices from DATASET to be used for k-fold cross validation,
and write them as a json stream to OUTFILE.
"""
import math
import time
import json
import logging
from typing import IO, Opti... |
# -*- coding: utf-8 -*-
#!/usr/bin/python3
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep
class crawler:
"""This class contains all functions responsible for crawling webpages.
All functions build upon webdriver to fetch pages. Among other things,
the f... |
<reponame>Yuessiah/Othello-Minimax<gh_stars>0
import copy
import datetime
import sys
__author__ = 'bengt, yuessiah'
from game.settings import *
class AlphaBetaPruner(object):
"""Alpha-Beta Pruning algorithm."""
def __init__(self, mutex, duration, pieces, first_player, second_player):
self.mutex = m... |
# coding: utf-8
# # Estimating the carbon content of marine bacteria and archaea
#
# In order to estimate the characteristic carbon content of marine bacteria and archaea, we rely on two main methodologies - volume based estimates and amino acid based estimates.
#
# ## Volume-based estimates
# We collected measurem... |
<reponame>lifengjin/transition-amr-parser
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
im... |
<filename>continual_learning/datasets/base/utils.py
import bisect
import os
from abc import ABC, abstractmethod
from os import makedirs
from os.path import join, dirname, exists
from typing import Callable, Tuple, Union, Sequence
import numpy as np
from torch.utils.data import DataLoader
from continual_learning.datas... |
"""
Copyright 2020 ICES, University of Manchester, Evenset 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 ... |
"""Plugin specification for Tox 4"""
from __future__ import annotations
import os
import shutil
import sys
import typing as t
from pathlib import Path
from tox.config.cli.parser import DEFAULT_VERBOSITY
from tox.config.sets import EnvConfigSet
from tox.execute.api import Execute
from tox.execute.local_sub_process imp... |
<reponame>RamyaSonar/Natural-language-and-Recommendation-engine-for-Asset-Classification
import pandas as pd
import config
import pickle
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
import numpy as ... |
import cv2
import numpy as np
from plot_one import plot_me_one
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.integrate import simps
M_sun=1.989*10**30;
R_sun=696340*10**3;
M=0.62*M_sun
r_star=0.0151*R_sun
G=6.67408*10**(-11);
####
####
#### This code will create the sandbox and allow user to p... |
<reponame>robertolaru/chip8py
import random
import constants
import pygame
import sys
class CPU:
def __init__(self) -> None:
self.memory = bytearray(constants.MEMORY_SIZE)
self.display = bytearray(constants.DISPLAY_SIZE)
self.key = None
# Create registers
self.v = [0x0 f... |
<gh_stars>1-10
from django.urls import path
from drf_spectacular.views import SpectacularJSONAPIView, SpectacularSwaggerView
from api import views
urlpatterns = [
path('user/profile/v2/', views.UserProfileV2View.as_view(), name="api-user-profile-v2"),
path('user/app-review/', views.UserAppReview.as_view(), na... |
# -*- coding: utf-8 -*-
from .BaseTest import BaseTest
class PanelTest(BaseTest):
def test_classes(self):
"""
Tests a panel with a user specified custom class
"""
self.do_component_fixture_test('panel', 'panel-classes')
def test_panel_footer(self):
"""
Test the... |
"""
Module: 'flowlib.m5cloud' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
class Btn:
''
def attach():
pass
def deinit():
pass
def detach():
... |
<reponame>gerlichlab/HiCognition
"""Module with tests realted adding and managing sessions."""
import unittest
from hicognition.test_helpers import LoginTestCase, TempDirTestCase
# add path to import app
# import sys
# sys.path.append("./")
from app import db
from app.models import Dataset, Session, Collection
class... |
"""Bernoulli-Bernoulli Restricted Boltzmann Machines with Energy-based Dropout.
"""
import time
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
import learnergy.utils.exception as ex
import learnergy.utils.logging as l
from learnergy.models.bernoulli import ... |
<reponame>remo5000/magma<gh_stars>0
#!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass, field
from datetime import datetime
from enum import Enum
from functools import partial
from typing import Any, Callable, List, Mapping, Optional
from dataclasses_json import d... |
"""
UI for scheduling and playout of clock chimes stored as .mp3 files
Manage a church or other electronic carillon to playout .mp3 files of
user-provided songs, peals, tolls, and hourly strikes at scheduled system
time(s). Requires Python3 but no desktop environment. Creates a text
based user interface between stdin... |
from flask import Flask, request, jsonify, url_for
import db
import traceback
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
@app.errorhandler(Exception)
def exception_handler(error):
tracelist = str(traceback.format_exc()).split('\n')
return jsonify({"message":"Internal server error","trace":tra... |
<reponame>markjin1990/foofah<gh_stars>10-100
from timeit import default_timer as timer
import json
import Queue
import argparse
import os
import csv
from tabulate import tabulate
from foofah_libs.foofah_node import FoofahNode
import foofah_libs.operators as Operations
import numpy as np
from foofah_libs.generate_prog i... |
<reponame>MissMeriel/BeamNGpy
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from shapely.geometry import Polygon
from beamngpy import BeamNGpy, Vehicle, Scenario, Road
from beamngpy.sensors import Camera
beamng = BeamNGpy('localhost',... |
<reponame>pjeanjean/dakara-player<gh_stars>0
import logging
import os
from threading import Timer
import mpv
from dakara_player_vlc.media_player import MediaPlayer
from dakara_player_vlc.version import __version__
logger = logging.getLogger(__name__)
class MpvPlayer(MediaPlayer):
"""Interface for the Python m... |
from json import dump, load
from os import path
from devip.utils import get_input, current_ip, cidr, console, require, log
SETTINGS_FILENAME = '{}/.devip.json'.format(path.expanduser('~'))
USER_DEFAULTS = {'temp': [], 'perm': []}
class Service(object):
name = None
default_settings = {}
required_settings... |
#coding:utf-8
from mantis.fundamental.utils.useful import hash_object,object_assign
from mantis.fundamental.network.message import JsonMessage
from mantis.fanbei.smarthome.base import *
"""
"""
# class MessageGetServerTime(Message):
# """获取系统时钟"""
#
# def __init__(self):
# Message.__init__(self)
#... |
<filename>qplan/plugins/FOCAS.py<gh_stars>1-10
#
# FOCAS.py -- OB converter for FOCAS instrument
#
# <NAME> (<EMAIL>)
#
import time
from ginga import trcalc
from q2ope import BaseConverter
class Converter(BaseConverter):
def _setup_target(self, d, ob):
funky_ra = self.ra_to_funky(ob.target.ra)
... |
<filename>trainer/rl_distributed_trainer.py
# -*- coding: utf-8 -*-
#tensorboard --logdir ./logs
import os,sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../utility'))
import time, copy
import random
import numpy as np
import multiprocessing as mp
import tensorflow as tf
from collections import deque
f... |
import prona2019Mod.utils as utils
import itertools as it
from six import iteritems, string_types, PY2, next
import numpy as np
import sys
def _is_single(obj):
"""
Check whether `obj` is a single document or an entire corpus.
Returns (is_single, new) 2-tuple, where `new` yields the same
sequence as `o... |
#!/usr/bin/python
"""
(C) Copyright 2018 Intel 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.org/licenses/LICENSE-2.0
Unless required by applicable ... |
<gh_stars>0
#-*- coding: utf8 -*-
import re
RGX = {
"page": r"<page>",
"title": r"<title>(?P<title>[^<]+)</title>",
"wikid": r"<id>(?P<id>[0-9]+)</id>",
"term": r"\[\[(?P<term>[0-9a-zA-Z\-' ]+)(#[^\|]+)?(\|[0-9a-zA-Z\-' ]+)?\]\]",
"etymology_section": r"===Etymology===",
"synonym_section": r"=... |
#!/usr/bin/env python
from __future__ import with_statement
import argparse
import hashlib
import os
import sys
import tempfile
import shutil
import logging
from logging import getLogger, StreamHandler
# Update here and in setup.py
VERSION = '1.0.0rc3-dev'
try:
import boto # noqa
import boto.s3.connection
... |
import pytest
from requests import Response
from tests.conftest import create_mock_response
from tests.conftest import TEST_DEVICE_GUID
from py42.exceptions import Py42HTTPError
from py42.exceptions import Py42StorageSessionInitializationError
from py42.services._connection import Connection
from py42.services.devices... |
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import get_nonlinear_func, expand_tensor, sample_laplace_noise, sample_unit_laplace_noise
from models.layers import MLP, WNMLP, Identity
def add_gaussian_noise(input, std):
eps = torch.randn_like(input)
... |
<reponame>RifleZhang/CORD_CPD<filename>trainer.py
import math
import sys, os
import os.path as osp
import time
import pickle
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.exp_utils import create_exp_dir
from utils.utils import *
from utils.cp_d... |
# preprocess the arctic database
# - extract 1st channel of the dual-channel audio, which contains meaningful sound
# - normalize the audio
# - trim the silence at the beginning and at the end based on alignment info
#
# <NAME>, 2021-05-19
import os
import argparse
import glob
import numpy as np
# change working d... |
# -*- coding: utf-8 -*-
import os
from fabric.api import run, env, settings, cd, task, put, execute
from fabric.contrib.files import exists, upload_template
from fabric.operations import _prefix_commands, _prefix_env_vars, require, sudo, local as local_
env.use_ssh_config = True
LOCAL_HOST = os.environ.get('LOCAL_H... |
<gh_stars>0
# -*- coding: utf-8 -*-
# Module for Popbill FAX API. It include base functionality of the
# RESTful web service request and parse json result. It uses Linkhub module
# to accomplish authentication APIs.
#
# http://www.popbill.com
# Author : <NAME> (<EMAIL>)
# Written : 2015-01-21
# Contributor : <NAME> (<E... |
<reponame>racinmat/depth-voxelmap-estimation
import scipy.special
import scipy.io
import matplotlib.pyplot as plt
import pickle
from sklearn.metrics import roc_curve, auc
import numpy as np
def plot_roc(fpr, tpr, roc_auc, model_name):
plt.figure()
plt.plot(fpr, tpr, label='ROC curve (area = %0.4f)' % roc_auc... |
<filename>carts/views.py
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.generics import RetrieveAPIView
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from django.views.decorators.csr... |
import codecs
import re
import pypandoc
import os
from trello import TrelloClient
from slugify import slugify
import datetime
import requests
from django.urls import reverse
from django.conf import settings
from django.db import IntegrityError
from django.contrib.sites.models import Site
base_dir = os.path.join(setti... |
# coding=utf-8
from typing import *
import abc
import six
from mdstudio.db.cursor import Cursor
from mdstudio.db.fields import Fields
from mdstudio.db.index import Index
from mdstudio.db.sort_mode import SortMode
from mdstudio.deferred.chainable import chainable
from mdstudio.deferred.return_value import return_value... |
<gh_stars>1-10
import random
from m1n1.utils import *
from m1n1.constructutils import *
from construct import *
from .cmdqueue import *
__all__ = ["channelNames", "channelRings", "DeviceControlMsg", "EventMsg", "StatsMsg"]
class RunCmdQueueMsg(ConstructClass):
subcon = Struct (
"queue_type" / Default(In... |
import distutils
import os
from distutils.core import setup
import _version
try:
from pip import main as pipmain
except:
from pip._internal import main as pipmain
pipmain(['install', 'appdirs'])
__version__ = _version.__version__
appname = _version.APPNAME
appauthor = _version.APPAUTHOR
def iamroot():
'... |
<filename>skule_vote/backend/ballot.py
import math
# results: function (ballots, choices, numSeats:
RON = "Reopen Nominations"
def calculate_results(ballots, choices, numSeats):
result = {
"winners": [],
"rounds": [],
"quota": 0,
"totalVotes": -1,
"spoiledBallots": 0,
... |
<filename>venv/lib/python3.6/site-packages/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py
# (c) 2021 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... |
import logging
import time
import torch
import torch.utils.model_zoo as model_zoo
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self, name, fmt=':f'):
self.name = name
self.fmt = fmt
self.val = 0
self.avg = 0
self.sum... |
<filename>kgcnn/utils/models.py
import tensorflow.keras as ks
import functools
import pprint
def generate_embedding(inputs, input_shape: list, embedding_args: dict, embedding_rank: int = 1, **kwargs):
"""Optional embedding for tensor input. If there is no feature dimension, an embedding layer can be used.
If ... |
import unittest
import os
import pytest
import shutil
import datetime
from unittest import mock
from parsons.etl.table import Table
from parsons.utilities.datetime import date_to_timestamp, parse_date
from parsons.utilities import files
from parsons.utilities import check_env
from parsons.utilities import json_format
f... |
<reponame>wan2000/hcmus-person-reid<gh_stars>1-10
import os
from torch.utils.data import Dataset
from PIL import Image
from torchvision import transforms
import numpy as np
from .utils import *
class Market1501TrainVal(Dataset):
def __init__(self, root, transform=None, batch_size=32, shuffle=True):
self.r... |
""" Module for I/O in arclines
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import numpy as np
import os
import datetime
import pdb
from astropy.table import Table, Column, vstack
from astropy.io import fits
from linetools import utils as ltu
import arclines # For path
fr... |
"""
constraint object library
"""
# imports third-parties
import cgp_generic_utils.python
import cgp_generic_utils.constants
import maya.cmds
# imports local
import cgp_maya_utils.constants
import cgp_maya_utils.scene._api
from . import _generic
# BASE OBJECT #
class Constraint(_generic.DagNode):
"""node obje... |
<filename>basis_set_exchange/writers/gamess_us.py
# Copyright (c) 2017-2022 The Molecular Sciences Software Institute, Virginia Tech
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source cod... |
<gh_stars>0
import numpy as np
import tempfile
import logging
import pandas as pd
import rpSBML
import libsbml
import os
##TODO: this really does not need to be an object
class rpMerge:
"""Class that hosts the different functions to merge two SBML files
"""
def __init__(self):
"""Constructor of th... |
<reponame>Rijul24/Codechef-Codes<gh_stars>0
#this is map int
n= int(input())
strt={'test':set()}
int_pts = {}
while n!=0:
n-=1
intpt_1 , intpt_2 , strt_name , direct = list(map(str , input().split()))
intpt_1 = int(intpt_1)
intpt_2 = int(intpt_2)
#------------------------------------------------------... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf8 -*-
import json
import codecs
JSON_EXT = '.json'
ENCODE_METHOD = 'utf-8'
class NeuromationWriter:
def __init__(self, foldername, filename):
self.foldername = foldername
self.filename = filename
self.boxlist = []
self.verified ... |
from hashlib import *
import binascii
from binascii import unhexlify
import hashlib
from tinydb import TinyDB, Query
import random
import IOTtransaction as tr
import chain
import datetime
mempool_db = TinyDB('mempool_db.json')
chain_db = TinyDB('chain_db.json')
class block:
def __init__(self):
... |
# Agentes Lógicos
"""
Abrange Lógica Proposicional e de Primeira Ordem. Primeiro temos quatro
Tipos de dados importantes:
KB Uma classe abstrata que contém uma base de conhecimento de expressões lógicas
KB_Agent Classe abstrata que é subclasse de agentes.Agent
Expr Uma expressão ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : tensor_utils.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 09.08.2019
# Last Modified Date: 02.10.2019
# Last Modified By : Chi Han, Jiayuan Mao
#
# This file is part of the VCML codebase
# Distr... |
# MIT License
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# 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, me... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import cv2
import torch
from tracker.multitracker import JDETracker
from tracking_utils import visualization as vis
from tracking_utils.log import logger
from tracking_utils.timer import Timer
from ... |
<reponame>sapcc/networking-nsx-t
from datetime import datetime
import oslo_messaging
from networking_nsxv3.common import constants as nsxv3_constants
from networking_nsxv3.db import db
from neutron_lib import context as neutron_context
from neutron_lib import exceptions, rpc
from neutron_lib.agent import topics
from n... |
<filename>remus/data_import/aggregate_CAGE_peaks.py
##
# Based on FANTOM5 (F5) ontology (arg1) the script groups individual F5 samples into preselected organs, tissues and celltypes (facets).
# Only primary cells and tissue samples from human are used.
# Robust CAGE peaks (TPM>10) for samples are extracted from expres... |
<filename>test/functional/bsv-zmq-txremovedfrommempool.py
#!/usr/bin/env python3
# Copyright (c) 2019-2020 Bitcoin Association
# Distributed under the Open BSV software license, see the accompanying file LICENSE.
"""
Test some ZMQ notifications/messages when transaction get removed from mempool.
Body of ZMQ message i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.