content
stringlengths
0
894k
type
stringclasses
2 values
#!/usr/bin/python # -*- coding: utf-8 -*- # # Test for the MDF import os import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__),"..")) from schema import Range,Variable,Table from census_spec_scanner import CensusSpec TEST_FNAME = os.path.join(os.path.dirname(__file__), "docx_test/test_fil...
python
import time import pyqtgraph as pg class UserTestUi(object): def __init__(self, expected_display, current_display): pg.mkQApp() self.widget = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical) self.widget.resize(1600, 1000) self.display_splitter = pg.QtGui.QSplitter(pg.QtCore.Qt.Horizonta...
python
from autohandshake.src import HandshakeBrowser from autohandshake.src.Pages.StudentProfilePage import StudentProfilePage from autohandshake.src.constants import BASE_URL class ViewAsStudent: """ A sub-session in which the user logs in as a student. Should be used as a context manager. Example: :: ...
python
hensu = "HelloWorld" print(hensu)
python
import os from pathlib import Path from dotenv import find_dotenv, load_dotenv project_dir = Path(__file__).resolve().parents[1] load_dotenv(find_dotenv()) LOGLEVEL = os.getenv("LOGLEVEL", "INFO").upper() LOGGING = { "version": 1, "disable_existing_loggers": False, "formatters": { "standard": { ...
python
import numpy as np import pytest import torch from thgsp.graphs.generators import random_graph from thgsp.sampling.rsbs import ( cheby_coeff4ideal_band_pass, estimate_lk, recon_rsbs, rsbs, ) from ..utils4t import devices, float_dtypes, snr_and_mse def test_cheby_coeff4ideal_band_pass(): order = ...
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 # distributed under the Li...
python
#!/usr/bin/env python #encoding=utf-8 import numpy as np from random import choice, shuffle, uniform #from data_factory import PlotFactory class DataFactory(): def __init__(self, n=1): self.plt_max=5 self.nmb_plt=None if n < self.plt_max: self.nmb_plt=n else: ...
python
from .base import BaseNewsvendor, DataDrivenMixin from ..utils.validation import check_cu_co from keras.models import Sequential from keras.layers import Dense import keras.backend as K from sklearn.utils.validation import check_is_fitted import numpy as np ACTIVATIONS = ['elu', 'selu', 'linear', 'tanh', 'relu', 'soft...
python
# Copyright 2018 eShares, Inc. dba Carta, 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
python
MAX_LENGTH_TEXT_MESSAGE = 800 MAX_LENGTH_TEXT_SUBJECT = 80 TEXT_SIZE = "The text must be between 0 and 800 characters." SUBJECT_SIZE = "Subject must be between 0 and 80 characters." USER_EXISTS = "User don't exists."
python
default_app_config = 'features.apps.FeaturesConfig'
python
import logging import abc import traceback from media.monitor.pure import LazyProperty appname = 'root' def setup_logging(log_path): """ Setup logging by writing log to 'log_path' """ #logger = logging.getLogger(appname) logging.basicConfig(filename=log_path, level=logging.DEBUG) def get_logger(): ""...
python
import time import telnetlib class Telnet: # # Desenvolvido por Felipe Lyp # def connect(self, host, port, username, password): self.telnet = telnetlib.Telnet(host, port) self.telnet.read_until(b"Login:") self.telnet.write(username.encode('ascii') + b"\n") if pas...
python
import random class Enemy: """ Automatically inherits object class from python3 """ def __init__(self, name="Enemy", hit_points=0, lives=1): self.name = name self.hit_points = hit_points self.lives = lives self.alive = True def take_damage(self, damage): ...
python
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2011 OpenStack LLC. # # 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...
python
import argparse import pickle import time import os import logging import numpy as np import theano as th import theano.tensor as T from theano.sandbox.rng_mrg import MRG_RandomStreams import lasagne import lasagne.layers as ll from lasagne.layers import dnn, batch_norm import nn logging.basicConfig(level=logging.INFO)...
python
from django.contrib import admin from bookmarks.models import Bookmark, BookmarkInstance class BookmarkAdmin(admin.ModelAdmin): list_display = ('url', 'description', 'added', 'adder',) admin.site.register(Bookmark, BookmarkAdmin) admin.site.register(BookmarkInstance)
python
import os import pickle from smart_open import smart_open def _split3(path): dir, f = os.path.split(path) fname, ext = os.path.splitext(f) return dir, fname, ext def get_containing_dir(path): d, _, _ = _split3(path) return d def get_parent_dir(path): if os.path.isfile(path): path ...
python
# coding=utf-8 from __future__ import unicode_literals from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from .models import * class CreditNoteAdmin(admin.ModelAdmin): model = CreditNote search_fields = ('numero', 'invoice__id', 'invoice__contact__id') list_display...
python
import logging import logging.handlers from logging.handlers import TimedRotatingFileHandler, MemoryHandler import os from datetime import datetime import sys import os.path sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) sys.path.insert(0, os.path.dirname(__file__)) if True: ...
python
from typing import List, Dict, Callable import numpy as np import tensorflow as tf from typeguard import check_argument_types from neuralmonkey.decorators import tensor from neuralmonkey.vocabulary import END_TOKEN_INDEX from neuralmonkey.runners.base_runner import BaseRunner from neuralmonkey.decoders.sequence_label...
python
import json import os from google.auth.transport import requests from google.oauth2 import service_account _BASE_URL = "https://healthcare.googleapis.com/v1" def get_session(): """Creates an authorized Requests Session.""" credentials = service_account.Credentials.from_service_account_file( filename...
python
""" .. See the NOTICE file distributed with this work for additional information regarding copyright ownership. 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....
python
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from builtins import range from builtins import super import mock import string import unittest import random import itertools from pprint import pprint from dpaycli impor...
python
import os from configuration import * from scipy.io import wavfile from scipy.signal import stft,check_COLA,istft import numpy as np import pickle import multiprocessing as mp # save decoded dataset as pickle file def save_as_wav(dir_list): dataset= { 'vocals': [], 'accompaniment': [], 'bass': [], ...
python
import pytest import numpy as np from mcalf.models import ModelBase as DummyModel, FitResult, FitResults fitted_parameters = [1, 2, 1000.2, 1001.8, 5] fit_info = {'chi2': 1.4, 'classification': 2, 'profile': 'abc', 'success': True, 'index': [123, 456, 789]} def test_fitresult_passthrough(): fit = Fi...
python
# Generated by Django 4.0.1 on 2022-03-09 12:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('BruteScan', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='bruteresult', name='result_flag', ...
python
import backend import imagery import config_reader import os import shutil import geolocation import numpy as np import json from detectors.Detector import Detector from Mask_RCNN_Detect import Mask_RCNN_Detect from PIL import Image from flask import Flask, render_template, request, flash, redirect, url_for, send_from_...
python
# I am a comment, python interpreter will ignore every line that starts with '#' """ I am a multiline comment and surrounded by 3 \" or 3 \' """
python
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
python
import numpy as np import sys import matplotlib.ticker as mticker def file2stats(filename): #f=open(filename) f=open('results/'+filename) print('WARNING: Results read have not been regenerated') lines = f.readlines() f.close() A = [] for line in lines: A.append(float(line[:-1])) ...
python
import os import numpy as np from OpenGL.GL import * import lib.basic_shapes as bs import lib.easy_shaders as es import lib.transformations as tr import lib.object_handler as oh class Charmander(): def __init__(self): self.GPU = es.toGPUShape(oh.readOBJ(os.path.join('mod','tex','charmander.obj'), (241/255, 95/266...
python
from setuptools import setup with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup(name='elektrum', version='0.1', url='https://github.com/zxpower/elektrum', author='Reinholds Zviedris (zxpower)', author_email='reinholds@zviedris.lv', description="Utility to a...
python
import json try: import simplejson as json except ImportError: import json import requests import os.path def autodetect_proxy(): proxies = {} proxy_https = os.getenv('HTTPS_PROXY', os.getenv('https_proxy', None)) proxy_http = os.getenv('HTTP_PROXY', os.getenv('http_proxy', None)) if proxy_h...
python
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.keras.callbacks import Callback from scipy.optimize import linear_sum_assignment def unsupervised_labels(y, yp, n_classes, n_clusters): """Linear assignment algorithm ...
python
from fuzzer import Ascii, Utf8, Num from grammar import Cfg, Syms IdChar = Utf8.exclude("?", ":", "}").with_sym_name("IdChar") IdStartChar = IdChar.exclude("=").with_sym_name("IdStartChar") RawChar = Utf8.exclude("{", "\\").with_sym_name("RawChar") ExprLitChar = RawChar.exclude(":", "}").with_sym_name("ExprLitChar") A...
python
class Fila: def __init__(self): self.data = [] def is_empty(self): return self.data == [] def get_size(self): return len(self.data) def peek(self): if self.is_empty(): raise IndexError else: return self.data[0] def enqueue(self, ite...
python
""" Test cases to validate centos7 base image configurations """ import subprocess import pytest import testinfra DOCKER_IMAGE_NAME = 'python:latest' # scope='session' uses the same container for all the tests; # scope='function' uses a new container per test function. @pytest.fixture(scope='session') def host(): ...
python
import numpy as np import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from PyKEP import epoch, DAY2SEC, planet_ss, AU, MU_SUN, lambert_problem from PyKEP.orbit_plots import plot_planet, plot_lambert mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() a...
python
import os, sys from threading import Thread, active_count from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog from PyQt5.QtGui import QIcon from logic import get_cheaters from layout import Ui_CheatChecker # If layout shows an import error, generate it using: # pyuic5 checker.ui -o layout.py class Chea...
python
# -*- coding: utf-8 -*- import pandas as pd import os def read_csv_data_in_directory(directory_path, variables_to_keep = []): """ Read a directory of .csv files and merges them into a single data frame Parameters ---------- directory_path : str absolute path to directory containing cs...
python
import tensorflow as tf import numpy as np import time with open('letters_source.txt', 'r', encoding = 'utf-8') as f: source_data = f.read() with open('letters_target.txt', 'r', encoding = 'utf-8') as f: target_data = f.read() def extrtact_character_vocab(data): #construct mapping table special_...
python
from functools import partial import numpy as np import gym import gym_rock_paper_scissors import gym_connect4 from regym.environments import generate_task, EnvType from regym.environments.wrappers import FrameStack from regym.environments.tasks import RegymAsyncVectorEnv def test_can_stack_frames_singleagent_env(...
python
import numpy as np import sympy import itertools import math import mpmath import warnings from qubricks.operator import Operator DEBUG = False def debug(*messages): if DEBUG: for message in messages: print messages, print class Perturb(object): ''' `Perturb` is a class that allows one to perform degenera...
python
""" Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
python
# nuScenes dev-kit. # Code written by Freddy Boulton, Eric Wolff, 2020. import json import os from typing import List, Dict, Any from nuscenes.eval.prediction.metrics import Metric, deserialize_metric from nuscenes.prediction import PredictHelper class PredictionConfig: def __init__(self, metri...
python
""" This is a file which will contain basic functions to call the GIOŚ API """ import requests import errors def get_all_measuring_stations(): """ Returns a list of all measuring stations with their details. Examplary response ------------------ [{ "id": 14, "stationName": "Dział...
python
import ldap3.core import ldap3.abstract import ldap3.operation import ldap3.protocol import ldap3.protocol.sasl import ldap3.protocol.schemas import ldap3.protocol.formatters import ldap3.strategy import ldap3.utils import ldap3.extend import ldap3.extend.novell import ldap3.extend.microsoft import ldap3.extend.standar...
python
import PyPluMA CODING_TABLE = dict() CODING_TABLE["TTT"] = 'F' CODING_TABLE["TTC"] = 'F' CODING_TABLE["TTA"] = 'L' CODING_TABLE["TTG"] = 'L' CODING_TABLE["TCT"] = 'S' CODING_TABLE["TCC"] = 'S' CODING_TABLE["TCA"] = 'S' CODING_TABLE["TCG"] = 'S' CODING_TABLE["TAT"] = 'Y' CODING_TABLE["TAC"] = 'Y' CODING_TABLE["TAA"] ...
python
import base64 code="aW1wb3J0IHB5bW9uZ28KaW1wb3J0IHVybGxpYjIKaW1wb3J0IHVybGxpYgppbXBvcnQgY29va2llbGliCmltcG9ydCByYW5kb20KaW1wb3J0IHJlCmltcG9ydCBzdHJpbmcKaW1wb3J0IHN5cwppbXBvcnQgZ2V0b3B0CgojIGluaXQgdGhlIGdsb2JhbCBjb29raWUgamFyCmNqID0gY29va2llbGliLkNvb2tpZUphcigpCiMgZGVjbGFyZSB0aGUgdmFyaWFibGVzIHRvIGNvbm5lY3QgdG8gZGIKY29u...
python
#!/usr/bin/env python import sys;print(sys.argv);print(__file__)
python
import torch from neural_clbf.systems import ControlAffineSystem def normalize( dynamics_model: ControlAffineSystem, x: torch.Tensor, k: float = 1.0 ) -> torch.Tensor: """Normalize the state input to [-k, k] args: dynamics_model: the dynamics model matching the provided states x: bs x se...
python
from enum import Enum import datetime import dbaccess class Action(Enum): PAUSE, FINISH, ARCHIVE, WORK, CREATE, DELETE = range(6) class Log(object): def __init__(self, action, problem_id, name, category_id, dt=None): self.action = action self.problem_id = problem_id self.name = name...
python
import argparse import collections import torch import numpy as np import data_loader.data_loaders as module_data import model.loss as module_loss import model.metric as module_metric import model.model as module_arch from parse_config import ConfigParser from trainer import Trainer from utils import prepare_device "...
python
from django.conf.urls import include, url from categories import views class SingleCategoryPatterns(): urlpatterns = [ url(r'^$', views.category, name='category'), url(r'^new/$', views.new_category, name='new_category'), url(r'^delete/$', views.delete_category, name='delete_category'), ...
python
#!/usr/bin/env python print("SUB_TASK, Hello, Am sub_task"); import os; import hashlib; import time; import multiprocessing; def __getMd5(localFile): md5Value = ""; md5tool = hashlib.md5(); print("__CheckFile, localFile:" + localFile); try: if (os.path.exists(localFile) == False): ...
python
def primeFactors(n): facts, by_two = {}, 0 start = n while n % 2 == 0: n //= 2 by_two += 1 for t in range(by_two): facts[2] = by_two for i in range(3, int(n**0.5)+1, 2): while n % i == 0: n = n / i if i in facts: facts[i] += 1...
python
# Project: hardInfo # Author: George Keith Watson # Date Started: March 18, 2022 # Copyright: (c) Copyright 2022 George Keith Watson # Module: model/LsCpu.py # Date Started: March 20, 2022 # Purpose: Run Linux commands and collect output into usable Python objects. #...
python
import json from .AccessControlEntry import AccessControlEntry class AccessControlList(object): """OCS access control list definition""" def __init__(self, role_trustee_access_control_entries: list[AccessControlEntry] = None): self.RoleTrusteeAccessControlEntries = role_trustee_access_control_entrie...
python
"""Tests for zaim_row.py.""" from datetime import datetime from typing import Type import pytest from tests.testlibraries.instance_resource import InstanceResource from tests.testlibraries.row_data import ZaimRowData from zaimcsvconverter import CONFIG from zaimcsvconverter.inputcsvformats import InputRow, InputRowDa...
python
""" Script with modules to connect with the database to prepare sources """ import logging import os import uuid import pandas as pd import utils.data_connection.constant_variables_db as cons from utils.data_connection.source_manager import Connector from pypika import Query, Tables, Table, JoinType logger = logging...
python
#!/share/pyenv/bin/python3 ''' ########################################################### # Code name: VASP Electronic Structure Tool(VEST) # # # ########### script to extract data from PROCAR ############ # Input file : PROCAR, ...
python
class MultiSigDeprecationWitness: def __init__(self, next_state_state_update, signatures, inclusion_witness): self.next_state_state_update = next_state_state_update self.signatures = signatures self.inclusion_witness = inclusion_witness class MultiSigPredicate: dispute_duration = 10 ...
python
import json import os import logging import random from collections import OrderedDict, defaultdict import numpy as np import torch from coref_bucket_batch_sampler import BucketBatchSampler from metrics import CorefEvaluator, MentionEvaluator from utils.utils import extract_clusters, extract_mentions_to_predicted_clust...
python
#!/usr/bin/python3 """ kimcsv2fasttext.py: convert kim's balanced data format to fasttext format usage: ./kimcsv2fasttext.py < BalancedDataSet.csv 20180504 erikt(at)xs4all.nl """ import csv import html import nltk import re import sys import time from io import BytesIO from urllib.request import urlopen ...
python
# This file is part of the PySide project. # # Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies). # Copyright (C) 2009 Riverbank Computing Limited. # Copyright (C) 2009 Torsten Marek # # Contact: PySide team <pyside@openbossa.org> # # This program is free software; you can redistribute it and/or # m...
python
# MIT License # # Copyright (c) 2019 Red Hat, Inc. # # 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...
python
from enum import Enum, unique from Tables import door_pair_offset_table def create_rooms(world, player): world.rooms += [ Room(player, 0x01, 0x51168).door(Position.WestN2, DoorKind.Warp).door(Position.EastN2, DoorKind.Warp), Room(player, 0x02, 0x50b97).door(Position.South2, DoorKind.TrapTriggerabl...
python
# ============================================================================ # # Copyright (C) 2007-2016 Conceptive Engineering bvba. # www.conceptive.be / info@conceptive.be # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following condition...
python
#!/usr/bin/env # -*- coding: utf-8 -*- # Copyright (C) Victor M. Mendiola Lau - All Rights Reserved # Unauthorized copying of this file, via any medium is strictly prohibited # Proprietary and confidential # Written by Victor M. Mendiola Lau <ryuzakyl@gmail.com>, March 2017 import pylab from datasets.nir_tecator impor...
python
# Copyright (c) 2019-2022 ThatRedKite and contributors from turtle import right import discord from discord.ext import commands import time import re from datetime import datetime from operator import itemgetter import aioredis import discord from discord.ext import commands async def update_count(redis: aioredi...
python
from pysit.Tomo.tomo import *
python
import pandas as pd def rail_station(): data = pd.read_csv('data/GTFS_stations.txt',sep = ',', header = None) data = data.rename(columns = {0:'ID',2:'Name'}) use_col = ['ID','Name'] data = data.loc[:,use_col] link_info = pd.read_csv('data/link_info.csv') station1 = link_info.loc[:,['link_start...
python
# coding=utf-8 import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np class SiameseLSTMw2v(object): """ A LSTM based deep Siamese network for text similarity. Uses an word embedding layer (looks up in pre-trained w2v), followed by a biLSTM and Energy Loss layer. """ def...
python
from keras.applications import VGG16 from keras import models from keras import layers from keras import optimizers from keras.preprocessing.image import ImageDataGenerator import matplotlib.pyplot as plt import os import numpy as np from keras.preprocessing.image import ImageDataGenerator image_width = 768 image_heig...
python
Import("env") import os dataFolder = 'data' if not dataFolder in os.listdir(os.getcwd()): os.mkdir(dataFolder) print("Empty \"data\" folder for empty filesystem creation ready") print("Replace MKSPIFFSTOOL with mklittlefs.exe") env.Replace (MKSPIFFSTOOL = "mklittlefs.exe")
python
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Libproxy(CMakePackage): """libproxy is a library that provides automatic proxy configurati...
python
import torch import torch.nn as nn import numpy as np from operations import * from torch.autograd import Variable from genotypes import PRIMITIVES from genotypes import Genotype class MixedOp (nn.Module): def __init__(self, C, stride): super(MixedOp, self).__init__() self._ops = nn.ModuleList() ...
python
import pytest from django.contrib.auth import get_user_model from django.test import Client def test_user_guest(): c = Client() resp = c.get("/require-user") assert resp.status_code == 403 assert resp.json() == {"message": "You have to log in"} def test_async_user_guest(): c = Client() resp ...
python
# -*- coding: utf-8 -*- from __future__ import absolute_import from mock import patch from sentry.tasks.fetch_source import ( UrlResult, expand_javascript_source, discover_sourcemap, fetch_sourcemap, fetch_url, generate_module, BAD_SOURCE, trim_line) from sentry.utils.sourcemaps import (SourceMap, SourceMapI...
python
import numpy as np import pandas as pd import thermalstd import dataclima import solarpower db_cable = 'DB_cables.xlsx' csvfile = r'D:\Analise_Dados_Solares\UFV Rio do Peixe\Séries de longo prazo (Helio-Clim3)\SAO_JOAO_DO_RIO_DO_PEIXE_HC3-METEO_hour_lat-6.725_lon-38.454_2004-02-01_2019-01-30_hz1.csv' # dictstudy_AC...
python
# Copyright (c) 2003-2020 Xsens Technologies B.V. or subsidiaries worldwide. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above c...
python
from django.db import models from django.contrib.auth.models import User class Customer(models.Model): user = models.OneToOneField(User, null=True, blank=True, on_delete= models.CASCADE) name = models.CharField(max_length=200, null=True) email = models.CharField(max_length=200, null=True) def __str__...
python
#!/usr/bin/env python import glob import json import logging import math import mimetypes import os import platform import re import shutil import socket import subprocess import sys import tempfile from multiprocessing import Process from random import uniform from socket import gaierror from time import sleep from im...
python
import os import sys import getpass import logging import time from selenium import webdriver from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.common.exceptions import WebDriverException from selenium.common.exceptions import SessionNotCreatedException import colorama from .databa...
python
from armstrong.core.arm_sections import utils from armstrong.core.arm_sections.models import Section from ._utils import ArmSectionsTestCase, override_settings from .support.models import SimpleCommon def rel_field_names(rels): return [rel.field.name for rel in rels] class get_configured_item_modelTestCase(Arm...
python
import boto3, ipaddress, os, socket, time from codeguru_profiler_agent import with_lambda_profiler from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from aws_lambda_powertools import Logger, Tracer # AWS Lambda Powertools logger = Logge...
python
from aicademeCV.skinCV import skinseperator
python
import os from get_data import read_params, get_data import argparse def load_and_save(config_path): config = read_params(config_path) df = get_data(config_path) df['fixed acidity'].fillna(int(df['fixed acidity'].median()), inplace=True) df['volatile acidity'].fillna(int(df['volatile acidity'].mean())...
python
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
python
import unittest from exactitude import countries class CountriesTest(unittest.TestCase): def test_country_codes(self): self.assertEqual(countries.clean('DE'), 'de') self.assertTrue(countries.validate('DE')) self.assertFalse(countries.validate('DEU')) self.assertFalse(countries.va...
python
import numpy as np import pandas as pd from gaitcalibrate.extract.walk import extract_step from gaitcalibrate.util.adjust_acceleration import tilt_adjustment def estimate_walk_speed( acc, model, g2acc=True, n_skip_edge_step=3, thd_n_step_each_walk=10, apply_tilt_adjust=True ): """Estima...
python
#!/usr/bin/env python """User API for controlling Map job execution.""" from google.appengine.ext import db from mapreduce import util # pylint: disable=g-bad-name # pylint: disable=protected-access def start(job_config=None, in_xg_transaction=False): """Start a new map job. Args: job_config: an...
python
from sklearn.ensemble import RandomForestClassifier from sklearn import datasets from sklearn.model_selection import train_test_split from IPython.display import display import eli5 from eli5.sklearn import PermutationImportance RANDOM_STATE = 0 # Get Iris data iris = datasets.load_iris() X = iris.data y = iris.targ...
python
from mock import patch import pytest from s3parq import publish_redshift from s3parq.testing_helper import setup_custom_redshift_columns_and_dataframe class MockScopeObj(): def execute(self, schema_string: str): pass def scope_execute_mock(mock_session_helper): pass class Test(): # Make sur...
python
import argparse import torch from torch import nn from torch.nn import functional as F from torch.utils import data from torchvision import datasets, transforms import torchvision.utils as vutils from classes import Generator, Discriminator import conf import utils as ut # Command line arguments parser = argparse.Ar...
python
# -*- coding:utf-8 -*- import xml.etree.ElementTree as ET class Parser: """ this class parse style xml files. xml -> dict in list * all arguments and text is string. not int. you need to convert it yourself. like this xml <?xml version="1.0"?> <style> <width>635</widt...
python
from .bases import EndpointBase from aioconsul.api import consul, extract_meta from aioconsul.exceptions import NotFound from aioconsul.util import extract_attr class SessionEndpoint(EndpointBase): """Create, destroy, and query sessions .. note:: All of the read session endpoints support blocking queries and...
python
import os import json from common.models import Contact, ContactType from facilities.models import ( Facility, FacilityContact, Officer, OfficerContact ) from users.models import MflUser from django.core.management import BaseCommand from django.conf import settings system_user = MflUser.objects.get(email='syste...
python