content stringlengths 5 1.05M |
|---|
from ..config import PROGRAM
#APP = "%s-%s" % (PROGRAM, "baf")
APP = PROGRAM
MODULE = "baf"
|
"""
Tools for inspecting existing clusters.
"""
import click
from dcos_e2e_cli.common.inspect_cluster import show_cluster_details
from dcos_e2e_cli.common.options import (
existing_cluster_id_option,
verbosity_option,
)
from dcos_e2e_cli.common.utils import check_cluster_id_exists
from ._common import Cluste... |
# MINLP written by GAMS Convert at 01/15/21 11:37:20
#
# Equation counts
# Total E G L N X C B
# 2935 1123 129 1683 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
import PIL, random, os, shutil
class Winner(Exception):
pass
class Tie(Exception):
pass
class InvalidMove(Exception):
pass
class TicTacToe:
def __init__(self, player1, player2):
# Készítsen másolatot a mezőről a cache mappába,
# majd megnyitjuk módosításra
self.file = f"cach... |
"""Provide definition of abstract Stream Producer
This file can be imported as a module and contains the following classes:
* StreamProducer - Abstract class that must be implement by concrete
Stream Producers
"""
import abc
import logging
import types
import typing
class StreamProducer(abc.ABC):
""... |
# coding: utf-8
import sys
import os
import re
import argparse
from lib import meiro
# by https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
... |
#
# Created by Lukas Lüftinger on 2/5/19.
#
from typing import List, Dict, Tuple, Optional
from collections import Counter
import json
import gzip
import pandas as pd
from Bio import SeqIO
from Bio.Alphabet import IUPAC, HasStopCodon, _verify_alphabet
import numpy as np
from phenotrex.util.logging import get_logger
f... |
# Based on Vestel YKR-H/002E AC remote
from time import sleep
from acremote.thermo import W1Thermo
import gpirblast
class VestelACRemote():
def __init__(self, gpio_pin: int):
self._SWING = True
self._ON = False
self._HEALTH = False
self._STRONG = False
self._SLEEP = False... |
from copy import deepcopy
d1 = []
d2 = []
player_2 = False
with open('in', 'r') as f:
f.readline()
for line in f.readlines():
try:
i = int(line.strip())
if player_2:
d2.append(i)
else:
d1.append(i)
except Exception:
... |
from dae.utils.variant_utils import mat2str
def test_dae_transmitted_loader_simple(dae_transmitted):
for fv in dae_transmitted.family_variants_iterator():
print(fv, mat2str(fv.best_state), mat2str(fv.gt))
|
# Copyright (C) 2020 FireEye, 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: [package root]/LICENSE.txt
# Unless required by applicable law or agreed to in writing,... |
import threading
import click
from irekua_dev_tools.utils import check_app_name
from .git import download_repository
from .git import update_repository
from .git import check_repository
@click.group(name="git")
@click.pass_context
@click.option('--origin', '-o', default='origin')
@click.option('--branch', '-b', def... |
import json
from AddressFormatter.util import format
import re
from AddressFormatter.dataFromPincode import dataFromPincode
def addressJSON(extractedAddress):
with open('data.json', 'r') as dataJSON:
dict = json.load(dataJSON)
dict['extractedAddress'] = extractedAddress.replace('\n', ' ').replace(... |
# coding: utf-8
"""
Logistics API
<span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\... |
"""
Define functions, classes, and constants that are exposed to the client,
enabling calls to fables.* .
"""
from fables.api import detect, parse
from fables.tree import (
StreamManager,
FileNode,
MimeTypeFileNode,
Directory,
Zip,
Csv,
Xls,
Xlsx,
Xlsb,
Skip,
mimetype_from_s... |
import FWCore.ParameterSet.Config as cms
# Module to create simulated GEM-CSC trigger pad digis.
simMuonGEMPadDigis = cms.EDProducer("GEMPadDigiProducer",
InputCollection = cms.InputTag('simMuonGEMDigis'),
)
from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon
from Configuration.ProcessModifiers.pr... |
"""
A simple demo server.
It waits to receive connections from a client, then instructs that client to run `ls -al`, waits for the results, and prints them. Should work with multiple clients but honestly anything more than what I described above is untested.
"""
import json
import random
import string
from time impor... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pystardog",
version="0.9.7",
author="Stardog Union",
author_email="support@stardog.com",
description="Use Stardog with Python!",
long_description=long_description,
long_description... |
from __future__ import print_function
from bitcoinetl.build_export_dag import build_export_dag
from bitcoinetl.variables import read_export_dag_vars
# When searching for DAGs, Airflow will only consider files where the string "airflow" and "DAG" both appear in the
# contents of the .py file.
DAG = build_export_dag(
... |
#!/usr/bin/env python
# coding: utf-8
# # Generate [dividiti](http://dividiti.com)'s submissions to [MLPerf Inference v0.5](https://github.com/mlperf/inference/tree/master/v0.5)
# <a id="overview"></a>
# ## Overview
# This Jupyter notebook covers [dividiti](http://dividiti.com)'s submissions to [MLPerf Inference v0.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from openpyxl import Workbook
from openpyxl import load_workbook
finally_filename = 'aftercopy_book.xlsx'
origin_filename = 'origin_book.xlsx'
read_wb = load_workbook(filename = origin_filename)
sheet_names = read_wb.get_sheet_names(... |
size_x = 3
size_y = 3
size_z = 3
modelname = "generic_satellite_var_rad_optical_properties_"+str(size_x)+"x"+str(size_y)+"x"+str(size_z)
#modelname = "generic_satellite_optical_properties_"+str(size_x)+"x"+str(size_y)+"x"+str(size_z)
import_to_model = ["iboss.*","iboss.illumination.*"]
parameter =["illumination.LEO.Str... |
from __future__ import print_function
import os
import sys
import unittest
import io
import re
from xml.sax.saxutils import XMLGenerator
from xml.sax import SAXParseException
from pyexpat import ExpatError
from defusedxml import cElementTree, ElementTree, minidom, pulldom, sax, xmlrpc
from defusedxml import defuse_st... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import distutils.version
# NumPy 1.13.1 introduced NEP13, without which Awkward ufuncs won't work, which
# would be worse than lacking a feature: it would cause unexpected output.
# NumPy 1.... |
__author__ = "Myles Dear <mdear@cisco.com>"
from unicon.bases.routers.connection import BaseSingleRpConnection
from unicon.bases.routers.connection import BaseDualRpConnection
from unicon.plugins.iosxr.iosxrv.statemachine import IOSXRVSingleRpStateMachine
from unicon.plugins.iosxr.iosxrv.statemachine import IOSXRVDua... |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... |
import numpy as np
from scipy import misc
from interpolate_2D import interpolate_2D
def rotate_z(points,theta):
"""Rotate an array of points theta degrees around the z-axis."""
theta = np.radians(theta)
c, s = np.cos(theta), np.sin(theta)
rotationMatrix = np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
... |
import pytest
from datums_warehouse.scripts.update import update_pairs
class WarehouseSpy:
def __init__(self):
self.received_pairs = []
def update(self, pair):
import time
import random
time.sleep(random.uniform(0.01, 0.1))
self.received_pairs.append(pair)
@pytest.f... |
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs43_detached_award_financial_assistance_2'
def test_column_headers(database):
expected_subset = {'row_number', 'place_of_performan... |
# Package.
|
# Generated by Django 3.0.6 on 2020-05-04 22:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0002_config_name'),
]
operations = [
migrations.RemoveField(
model_name='config',
name='enable',
),
]
|
__author__ = 'yuy001'
#!/usr/bin/env python
a = ["cat","dog", "rat", "cow", "horse"]
a.append("elephant")
print a |
# Copyright 2022 The AI Flow 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 or agreed to in wri... |
# coding: utf-8
"""
SimScale API
The version of the OpenAPI document: 0.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from simscale_sdk.configuration import Configuration
class OneOfFrequencyAnalysisBoundaryConditions(object):
"""NOTE: This... |
import logging
from performance.driver.core.config import Configurable
from performance.driver.core.eventbus import EventBusSubscriber
class Runner(Configurable, EventBusSubscriber):
"""
A Run controller controls the overall execution of the test suite.
This abstraction allows the tests to continue until enoug... |
# Define custom error messages here
EMAIL_IN_USE = ({'message': 'User with that email already exists'}, 409)
UNAUTHORIZED = (
{'message': 'Authentication is required to access this resource', 'type': 'UNAUTHORIZED'}, 401)
BAD_CREDENTIALS = (
{'message': 'Incorrect username or password', 'type': 'BAD_CREDENTIAL... |
#!/usr/bin/env python
# coding: utf-8
# ## Overview of functionalities
#
# This notebook gives an overview of the functionalities of the dhydamo module.
#
# For install instructions see: https://github.com/openearth/dhydamo#installation
#
# Note that the old version of the package (delft3dfmpy) will not be updated ... |
from test.job_parameters.test_load_job_parameters import TestLoadJobParameters
from test.job_parameters.test_flatten_parameter_dictionary import TestFlattenParameterDictionary
from test.job_parameters.test_log_param import TestLogParam
from test.job_parameters.test_log_params import TestLogParams |
from __future__ import print_function
import py
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr
from rpython.rtyper import rclass
from rpython.jit.backend.test import test_random
from rpython.jit.backend.test.test_random import getint, getref_base, getref
from rpython.jit.metainterp.resoperation im... |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... |
import json
data = json.dumps({'status': {'recordsTotal': 0, 'request': 'getSalesReport', 'generationTime': 0.13462495803833, 'recordsInResponse': 0, 'requestUnixTime': 1469040297, 'errorCode': 1016, 'errorField': 'dateStart', 'responseStatus': 'error'}, 'records': None})
|
import mwclient
site = mwclient.Site('en.wikipedia.org')
def get_gender(users):
result = {}
users = site.users(users=users, prop=['gender'])
for user in users:
name = user['name']
if 'missing' in user:
result[name] = 'unknown'
else:
gender = user['gender']
... |
__author__ = 'Bohdan Mushkevych'
from threading import RLock
from bson.objectid import ObjectId
from pymongo import ASCENDING
from pymongo.errors import DuplicateKeyError as MongoDuplicateKeyError
from synergy.system import time_helper
from synergy.system.time_qualifier import *
from synergy.system.decorator import ... |
import math
from math import sqrt
from os import listdir
from os.path import join, basename
import matplotlib.pyplot as plt
import moviepy.editor as mpy
import numpy as np
from torch import nn
from src.Common import config
from src.Common.utils import get_data_base
def loss_visualization(training_space: dict, loss_... |
# uncompyle6 version 3.3.5
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\pushbase\value_component.py
# Compiled at: 2018-11-30 15:48:12
from _... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class SignApproveOpenApiDTO(object):
def __init__(self):
self._process_ids = None
self._process_type = None
@property
def process_ids(self):
return self._process_ids
... |
#!/usr/bin/env vpython
# Copyright 2016 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.
# This file was copy-pasted over from:
# //build/scripts/slave/upload_perf_dashboard_results.py
# with sections copied from:
# //build... |
# ATTENTION: the tests are supposed to be run inside a container!
# all dependencies have to be installed before running the tests by `./entrypoint install -n benchmark_name`
from .abstract_test import BuildAndRun, INPUT_PATH
from .abstract_acceptance_test import Acceptance
import sys
import logging
import unittest
c... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 2 19:54:03 2016
@author: nhuynh
"""
import csv;
import utilities;
import railNetv2;
import mmResultsRef;
import mmRef;
def readInFlowCounts(filename):
"""
reads in the flow counts from simulation output files of a station.
ignores the second r... |
#!/usr/bin/env python3
class Insertion_Sort:
i=0
n=0
t=0
arr=0
def __init__(self,i,n,ele,arr):
self.i=i
self.n=n
self.arr=arr[6]
self.t=t
def user_input():
n= int(input("kindly enter the number of elements to be entered into the database"))
f... |
import ConfigParser
import requests
import json
import os
#Load all mutable-like information from configuration files
conf_file = os.path.join(os.environ["HOME"], ".pytravisrc")
gh_token = False
auth_token = False
if os.path.exists(conf_file):
conf = ConfigParser.ConfigParser()
conf.read(conf_file)
#Get AP... |
#!/bin/python3
import time
import numpy as np
if __name__ == '__main__':
arr=np.arange(10)
print(arr)
t0 = time.time()
arr=np.zeros([5000,5000])
t1 = time.time()
arr2=[[0 for _ in range(5000)] for _ in range(5000)]
t2 = time.time()
print(str(t1-t0), str(t2-t1))
arr[0][0]=1
prin... |
# TODO
#
# @author Oktay Acikalin <oktay.acikalin@gmail.com>
# @copyright Oktay Acikalin
# @license MIT (LICENSE.txt)
import os
import sys
import ConfigParser
from collections import OrderedDict
from math import ceil, floor
import csv
from types import GeneratorType
from diamond import pyglet
from diamond.rect i... |
#
# Copyright (c) 2006-2013, Prometheus Research, LLC
#
from htsql.core.adapter import adapt
from htsql.core.error import Error
from htsql.core.domain import (BooleanDomain, TextDomain, IntegerDomain,
DecimalDomain, DateDomain, TimeDomain, DateTimeDomain)
from htsql.core.tr.frame import ColumnPhrase, Referenc... |
import re
import requests
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
def getHTMLText(url):
try:
header = {"user-agent":
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"}
r = requests.get(url, timeout = 20,... |
import unittest
import os
from programy.processors.post.removehtml import RemoveHTMLPostProcessor
from programy.bot import Bot
from programy.brain import Brain
from programy.config.sections.brain.brain import BrainConfiguration
from programy.config.sections.bot.bot import BotConfiguration
class RemoveHTMLTests(unitte... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="projects"),
path('project/<str:pk>/', views.project, name="project"),
]
|
import sublime
import sublime_plugin
import hashlib
import htmlmin
import json
import sys
from http.client import CannotSendRequest
from jinja2 import Template
from os.path import realpath
from threading import Lock
from urllib.parse import quote
from ..lib import deferred, keymap, link_opener, logger, settings, requ... |
from concurrent.futures.thread import ThreadPoolExecutor
from json import load
from selenium.webdriver.remote.webdriver import WebDriver
from selenium import webdriver
from selenium.webdriver.edge.options import Options as EdgeOptions
from time import perf_counter, sleep
from selenium.webdriver.common.desired_capabilit... |
""" The Code is under Tencent Youtu Public Rule
"""
from PIL import Image
from torch.utils.data import Dataset
#val,l-train dataset
class MyDataset(Dataset):
"""
Interface provided for customized data sets
names_file:a txt file, each line in the form of "image_path label"
transform: transform piplin... |
from typing import List
import numpy as np
import torch
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
self.softmax = nn.... |
import random
import sys
import pygame
import time
from src.carnivorous import *
from src.food import *
# Initialisation
pygame.init()
width, height = 800, 600
black = 0, 0, 0 # Black is for background
white = 255, 255, 255 # White is for big winter event
yellow = 255, 255, 0 # Yellow is for big summer event
red ... |
import numpy as np
def create_int_img(img):
int_img = np.cumsum(img, axis=0)
np.cumsum(int_img, axis=1, out=int_img)
return int_img
def drop_objects_in_igr(gt, det, img_height, img_width):
gt_ignore_mask = gt[:, 5] == 0
curgt = gt[np.logical_not(gt_ignore_mask)]
igr_region = gt[g... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 28 14:20:44 2018
@author: Evangelos Tzardis
"""
from time import sleep, time
import serial
import mylibrary as mlb
import rw_config as cfg
import numpy as np
import imageio
import os
#def init_camera():
# settings = ['acquisition mode','continuous',\
... |
# -*- coding: utf-8 -*-
import urllib3
import pandas as pd
import os
# if DOWNLOAD = False,don't download report
DOWNLOAD=True
def download_report(code):
"""
下载报表(利润表年表,如果下载其他报表,需要修改url
Arguments:
code: 股票代码
"""
# 利润表(年表)
url = f"http://quotes.money.163.com/service/lrb_{code}.html?ty... |
# Copyright (C) 2019 Chao Wen, Yinda Zhang, Zhuwen Li, Yanwei Fu
# All rights reserved.
# This code is licensed under BSD 3-Clause License.
import tensorflow as tf
import tflearn
import os
import tensorflow.contrib.layers as tfcontriblayers
from modules.losses import mesh_loss, laplace_loss
from modules.layers import ... |
from tkinter import *
def fill_list_scrollbar(items):
top = Tk()
top.geometry('1024x400')
top.title('Relação de e-mails que foram enviados')
sb = Scrollbar(top)
sb.pack(side = RIGHT, fill = Y)
mylist = Listbox(top, yscrollcommand = sb.set, width='1024', height='400')
for li... |
def timed_func(f, args=(), kwargs=None, timeout=30, default=None, errormsg="Timeout error"):
# Since kwargs are mutable, assume they don't exist via optional arguments. If they do in fact exist,
# they will exist in this context and be assigned. Otherwise, set to an empty dict and proceed.
kwargs = kwargs or {}
i... |
import unittest
from ratings.ratings import elo_rating
class TestRatings(unittest.TestCase):
def test_elo_rating(self):
p1_rating = 1200
p2_rating = 1000
K = 32
ratings_if_p1_wins = elo_rating(p1_rating, p2_rating, K, True)
expected_ratings_p1_wins = (1208, 992)
s... |
#
# 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
# distributed under t... |
from django.shortcuts import render
from django.contrib.auth.models import User
# Create your views here.
def index(request):
print(request.user)
if request.user.is_authenticated:
social = request.user.social_auth.get(provider='fitbit')
token = social.extra_data['access_token']
print(... |
from django.urls import path, re_path
from django.contrib.sitemaps.views import sitemap
from blog.sitemaps import BlogSitemap
from blog.views import (
BlogDetailView,
BlogIndexView,
BlogPostsRssFeed,
BlogPostsAtomFeed,
)
urlpatterns = [
# blog urls
path("", BlogIndexView.as_view(), name="blog... |
import unittest
import numpy as np
import rlcard
from rlcard.agents import RandomAgent
from .determism_util import is_deterministic
class TestVecEnv(unittest.TestCase):
def test_vec_env(self):
env = rlcard.make('limit-holdem', config={'env_num': 4})
env.set_agents([RandomAgent(env.action_num) for... |
# -*- coding: utf-8 -*-
def foo():
pass
print foo()
|
# Copyright 2021 The HuggingFace Team. 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 applicabl... |
# coding: utf-8
# 2021/7/12 @ tongshiwei
__all__ = ["PadSequence", "pad_sequence"]
class PadSequence(object):
"""Pad the sequence.
Pad the sequence to the given `length` by inserting `pad_val`. If `clip` is set,
sequence that has length larger than `length` will be clipped.
Parameters
---------... |
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class AmazonProduct(models.Model):
_name = "amazon.product"
name = fields.Char('Product Name')
img_url = fields.Char(string="Image URL")
link_url = fields.Char(string="Link URL")
|
"""
Abstracts a column to handle its existence as both part of a Table and
a namespace variable. A ColumnVariable has a lifetime no longer than the
period that the underlying column is static.
"""
import api_util
import cell_types
class ColumnVariable(object):
"""
Manages the relationship between the da... |
import FWCore.ParameterSet.Config as cms
badGlobalMuonTaggerMAOD = cms.EDFilter("BadGlobalMuonTagger",
muons = cms.InputTag("slimmedMuons"),
vtx = cms.InputTag("offlineSlimmedPrimaryVertices"),
muonPtCut = cms.double(20),
selectClones = cms.bool(False),
taggingMode = cms.bool(False),
)
cloneGloba... |
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
from .app import create_app
async def test_graphiql_view(aiohttp_app_client):
response = await aiohttp_app_client.get("/graphql", headers={"Accept": "text/html"})
body = await response.text()
assert "GraphiQL" in bod... |
"""
Standard logger settings
"""
import logging
LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
def get_logger(name, level=logging.DEBUG):
logger = logging.getLogger(name)
logger.setLevel(level)
# create console handler and set level to debug
console_handler = logging.StreamHandl... |
# -*- coding: utf-8 -*-
import calendar
from jinja2 import Environment, PackageLoader
class Mbrmau:
def __init__(self, year, month):
first_weekday, last_day = calendar.monthrange(year, month)
days = map(lambda n: n+1, range(last_day))
weekdays = map(lambda n: (first_weekday+n) % 7, range... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
# Copyright (C) 2021 Graz University of Technology.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""DataCite-... |
import math
import os
import numpy as np
import time
from collections import namedtuple
import scipy.io as sio
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.batchnorm import _BatchNorm
# import vgtk.zpconv as zptk
import vgtk.so3conv as sptk
# SO3 Conv
# [nb, np, 3] -> [nb, ... |
# -*- coding: utf-8 -*-
# Copyright 2015 Donne Martin. 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. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "lice... |
from ._co2tab import co2tab
from ._export import export
from ._extract import extract
from ._merge import merge
from ._save2incon import save2incon
__all__ = [
"co2tab",
"export",
"extract",
"merge",
"save2incon",
]
|
import wpilib
from wpilib import controller
import ctre
from numpy import interp
from magicbot import feedback, tunable
class Shooter:
outer_motor: ctre.WPI_TalonFX
centre_motor: ctre.WPI_TalonFX
loading_piston: wpilib.Solenoid
ranges = (0, 7, 8, 9, 10, 11) # TODO remove 0 and add more data points
... |
from djgeojson.serializers import Serializer as GeoJSONSerializer
from django.contrib.gis.measure import Distance, D
from django.shortcuts import render_to_response
from djgeojson.http import HttpJSONResponse
from django.template import RequestContext
from django.contrib.gis.geos import Point
from models import PermitA... |
#! /usr/bin/env python
# coding=utf-8
import sys
sys.path.append('../common')
import os.path
from flask import Flask, redirect, url_for
from flask_admin import Admin
from flask_login import (current_user, UserMixin, LoginManager,
login_user, logout_user)
from flask_admin.contrib.sqla import Mo... |
from enum import Enum
class PerceivedDeviceType(Enum):
Undefined = 0
DigitalStillCamera = 1
|
import time
from datetime import datetime
from random import choice, randint
from pandas import DataFrame
class Log:
def __init__(self, cases, events, rows):
self.cases = [i for i in range(cases)]
self.events = [i for i in range(events)]
self.case_data = [choice(self.cases) for i in range... |
import configparser
import getpass
import os
from typing import Type, Generic, List, Dict, Set
DEFAULT_HOSTNAME = "tristano.neuro.polymtl.ca"
DEFAULT_PORT = "80"
DEFAULT_CONFIGFILE = ".sctdbtool"
def setup(arguments: Dict):
"""This method will ask user input to configure the system
with the hostname, userna... |
# coding=utf8
connected = False
print("Loading...")
print("Loading imports...")
import re
import sys
import os
import io
import json
import time
import socket
import random
import urllib
import string
import aiohttp
import smtplib
import discord
import asyncio
import requests
import datetime
impor... |
#basit shape detection
# kare ile dikdortgeni ayirt edemez
import cv2 as cv
img = cv.imread('shapes2.jpg')
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
__, thresh = cv.threshold(gray, 240, 255, cv.THRESH_BINARY )
contours, __ = cv.findContours(thresh, cv.RETR_TREE, cv.CHAIN_APPROX_NONE)
for contour in contours :
... |
import pygame
from random import randint
class Rectangle:
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = randint(20,100)
self.height = randint(20,100)
self.top = y
self.bottom = y + self.height
self.left = x
self.right =... |
# Generated by Django 3.1.2 on 2021-03-26 18:53
from django.db import migrations, models
import lfs.core.fields.thumbs
class Migration(migrations.Migration):
dependencies = [
('manufacturer', '0002_auto_20150428_2039'),
]
operations = [
migrations.AlterField(
model_name='man... |
import ast
from typing import Dict, Tuple
from boa3.compiler.codegenerator import CodeGenerator
from boa3.model.method import Method
from boa3.model.operation.binary.binaryoperation import BinaryOperation
from boa3.model.operation.binaryop import BinaryOp
from boa3.model.operation.unary.unaryoperation import UnaryOper... |
"""
Adapted from "The Color Blind Simulation function" by Matthew Wickline
and the Human - Computer Interaction Resource Network (http://hcirn.com/), 2000 - 2001.
"""
import numpy as np
rBlind = {
"protan": {"cpu": 0.735, "cpv": 0.265, "am": 1.273463, "ayi": -0.073894},
"deutan": {"cpu": 1.14, "cpv": -0.14, "a... |
from socutils import get_settings, exceptions
import logging
import sys
import os
logger = logging.getLogger("configer")
def read_setting(path):
try:
config = get_settings(path)
except exceptions.SettingsFileNotExistError:
logger.error(f'{path} Not found')
sys.exit(1)
return confi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.