text stringlengths 957 885k |
|---|
import tensorflow as tf
import numpy as np
import threading
import time
batch_size =32
flag = False
class CustomRunner(object):
"""
This class manages the the background threads needed to fill
a queue full of data.
"""
def __init__(self):
#self.data_iterator = data
self.n_thre... |
import json
import numpy as np
import os
import requests
import sys
from bs4 import BeautifulSoup
from settings import DATA_DIR
AUTOCOMPLETE_URL = 'http://www.fipiran.com/DataService/AutoCompleteindex'
EXPORT_URL = 'http://www.fipiran.com/DataService/Exportindex'
START_DATE = 13980101 # YYYYMMDD Solar Hijri calend... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'style_image.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_StyleImg(object):
def setupUi(self, StyleImg):
... |
"""The BERT-based triple clustering mechanism."""
from typing import List, Dict, Tuple
import numpy as np
import torch
from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics.pairwise import cosine_similarity
from transformers import RobertaTokenizer, RobertaForSequenceClassification
from triple_clu... |
#! /usr/bin/python
#-*- coding: utf-8 -*-
from __future__ import print_function
import sys
import os
import argparse
import datetime
from shutil import copyfileobj
from pybern.products.downloaders.retrieve import http_retrieve
from pybern.products.fileutils.keyholders import parse_key_file
## https://vmf.geo.tuwien.a... |
<reponame>Cure20001019/BTP_DM
'''
Author: Ligcox
Date: 2021-04-06 15:20:21
LastEditors: Ligcox
LastEditTime: 2021-07-21 16:26:50
Description:
Apache License (http://www.apache.org/licenses/)
Shanghai University Of Engineering Science
Copyright (c) 2021 Birdiebot R&D department
'''
import tensorflow as tf
from tensorf... |
<gh_stars>10-100
# coding=utf8
# Copyright 2018 The trfl 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... |
# Copyright (C) 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 law or agreed to in wri... |
<reponame>niallrmurphy/twimp<filename>ships/ships.py
#!/usr/bin/python
# Ship simulator, updated for TW4.
from __future__ import print_function
import enum
import pprint
import random
import dice
class ShipType(enum.Enum):
SPACEDOCK = 1
PDS = 2
FIGHTER = 3
CARRIER = 4
CRUISER = 5
DESTROYER =... |
from stats import *
import glob as gl
import pandas as pd
import os
import time
def printProgressBar (iteration, total, prefix, suffix = "completo",
decimals = 1, length = 50, fill = '█'):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iterati... |
#!/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Licens... |
#!/usr/bin/env python
"""
Utilities related to file handling
"""
from __future__ import print_function, division
import io
import os
import stat
import subprocess
import time
import zlib
from Utils.Utilities import decodeBytesToUnicode
from Utils.PythonVersion import PY3
def calculateChecksums(filename):
"""
... |
<filename>src/matching/games/hospital_resident.py
""" The HR game class and supporting functions. """
import copy
import warnings
from matching import BaseGame, MultipleMatching
from matching import Player as Resident
from matching.algorithms import hospital_resident
from matching.exceptions import (
MatchingError... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.7.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown] pycharm={"name": "#%% md\n"}
# # P1 E... |
<gh_stars>1000+
# Copyright 2012 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.
from telemetry import decorators
from telemetry.internal.actions import page_action
from telemetry.internal.actions import scroll
from teleme... |
import random
from classes.command import command
from classes.module import Module
from utils.getch import getch
class Battle(Module):
"""
The battle begins...
"""
def __init__(self, handler):
self.handler = handler
@command(description="The deadly battle.", usage="battl... |
<reponame>zeroos/infdist<filename>infdist/simulator/network.py
from collections import defaultdict
import json
import ns.applications
import ns.core
import ns.internet
import ns.network
import ns.mobility
import ns.point_to_point
import ns.wifi
from . import simulator
from optimization.models import Message
from opti... |
from unittest import TestCase
from mockredis import MockRedis, mock_redis_client, mock_strict_redis_client
class TestFactories(TestCase):
def test_mock_redis_client(self):
"""
Test that we can pass kwargs to the Redis mock/patch target.
"""
self.assertFalse(mock_redis_client(host=... |
""" SConsGnu.AcDirVarsTests
Unit tests for SConsGnu.AcDirVars
"""
__docformat__ = "restructuredText"
#
# Copyright (c) 2012-2014 by <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... |
<gh_stars>0
import time
from typing import List, Optional
import azure.cognitiveservices.speech as speechsdk
from azure.cognitiveservices.speech import speech_py_impl as impl
from azure.cognitiveservices.speech.languageconfig import SourceLanguageConfig
from microphone import config as cfg
class OwnAutoDetectSource... |
<filename>motor_driver.py
#driver for adafruit PWM servo driver
#derived from https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library
#uses NXP PCA 9685 16-channel, 12-bit PWM controller
#deal with nested file structure...
import smbus2.smbus2.smbus2 as smbus2
import math
import time
#import matplotlib ##need to... |
<reponame>ITRI-AIdea/CTSP-job-shop-scheduling
# Copyright (c) 2020 Industrial Technology Research Institute.
#
# 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... |
import numpy as np
from numpy import sqrt
import scipy.constants as cs
import datproc.print as dpr
from cooling_unit import c_W, rho_W
## General
output = __name__ == '__main__'
## Data
I = 2.590 * 5
d_I = 0.010 * 5
U = 11.78
d_U = 0.03
J = 212.0 * cs.milli * cs.liter / cs.minute
d_J = 2.0 * cs.milli * cs.liter /... |
import os
import numpy as np
import re
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from math import radians, cos, sin, asin, sqrt
def cal_distance_meter(lat1, lng1, lat2, lng2):
lng1, lat1, lng2, lat2 = map(radians, [lng1, lat1, lng2, lat2])
d_lon = lng2-lng1
... |
#
# Copyright (c) 2021, NVIDIA 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 law or agreed ... |
# coding: utf-8
from __future__ import division, print_function, unicode_literals, absolute_import
import os
import unittest
from fireworks import FWorker
from fireworks.core.rocket_launcher import rapidfire
from atomate.vasp.powerups import use_fake_vasp
from atomate.vasp.workflows.base.adsorption import get_wf_su... |
"""
Created on September 29th, 2020
@author: urikotlicki
"""
# Based on code taken from: https://github.com/YanWei123/Pytorch-implementation-of-FoldingNet-encoder-and-decoder-with-graph-pooling-covariance-add-quanti
# import system modules
from __future__ import print_function
import argparse
import os
import os.path... |
<gh_stars>0
import aiohttp
class Tracking:
def __init__(self, company: str = None, delivery_code: int = None):
self.company = company
self.delivery_code = delivery_code
self.company_list = [
{
"id": "de.dhl",
"name": "DHL",
"tel":... |
<filename>tests/test_bicing.py
# -*- coding: utf-8 -*-
"""
Copyright 2016 <NAME>.
This file is part of BicingBot.
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/license... |
def connect(field,doct):
for i in range(14):
c=int(i/2)
if i%2==0:
for b in range(14):
a=int(b/2)
if b!=13:
if b%2==0:
print(field[a][c],end='')
else:
print('|',end='')... |
# -*- encoding: utf-8 -*-
'''
@Filename : utils_workflow.py
@Datetime : 2020/05/11 09:13:36
@Author : Joe-Bu
@version : 1.0
@description : 提取工具
'''
import os
import sys
import calendar
import traceback
from copy import deepcopy
from datetime import datetime, timedelta
import numpy as np
import pandas a... |
<gh_stars>1-10
import re
from docxtpl import DocxTemplate, R, InlineImage, RichText, Listing, Document, Subdoc
from docx.shared import Mm, Inches, Pt
import docx.opc.constants
from docassemble.base.functions import server
import docassemble.base.filter
from xml.sax.saxutils import escape as html_escape
from types impor... |
<gh_stars>100-1000
from sqlalchemy.orm import Session
from sqlalchemy import func
import datetime
import db.models as models
import schemas.schemas as schemas
def create_new_stack(
db: Session,
stack: schemas.StackCreate,
user_id: int,
task_id: str,
var_json: str,
var_... |
# -*- coding: utf-8 -*-
import numpy as np
from waldis.dynamic_graph import Edge
from waldis.random_walker import edge_similarity
def check_pattern_in_instance(graph, pattern_edges, pattern_attributes, pattern_timestamps, pattern_directions,
graph_starting_vertices, graph_starting_time... |
import logging
# connecting assisting functions, wrappers around psycopg
def QueryDatabase(query, SETTINGS=None, SCHEMA=None, SSH=None):
"""! Query either the 'data lake' postgres db, or the heap-rs3 'data warehouse'. """
if SSH:
try:
prod_tunnel
except NameError:
prod_tunnel = CreateSSHTunnel()
prod_... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Standard library
from __future__ import absolute_import, division, print_function
import argparse
import ConfigParser
import io
import re
import time
default_iterations = 100
default_old_config = "../wtop.cfg"
default_new_config = "robots_excerpt.ini"
file_user... |
from datetime import datetime
from glob import glob
from asyncio import sleep
import os
from dotenv import load_dotenv
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
from discord import Embed, File
from discord.errors import HTTPException, Forbidden
from ... |
# ------------------------------------------------------------------------------
# Unit tests for FactIndex and FactMap.
# ------------------------------------------------------------------------------
import unittest
import operator
from .support import check_errmsg
from clingo import Control, Number, String, Functi... |
# Copyright 2015 Google 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 law or a... |
<reponame>youngqqcn/QBlockChainNotes
#!coding:utf8
#author:yqq
#date:2020/5/11 0011 10:10
#description:
from binascii import hexlify
from eth_account.datastructures import SignedTransaction
from eth_typing import URI, Address, HexStr, BlockNumber, HexAddress, ChecksumAddress
from eth_utils import to_checksum... |
<reponame>babraham123/tigrinya_ocr<filename>HornMorpho/l3/morpho/am_lang.py
"""
This file is part of L3Morpho.
L3Morpho is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,... |
from pandac.PandaModules import *
CollectionTime = 30
BarrelRoomIntroTimeout = 15.0
RewardUiTime = 5.0
EndWithAllBarrelsCollected = False
ShowRewardUI = False
AllBarrelsCollectedTime = 5.0
ToonUp = (2, 4)
BarrelProps = [{'pos': (-10, -66, 0),
'heading': 9},
{'pos': (-7.8, -54.5, 0),
'heading': 12},
{'pos': (-10.5... |
# -*- coding: utf-8 -*-
import requests
from enviopack import Enviopack
from enviopack.constants import BASE_API_URL
from typing import List
from enviopack import Auth
class Quote(Enviopack):
"""
"""
_name = "Quote orders"
state:str
"ID Provincia: Deberá informarse el valor ID devuelto por el webservi... |
import asyncio
import datetime
import io
import os
import pickle
import pprint
import subprocess
import sys
import textwrap
import time
from contextlib import redirect_stdout
import nextcord as discord
import psutil
import traceback2
from nextcord.ext import commands
from .milkcoffee import MilkCoffee
from .utils.me... |
<reponame>lasse-herzog/pi-game-console
import os
import pygame
from pygame.locals import *
from pong.utils import load_asset
import pong.level_easy as level_easy
import pong.level_hard as level_hard
import pong.level_med as level_med
import pong.level_unf as level_unf
pygame.init()
# Game Initialization
# Center th... |
# Copyright (C) 2013-present The DataCentric Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... |
#////////////////////////Class constuctor//////////////
#.......Boid class
class Boid(object):
""" Custom Boid Class"""
def __init__(self,Pos,Vel,Range,Vision,Alignment,Separation,Cohesion):
self.pos = Pos
self.vel = Vel
self.ran = Range
self.vis = Vision
self.Al = Align... |
import urllib, json, os
from default_files import gitignore, wingproj, license, readme, setupfile, testfile
def get_default_files(name,desc):
"""
General default files
"""
defaultfiles = [['.gitignore', gitignore()],
['README.md', readme(name, desc)],
['... |
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ClientAdvisorOverviewVO(object):
"""NOTE: Thi... |
import os
import sys
import traceback
import json
from osgeo import gdal, osr
OUTPUT_FOLDER = "data"
def write_metadata_json(path, metadata):
with open(os.path.join(OUTPUT_FOLDER, path, 'metadata.json'), 'w') as outfile:
json.dump(metadata, outfile, indent=4, sort_keys=True)
def get_exten... |
import itertools, copy, random
import numpy as np
from time import time
from qiskit.converters import circuit_to_dag, dag_to_circuit
from qiskit.circuit.library.standard_gates import HGate, SGate, SdgGate, XGate
from qiskit_helper_functions.non_ibmq_functions import read_dict, find_process_jobs, evaluate_circ, get_all... |
<filename>2DX4_FinalProject_molinark.py
'''
<NAME>
400136596
2DX4 Final Project
Using Python 3.6.5
Need to pyserial, open3d, numpy, math, and sys libraries
'''
import serial
import math
import numpy
import open3d
import sys
angleOffset = 0 #starting angle in degrees relative to motor position (just co... |
import datetime
import typing
import numpy as np
import pandas as pd
from dateutil.relativedelta import relativedelta
from influxdb import DataFrameClient
import atpy.data.iqfeed.bar_util as bars
from atpy.data.ts_util import slice_periods
class InfluxDBOHLCRequest(object):
def __init__(self, client: DataFrame... |
#!/usr/bin/env python
#
# Copyright 2009 <NAME> All Rights Reserved.
# Portions Copyright 2009 Google 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:/... |
<reponame>icanbwell/mockserver_client
import json
from typing import Dict, Any, Optional, List, Union, cast
from urllib.parse import parse_qs
class MockRequest:
def __init__(self, request: Dict[str, Any]) -> None:
"""
Class for mock requests
:param request:
"""
self.reques... |
<reponame>ecoen66/imcsdk<gh_stars>10-100
"""This module contains the general information for BiosVfPartialMirrorPercent ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfPartialMirrorPercentConsts:
VP_PARTIAL_MIRR... |
from typing import Union
from app import db
class Team(db.Model):
__tablename__ = 'team'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
nickname = db.Column(db.String(100), nullable=True)
ap_poll = db.relationship('APPoll', backref='team', lazy=True... |
<reponame>Huanzhuo/njica
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
About: Core functions of a MEICA end host.
Currently, source data (X matrix) is fragmented into UDP datagrams with a
preamble (or header) for distributed MEICA.
The choice of UDP instead of TCP is due to following reasons:
... |
# - *- coding: utf- 8 - *-
import xlwings
from xlwings import Range
from cargarExcel import cargarExcelDataframe
import math
import logginProcess
import urllib.request
from urllib.error import HTTPError, URLError
import json
import pandas as pd
URL_SERVICIO_WEB = 'http://viscoandres.pythonanywhere.com/' #?tipo='
# URL... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@description: Module containing functions to calculate derivatives, averages, decompositions, vorticity.
@contact: <EMAIL>
"""
# Imports
import numpy as np
import warnings
# Functions
def avg_z(u):
"""
Return the span-wise spatial average of a three-dimensional field.
If ... |
#importing necessary packages
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import PolynomialFeatures
from sk... |
<reponame>HawkEleven/Python-RESTful-API
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-07-06 14:30:10
# @Author : Eleven (<EMAIL>)
# @Link : https://github.com/HawkEleven
# @Version : 1.0
import pymysql
from sqlalchemy import Column, String, create_engine
from sqlalchemy.orm import sessionmaker
fr... |
<reponame>pramulkant/https-github.com-android-art-intel-marshmallow
#!/usr/bin/python
import os, sys, csv
def AppendData(filename, data):
data[filename] = {}
with open(filename, 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
for i,row in enumerate(spamreader):
data[... |
<reponame>maccesch/django-moderation
from __future__ import unicode_literals
from django.test.testcases import TestCase
from django import VERSION
from django.db import models
from django.contrib.auth.models import User, Group
if VERSION >= (1, 4):
from django.test.utils import override_settings
from tests.models i... |
# Standard PyTorch imports
import time
import math
import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import matplotlib.pyplot as plt
class EncoderDecoderP(nn.Module):
"""
A standard Encoder-Decoder architecture. Base for thi... |
"""
Copyright (c) 2018-2020 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 law or agreed to in wri... |
import sys
import yaml
from collections import OrderedDict
def represent_ordereddict(dumper, data):
value = []
for item_key, item_value in data.items():
node_key = dumper.represent_data(item_key)
node_value = dumper.represent_data(item_value)
value.append((node_key, node_value))
... |
<reponame>Sveder/advent_of_code
input = """plaid fuchsia bags contain 5 light violet bags, 1 light yellow bag.
striped aqua bags contain 2 striped teal bags.
clear coral bags contain 2 plaid green bags, 5 mirrored gold bags.
dull tan bags contain 4 faded blue bags, 3 faded olive bags, 5 dull salmon bags.
plaid green ba... |
import copy
import logging
import sys
import typing
from typing import Type
import six
from dbnd._core.configuration.dbnd_config import config
from dbnd._core.current import get_databand_context
from dbnd._core.errors import friendly_error
from dbnd._core.plugin.dbnd_plugins import is_airflow_enabled
from dbnd._core... |
#===========================================#
#===========>>Python Lists<<================#
#===========================================#
list1 = ["apple", "banana", "cherry"]
list2 = [1, 5, 7, 9, list1]
list3 = [True, False, list2]
# Length of the list
length = len(list3)
print(length, list3[-1][-1][1])
#===========... |
<reponame>99Kies/allura<gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you un... |
<reponame>maghniem/redtide<filename>src/tradebot.py
import numpy as np
from time import sleep, time
from datetime import datetime
from collections import defaultdict
from analysis.financials import FinancialAnalysis
from src.common import get_wallstreet_time
from src.models import Stocks
from src.api import HoodAPI
... |
<filename>server.py
import torch
from torch import nn, optim
import torch.nn.functional as F
import time
import copy
import numpy as np
import torch
from torch import nn, optim
import torch.nn.functional as F
import time
import copy
import numpy as np
from utils import init_dict, save_dict, curve_save, time_mark, pri... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import dataclasses
import glob
import json
import logging
import os
import shutil
import site
import subprocess
import sys
from dataclasses... |
<reponame>fyellin/pds-opus
################################################################################
# validate.py
#
# Perform various validations on the database.
################################################################################
import impglobals
def validate_param_info(namespace):
# Every... |
import random
import networkx as nx
class Graph:
def __init__(self, n=100, e=200, p=0.001, init_scale=None):
self.n = n
if e > n * (n - 1) / 2:
self.e = n * (n - 1) / 2
else:
self.e = e
self.graph = nx.empty_graph(self.n)
self.nodes = list(self.gr... |
#print("Initializing NEW 3-head model")
import sys
from pyprojroot import here
proj_path = here()
#these next three lines are to important important TSM module functionality
sys.path.append(str(proj_path / "MULTITASK_FILES/TSM_FILES/temporal-shift-module/"))
from ops.basic_ops import ConsensusModule
from ops.transform... |
<gh_stars>0
import copy
import inspect
import math
import cv2
import mmcv
import numpy as np
from numpy import random
from mmdet.core import PolygonMasks
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from ..builder import PIPELINES
@PIPELINES.register_module()
class RandomRotate:
'''
modify b... |
# NOTE: bad django practice but /ee specifically depends on /posthog so it should be fine
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Tuple
from dateutil.relativedelta import relativedelta
from django.db.models.expressions import F
from django.utils import timezone
from rest_... |
#!/usr/bin/env python
# coding: utf-8
# # Frequentist vs Bayesian
#
# <p style="color:blue"> <NAME></p>
# <p style="color:blue">Station10 Ltd</p>
# ```{image} ./Bayesian-vs-frequentist.png
# :class: bg-primary mb-1
# :width: 500px
# :align: center
# ```
# ## 1. The problem formulation
# In a marketing campaign, a ... |
<filename>dataviva/apps/models.py
# -*- coding: utf-8 -*-
from flask import g
from dataviva import db, __latest_year__
from dataviva.utils.auto_serialize import AutoSerialize
from dataviva.utils.title_case import title_case
from dataviva.attrs.models import Bra, Isic, Hs, Cbo, Wld
import ast, re
build_ui = db.Table('... |
from pyb import I2C
import uasyncio as asyncio
import ustruct as struct
from utils import Timer
import ulogging as logging
logger = logging.Logger(__name__)
class Motor:
"""A class to represent a motor and offers an API to control it.
Additionnal documentation can be found here:
- http://learn.make... |
import torch as th
from torch import nn
import models
import math
import time
import timeit
class RNN_builtin(nn.Module):
def __init__(self, win, wrec, wout, brec, bout):
super(RNN_builtin, self).__init__()
s = win.shape
self.rnn = nn.RNN(s[0], s[1], 1)
self.rnn.weight_ih_l0.data = ... |
<reponame>liuxk99/sjPomotodo
# encoding=utf-8
# -------------------------------------------------------------------------------
# Name: pomo
# Purpose: python client for pomotodo
#
# Author: thomas
#
# Created: 07/07/2021
# Copyright: (c) thomas 2021
# Licence: <your licence>
# coding=utf-8
#... |
<reponame>fahlmant/openshift-tools
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
#This is not a module, but pylint thinks it is. This is a command.
#pylint: disable=invalid-name
"""
ops-runner: Script that runs commands and sends result data to zabbix.
"""
import argparse
import sys
from subprocess ... |
<reponame>mdda/libgpuarray
import operator
import numpy
from pygpu import gpuarray, ndgpuarray as elemary
from pygpu.elemwise import ElemwiseKernel
from pygpu.tools import check_args, ArrayArg, ScalarArg
from .support import (guard_devsup, rand, check_flags, check_meta, check_all,
context, gen_g... |
#!/usr/bin/python
from h264 import *
import unittest
def binData( s ):
"convert 0/1/<space> string into byte buffer string"
ret = ""
mask = 1<<7
val = 0
for c in s:
if c == ' ':
continue
if c == '1':
val += mask
mask /= 2
if mask == 0:
ret += chr(val)
val = 0
mas... |
<gh_stars>1-10
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: onos/ransim/model/model.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import AsyncIterator, Dict, List, Optional
import betterproto
from betterproto.grpc.grpclib_server import ServiceBase
import grpc... |
"""
This module provides GLTF 2.0 exports
"""
import json
import collections
import numpy as np
from .. import util
# magic numbers which have meaning in GLTF
# most are uint32's of UTF-8 text
_magic = {'gltf': 1179937895,
'json': 1313821514,
'bin': 5130562}
# GLTF data type codes: numpy dtypes... |
<gh_stars>100-1000
from dynaconf.utils.boxing import DynaBox
from datetime import datetime
from threatbus_misp import plugin as misp_plugin
from threatbus_inmem import plugin as inmem_backbone
from queue import Queue
import time
import unittest
import zmq
class TestRoundtrips(unittest.TestCase):
def test_misp_plu... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
<gh_stars>0
import re
class WordIterator:
"""
A basic wrapper for sequential reading of words from file
"""
def __init__(self, filename):
self.filename = filename
self.word_queue = []
self.line_payload = 50 # how many lines will be loaded into the queue at one time
se... |
#!/usr/bin/python
# ------------------------------------------------------------------------------
#
# Automatic generation of a completion function for stoke for zsh.
# Running this file will produce bin/_stoke, which can be used by zsh. If the
# env variable ZSH_COMPLETION_DIR points to a directory, then _stoke is ... |
"""Implementation of the pycross_wheel_library rule."""
load(":providers.bzl", "PycrossWheelInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@rules_python//python:defs.bzl", "PyInfo")
def _pycross_wheel_library_impl(ctx):
out = ctx.actions.declare_directory(ctx.attr.name)
wheel_target = ctx.attr.wh... |
<gh_stars>0
"""
Tensorflow SMPL implementation as batch.
Specify joint types:
'coco': Returns COCO+ 19 joints
'lsp': Returns H3.6M-LSP 14 joints
Note: To get original smpl joints, use self.J_transformed
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
im... |
from __future__ import unicode_literals
from click.testing import CliRunner
import os.path
from pytest import raises
from textx import metamodel_from_str
from textx.cli import textx
from textx.exceptions import TextXError
from textx.generators import gen_file, get_output_filename
from textx import language, generator... |
<filename>pysal/esda/tests/test_gamma.py
import unittest
import numpy as np
from ...weights import lat2W
from ..gamma import Gamma
from ...common import pandas
PANDAS_EXTINCT = pandas is None
class Gamma_Tester(unittest.TestCase):
"""Unit test for Gamma Index"""
def setUp(self):
self.w = lat2W(4, 4)
... |
<gh_stars>1000+
#!/usr/bin/env python
#
# check_sizes.py is a tool run by the ESP-IDF build system
# to check a particular binary fits in the available partitions of
# a particular type/subtype. Can be used to check if the app binary fits in
# all available app partitions, for example.
#
# (Can also check if the bootlo... |
from AC3utils import PLUGIN_BASE, PLUGIN_VERSION
from Components.ActionMap import NumberActionMap
from Components.Button import Button
from Components.ConfigList import ConfigListScreen
from Components.Label import Label
from Components.config import config, getConfigListEntry
from Screens.Screen import Screen
class A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.