content
stringlengths
0
894k
type
stringclasses
2 values
import pdb import uuid from decimal import Decimal from django.apps import apps from ahj_app.models import User, Edit, Comment, AHJInspection, Contact, Address, Location, AHJ, AHJUserMaintains from django.urls import reverse from django.utils import timezone import pytest import datetime from fixtures import create_u...
python
from flask import Blueprint, g, request, current_app import json import logging from ..utils import datetime_to_json, get_time_string, get_default_runtime, match_movie import datetime from ..pick_algo import pick_movies_by_num, pick_movies_by_time from .auth import login_required import pandas import pathlib from .. i...
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # from "SuperShape2D" (Daniel Shiffman) # Video: https://youtu.be/ksRoh-10lak # supershapes: http://paulbourke.net/geometry/supershape/ import sys, os from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import math import numpy as np def...
python
"""Convert all the old posts. Author: Alex Alemi Date: 2019-01-23 """ import os import logging CURRENT_DIR = os.path.dirname(__file__) POSTS_DIR = os.path.normpath(os.path.join(CURRENT_DIR, '../posts/old')) def fix_front(line): """Redo the front of the metadata lines for the nikola format.""" return '.. ' +...
python
# Generated by Django 2.2.24 on 2021-07-26 14:50 import django.core.validators from django.db import migrations, models def split_dates(apps, schema_editor): CompanyObjective = apps.get_model('exportplan', 'CompanyObjectives') for objective in CompanyObjective.objects.all(): if objective.start_date: ...
python
"""https://gist.github.com/alopes/5358189""" stopwords = [ "de", "a", "o", "que", "e", "do", "da", "em", "um", "para", "é", "com", "não", "uma", "os", "no", "se", "na", "por", "mais", "as", "dos", "como", "mas", "foi", ...
python
import pygame from . import GameEnv, GameEnv_Simple, Ball, Robot, Goal from typing import Tuple, List, Dict import random class AbstractPlayer: def __init__(self, env: GameEnv, robot: Robot): self.env = env self.robot = robot def get_action(self) -> Tuple[float, float]: raise Exception...
python
class Solution: def XXX(self, head: ListNode) -> ListNode: try: new_head = new_tail = ListNode(head.val) p = head.next while p: if new_tail.val != p.val: node = ListNode(p.val) new_tail.next = node ...
python
from PIL import Image # Charger l'image img = Image.open('/home/popschool/Documents/GitHub/projet_recoplante/Images_test/bruyere_des_marais_NB.jpg') # Afficher l'image chargée img.show() # Récupérer et afficher la taille de l'image (en pixels) w, h = img.size print("Largeur : {} px, hauteur : {} px".format(w, h)...
python
import unittest from Config import Config from MossResultsRetriever import MossResultsRetriever from Result import Result class MossURLsTests(unittest.TestCase): def setUp(self): self.config = Config() self.validUrl = self.config.getMagicsquare() self.retriever = MossResultsRetriever() ...
python
import io import os.path import shutil import sys import tempfile import re import unittest from types import ModuleType from typing import Any, List, Tuple, Optional from mypy.test.helpers import ( assert_equal, assert_string_arrays_equal, local_sys_path_set ) from mypy.test.data import DataSuite, DataDrivenTest...
python
# Generated by Django 3.2.12 on 2022-02-16 23:46 import django.core.validators from django.db import migrations, models import re class Migration(migrations.Migration): dependencies = [ ('customer', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='custom...
python
###################################################################### # # File: b2/download_dest.py # # Copyright 2019 Backblaze Inc. All Rights Reserved. # # License https://www.backblaze.com/using_b2_code.html # ###################################################################### from b2sdk.download_dest import *...
python
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"index_flow": "00_core.ipynb", "query_flow": "00_core.ipynb", "slugify": "01_loader.ipynb", "get_image_files": "01_loader.ipynb", "verify_image": "01_loader.ipynb", ...
python
from checkov.common.models.enums import CheckCategories from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck class VMDisablePasswordAuthentication(BaseResourceNegativeValueCheck): def __init__(self): name = "Ensure that Virtual machine does not en...
python
"""Tests for encoder routines to tf.train.Exammple.""" from absl.testing import parameterized import tensorflow as tf from tensorflow_gnn.graph import graph_constants as gc from tensorflow_gnn.graph import graph_tensor as gt from tensorflow_gnn.graph import graph_tensor_encode as ge from tensorflow_gnn.graph import gr...
python
from django import forms from fir_nuggets.models import NuggetForm from incidents import models as incident_models class LandingForm(NuggetForm): new = forms.BooleanField(initial=True, required=False) event = forms.ModelChoiceField(queryset=incident_models.Incident.objects.exclude(status='C'), required=False) st...
python
#!/usr/bin/env python #==================================================== import copy import uuid import numpy as np import threading from Utilities.decorators import thread #==================================================== class CircuitCritic(object): def __init__(self, circuit_params): self.circuit_p...
python
# -*- coding: utf-8 -*- """ easybimehlanding This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ import easybimehlanding.models.travel_insurance_policy_extend class TravelInsurancePolicyExtendView(object): """Implementation of the 'TravelInsurancePolicyExtend...
python
# Copyright (c) 2016-2020, The Bifrost Authors. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditi...
python
from .clock import Clock from .identity import Identity from .license import License from .note import Note from .resource import Resource __all__ = ["Clock", "Identity", "License", "Note", "Resource"]
python
from behave import * from src.hamming import distance from assertpy import assert_that use_step_matcher("re") @given("two strands") def step_impl(context): context.distance = distance @when("(?P<strand1>.+) and (?P<strand2>.+) are same length") def step_impl(context, strand1, strand2): context.result = conte...
python
# # This file is an example to set the environment. # The configs will be used in dmrgci.py and chemps2.py # import os from pyscf import lib # To install Block as the FCI solver for CASSCF, see # http://sunqm.github.io/Block/build.html # https://github.com/sanshar/Block BLOCKEXE = '/path/to/Block/block.sp...
python
from nipype.interfaces.base import BaseInterface, \ BaseInterfaceInputSpec, traits, File, TraitedSpec, InputMultiPath, Directory from nipype.utils.filemanip import split_filename import nibabel as nb import numpy as np import os class ConsensusInputSpec(BaseInterfaceInputSpec): in_Files = traits.Either(InputMu...
python
#!/usr/bin/env python ## Program: VMTK ## Module: $RCSfile: vmtksurfacedistance.py,v $ ## Language: Python ## Date: $Date: 2005/09/14 09:49:59 $ ## Version: $Revision: 1.6 $ ## Copyright (c) Luca Antiga, David Steinman. All rights reserved. ## See LICENSE file for details. ## This software is d...
python
# -*- coding: utf-8 -*- #______________________________________________________________________________ #______________________________________________________________________________ # # Coded by Daniel González Duque #______________________________________________________________________________...
python
from app import db import os import requests class Movies(db.Model): """ Models the data of movies related to a given location. """ id = db.Column(db.Integer, primary_key=True) movies = db.Column(db.Text) @staticmethod def create_entry(query): """ Takes in a search query...
python
# # Copyright (c) 2015-2021 Thierry Florac <tflorac AT ulthar.net> # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRAN...
python
from pydocstyle.checker import check from pydocstyle.checker import violations import testing registry = violations.ErrorRegistry _disabled_checks = [ 'D202', # No blank lines allowed after function docstring 'D205', # 1 blank line required between summary line and description ] def check_all_files(): ...
python
# Copyright 2015 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 by applicable law or a...
python
# Generated by Django 3.0.2 on 2020-10-13 07:23 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('accounts', '0005_thirdpartycreds'), ] operations = [ migrations.AlterModelOptions( name='thirdpartycreds', options={'verbose...
python
from skynet.common.base_daos import BaseDao class BaseModel(object): DEFAULT_DAO = BaseDao def __init__(self, dao=None): if dao is None: dao = self.DEFAULT_DAO() self.dao = dao def populate(self, data): for k, v in data.iteritems(): k_transl...
python
import os import json import html from datetime import datetime, timedelta from fastapi import FastAPI, HTTPException from fastapi.middleware.cors import CORSMiddleware from starlette.requests import Request from starlette.responses import JSONResponse from auth import LEADERBOARD_API_TOKEN app = FastAPI(redoc_url=...
python
# -*- encoding: utf-8 -*- """Handle root-services sessions endpoints.""" from .base import RootService from ..decorators import dyndoc_insert, endpoint from .responses.sessions import responses @endpoint("openapi/root/v1/sessions/capabilities/") class GetSessionCapabilities(RootService): """Get the sessions cap...
python
from __future__ import unicode_literals from . import model from . import collection from . import fields from . import related
python
from collection.property_dictionary import PropertyDict from collection.xml_interface import XMLError from collection.xml_interface import XMLInterface from metadata.metadata_api import MetadataError from metadata.metadata_api import Metadata from image.envi import ENVIHeader
python
import json import logging import re from datetime import datetime from decimal import Decimal from enum import Enum from functools import singledispatch from sys import version_info from typing import Any, Optional, Tuple, Union from urllib.parse import urlsplit PY37 = version_info >= (3, 7) class JSONEncoder(json....
python
""" Adapted from https://github.com/kirubarajan/roft/blob/master/generation/interactive_test.py to process a batch of inputs. """ import argparse import json import numpy as np import os import torch from transformers import AutoModelForCausalLM, AutoTokenizer def main(args): np.random.seed(args.random_seed) ...
python
#!/bin/python3 import math count = 0 def count_inversions(a): length = len(a) if (length <= 1): return a else: midP = int(math.floor(length / 2)) left = a[:midP] right = a[midP:] return merge(count_inversions(left), count_inversions(right)) def merge(left, right)...
python
import sklearn from sklearn.linear_model import Perceptron from sklearn.datasets import load_iris import pandas as pd import numpy as np import matplotlib.pyplot as plt # load data iris = load_iris() df = pd.DataFrame(iris.data, columns=iris.feature_names) df['label'] = iris.target df.columns = [ 'sepal length', ...
python
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """A basic unit test for the Python interface of the BMG C++ Graph.infer method""" import unittest import beanmachine.ppl as bm from beanma...
python
# this brainfuck source code from https://github.com/kgabis/brainfuck-go/blob/master/bf.go # and karminski port it to PHP # and is ported to Python 3.x again # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import sys class Brainfuck: # operators op_inc_dp = 1 op_dec_...
python
import os import platform import getpass if(platform.system() == "Windows"): os.system("cls") print(" _") print("__ _____| | ___ ___ _ __ ___ ___ ") print("\ \ /\ / / _ \ |/ __/ _ \| '_ ` _ \ / _ \ ") print(" \ V V / __/ | (_| (_) | | | | | | __/ ") print(" \_...
python
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 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 limitat...
python
"""Utility code for argparse""" import argparse import yaml #class StoreDictKeyPair(argparse.Action): # """An action for reading key-value pairs from command line""" # def __call__(self, parser, namespace, values, option_string=None): # my_dict = {} # for kv in values.split(","): # k,v ...
python
# datastore transations and methods from sqlalchemy.orm import load_only from sqlalchemy.sql import text def count_records(session, model, **kwargs): row_count = session.query(model).filter_by(**kwargs).count() return row_count def delete_record(session, model, **kwargs): instance = session.query(model...
python
import rclpy from rclpy.node import Node from rclpy.qos import qos_profile_sensor_data from sensor_msgs.msg import Image # Image is the message type import cv2 # OpenCV library from cv_bridge import CvBridge # Package to convert between ROS and OpenCV Images import numpy as np # Naming the Output window windowname = ...
python
from random import randint import pygame as pg from scripts import constants as const class Bird(pg.sprite.Sprite): SIZE = const.SPRITE_SIZE[0] MIN_SPEED = 1 MAX_SPEED = 10 def __init__(self, bird_image): pg.sprite.Sprite.__init__(self) self.image = bird_image self.rect = sel...
python
""" Example showing for tkinter and ttk how to do: -- Simple animation -- on a tkinter Canvas. References: -- https://effbot.org/tkinterbook/canvas.htm This is the simplest explanation, but very old and possibly somewhat out of date. Everywhere that it says "pack" use "grid" instead. -- Th...
python
class LinkedList: def __init__(self, head): self.head = head self.current_element = self.head # Node navigation def next(self): if self.current_element.next is None: return self.current_element = self.current_element.next def go_back_to_head(self): ...
python
import pandas as pd import os import subprocess as sub import re import sys from Bio import SeqUtils import matplotlib.pyplot as plt import numpy as np from scipy import stats # path = os.path.join(os.path.expanduser('~'),'GENOMES_BACTER_RELEASE69/genbank') path = "." # ['DbxRefs','Description','FeaturesNum','assemb...
python
from flask import * from flask_sqlalchemy import SQLAlchemy from sqlalchemy.schema import Sequence app = Flask(__name__, static_url_path='/static') #referencing this while app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///App.sqlite3' app.config['SECRET_KEY'] = "secret key" app.config['SQLALCHEMY_TRACK_MODIFICATIONS']...
python
from __future__ import print_function from __future__ import absolute_import from __future__ import division import scriptcontext as sc import compas_rhino from compas_ags.rhino import SettingsForm from compas_ags.rhino import FormObject from compas_ags.rhino import ForceObject __commandname__ = "AGS_toolbar_displa...
python
class DianpingConfig: def __init__(self): self.instance_name = "BERTModel.pt" self.model_name = self.instance_name self.BERT_MODEL = "bert-base-chinese" self.max_sent_lens = 64 class SSTConfig: def __init__(self): self.instance_name = "BERTModel.pt" self.model_na...
python
from __future__ import unicode_literals from djangobmf.apps import ContribTemplate class EmployeeConfig(ContribTemplate): name = 'djangobmf.contrib.employee' label = "djangobmf_employee"
python
import eel try: from pyfirmata import Arduino, util except: from pip._internal import main as pipmain pipmain(['install','pyfirmata']) from pyfirmata import Arduino, util #Get Operating System Type import platform currentOs = platform.system() if "linux" in currentOs.lower(): curr...
python
from sys import argv script, filename=argv print(f"We're going to erase{filename}.") print("If you don't want that,hit CTRL-C(^C).") print("If you do want that,hit RETURN.") input("?") print("Opening the file..") target=open(filename,'w') print("Truncating the file,Goodbye!") target.truncate() print("Now I'm goin...
python
# =============================================================================== # # # # This file has been generated automatically!! Do not change this manually! # # ...
python
#MenuTitle: Check glyphsets match across open fonts ''' Find missing glyphs across fonts ''' def main(): fonts = Glyphs.fonts glyphsets = {} try: for font in fonts: if font.instances[0].name not in glyphsets: glyphsets[font.instances[0].name] = set() ...
python
initial = """\ .|||.#..|##.#||..#.|..|..||||..#|##.##..#...|..... .|#.|#..##...|#.........#.#..#..|#.|#|##..#.#|..#. #....#|.#|.###||..#.|...|.|.#........#.|.#.#|..#.. |..|#....|#|...#.#..||.#..||......#.........|....| .|.|..#|...#.|.###.|...||.|.|..|...|#|.#..|.|..|.| #.....||.#..|..|..||#.||#..|.||..||##.......#........
python
from group import GroupTestCases from user import UserTestCases from permission import PermissionTestCases from core import *
python
''' Defines the training step. ''' import sys sys.path.append('tfutils') import tensorflow as tf from tfutils.base import get_optimizer, get_learning_rate import numpy as np import cv2 from curiosity.interaction import models import h5py import json class RawDepthDiscreteActionUpdater: ''' Provides the training s...
python
''' Given an array of integers, there is a sliding window of size k which is moving from the left side of the array to the right, one element at a time. You can only interact with the k numbers in the window. Return an array consisting of the maximum value of each window of elements. ''' def sliding_window_max(arr, k)...
python
# terrascript/provider/chanzuckerberg/snowflake.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:27:17 UTC) import terrascript class snowflake(terrascript.Provider): """Terraform provider for managing Snowflake accounts""" __description__ = "Terraform provider for managing Snowflake account...
python
def move_tower(height, from_pole, middle_pole, to_pole): if height >= 1: move_tower(height-1, from_pole, to_pole, middle_pole) print "move disk from {} to {}".format(from_pole, to_pole) move_tower(height-1, middle_pole, from_pole, to_pole)
python
from getratings.models.ratings import Ratings class NA_Karthus_Mid_Aatrox(Ratings): pass class NA_Karthus_Mid_Ahri(Ratings): pass class NA_Karthus_Mid_Akali(Ratings): pass class NA_Karthus_Mid_Alistar(Ratings): pass class NA_Karthus_Mid_Amumu(Ratings): pass class NA_Karthus_Mid_Anivia(Rating...
python
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.24.*, run `git checkout -b 0.24` or switch to the `0.24` branch on GitHub) import mlflow.sklearn import numpy as np class PythonPredictor: def __init__(self, config, python_c...
python
#!/usr/bin/python3 # -*- coding: utf-8 -*- """PyVoiceChanger.""" import sys from datetime import datetime from subprocess import call from time import sleep from PyQt5.QtCore import QProcess, Qt, QTimer from PyQt5.QtGui import QColor, QCursor, QIcon from PyQt5.QtWidgets import (QApplication, QDial, QGraphicsDropSh...
python
from setuptools import setup setup( name='ctab', version='0.1', author='Thomas Hunger', author_email='tehunger@gmail.com', packages=[ 'ctab', ] )
python
""" Methods to setup the logging """ import os import yaml import platform import logging import coloredlogs import logging.config from funscript_editor.definitions import WINDOWS_LOG_CONFIG_FILE, LINUX_LOG_CONFIG_FILE from funscript_editor.utils.config import SETTINGS def create_log_directories(config: dict) -> No...
python
##################################################### # Read active and reactive power from the atm90e32 then # store within mongodb. # # copyright Margaret Johnson, 2020. # Please credit when evolving your code with this code. ######################################################## from FHmonitor.error_handling imp...
python
import torch import numpy as np from torch import Tensor from torch.utils.data import Dataset, DataLoader from torchvision import io from pathlib import Path from typing import Tuple class Wound(Dataset): """ num_classes: 18 """ # explain the purpose of the model # where is it, how big it is, ...
python
#!/usr/bin/python3 def best_score(a_dictionary): if a_dictionary: return max(a_dictionary, key=a_dictionary.get)
python
print("before loop") for count in range(10): if count > 5: continue print(count) print("after loop")
python
"""Application management util tests""" # pylint: disable=redefined-outer-name from types import SimpleNamespace import pytest import factory from django.core.exceptions import ValidationError from django.core.files.uploadedfile import SimpleUploadedFile from mitol.common.utils import now_in_utc from applications.api...
python
# -*- coding: utf-8 -*- """ Copyright (c) 2020. Huawei Technologies Co.,Ltd.ALL rights reserved. This program is licensed under Mulan PSL v2. You can use it according to the terms and conditions of the Mulan PSL v2. http://license.coscl.org.cn/MulanPSL2 THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHO...
python
# -*- coding: utf-8 -*- # @Time : 2022/2/20 # @Author : Zhelong Huang # @File : client2.py # @Description: client2 _POS = 2 import os, sys sys.path.append(os.path.abspath('.')) from coach import LoadCoach import argparse arg = argparse.ArgumentParser() arg.add_argument('-r', '--render', default=True...
python
# A non-empty zero-indexed array A consisting of N integers is given. # # A permutation is a sequence containing each element from 1 to N once, and # only once. # # For example, array A such that: # A = [4, 1, 3, 2] # is a permutation, but array A such that: # A = [4, 1, 3] # is not a permutation, because value...
python
"""Flexmock public API.""" # pylint: disable=no-self-use,too-many-lines import inspect import re import sys import types from types import BuiltinMethodType, TracebackType from typing import Any, Callable, Dict, Iterator, List, NoReturn, Optional, Tuple, Type from flexmock.exceptions import ( CallOrderError, E...
python
import bs4 import re from common import config # Regular expresion definitions is_well_former_link = re.compile(r'^https?://.+$') is_root_path = re.compile(r'^/.+$') def _build_link(host, link): if is_well_former_link.match(link): return link elif is_root_path.match(link): return '{}{}'.form...
python
''' Created on Apr 4, 2016 @author: Noe ''' class MyClass(object): ''' classdocs ''' def __init__(self, params): ''' Constructor '''
python
#!/usr/bin/python from __future__ import absolute_import, division, print_function, unicode_literals import pi3d import ConfigParser from PIL import Image import sys #read config Config = ConfigParser.ConfigParser() Config.read("config.ini") xloc = int(Config.get("client",'x_offset')) yloc = int(Config.get("client"...
python
#!/usr/bin/python3 # -*- coding: utf-8 -*- import sys def solve(s): open_p = ('[', '{', '(') close_p = (']', '}', ')') pair = dict(zip(close_p, open_p)) # key: close_p stack = list() for c in s: if c in open_p: stack.append(c) if c in close_p: if len(stack...
python
import aiohttp import os import pytest from tokki.travis import TravisClient from tokki.enums import Status TOKEN = os.environ["TRAVISCI_TOKEN"] AGENT = "Tests for Tokki +(https://github.com/ChomusukeBot/Tokki)" @pytest.mark.asyncio async def test_no_login(): with pytest.raises(TypeError, match=r": 'token'"): ...
python
import argparse parse = argparse.ArgumentParser(description="test") parse.add_argument('count' , action='store' , type = int) parse.add_argument('units',action='store') parse.add_argument('priseperunit' , action= 'store') print(parse.parse_args())
python
#!/usr/bin/env python3 import numpy import cv2 import math from entities.image import Image from entities.interfaces.scene_interface import SceneInterface from entities.aligned.aligned_band import AlignedBand from entities.aligned.aligned_image import AlignedImage from entities.aligned.aligned_true_color import Aligne...
python
import os import json import scipy.io import pandas import itertools import numpy as np from PIL import Image from collections import OrderedDict info = OrderedDict(description = "Testset extracted from put-in-context paper (experiment H)") licenses = OrderedDict() catgs = ['airplane','apple','backpack','banana',...
python
# See https://michaelgoerz.net/notes/extending-sphinx-napoleon-docstring-sections.html # # -- Fixing bug with google docs showing attributes------------- from sphinx.ext.napoleon.docstring import GoogleDocstring # first, we define new methods for any new sections and add them to the class def parse_keys_section(self,...
python
import re import random import string from django import template from django.template import Context from django.template.loader import get_template from django.contrib.auth.models import Group from django.core.exceptions import PermissionDenied from crm.models import Person from cedar_settings.models import General...
python
import os from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404 from django.core.urlresolvers import reverse from django.conf import settings from django.core.exceptions im...
python
''' Do a parcel analysis of the sounding and plot the parcel temperature ''' from __future__ import print_function, division from SkewTplus.skewT import figure from SkewTplus.sounding import sounding from SkewTplus.thermodynamics import parcelAnalysis, liftParcel #Load the sounding data mySounding = sounding("./exa...
python
from cmath import exp, pi, sin from re import I import matplotlib.pyplot as mplt def FFT(P): n = len(P) if n == 1: return P else: w = exp((2.0 * pi * 1.0j) / n) Pe = [] Po = [] for i in range(0, n, 2): Pe.append(P[ i ]) for i in range(1, n, 2...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-04-15 18:21 # @Author : erwin import pandas as pd import numpy as np from common.util_function import * ''' 缺失值处理 1. 采用均值/出现次数设置missing值。对于一列数字,要获取平均值。 2. 对于一列非数字,例如字符,要找到出现频率最高的字符赋值给missing值 3. 删除缺失值 http://pandas.pydata.org/pandas-docs/stable/generate...
python
""" The sys command to manage the cmd5 distribution """ import glob import os import shutil from cloudmesh.common.util import path_expand from cloudmesh.shell.command import PluginCommand from cloudmesh.shell.command import command from cloudmesh.sys.manage import Command, Git, Version class SysCommand(PluginCommand...
python
import numpy as np from pypadre.pod.app import PadreApp from sklearn.datasets import load_iris from pypadre.examples.base_example import example_app # create example app padre_app = example_app() def create_experiment1(app: PadreApp, name="", project="", auto_main=True): @app.dataset(name="iris", ...
python
import socket import pickle import struct import argparse def send_msg(sock, msg): msg_pickle = pickle.dumps(msg) sock.sendall(struct.pack(">I", len(msg_pickle))) sock.sendall(msg_pickle) print(msg[0], 'sent to', sock.getpeername()) def recv_msg(sock, expect_msg_type = None): msg_len = struct.un...
python
""" NetCDF Builder This is currently a test script and will eventuall be made into a module """ #============================================================================== __title__ = "netCDF maker" __author__ = "Arden Burrell (Manon's original code modified)" __version__ = "v1.0(02.03.2018)" __email__ ...
python
lista = enumerate('zero um dois três quatro cinco seis sete oito nove'.split()) numero_string=dict(lista) string_numero={valor:chave for chave,valor in numero_string.items()} print (numero_string) print(string_numero) def para_numeral(n): numeros=[] for digito in str(n): numeros.append(numero_...
python
# -*- coding: utf-8 -*- """ Created on Fri Mar 20 00:59:05 2020 @author: Leonardo Saccotelli """ import numpy as np import AlgoritmiAlgebraLineare as al #------------------- TEST MEDOTO DI ELIMINAZIONE DI GAUSS #Dimensione della matrice n = 5000 #Matrice dei coefficienti matrix = np.random.random((n, n)).astype(f...
python
"""Lists out the inbuilt plugins in Example""" from src.example_reporter import ExampleReporter from src.example_tool import ExampleTool def get_reporters() -> dict: """Return the reporters in plugin""" return { "example-reporter": ExampleReporter, } def get_tools() -> dict: """Return the to...
python