text
string
size
int64
token_count
int64
from django import forms class InviteForm(forms.Form): email_addr = forms.EmailField(widget=forms.EmailInput(attrs={'class':'form-control','placeholder':'Email address','id':'email'}), label='') check_terms = forms.BooleanField(label="I agree to the <a link''>Terms and Code of Conduct</a>")
301
92
#!/usr/bin/env python """Extract paired read names from FASTQ file(s). The input file should be a valid FASTQ file(s), the output is two tabular files - the paired read names (without suffixes), and unpaired read names (including any unrecognised pair names). Note that the FASTQ variant is unimportant (Sanger, Solexa...
4,561
1,670
from loguru import logger import yaml import time import pyaudio import struct import os import sys from vosk import Model, SpkModel, KaldiRecognizer import json import text2numde from TTS import Voice import multiprocessing CONFIG_FILE = "config.yml" SAMPLE_RATE = 16000 FRAME_LENGTH = 512 class VoiceAssistant():...
2,903
1,180
# coding: utf-8 # # Dictionaries (2) # In the last lesson we saw how to create dictionaries and how to access the different items in a dictionary by their key. We also saw how to add to and update the items in a dictionary using assignment, or the <code>dict.update()</code> method, and how to delete items using the...
4,781
1,485
#!/usr/bin/env python import rospy import numpy as np from scipy.spatial import KDTree from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped from styx_msgs.msg import Lane, Waypoint import math ''' This node will publish waypoints from the car's current position to some `x` distance ahead. As men...
7,851
2,399
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-03-09 10:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='HostLis...
1,353
493
# this file is needed for python2, delete for python3
53
14
""" TODO write this """ import marshmallow_dataclass as md from sqlalchemy import orm from originexample import logger from originexample.db import inject_session from originexample.tasks import celery_app, lock from originexample.auth import User, UserQuery from originexample.consuming import ( GgoConsumerControl...
3,603
1,183
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `spliceai_wrapper` package.""" import pytest # noqa
113
46
import argparse import logging import os import pathlib from typing import Union logger = logging.getLogger(__name__) def run(somearg) -> int: """Run app""" try: print(f'Some exciting argument: {somearg}') except RuntimeError as ex: logger.error(ex) return 1 return 0
313
99
import os import sys import time import atomac import subprocess if len(sys.argv) < 2: print "Usage: bouncer.py <path_to_logic_project> (<path_to_logic_project>)" os.exit(1) bundleId = 'com.apple.logic10' for project in sys.argv[1:]: projectName = project.split('/')[-1].replace('.logicx', '') filename...
4,656
1,424
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import datetime import colorama colorama.init(autoreset=True) logData = { '所在位置': 'Location', '是否经停湖北': '否', '接触湖北籍人员': '否', '接触确诊疑似': '否', '今日体温': '37.2度以下', '有无疑似或异常': '无', '是否隔离': '否', } def log_line(dic: dict, color=True): ''' 中文...
2,506
1,041
import json import glob groupPost = glob.glob("rawData/*/*/*.json") pagePost = glob.glob("rawData/*/*.json") groupPagePost = groupPost + pagePost def is_json(myjson): try: json.load(myjson) except ValueError as e: return False return True for postFile in groupPagePost: with open(pos...
433
143
from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Daniel Parra' doc = """ Consent """ class Constants(BaseConstants): name_in_url = 'consent' players_per_group = None num_rounds = 1 ...
805
259
import pytest import backend as F if F._default_context_str == 'cpu': parametrize_dtype = pytest.mark.parametrize("idtype", [F.int32, F.int64]) else: # only test int32 on GPU because many graph operators are not supported for int64. parametrize_dtype = pytest.mark.parametrize("idtype", [F.int32, F.int64]) ...
448
159
import importlib import os import pkgutil from typing import Any, List, Type def _import_modules(file_dir: str, package: str) -> None: pkg_dir = os.path.dirname(file_dir) for (_, name, ispkg) in pkgutil.iter_modules([pkg_dir]): if ispkg: _import_modules(pkg_dir + "/" + name + "/__init__.py...
1,069
364
import PySimpleGUI as PySG lay = [ [PySG.Text("What's your name?")], [PySG.Input()], [PySG.Button('Ok')] ] wd = PySG.Window('Python Simple GUI', lay) event, values = wd.read() print('Hello', values[0]) wd.close()
304
99
import numpy as np from . import BasePolicy class UniformPolicy(BasePolicy): def __init__(self, dim_action): self.dim_action = dim_action def get_actions(self, states): return np.random.uniform(-1., 1., states.shape[:-1] + (self.dim_action,))
270
88
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from models.model_utils import BigGAN as BGAN from utils.data_utils import * import pandas as pd class Recognizer(nn.Module): def __init__(self, cfg): super(Recognizer, self).__init__() input_size = 1 ...
5,304
1,990
from flask import abort from jobbing.models.user_profile import UserProfile # noqa: E501 from jobbing.models.service import Service # noqa: E501 from jobbing.DBModels import Profile as DBProfile from jobbing.DBModels import Service as DBService from jobbing.login import token_required @token_required def get_provi...
2,745
784
from collections import namedtuple from datetime import timedelta import factory import pytest from django.db.models import signals from django.utils import timezone from tests.factories import ( EvaluationFactory, MethodFactory, SubmissionFactory, ) from tests.utils import ( get_view_for_user, va...
11,082
3,895
a=[[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]] b=[[1,2,3,4],[3,4,5,5]] def convMatrix(a, b, mode='full'): if mode == 'full': row=len(a)+len(b) - 1 col=len(a[0])+len(b[0]) - 1 c= [[0 for i in range(col)] for i in range(row)] for i in range(len(a)): for j in range(len(a[0])): ...
2,496
976
from sicpythontask.PythonTaskInfo import PythonTaskInfo from sicpythontask.PythonTask import PythonTask from sicpythontask.InputPort import InputPort from sicpythontask.OutputPort import OutputPort from sicpythontask.data.Int32 import Int32 from sicpythontask.data.Float32 import Float32 from sicpythontask.data.Float64 ...
1,170
429
#!/usr/bin/env python import argparse import logging import re from sys import stdout from Bio.SeqIO.QualityIO import FastqGeneralIterator # avoid ugly python IOError when stdout output is piped into another program # and then truncated (such as piping to head) from signal import signal, SIGPIPE, SIG_DFL signal(SIGPIP...
6,811
2,209
import pyfiglet as figlet import click as click from project import Project, ApplicationRunner # The application package manager # get from package import PackageManager # print out the application name def print_app_name(app_name): figlet_object = figlet.Figlet(font='slant') return figlet_object...
1,226
390
import sys import mock import unittest import os import types from mock import patch, Mock docker = Mock() docker.client = Mock() sys.modules['docker'] = docker from cni.kube_cni import kube_params class DockerClientMock(object): def __init__(self): pass def inspect_container(self, id): retu...
1,970
698
import os from pathlib import Path from .settings import default import logging try: if os.path.isdir(str(Path.home()) + '/ripda/'): if not os.path.isdir(str(Path.home()) + '/ripda/blocks/'): os.mkdir(str(Path.home()) + '/ripda/blocks/') pass if not os.path.isfile(str(Path...
672
236
""" Amicable numbers Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22...
1,339
493
from .file_tracer import FileTracer from .null_tracer import NullTracer from .base_tracer import BaseTracer, get_tracer
120
46
from py_jwt_validator import PyJwtValidator, PyJwtException import requests jwt = 'eyJraWQiOiIyMjIiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdF9oYXNoIjoic2pvdjVKajlXLXdkblBZUDd3djZ0USIsInN1YiI6Imh0dHBzOi8vbG9naW4uc2FsZXNmb3JjZS5jb20vaWQvMDBEMXQwMDAwMDBEVUo2RUFPLzAwNTF0MDAwMDAwRHlhUEFBUyIsInpvbmVpbmZvIjoiRXVyb3BlL0R1Ymx...
2,156
1,619
# -*- coding: utf-8 -*- #------------------------------------------------------------------ # Constantes que você pode utilizar nesse exercício # Em notação científica 1.0e-6 é o o mesmo qoe 0.000001 (10 elevado a -6) EPSILON = 1.0e-6 #------------------------------------------------------------------ # O import abai...
6,795
2,722
""" Handle download of NWP data from remote servers. """ import logging from concurrent.futures import ThreadPoolExecutor from pathlib import Path from typing import Dict, List import requests from gribmagic.unity.configuration.constants import ( KEY_COMPRESSION, KEY_LOCAL_FILE_PATHS, KEY_REMOTE_FILE_PATH...
4,421
1,337
import sys import os import shutil import filecmp import json import unittest # Path hack. http://stackoverflow.com/questions/6323860/sibling-package-imports sys.path.insert(0, os.path.abspath('../guacamole')) import guacamole class GuacamoleTestCase(unittest.TestCase): def setUp(self): guacamole.app.con...
2,195
685
# coding: utf-8 import sys import yaml import paramiko import base64 import time import keychain import re import console def connect_to_device(ssh): print "\n\nConnecting to device..." keys = ssh.get_host_keys() keys.add(hostname,'ssh-rsa',public_key) password = keychain.get_password(hostname, ...
1,249
437
# Flask settings FLASK_DEBUG = True # Do not use debug mode in production # SQLAlchemy settings SQLALCHEMY_DATABASE_URI = 'sqlite:///db.sqlite' SQLALCHEMY_TRACK_MODIFICATIONS = True # Flask-Restplus settings SWAGGER_UI_DOC_EXPANSION = 'list' RESTPLUS_VALIDATE = True RESTPLUS_MASK_SWAGGER = False ERROR_404_HELP = Fa...
324
131
#!/usr/bin/env python """ Create superuser and monitoring group """ from django.core.management.base import BaseCommand from django.contrib.auth.models import Group from django.contrib.auth.models import Permission from django.contrib.auth.models import User from parkings.models import Monitor from parkings.models imp...
1,409
387
import numpy as np from parallelm.mlops.mlops_exception import MLOpsStatisticsException from parallelm.mlops.stats.graph import Graph from parallelm.mlops.stats.multi_line_graph import MultiLineGraph from parallelm.mlops.stats.single_value import SingleValue from parallelm.mlops.stats.table import Table from parallelm...
5,437
1,469
# terrascript/data/davidji99/split.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:27:33 UTC) import terrascript class split_traffic_type(terrascript.Data): pass class split_workspace(terrascript.Data): pass __all__ = [ "split_traffic_type", "split_workspace", ]
303
123
from django.apps import AppConfig class NginxConfig(AppConfig): name = 'nginx'
85
27
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from telemetry.core import util from telemetry.unittest import options_for_unittests class OutputFormatter(object): def __init__(self, o...
3,511
1,134
from awsflow.tools.emr import logging from awsflow.version import __version__ def hello_world(event, context): """ Test function, does nothing :param event: AWS lambdas function event :param context: AWS lambdas function context :return: """ message = 'event={} context={}'.format(event, c...
480
137
''' Module's author : Jarry Gabriel Date : June, July 2016 Some Algorithms was made by : Malivai Luce, Helene Piquet This module handle different tools ''' from pyproj import Proj, Geod import numpy as np # Projections wgs84=Proj("+init=EPSG:4326") epsg3857=Proj("+init=EPSG:3857") g=Geod(ellps='WGS84') ...
1,074
452
from docx import Document class Report: def __init__(self, docx_text, meta, text_processor): self.document = Document(docx_text) self.date = self.document.core_properties.modified self.title = meta['title'] self.author = meta['author'] self.group = int(meta['group']...
1,315
378
# -*- coding: utf-8 -*- # # # Copyright (C) University of Melbourne 2012 # # # #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 us...
19,724
5,930
# 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 t...
11,893
4,030
# import logging # from pprint import pformat from diana.utils.dicom import DicomLevel def find_item_query(item): """ Have some information about the dixel, want to find the STUID, SERUID, INSTUID Returns a _list_ of dictionaries with matches, retrieves any if "retrieve" flag """ q = {} keys ...
1,577
458
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from future.builtins import * # NOQA @UnusedWildImport import os import unittest import numpy as np from obspy import Trace, UTCDateTime, read from obspy.io.ascii.core import (_determ...
32,332
11,928
''' MAP v-SCREEN gargle test - Shimadzu 8020 H Date: 30/11/2020 '''
68
41
"""URL converters for the Zinnia project""" class FourDigitYearConverter: """ Pattern converter for a Year on four digits exactly """ regex = '[0-9]{4}' def to_python(self, value): return int(value) def to_url(self, value): # Enforce integer since some code may try to pass a nu...
1,793
546
import logging import os import uuid from typing import List from flask import current_app from flask.config import Config from flask_injector import inject from slackclient import SlackClient from werkzeug.utils import secure_filename from nisse.models.DTO import PrintParametersDto from nisse.models.slack.common imp...
8,045
2,156
from helpers import inputs def solution(day): depths = inputs.read_to_list(f"inputs/{day}.txt") part1_total = 0 for index, depth in enumerate(depths): if index - 1 >= 0: diff = int(depth) - int(depths[index - 1]) if diff > 0: part1_total += 1 return f"Da...
369
130
# third party from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String # relative from . import Base class SetupConfig(Base): __tablename__ = "setup" id = Column(Integer(), primary_key=True, autoincrement=True) domain_name = Column(String(255), default="") node_id =...
583
197
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from .composition_parts import Component from .composition_parts import Identifier from .make_copy import make_copy class MakeCopyTest(uni...
1,983
638
# HEAD # Classes - Magic Methods - Normal Numeric Magic Methods # DESCRIPTION # Describes the magic methods of classes # add, sub, mul, floordiv, div, truediv, mod, # divmod, pow, lshift, rshift, and, or, xor # RESOURCES # # https://rszalski.github.io/magicmethods/ # Normal arithmetic operators # Now, ...
1,554
467
# Copyright 2017 Conchylicultor. 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 ...
11,384
2,982
soma = 0 print("0 para parar") numero = int(input("Digite numero: ")) while numero != 0: if numero %2 == 0: soma += numero if numero == 0: break print("0 para parar") numero = int(input("Digite numero: ")) print("O total é", soma)
265
98
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: spaceone/api/power_scheduler/v1/schedule_rule.proto """Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import ...
41,780
16,225
from django.contrib import admin from django.db.models import Model __all__ = ["register_all"] def register_all(models, admin_class=admin.ModelAdmin): """ Easily register Models to Django admin site. :: from yourapp import models from django_boost.admin.sites import register_all regi...
990
269
import discord import os from discord.ext import commands bot = commands.Bot(command_prefix=">") TOKEN = os.environ.get('TOKEN') @bot.event async def on_ready(): print(f'{bot.user} has logged in.') bot.load_extension('cogs.WVL') bot.run(TOKEN)
251
100
from pathlib import Path import pytest import yaml from azure.ai.ml._schema._deployment.batch.batch_deployment import BatchDeploymentSchema from azure.ai.ml.constants import BASE_PATH_CONTEXT_KEY, BatchDeploymentOutputAction from azure.ai.ml.entities._util import load_from_dict from azure.ai.ml.entities import BatchDe...
1,612
498
def display(): def message(): return "Hello" return message fun = display() print(fun())
105
30
from options.test_parser import TestParser from models import create_model, get_model_parsing_modifier from datasets import create_dataset, get_dataset_parsing_modifier parser = TestParser() model_name = parser.get_model_name() dataset_name = parser.get_dataset_name() print('Model name: {}'.format(model_name)) print(...
795
252
for i in range(11): v = 2 ** i print("2^%s = %s" % (i, v))
67
36
# 浏览器最大化窗口、截屏 from selenium import webdriver from os import path driver = webdriver.Chrome() d = path.dirname('__file__') index = path.join(d,'index.png') driver.get("https://www.baidu.com/") # 最大化窗口 driver.maximize_window() # 截屏 driver.save_screenshot(index) # 后退操作 driver.back() # 前进操作 driver.forward() # 刷新操...
353
178
""" Handles exceptions raised by Flask WebAPI. """ from . import status class APIException(Exception): """ Base class for Flask WebAPI exceptions. Subclasses should provide `.status_code` and `.default_message` properties. :param str message: The actual message. :param kwargs: The extra attribute...
4,016
1,070
#!/usr/bin/python # This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license #...
5,133
1,573
# Filename: test_account.py """ Test the lendingclub2.accountmodule """ # PyTest import pytest # lendingclub2 from lendingclub2.account import InvestorAccount from lendingclub2.error import LCError class TestInvestorAccount: def test_properties(self): try: investor = InvestorAccount() ...
497
154
from config import * from excel_handler import get_users_from_excel from fastapi import FastAPI, HTTPException, status, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from ty...
3,318
956
###PiPlate buttons print('sudo crontab /home/pi/grow-controller-Rpi/main/ref/crontab.cron') ''' while True: time.sleep(0.5) # without this time.sleep, 23% cpu usage. with 3% if lcd.is_pressed(LCD.UP): GPIO.output(pin1, GPIO.LOW) # on if lcd.is_pressed(LCD.DOWN): GPIO.output(pin1, GPIO...
337
154
#!/usr/bin/python # import os import subprocess import sys def CSSMaker(): output = 'css/icons_list.css' css = '' for icon in os.listdir('./icons'): [name, ext] = icon.split('.') css += 'i[data-feather="{}"]:after {{ background-image: url(../icons/{}); }}\n'.format(name, icon); f = open(output, 'w+') f.wri...
2,010
894
# coding: utf-8 # Copyright 2017 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 ap...
3,827
1,200
class TypewiseAlert: def __init__(self, limits_for_types=None, alert_target_funcs=None): self.default_limits_for_cooling_types = { "PASSIVE_COOLING": (0, 35), "MED_ACTIVE_COOLING": (0, 40), "HI_ACTIVE_COOLING": (0, 45), } self.default_alert_funcs = { ...
2,775
847
from django.conf import settings from haystack import indexes from celery_haystack.indexes import CelerySearchIndex from .models import PublicBody PUBLIC_BODY_BOOSTS = settings.FROIDE_CONFIG.get("public_body_boosts", {}) class PublicBodyIndex(CelerySearchIndex, indexes.Indexable): text = indexes.EdgeNgramField...
1,245
389
from chicago_style_clam_pizza import ChicagoStyleClamPizza from chicago_style_cheese_pizza import ChicagoStyleCheesePizza from chicago_style_pepperoni_pizza import ChicagoStylePepperoniPizza from chicago_style_veggie_pizza import ChicagoStyleVeggiePizza from ny_style_clam_pizza import NYStyleClamPizza from ny_style_che...
1,519
464
import performance import dislib as ds from dislib.classification import RandomForestClassifier def main(): x_mn, y_mn = ds.load_svmlight_file( "/fefs/scratch/bsc19/bsc19029/PERFORMANCE/datasets/train.scaled", block_size=(5000, 780), n_features=780, store_sparse=False) rf = RandomForestClas...
459
190
class Movie: def __init__(self, name="", year=1901): self.name = name self.year = year def getStr(self): return self.name + " (" + str(self.year) + ")"
186
66
from pwn.internal.shellcode_helper import * from ..misc.pushstr import pushstr @shellcode_reqs(arch=['i386', 'amd64'], os=['linux', 'freebsd']) def exit(returncode = None, arch = None, os = None): """Exits. Default return code, None, means "I don't care".""" returncode = arg_fixup(returncode) if arch == ...
2,275
712
from bundle import seeker @seeker.tracer(depth=2, only_watch=False) def main(): f2() def f2(): f3() def f3(): f4() @seeker.tracer(depth=2, only_watch=False) def f4(): f5() def f5(): pass expected_output = ''' Source path:... Whatever call 5 def main(): ...
1,037
319
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
1,451
417
import os import shutil import numpy as np import pandas as pd import matplotlib.pyplot as plt from read import clean_read from detrend import * def get_effect(data, param, mean, stddev, start_index, lag=3, effect_type=1, returning_gap=0, dropthrough=(0, 0), forcing=(None, None), max_e...
14,117
4,358
from lightning_transformers.task.nlp.multiple_choice.datasets.swag.data import ( # noqa: F401 SwagMultipleChoiceDataModule, )
131
48
import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) Motor1Enable = 5 Motor1B = 24 Motor1A = 27 Motor2Enable = 17 Motor2B = 6 Motor2A = 22 #single shot script used as a warning shot # Set up defined GPIO pins GPIO.setup(Motor1A,GPIO.OUT) GPIO.setup(Motor1B,GPIO.OUT) GPIO.setup(Motor1Enable,GPIO.OUT)...
871
460
import html import markdown import bleach import lxml.html from lxml.html import builder as E TAGS = [ 'p', 'img', 'em', 'strong', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'li', 'br', 'hr', 'a', 'img', 'blockquote', 'b', 'i', 'u', 's', 'pre', 'code', 'table', 'thead', 'tr', 'th', 'tbody', 'td' ] AT...
1,979
700
import subprocess import os def removeModule(filename): try: path = os.path.abspath(os.path.join(os.path.dirname(__file__),"..")) path = path +"/modules" shellCommand = "cd " + path + " && rm -r -f " + filename subprocess.call(shellCommand, shell=True) shellCommand = "node ...
552
159
from ...abstractObjects.hybridShapes.line import LinePtPt def AddNewLinePtPt(self, geometrical_set, start, end): part = geometrical_set.parentsDict['Part'] reference1 = part._createReferenceFromObject(start) reference2 = part._createReferenceFromObject(end) cat_constructor = self.cat_construc...
532
171
# Copyright (c) 2005-2011, Enthought, Inc. # All rights reserved. """ Support for managing resources such as images and sounds. Part of the TraitsGUI project of the Enthought Tool Suite. """
195
67
from tkinter import * class SemGrade: def __init__(self, win): self.lbl1=Label(win, text='Prelim:') self.lbl2=Label(win, text='Midterm:') self.lbl3=Label(win, text='Final:') self.lbl4=Label(win, text='Semestral Grade:') self.t1=Entry(bd=3) self.t2=Entry(bd=3...
1,223
543
import os import sys import pandas as pd from xml.etree import ElementTree as et cwd = os.getcwd() filepath = 'C:\\Users\\asimon\\Desktop\\Practice-' \ 'Training\\p21_template_out3.xml' def parse_wfd_xml(filepath): tree = et.parse(filepath) root = tree.getroot() data, page = root.findall('.//...
1,853
520
#!/usr/bin/env python from setuptools import setup # get version from memsql_loader import __version__ setup( name='memsql-loader', version=__version__, author='MemSQL', author_email='support@memsql.com', url='https://github.com/memsql/memsql-loader', download_url='https://github.com/memsql/me...
1,598
596
#MNE tutorial #Import modules import os import numpy as np import mne import re import complexity_entropy as ce #Import specific smodules for filtering from numpy.fft import fft, fftfreq from scipy import signal from mne.time_frequency.tfr import morlet from mne.viz import plot_filter, plot_ideal_filter ...
17,022
7,190
import numpy as np import scipy as sp class MahalanobisClassifier(): def __init__(self, samples, labels): self.clusters={} for lbl in np.unique(labels): self.clusters[lbl] = samples.loc[labels == lbl, :] def mahalanobis(self, x, data, cov=None): """Compute the Mahalanobis D...
1,790
595
import os import shutil import json import time import cv2 import numpy as np import PIL def convert_image_to_numpy(image) : (im_width, im_height) = image.size image_np = np.fromstring(image.tobytes(), dtype='uint8', count=-1, sep='') array_shape = (im_height, im_width, int(image_np.shape[0] / (im_height...
1,982
740
""" Training of a network """ import torch import sys import torch_optimizer as optim_all import numpy as np from .modules import rk4th_onestep_SparseId, rk4th_onestep_SparseId_parameter def learning_sparse_model(dictionary, Coeffs, dataloaders, Params,lr_reduction = 10, quite = False): ''' Parameters ...
12,891
4,016
cp ./* ~/server/uniquemachine/
31
14
from urllib import request from os import path, system from platform import system as osInfo from time import sleep from urllib import request def repairFileMain(): print("\n") repairAppData() sleep(.2) print("\n") repairEssential() sleep(.2) print("\n") def repairAppData():...
4,874
1,445
import os import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-port") parser.add_argument("-programmer") parser.add_argument("-binary") args = parser.parse_args() port_norm = args.port port_bootloader = f"{port_norm[0:3]}{int(port_norm[-1])+1...
581
222
# 空の固定長配列はNoneを入れておくと高速に生成できます a=[None] * 20 a[0]=a[1]=100 a[2]=200 for i in range(3,20): a[i] = a[i-1] + a[i-2] + a[i-3] print(a[19])
136
106
"""Test the basic functionality of the base and core data types.""" from datetime import date, time, datetime from typing import NoReturn from ontic import OnticType from ontic import property from ontic import type as o_type from ontic.meta import Meta from ontic.property import OnticProperty from ontic.schema import...
41,045
12,810
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.9.7) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x2a\xae\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x01\xd0\x0...
46,788
43,184
import json import logging import os import pdb import re from helpers.app_helpers import * from helpers.page_helpers import * from helpers.jinja2_helpers import * from helpers.telegram_helpers import * #from main import * #from flask import request #####################################################################...
5,503
1,795