text
string
size
int64
token_count
int64
class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ numlist = [] for x in s: if x == 'I': num = 1 elif x == 'V': num = 5 elif x == 'X': num = 10 elif ...
1,089
324
#!/usr/bin/env python import rospy from random import uniform, choice from math import copysign """ This is a simple pythin script that generates random values for circN parameters read by simple_sim to place objects It places 1, 2 or 3 circles in a +/- 1.5m area around the center of the map """ def randsign(): ...
832
298
from selenium import webdriver import time class HiddenElements(): def testLetsKodeIt(self): baseUrl = "https://letskodeit.teachable.com/pages/practice" driver = webdriver.Firefox() driver.maximize_window() driver.get(baseUrl) driver.implicitly_wait(2) # Find the ...
1,868
559
#CodeMod from Trinh Nguyen http://www.dangtrinh.com/2013/10/python-convert-csv-to-excel.html import csv import os from openpyxl import Workbook from openpyxl.utils import get_column_letter def csv_to_excel(csv_path, excel_path): csv_file = open(csv_path, encoding = 'utf-8-sig') #ChineseFixUTF8 csv.register_dialect('...
1,091
450
""" Expression interpretor """ import matlab2cpp as mc import findend import identify import constants as c def create(self, node, start, end=None, start_opr=None): """ Create expression in three steps: 1) In order, split into sub-expressions for each dividing operator 2) Address prefixes, postfixes, pa...
9,345
3,034
import setuptools import os # Change to the setup.py directory to read files relative to it. cwd = os.getcwd() abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname) with open("README.md", "r") as f: long_description = f.read() setuptools.setup( name="{{cookiecutter.company_name...
1,103
372
from dataclasses import dataclass @dataclass(order=True, frozen=True) class Attributes: r""" Immutable object to group attributes, and do operations on them. phy = Physical men = Mental tac = Tactical Attributes are printed as `(phy / men / tac)` So `( 50 / 110 / 170)` means: ...
3,917
1,304
import os import collections from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.webtest import TestApp, get_scopefunc from kozmic import create_app, db from . import factories class SQLAlchemyMixin(object): @property def db(self): return self.app.extensions['sqlalchemy'].db def create_d...
2,382
747
import argparse import logging import sys import numpy as np from PIL import Image, ImageTk import tkinter as tk logger = logging.getLogger('tkcanvasimage') logger.addHandler(logging.StreamHandler(sys.stdout)) class TkDrawable: def __init__(self, scaling_factor=1.0, position=[0, 0]): self._canvas = None ...
6,046
1,907
from .base import BaseOddsEnv from .base_percentage import BasePercentageOddsEnv from .daily_bets import DailyOddsEnv, DailyPercentageOddsEnv class MetaEnvBuilder(type): def __new__(cls, name, bases, attr): def safe_get(attribute): if attribute in attr: return attr[attribute] ...
1,485
451
from physique import Pyboard import numpy as np import matplotlib.pyplot as plt script = """ from pyb import Pin, ADC, Timer, delay import array f = 20000 # fréquence d'échantillonnage nb = 2000 # nombre de points adc = ADC(Pin('A2')) # Activation du CAN sur la broche A0 buf = array.arra...
998
424
# -*- encoding: utf-8 -*- # @Author: SWHL # @Contact: liekkaskono@163.com from rapid_ocr_api import TextSystem, visualize det_model_path = 'models/ch_ppocr_mobile_v2.0_det_infer.onnx' cls_model_path = 'models/ch_ppocr_mobile_v2.0_cls_infer.onnx' # 中英文识别 rec_model_path = 'models/ch_ppocr_mobile_v2.0_rec_infer.onnx' ke...
1,663
673
# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python #adb shell dumpsys window | findstr mCurrentFocus #adb shell getprop ro.product.model from appium import webdriver caps = {} caps["platformName"] = "Android" caps["devi...
1,133
407
from django import forms from django.conf import settings from captcha.fields import ReCaptchaField from captcha.widgets import ReCaptchaV3 from coderdojochi.util import email class ContactForm(forms.Form): widths = ( ("name", "small-6"), ("email", "small-6"), ("interest", "small-6"), ...
2,589
770
from myhdl import * ggens = [] gclock = None #Signal(bool(0)) greset = None #ResetSignal(0, active=0, async=True) def init(clock=None, reset=None): global ggens,gclock,greset gclock,greset = clock,reset ggens = [] return ggens def end(g=None, dump=False): global ggens if dump: for ...
4,411
1,553
# importing required modules import argparse stop_words = {'i', 'with', 'he', 'down', 'itself', 'm', 'shan', 'no', 'yourself', 'but', 'the', 'y', 'again', 'more', 'o', "she's", 'theirs', 'my', "isn't", 'are', 're', 'their', 'own', 'during', 'don', 'such', 'me', "you'll", 'have', 'has', 'an', 'isn', 'wouldn', 'between'...
6,975
2,274
from __future__ import print_function import torch.utils.data as data from PIL import Image import os import os.path import errno import numpy as np import sys if sys.version_info[0] == 2: import cPickle as pickle else: import pickle class CIFAR10(data.Dataset): base_folder = 'cifar-10-batches-py' url...
5,458
1,901
import os import multiprocessing from tqdm import tqdm # Custom Modules import constants import formulas from dataHandler import dataHandler from settingsHandler import SettingsHandler from mcd_interface import MCDInterface settings_handler = SettingsHandler() mcd_interface = MCDInterface(settings_handler.get_setting...
1,780
563
import mysql.connector as conn from mysql.connector import errorcode Connection = conn.connect( host="localhost", port="3306", user="root", password="", database="applicationtrackingsystem" ) print("Connect to the local database outside method success...
8,160
2,262
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 18 18:45:18 2019 @author: ben """ import pointCollection as pc class tile(pc.tile): def __default_field_dict__(self): return {None:['delta_time','h_li','h_li_sigma','latitude','longitude','atl06_quality_summary','segment_id','sigma_g...
746
287
# coding: utf-8 """ Copyright 2016 SmartBear Software 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...
5,898
1,623
from __future__ import annotations from dataclasses import dataclass, field from typing import List, Dict, Tuple, Optional, Any from expungeservice.models.case import Case from expungeservice.models.charge import Charge @dataclass(frozen=True) class Alias: first_name: str last_name: str middle_name: str ...
1,247
414
from flask_restplus import Namespace from app.api.application.resources.application import ApplicationResource, ApplicationListResource, ApplicationReviewResource from app.api.application.resources.application_estimated_cost_override import ApplicationEstimatedCostOverride from app.api.application.resources.applicatio...
3,329
886
# Generated by Django 3.2.6 on 2021-09-09 02:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pycake', '0001_initial'), ] operations = [ migrations.AlterField( model_name='pedido', name='cobertura', ...
4,172
1,483
# Generated by Django 2.2.7 on 2019-11-27 05:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('course_registration', '0001_initial'), ] operations = [ migrations.AlterField( model_name='courseregistration', name...
734
241
import cv2 import argparse a=argparse.ArgumentParser() a.add_argument("-i","--image", required=True, help="input image path") args=vars(a.parse_args()) image=cv2.imread(args["image"]) # two methods # Static spectral saliency saliency = cv2.saliency.StaticSaliencySpectralResidual_create() (success, salien...
743
291
################################################## # Copyright (C) 2017-2020, All rights reserved. ################################################## __project_name__ = "ignoregen" __version__ = "0.6" __description__ = "Generate Git ignore rules"
248
71
from flask import Flask, request, render_template, redirect, url_for, flash, make_response from flask_wtf import FlaskForm from wtforms import StringField, IntegerField, SubmitField, SelectField, widgets from wtforms.validators import Required import os import csv import json import requests # import jellyfish #####...
9,517
3,114
""" Package models """ import re from abc import ABC, abstractmethod from decimal import Decimal from typing import Any, List, Optional from bs4 import BeautifulSoup from .http_client import HttpClient, HttpResponse class ParserException(Exception): """ Base parser exception """ class Address(): "...
6,695
1,883
"""Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa. Pergunte o valor da casa, o salário do comprador e em quantos anos ele vai pagar. A prestação mensal não pode exceder 30% do salário ou então o empréstimo será negado.""" casa = float(input('Qual o valor da casa? R$ ')) salario = floa...
747
317
""" Print a full bibliographic citation for a Concepticon version """ import html import collections from datetime import date from clldutils.path import git_describe from clldutils.jsonlib import dump from nameparser import HumanName def register(parser): parser.add_argument('--version', default=None) parse...
1,972
648
import pymysql from booth_info import booths from generate_random_id import generate_random_id, generate_easy_password from generate_random_password import generate_random_password from sqls import * pay_database = { 'port': 3306, } pay_connection = pymysql.connect(**pay_database) pay_cursor = pay_co...
848
311
from requests import get from parameters import build_parameters GITHUB_API_URL = "https://api.github.com/search/repositories" def get_repos_with_most_stars(languages, sort="stars", order="desc", stars=50000): """Fetches the data from the GitHub API Arguments: languages {list} -- the list of languag...
1,106
330
import webbrowser class Movie(): """ This class provides a way to store movie related information""" VALID_RATINGS = ['G','PG','PG-13','R'] # Make class variables, guideline recommend make constant variables as upper case def __init__(self, movie_title, movie_storyline, poster_image,trailer_youtube): self.tit...
580
192
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.code import Concat, Switch, If from hwt.hdl.typeShortcuts import vec from hwt.interfaces.utils import addClkRstn, propagateClkRstn from hwt.synthesizer.param import Param from hwt.synthesizer.unit import Unit from hwtLib.amba.axis import AxiStream from hwtLib.xil...
3,840
1,435
#!/usr/bin/python # Binary Analysis Tool # Copyright 2015-2016 Armijn Hemel for Tjaldur Software Governance Solutions # Licensed under Apache 2.0, see LICENSE file for details import shutil import os.path import copy ''' This aggregate scan traverses the unpackreports an tries to rename certain files based on proper...
5,763
1,482
import argparse import shutil import os, json, sys, traceback, time import pathlib try: from comet_ml import Experiment COMET_AVAIL = True except: COMET_AVAIL = False import numpy as np import torch import datetime sys.path.insert(0, str(pathlib.Path(__file__).parent)) from scripts.solver import Solver s...
7,863
2,445
from TicketGenerator import TicketGenerator as Tickes import random class Lottery: def __init__(self,seed=18,size=6,maxTickes=10,all=False): self.maxTickes=maxTickes self.tickes =Tickes(seed=seed,size=size,maxTickes=maxTickes,all=all).tickes self.seller=[] self.sell() ...
854
296
# -*- coding:utf-8 -*- """ """ from ._base import get_tool_box, register_toolbox, register_transformer, tb_transformer from .toolbox import ToolBox register_toolbox(ToolBox) try: import dask.dataframe as dd import dask_ml from .dask_ex import DaskToolBox register_toolbox(DaskToolBox, 0) is_dask...
704
258
# Expose the main function to the outside world under the alias "simulate" from .main import main_func as simulate
115
29
import time import config import discord from discord.ext import commands class EverestPins: def __init__(self, bot): self.bot = bot @commands.command() async def ahorn(self, ctx): embed = discord.Embed(title="Ahorn Downloads", url="https://github.com/Celesti...
3,086
956
import numpy as np import cv2 video = cv2.VideoCapture(0) while(True): ret, frame = video.read() resized_video = cv2.resize(frame, (1000, 700)) cv2.imshow('Video Capture', resized_video) if cv2.waitKey(10) == ord('q'): break video.release() cv2.destroyAllWindows()
291
114
# DO NOT EDIT # This file was generated by idol_mar, any changes will be lost when idol_mar is rerun again from marshmallow import Schema from .optional_method import AllTargetOptionalMethodField class AllTargetOptionalServiceSchema(Schema): optional = AllTargetOptionalMethodField( dump_to="optional", loa...
362
98
""" Main logic code """ import wpilib from inits import Component import helpers from components.chassis import Chassis from autonomous import Autonomous from components.lights import Lights from components.metabox import MetaBox from components.winch import Winch from components.pdb import Power from networktables...
4,193
1,324
#!/usr/bin/python # encoding=utf-8 import sys if sys.version_info[0] == 2: # Python2 import core.AepSdkRequestSend as AepSdkRequestSend else: # Python3 from apis.core import AepSdkRequestSend #参数MasterKey: 类型String, 参数不可以为空 # 描述:MasterKey在该设备所属产品的概况中可以查看 #参数productId: 类型long, 参数不可以为空 # 描述: #参数sear...
6,496
2,967
# Copyright (c) 2017 Iotic Labs Ltd. 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 # # https://github.com/Iotic-Labs/py-IoticBulkData/blob/master/LICENSE # # Unless...
8,933
2,869
import requests import json url = 'http://localhost:5000/invocations' data = { 'Pclass':[3,3,3], 'Sex': ['male', 'female', 'male'], 'Age':[4, 22, 28] } j_data = json.dumps(data) headers = {'Content-Type': 'application/json'} print("Sending request for model...") print(f"Data: {j_data}") r...
400
157
import sys import mrutil # NxN matrix def serialLine(matrix): for line in matrix: list_new = [str(x) for x in line] kvstr = ",".join(list_new) mrutil.emit([kvstr])
171
72
#!/usr/bin/env python import re import urllib.request template = ''' <!doctype html> <html> <head> <title>Twilio OpenAPI Documentation</title> <style> body { text-align: center; } ul { list-style-type: none; display: flex; flex-wrap: wrap; padding-i...
1,207
446
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.0 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. """ The smartcard.scard module is a simple wrapper on top of the C language PCSC SCardXXX API. The smartcard.scard m...
104,686
34,872
# Python Version: 3.x import subprocess import sys import time from typing import * from typing.io import * import onlinejudge._implementation.format_utils as format_utils import onlinejudge._implementation.logging as log if TYPE_CHECKING: import argparse def non_block_read(fh: IO[Any]) -> str: # workaround...
2,027
626
from django.shortcuts import render from .models import Photorecorder from django.contrib.auth.decorators import login_required # Create your views here. @login_required(login_url='/account/login/') def user(request): Photorec = Photorecorder.objects.all() return render(request, 'photographer.html',{'Photorec...
334
104
# Copyright 2018-2021 Jakub Kuczys (https://github.com/jack1142) # # 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 app...
24,656
7,011
import abc class Base(abc.ABC): command_name = None def __init__(self, client, message, payload=None): self.client = client self.message = message self.payload = payload if not self.command_name: raise ValueError('Should have a command name!') @abc.abstractme...
384
107
import time import logging from typing import List import json from spaceone.core.utils import * from spaceone.inventory.connector.aws_sqs_connector.schema.data import QueData, RedrivePolicy from spaceone.inventory.connector.aws_sqs_connector.schema.resource import SQSResponse, QueResource from spaceone.inventory.conn...
2,375
681
""" File: nimm.py ------------------------- Add your comments here. """ def main(): stones = 20 while stones > -1: for player in range(1, 3): if stones == 0: print(f'Player {player} wins!') stones -= 1 break print(f'There are {sto...
936
271
# 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, software # distributed under the Li...
1,842
577
import time import daemon from ssidstat.common import db from ssidstat.common import sysutils class MonitorDaemon(daemon.Daemon): def __init__(self, dbfile, pidfile, interval=10, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): daemon.Daemon.__init__(self, pidfile, stdin=stdin, stdout=stdout, stderr=st...
1,371
581
#!/usr/bin/python import petsc4py import slepc4py import sys petsc4py.init(sys.argv) slepc4py.init(sys.argv) from petsc4py import PETSc from slepc4py import SLEPc Print = PETSc.Sys.Print # from MatrixOperations import * from dolfin import * import numpy as np import matplotlib.pylab as plt import scipy.sparse as sps ...
8,899
3,795
from onegov.winterthur.forms.mission_report import MissionReportForm from onegov.winterthur.forms.mission_report import MissionReportVehicleForm __all__ = ('MissionReportForm', 'MissionReportVehicleForm')
206
61
''' Author - Ronak Vadhaiya FCFS ''' import math def FCFS(n_process, data): ttr, ttw = 0, 0 print("="*20 + "FCFS" + "="*20) tr = data[0][1] wt = 0 ttr += tr prev = data[0][0] + data[0][1] print("P1", "Start Time: ", data[0][0], "End Time: ", data[0][0]+data[0][1], "TR : ", tr, "...
1,322
500
import numpy as np import linearclass.util def main(train_path, valid_path, save_path): """Problem: Gaussian discriminant analysis (GDA) Args: train_path: Path to CSV file containing dataset for training. valid_path: Path to CSV file containing dataset for validation. save_path: Path ...
2,418
749
BOOL = "BOOL" INT = "INT" DOUBLE = "DOUBLE" STRING = "STRING" DURATION = "DURATION"
84
40
# coding: utf-8 # In[ ]: { "MLModelId": "ml-ModelExampleId" }
69
38
iris = [ ((6.0, 2.2, 4.0, 1.0), "iris-versicolor"), ((6.9, 3.1, 5.4, 2.1), "iris-virginica" ), ((5.5, 2.4, 3.7, 1.0), "iris-versicolor"), ((6.3, 2.8, 5.1, 1.5), "iris-virginica" ), ((6.8, 3.0, 5.5, 2.1), "iris-virginica" ), ((6.3, 2.7, 4.9, 1.8), "iris-virginica" ), ((6.3, 3.4, 5.6, 2...
902,000
842,587
#PILATUS pilat_file_path = 'BL24I-EA-PILAT-01:cam1:FilePath' pilat_file_name = 'BL24I-EA-PILAT-01:cam1:FileName' pilat_file_temp = 'BL24I-EA-PILAT-01:cam1:FileTemplate' pilat_numb_imgs = 'BL24I-EA-PILAT-01:cam1:NumImages' pilat_file_num = 'BL24I-EA-PILAT-01:cam1:FileNumber' pilat_acquire = 'BL24I-EA-PILAT-01:cam1:Acqui...
7,162
5,218
from tracardi.process_engine.action.v1.flow.property_exists.model.configuration import Configuration from tracardi.service.plugin.domain.register import Plugin, Spec, MetaData, Documentation, PortDoc, Form, FormGroup, \ FormField, FormComponent from tracardi.service.plugin.domain.result import Result from tracardi....
2,532
589
#!/usr/bin/env python from __future__ import print_function import argparse from distutils.util import strtobool import os import chainer from chainer import serializers from chainer import iterators from chainer import optimizers from chainer import training from chainer.dataset import to_device, concat_examples fro...
8,178
2,708
import os import pytest from click.testing import CliRunner from shub.exceptions import BadConfigException from shub.image.init import cli from shub.image.init import _format_system_deps from shub.image.init import _format_system_env from shub.image.init import _format_requirements from shub.image.init import _wrap ...
4,617
1,585
#!/usr/bin/env python # -*- coding: utf-8 -*- from os import mkdir from os.path import splitext, dirname, sep, join, exists, basename from subprocess import Popen from diagnostics import diagnostics, known_compilers, FontError import codecs import re diagnostics = diagnostics() class Compiler: def __init__(self,...
6,195
1,770
from midi_converter import char_to_note, note_to_char import random def load_data(filename): data = [] # load the file with open(filename, "r") as f: file = f.readlines() for line in file: line = line.replace("\n", "") line = line.replace(",", "") data...
1,999
639
#!/usr/bin/env python # -*- coding: utf-8 -*- # Python version: 3.8 """ This script is used to run the baseline experiments by arguments from commandline. Please see readme.md to see the supported arguments. """ import pickle import time from tqdm import tqdm import matplotlib.pyplot as plt from utils import * from o...
2,978
1,013
from setuptools import setup, find_namespace_packages setup( name='personal_assistant', version='1.0.0', authors=('Volodymyr Dunkin', 'Andrii Mikhalkin'), description='personal assistant', entry_points={'console_scripts': [ 'assist = personal_assistant.general:main']}, long_des...
498
145
"""Define the test group classes.""" from __future__ import division, print_function from openmdao.core.group import Group class ParametericTestGroup(Group): """ Test Group expected by `ParametricInstance`. Groups inheriting from this should extend `default_params` to include valid parametric options for...
2,160
555
#Nabin Chapagain #1001551151 #knn_classify(<training_file>, <test_file>, <k>) # Importing all needed libraries import numpy as np import math import sys import random from scipy import stats from scipy.spatial import distance import statistics as s from statistics import mean, median, mode, stdev fname = sys.argv[1]...
2,577
992
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PerlGetoptTabular(PerlPackage): """Getopt::Tabular is a Perl 5 module for table-driven arg...
638
277
import logging import os import time from datetime import datetime import pytz from django.conf import settings from django.core.management.base import BaseCommand import libtmux from box.management.commands.run_box import start_sensor_in_tmux from box.models import BoxSettings from box.utils.dir_handling import buil...
3,218
972
# -- coding: utf-8 -- # Copyright 2018 Olivier Scholder <o.scholder@gmail.com> import os import base64 import xml.etree.ElementTree as ET import struct import numpy as np import pySPM.SPM from pySPM.SPM import SPM_image, funit from .utils.misc import aliased, alias, deprecated @deprecated("getCurve") def get_curve(f...
8,244
2,850
""" Contacts """ # You went to a conference and got people to sign up for text updates from your startup. Go through this dict to make the phone numbers readable to a computer. # Hint: It can't include any non-numeric # characters. contacts = { 'Jamie': '1.192.168.0143', 'Kartik': '1.837.209.1121', 'Grant': '1.8...
424
207
import os import logging import logging.config def logging_config(log_dir=None, log_file_path=None): config = { "version": 1, "disable_existing_loggers": False, "formatters": { "standard": { "format": "[%(asctime)s][%(name)s][%(funcName)s][%(levelname)s] %(mess...
1,342
414
import os import json from ..web import base from .. import config class SchemaHandler(base.RequestHandler): def __init__(self, request=None, response=None): super(SchemaHandler, self).__init__(request, response) def get(self, schema): schema_path = os.path.join(config.schema_path, schema) ...
481
147
import torch import torch.optim as optim import torch.nn as nn import torchvision import time import progressbar import os from torchvision import transforms, models # Implementation based on resnet18 # Accuracy of 99% after 12 Epochs of training with 31.200 training images and 7.800 validation images # Where to sto...
6,794
2,172
class ToBeFoundChange: """Event used when the number of resources available for a request has been retrieved and recorded""" NAME = "TO_BE_FOUND_CHANGE" def __init__(self, directory, need_spliter, amount): self.directory = directory self.need_spliter = need_spliter self.amount = a...
961
262
import weakref from collections import defaultdict from typing import List, Dict from person import Person __map: Dict[int, List] = defaultdict(list) def add_friend(person: Person, friend: Person): if not person or not friend: return if person.id == friend.id: return if is_friend(person...
1,187
372
import os import sys import shutil ANDROID_NDK = os.getenv("NDK_HOME") if(ANDROID_NDK == None): print("no ndk found") else: print("foud ndk in " + ANDROID_NDK) BUILD_TYPE="Release" BUILD_SHARED_LIBS="OFF" BUILD_HIDDEN_SYMBOL="ON" BUILD_RTTI="ON" BUILD_EXCEPTIONS="ON" ANDROID_STL_32BIT="c++_shared" ANDROID_ST...
3,450
1,581
""" PROIECT MOZAIC """ # Parametrii algoritmului sunt definiti in clasa Parameters. from parameters import * from build_mosaic import * import timeit import numpy as np import os import cv2 as cv dir_path = './..data/imaginiTest/' filenames = [('./../data/imaginiTest/ferrari.jpeg', 'ferrari'), ...
5,143
1,971
import json import unittest from datetime import datetime import mock from contacthub.lib.paginated_list import PaginatedList from contacthub.lib.read_only_list import ReadOnlyList from contacthub.models.customer import Customer from contacthub.models.education import Education from contacthub.models.properties impor...
28,776
8,716
# This file is MACHINE GENERATED! Do not edit. # Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. """Public API for tf.lite.constants namespace. """ from __future__ import print_function as _print_function from tensorflow.lite.python.lite_constants import FLOAT from tensorflow.lite.pyt...
1,027
334
import numpy as np import ctypes as ct char = ct.c_char ubyte = ct.c_ubyte bool = np.bool float = np.float float16 = np.float16 float32 = np.float32 float64 = np.float64 uint8 = np.uint8 byte = np.byte uint = np.uint uint16 = np.uint16 uint32 = np.uint32 uint64 = np.uint64 int = np.int int16 = np.int16 short = np.shor...
461
217
import pytest from pydp.algorithms.laplacian import BoundedMean def test_python_api(): a = [2, 4, 6, 8] mean_algorithm = BoundedMean( epsilon=1.0, lower_bound=1, upper_bound=9, dtype="float" ) assert 1.0 <= mean_algorithm.quick_result(a) <= 9.0 def test_bounded_mean(): bm1 = BoundedMean...
1,468
601
from meerk40t.device.lasercommandconstants import * output_path = "/home/jacob/cut/output.egv" def plugin(kernel, lifecycle): if lifecycle == 'register': """ Register our changes to meerk40t. These should modify the registered values within meerk40t or install different modules and modifie...
2,688
667
from ipywidgets import widgets, HBox, VBox, Layout from IPython.display import display from functools import partial import numpy as np class TicTacToeGame(object): ''' Tic-tac-toe game within a Jupyter Notebook Opponent is Xs and starts the game. This is assumed to be a predictor object from a ...
3,769
1,189
from src.model import faster_rcnn_bundle, faster_rcnn_cilia, mask_rcnn, keypoint_rcnn import torch import src.utils import torch.optim import torchvision.ops as ops import src.transforms as t import torchvision.transforms.functional as TF import numpy as np import PIL from typing import Dict, List, Tuple import os.p...
2,714
1,005
# coding=utf-8 __author__ = 'Sean'
36
18
from src.data import Data import numpy as np from scipy.optimize import minimize import matplotlib.pyplot as plt # area of ellipse # def f(x): # return np.pi * (x[0] * x[3] - x[1] * x[2]) ** 2 def f(x): return np.pi * (1 / float(x[0] ** 2 * x[1] ** 2)) class Solver: def __init__(self, data): ...
4,763
1,760
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... #By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued term...
1,043
447
# # This file is part of Brazil Data Cube Database module. # Copyright (C) 2019-2020 INPE. # # Brazil Data Cube Database moduleis free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Config test fixtures.""" from typing import List impo...
1,218
398
import argparse import logging import os import numpy as np import torch import utils import model.net as net from model.data_loader import DataLoader parser = argparse.ArgumentParser() parser.add_argument('--data_dir', default='data/small', help="Directory containing the dataset") parser.add_argument('--model_dir', ...
2,805
918
import os import re def multi_files_names(URL): #print(f"URL:{URL}") curr_dir = os.getcwd() # First get the current directory and then add the folder which you want to enter sourcepath = os.listdir(os.path.join(curr_dir, "data_for_ML")) # OR read_file_path() delimiters = "_" #re.escape allows to build the...
2,051
736
from typing import Type class ContainerException(Exception): def __init__(self, cls: Type, message): self.cls = cls super(ContainerException, self).__init__(message) class ClassNotFoundException(ContainerException): def __init__(self, cls: Type): super(ClassNotFoundException, self)._...
1,124
234