text
stringlengths
2
999k
from registration.backends.default.views import RegistrationView from onadata.apps.main.models import UserProfile class FHRegistrationView(RegistrationView): def register(self, request, **cleaned_data): def _get_first_last_names(name): name_split = name.split() first_name = name_s...
from scipy.io import readsav import matplotlib.dates as mdates import matplotlib as mpl import datetime import glob import os from astropy import units as u from astropy.coordinates import EarthLocation, SkyCoord from astropy.io import fits from astropy.time import Time import numpy as np from skimage import measure ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import time import signal import argparse import asyncio import pygazebo import numpy as np from PIL import Image from pynput import keyboard from datetime import datetime from navigation_model import NavigationModel ''' gz topic -l gz joint ...
# flake8: noqa import vizdoom as vzd from os import listdir from os.path import isfile, join from PIL import Image from train_setup import * def get_valid_wad_ids(wad_dir): all_files = [f for f in listdir(wad_dir) if isfile(join(wad_dir, f))] wad_files = [f for f in all_files if f.endswith('wad')] wad_id...
import graphene import graphene_django_optimizer as gql_optimizer from django.db.models import QuerySet from ...core.permissions import ProductPermissions from ...warehouse import models from ..core.fields import FilterInputConnectionField from ..decorators import permission_required from .filters import StockFilterIn...
# (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import copy import mock import pytest from datadog_checks.snowflake import SnowflakeCheck, queries from .conftest import CHECK_NAME def test_config(): # Test missing account user_config = { ...
""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.10.2. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ from decou...
import json from flask import Flask from bokeh.plotting import Figure, figure, output_file, show from bokeh.resources import CDN from bokeh.embed import json_item from bokeh.layouts import column from bokeh.models import CustomJS, ColumnDataSource, Slider from bokeh.sampledata.autompg import autompg from numpy import c...
# -*- coding: utf-8 -*- str1 = 'hello, world!' # 通过内置函数len计算字符串的长度 print(len(str1)) # 13 # 获得字符串首字母大写的拷贝 print(str1.capitalize()) # Hello, world! # 获得字符串每个单词首字母大写的拷贝 print(str1.title()) # Hello, World! # 获得字符串变大写后的拷贝 print(str1.upper()) # HELLO, WORLD! # 从字符串中查找子串所在位置 print(str1.find('or')) # 8 print(str1.find('h')) #...
import qm3.mol import qm3.elements import qm3.utils._volume import io f = io.StringIO( """ ATOM 1 N NH3 1 0.000 0.000 0.000 0.00 0.00 A ATOM 2 H1 NH3 1 0.859 -0.465 -0.000 0.00 0.00 A ATOM 3 H2 NH3 1 -0.027 0.976 -0.000 0.00 0.00 ...
# # This source file is part of the EdgeDB open source project. # # Copyright 2008-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
from random import shuffle def create_dt_params(columns, search="", start=0, length=10, order=None): """Create DataTables input parameters when the data source from the rows data object/ array is not set. Read more about setting column data source here https://datatables.net/reference/option/columns.data...
import numpy as np from pkg_resources import Requirement, resource_listdir, resource_filename from ribohmm.utils import STARTCODONS, STOPCODONS # set regex for start and stop codons STARTS = {codon_name: i for i, codon_name in enumerate(STARTCODONS, start=1)} STOPS = {codon_name: i for i, codon_name in enumerate(STOPC...
########################################################################## # # Copyright (c) 2011-2012, Image Engine Design Inc. 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...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import...
# Copyright 2013 Cisco Systems, 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 o...
# # This source file is part of the EdgeDB open source project. # # Copyright 2008-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
from setuptools import setup with open("requirements.txt", "r") as f: requirements = f.read().splitlines() setup( name="asyncgist", author="avizum", version="1.0.1a", packages=["asyncgist"], url="https://github.com/avizum/asyncgist", description="Async wrapper around the GitHub Gist API",...
import os import argparse import numpy as np import pandas as pd import time import zipfile import os.path from ongoing.prescriptors.neat_multi.neat_prescriptor_many_objective import Neat as Neat2D from ongoing.prescriptors.neat_13D.neat_prescriptor_many_objective import Neat as Neat13D from ongoing.prescriptors.band...
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'localblog.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise Impo...
import json import os import argparse from shutil import copyfile parser = argparse.ArgumentParser(description='Dataset GT split') parser.add_argument("--dataset", required=True, type=str, nargs='?') args = parser.parse_args() results_path = "../../Performance/Character Recognition/gt_{}.txt".format(args.dat...
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import numpy as np import onnxruntime import common import os, sys import onnx from onnx import helper # First read the ONNX file. def get_onnx_output(model, input, intermediate_node=None): sess = onnxruntime.InferenceSessi...
import sys from switch_nexa import NexaSwitcher if __name__ == '__main__': if len(sys.argv) != 4: sys.exit('Usage: %s on|off data_pin_number transmitter_code' % sys.argv[0]) switcher = NexaSwitcher(data_pin=int(sys.argv[2]), transmitter_code=int(sys.argv[3])) if sys.argv[1] == "on": switc...
# Copyright 1999-2020 Alibaba Group Holding 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 a...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ResetPassword.ui' # # Created by: PyQt5 UI code generator 5.15.6 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore...
import unittest from flow.core.params import SumoParams, SumoLaneChangeParams, \ SumoCarFollowingParams import os os.environ["TEST_FLAG"] = "True" class TestSumoParams(unittest.TestCase): """Tests flow.core.params.SumoParams""" def test_params(self): """Tests that the various parameters lead to ...
#!/usr/bin/env python3 # license removed for brevity from tkinter import ttk from tkinter import * import numpy as np import rospy from std_msgs.msg import Float32MultiArray, Int32MultiArray from functools import partial import cv2 from PIL import Image, ImageTk import threading import pyrealsense2 as rs ...
from django.http import HttpResponse from django.shortcuts import render from django.views.generic.edit import CreateView, UpdateView from django.views.generic.base import TemplateView from django.views.generic.list import ListView from mainapp.redis_queue import sms_queue from mainapp.sms_handler import send_confirma...
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ..dcmstack import CopyMeta def test_CopyMeta_inputs(): input_map = dict( dest_file=dict( extensions=None, mandatory=True, ), exclude_classes=dict(), include_classes=dict(), src_file=dict( ...
# orm/session.py # Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Provides the Session class and related utilities.""" from __future__ import with_sta...
import os def check(cmd, mf): m = mf.findNode("pygame") if m is None or m.filename is None: return None def addpath(f): return os.path.join(os.path.dirname(m.filename), f) RESOURCES = ["freesansbold.ttf", "pygame_icon.icns"] return {"loader_files": [("pygame", map(addpath, RESOUR...
from kikit import pcbnew_compatibility from kikit.pcbnew_compatibility import pcbnew from kikit.common import normalize from pcbnew import (GetBoard, LoadBoard, FromMM, ToMM, wxPoint, wxRect, wxRectMM, wxPointMM) from enum import Enum, IntEnum from shapely.geometry import (Polygon, MultiPolygon, Point, LineString, ...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import json import logging import os import sys from abc import ABCMeta from importlib import import_module from django.utils.module_loading import module_has_submodule from six import with_metaclass ...
# Generated by Django 2.2.17 on 2021-02-09 02:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('emanuel', '0005_auto_20210201_1934'), ] operations = [ migrations.AlterModelOptions( name='aluno', options={'ordering': ('i...
from python_framework import SchedulerType from python_framework import Scheduler, SchedulerMethod, WeekDay, WeekDayConstant @Scheduler(muteLogs=True) class EmissionScheduler: @SchedulerMethod(SchedulerType.INTERVAL, seconds=1, instancesUpTo=5) def updateAllModifiedFromMemory(self) : self.service.em...
#!/usr/bin/env python # ============================================================================================================ # Created by: Lee Bergstrand & Matt McInnes # Description: A next generation bioinformatics file format converter and sequence feature extractor. # Requirements: This script requires the...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: view.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 _message from google.protobuf import...
from talon import Module, Context, actions, imgui import re mod = Module() ctx = Context() mod.mode("help_formatters", "Mode for showing the formatter help gui") formatters_dict = { # Simple formatters "NOOP": lambda text: text, "TRAILING_PADDING": lambda text: f"{text} ", "ALL_CAPS": lambda text: te...
from rest_framework import serializers from django.contrib.auth import get_user_model from django.contrib.auth.password_validation import validate_password # User = get_user_model() # class UserSerializer(serializers.ModelSerializer): # class Meta: # model = User # fields = '__all__' # rea...
import textwrap import unittest from conans.client.generators.text import TXTGenerator class LoadContentTestCase(unittest.TestCase): def test_load_sytem_libs(self): # Loading an item that contains an underscore content = textwrap.dedent(""" [system_libs] a-real-flow-conta...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'd06_project_test.settings') try: from django.core.management import execute_from_command_line ex...
# -*- coding: utf8 -*- """ Patterns and rules Some examples: >> a + b + c /. a + b -> t = c + t >> a + 2 + b + c + x * y /. n_Integer + s__Symbol + rest_ -> {n, s, rest} = {2, a, b + c + x y} >> f[a, b, c, d] /. f[first_, rest___] -> {first, {rest}} = {a, {b, c, d}} Tests and Conditions: >> f[4] /. f[x_?(# > 0&)]...
########################################################################## # # pgAdmin 4 - PostgreSQL Tools # # Copyright (C) 2013 - 2020, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## import uuid impor...
import pytest from pock.behaviour import Behaviour, ValueResult from pock.mock import Mock from pock.verification import VerificationBuilder, VerificationError @pytest.fixture def mock(): return Mock() @pytest.fixture def verification_builder(mock): return VerificationBuilder(mock, lambda result: len(resul...
import os import glob import random import cv2 import numpy as np import torch import matplotlib.pyplot as plt import open3d from skimage import io, img_as_float32 from scipy import ndimage from torch_geometric.data import Data, DataListLoader from torch_geometric.loader import DataLoader as GraphLevelDataLoader from t...
import pytest import torch as th import syft as sy from syft.frameworks.torch.tensors.decorators.logging import LoggingTensor def test_combine_pointers(workers): """ Ensure that the sy.combine_pointers works as expected """ bob = workers["bob"] alice = workers["alice"] x = th.tensor([1, 2, ...
''' INTERFACE FOR PARSING RAW SERVER BITSREAMS USING RUST - DO NOT MODIFY THIS FILE - *** hotfixes a layer of rust on-top of the python codes to handle performance issues with string-handling @returns the associated segment of the bitsream as requested by the class instance variables *** '...
from django.contrib import auth from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse UserModel = get_user_model() class TestErrors(TestCase): def test_when_404(self): response = self.client.get('/test/wrong') self.assertTemplateUsed(respo...
#!/usr/bin/env python3 import socketserver import datetime import argparse import logging class SyslogUDPHandler(socketserver.BaseRequestHandler): def handle(self): data = bytes.decode(self.request[0].strip()) socket = self.request[1] print(datetime.datetime.now().strftime("%Y-%d-%m - %H:%...
import Daemon import socket, os, select, sys, curses, locale, struct from time import sleep class Server(object): socket = None client_socket = None daemon_config = {} address = '' port = 1227 daemon = None child_callback = lambda self, client: None parent_callback = lambda self: None ...
#!/usr/bin/python # This scripts loads a pretrained model and a input file in CoNLL format (each line a token, sentences separated by an empty line). # The input sentences are passed to the model for tagging. Prints the tokens and the tags in a CoNLL format to stdout # Usage: python RunModel_ConLL_Format.py modelPath i...
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: que = collections.deque() res = [] for i, num in enumerate(nums): if que and i - que[0][0] >= k: que.popleft() while que and que[-1][1] <= num: que.pop() que.append([i, num])...
# -*- coding: utf-8 -*- from django import template register = template.Library() class IndentByNode(template.Node): def __init__(self, nodelist, indent_level, if_statement): self.nodelist = nodelist self.indent_level = template.Variable(indent_level) if if_statement: self.if_...
# -*- coding: utf-8 -*- import sys import ply.yacc as yacc import ply.lex as lex import pprint # Importar a lista de tokens do analisador léxico from lex_analyzer import tokens, find_column from utils.tree import Tree global_tree = [] expa_list = [] class Scope(object): actual_scope = {'father'...
from automation import * import openpyxl as excel from tkinter import filedialog from tkinter import * import os #read Excel file def readContacts(fileName): lst = [] file = excel.load_workbook(fileName) sheet = file.active firstCol = sheet['A'] for cell in range(len(firstCol)): contact = f...
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division """Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. 10digit surpass the int32 """ def ProjectEuler48(): print(str(sum([i**i for i in range(1,1000)]))[-10:]) #sum = 1...
#!/usr/bin/env python # Python 2/3 compatibility from __future__ import print_function import os import cv2 as cv from tests_common import NewOpenCVTests SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) MODULE_DIR = os.path.join(SCRIPT_DIR, '../../../') class shape_test(NewOpenCVTests): def test_compu...
# (c) 2015, Andrew Gaffney <andrew@agaffney.org> # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' callba...
""" Module for managing enemies. """ import random import constants as const import pygame import random import platforms from spritesheet_functions import SpriteSheet class Enemy(pygame.sprite.Sprite): # -- Methods def __init__(self, x_cord, y_cord,level, x_speed=2, char_type=0): """ Constructor ...
# Copyright 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" file accompan...
"""Submodule wrapping Random Forest for edge prediction.""" from typing import Dict, Any from sklearn.ensemble import RandomForestClassifier from embiggen.edge_prediction.edge_prediction_sklearn.decision_tree_edge_prediction import DecisionTreeEdgePrediction from embiggen.edge_prediction.edge_prediction_sklearn.sklearn...
# -*- coding: utf-8 -*- import os from babelfish import Language import pytest from vcr import VCR from subliminal.providers.podnapisi import PodnapisiProvider, PodnapisiSubtitle vcr = VCR(path_transformer=lambda path: path + '.yaml', record_mode=os.environ.get('VCR_RECORD_MODE', 'once'), casset...
# Inside of __init__.py #from MyLib.File1 import ClassA, ClassB, ClassC #from MyLib.File2 import ClassX, ClassY, ClassZ
""" To understand why this file is here, please read: http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django """ from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site d...
# Copyright 2015 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 curses import sys import time from pynput import keyboard from ._widget import Widget class Box(Widget): """The widget for making a text box to get a value""" def __init__(self, h, w, y, x): super().__init__("text box") self.window = curses.newwin(h, w, y, x) self.text = "ent...
"""Define tests for the Reaper config flow.""" from unittest.mock import patch from pytest_homeassistant_custom_component.common import MockConfigEntry from custom_components.reaper.const import ( CONF_HOSTNAME, CONF_PASSWORD, CONF_PORT, CONF_UPDATE_INTERVAL, CONF_USERNAME, DOMAIN, ) from home...
from dataclasses import dataclass import asyncio @dataclass class Message: _type: str data: dict def handle_world(message, broker): name = message.data["name"] print(f"Hello {name}") next_message = Message("quadrant:a", {"events": ["eagle"]}) broker.add_message(next_message) def handle_quad...
#!/usr/bin/env python3 import postgresql, flask, json, re import socket, ssl, time from wtforms import Form, BooleanField, StringField, PasswordField, validators from wtforms.widgets import TextArea pgsql_conn_string = 'pq://eax@localhost/eax' irc_enabled = False irc_config = { 'host': 'irc.gitter.im', 'port...
#!/usr/bin/env python # Copyright (c) 2013-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from __future__ import division,print_function,unicode_literals import biplist from ds_store import DSStore...
# -*- coding: utf-8 -*- """ Module for showing current keyboard layout. Requires: - xkblayout-state or - setxkbmap @author shadowprince @license Eclipse Public License """ from subprocess import check_output from time import time import shlex import re # colors of layouts, check your command's output to...
#!/usr/bin/python # # Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
# -*- coding: utf-8 -*- """ Sahana Eden Translate Model @copyright: 2012-2018 (c) Sahana Software Foundation @license: MIT 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 wit...
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiple RPC users.""" from test_framework.test_framework import BitcoinTestFramework from test_f...
# exported from PySB model 'model' from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD Model() Monomer('Ligand', ['Receptor']) Monomer('ParpU', ['C3A']) Monomer('C8A', ['BidU', 'C3pro']) Monomer('SmacM', ['BaxA']) Monomer('BaxM', ['BidM', '...
from typing import List from celery import shared_task from mipengine.node_tasks_DTOs import TableInfo from mipengine.node.monetdb_interface import remote_tables @shared_task def get_remote_tables(context_id: str) -> List[str]: """ Parameters ---------- context_id : str The id of the experiment ...
import logging import uuid import json import asyncio import os from asgiref.sync import sync_to_async from channels.generic.websocket import AsyncJsonWebsocketConsumer from django.core.exceptions import ObjectDoesNotExist from django.core.files.base import ContentFile from . import models from .agent_ws import Agent...
import gym from .base import Policy class RandomPolicy(Policy): def __init__(self, action_space: gym.Space): super().__init__() self.action_space = action_space def reset(self, observation): pass def step(self, action, observation): pass def sample_action(self, stat...
import sys import numpy import matplotlib import pandas import sklearn print('Python: {}'.format(sys.version)) print('Numpy: {}'.format(numpy.__version__)) print('matplotlib: {}'.format(matplotlib.__version__)) print('Python: {}'.format(pandas.__version__)) print('Python: {}'.format(sklearn.__version__)) ...
# Copyright 2015 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 sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.realpath(__file__)))) import pandas as pd import numpy as np from itertools import zip_longest import pytest import userinput, variables TEST_FN_DIR = os.path.join(os.path.dirname(os.path.abspath(os.path.realpath(__file__))), "test") NUM_BINS...
from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect from django.shortcuts import render from django.shortcuts import get_object_or_404 from metaci.build.utils import view_queryset from metaci.plan.models import Plan, PlanRepository from metaci.plan.forms import RunPlanForm ...
import numpy as np import torch.optim as optim from ast import literal_eval as make_tuple def cast_optim_params(optim_params): """ :param optim_params: :return: """ for k in optim_params.keys(): # check if argument is a parameter tuple if isinstance(optim_params[k], str) and '(...
# -*- 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.base.exchange import Exchange import hashlib import math from ccxt.base.errors import ExchangeError from ccxt.base.errors import ...
import pytest from django.urls import resolve, reverse from notificationsservice.users.models import User pytestmark = pytest.mark.django_db def test_user_detail(user: User): assert ( reverse("api:user-detail", kwargs={"username": user.username}) == f"/api/users/{user.username}/" ) asser...
import os, sys from six.moves import cPickle import numpy as np import pandas as pd import helper from tfomics import utils #------------------------------------------------------------------------------------------------ # JASPAR filter indices arid3 = ['MA0151.1', 'MA0601.1', 'PB0001.1'] cebpb = ['MA0466.1', 'MA046...
# -*- coding: utf-8 -*- import os import pickle import numpy as np from PIL import Image import pypytorch as ppt from pypytorch.data import Dataset import pypytorch.data.transform as transform def load_data(filename): with open(filename, 'rb') as f: data = pickle.load(f, encoding='latin1') X = da...
import komand from .schema import ConnectionSchema, Input # Custom imports below from google.oauth2 import service_account import apiclient import json class Connection(komand.Connection): def __init__(self): super(self.__class__, self).__init__(input=ConnectionSchema()) def connect(self, params): ...
# pylint: disable=C0111, too-many-statements, too-many-locals # pylint: too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme # pylint: disable=superfluous-parens, no-member, invalid-name """ architecture file for deep speech 2 model """ import argparse import json import math impo...
import argparse import json from pymatgen.core.composition import Composition from pymatgen.core.structure import Structure from oxi_diel_db.prediction_model.ml_prediction import predict_log10_eps def main(): parser = argparse.ArgumentParser(description="Prediction of dielectric constant by ML models") parser...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import OrderedDict from torch import nn from mega_core.modeling import registry from mega_core.modeling.make_layers import conv_with_kaiming_uniform from . import fpn as fpn_module from . import resnet @registry.BACKBONES.regis...
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2015-2017 Rapptz 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 u...
import math import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['wrn'] class BasicBlock(nn.Module): def __init__(self, in_planes, out_planes, stride, dropRate=0.0): super(BasicBlock, self).__init__() self.bn1 = nn.BatchNorm2d(in_planes) self.relu1 = nn.ReLU(inplac...
import os import random import sys from unittest.mock import patch import numpy as np import pytest import torch import torch.nn as nn from torch.optim import SGD from torch.utils.data import BatchSampler, DataLoader, RandomSampler import ignite.distributed as idist from ignite.engine import Events from ignite.engine...
# Generated by Django 4.0 on 2022-01-08 11:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ids', '0002_id_created_at'), ] operations = [ migrations.AlterField( model_name='id', name='created_at', f...
""" Module for managing Belgium Traffic Signs Classification dataset """ from .ImageDataset import ImageDataset import h5py import sklearn import sklearn.model_selection import os import pandas as pd import skimage.data import skimage.transform from skimage import io, color, exposure, transform import glob import url...
from .main import cli # noqa: F401 __version__ = '0.1'
# Logistic Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Social_Network_Ads.csv') X = dataset.iloc[:,[2,3]].values y = dataset.iloc[:, 4].values # Splitting the dataset into the Training set and Test set from...