text
string
size
int64
token_count
int64
from pyais.messages import NMEAMessage message = NMEAMessage(b"!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C") print(message.decode()) # or message = NMEAMessage.from_string("!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C") print(message.decode())
254
136
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:02:33 2019 @author: sercangul """ def maxConsecutiveOnes(x): # Initialize result count = 0 # Count the number of iterations to # reach x = 0. while (x!=0): # This operation reduces length ...
536
208
import numpy as np from .problem import Problem from .algorithm_genetic import GeneralEvolutionaryAlgorithm from .individual import Individual from .operators import CustomGenerator, nondominated_truncate, RandomGenerator, UniformGenerator import time class CMA_ES(GeneralEvolutionaryAlgorithm): """ Implementa...
6,744
1,973
# -*- coding: utf-8 -*- """ APNS Proxy Serverのクライアント """ import time import zmq import simplejson as json READ_TIMEOUT = 1500 # msec FLUSH_TIMEOUT = 5000 # msec COMMAND_ASK_ADDRESS = b'\1' COMMAND_SEND = b'\2' COMMAND_FEEDBACK = b'\3' DEVICE_TOKEN_LENGTH = 64 JSON_ALERT_KEY_SET = set(['body', 'action_loc_key', ...
4,988
1,566
import sys sys.path.insert(0, '..') import numpy import time import ConfigParser import topicmodel def main(): # read configuration file config = ConfigParser.ConfigParser() config.readfp(open('config.ini')) dataDir = config.get('main', 'dataDir') io = topicmodel.io(dataDir) model ...
800
274
#coding:utf-8 # # id: bugs.core_4318 # title: Regression: Predicates involving PSQL variables/parameters are not pushed inside the aggregation # decription: # tracker_id: CORE-4318 # min_versions: ['3.0'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, i...
2,660
927
#Import the json library to parse JSON file to Python import json #Import list of punctuation characters from the string library from string import punctuation as p #This method checks if the given word is a profanity def is_profanity(word): #Open the JSON file words_file = open('data.json') #Parse the JSON f...
1,047
314
from setuptools import setup import os here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() #NEWS = open(os.path.join(here, 'NEWS.txt')).read() rootdir = os.path.dirname(os.path.abspath(__file__)) exec(open(rootdir + '/cerridwen/version.py').read()) version = __VERS...
1,613
532
import datetime from abc import ABC, abstractmethod import pajbot class AccessToken(ABC): SHOULD_REFRESH_THRESHOLD = 0.9 """Fraction between 0 and 1 indicating what fraction/percentage of the specified full validity period should actually be utilized. E.g. if this is set to 0.9, the implementation will ...
4,768
1,395
#! /usr/bin/python3 # Description: Data_Ghost, concealing data into spaces and tabs making it imperceptable to human eyes. # Author: Ajay Dyavathi # Github: Radical Ajay class Ghost(): def __init__(self, file_name, output_format='txt'): ''' Converts ascii text to spaces and tabs ''' self.file_name...
1,686
555
# Image classification using AWS Sagemaker and Linear Learner # Program set up and import libraries import numpy as np import pandas as pd import os from sagemaker import get_execution_role role = get_execution_role() bucket = 'chi-hackathon-skin-images' # Import Data import boto3 from sagemaker import get_execution...
1,965
656
#!/usr/bin/env python # -*- coding: utf-8 -*- # copyright 2015 Hamilton Kibbe <ham@hamiltonkib.be> and Paulo Henrique Silva # <ph.silva@gmail.com> # 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...
34,227
10,470
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-08-19 17:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('heroquest', '0001_initial'), ] operations = [ migrations.RemoveField( ...
600
200
from distutils.version import LooseVersion import difflib import os import numpy as np from .core import Array from ..async import get_sync if LooseVersion(np.__version__) >= '1.10.0': allclose = np.allclose else: def allclose(a, b, **kwargs): if kwargs.pop('equal_nan', False): a_nans = np...
1,727
598
# more specific selections for Python 3 (ASkr, 2/2018) from launchpad_py.launchpad import Launchpad from launchpad_py.launchpad import LaunchpadMk2 from launchpad_py.launchpad import LaunchpadPro from launchpad_py.launchpad import LaunchControlXL from launchpad_py.launchpad import LaunchKeyMini from launchpad_py.launch...
370
116
import base64 import math import re from io import BytesIO import matplotlib.cm import numpy as np import torch import torch.nn from PIL import Image # Compute edge magnitudes from scipy import ndimage class RunningAverage: def __init__(self): self.avg = 0 self.count = 0 ...
4,174
1,748
"""In programming, a factory is a function that returns an object. Functions are easy to understand because they have clear inputs and outputs. Most gdsfactory functions take some inputs and return a Component object. Some of these inputs parameters are also functions. - Component: Object with. - name. - refe...
8,439
2,772
# -*- coding: utf-8 -*- # Code will only work with Django >= 1.5. See tests/config.py import re from django.utils.translation import ugettext_lazy as _ from django.db import models from django.core import validators from django.contrib.auth.models import BaseUserManager from oscar.apps.customer.abstract_models impor...
1,685
484
import pickle import numpy as np INPUT_FILENAME = 'NP_WEIGHTS.pck' PRECISION = 100 # Open weights fc1_k, fc1_b, fc2_k, fc2_b = pickle.load( open(INPUT_FILENAME, 'rb')) # Round them fc1_k, fc1_b, fc2_k, fc2_b = fc1_k*PRECISION//1, fc1_b*PRECISION//1, fc2_k*PRECISION//1, fc2_b*PRECISION*PRECISION//1 fc1_k, fc1_b, f...
3,253
1,507
import cv2 import numpy as np import random img = cv2.imread('../../Assets/Images/flower-white.jpeg', 1) imgInfo = img.shape height = imgInfo[0] width = imgInfo[1] cv2.imshow('img', img) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) imgG = cv2.GaussianBlur(gray, (3, 3), 0) dst = cv2.Canny(img, 50, 50) cv2.imshow(...
346
165
"""Detection model trainer. This file provides a generic training method to train a DetectionModel. """ import datetime import os import tensorflow as tf import time from avod.builders import optimizer_builder from avod.core import trainer_utils from avod.core import summary_utils slim = tf.contrib.slim def train(m...
7,767
2,342
import binascii import os from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ class HMACKey(models.Model): """ The default HMACKey model that can auto generate a key/secret for HMAC Auth via a signal """ def generate_key(): ...
1,237
384
import os from tempfile import NamedTemporaryFile import boto3 from moto import mock_s3 import pandas as pd import pandavro as pdx import pickle import pytest @pytest.fixture(autouse=True, scope='session') def aws_credentials(): """ Sets AWS credentials to invalid values. Applied to all test functions and ...
6,222
2,272
# -*- coding: utf-8 -*- # Generated by Django 1.9.10 on 2016-12-08 11:13 from __future__ import unicode_literals from django.db import migrations from company import helpers def ensure_verification_code(apps, schema_editor): Company = apps.get_model("company", "Company") for company in Company.objects.filte...
641
220
import pytest import asyncio from system.utils import * from random import randrange as rr import hashlib import time from datetime import datetime, timedelta, timezone from indy import payment import logging logger = logging.getLogger(__name__) @pytest.mark.usefixtures('docker_setup_and_teardown') class TestAuthMa...
68,544
20,623
import opensearchpy import curator import os import json import string import random import tempfile import click from click import testing as clicktest import time from . import CuratorTestCase from unittest.case import SkipTest from . import testvars as testvars import logging logger = logging.getLogger(__name__) ...
18,351
5,581
import libhustpass.sbDes as sbDes import libhustpass.captcha as captcha import requests import re import random def toWideChar(data): data_bytes = bytes(data, encoding="utf-8") ret = [] for i in data_bytes: ret.extend([0, i]) while len(ret) % 8 != 0: ret.append(0) return ret def En...
2,235
806
import cv2 as cv import numpy as np def areaFinder(contours): areas = [] for c in contours: a =cv.contourArea(c) areas.append(a) return areas def sortedContoursByArea(img, larger_to_smaller=True): edges_img = cv.Canny(img, 100, 150) contours , h = cv.findContours(edges_img, cv.RETR_...
779
302
"""Precision for ranking.""" import numpy as np from matchzoo.engine.base_metric import ( BaseMetric, sort_and_couple, RankingMetric ) class Precision(RankingMetric): """Precision metric.""" ALIAS = 'precision' def __init__(self, k: int = 1, threshold: float = 0.): """ :class:`Preci...
1,813
592
from mung.torch_ext.eval import Loss from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput from ltprg.model.seq import VariableLengthNLLLoss # Expects config of the form: # { # data_parameter : { # seq : [SEQUENCE PARAMETER NAME] # inp...
4,168
1,460
from shutil import move import piexif from PIL import Image def delete_metadata(full_path_to_img): """ This function used for remove metadata only from documents, if you send image 'as image' Telegram automatically removes all metadata at sending. This function removes all metadata via 'piexif' lib, save...
1,086
319
#py_unit_2.py import unittest class FirstTest(unittest.TestCase): def setUp(self): "setUp() runs before every test" self.msg="Sorry, Charlie, but {} is not the same as {}." def tearDown(self): "tearDown runs after every test" pass def test_me(self): "this test should pass" first=1 second=2 self.asse...
765
306
from .scheduled_task import ScheduledTask
41
11
from sys import exit # ------------------------------------------------------------------------------ global dev_name global game_title dev_name = "" # enter your name in the quotes! game_title = "" # enter the game title in the quotes! # ------------------------------------------------------------------------------ ...
1,623
477
class Solution: def defangIPaddr(self, address: str) -> str: i=0 j=0 strlist=list(address) defang=[] while i< len(strlist): if strlist[i] == '.': defang.append('[') defang.append('.') defang.append(']') ...
510
146
import os, zipfile # Zip files. def zipfiles(directory): # File extension to zip. #ext = ('.gdb', '.csv') ext = ('.gdb') # Iterate over all files and check for desired extentions for zipping. for file in os.listdir(directory): if file.endswith(ext): #: Zip it. ...
1,018
361
class Node: def __init__(self, path, libgraphql_type, location, name): self.path = path self.parent = None self.children = [] self.libgraphql_type = libgraphql_type self.location = location self.name = name def __repr__(self): return "%s(%s)" % (self.libg...
344
107
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
5,097
1,748
""" 例子为MNIST,对手写图片进行分类。 神经网络hello world。 """ import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) # 封装网络用到的API def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf....
3,419
1,509
import pbge from game.content.plotutility import LMSkillsSelfIntro from game.content import backstory from pbge.plots import Plot from pbge.dialogue import Offer, ContextTag from game.ghdialogue import context import gears import game.content.gharchitecture import game.content.ghterrain import random from game import m...
34,924
11,106
import json if __name__ == '__main__': jsonFile = '/data00/home/zhangrufeng1/projects/detectron2/projects/detr/datasets/mot/mot17/annotations/mot17_train_half.json' with open(jsonFile, 'r') as f: infos = json.load(f) count_dict = dict() for info in infos["images"]: if info["file_name"]...
1,061
420
# -*- coding: utf-8 -*- """Archivo principal para el echobot. Main File for the echobot""" from fbmq import Page from flask import Flask, request # Token generado por la página web. Generated token in the facebook web page PAGE_ACCESS_TOKEN = "COPY_HERE_YOUR_PAGE_ACCES_TOKEN" # Token generado por nosotros. Token gener...
3,099
944
# -*- coding: utf-8 -*- from __future__ import print_function from matplotlib import pyplot as plt import matplotlib.image as mpimg import numpy as np import scipy.misc import random import os import imageio ############################# # global variables # ############################# root_dir = "/ho...
7,607
3,698
#!/usr/bin/env python import websocket import time try: import thread except ImportError: import _thread as thread runs = 100 def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws): print("### closed ###") def on_open(ws): ...
804
309
import pandas as pd import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats import seaborn as sns from matplotlib import rcParams import statsmodels.api as sm from statsmodels.formula.api import ols df = pd.read_csv('kc_house_data.csv') # print(df.head()) # print(df.isnull().any()) # print(df.d...
932
380
# Dialogs for setting filter parameters. from PyQt5.QtWidgets import QLabel, QGridLayout, QPushButton, \ QLineEdit, QVBoxLayout, QHBoxLayout, QDialog, QComboBox, QWidget from PyQt5.QtCore import pyqtSignal class FilterDialog(QDialog): ''' Dialog for choosing filter types. ''' def __init__(self, default, parent ...
3,915
1,534
#!/usr/bin/env python3 # 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 from .build import build, make_path from parlai.utils.misc import warn_once from parlai.core.teachers import...
813
264
from math import ceil, sqrt from problem import Problem from utils.math import gcd class PythagoreanTriplet(Problem, name="Special Pythagorean triplet", expected=31875000): @Problem.solution() def brute_force(self, ts=1000): for a in range(3, round((ts - 3) / 2)): for b in range(a + 1, ro...
1,228
420
# -*- coding: utf-8 -*- """ Created on Thu Jan 14 10:37:04 2021 @author: martin urbanec """ #calculates trajectory of small mass positioned close to L4 Lagrange point #creates gif as output import math import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation, PillowWriter ...
4,345
2,407
from __future__ import unicode_literals import json from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, sanitized_Request, ) class AzubuIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?azubu\.tv/[^/]+#!/play/(?P<id>\d+)' _TESTS = [ { 'ur...
5,078
1,860
# (c) Continuum Analytics, Inc. / http://continuum.io # All Rights Reserved # # conda is distributed under the terms of the BSD 3-clause license. # Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_import, division, print_function import sys from os.path import join, ...
8,157
2,455
#!/bin/env python3 from transformers import TFBertForTokenClassification from data_preparation.data_preparation_pos import MBERTTokenizer as MBERT_Tokenizer_pos import sys if __name__ == "__main__": if len(sys.argv) > 1: modelname = sys.argv[1] else: modelname = "ltgoslo/norbert" model = T...
494
170
from oslo_serialization import jsonutils as json from nca47.api.controllers.v1 import base from nca47.common.i18n import _ from nca47.common.i18n import _LI, _LE from nca47.common.exception import Nca47Exception from oslo_log import log from nca47.api.controllers.v1 import tools from nca47.manager.central import Centra...
10,192
2,695
import numpy as np import torch from torch import nn from torch.nn import functional as F def seasonality_model(thetas, t, device): p = thetas.size()[-1] assert p < 10, 'thetas_dim is too big.' p1, p2 = (p // 2, p // 2) if p % 2 == 0 else (p // 2, p // 2 + 1) s1 = torch.tensor([np.cos(2 * np.pi * i * ...
6,992
2,428
from math import exp from random import seed from random import random def initialize_network(n_inputs, n_hidden, n_outputs): network = list() hidden_layer = [{'weights':[random() for i in range(n_inputs + 1)]} for i in range(n_hidden)] network.append(hidden_layer) output_layer = [{'weights':[random() for i in r...
2,916
1,333
"""\ Copyright (c) 2009 Paul J. Davis <paul.joseph.davis@gmail.com> This file is part of hypercouch which is released uner the MIT license. """ import time import unittest import couchdb COUCHURI = "http://127.0.0.1:5984/" TESTDB = "hyper_tests" class MultiDesignTest(unittest.TestCase): def setUp(self): s...
1,993
686
from .sample_setup import * ctr = setup_control() eff = ColorMeanderEffect(ctr, "solid") eff.launch_rt() input() eff.stop_rt() ctr.turn_off()
144
56
"""Torch NodeEmbedding.""" from datetime import timedelta import torch as th from ...backend import pytorch as F from ...utils import get_shared_mem_array, create_shared_mem_array _STORE = None class NodeEmbedding: # NodeEmbedding '''Class for storing node embeddings. The class is optimized for training larg...
6,739
1,891
from __future__ import absolute_import from django.core.urlresolvers import reverse from sentry.models import OrganizationMember, OrganizationMemberTeam, Team from sentry.testutils import TestCase, PermissionTestCase class CreateTeamPermissionTest(PermissionTestCase): def setUp(self): super(CreateTeamPe...
2,815
811
import abc import datetime import enum import logging import time import typing import aysncio import Layout as layouts from decimal import Decimal from pyserum.market import Market from pyserum.open_orders_account import OpenOrdersAccount from solana.account import Account from solana.publickey import PublicKey from...
61,742
19,328
# Generated by Django 3.2.8 on 2021-11-29 05:47 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('agendamentos', '0010_agendamentosfuncionarios'), ] operations = [ migrations.AlterModelTable( name='agendamentosfuncionarios', ...
373
126
# 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,288
390
import unittest import os from pyxdsm.XDSM import XDSM, __file__ from numpy.distutils.exec_command import find_executable def filter_lines(lns): # Empty lines are excluded. # Leading and trailing whitespaces are removed # Comments are removed. return [ln.strip() for ln in lns if ln.strip() and not ln....
10,706
3,657
# -*- coding: utf-8 -*- from wecom_sdk.base.crypt import encrypt_msg, decrypt_msg class WeChatWorkCallbackSDK(object): """ 企业微信回调SDK基本类,用于实现内部系统和企业微信客户端的双向通信 详细说明:https://work.weixin.qq.com/api/doc/90000/90135/90930 """ def __init__(self, token, encoding_aes_key): self.token = token ...
926
366
import psycopg2 from decouple import config import pandas as pd import dbconnect cursor, connection = dbconnect.connect_to_db() sql = """ SELECT "table_name","column_name", "data_type", "table_schema" FROM INFORMATION_SCHEMA.COLUMNS WHERE "table_schema" = 'public' ORDER BY table_name """ df = pd.read_sql(sql, con=co...
351
121
#!/usr/bin/env python # -*- coding: utf8 -*- import sys try: from cdecimal import Decimal except ImportError: # pragma: no cover from decimal import Decimal from agate import Table from agate.aggregations import Sum from agate.computations import Percent from agate.data_types import Number, Text from agate....
7,880
2,636
import os os.makedirs(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'build')), exist_ok=True) from .chamfer_distance import ChamferDistance
156
59
from functools import partial from impartial import impartial def f(x: int, y: int, z: int = 0) -> int: return x + 2*y + z def test_simple_call_args(): assert impartial(f, 1)(2) == f(1, 2) def test_simple_call_kwargs(): assert impartial(f, y=2)(x=1) == f(1, 2) def test_simple_call_empty(): asse...
1,332
580
''' Python script for uploading/downloading scripts for use with the game Screeps. http://support.screeps.com/hc/en-us/articles/203022612-Commiting-scripts-using-direct-API-access Usage: # # general help/usage # python3 manager.py --help # # retrieve all scripts from the game and store them...
5,076
1,544
class Contact: def __init__(self, first_name, last_name, nickname, address, mobile, email): self.first_name = first_name self.last_name = last_name self.nickname = nickname self.address = address self.mobile = mobile self.email = email
289
83
import logging from django.views.generic import TemplateView from ...models import Feedback from ..chat.chat_context_mixin import ChatContextMixin logger = logging.getLogger(__name__) class AdminDashboardView(TemplateView, ChatContextMixin): """ View for the admin dashboard """ #: The template to ...
1,158
338
from typing import Optional import bisect from tangled_up_in_unicode.u14_0_0_data.prop_list_to_property import prop_list_to_property from tangled_up_in_unicode.u14_0_0_data.blocks_to_block_start import blocks_to_block_start from tangled_up_in_unicode.u14_0_0_data.blocks_to_block_end import blocks_to_block_end from ta...
15,144
5,104
from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import ST7735 # Create ST7735 LCD display class object and set pin numbers and display hardware information. disp = ST7735.ST7735( dc=24, cs=ST7735.BG_SPI_CS_BACK, rst=25, port=0, width=122, height=160, ro...
1,379
557
import sqlite3 conn=sqlite3.connect('Survey.db') fo=open('insertcommand.txt') str=fo.readline() while str: str="INSERT INTO data VALUES"+str conn.execute(str) #print(str) str=fo.readline() conn.commit() conn.close() fo.close()
245
91
# DO NOT EDIT THIS FILE! # # This file is generated from the CDP specification. If you need to make # changes, edit the generator and regenerate all of the modules. # # CDP domain: HeadlessExperimental (experimental) from __future__ import annotations from cdp.util import event_class, T_JSON_DICT from dataclasses impo...
4,719
1,372
import unittest from wvflib.geometry import Face class TestGeometry(unittest.TestCase): def test_constructor(self): f = Face() self.assertTrue(len(f.vertices) == 0) if __name__ == '__main__': unittest.main()
237
83
import pytest from detectem.core import Detector, Result, ResultCollection from detectem.plugin import Plugin, PluginCollection from detectem.settings import INDICATOR_TYPE, HINT_TYPE, MAIN_ENTRY, GENERIC_TYPE from detectem.plugins.helpers import meta_generator class TestDetector(): HAR_ENTRY_1 = { 'requ...
11,325
3,603
from django.dispatch.dispatcher import receiver from django.shortcuts import get_object_or_404, redirect, render from django.contrib.auth.decorators import login_required from django.http.response import HttpResponse from django.contrib.auth.models import User from django.contrib.auth import authenticate, logout as aut...
8,317
2,457
# Copyright (c) 2022, momscode and Contributors # See license.txt # import frappe import unittest class Testdepart(unittest.TestCase): pass
143
53
"""Python APIs for STIX 2. .. autosummary:: :toctree: api confidence datastore environment equivalence exceptions markings parsing pattern_visitor patterns properties serialization utils v20 v21 versioning workbench """ # flake8: noqa DEFAULT_VERSION = '2.1' # De...
2,057
588
count = int(input()) title = 0 while count > 0: title += 1 if '666' in str(title): count -= 1 print(title)
125
52
# This file is automatically generated by tools/idna-data # vim: set fileencoding=utf-8 : """IDNA Mapping Table from UTS46.""" __version__ = "11.0.0" def _seg_0(): return [ (0x0, '3'), (0x1, '3'), (0x2, '3'), (0x3, '3'), (0x4, '3'), (0x5, '3'), (0x6, '3'), (0x7, '3...
197,684
139,025
# -*- coding: utf-8 -*- import numpy as np import torch from torch import nn from kbcr.kernels import GaussianKernel from kbcr.smart import NeuralKB import pytest @pytest.mark.light def test_smart_v1(): embedding_size = 50 rs = np.random.RandomState(0) for _ in range(32): with torch.no_grad(...
3,078
1,102
import tkinter window=tkinter.Tk() window.title("YUN DAE HEE") window.geometry("640x400+100+100") window.resizable(True, True) image=tkinter.PhotoImage(file="opencv_frame_0.png") label=tkinter.Label(window, image=image) label.pack() window.mainloop()
254
105
from django.urls import path, include from .views import main_view, PredictionView #router = routers.DefaultRouter(trailing_slash=False) #router.register('years', YearView, basename='years') #router.register('predict', PredictionView, basename='predict') urlpatterns = [ #path('api/', get_dummy_data), #path('...
584
196
from django.conf import settings from termcolor import colored #: Red color constant for :func:`.ievv_colorize`. COLOR_RED = 'red' #: Blue color constant for :func:`.ievv_colorize`. COLOR_BLUE = 'blue' #: Yellow color constant for :func:`.ievv_colorize`. COLOR_YELLOW = 'yellow' #: Grey color constant for :func:`.i...
1,547
535
# coding: utf-8 # In[1]: import baostock as bs import pandas as pd import numpy as np import talib as ta import matplotlib.pyplot as plt import KlineService import BaoStockUtil import math import datetime from scipy import integrate from RSI import DayRSI,WeekRSI,MonthRSI,SixtyMinRSI from concurrent.futures import...
12,438
4,882
# Copyright 2016 Orange # # 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, softw...
1,558
502
from kivy.properties import NumericProperty from gui.sensors.sensor import Sensor import config class ProximitySensor(Sensor): """Proximity sensor view""" # maximum possible reading max = NumericProperty(config.ProximitySensor.max) # minimum possible reading min = NumericProperty(config.Proximit...
333
101
#도움말 import discord from discord.ext import commands from discord.ext.commands import Context from define import * class HelpCommand_Context(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(name="도움말", aliases=["명령어", "?"]) @CommandExecutionTime async def _Hel...
9,360
4,896
import cProfile import pstats import os # 性能分析装饰器定义 def do_cprofile(filename): """ Decorator for function profiling. """ def wrapper(func): def profiled_func(*args, **kwargs): # Flag for do profiling or not. DO_PROF = False if DO_PROF: profil...
778
210
# Copyright 2019 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
1,629
469
# -*- coding: utf-8 -*- from .converters import Converter, UnstructureStrategy __all__ = ('global_converter', 'unstructure', 'structure', 'structure_attrs_fromtuple', 'structure_attrs_fromdict', 'UnstructureStrategy') __author__ = 'Tin Tvrtković' __email__ = 'tinchester@gmail.com' global_conve...
864
259
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., 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 # # http://www.apache.org/licenses/LICENS...
4,531
1,499
""" StarGAN v2 Copyright (c) 2020-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, US...
12,512
4,575
# Uses python3 import sys def lcm_naive(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b def gcd(a, b): if a%b == 0: return b elif b%a == 0: return a if a > b: return gcd(a%b, b) else: return gcd(b%...
534
241
import random highscore = [] def not_in_range(guess_it): """This is to check that the numbers inputted by the user are in range, and will let the user know. If the numbers are in range then it passes. """ if guess_it < 1: print('I am not thinking of negative numbers!') elif guess_it > 10:...
2,261
657
#!/usr/bin/env python3 USER = r'server\user' PASSWORD = 'server_password' HOSTNAME = 'hostname.goes.here.com' DOMAIN = 'domain.goes.here.com' FROM_ADDR = 'emailyouwanttosendmessagesfrom@something.com'
201
77
#!/usr/bin/python3 # # MIT License # # Copyright (c) 2021 Arkadiusz Netczuk <dev.arnet@gmail.com> # # 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 limi...
1,956
629
import click APP_YAML_TEMPLATE = """runtime: python37 env_variables: ELMO_BASE_URL: '{BASE_URL}' ELMO_VENDOR: '{VENDOR}' handlers: - url: /.* script: auto secure: always redirect_http_response_code: 301 """ @click.command() @click.argument("base_url") @click.argument("vendor") def generate_app_yaml(base_u...
984
346