content stringlengths 5 1.05M |
|---|
# Program 02d : Power series solution of second order ODE.
# See Example 8.
from sympy import dsolve, Function, pprint
from sympy.abc import t
x = Function('x')
ODE2 = x(t).diff(t, 2) + t**2*x(t).diff(t) - x(t)
pprint(dsolve(ODE2, hint='2nd_power_series_ordinary', n=6))
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KbdishMaterialInfo(object):
def __init__(self):
self._add_price = None
self._create_user = None
self._ext_info = None
self._material_id = None
self._materi... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 1 16:32:54 2021
@author: caear
"""
import random
import pylab
def getMeanAndStd(X):
mean = sum(X)/float(len(X))
tot = 0.0
for x in X:
tot += (x - mean)**2
std = (tot/len(X))**0.5
return mean, std
def plotMeans(numDice, numRolls, numBins, ... |
#
# Database access functions for the web forum.
#
import time
import psycopg2
# Database connection
def ConnectDB():
try:
DB = psycopg2.connect("dbname=forum")
except:
print "Connectivity Problem."
return DB
# Get posts from database.
def GetAllPosts():
'''Get all the posts from ... |
"""
Class Method / Function decorators
**Copyright**::
+===================================================+
| © 2019 Privex Inc. |
| https://www.privex.io |
+===================================================+
| ... |
"""Update version numbers everywhere based on git tags."""
import os
import re
import json
import fileinput
import contextlib
import subprocess
from packaging import version
from py import path as py_path # pylint: disable=no-name-in-module,no-member
def subpath(*args):
return os.path.realpath(
os.path.... |
#!/usr/bin/env python
# Copyright (c) 2015, Herman Bergwerf. All rights reserved.
# Use of this source code is governed by a MIT-style license
# that can be found in the LICENSE file.
text="Hello, World!"
if ( len(text) > 0 )
print( "Hello, World!" )
|
from scout.parse.omim import (parse_omim_line, parse_genemap2, parse_mim_titles,
parse_mim2gene, get_mim_phenotypes)
GENEMAP_LINES = [
"# Copyright (c) 1966-2016 Johns Hopkins University. Use of this"\
" file adheres to the terms specified at https://omim.org/help/agreement.\n",
... |
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathlib import Path
import yaml
import sqlite3
import subprocess
# user lib
import yaml_utils
import file_search
import db_utils
def parser():
# parser information setup
prog='parse_design'
description = 'Parse verilog/systemverilog source fil... |
import boto3
import json
from datetime import datetime
dynamodb = boto3.client('dynamodb')
def get_counter():
response = dynamodb.get_item(
TableName = 'alert-log',
Key = {
'messageID': {
'S': 'counter'
}
}
)
return int(response['Item']['mes... |
import xlsxwriter
import os
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
import logging
import logging.handlers
from datetime import datetime
# logging
LOG_FILENAME = "scrap_merit_info_acpdc.out"
my_logger = logging.getL... |
from contextlib import contextmanager
import csv
import operator
from sqlalchemy import CHAR
from sqlalchemy import column
from sqlalchemy import exc
from sqlalchemy import exc as sa_exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import INT
from sqlalchemy import Integer
from sqlalch... |
bw = ["GEN","EXO","LEV","NUM","DEU","JOS","JDG","RUT","1SA","2SA","1KI","2KI","1CH","2CH","EZR","NEH","EST","JOB","PSA","PRO","ECC","SOL","ISA","JER","LAM","EZE","DAN","HOS","JOE","AMO","OBA","JON","MIC","NAH","HAB","ZEP","HAG","ZEC","MAL","MAT","MAR","LUK","JOH","ACT","ROM","1CO","2CO","GAL","EPH","PHI","COL","1TH","2... |
#!/usr/bin/env python
############################################################################
##
## Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
##
## This file is part of the example classes of the Qt Toolkit.
##
## This file may be used under the terms of the GNU General Public
## License version 2... |
# coding: utf-8
# pip install beautifulsoup4 requests
from bs4 import BeautifulSoup as bs
import re
import utils
base_url = 'https://www.ravpower.jp/product-category/battery'
def crawl(url:str=base_url):
'''
製品の一覧を取得する。
'''
data = utils.fetch(url)
data_list = [data, ]
sou... |
#!/usr/bin/python3
import sys
import os
import signal
import argparse
import json
from datetime import datetime,timedelta
import subprocess
import random
import csv
#import awslib.patterns as aws
class GError(Exception):
'''Module exception'''
pass
KV... |
/anaconda3/lib/python3.6/genericpath.py |
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from etl.views import PersonViewSet
router = routers.DefaultRouter()
router.register(r'persons', PersonViewSet)
urlpatterns = [
path('admin/', admin.site.urls),
path('', include(router.urls)),
path('... |
# Configuration file where you can set the parameter default values and
# descriptions.
DEFAULT_COMP = 3
DEFAULT_MSC = 0
DEFAULT_MFC = 0
DEFAULT_MAXITER = 25
DEFAULT_FMETA = None
DEFAULT_COND = None
DESC_INIT = ("The number of initialization vectors. Larger values will"
"give more accurate factorization b... |
#!/usr/bin/env python
from server.brain import JenniferBrain
from ioclients.terminal import JenniferTerminalClient
from ioclients.terminal_with_sound import JenniferTerminalWithSoundClient
brain = JenniferBrain(allow_network_plugins=True)
client = JenniferTerminalWithSoundClient(brain)
client.run()
"""
$: dollar
... |
import functools
from sqlagg.columns import *
from sqlagg.base import AliasColumn
from sqlagg.filters import *
from corehq.apps.fixtures.models import FixtureDataItem, FixtureDataType
from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader, DataTablesColumnGroup, DTSortType
from corehq.apps.report... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.decorators.cache import cache_page
from contactmps import views
from django.views.decorators.csrf import csrf_exempt
# Used to cache expensive API calls, since it's fine to show same results fo... |
import os
import pandas as pd
import csv
import numpy as np
from sklearn.metrics import accuracy_score
stage_csv = os.path.join("dataset_sleep", "0519", "mi_stage.csv")
predict_stage_csv = os.path.join("dataset_sleep", "0519", "predict.csv")
vitial_sig = pd.read_csv(stage_csv)
predict_vitial_sig = pd.read_csv(predict_s... |
from django.contrib import admin
from .models import File
admin.site.register(File)
|
import matplotlib.image as im
import numpy as np
import cv2
import glob
import pickle
def getCalibrationMatrix (imgs_path,nx,ny):
#Create listst to hold the corner points for images and real coordinates
objpoints = []
imgpoints = []
#Construct the real life 3D points meshgrid for x,y and z = 0 for ... |
from .rna_em import EMTrainer
__all__ = [
'EMTrainer',
]
|
import pylast
import time
from platypush.message.response import Response
from .. import Plugin
class LastfmPlugin(Plugin):
def __init__(self, api_key, api_secret, username, password):
self.api_key = api_key
self.api_secret = api_secret
self.username = username
self.password = pas... |
import random
from .competition_errors import FakeError
class FakeDebugger(object):
def __init__(self, proxy, mult=0.1):
self.proxy = proxy
if isinstance(mult, basestring):
mult = float(mult)
self.mult = mult
def get_times(self):
if self.mult > 1.0:
r... |
#!/usr/bin/env python3
#
# Copyright (c) 2022 Samuel J. McKelvie
#
# MIT License - See LICENSE file accompanying this package.
#
"""Tools to assist with installation/provisioning of the dev environment"""
from .os_packages import (PackageList, create_os_group, get_dpkg_arch, get_os_package_version,
... |
import sys
import json
import boto3
sys.path.insert(0, "../src")
import bioims
trainClient = bioims.client('train')
embeddingName='bbbc021'
filterBucket=''
filterKey=''
executeProcessPlate='true'
useSpot='false'
r = trainClient.train(embeddingName, filterBucket, filterKey, executeProcessPlate, useSpot)
print(r)
|
"""
coding:utf-8
file: log.py
@author: virgil
@contact: XXXX@163.com
@time: 2020-01-03 20:59
@desc:
"""
import logging
import os
from Commons.Path import log_path
class Log:
@classmethod
def logs(cls, log_name=None, file_name=None):
if log_name is None:
log_name = 'virgil'... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class CouponsConfig(AppConfig):
name = 'apps.coupons'
verbose_name = _('Coupon')
verbose_name_plural = _('Coupons')
|
import os
from typing import Optional
from fastapi import APIRouter, HTTPException, Body
from fastapi.responses import HTMLResponse
from wechatpy import parse_message, create_reply
from wechatpy.utils import check_signature
from wechatpy.crypto import WeChatCrypto
from wechatpy.exceptions import (
InvalidSignatur... |
# V0
# IDEA : DFS
class Solution:
def findSecondMinimumValue(self, root):
result=[]
self.dfs(root, result)
result_=sorted(set(result))
return result_[1] if len(result_) > 1 else -1
def dfs(self,root, result):
if not root:
return
self.dfs(root.left,... |
#%%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from src.visualization_description.descriptive_tool import DescribeData
from src.models.data_modules import CheXpertDataModule
fig_path_report = '../Thesis-report/00_figures/cheXpert/'
save_figs = False
disease = 'Cardiomegaly'
def get_descr... |
from typing import Optional
from pydantic import BaseModel
class ItemBase(BaseModel):
title: str
description: Optional[str] = None
class ItemCreate(ItemBase):
pass
class Item(ItemBase):
id: int
customer_id: int
class Config:
orm_mode = True |
"""
This file is part of the rgf_grape python package.
Copyright (C) 2017-2018 S. Boutin
For details of the rgf_grape algorithm and applications see:
S. Boutin, J. Camirand Lemyre, and I. Garate, Majorana bound state engineering
via efficient real-space parameter optimization, ArXiv 1804.03170 (2018).
"""
import nump... |
# import modules
from pathlib import Path
# ask user where to store todo file
path = open("PATH")
pathIs = path.readlines()
path.close()
path = str(pathIs[0].strip())
fileOpen = Path(path)
# mainloop
while True:
# options of what to do
choices = "1 to add item, 2 to view list, 3 to finish a todo, 4 to delete a ... |
#!/usr/bin/env python3
import sys
import overrides
from utils import memoize
@memoize
def get():
timers_val = overrides.get('CHPL_TIMERS', 'generic')
return timers_val
def _main():
timers_val = get()
sys.stdout.write("{0}\n".format(timers_val))
if __name__ == '__main__':
_main()
|
# 「プロパティ」エリア → 「モディファイア」タブ
import os, re, sys, bpy, time, bmesh, mathutils, math
from . import common
# メニュー等に項目追加
def menu_func(self, context):
ob = context.active_object
if ob:
if ob.type == 'MESH':
me = ob.data
if len(ob.modifiers):
self.layout.operator('object.forced_modifier_apply', icon_value=commo... |
"""Test gen_iset."""
import joblib
from tinybee.gen_iset import gen_iset
def test_gen_iset():
"""Test gen_iset."""
cmat = joblib.load("data/cmat.lzma")
res = gen_iset(cmat, verbose=False)
# logger.debug("res: %s, %s", res, res[68])
# logger.info("res: %s, %s", res, res[68])
# logger.debug("r... |
from django.conf.urls import patterns, url
from proyectos import views
urlpatterns = patterns('',
# /proyectos/
url(r'^$', views.index, name='index'),
# /proyectos/5/
url(r'^(?P<id_proyecto>\d+)/$', views.proyecto, name='proyecto'),
# /proyectos/nuevo_proyecto
url(r'^nuevo_proyecto/$', views.nu... |
'''
Purpose:
# Run sumo for parameter input values to determine sensitivity of parameter to desired outputs
# Create dictionary of lists for input and output values
# Save plots of input Parameter changes and output parameter results
Author: Matthew James Carroll
'''
import xml.etree.ElementTree as ET
from SumoConnect ... |
# encoding: utf-8
from ctypes import *
class PyDystopia(object):
"""Tokyo Dystopia Python Interface"""
def __init__(self, dbname='khufu'):
self.dbname = dbname
try:
self.lib=CDLL('libtokyodystopia.so')
except:
self.lib=CDLL('libtokyodystopia.dylib')
self.... |
# Generated by Django 3.2.13 on 2022-05-25 07:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('probes', '0012_auto_20220329_0643'),
]
operations = [
migrations.RemoveField(
model_name='feed',
name='url',
),
... |
"""Complete a campaign in Gophish and/or output a Gophish campaign summary.
Usage:
gophish-complete [--campaign=NAME] [--summary-only] [--log-level=LEVEL] SERVER API_KEY
gophish-complete (-h | --help)
gophish-complete --version
Options:
API_KEY Gophish API key.
SERVER Fu... |
from unicorn.x86_const import *
hooks = None
hooks = set(vars().keys())
def GetWindowsDirectoryA(ut):
emu = ut.emu
retaddr = ut.popstack()
lpBuffer = ut.popstack()
uSize = ut.popstack()
windir = "C:\\Windows"
print 'GetWindowsDirectoryA = "{0}"'.format(windir)
emu.mem_write(lpBuffer, wind... |
'''
A simple tutorial program to FM demodulate an APRS IQ.wav file
NOTE: All documentation is at directdemod.readthedocs.io
A simple FM demodulator would be a good start for us.
Record a sample IQ.wav file from your RTLSDR or use the one provided in the samples flder.
'''
# Firstly we will have to import whatever li... |
#
# Copyright 2016 Sotera Defense Solutions 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 ag... |
import os
def list_to_scalar(input_list):
"""
This is a helper function, that turns a list into a scalar if its length is 1.
"""
if len(input_list) == 1:
return input_list[0]
else:
return input_list
class Folder:
def __init__(self, path):
self.abs_path = os.path.abspa... |
import struct
class Slot:
def __init__(self):
self.num = 0
self.ref = None
class LocalVars(list):
def SetInt(self, index:int, val: int):
self[index].num = val
def GetInt(self, index:int) -> int:
return self[index].num
def SetFloat(self, index:int, val:float):
b... |
"""print('-=-'*10)
res = False
p = int(input('Informe o 1° termo da PA: '))
r = int(input('Razão da PA: '))
decimo = p + (10-1) * r
per = 'N'
mais = 0
cont = 0
while p != (decimo+r):
print(p, end=' -> ')
p += r
cont += +1
while not res:
per = str(input('Quer continuar [S/N]? ')).upper().strip()
if p... |
"""Filename globbing utility with optional case sensitive override."""
try: # Python 2
from glob import _unicode
except: # Python 3
_unicode=str
unicode=str
from fnmatch import translate
import os,posixpath,ntpath
import sys
import re
__all__ = ["glob", "iglob"]
def path_split(p):
""" Well... it turns ou... |
""" This is the start routine for Apache """
from .run_flask import run, log
if __name__ == '__main__':
log.debug("Starting Flask Service from Apache")
run()
|
import time
from multiprocessing import Value
from chillow.service.ai.artificial_intelligence import ArtificialIntelligence
from chillow.model.action import Action
from chillow.model.game import Game
class RandomAI(ArtificialIntelligence):
"""AI that randomly chooses an action ignoring the state of the game.
... |
import unittest
import comandante as cli
import comandante.errors as error
from comandante.inner.test import suppress_output, capture_output
class SubCommand(cli.Handler):
@cli.command()
def command(self, **specified_options):
return specified_options
class App(cli.Handler):
def __init__(self):... |
import json
from functools import partial
from pathlib import Path
from typing import Any, Dict, List, Optional, Set, cast
import yaml
from marshmallow import Schema
from lisa import schema
from lisa.util import LisaException, constants
from lisa.util.logger import get_logger
from lisa.util.module import import_modul... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
from flask import Blueprint, make_response, render_template, request, session, abort, send_from_directory
from jinja2.exceptions import TemplateNotFound
from .service_page import render_template_wo_statistics
# Инициализируем модуль Game
game_bp = Blueprint('Game', __name__, template_folder='../games', static_fol... |
# -*- coding: utf-8 -*-
"""Test the module can be imported."""
#import unittest
from runOTcli import main
from opentargets import OpenTargetsClient
from click.testing import CliRunner
def test_doMainCheckT():
"""Test that 'runOTcli' can be executed & passed."""
runner = CliRunner()
result = runner.invok... |
import faulthandler
import logging
import os
import pathlib
import sys
import determined as det
from determined import _generic, horovod, layers, load
from determined.common import experimental
from determined.common.api import certs
def config_logging(debug: bool) -> None:
log_level = logging.DEBUG if debug els... |
import unittest
from smac.optimizer.random_configuration_chooser import ChooserNoCoolDown, \
ChooserLinearCoolDown
class TestRandomConfigurationChooser(unittest.TestCase):
def test_no_cool_down(self):
c = ChooserNoCoolDown(modulus=3.0)
self.assertFalse(c.check(1))
self.assertFalse(c.... |
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def index():
"""
获取head请求头
Keys: {
Host:
Connection:
Cache-Control:
Requests:
User-Agent:
Accept:
Cookie:
... |
import json
from django.contrib import messages
from django.contrib.admin import site
from django.contrib.auth import logout
from django.http import JsonResponse
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.views import View
from server.announcement.interface... |
import re
import json
from csv import writer
from parsel import Selector
import os.path
import fnmatch
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Update file storage with new jsons"
def __init__(self, *args, **kwargs):
su... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n , m ) :
return ( m * n * ( n + 1 ) * ( m + 1 ) ) // 4
#TOFILL
if __name__ == '__main__':
param = [
... |
"""Fuzzy Wuzzy Token Sort Similarity Measure"""
from __future__ import division
from difflib import SequenceMatcher
from py_stringmatching import utils
from py_stringmatching.similarity_measure.sequence_similarity_measure import \
SequenceSimilarityMeasure
from py_... |
# Question model
class Question(object):
# Empty List to hold the questions asked
questions_list = []
# constructor
def __init__(self, title, description, owner):
self.title = title
self.description = description
self.owner = owner
# class method to save a question
def s... |
"""This module extends the C++ 2003 iterator header with common extensions."""
import fbuild.config.cxx as cxx
import fbuild.config.cxx.cxx03 as cxx03
# ------------------------------------------------------------------------------
class iterator(cxx03.iterator):
bidirectional_iterator = cxx.template_test(test_t... |
"""Copyright (c) 2021 Alistair Child
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, merge, publish, distribute, ... |
from __future__ import absolute_import
import contextlib
import errno
import io
import locale
# we have a submodule named 'logging' which would shadow this if we used the
# regular name:
import logging as std_logging
import os
import posixpath
import re
import shutil
import stat
import subprocess
import sys
import tar... |
from argparse import Action, ArgumentError, ArgumentTypeError
from importlib import import_module
import os
import re
import shlex
import sys
from snakeoil.cli import arghparse, tool
from . import const
from .alias import Aliases
from .base import get_service_cls
from .config import Config
from .exceptions import Bit... |
n=int(input('enter value of n:'))
for i in range(n):
print(((n-i-1)*" " + "* "*(i+1))) |
class HashTable(object):
"""implements a simple HastTable"""
def __init__(self, size=1024):
self._list_size = size
self._bucket_list = [[] for bucket in xrange(0, size)]
def hash(self, key):
if not isinstance(key, basestring):
raise TypeError("key must take a string")
... |
# Copyright (C) 2015-2017 XLAB, Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
#compdef imageMounter.py
local arguments
arguments=(
'--version[show programs version number and exit]'
'(- * :)'{-h,--help}'[show this help message and exit]'
{-s,--single}'[single partition in image]'
{-i,--info}'[just Display the information]'
{-e,--e01}'[use ewfmount to mount E0 Evidence Files]'
{-b,-... |
import sys
from cx_Freeze import setup, Executable
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name="XcalxS",
version="0.1.0",
description="RPN Calculator",
options={
"... |
import requests
import time
from hexbytes import HexBytes
from typing import List, NamedTuple, Set, Tuple, Union, Dict
def trace_transaction(tx_hash: str, disable_memory=True,
disable_storage=True, disable_stack=True):
return {"id": 1,
"method": "debug_traceTransaction",
... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
k=4 #number of clusters
n_samples=1500
random_state=17
X,y=make_blobs(n_samples=n_samples,centers=k,n_features=2,random_state=random_state)
color='black'
size=1
plt.... |
# Original Code
# https://github.com/huggingface/transformers/blob/master/src/transformers/configuration_utils.py
# See https://github.com/graykode/matorage/blob/0.1.0/NOTICE
# modified by TaeHwan Jung(@graykode)
# Copyright 2020-present Tae Hwan Jung
#
# Licensed under the Apache License, Version 2.0 (the "License");... |
import shutil
from pathlib import Path
from metaerg.data_model import Genome, SeqRecord, SeqFeature, FeatureType
from metaerg import context
from metaerg import bioparsers
def _run_programs(genome:Genome, result_files):
fasta_file = context.spawn_file('masked', genome.id)
bioparsers.write_genome_to_fasta_fil... |
from aiogram.dispatcher.filters.state import StatesGroup, State
class TodoStates(StatesGroup):
"""
For todo_handl
"""
todo = State()
reception_todo = State()
class PasswordStates(StatesGroup):
"""
For storing_passwords_handl
"""
check_personal_code = State()
successful_auth_for_pass = State()
set_name_pa... |
from agu_api import AguApi
import string
import math
import json
# Export path
# out_path = 'database/'
out_path = '../../app/private/'
# Export only if flag is true
exp_abstracts = True
exp_programs = True
exp_sessions = True
years = [2017] # [2014, 2015, 2016]
# these programs do not contain abstracts
# exclude_p... |
import pytest
from gtt import db
from gtt.models import Technique
from gtt.fixtures import database
@pytest.mark.usefixtures("database")
def test_create_read():
"""Create a technique in the database and read it back
"""
write_technique = Technique()
write_technique.name = "Hammer On"
w... |
#
# PySNMP MIB module Chromatis-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Chromatis-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:34:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
from rest_framework.generics import ListAPIView, RetrieveAPIView, RetrieveUpdateDestroyAPIView, ListCreateAPIView
from rest_framework.filters import SearchFilter, OrderingFilter
from book.api.pagination import BookPagination
from book.api.serializers import BookSerializer, BookCreateSerializer, BookUpdateDeleteSeriali... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 21 15:36:45 2019
@author: Guilherme
"""
import numpy as np
def fact(n):
x = 1
i = 2
while i <= n:
x =x*i
i= i+1
return(x)
|
# Add reference to Part_03 (assuming the code is executed from Part_04 folder)
import sys
sys.path.insert(1, '../Part_03/')
from inference import Inference as model
from image_helper import ImageHelper as imgHelper
from camera import Camera as camera
if __name__ == "__main__":
# Load and prepare model
model... |
import serial
import plotly.plotly as py
import plotly.graph_objs as go
port = serial.Serial('/dev/cu.usbserial-DN04AX6V') # open the serial port (MAC/Linux)
chars = []
vals = []
while 1:
c = port.read()
if c==b'\n':
val = ''.join(chars).strip()
chars = []
vals.append(float(val))
... |
"""
Defines arguments manipulation utilities, like checking if an argument is iterable, flattening a nested arguments list, etc.
These utility functions can be used by other util modules and are imported in util's main namespace for use by other pymel modules
"""
import sys
import operator
import itertools
from colle... |
import datetime
import os
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
from utils.combine import merge_by_subject
from visualize.all_tasks import save_plot
import numpy as np
def add_fps_subject_level(data_subject, data_trial):
grouped = data_trial \
.groupby(['run_id'], as... |
#!/usr/bin/env python
# Author: Dogacan S. Ozturk
# Import default Python libraries.
import os
import sys
from glob import glob
import tables
import numpy as np
import datetime as dt
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.dates as mdat... |
from __future__ import division
from vectors import vec3, cross
from math import cos, sin, pi
from itertools import chain
def memodict(f):
""" Memoization decorator for a function taking a single argument """
class memodict(dict):
def __missing__(self, key):
ret = self[key] = f(key)
... |
# Generated by Django 2.1.15 on 2021-01-10 00:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='student',
name='student_class',
... |
import pandas as pd
def getHouseTransactions():
'''
Grabs a list of stock transactions made by various members of the
United States House of Representatives.
Data has been croud sourced from the House Stock Watcher website.
Link: https://housestockwatcher.com/
'''
URL = 'https://hou... |
from six.moves import urllib
from mlflow.store.file_store import FileStore
from mlflow.store.local_artifact_repo import LocalArtifactRepository
class PluginFileStore(FileStore):
"""FileStore provided through entrypoints system"""
def __init__(self, store_uri=None, artifact_uri=None):
path = urllib.p... |
import logging
import os
from pathlib import Path
from typing import List, Dict
import yaml
from piper.config.pipe import Pipe
PIPE_FILE = "pipe.yml"
logger = logging.getLogger(__name__)
def _read_pipe(location: str) -> Pipe:
# Read the pipe file
path = os.path.join(location, PIPE_FILE)
... |
# -*- coding: utf-8 -*-
from sceptre.helpers import get_external_stack_name
class TestHelpers(object):
def test_get_external_stack_name(self):
result = get_external_stack_name("prj", "dev/ew1/jump-host")
assert result == "prj-dev-ew1-jump-host"
|
from django.contrib import admin
from planificacionfamiliarapp.models import PacienteInscripcion, PacienteSubSecuentePF
#filtros para admin
class PlanificacionFamiliarAdmin(admin.ModelAdmin):
list_display = ('paciente','fechaIngreso')
class PacienteSubSecuentePFAdmin(admin.ModelAdmin):
list_display = ('pacie... |
from django.db import models
from server.constants import CampusType, TransferType, UserType, ApplicationsStatus, ThesisLocaleType
class ActiveUserProfile(models.Model): #model used for filling the database with inital values
"""
Profile model for each User in the app.
Keep fields nullable to create... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.