content stringlengths 5 1.05M |
|---|
import os
import unittest
import tempfile
import struct
from pyoram.storage.block_storage import \
BlockStorageTypeFactory
from pyoram.encrypted_storage.encrypted_block_storage import \
EncryptedBlockStorage
from pyoram.crypto.aes import AES
from six.moves import xrange
thisdir = os.path.dirname(os.path.absp... |
import inspect
import os
import re
import types
import pymel.internal.apicache as apicache
import pymel.internal.parsers as parsers
import pymel.internal.startup
import pymel.util.arguments as arguments
import pymel.versions as versions
from pprint import pprint
from pymel.util.enum import Enum
from py... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 Nathan Juraj Michlo
#
# 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 Softwar... |
import logging
from autobahn.twisted.websocket import WebSocketClientFactory
from twisted.internet.protocol import ReconnectingClientFactory
from coinlendingbot.websocket.WsConfig import WsConfig
class ExchangeWsClientFactory(ReconnectingClientFactory, WebSocketClientFactory):
def __init__(self, exchange, data_p... |
#!/usr/bin/python
class Token( ):
def __init__( self, state, score=0.0, heur=0.0, parent=None, label=None ):
self.score = float(score) #actual score
self.heur = float(heur) #heuristic score in Dijkstra: score==heur
self.state = state
self.label = label
self.parent = pa... |
"""
LaunchQTAppCommand.py
=====================
Python module for launching and restarting a QT App
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2021 by Patrick Rainsberry.
:license: MIT, see LICENSE for more details.
"""
import adsk.core
from ..apper import apper
# This command is only activ... |
"""
(c) 2020 Daniel Companeetz
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, sub... |
# Stream are lazy linked list
# A stream is a linked list, but the rest of the list is computed on demand
'''
Link- First element is anything
- second element is a Link instance or Link.empty
Stream -First element can be anything
- Second element is a zero-argument function that returns a Stream or Strea... |
# Copyright (c) 2016 OpenStack Foundation
#
# 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 i... |
def normalize_str(x):
if x is None:
return x
return " ".join(x.replace("\n", " ").split()).lower()
|
"""Implementation of the Noun Absurdity property."""
from collections import defaultdict
from functools import partial
import numpy as np
import os
import re
import sys
from scipy.spatial import distance
from pyhumour._utilities.pos_tag_bigram_frequency_matrix import POSTagBigramFrequencyMatrix
class NounAbsurdity:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Carter Yagemann
#
# 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 ri... |
# from torch.utils import data
import torch
from torchvision import datasets
import torchvision.transforms as transforms
import config
def tr_dataset(batch_size):
# Transformation
transform_data = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Nor... |
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2019 New Vector 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 16 10:51:06 2020
@author: AzureDVBB
Test functions for dynamic lookups.
"""
def test1(a):
return str(a)
def test2():
return "OK test2" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. $Id: punctuation.py 85352 2016-03-26 19:08:54Z carlos.sanchez $
"""
from __future__ import print_function, unicode_literals, absolute_import, division
__docformat__ = "restructuredtext en"
logger = __import__('logging').getLogger(__name__)
import re
from zope imp... |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# Required dependencies
required = [
'joblib',
'numpy',
'tqdm',
'humanhash3',
'python-dateutil',
'dill'
]
setup(
name="smallab",
version="1.8... |
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['FrozenBatchNorm2d', 'FilterResponseNorm1d',
'FilterResponseNorm2d', 'FilterResponseNorm3d']
class FrozenBatchNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-5):
super(FrozenBatchNorm2d, self).__init__()... |
# Copyright (c) 2013 OpenStack Foundation.
# 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... |
import os
import sys
import errno
import pprint
def safe_print(p_str):
try:
print(p_str)
except IOError, e:
if e.errno == errno.EPIPE:
sys.exit(0)
else:
raise
def safe_pprint(p_str):
try:
pprint.pprint(p_str)
except IOError, e:
if e.err... |
import torch
from PIL import Image
from torch.utils.data import Dataset, DataLoader,random_split
import torchvision
from torchvision import datasets, models, transforms
import numpy as np
import matplotlib.pyplot as plt
import time
import os
import PIL
import pickle
device = torch.device("cuda" if torch.... |
# Range: Sequence representing an arithmetic progression of intgers
# By default it initialized from0
a = range(3)
print(a)
for i in a:
print(a)
# Iterating over a range
for i in range(5):
print(i)
"""
Range signature
1. One argument: means argument stop value
range(stop)
2. Two arguments: means argum... |
from __future__ import print_function, absolute_import
import numpy as np
import vtk
from .vtk_camera_manipulator import vtkCameraManipulator
np_array = np.array
np_cross = np.cross
class vtkPVTrackballPan(vtkCameraManipulator):
def __init__(self):
vtkCameraManipulator.__init__(self)
def OnMouseMo... |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/ContactPoint
Release: R5
Version: 4.5.0
Build ID: 0d95498
Last updated: 2021-04-03T00:34:11.075+00:00
"""
from pydantic import Field
from . import fhirtypes
from . import datatype
class ContactPoint(datatype.DataType):
"""Disclaimer: A... |
# -*- coding: utf-8 -*-
"""
@project: Sorting-Algorithms
@version: v1.0.0
@file: main.py
@brief: main file
@software: PyCharm
@author: Kai Sun
@email: autosunkai@gmail.com
@date: 2021/8/1 21:08
@updated: 2021/8/1 21:08
"""
from bubble_sort import *
from selection_sort import *
from ... |
from django.conf.urls import url
from django.urls import include, path
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
path(r'', include('apps.web.urls', namespace='web')),
path(r'', include('apps.products.urls', namespace='products')),
path(r'', include('apps.users.u... |
"""
Script to update AWS IAM user information
"""
import boto3
client = boto3.client('iam') |
"""
TRAN - a wrapper for traxy/tranback to transform a position (x,y) in pixels
on an input, distorted image to/from an output image.
There are two methods: tran.f for forward transforms and tran.b for
the reverse.
The syntax is:
tran.f(original_image,drizzled_image,x,y)
--or--
tran.f(original_image,driz... |
import unittest
from unittest.mock import patch
import pygatt
from paulmann.paulmann import Paulmann
from paulmann.models import State, Info
from .mocks import MockAdapter, MockDevice
MAC = "AA:AA:AA:AA:AA:AA"
PWD = "1234"
class PaulmannTestCase(unittest.TestCase):
_light: Paulmann = None
def setUpReal(self)... |
# -*- coding: utf-8 -*-
"""
This overrides the Rubric with the class loaded from the
PUBLICATION_BACKBONE_FACET_MODEL setting if it exists.
"""
from django.conf import settings
from publication_backbone.utils.loader import load_class
#==============================================================================
# E... |
"""
/flash/main.py
Initial setup and configuration
Should be called if there is no SD card inserted
Assumes variables are set in conf.py
Author: Howard Webb
Data: 11/13/2020
"""
import conf
from utime import sleep, ticks_ms, ticks_diff, localtime
import Environ
from pyb import RTC, LED
import Wifi
led_G = LED(2)
le... |
from .models import Player, Room
def get_player_from_request(request):
"""
Get a player from a request.
:param request: the request
:return: a Player object if the request has a player, False otherwise
"""
player_id = request.COOKIES.get(Player.PLAYER_COOKIE_NAME, None)
return get_player_... |
PART_NAMES = [
"nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder",
"rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist",
"leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle"
]
NUM_KEYPOINTS = len(PART_NAMES)
PART_IDS = {pn: pid for pid, pn in enumer... |
import os
os.system('pandoc post.md -s --highlight-style pygments -o ex.html')
#os.system('pandoc -t beamer pres.md -o ex.pdf')
os.system('pandoc post.md -s --highlight-style pygments -o ex.pdf')
|
"""
Title: utils.py
Purpose: Contains utility functions for yt answer tests
Notes:
"""
import functools
import hashlib
import inspect
import os
import numpy as np
import pytest
import yaml
from yt.config import ytcfg
from yt.convenience import load, simulation
from yt.data_objects.selection_data_containers import Y... |
# Url of sso cas server
CAS_SERVER = "https://websso.example.com"
# This is probably fine
CAS_LOGOUT_URL = "/cas/logout"
# The name of your cookie
CAS_COOKIE = "CAS"
# The top level that the cookie should be stored
COOKIE_PATH = '/'
# Duration of cookie before revalidating to cas server
TIMEOUT = 600
# Your cookie... |
import numpy as np
from numpy.testing import assert_allclose
import pytest
from ..kernels import KERNELS
kernel_types = sorted(KERNELS.keys())
@pytest.mark.parametrize('kernel', kernel_types)
@pytest.mark.parametrize('sigma', [2, 3])
@pytest.mark.parametrize('n', [1000, 2000])
@pytest.mark.parametrize('m', [50, 100... |
from decimal import Decimal
from deepdiff import DeepDiff
class TestDiffMath:
def test_math_diff(self):
"""Testing for the correct setting and usage of epsilon."""
d1 = {"a": Decimal("3.5")}
d2 = {"a": Decimal("4")}
ep = 0.5
res = DeepDiff(d1, d2, math_epsilon=ep)
a... |
from leapp.exceptions import StopActorExecutionError
from leapp.libraries.common.rpms import has_package
from leapp.libraries.stdlib import api
from leapp.models import InstalledRedHatSignedRPM
# The main SSHD configuration file
SSHD_CONFIG = '/etc/ssh/sshd_config'
# The include directive needed, taken from RHEL9 ssh... |
# 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 ... |
import numpy as np
import pandas as pd
import time
import networkx as nx
start = time.time()
def average_cost(data_price, data_dist):
"""
Calcul de la matrice du prix moyen au kilomètre.
.. warning:: Attention, les données de distances et de prix
doivent être compatibles pour pouvoir avo... |
from os import environ as env
import requests, json, datetime
from telegram import ReplyKeyboardRemove, Update
from telegram.ext import ConversationHandler, CallbackContext
from telegram import KeyboardButton, ReplyKeyboardMarkup
import pymongo
from bot import reply_markups
from libs import utils
from bot.globals im... |
from . import dcgan
from . import dqn
from . import mobilenetv2
|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
class GlobalParams:
PARALLELS = 5
LOG_LEVEL = logging.INFO
class GlobalPaths:
MARO_GRASS_LIB = '~/.maro/lib/grass'
MARO_K8S_LIB = '~/.maro/lib/k8s'
MARO_CLUSTERS = '~/.maro/clusters'
MARO_DATA = '~/.mar... |
from django.http import JsonResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
@login_required
@require_http_methods(['PUT'])
def set(request, target):
"""Sets user's goal.
Arguments:
target: target in ['week', 'month', 'yea... |
import asyncio
import datetime
import logging
import subprocess
import json
from copy import deepcopy
from typing import Optional
from hashlib import sha1
from dateutil.tz import tzutc
from botocore import UNSIGNED
from botocore.config import Config
import botocore.compat
from botocore.credentials import EnvProvider,... |
import asyncio
import json
from base64 import b64decode
from base64 import b64encode
from datetime import datetime
from time import perf_counter
from typing import Awaitable
from typing import Callable
from typing import Coroutine
from typing import Optional
from uuid import uuid4
import websockets
from aiohttp import... |
import unittest
import time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from PageObjectModel.Pages.Buttons import Buttons
from PageObjectModel.Pages.Home import HomePage
class TestButtons(unittest.TestCase):
def setUp(self) -> None:
self.driver = webdriver.Chr... |
# Generated by Django 3.2.5 on 2021-08-04 10:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('artists', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='artist',
old_name='seeking_talent',
... |
import numpy as np
from keras.utils import Sequence
import data_preprocessing
from PIL import Image
class BatchGenerator(Sequence):
'''
generate batch of normalized, randomly transformed images
'''
def __init__(self, data, config):
'''
Args:
data : dictionary (... |
#!/usr/bin/env python
# /* -*- indent-tabs-mode:t; tab-width: 8; c-basic-offset: 8 -*- */
# /*
# Copyright (c) 2014, Daniel M. Lofaro
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redi... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains functions and classes related with MotionBuilder takes
"""
from __future__ import print_function, division, absolute_import
import pyfbsdk
def get_current_anim_take_name():
"""
Returns the name of the current take
:return: str, nam... |
import sms_sdk_renderer_python.lib.sms_sdk_renderer as SmsRenderer
info_data = {
"title": 'Informaiton Title',
"content": 'This is a information message',
"description": 'Information message description'
}
print(SmsRenderer.renderInBot(info_data, SmsRenderer.smsTypes['INFORMATION']))
|
#!/usr/bin/env python
import fileinput
import subprocess
import json
import os
import re
last = {
'artist': False,
'title': False
}
data = {}
def clean(str):
str = str.decode('utf-8')
str = re.sub('[\[].*?[\]]', '', str)
str = re.sub('[\(].*?[\)]', '', str)
str = re.sub('\s+', ' ', str).strip... |
from datetime import timedelta
import pytest
from django.core.management import call_command
from django.utils import timezone
from magiclink.models import MagicLink
@pytest.mark.django_db
def test_magiclink_clear_logins():
# Valid Magic Links
for index in range(2):
MagicLink.objects.create(
... |
"""argon.py"""
# Constant-temperature constant-pressure MD simulation of Argon
from MMTK import *
from MMTK.ForceFields import LennardJonesForceField
from MMTK.Environment import NoseThermostat, AndersenBarostat
from MMTK.Trajectory import Trajectory, TrajectoryOutput, LogOutput
from MMTK.Dynamics import Velo... |
#!/usr/bin/env python3
import os
from jupyterhub_client import JupyterHubClient
import fire
from deploy_util import get_config
def _create_hub_client():
c = get_config()
hub_api_token = c["HUB_CLIENT_API_TOKEN"]
hub_api_url = "http://{}:{}/hub/api".format(
"127.0.0.1",
c["HUB_API_PORT"]
... |
import itertools
import algo_2_count
import d_SVM
import numpy as np
import funcs
import warnings
import pandas as pd
warnings.filterwarnings("ignore")
# 获取原始数据
data_raw = d_SVM.dataDigitize("data/adult_new.csv")
# 将特征fnlwgt离散为5个维度
data_raw['fnlwgt'] = pd.cut(data_raw['fnlwgt'], 5)
# data, labels, names... |
import os
print("Enter Text in \"\"\" <Text> \"\"\" Format")
Text = input()
print("Enter File name (Do not Enter .txt)")
FileName = input()
FileName += ".txt"
os.chdir("G:\\Python DB")
FileLocation = os.path.join(os.path.abspath("."),FileName)
FileOBJ = open(FileLocation , "w")
FileOBJ.write(Text)
FileOBJ.c... |
from podb import DB
from threading import Thread
from multiprocessing import Queue
import unittest
from time import time, sleep
from datetime import datetime
from copy import deepcopy
from tests import TestObject
db = DB("test")
class DBTestMethods(unittest.TestCase):
def test_insert(self):
print("test_i... |
"""Unit test package for platemate."""
|
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from apps.web.models import Competition, CompetitionParticipant, ParticipantStatus
from apps.teams.models import Team, TeamStatus, ... |
# This macro provides an example to extract the joints of a program.
# The joints extracted take into account the rounding effect.
from robodk.robolink import * # API to communicate with RoboDK
import sys
import os
# Set to False to have a more customized output as dictated by this script
FAST_SAVE = False
# Start t... |
"""
You are given a 2d grid of `"1"`s and `"0"`s that represents a "map". The
`"1"`s represent land and the `"0"s` represent water.
You need to write a function that, given a "map" as an argument, counts the
number of islands. Islands are defined as adjacent pieces of land that are
connected horizontally or vertically... |
"""
This module is to define all application level events in one place
to avoid attempting to remember string event names
"""
class EventsMeta(type):
"""Class that defines what events are exposed at the bot level"""
@property
def on_example(self):
"""
This is an example event for the Exa... |
import sys
from typing import Sequence
import numpy as np
from pyroll.core import RollPass, Unit
from ..reporter import Reporter
from .. import utils
@Reporter.hookimpl
def sequence_plot(units: Sequence[Unit]):
"""Plot the filling ratios of all passes"""
fig, ax = utils.create_sequence_plot(units)
ax.se... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print (categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print (numerical_var)
# cod... |
from collections.__init__ import OrderedDict
from typing import List, Optional, Tuple, Union
from .action import ActionArgsPack, ActionExecutor, ArgumentValue
from .path import NodePath
class Command:
"""Represents single command line typed in the shell"""
def __init__(self, command_name):
self.targ... |
from raptiformica.cli import install
from tests.testcase import TestCase
class TestInstall(TestCase):
def setUp(self):
self.parse_install_arguments = self.set_up_patch(
'raptiformica.cli.parse_install_arguments'
)
self.unload_module = self.set_up_patch(
'raptiformic... |
# Copyright (c) 2019 Viosoft 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... |
from flask import Flask, request, jsonify, make_response
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
import jwt
import datetime
from functools import wraps
import os
app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file_... |
from abc import ABC, abstractmethod
from .connections import BaseConnection
class BaseEndpoint(ABC):
"""
This forces all endpoint objects to have a connection method and an
endpoint attribute.
"""
@abstractmethod
def __init__(self, connection, endpoint):
self.connection = connection
... |
#Даны стороны прямоугольника. Найти его периметр и длину диагонали.
import math
a = float(input("Введите а: "))
b = float(input("Введите b: "))
P = 2 * (a + b)
l = math.sqrt(a**2 + b**2)
print("Периметр: ", P,",", "длина диагонали", l) |
# Generated by Django 3.1.7 on 2021-03-14 19:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('tools', '0007_suptech'),... |
# Copyright 2014-2020 The PySCF Developers. 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 appl... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
# Copyright 2014 Diamond Light Source 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 t... |
from Kaspa.modules.abstract_modules.abstractBriefingSubmodule import AbstractBriefingSubmodule
class NewsModuleEn(AbstractBriefingSubmodule):
module_name = "News"
language = "en"
key_regexes = dict()
def __init__(self):
self.key_regexes = {'(?i).*?(?=news)+.': self.action}
def action(s... |
import requests
from lxml import html
import sys
import lxml.etree
import lxml._elementpath
def ratings(handle, result):
str = ""
#valid username url
url = 'https://www.codechef.com/users/' + handle
page = requests.get(url)
tree = html.fromstring(page.content)
data = tree.xpath("//div/section/div/div/div/a... |
import decouple
class EnvConfig:
def __init__(self):
self.aws_access_key_id = decouple.config("AWS_ACCESS_KEY_ID")
self.aws_secret_access_key = decouple.config("AWS_SECRET_ACCESS_KEY")
env_config = EnvConfig()
|
from flask import Flask
from flask_testing import TestCase
class TestFoo(TestCase):
def create_app(self):
return Flask(__name__)
def test_add(self):
self.assertEqual(1 + 2, 3)
|
import shutil
import os
import global_vars as var
print('hi') |
'''
This module is aimed at reading JSON data files, either locally or from a remote
host. The data files are not exactly JSON, they're files in which each line is a
JSON object, thus making up a row of data, and in which each key of the JSON
strings refers to a column.
'''
import os
import gzip
import logging
import p... |
"""
This script creates monoT5 input files by taking corpus,
queries and the retrieval run file for the queries and then
create files for monoT5 input. Each line in the monoT5 input
file follows the format:
f'Query: {query} Document: {document} Relevant:\n')
"""
import collections
from tqdm import tqdm
import argpa... |
from .triplet_sampler import RandomIdentitySampler
|
# Copyright 2017 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are 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/LIC... |
from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, Mapping, NamedTuple, Optional
from requests import Response
from ambra_sdk.exceptions.storage import AmbraResponseException
from ambra_sdk.storage.response import check_response
from ambra_sdk.types import RequestsFileType
if TYPE_CHECKING:
from ... |
from flask import request,Flask,jsonify #pylint: disable=F0401
from flask_cors import CORS
import secrets
import PikuAi as bot
from time import gmtime, strftime
import json
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
CORS(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///dbpiku.sqlite3'
app.... |
from .settings import * # noqa
DEBUG = True
SECRET_KEY = 'dev_secret_key'
SEND_GA_EVENTS = False
SCHEME = 'http://'
HOST = '127.0.0.1'
ALLOWED_HOSTS = [HOST]
PORT = 8000
BRAINTREE_MERCHANT_ID = get_secret('bt_sandbox.merchant_id')
BRAINTREE_PUBLIC_KEY = get_secret('bt_sandbox.public_key')
BRAINTREE_PRIVATE_KEY = g... |
import csv
import sys
if __name__ == "__main__":
print(sys.argv)
for i in range(len(sys.argv)):
if sys.argv[i] == "-i":
inLoc = sys.argv[i+1]
if sys.argv[i] == "-o":
outLoc = sys.argv[i+1]
csv.register_dialect("tsv", delimiter="\t")
with open(inLoc, 'r') as i... |
from django.db import models
class CompanyManager(models.Manager):
def get_for_index(self, index):
return self.get(index=index)
class Company(models.Model):
"""
A Paranuaran company.
"""
# The index of the company record in the JSON source data
index = models.PositiveIntegerField(u... |
# add a new test file
# test other thing
|
import math
import random
import pickle
import sys
from ..math.matrix import Matrix
from ..math.text2matrix import Text2Matrix
from ..nlp.segmenter import Segmenter
from ..common.global_info import GlobalInfo
from ..common.configuration import Configuration
class Kmeans:
"""
kmeans is a single-pass work, so ... |
import base64
import simplejson as json
import os
import pprint
from io import BytesIO
from IPython.core.display import display, HTML
from matplotlib import pyplot as plt
from optimus.infer import is_str
def output_image(fig, path):
"""
Output a png file
:param fig:
:param path: Matplotlib figure
... |
"""
dmim_analysis/analysis.py
Dylan H. Ross
2019/10/30
description:
tools for analyzing data
"""
from numpy import array
from dmim_analysis.util import remove_counter_ions, get_and_fit_chrom
from dmim_analysis.scraping.pubchem import get_pchem_monoiso, get_pchem_smi
from dmim_analysis.scrapin... |
import nj
def test_various_001(data):
cur = data.find(nj.q(a=nj.in_(1, 2)))
assert {doc['_id'] for doc in cur} == {'11', '22', '14', '25'}
def test_various_002(data):
cur = data.find(nj.q(b=nj.mod_(3, 1)))
assert {doc['_id'] for doc in cur} == {'11', '14'}
def test_various_003(data):
cur = dat... |
from django import template
register = template.Library()
@register.filter(name='isboolean')
def isboolean(value):
return isinstance(value, bool)
@register.filter(name='vartypename')
def vartypename(value):
return type(value).__name__
|
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='cronen',
version='1.0',
description='Micro cron library',
author='Barak Schiller',
author_email='bschiller@gmail.com',
packages=find_packages(),
install_requires=[
'bottle',
]
... |
import logging
from src.utils.configurer import config
class Logger:
def __init__(self, filename: str) -> None:
logging.basicConfig(
filename=filename,
filemode='a',
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
)
... |
#######################################################
#
# RequestCOTController.py
# Python implementation of the Class RequestCOTController
# Generated by Enterprise Architect
# Created on: 26-Mar-2020 6:32:34 PM
# Original author: Giu Platania
#
#######################################################
from Mod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.