text
string
size
int64
token_count
int64
from PIL import Image def img2coe(name): img = Image.open(name) img = img.convert("1") width, height = img.size output_file = name.split('.')[0] + ".coe" f = open(output_file, "w") # using the 16, so change radix to 16, can be 2(binary), 10(decimal), 16(hex) f.write("memory_initializat...
826
316
# faça um programa que mostre a tabuada de varios numeros # um de cada vez, para cada valor digitado # o programa sera interrompido quando for solicityado um numero negativo while True: multiplicado = int(input('Digite um numero para ver sua tabuada: ')) for tab in range(1, 11): print(f'{multiplicado}x...
473
161
# Generated by Django 3.2 on 2021-05-01 14:42 from django.db import migrations, models import easy_thumbnails.fields import embed_video.fields class Migration(migrations.Migration): dependencies = [ ('events', '0001_initial'), ] operations = [ migrations.AddField( model_name...
818
250
import numpy as np from scipy.io import loadmat import os import logging from scipy.signal import butter, filtfilt def mat2npy(mat_chanmap_dir): mat_chanmap = loadmat(mat_chanmap_dir) x = mat_chanmap['xcoords'] y = mat_chanmap['ycoords'] npy_chanmap = np.hstack([x,y]) #np.save('chanmap.npy', n...
6,748
2,103
# 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. import copy import contextlib import torch import torch.nn.functional as F from typing import List, Tuple, Dict, Optional from transformers imp...
9,024
3,245
import pathlib import numpy as np from dambreak import Experiment2D from plot import plot2D, plot3D, quiver #%% Initial condition def h0_(x, y, x0, y0, h0): H = np.zeros_like(x) idx = np.array((x <= x0) & (y <= y0)) H[idx] = h0 return H #%%Parameters h_0 = 40 x0 = 1000 y0 = 1000 L = 2000 T = 40 Nx = 100 Ny = ...
3,250
1,802
# 聚类 # 需要移除远处点 import open3d as o3d import numpy as np import matplotlib.pyplot as plt sourcePath="./zz_test_panda/scene/integrated.ply" tatgetPath="./zz_test_panda/scene/cropped_1.ply" # 加载点云 print("Load a ply point cloud, print it, and render it") pcd = o3d.io.read_point_cloud(sourcePath) with o3d.utility.Verbosi...
1,025
547
import random def coinflip(): # print(random.random()) return random.random()
86
26
#多分支结构 score=int(input('请输入成绩')) #判断 if score>=90 and score<=100: print('A') elif score>=80 and score<=89: print('B') elif score>=70 and score<=79: print('C') elif score>=60 and score<=69: print('D') elif score>=0 and score<=59: print('E') else: print('无效')
295
140
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved. # This work is licensed under the NVIDIA Source Code License - Non-commercial. Full # text can be found in LICENSE.md import sys import cv2 import time from .sdf_utils import * import _init_paths from fcn.config import cfg from layers.sdf_matching_loss impo...
8,126
3,154
from pymunk.vec2d import Vec2d from src.utils import AngleHelper import pymunk class Map: def __init__(self): self.crossings = [] self.streets = [] self.STREET_WIDTH = 50 self.SIDEWALK_WIDTH = 60 self.sidewalk_crossings = [] self.sidewalks = [] self.distance...
10,563
3,162
from __future__ import annotations import asyncio import logging from custom_components.magic_lights.setup_tasks.task import SetupTask from custom_components.magic_lights.helpers.service_call import create_async_call from typing import Dict, Tuple from custom_components.magic_lights.magicbase.share import get_magic f...
2,110
705
import dash_html_components as html import dash app = dash.Dash(__name__) style_div = {'display': 'flex','flex-wrap': 'wrap', 'padding':'20px'} style_text = {'width': '500px', 'padding':'20px'} div_octo = html.Div([ html.Div([html.Img(src=app.get_asset_url('planet1.jpg'), width="500px")]), html.Div([ ...
2,382
811
""" network_diagram.py """ from ipfabric_diagrams import IPFDiagram, Network, NetworkSettings, VALID_NET_PROTOCOLS, Layout if __name__ == '__main__': ipf = IPFDiagram() net = Network(sites=['MPLS', 'LAB01'], all_network=True) json_data = ipf.diagram_json(net) model_data = ipf.diagram_model(net) w...
1,405
514
from msteams.adaptivecard.containers.layout import Layout class FactSet(Layout): """ FactSet element displays a series of facts (i.e. name/value pairs) in a tabular form """ FACTS = 'facts' def __init__(self, spacing=None, separator=None): """ :param spacing: amount of spacing ...
878
254
import os import uuid import warnings import datarobot as dr import pytest from dr_usertool.datarobot_user_database import DataRobotUserDatabase from dr_usertool.utils import get_permissions from tests.drum.constants import TESTS_DATA_PATH, PUBLIC_DROPIN_ENVS_PATH ENDPOINT_URL = "http://localhost/api/v2" def dr_us...
6,057
2,016
# -*- coding: utf-8 -*- # # Copyright (c) 2017 F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import sys from nose.plugins.skip import SkipTest i...
5,464
1,566
import pyautogui pyautogui.moveTo(2317, 425, duration=1)
58
31
from openweather_pws import Station, Measurements
50
15
""" MIT License Copyright (c) 2021 Jake Sichley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
2,731
901
import unittest import paddle import neural_renderer_paddle as nr class TestLighting(unittest.TestCase): def test_case1(self): """Test whether it is executable.""" faces = paddle.randn([64, 16, 3, 3], dtype=paddle.float32) textures = paddle.randn([64, 16, 8, 8, 8, 3], dtype=paddle.fl...
415
162
''' Created on 04.10.2019 @author: areb ''' import pycebox.ice as pIce from Connections.predictor import * import matplotlib.pyplot as plt from InterpretationTechniques.PlotAndShow import * # https://github.com/AustinRochford/PyCEbox/blob/master/pycebox/ice.py def plotIce(data, pr): ''' :param data: pandas da...
4,709
1,797
''' Created on Sep 4, 2015 @author: Amol ''' from feedparser import parse import re from itertools import groupby #Remove HTML and get the remaining words def getwords(html): txt = re.compile(r'<[^>]+>').sub('', html) words = re.compile(r'[^A-Z^a-z]+').split(txt) return [word.lower() for word in words if...
2,253
739
# -*- coding: utf-8 -*- __author__ = "Roman Chernikov" __date__ = "08 Mar 2016" #import pickle import numpy as np #import matplotlib.pyplot as plt import os, sys; sys.path.append(os.path.join('..', '..', '..')) # analysis:ignore import xrt.backends.raycing as raycing import xrt.backends.raycing.sources as rs import ...
2,904
1,231
# -*- coding: utf-8 -*- """ Created on Fri Nov 27 08:09:11 2020 @author: Tin """ # Plot Candlestick in bokeh import pandas as pd # Dataframe Library from math import pi from bokeh.plotting import figure, show, output_file pd.set_option('max_columns', None) # To show all columns import yfinance as yf yf...
1,277
578
# # elephant.py # from threading import Thread from adafruit_servokit import ServoKit from gpiozero import LED,Button,Servo import time import random import board import neopixel import subprocess import os.path print("Initializing...") # pin definitions PIN_LEFT_EYE = 17 PIN_LEFT_BROW = 23 PIN_RIGHT_EYE = 27 PIN_RI...
7,124
2,703
# -*- coding: utf-8 -*- r""" ================================================================ Morphing source estimates: Moving data from one brain to another ================================================================ Morphing refers to the operation of transferring :ref:`source estimates <sphx_glr_auto_tutorial...
10,954
3,263
""" Citing from jasper from Nvidia """ import torch import torch.nn as nn import torch.functional as F class SubBlock(nn.Module): def __init__(self, dropout): super(SubBlock, self).__init__() self.conv = nn.Conv1d(in_channels=256, out_channels=256, kernel_size=11...
680
251
import pandas as pd # Load the original csv df = pd.read_csv('data/carto.csv') # Group by name of borough # The output is a list of tuples with ('name of borough', dataframe of that borough) grouped = list(df.groupby('location_name')) for x in grouped: # Get the name of the borough name_of_borough = x[0] ...
513
172
from pm4pymdl.algo.mvp.gen_framework.rel_activities import classic, rel_activities_builder
91
32
import torch import hashlib import dataclasses import numpy as np from typing import List, Tuple, final from .misc import collate_tensors_with_variable_shapes, CollateData, inverse_permutation from .tensors_data_class_base import TensorsDataClass from .mixins import HasTargetIndexingGroupMixin __all__ = ['BatchedFla...
5,047
1,565
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
2,761
928
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def calculadora(request): context = { 'titulo' : "Ingrese los numeros", } return render(request,'operaciones/formulario.html',context) def resultado(request): a=request.POST['numeroa'] b=req...
1,404
470
''' Nicolas Lindbloom-Airey turn.py This file is entirely devoted to the do_turn(Battle) method. One call of do_turn does all the logic for a single turn. Functions defined in this file are: * functions are are only called in the do_turn method. Functions called by run_move are called only once per run_move call...
40,552
13,669
import ocl import camvtk import time import vtk import datetime import math import random def drawVertex(myscreen, p, vertexColor, rad=1): myscreen.addActor( camvtk.Sphere( center=(p.x,p.y,p.z), radius=rad, color=vertexColor ) ) def drawEdge(myscreen, e, edgeColor=camvtk.yellow): p1 = e[0] p2 = e[1] ...
8,936
4,362
from torch.optim.lr_scheduler import _LRScheduler class WarmupScheduler(_LRScheduler): def __init__(self, optimizer, epochs, next_scheduler): self.epochs = epochs self.next_scheduler = next_scheduler super(WarmupScheduler, self).__init__(optimizer) def get_lr(self): if self.la...
760
253
import deeplabcut as dlc import os from fcutils.file_io.utils import listdir # from fcutils.video.utils import trim_clip config_file = 'D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\dlc\\locomotion-Federico\\config.yaml' dlc.train_network(config_file) # fld = 'D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion...
763
352
#!/usr/bin/env python import argparse, shutil, os, sys def getArgs(): parser = argparse.ArgumentParser() parser.add_argument('app', help='Application identifier (used by the app developer)') parser.add_argument('mipDir', help='Directory containing the mip application (<path>/app/)') return parser.parse_args() ...
5,290
2,158
#!/usr/bin/env python from setuptools import setup version = '0.1.2' long_description = """ # flow This project implements basic Normalizing Flows in PyTorch and provides functionality for defining your own easily, following the conditioner-transformer architecture. This is specially useful for lower-dimensional...
1,846
537
from flask import Flask from .storage_blueprint import bp_storage from .tattooists_blueprint import bp_tattooists from .tattoos_blueprint import bp_tattoos from .clients_blueprint import bp_clients def init_app(app: Flask) -> None: ''' Registra as blueprints ''' app.register_blueprint(bp_storage) app.re...
430
153
#20080518 #20080519 import mPDF import time import zlib import sys if len(sys.argv) != 2: print "Usage: make-pdf-helloworld pdf-file" print " " print " Source code put in the public domain by Didier Stevens, no Copyright" print " Use at your own risk" print " https://DidierStevens...
692
334
import pytest from dnaio import Sequence from cutadapt.adapters import Adapter, Match, Where, LinkedAdapter def test_issue_52(): adapter = Adapter( sequence='GAACTCCAGTCACNNNNN', where=Where.BACK, remove='suffix', max_error_rate=0.12, min_overlap=5, read_wildcards=...
5,969
2,376
from typing import List, Optional from pydantic import BaseModel class Provider(BaseModel): url: str name: str roles: Optional[List[str]] = None
160
49
#!/bin/python3 import os # # Complete the 'solve' function below. # # The function is expected to return an INTEGER_ARRAY. # The function accepts following parameters: # 1. 2D_INTEGER_ARRAY tree # 2. 2D_INTEGER_ARRAY queries # def solve(tree, queries): # Write your code here from bisect import bisect_righ...
1,909
723
from unittest import TestCase from kabob import _ class KabobTestCase(TestCase): def _T(self, obj, kbb): from kabob.wand import Kabob self.assertIsInstance(kbb, Kabob) return [x for x in kbb(obj)] class TestKabob(KabobTestCase): def test_contains(self): fixture = [dict(bar=1...
2,598
1,020
load("//flatbuffers/internal:string_utils.bzl", "capitalize_first_char") def _include_args_from_depset(includes_depset): # Always include the workspace root. include_args = ["-I", "."] for include in includes_depset.to_list(): include_args.append("-I") include_args.append(include) retur...
1,336
441
#!usr/bin/python2.7 # coding=utf-8 ####################################################### # Name : Multi BF (MBF) <cookie method> # # File : search_name.py # # Author : DulLah # # Github : https://github.com/dz-id # # Fa...
2,412
1,008
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
26,619
7,704
import os from distutils.core import setup def read(*paths): """Build a file path from *paths* and return the contents.""" with open(os.path.join(*paths), 'r') as f: return f.read() DESCRIPTION = ("Library for solving, simulating, and estimating the " + "Solow (1956) model of economic...
1,324
383
#!/usr/bin/env python3 # Copyright (c) 2021, harens # # 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...
3,236
1,032
#!/usr/bin/env python # # Raman off-resonant activity calculator # using CRYSTAL as a back-end. # # Contributors: Alexandr Fonari (Georgia Tech) # MIT license, 2013 # # def parse_fort34_header(fort34_fh): import sys from math import sqrt # fort34_fh.seek(0) # just in case # header = [fort34_fh.n...
12,020
4,240
# # Copyright (c) 2021 Idiap Research Institute, https://www.idiap.ch/ # Written by Andreas Marfurt <andreas.marfurt@idiap.ch> # """ Computes the proportion of novel bigrams in the summary. """ import numpy as np import pandas as pd from interface import Evaluation from eval_utils import preprocess_article, preproce...
2,281
707
import argparse import channel_access.common as ca import channel_access.client as cac if __name__ == '__main__': parser = argparse.ArgumentParser(description='Read process values') parser.add_argument('pvs', metavar='PV', type=str, nargs='+', help='list of process values') args ...
2,003
503
from scipy.special import factorial from itertools import count import numpy as np from tmps.utils import pauli, fock def get_boson_boson_dim(alpha, cutoff_coh): """ Find the cutoff for the local dimension (identical everywhere) from the chosen accuracy alpha for the impurity coherent state. "...
6,975
2,474
#!/usr/bin/env python import os import time class Logbook(object): def __init__(self): """ Class initialization """ self._id = time.strftime("%d%m%Y_%H%M%S", time.gmtime()) #id of the log, it's the timestamp self._trial = 0 self._pinv = 0.0 self._rinv = 0.0...
2,564
806
# python experimental tests for Husky from numpy import sin, cos, pi, load import matplotlib.pyplot as plt from time import sleep yaw_bound = 2 * pi / 180 yaw_calibrate = pi / 180 * (0) x_offset_calibrate = 0 y_offset_calibrate = -.08 f0 = plt.figure() ax0 = f0.add_subplot(111) ax1 = f0.add_subplot(111) env_data = ...
6,346
2,773
from sys import stderr from study.models import Result, ActiveTranslation def update_score(learner, result, verified=False): """ Update the score after a phrase has been judged. :param result: Result.CORRECT, Result.CLOSE or Result.INCORRECT :return: Result instance """ if result == Result.CORRECT: base =...
1,770
568
from pathlib import Path from moonleap import add, create from titan.project_pkg.service import Tool from titan.react_pkg.nodepackage import load_node_package_config class Prettier(Tool): pass base_tags = [("prettier", ["tool"])] @create("prettier") def create_prettier(term, block): prettier = Prettier(n...
477
163
#!/usr/bin/env python """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ import sys from readmemaker import ReadmeMaker PROJECT_NAME = "tabledata" OUTPUT_DIR = ".." def main(): maker = ReadmeMaker( PROJECT_NAME, OUTPUT_DIR, is_make_toc=True, project_url=f"...
787
299
#! /usr/bin/env python from expired_cert_finder.plugins.raw import RawParser from expired_cert_finder.plugins.yaml import YamlParser from expired_cert_finder.allowed_certs import AllowedCerts rawParser = RawParser yamlParser = YamlParser # handle dynamic loading. def scan_file_for_certificate(path, expired_only, d...
1,860
529
"""Processing modules This package contains image processing algorithms. """ from . import compositing from . import filtering from . import transform
153
35
import unittest from mock import Mock from foundations_spec.helpers.spec import Spec from foundations_spec.helpers import let, let_mock, set_up class TestLazyBucket(Spec): @let def lazy_bucket(self): from foundations_contrib.lazy_bucket import LazyBucket return LazyBucket(self.bucket_constru...
3,128
1,020
from abc import ABC import torch.nn as nn class CNN5(nn.Module, ABC): def __init__(self): super(CNN5, self).__init__() # torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding) # torch.nn.MaxPool2d(kernel_size, stride, padding) # input 維度 [3, 128, 128] self...
1,557
795
"""Top-level package for Calendário dos Vestibulares do Brasil.""" __author__ = """Ana_Isaac_Marina""" __email__ = 'marinalara170303@gmail.com' __version__ = '0.0.1'
167
71
from utils import BaseHandler class FaqHandler(BaseHandler): """Handler for FAQ page.""" def get(self): """Handler GET requests.""" # print "Get current get_user" # print self.get_user() # if not self.get_user(): # self.transient_student = True #This if statement will let the non-student un...
776
253
import unittest from cloudrail.knowledge.context.aws.aws_connection import PublicConnectionDetail, PolicyConnectionProperty, ConnectionDirectionType from cloudrail.knowledge.context.aws.ec2.ec2_instance import Ec2Instance from cloudrail.knowledge.context.aws.ec2.network_interface import NetworkInterface from cloudrail...
2,866
873
from setuptools import setup from glob import glob import shutil import sys import os # single source of truth for package version version_ns = {} with open(os.path.join("lolopy", "version.py")) as f: exec(f.read(), version_ns) version = version_ns['__version__'] # Find the lolo jar JAR_FILE = glob(os.path.join('...
1,967
674
import pandas as pd from typing import Dict, List import numpy as np import pylab as plt def compute_trajectory_features_set1(aligned_trajector_key_file: pd.DataFrame, parameters: Dict, start_time, end_time): features_df = pd.DataFrame() data_statistics_df = pd.DataFrame() counter = 0 frame_interval =...
5,254
1,651
#!/usr/bin/python3 # # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # # 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 # # Un...
22,421
7,712
# Generated by Django 3.2.8 on 2021-10-28 18:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('vaksinasi', '0002_alter_pendaftar_nik'), ] operations = [ migrations.AlterField( model_name='pendaftar', name='NIK',...
703
220
# node class for develping linked list class Node: def __init__(self, data=None, pointer=None): self.data = data self.pointer = pointer def set_data(self, data): self.data = data def get_data(self): return self.data def set_pointer(self, pointer): ...
1,991
686
#!/usb/bin/env python3 """Demo script for abp.spherical2d.pairdistribution module.""" __author__ = "Julian Jeggle, Raphael Wittkowski" __copyright__ = "Copyright (C) 2019 Julian Jeggle, Raphael Wittkowski" __license__ = "MIT" __version__ = "1.0" import argparse import numpy as np import matplotlib.pyplot as plt fro...
2,562
1,034
import PyPDF2 import fitz import io from PIL import Image import os import random import string import pikepdf from tqdm import tqdm from zipfile import ZipFile from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter from pathlib import Path """ Converts entire PDF to set of disjoint PNG images...
12,481
4,075
# Python Standard Libraries import warnings # grAdapt # from .base import Equidistributed from .MaximalMinDistance import MaximalMinDistance class Mitchell(MaximalMinDistance): """ [Mitchell et al., 1991], Spectrally optimal sampling for distribution ray tracing """ def __init__(self, m=3): ...
1,902
503
import os from poly_py_tools.dialplan_entry import Entry from poly_py_tools.polypy_config import PolypyConfig class Payload: dialplan_entry = None provisioned_directory = None config = None sources = None def __init__(self, config:PolypyConfig, dialplan_entry: Entry): self.dialplan_entr...
1,141
377
from ml_tools import CosineEstimator, Similars from ml_tools.fixtures import articles import numpy as np corpus = articles() split_ = len(corpus)//3 x, y = corpus[split_:], corpus[:split_] # note reversal; x should be smaller x, y = Similars(x, y).embed().value() def test_cosine_estimator(): dnn = CosineEstimat...
549
202
from application.euclidean_distance import euclidean_distance def test_euclidean_distance(): point_a = (0, 0) point_b = (3, 4) distance_between_a_and_b = euclidean_distance(point_a, point_b) assert distance_between_a_and_b == 5 point_c = (-2, 3) point_d = (2, 3) distance_between_c_and_...
402
157
import numpy as np class Material: """send color as list of 3 floats in range of 0-1""" def __init__(self, color, reflection=0, transparency=0, emission=np.array((0, 0, 0)), refraction_ind=1): self.color = np.array(color) self.emission = emission # only for light sources self.reflect...
423
133
import math import sys import torch from torch import nn import models.drn as drn # class Decoder(nn.Module): # # def __init__(self, # output_channels = 3, # ): # # self.output_channels = 3 # # # DEFINING MODEL AS COMPLEMENT OF BASE CHOSEN FOR DRN # # self...
4,599
1,461
from flask import request, render_template import json import traceback import lib.es as es import web.util.tools as tools import web.modules.post.services.workflow as workflow import web.modules.post.services.upload as upload import web.util.jinja as jinja import web.modules.admin.services.notification as notification...
5,686
1,582
"""This module provies the main Bot class""" import time import traceback import json import threading import sched from fbchat import models from ._fbclient import Client from ._logs import log from .dataclasses import Thread from .handlers import BaseHandler from ._i18n import _ class Bot(object): """Main St...
7,096
1,818
import pandas as pd from torch.utils.data import DataLoader import multiprocessing as mp import argparse from DataSet import Dataset import torch import torch.nn as nn from os import path import Infer device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') cpu = torch.device('cpu') parser = argparse.A...
5,296
2,016
#!/usr/bin/env python3 import re import sys import io import os import traceback class TextPreprocessorError(Exception): def __init__(self, file_id, line, msg): super().__init__(f"{file_id}:{line}: {msg}") def debug_print(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def preprocess( ...
1,842
573
from .resnet50 import ResNet50
30
12
from datetime import datetime, timezone from io import StringIO from unittest import mock import freezegun import pytest from django.conf import settings from django.core.management import call_command from django.utils import timezone from model_bakery import baker from supportal.app.common.enums import CanvassResul...
14,354
4,949
import gym from gym import error, spaces, utils from gym.utils import seeding from eplus.envs import pyEp import socket from eplus.envs.socket_builder import socket_builder import numpy as np import os class DataCenterEnv(gym.Env): def __init__(self, config): #timestep=12, days=1, eplus_path=None, ...
9,128
2,900
print("hello") while True: print("Infinite loop")
55
19
__version__ = '0.1.6' __mod_name__ = 'srblib' from .colour import Colour # A class with color names and a static print function which prints coloured output to stderr from .debugger import debug # a boolean whose value can be changed in ~/.config/srblib/debug.json from .debugger import on_appveyor # a boolean value ...
3,568
916
""" Copyright (c) 2018 Jet Propulsion Laboratory, California Institute of Technology. All rights reserved """ import json from msfbe.webmodel import BaseHandler, service_handler import requests import psycopg2 class CountiesColumns: COUNTY_ID = 0 NAME = 1 AREA = 2 PERIMETER = 3 CACOA = 4 CACO...
2,880
889
import time def tic(): #Homemade version of matlab tic and toc functions global startTime_for_tictoc startTime_for_tictoc = time.time() def toc(): if 'startTime_for_tictoc' in globals(): print("Elapsed time is " + str(time.time() - startTime_for_tictoc) + " seconds.") else: print...
347
126
# This file is automatically generated __version__ = '0.10.3.2' __comments__ = """too many spaces :/ Merge pull request #1848 from swryan/work""" __date__ = '2014-11-15 09:50:34 -0500' __commit__ = '97c66aaecfad3451bc6a0b1cae1fce4c0595037a'
243
128
''' * This Software is under the MIT License * Refer to LICENSE or https://opensource.org/licenses/MIT for more information * Written by ©Kohulan Rajan 2020 ''' from skimage import img_as_float from skimage import io, color, morphology import matplotlib.pyplot as plt def get_skeleton_and_thin(input_image): image =...
779
309
from csv import DictReader from xml.etree import ElementTree as ET def csv2html_robust(txt, header=True, attr=None): # Use DictReader because, despite what the docs say, reader() doesn't # return an object with .fieldnames # (DictReader expects an iterable that returns lines, so split on \n) reader = D...
1,328
456
import os import re import sys import argparse from preprocessing import templatize_sql from utils import DBAgent, check_time_legality __description__ = "Get sql information based on wdr." def parse_args(): parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, ...
2,763
865
""" 文件名:hachina.py. 演示程序,三行代码创建一个新设备. """ def setup(hass, config): """HomeAssistant在配置文件中发现hachina域的配置后,会自动调用hachina.py文件中的setup函数.""" # 设置实体hachina.Hello_World的状态。 # 注意1:实体并不需要被创建,只要设置了实体的状态,实体就自然存在了 # 注意2:实体的状态可以是任何字符串 hass.states.set("hachina.hello_world", "太棒了!") # 返回True代表...
344
229
from simple_ddl_parser.utils import check_spec, remove_par class HQL: def p_expression_location(self, p): """expr : expr LOCATION STRING""" p[0] = p[1] p_list = list(p) p[0]["location"] = p_list[-1] def p_row_format(self, p): """row_format : ROW FORMAT SERDE | ...
4,263
1,613
import json import sys import time from twisted.internet.task import deferLater from twisted.web import http from twisted.web.resource import Resource from twisted.web.server import Site from twisted.internet import reactor from gsmmodem.modem import GsmModem, SentSms from gsmmodem.exceptions import TimeoutException,...
5,627
1,599
# -*- coding: utf-8 -*- from naomi import testutils from . import snr_vad class TestSNR_VADPlugin(testutils.Test_VADPlugin): def setUp(self): super(TestSNR_VADPlugin, self).setUp() self.plugin = testutils.get_plugin_instance( snr_vad.SNRPlugin, self._test_input ) ...
391
133
# Copyright (c) 2019-2022, NVIDIA CORPORATION & 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
13,243
5,040
from django import template import bleach # import the logging library import logging # Get an instance of a logger logger = logging.getLogger(__name__) register = template.Library() @register.filter def sanitize(text): ALLOWED_TAGS = ['p', 'span', 'h5', 'h6'] ALLOWED_ATTRIBUTES = [] ALLOWED_STYLES ...
524
184