text
string
size
int64
token_count
int64
# -*- coding: utf-8; -*- """AST markers for internal communication. *Internal* here means they are to be never passed to Python's `compile`; macros may use them to work together. """ __all__ = ["ASTMarker", "get_markers", "delete_markers", "check_no_markers_remaining"] import ast from . import core, utils, walkers ...
3,418
988
import boto3 import json import numpy as np import base64, os, boto3, ast, json endpoint = 'myprojectcapstone' def format_response(message, status_code): return { 'statusCode': str(status_code), 'body': json.dumps(message), 'headers': { 'Content-Type': 'application/json', ...
1,960
547
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.runtime.opset9 as ov import numpy as np import pytest from tests.runtime import get_runtime from openvino.runtime.utils.types import get_element_type_str from openvino.runtime.utils.types import get_element_type @pytes...
4,097
1,438
from typing import List, Union from pytest import raises from graphql.error import GraphQLError, format_error from graphql.language import Node, Source from graphql.pyutils import Undefined def describe_format_error(): def formats_graphql_error(): source = Source( """ query { ...
2,371
654
# -------------------------------------------------------- # (c) Copyright 2014 by Jason DeLaat. # Licensed under BSD 3-clause licence. # -------------------------------------------------------- import unittest from pymonad.Maybe import Maybe, Just, First, Last, _Nothing, Nothing from pymonad.Reader import curry from ...
6,708
2,314
# Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. __version__ = "0.0.8" # flake8: noqa: F401,F402 from . import errors, events, relation, testing from .relation import EndpointWrapper
210
80
#!/usr/bin/python3 # Fetch torrent sizes # TODO: Report number of files before we go etc import os from torrentool.api import Torrent from fnmatch import fnmatch root = '/opt/radio/collections' pattern = "*.torrent" alltorrentsize = 0 print("Thanks for using The Librarian.") for path, subdirs, files in os.walk(root...
940
305
""" Flask LoginManager plugin. Import and execute ``login.init_app(app)`` in a factory function to use. """ from typing import Any, Callable, TYPE_CHECKING from functools import wraps from flask import redirect, request, url_for, current_app from flask_login import current_user from flask_login.login_manager import...
1,319
387
from tkinter import * from ModeEnum import Mode import SerialHelper import Views.StaticView import Views.CustomWidgets.Silder from ColorEnum import Color from functools import partial from Views.CommandPanel import CommandPanel from Views.ListItem import ListItem from ProcessControl import ProcessManager, ProcessCo...
10,078
2,929
import os import json import tempfile import shutil import unittest from sarpy.io.complex.sicd import SICDReader from sarpy.io.product.sidd import SIDDReader from sarpy.io.product.sidd_schema import get_schema_path from sarpy.processing.sidd.sidd_product_creation import create_detected_image_sidd, create_dynamic_image...
4,944
1,476
import numpy as np import scipy.sparse as sp from westpa.tools import Plotter # A useful dataclass used as a wrapper for w_ipa to facilitate # ease-of-use in ipython/jupyter notebooks/sessions. # It basically just wraps up numpy arrays and dicts. class WIPIDataset(object): def __init__(self, raw, key): ...
28,213
8,283
import random # use of the random module print(random.random()) # a float value >= 0.0 and < 1.0 print(random.random()*100) # a float value >= 0.0 and < 100.0 # use of the randint method print(random.randint(1, 100)) # an int from 1 to 100 print(random.randint(101, 200)) # an int from 101 to 2...
680
291
from PyInquirer import style_from_dict, Token, prompt, Separator from lnt.graphics.utils import vars_to_string # Mark styles prompt_style = style_from_dict({ Token.Separator: '#6C6C6C', Token.QuestionMark: '#FF9D00 bold', #Token.Selected: '', # default Token.Selected: '#5F819D', Token.Pointer: '#F...
1,385
480
import os import struct import json from time import sleep import hashlib import threading from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM from datetime import * from re import compile import time import logging class SomethingIsWrongWithCamera(Exception): pass class DVRIPCam(object): DATE_FORMAT ...
25,327
7,800
import mock from maildown import renderer import mistune import pygments from pygments import lexers from pygments.formatters import html import premailer import jinja2 def test_highlight_renderer(monkeypatch): monkeypatch.setattr(mistune, "escape", mock.MagicMock()) monkeypatch.setattr(lexers, "get_lexer_by_...
1,373
473
from generator import * from iterator import * def nInput(): while True: try: n = int(input("Enter n(size): ")) if n <= 0: print("Input must be a positive integer!") continue except ValueError: print("Not the correct value n!") ...
1,423
397
from setuptools import setup version = '1.0.10' setup( name='grail', version=version, classifiers=[ 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', ], packages=[ ...
688
201
import os import unittest import tempfile from boltdb import BoltDB class TestFree(unittest.TestCase): def setUp(self): self.db = BoltDB(tempfile.mktemp()) def tearDown(self): os.unlink(self.db.filename) def test_free(self): with self.db.update() as tx: b = tx.bucke...
964
345
#!/usr/bin/python # Copyright (C) International Business Machines Corp., 2006 # Author: Stefan Berger <stefanb@us.ibm.com> # Basic VM creation test from XmTestLib import xapi from XmTestLib.XenAPIDomain import XmTestAPIDomain from XmTestLib import * from xen.xend import XendAPIConstants import commands import os tr...
1,709
668
def format_sql(schedule, table): for week, schedule in schedule.items(): print(f"UPDATE {table} SET `block`=0, `week`={week} WHERE `name`='{schedule.leader}';") for block, staffs in schedule.staffs.items(): for staff in staffs: print(f"UPDATE {table} SET `block`={block}, ...
369
121
"""Fourier transform non-linear Poisson solver""" # This module is concerned with solving the "non-linear Poisson" # equation # Delta(u) = f(u,z) # on a uniform rectangular mesh, with u = u0 on the boundary. # # We solve the equation by an iterative method, solving an # approximation to the linearized equation at ...
9,024
3,020
# -*- coding: utf-8 -*- from datetime import datetime from sqlalchemy.dialects.mysql import LONGTEXT from sqlalchemy.orm import load_only from sqlalchemy import func from flask import abort from markdown import Markdown,markdown from app.models import db,fragment_tags_table from app.models.tag import Tag from app.whoo...
2,853
903
# -*- coding: utf-8 -*- from django.db import migrations, models import django.utils.timezone import django.db.models.deletion from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ('auth', '0006_require_conte...
24,236
6,712
from .constants import SUCCESS_KEY, MESSAGE_KEY, DATA_KEY from cloudygram_api_server.scripts import CGMessage from typing import List class TtModels: @staticmethod def sing_in_failure(message) -> dict: return { SUCCESS_KEY : False, MESSAGE_KEY : message } @staticme...
746
222
import math from mathutils import Euler import bpy from .portal2_entity_classes import * from .portal_entity_handlers import PortalEntityHandler local_entity_lookup_table = PortalEntityHandler.entity_lookup_table.copy() local_entity_lookup_table.update(entity_class_handle) class Portal2EntityHandler(PortalEntityHan...
4,617
1,539
from collections import namedtuple class SSParser: """ Create a SS block from PDB data. Written to be agnostic of PDB parser, but for now only has PyMOL. .. code-block:: python import pymol2 with pymol2.PyMOL() as pymol: pymol.cmd.load('model.pdb', 'prot') ss = ...
3,935
1,323
from django.urls import reverse from Net640.settings import FRONTEND_DATE_FORMAT class AsDictMessageMixin: """ Mixin for representing user messages(post, comments) as dictionaries """ def as_dict(self, executor): return {'content': self.content, 'user_has_like': self.has_like(...
748
225
"""A module for converting a data source to TFRecords.""" import os import json import copy import csv from pathlib import Path from shutil import rmtree import PIL.Image as Image import tensorflow as tf from tqdm import tqdm from .feature import items_to_features from .errors import DirNotFoundError, InvalidDataset...
16,030
4,150
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to non...
2,743
852
import pathlib import datetime path = 'c:/Users/Jacob/PycharmProjects/KryptoSkatt/Data/' trans_in = list() trans_out = list() bitcoin_dict = dict() ethereum_dict = dict() USD_NOK_dict = dict() def unix_time_to_date(timestamp): return datetime.datetime.fromtimestamp(int(timestamp)).strftime('%Y-%m-%d') def popul...
5,335
1,966
import numpy as np import scipy.special as ss import pathlib from Particle import Particle def ql_global(l, particles): # Keep only particles that have neighbors (this was changed 5/23/2020) particles = [i for i in particles if len(Particle.data[i].neighs)>0] neigh_total = sum([len(Particle.data[i].neig...
1,222
565
from .switch import EKFSwitch, RelaySwitch, InitialModeSwitch from .camera_t265 import CameraT265 from .camera_d435 import CameraD435
133
48
import os import time import datetime def get_current_epoch(): return int((datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds() * 1000) def get_sleep_parameter(event): user_input = str(event.query["sleep"]) if not user_input or not user_input.isdigit() or int(user_input) < 0: ...
1,030
368
#!/usr/bin/env python3 # IBM_PROLOG_BEGIN_TAG # # Copyright 2019,2020 IBM International Business Machines Corp. # # 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.apa...
2,922
901
# This script loads the pre-trained scaler and models and contains the # predict_smile() function to take in an image and return smile predictions import joblib from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import img_to_array, array_to_img from PIL import Image import numpy ...
2,223
774
import sys import webbrowser import os from comicstreamerlib.folders import AppFolders from PyQt4 import QtGui,QtCore class SystemTrayIcon(QtGui.QSystemTrayIcon): def __init__(self, icon, app): QtGui.QSystemTrayIcon.__init__(self, icon, None) self.app = app self.menu = QtGui.QMenu(None) ...
1,054
352
""" IO Handler for LAS (and compressed LAZ) file format """ import laspy import numpy as np from laserchicken import keys from laserchicken.io.base_io_handler import IOHandler from laserchicken.io.utils import convert_to_short_type, select_valid_attributes DEFAULT_LAS_ATTRIBUTES = { 'x', 'y', 'z', 'i...
3,892
1,102
import numpy as np import pandas as pd def read_file(prob_num): df = pd.read_csv("dat/port" + str(prob_num) + ".txt", header=None, delimiter="\s+", names=range(3)) # info on assets n = int(df[0][0]) # number of assets r = df[1: (n + 1)][0].values.reshape(n, 1) # mean of returns s = df[1: (n + 1)][...
1,206
532
from pybmrb import Spectra, Histogram import plotly.io as pio pio.renderers.default = "browser" peak_list=Spectra.n15hsqc(bmrb_ids=15060, legend='residue') peak_list=Spectra.c13hsqc(bmrb_ids=15060, legend='residue') peak_list=Spectra.tocsy(bmrb_ids=15060, legend='residue')
277
134
#!/usr/bin/env python3 import io import xml.etree.ElementTree as ET import argparse ns = {'ns1': 'http://www.sifinfo.org/infrastructure/2.x', 'ns2': 'http://stumo.transcriptcenter.com'} class StudentInfo: def __init__(self, first_name, middle_name, last_name, ): self.last_name = last_name ...
10,511
3,466
# -*- coding: utf-8 -*- # @Time : 2020-04-11 12:34 # @Author : speeding_moto import numpy as np import pandas as pd from matplotlib import pyplot as plt EUNITE_PATH = "dataset/eunite.xlsx" PARSE_TABLE_NAME = "mainData" def load_eunite_data(): """ return the generated load data, include all the features...
2,623
1,024
import numpy as np import pytest from piescope.data.mocktypes import MockAdornedImage import piescope.fibsem autoscript = pytest.importorskip( "autoscript_sdb_microscope_client", reason="Autoscript is not available." ) try: from autoscript_sdb_microscope_client import SdbMicroscopeClient microscope = Sdb...
4,828
1,804
import streamlit as st import pandas as pd import matplotlib.pyplot as plt import csv import numpy as np import pydeck as pdk from PIL import Image def scatterplot(): skyscrapers_data = pd.read_csv("Skyscrapers2021.csv") completion_year_List = [] meters_List = [] for row in skyscrapers_data...
8,206
3,110
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout, BatchNormalization from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.models import Sequential from tensorflow.keras.models import load_model ...
4,746
1,672
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import absolute_import from django.db import models, migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('form_processor', '0048_attachment_content_length_blob_id'), ] operati...
1,373
369
import re import json import tornado.web import tornado.httpclient tornado.httpclient.AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient") import tornadoes from utils.es import (ESQuery, ESQueryBuilder, MGQueryError, ElasticSearchException, ES_INDEX_NAME...
8,658
2,362
""" Thư viện này viết ra phục vụ cho môn học `Các mô hình ngẫu nhiên và ứng dụng` Sử dụng các thư viện `networkx, pandas, numpy, matplotlib` """ import networkx as nx import numpy as np import matplotlib.pyplot as plt from matplotlib.image import imread import pandas as pd def _gcd(a, b): if a == 0: retu...
10,203
3,216
import os import json import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, TensorDataset, SequentialSampler from transformers import CamembertTokenizer, CamembertForSequenceClassification import pandas as pd from tqdm import tqdm, trange # tokenizer = CamembertTokenizer.from_pretr...
3,322
1,219
print (19 // 2 ) print( 19%2)
29
18
from django.conf import settings from django.contrib.gis.db import models class Campground(models.Model): campground_code = models.CharField(max_length=64) name = models.CharField(max_length=256) campground_type = models.CharField(max_length=256) phone = models.CharField(max_length=256) comments = ...
934
298
#进行users 子应用的视图路由 from django.urls import path from users.views import RegisterView, ImageCodeView,SmsCodeView urlpatterns = [ #path的第一个参数:路由 #path的第二个函数:视图函数名 path('register/', RegisterView.as_view(),name='register'), #图片验证码的路由 path('imagecode/',ImageCodeView.as_view(),name='imagecode'), #短信...
383
165
#!/usr/bin/python from builtins import object from builtins import str import sys import traceback sys.path.append("/opt/contrail/fabric_ansible_playbooks/module_utils") # noqa from filter_utils import _task_done, _task_error_log, _task_log, FilterLog from job_manager.job_utils import JobVncApi class FilterModule...
11,861
3,631
"""Provides the MENU html string which is appended to all templates Please note that the MENU only works in [Fast](https://www.fast.design/) based templates. If you need some sort of custom MENU html string feel free to customize this code. """ from awesome_panel_extensions.frameworks.fast.fast_menu import to_menu f...
527
160
import os import boto3 import numpy as np import tensorflow as tf from flask import Flask from dotenv import load_dotenv from pymongo import MongoClient from keras.models import load_model from sklearn.preprocessing import LabelEncoder from werkzeug.datastructures import FileStorage from werkzeug.middleware.proxy_fix i...
1,909
623
# Given an array containing None values fill in the None values with most recent # non None value in the array from random import random def generate_sample(n): rand = 0.9 while n: yield int(rand * 10) if rand % 1 > 1 / 3 else None rand = random() n -= 1 def fill1(array): for i i...
633
211
# useful functions for BEAST tests # put here instead of having in every tests import os.path import numpy as np import h5py from astropy.io import fits from astropy.utils.data import download_file __all__ = ['download_rename', 'compare_tables', 'compare_fits', 'compare_hdf5'] def download_rename(filena...
3,836
1,150
# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRe...
78,772
22,305
# Detlev Aschhoff info@vmais.de # The MIT License (MIT) # # Copyright (c) 2020 # # # 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...
4,494
1,453
from django.apps import AppConfig from django.contrib.admin.apps import AdminConfig class CoreConfig(AppConfig): name = "core" class AppAdminConfig(AdminConfig): default_site = "core.admin.AppAdmin"
212
64
class Node(object): # XXX: legacy code support kind = property(lambda self: self.__class__) def _iterChildren(self): for name in self.childAttrNames: yield (name, getattr(self, name)) return children = property(_iterChildren) def dump(self, stream, indent=0): ...
1,249
372
import os import urllib.request os.makedirs('saved_models', exist_ok=True) model_path = 'http://shape2prog.csail.mit.edu/repo/wrn_40_2_vanilla/ckpt_epoch_240.pth' model_dir = 'saved_models/wrn_40_2_vanilla' os.makedirs(model_dir, exist_ok=True) urllib.request.urlretrieve(model_path, os.path.join(model_dir, mo...
2,108
907
__author__ = 'alex jiang' __version__ = '2.3.3'
48
24
#!/usr/bin/env python # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Scenario spawning elements to make the town dynamic and interesting """ import math from collections import OrderedDict import py_trees import numpy as np import carla fr...
95,791
27,832
#!/usr/bin/env python from argparse import ArgumentParser import sys from comp_pi import compute_pi def main(): arg_parser = ArgumentParser(description='compute pi using Fortran ' 'function') arg_parser.add_argument('n', default=1000, nargs='?', hel...
502
147
#!/usr/bin/env python3 import unittest import torch from Lgpytorch.lazy import CatLazyTensor, NonLazyTensor from Lgpytorch.test.lazy_tensor_test_case import LazyTensorTestCase class TestCatLazyTensor(LazyTensorTestCase, unittest.TestCase): seed = 1 def create_lazy_tensor(self): root = torch.randn(...
3,885
1,531
import datetime from sqlalchemy import Column, Integer, Boolean, ForeignKey, String, DateTime, UniqueConstraint, ForeignKeyConstraint from sqlalchemy.orm import relationship from dbConfig import Base, engine class GroupStatus(Base): __tablename__ = "groupstatus" id = Column(Integer, primary_key=True) sta...
3,349
1,062
import paddle import paddle.nn as nn import paddle.nn.functional as F from paddle.nn.initializer import Assign import math class NoisyLinear(nn.Linear): def __init__(self, in_features, out_features, sigma_zero=0.4, bias=True): super(NoisyLinear, self).__init__(in_features, out_features) sigma_init ...
2,224
782
default_app_config = 'players.apps.PlayersConfig'
50
18
# Copyright 2019 The Forte 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 applicable ...
1,631
504
import re from AFD import AFD class AFN: def __init__(self, nome=None, estados=[], simbolos=[], estado_inicial=None, estados_finais=[], funcoes_programa={}): self.nome = nome self.estados = estados self.simbolos = simbolos self.estado_inicial = estado_inicial self.estados...
4,834
1,546
from typing import List, Dict import pathlib import shutil import enum from typer import Option as O_ import typer from cs_tools.helpers.cli_ux import console, frontend, CSToolsGroup, CSToolsCommand from cs_tools.util.datetime import to_datetime from cs_tools.tools.common import run_tql_command, run_tql_script, tsloa...
11,348
3,261
#!/usr/bin/python import math import random from utils.log import log from bots.simpleBots import BasicBot def get_Chosen(num_cards, desired_score): chosen = list(range(1,num_cards+1)) last_removed = 0 while sum(chosen) > desired_score: #remove a random element last_removed = random.randint(0,len(chosen)-1) ...
6,098
2,321
import uuid from typing import Dict, List from nehushtan.ws.NehushtanWebsocketConnectionEntity import NehushtanWebsocketConnectionEntity class TestWebsocketRegisterAgent: def __init__(self): self.__map: Dict[str, NehushtanWebsocketConnectionEntity] = {} self.agent_identity = str(uuid.uuid4()) ...
1,280
379
from .interface import Beverage, CondimentDecorator class Mocha(CondimentDecorator): def __init__(self, beverage: Beverage): super().__init__(beverage) self._cost = 0.2 class Whip(CondimentDecorator): def __init__(self, beverage: Beverage): super().__init__(beverage) self._...
470
164
# # # Copyright 2009 HPGL Team # # This file is part of HPGL (High Perfomance Geostatistics Library). # # HPGL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. # # HPGL is ...
1,641
686
friendly_camera_mapping = { "GM1913": "Oneplus 7 Pro", "FC3170": "Mavic Air 2", # An analogue scanner in FilmNeverDie "SP500": "Canon AE-1 Program" }
166
74
from typing_extensions import Annotated, TypeGuard from typing import TypeVar, List, Set, Dict from refined.predicates import ( PositivePredicate, NegativePredicate, ValidIntPredicate, ValidFloatPredicate, EmptyPredicate, NonEmptyPredicate, TrimmedPredicate, IPv4Predicate, IPv6Predi...
1,622
591
from setuptools import setup with open("README.md", "r") as f: long_description = f.read() setup(name="SpotPRIS2", version='0.3.1', author="Adrian Freund", author_email="adrian@freund.io", url="https://github.com/freundTech/SpotPRIS2", description="MPRIS2 interface for Spotify Connec...
1,151
374
# Generated by Django 4.0.3 on 2022-04-02 17:32 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
2,371
708
#!/usr/bin/env python # Filename: raster_statistic """ introduction: conduct statistic based on vectos, similar to https://github.com/perrygeo/python-rasterstats, # but allow image tiles (multi-raster). authors: Huang Lingcao email:huanglingcao@gmail.com add time: 02 March, 2021 """ import os,sys import ve...
7,963
2,770
# Defutils.py -- Contains parsing functions for definition files. # Produces an organized list of tokens in the file. def parse(filename): f=open(filename, "r") contents=f.read() f.close() # Tokenize the file: #contents=contents.replace('\t', '\n') lines=contents.splitlines() outList=[] ...
1,226
400
#!/usr/bin/env python3 import json import sys import clize def get_file_handler(input_file): if input_file is None: return sys.stdin return open(input_file, 'r') @clize.clize def main(input_file=None): result = {'datas': []} with get_file_handler(input_file) as input_han...
492
188
""" TutorialMirror A simple mirror object to experiment with. """ from evennia import DefaultObject from evennia.utils import make_iter, is_iter from evennia import logger class TutorialMirror(DefaultObject): """ A simple mirror object that - echoes back the description of the object looking at it ...
2,254
596
from tkinter import Tk from turtle import ScrolledCanvas, TurtleScreen, RawTurtle DIGIT2POS = dict(zip( "123456789", ((100 * (j - 1), 100 * (-i + 1)) for i in range(3) for j in range(3)) )) def draw_dots(turt: RawTurtle) -> None: penstate = turt.pen() turt.penup() for x, y in DIGIT2POS.values(): ...
1,087
455
#!/usr/bin/env python # test code for PyPortMidi # a port of a subset of test.c provided with PortMidi # John Harrison # harrison [at] media [dot] mit [dot] edu # March 15, 2005: accommodate for SysEx messages and preferred list formats # SysEx test code contributed by Markus Pfaff # February 27, 2005...
3,879
1,504
#coding=utf-8 import pandas as pd def get_labels(init_file,predict_file): init_label = [] predict_label = [] pd_init = pd.read_csv(init_file,sep="^",header=None) for index,row in pd_init.iterrows(): init_label.append(row[0]) pd_predict = pd.read_csv(predict_file,sep=",",header=None) ...
1,043
368
from ex01.funcoes import * def arqExiste(nome): try: a = open(nome, 'rt') #rt = read text a.close() except FileNotFoundError: return False else: return True def criarArq(nome): try: a = open(nome, 'wt+') #wt = write text and + = create one if it not exists ...
1,219
432
# -*- coding: utf-8 -*- """ :author @Icrons cron: 20 10 * * * new Env('机场签到'); """ import json import re import traceback import requests import urllib3 from notify_mtr import send from utils import get_data urllib3.disable_warnings() class SspanelQd(object): def __init__(self, check_items): self.chec...
4,330
1,571
# ----------------------------------------------------------------------- # Author: Marcelo Villa-Piñeros # # Purpose: Determines the fire season for each window. The fire season is # defined as the minimum number of consecutive months that contain more # than 80% of the burned area (Archibald ett al 2013; Abatzoglou e...
2,541
832
import bpy import json from bpy.types import SpaceView3D from bpy.app.handlers import persistent from mathutils import Quaternion, Matrix, Vector from holo.gestures import prediction_from_camera def duplicate_window(window_type: str = 'INVOKE_DEFAULT') -> None: """Duplicates a new window into bpy.data.screens fro...
5,719
2,281
# 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, ...
2,506
890
""" DB operations for Targets """ from api.models.base import DBModel class TargetDB(DBModel): '''DBModel for the targets table''' tablename = 'targets'
165
54
# myTeam.py # --------- # Licensing Infoesmation: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # A...
15,107
4,759
class Solution: # @param s, a string # @param wordDict, a set<string> # @return a string[] def wordBreak(self, s, wordDict): n = len(s) res = [] chars = ''.join(wordDict) for i in xrange(n): if s[i] not in chars: return res lw = s[-1] ...
850
274
from setuptools import setup, find_packages setup( name='SBIExperiments', version='0.0.1', url='https://github.com/astrodeepnet/sbi_experiments', author='Justine Zeghal and friends', description='Package for numerical experiments of SBI tools', packages=find_packages(), install_requires=[ 'numpy>=1.1...
433
164
import datetime import libcloud from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver from pprint import pprint Engine = get_driver(Provider.ELASTICHOSTS) driver = Engine("733b7dc7-7498-4db4-9dc4-74d3fee8abed", secret="6w6CDAqL6JyXFj3xNkWW2zpUjYfv9dYaLVdaaR4Y",...
880
378
from django.contrib import admin from .models import TodoModel admin.site.register(TodoModel)
95
28
#!/usr/bin/env python3 """ Author : antoniog1 Date : 2019-02-21 Purpose: Rock the Casbah """ import argparse import sys import os # -------------------------------------------------- def get_args(): """get command-line arguments""" parser = argparse.ArgumentParser( description='Argparse Python scri...
1,853
546
#!/usr/bin/env python # encoding: utf-8 # # @Author: José Sánchez-Gallego # @Date: Oct 10, 2017 # @Filename: target.py # @License: BSD 3-Clause # @Copyright: José Sánchez-Gallego from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import pathlib impo...
4,042
1,210
# 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, s...
1,889
618