text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from test_bitbucketbase import BitbucketFixture
import json
import httpretty
from uritemplate import expand
from pybitbucket.ref import (Ref, Tag, Branch)
from pybitbucket.bitbucket import Bitbucket
from pybitbucket.commit import Commit
from pybitbucket... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 28 17:46:55 2021
@author: bhupendra.singh
"""
import numpy as np
import pandas as pd
from tqdm import tqdm
import opensmile
totalSubjects = 21
totalUtterances = 60 #the number of utterances of words in a folder for every subject
featureName = "mfcc"
features_length... |
import torch
from torchvision import models
from tensorboardX import SummaryWriter
writer = SummaryWriter()
resnet = models.resnet34(pretrained=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = resnet.to(device)
dummy_input = torch.zeros(8, 3,512,512)
writer.add_graph(model, du... |
# The proper divisors of a number are all the divisors excluding
# the number itself. For example, the proper divisors of 28 are
# 1, 2, 4, 7, and 14. As the sum of these divisors is equal to 28,
# we call it a perfect number.
# Interestingly the sum of the proper divisors of 220 is 284 and
# the sum of the proper div... |
def extractManaTankMagus(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Mana Tank Magus' in item['tags']:
return buildReleaseMessageWithType(item, 'Mana Tank Magus', vol, chp, frag=frag, postfi... |
# Generated by Django 3.2.12 on 2022-04-22 23:25
import bootcamp.custom
from django.db import migrations
import django_ckeditor_5.fields
class Migration(migrations.Migration):
dependencies = [
('articles', '0010_alter_article_content'),
]
operations = [
migrations.AlterField(
... |
# -*- python -*-
# Copyright (C) 2009-2016 Free Software Foundation, Inc.
# This program 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, or
# (at your option) any later versio... |
import numpy as np
import sys, os
import time
import glob
from registration_3d import *
from cartesian import *
from collections import namedtuple
from operator import itemgetter
from pprint import pformat
import matplotlib.pyplot as plt
from read_files import *
import argparse
from ICPmatching import *
class KD_tree(... |
# Problem: Merge Two Sorted Lists
# Difficulty: Easy
# Category: LinkedList
# Leetcode 014: https://leetcode.com/problems/merge-two-sorted-lists/description/
# Description:
"""
Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists.
"... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... |
# Copyright 2016 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
#
# Unless required by applica... |
# LEGB rule: Local Enclosing Global Built-in
name = 'global'
def enclosing():
name = 'enclosing'
def local():
global name # bring name from global namespace into local
#nonlocal name # bring name from enclosing namespace into local
name = 'local'
print(f'enclosing name: ... |
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template_file: python-cli-command.j2
# justice-social-service (1.29.2)
# pylint: disable=duplicate-code... |
class LOG:
def info(message):
print("Info: " + message)
def error(message):
print("Error: " + message)
def debug(message):
print("Debug: " + message) |
#!/usr/bin/env python
# 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... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class GizmodoPipeline(object):
def process_item(self, item, spider):
return item |
#!/usr/bin/env python
from setuptools import find_namespace_packages, setup
import os
import re
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md')) as f:
long_description = f.read()
package_name = "dbt-spark"
# get this from a separate file
def _dbt... |
from .cli import app
app(prog_name="logbook-cli") |
# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. 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://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
'''Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa.
O Programa vai perguntar o valor da casa, o salário do comprador e em quantos anos ele vai pagar.
Calcule o valor da prestação mensal, sabendo que ela não pode exceder 30% do salário ou então o empréstimo será negado'''
valor = float(i... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: object_detection/protos/optimizer.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messag... |
#!/usr/bin/env python3
import os
import subprocess
import json
# Text styling class
class Text:
HEADER = '\033[1;34m'
SUCCESS = '\033[1;32m'
FAIL = '\033[1;21m'
ENDC = '\033[0m'
# Shell commands class
class Commands:
INSTALL_PY_DEPS = 'sudo apt-get install -y python3 python3-distutils python3-pip ... |
from collections import Mapping, MutableMapping
from configparser import ConfigParser
import datetime
from enum import Enum, IntEnum, unique
import struct
from threading import Lock
from .constants import *
class ObjectDictionary(MutableMapping):
def __init__(self, other=None, **kwargs):
self._store = { ... |
# from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
import sys
print(sys.version)
from module import t_math
assert t_math.add(1, 1) == 2
assert t_math.subtract(1, 1) == 0 |
# 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... |
#Alternative
for x in 'ABCDE':
for y in 'ABCDE':
print(x,end="")
print() |
# automate/server/user/forms.py
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length, EqualTo
class LoginForm(Form):
email = StringField('Email Address', [DataRequired(), Email()])
password = PasswordField('Password', [DataRequi... |
# Licensed under a 3-clause BSD style license - see LICENSE
'''
Tests for the "perturbation_auf" module.
'''
import pytest
import os
import numpy as np
from numpy.testing import assert_allclose
from scipy.special import j0, j1
from ..matching import CrossMatch
from ..misc_functions_fortran import misc_functions_fortr... |
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copy... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""Advent of Code 2019 Day 10 - Monitoring Station."""
from math import atan2, degrees, pi
with open("inputs/day_10.txt", "r") as f:
space = [list(row) for row in f.read().strip().split('\n')]
space_dict = {}
y = 0
for row in space:
x = 0
for col in row:
value = space[y][x]
if value == ... |
"""
Remove vendor plugin from openaps-environment
"""
from vendor import Vendor
def main (args, app):
for plugin in Vendor.FromConfig(app.config):
if args.name == plugin.name:
plugin.remove(app.config)
app.config.save( )
print ('removed', plugin.format_url( ))
break |
WEAPONS = {
"lewis gun low weight": "b79b965e-e080-475d-a1cc-2432de5f3bf5",
"sawtooth knife": "f9983578-e3e9-46fb-bcc5-6640825b7169",
"sjogren inertial factory": "5d89166e-58e1-46fd-b854-69641e9dcef7",
"survival knife": "5be36f02-de5e-4ddd-8e09-74fd16f39efc",
"m97 trench gun backbored": "ea7c6cf1-58... |
from shaker.version import __version__
import optparse
def parse_cli():
parser = optparse.OptionParser(
usage="%prog [options] profile",
version="%%prog %s" % __version__)
parser.add_option(
'-a', '--ami', dest='ec2_ami_id', metavar='AMI',
help='Build instance from AMI')
p... |
import discord
from discord.ext import commands
from random import shuffle
GAME_MASTER = {}
def is_game_master(ctx):
return ctx.message.author.id == GAME_MASTER.get(ctx.guild.id)
class TruthOrDareCmd(commands.Cog):
""" Command list for playing a Truth or Dare game with server members. """
def __init__... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/speech_v1/proto/cloud_speech.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import mes... |
#!/usr/bin/python
##?? early version of count_clst_abundance.py ??##
import sys
import os
from collections import Counter
import re
#if len(sys.argv) != 4:
# print "USAGE: cdhit_clst_parser.py <pattern> <cdhit.clstr> <out_file>"
# sys.exit(1)
j =0
f = open(sys.argv[1], 'rU')
#output = open(sys.argv[2], 'w')
for n... |
import unittest
from amaranth import *
from amaranth.back.pysim import *
from ..units.divider import *
from ..isa import Funct3
def test_op(funct3, src1, src2, result):
def test(self):
sim = Simulator(self.dut)
def process():
yield self.dut.x_op.eq(funct3)
yield self.dut.... |
# flake8: noqa
__version__ = "0.19.2"
from dbcat.catalog.pii_types import PiiType
class Phone(PiiType):
name = "Phone"
type = "phone"
pass
class Email(PiiType):
name = "Email"
type = "email"
pass
class CreditCard(PiiType, type="credit_card"): # type: ignore
name = "Credit Card"
t... |
"""
__Seed builder__
AUTO_GENERATED (Read only)
Modify via builder
"""
def get_schema():
import seed.schema.schema as seed_schema
return seed_schema.schema
schema = get_schema() |
# SPDX-FileCopyrightText: 2021 Jean-Sébastien Dieu <jean-sebastien.dieu@cfm.fr>
#
# SPDX-License-Identifier: MIT
from flask import request
from flask_restx import Resource
from sqlalchemy import func
from http import HTTPStatus
from monitor_server import SERVER
from monitor_server.api.model import (pipelines_ns as n... |
#!/usr/bin/env python3
###############################################################################
# Program: EPI-ClusT.py
# Type: Python Script
# Version: 1.0
# Author: Steven J. Clipman
# Description: Empiral Phylogeny Informed Cluster Tool for identifying
# distance thresholds and defining clusters... |
# -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
Class definition and utilities for the activity classification toolkit.
"""
from... |
import pandas as pd
from experiments.arcbench_data_preparation.reworked_one_hot_encoding import get_original_data_fold_abs_file_name, \
TrainTestEnum
from mdrsl.data_handling.nan_data_filtering import remove_instances_with_nans_in_column
from mdrsl.data_handling.reorder_dataset_columns import reorder_columns
def... |
from .notdev import *
# Some possible hosts
ALLOWED_HOSTS = [
'open-foia-test.app.cloud.gov',
'open.foia.gov',
'foia-a.cf.18f.us',
'foia-b.cf.18f.us',
'openfoia-staging.cf.18f.us',
'foia.app.cloud.gov',
]
# Force an HTTPS connection.
# When testing production mode locally, this may require usi... |
# 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
# d... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, VHRS and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestTensileYieldElongationTesting(unittest.TestCase):
pass |
import re
from .common import regex_labels, re_number, re_string
keywords = ['TODO']
re_keyword = re.compile(r'\b({})\b'.format('|'.join(keywords)))
def init(document):
document.OnGenerateLabeling.add(main)
def main(document):
regex_list = [(re_keyword, 'keyword'), (re_number, 'number'), (re_string, 'stri... |
# salimt
# Import libraries
# Import libraries
import numpy as np
from scipy import optimize
# First we define the functions, YOU SHOULD IMPLEMENT THESE
def f (x, y) :
return - np.exp(x - y**2 + x*y)
def g (x, y) :
return np.cosh(y) + x - 2
def dfdx (x, y) :
return (1 + y) * f (x, y)
def dfdy (x, y) :
retur... |
import io
import time
import unittest
from datetime import datetime, timezone
from enum import Enum
from typing import Any, Callable
from apify_client._utils import (
_encode_webhook_list_to_base64,
_is_content_type_json,
_is_content_type_text,
_is_content_type_xml,
_is_file_or_bytes,
_maybe_ex... |
'''
UniFam.py
pipeline
Created by JJ Chai on 02/24/2014
Last modified Mon Apr 20 16:58:56 EDT 2015
Copyright (c) 2014 JJ Chai (ORNL). All rights reserved.
'''
# Import Python modules
import configparser
import argparse
import sys
from datetime import datetime
# Import local modules
import UniFam_lib # in this direc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import (
find_packages,
setup,
)
extras_require = {
'tester': [
"eth-tester[py-evm]==0.1.0-beta.32",
"py-geth>=2.0.1,<3.0.0",
],
'testrpc': ["eth-testrpc>=1.3.3,<2.0.0"],
'linter': [
"flake8==3.4.1",
"... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys
from collections import defaultdict
import json
import ssg.build_yaml
import ssg.oval
import ssg.build_remediations
import ssg.products
import ssg.rules
import ssg.yaml
SSG_ROOT = os.path.abspath(os.path.join(os.path.... |
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All rights reserved.
#
# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg.
#
#
# 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... |
import click
@click.command()
@click.argument('openapi_file', envvar='OPENAPI_FILE', type=click.File('rb'))
def main(openapi_file):
"""Simple program to generate DTO Python Classes based on OpenAPI v3 Schema"""
pass
if __name__ == "__main__":
main() |
import os
import numpy as np
from scipy import integrate
def LorentzTerm(w,w0,gamma,s):
'''
A single term in a Lorentz Oscillator sum.
Parameters
----------
w: array-like, frequency at which to evaluate the response (rad/s)
w0: scalar, resonance frequency (rad/s)
gamma: scalar, width of the resonance (rad... |
from django.core.mail import send_mail
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, \
BaseUserManager
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
def _create_user(self, ... |
# coding=utf-8
# 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,... |
__copyright__ = """
Copyright (C) 2020 George N Wong
Copyright (C) 2020 Zachary J Weiner
"""
__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 withou... |
# Generated by Django 2.2.9 on 2020-02-07 07:32
from django.db import migrations
def flatten_model_metadata(model_with_metadata):
updated_fields = []
public_meta = model_with_metadata.metadata
private_meta = model_with_metadata.private_metadata
if public_meta:
model_with_metadata.metadata = f... |
# https://en.wikipedia.org/wiki/Observer_pattern
class Observable:
def __init__(self):
self.__observers = []
def register_observer(self, observer):
self.__observers.append(observer)
def notify_observers(self, *args, **kwargs):
for observer in self.__observers:
observe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-25 14:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('test_app', '0001_create_table'),
]
operations = [
migrations.RenameModel(
... |
# flake8: noqa
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
class CarControllerParams:
STEER_MAX = 261 # 262 faults
STEER_DELTA_UP = 3 # 3 is stock. 100 is fine. 200 is too much it seems
STEER_DELTA_DOWN = 3 # no faults on the way down it seems
STEER_ERROR_... |
# 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
#
# Unless required by applica... |
import json
from flask import make_response
from flask_restful import Resource
class ErrorCode(object):
OK = (0, "OK")
class BaseResource(ErrorCode, Resource):
def build_response(self, err_code, data=None):
params = {
'meta': {
'code': err_code[0],
'mess... |
import os
import subprocess
from AlphaBot import AlphaBot
import RPi.GPIO as GPIO
from io import BytesIO
from time import sleep
from picamera import PiCamera
from PIL import Image
from dna import *
import math
import argparse
Ab = AlphaBot()
Dna = Dna()
Ab.stop()
S1 = 27 # or 22
camera = PiCamera()
camera.resolution ... |
"""configs URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... |
import socket
import os
import time
def do_sleep():
time.sleep(1)
def do_work():
from random import random
iterations = 5_000_000
count = 0
for _ in range(iterations):
x = random()
y = random()
if x*x + y*y <= 1.0:
count = count + 1
pi = 4.0 * count / ite... |
import csv
import tqdm
import requests
import threading
import queue
##########################################################
# curie_match
# Input: drug
# Output: string chembl id or 'NOT FOUND' if not found
#--------------------------------------------------------
# Description: Drug chembl ids are returned using... |
""" openconfig_mpls
This module provides data definitions for configuration of
Multiprotocol Label Switching (MPLS) and associated protocols for
signaling and traffic engineering.
RFC 3031\: Multiprotocol Label Switching Architecture
The MPLS / TE data model consists of several modules and
submodules as shown below... |
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return True if sorted([ord(c) for c in s]) == sorted([ord(c) for c in t]) else False |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# to use for example with ipython -pylab
# run /home/pierre/Python/Production/Energy_budget/all_terms_loop_days_review.py
# run /scratch/augier/Python/Production/Energy_budget/all_terms_loop_days_review.py
# compute some terms of the spectral energy budget.
# The memory is... |
class Ant(object):
last_position = None
tour = []
"""docstring for Ant"""
def __init__(self, name, initial_position):
super(Ant, self).__init__()
self.name = name
self.__position = initial_position
@property
def position(self):
return self.__position
@posi... |
from django.conf import settings
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import resolve_url
from django.urls import get_script_prefix
from django.utils.deprecation import MiddlewareMixin
class AnonymousRedirectMiddleware(MiddlewareMixin):
def process_view(self, request, view... |
from discord.ext import commands
from mods.cog import Cog
class PlaceHolder(Cog):
@commands.group()
@commands.cooldown(2, 3, commands.BucketType.guild)
async def phone(self, ctx):
if ctx.guild and ctx.guild.get_member(336961510276595722):
return
await ctx.send("\N{WARNING SIGN} NotSoPhone is not here!\n" \... |
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Yi Li, Gu Wang
# --------------------------------------------------------
from __future__ import print_function, division
import yaml
import numpy a... |
#!/usr/bin/env python2
import imp
import sys
sys.path.append("/home/odroid/ocupus/python/libs")
import time
import zmq
import json
import traceback
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:%s" % "5550")
try_count = 0
while try_count < 10000:
try:
imp.loa... |
#https://stackoverflow.com/questions/51007632/how-to-monitor-usb-devices-insertion#51011386
from pyudev import Context, Monitor, MonitorObserver
import time
context = Context()
monitor = Monitor.from_netlink(context)
monitor.filter_by(subsystem='usb')
def print_device_event(device):
print('background event {0.acti... |
import torch
from colossalai.tensor import ColoTensor
from numpy import allclose
def test_tensor_indexing():
torch_t = torch.randn(2, 3)
colo_t = ColoTensor.init_from_torch_tensor(torch_t)
assert allclose(torch_t[:, 1], colo_t[:, 1].torch_tensor())
def test_lazy_init_tensor():
lazy_t = ColoTensor(2,... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Jails execution module
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-10-21
# Description: Functions related to FreeBSD jails
# License: ... |
import re
from periodic_table import ELEMENTS, LOW_CHARS, CAP_CHARS, lookupEle
class NoSuchElementError(Exception):
"""
if the string is not actually an element, error will be raised
"""
def __init__(self, ele_str, mat_str):
super().__init__("No element named {} ({}).".format(ele_str, mat_str)... |
from hypothesis import given
from tests.utils import (equivalence,
implication)
from wagyu.ring_manager import RingManager
from . import strategies
@given(strategies.ring_managers)
def test_reflexivity(ring_manager: RingManager) -> None:
assert ring_manager == ring_manager
@given(strat... |
from extractor import ActivityExtractor
from fitparse import FitFile
import uuid
import os
from utils import get_base_path
import json
class FitFileActivityExtractor(ActivityExtractor):
PROVIDER_NAME = 'fitfile'
def __init__(self, file_stream):
self.fitfile = FitFile(file_stream)
self.activit... |
# coding=utf-8
from __future__ import absolute_import
from octoprint.util import RepeatedTimer
from subprocess import Popen, PIPE, STDOUT
import octoprint.plugin
import re
import sys
__author__ = "Rich JOHNSON <nixternal@gmail.com>"
__license__ = 'The Unlicense http://unlicense.org/'
__copyright__ = "Copyright (C) 20... |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... |
import pytest
import graphviz
from graphviz import parameters
VERIFY_FUNCS = [parameters.verify_engine,
parameters.verify_format,
parameters.verify_renderer,
parameters.verify_formatter]
@pytest.mark.parametrize(
'cls', [graphviz.Graph, graphviz.Digraph, graphviz.... |
#!/usr/bin/python
#
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import base64
class EnrolledIdentity:
def __init__(self, name, cert, private_key, ca, hsm):
self.name = name
self.cert = cert
self.private_ke... |
from sympy import cos, expand, Matrix, sin, symbols, tan
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, KanesMethod, inertia, Particle)
def test_one_dof():
# This is for a 1 dof spring-mass-damper case.
# It is described in more deta... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import shutil
import pytest
from shapely import geometry
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
TMP_DIR = os.path.join(TESTS_DIR, "tmp")
TEST_DATA_DIR = os.path.join(TESTS_DIR, "data")
SHP_DIR = os.path.join(TEST_DATA_DIR, "... |
#!/usr/bin/env python2
#author : Jing Guo jing.guo@colorado.edu
#name : Flask.py
#purpose : The friendly GUI for novice users
#date : 2018.02.14
#version : 1.0.1
#version notes (latest): Compatible w/ python2.
from flask import Flask
from flask import render_template
from flask import url_for
from flask import requ... |
#!/usr/bin/env python2
"""Helper script for the feature provided by the IncludeEditLink setting."""
editor = 'Vim'
editorCommands = {
'Emacs':
'gnuclient +%(line)s "%(filename)s"',
'Geany':
'geany -l %(line)s "%(filename)s"',
'Geany (Windows)':
r'start %%ProgramFiles%%\Geany\Geany... |
def findHeight():
# userInput = input('What file do you want to search? ')
userInput = 'v3.2.2GEOMETRYBIGGERCHOIR.GEO'
file = open(userInput,'r',encoding='cp1252')
vertices = []
for line in file:
if line[0] not in '[;CPA ' and line != '\n':
vertices += [list(map(float,line.split()))]
for point in vertices:... |
# 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... |
# coding=utf-8
# Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors and the HuggingFace Inc. team.
#
# 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/... |
# -*- coding: utf-8 -*-
#
# inventory/common/api/renderers.py
#
import importlib
from django.conf import settings
class RendererFactory:
_DEFAULT_RENDERERS = settings.REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES']
VERSIONS = (1.0,)
URI_PREFIX = 'application/vnd.tetrasys.pbpms.'
CLASS_INFIX = 'RendererVe... |
# coding: utf-8
"""
LUSID API
The version of the OpenAPI document: 0.11.2275
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class PeriodType(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
... |
N = int(input())
S = input()
l = 0
r = 0
L = ''
for i in S:
if i == '(':
l += 1
else:
r += 1
if l < r:
L += '('
l += 1
R = ')'*(l-r)
print(L+S+R) |
from rest_framework import serializers
from core.models import Tag, Ingredient, Recipe
class TagSerializer(serializers.ModelSerializer):
"""Serializer for Tag object"""
class Meta:
model = Tag
fields = ('id', 'name')
read_only_fields = ('id',)
class IngredientSerializer(serializers.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================
# File Name: MatchingScoreBench.py
# Author: Xu Zhang, Columbia University
# Creation Date: 01-25-2019
# Last Modified: Mon Apr 15 15:19:28 2019
#
# Description: Matching score benchmark
#
# Copyright (C) 2018 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.