index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
997,500
7d243749035c1f076379e55e3f0754d48bd213ca
# Generated by Django 3.1.3 on 2020-11-23 02:06 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', models.AutoField(aut...
997,501
2a35e0f6c9b4a47e1be246871dd05a452200bf90
from datetime import date, datetime import hashlib, inspect from django.db.models import Q from django.contrib.auth import authenticate, login, logout, models as auth_models from django.contrib.auth.hashers import make_password from django.conf.urls import url from django.utils import timezone from tastypie import re...
997,502
a230c9fe5b03df50cf7c26f74f8af3a979877dfa
# -*- coding: utf-8 -*- { 'name': 'NCSS Appraisal', 'version': '13.0.1', 'summary': 'NCSS Appraisal', 'category': 'hr', 'author': 'Magdy,TeleNoc', 'description': """ NCSS Survey """, 'depends': ['base', 'mail', 'hr_appraisal'], 'demo': [ 'demo/demo.xml' ], 'data':...
997,503
df5378c239f6bbc4ffd076f27c878b88e9693b29
from station import Station from BeautifulSoup import BeautifulStoneSoup import urllib, urllib2 import re HOST = "http://clientes.domoblue.es/onroll/" SERVICE_URL = HOST+"generaXml.php?token={token}&cliente={client_id}" TOKEN_URL = HOST+"generaMapa.php?cliente={client_id}" TOKEN_RE = "generaXml\.php\?token\=(.*?)\&cl...
997,504
13f7029aaa68686784c2a0c04274cb304c614156
#!/usr/bin/python import subprocess import os import sys subprocess.call(["/usr/bin/git diff"])
997,505
4930b37a3c1e3ad86eee48f449f2f5032c3208a0
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from dao import Connections from utilities import * class ViewItemById(QWidget): def __init__(self): super().__init__() self.PrepareScreen() def PrepareScreen(self): self.setWindowTitle("View Item BY ID Screen") self.setGe...
997,506
29876abf8be229a59032affbbca511425e90846b
from abc import ABC, abstractmethod from enum import Enum from errors import TooManyRetriesError class FailAction(Enum): Cancel = 0 Retry = 1 class Manager(ABC): def __init__(self, validator, queries): self.queries = queries self.validator = validator def send(self,...
997,507
0a6095392b826041c5023c8bf223ff432b7d5323
from askmath.entities import TextMessage from askmath.models.classe import Classe as ClasseModel from askmath.models.users import Student as StudentModel from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.http import Htt...
997,508
4250a6e00141e048b8afa7b78adc14fd51433a5d
#!/bin/python3 import math import os import random import re import sys #begining of my code ######################## #looking for nodes def look_for_nodes(edges): #get the list of edges nodes=[] for i in range(len(edges)): nodes.append(edges[i][0]) nodes.append(edges[i][1]) #clean ...
997,509
2de8d3548d6f4d321d94210cfacaadaf8223edf9
from aiogram import types from aiogram.types import CallbackQuery from keyboards.inline import feedback from loader import dp @dp.message_handler(text="Для жалоб и предложений") async def price_list(message: types.Message): await message.answer("Вот кому ты можешь обратится", reply_markup=feedback) @dp.callba...
997,510
86234666011cd777b7c98030dd436376e20b1ca9
import yaml import argparse import os from os import path as osp import argparse import joblib from time import sleep from collections import defaultdict import numpy as np import torch import rlkit.torch.pytorch_util as ptu from rlkit.envs.few_shot_fetch_env import _BaseParamsSampler from rlkit.envs.few_shot_fetch_e...
997,511
0e7a3c47516cf45b2982ea0cb35829d79dadc729
#!venv/bin/python3 from include.dto.UserDTO import UserDTO from include.dto.VacancyDTO import VacancyDTO from include.ArgsParse import ArgsParser from include.api.ZarplataApi import ZpApi from include.helpers.PhoneFormat import PhoneFormat from include.helpers.PasswordGen import PasswordGen import requests from include...
997,512
782f0b76591777abc5bab93d4affb3689df4d284
import numpy as np from PIL import Image def preprocess(img): img = Image.fromarray(img) img = img.resize((84, 110)) img = img.crop((0, 26, 84, 110)) img = img.convert('L') img = img.resize((64, 64)) img = np.array(img) / 255 img = np.float16(img) return img def init_state(img) : s...
997,513
74d0ce75a8086d5c3a32163199cb1c0b92facc4d
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-07-06 08:10 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('prodsys', '0028_auto_20170626_1131'), ] operations = [ migrations.AddField( ...
997,514
57f589b7778d873e09adaa65da31d36296ab97e6
from django.db import models from django.db.models import Q from django.contrib.auth.models import User from django.contrib.auth import authenticate class Tag(models.Model): name = models.CharField(max_length=20) def __str__(self): return self.name class Skill(models.Model): short_name = models...
997,515
1549139c082cff86e0d6b2bde5d914f4a60dcb5e
N, K = map(int, input().split()) A = list(map(int, input().split())) A = sorted(A) def ncr(n, r, p): num = den = 1 for i in range(r): num = (num * (n - i)) % p den = (den * (i + 1)) % p return (num * pow(den, p - 2, p)) % p Mod = 10**9+7 fac = [1, 1] finv = [1, 1] inv = [0, 1] def COMinit(): #N_C_kのN ...
997,516
937c7f28a66392ba8e7b2da4e894bf524d0eb848
def reverse(s): t = [] for letter in reversed(s): t.append(letter)
997,517
610177912de2a3ec3c37d40a0f739d91419d5c73
from __future__ import unicode_literals import youtube_dl import glob, os def vid2aud(): ydl_opts = { 'format': 'bestaudio/best', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'wav', 'preferredquality': '192', }], } with youtube_dl.YoutubeDL(ydl_opts) ...
997,518
7f446dfe41ab08345dedfd9920e82578cf02cccc
# program with operation on 2 sets x = set("runoob") y = set("google") print("x =", x) print("y =", y) print("x & y =", x & y) print("x | y =", x | y) print("x - y =", x - y)
997,519
892299e773795313480429831cd624e708049edb
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/client/gui/battle_control/arena_info/team_overrides.py import VOIP from gui.battle_control import avatar_getter from gui.battle_control.arena_info.arena_vos import VehicleActions from gui.battle_control.arena_info import settings _DELIVERY...
997,520
687c541cebb563651fae80a21ac80a62f6deb1b0
import asyncio import mimetypes import os import pathlib from . import hdrs from .helpers import create_future from .http_writer import PayloadWriter from .log import server_logger from .web_exceptions import HTTPNotModified, HTTPOk, HTTPPartialContent, HTTPRequestRangeNotSatisfiable from .web_response import StreamRes...
997,521
b05fda2e75058756fbd8f19bb79d1646ed38c4e3
# -*- coding:utf-8 -*- ''' This module mainly handle user's settings,which include basic information and contact information. Also,the 3th auth and user confirm are here. ''' from __init__ import BaseHandler from __init__ import USER_STATUS, AUTHORIZE_OPTIONS, set_image_size import tornado.web from hashlib impo...
997,522
ff1f329f1c821b05418ee9482ac0504c3ecd1dc1
from django.db import models class Fruitmodel(models.Model): fruitname=models.CharField(max_length=40) price=models.IntegerField() desc=models.CharField(max_length=300) favourite=models.BooleanField() imgpath=models.CharField(max_length=40) rating=models.IntegerField() color=models.CharFiel...
997,523
16287e31dbf2e632a97f1cc29e947458a143e12f
import torch import numpy as np import cv2 from os import listdir import pandas as pd try: from itertools import ifilterfalse except ImportError: # py3k from itertools import filterfalse def mean(l, ignore_nan=False, empty=0): """ nanmean compatible with generators. """ l = iter(l) if ...
997,524
93fce8c8f28a642242cbec866830b52e2e0fa5a6
# Copyright 2016 Red Hat, Inc. # # 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...
997,525
501767568dfdb71160b2a5d00eebdb2a7eab080a
# -*- coding: utf-8 -*- import jinja2 from mail.mail import sendpost from contextlib import closing import ConfigParser import sqlite3 import sys, getopt def main(argv): reload(sys) sys.setdefaultencoding('utf8') section = 'CATS' opts, args = getopt.getopt(argv,"s:") for opt,arg in opts: ...
997,526
61f8c7e3f123ba1f710b8ce64a843962c7b4fe22
# coding: utf-8 import logging import os import tweepy # https://github.com/tweepy/tweepy # https://dev.twitter.com/docs # https://dev.twitter.com/apps/ID/show def tweet(message, consumer_key=None, consumer_secret=None, access_token=None, access_token_secret=None, debug=False): consumer_key = os.environ.get('TW...
997,527
0b686e358ccfef3aa8e4ef429e811f1ebfbf4ab5
# coding=utf-8 import json import re import requests from bs4 import BeautifulSoup import sys dir_path = sys.argv[1] #url = 'https://buy.yungching.com.tw/region/%E5%8F%B0%E5%8C%97%E5%B8%82-_c/' header_s={ 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'A...
997,528
6f860612a06d2c4ce10172c7183e90e892ce76a3
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import visualize.models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ ...
997,529
f673e10486e7039981a185af597ac7aa24dbbf40
import wikipedia import os inpt = open("pageTitleList.txt", "r") lines = inpt.readlines() try: os.mkdir("output") except FileExistsError: pass for line in lines: line = line.strip() print("Looking for: \""+line+"\"") try: page = wikipedia.page(line) print("found: \""+line+"\"") ...
997,530
5dc150eb93d74597d283b3dc0fed204ec90cee52
# -*- coding: utf-8 -*- #---------------------------------------------------------------------------- # Name: web_ui.py # Purpose: The image svg file handler module # # Author: Richard Liao <richard.liao.i@gmail.com> # #---------------------------------------------------------------------------- fro...
997,531
21930a951dac4e7df14565149a70c28c075cd6d3
'''<><><><><><><><><><><><><><><><><><><><><><><><> TouchPlus This defines an augmented touch object that includes its own simple tracking algorithms, a sprite representation, and gesture area calculations BEGIN <><><><><><><><><><><><><><><><><><><><><><><><>''' import scene import console from colorsys imp...
997,532
30258c9d63c6a694b54da8d653dc8f6d43142125
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmagic.models.editors.nafnet.naf_layerNorm2d import LayerNorm2d def test_layer_norm(): inputs = torch.ones((1, 3, 64, 64)) targets = torch.zeros((1, 3, 64, 64)) layer_norm_2d = LayerNorm2d(inputs.shape[1]) outputs = layer_norm_2d(inpu...
997,533
b9ad24f008dbe6a0cb1b6b23e732d7ae26d1f774
import subprocess import sys import pytest import inspect from test_utils import * import os.path import time import random # try: # import memory_profiler # except ImportError: # subprocess.check_call([sys.executable, "-m", "pip", "install", 'memory-profiler']) # finally: # import memory_profiler # fro...
997,534
1375b2c2415f467fd44650b0497061fad7b00ce8
#!/usr/bin/env python3 # -*- 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. # -------------------...
997,535
b3fd4ac85214a5781ab3f7aaba0a976ec8e98d89
#!/usr/bin/python """ @author Ryan Summers @date 2-27-2018 @brief Returns labeled or validated datasets to the robosub server. """ from __future__ import print_function import datetime import json import os import pysftp import shutil import sys import tempfile import glob import tarfile import progressbar try: ...
997,536
ef9ce8c5e07e7c7b161de0608ef4ae21b213ca9f
import torch import pandas as pd from torch.utils.data import DataLoader from torchvision.transforms import Compose from utils import extract_cnrpark_extra_dataset, fix_random_seed, device, extract_annotation_file, remove_parentheses from constants import TEST_CNRPARK_EXTRA_ANNOTATION, RANDOM_SEED, PKLOT_DATA_DIR, TE...
997,537
eb95cd27a422b1f262e1412a9d5638c2b47a7f83
#!/usr/bin/python3 from program.recognition_app import RecognitionApp if __name__ == "__main__": appli = RecognitionApp() appli.mainloop()
997,538
c8f5457e1514d50f6ee27ae658810b2e36770e06
from pylab import * from scipy import signal from numpy import * import netCDF4 as nc import pyroms as p from scipy.special import erf from scipy.integrate import cumtrapz #this code reads grid data from an existing grid file, uses it to #define a boundary forcing file for roms. If you need the boundary #forcing file ...
997,539
bfdd4255301196194a2bd39991e72f1664f8ae94
import uuid from datetime import datetime, timedelta from bson.tz_util import utc from flask.sessions import SessionInterface, SessionMixin from werkzeug.datastructures import CallbackDict __all__ = ("MongoEngineSession", "MongoEngineSessionInterface") class MongoEngineSession(CallbackDict, SessionMixin): def _...
997,540
3d923623ca8cbbaa87c84e5fd69ed00a90743849
import json f=open('.json','r') print(json.loads(f.read()))
997,541
928601da4090decfbb74b9499c0c7e47e445c529
from flask import current_app as app from pytz import timezone, UTC from datetime import timedelta import time, datetime import random import uuid import requests import sys import pandas as pd import json def handle_error(req): try: req.raise_for_status() # Binance code errors if 'code' in json.loads(req.c...
997,542
9c92d29262041d4d363d4511602396537c218a7e
from django.urls import path,re_path from todo_app.viewsets import TodoViewSet from django.conf.urls import url urlpatterns = [ url('^getall/$', TodoViewSet.as_view({'get':'list'}), name='todo_list' ), url('^create/$', TodoViewSet.as_view({'post':'create'}), name='todo_create' ), url('^get/(?P<id>[0-9]+)/$...
997,543
e59fc02b136633fda967b472dcc842352b114ad4
from rest_framework import viewsets, mixins from rest_framework.parsers import MultiPartParser, FileUploadParser from rest_framework.viewsets import GenericViewSet from .models import Post, PostFile from .serializers import PostSerializer, PostFileSerializer class PostViewSet(viewsets.ModelViewSet): """ A Po...
997,544
fe517fe10152ff12af1f54cd4444576bec21a3f6
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets from bokeh.plotting import figure from bokeh.io import show from bokeh.models import LinearAxis, Range1d import torch.nn.functional as F import torch.utils.data as torchUtils import numpy as np from matplotlib imp...
997,545
936e4539bc8a525df93bd7be5706e82e93fbfa93
""" Contains classes to be (re)used in various places """ import asyncio class Timer: # pylint: disable=too-few-public-methods """ Executes a callback function after a specified timeout """ def __init__(self, timeout, callback): self._timeout = timeout self._callback = callback ...
997,546
8de8eec9837144c7065f261edf19993862aa5db4
from django.shortcuts import render from django.views import View from django.views.generic import ListView, CreateView, UpdateView, DetailView from app_news.forms import NewsForm from app_news.models import News class MainPage(View): def get(self, request): return render(request, 'main.html', {}) cla...
997,547
733c28cba3358ba727be09ce8fb18cadcfc197b9
#Uses python3 import sys import queue def extract_min(H): min_key = sorted(H.keys())[0] rval = H[min_key].pop(0) if H[min_key] == []: del H[min_key] return rval def change_priority(H, v, d): if d not in H.keys(): H[d] = [v] else: H[d].append(v) def distance(adj, cost,...
997,548
d2d3aa164eca70ca693ef7489f4cc2ece1f9cad8
from hyperopt import Trials, fmin, tpe from models.model import model import models.MultivariateRegression as mvr import numpy as np import math class MultiVariateRegression(model): def __init__(self, data, labels): self.model = self.create_model(data, labels) def extract_model_parameters(self, mode...
997,549
e5f51b9448337485ac55b946e931e75f0874a061
# def factors(n): # return list(set(x for tup in ([i, n//i] for i in range(1, int(n**0.5)+1) if n % i == 0) for x in tup)) # string = input() # que = int(input()) # cnt = {} # # print(string) # for i in set(string): # cnt[ord(i)-ord('a')+1] = 0 # for j in string: # cnt[ord(j)-ord('a')+1] += 1 # # print(cnt) # whi...
997,550
15d819ed435e4fc82bb8e60a08b2f1fec58ccd1c
import logging import webapp2 import re from google.appengine.ext.webapp.mail_handlers import InboundMailHandler from google.appengine.api import mail from model import Person import email_helper class EmailHandler(InboundMailHandler): def receive(self, mail_message): logging.info("RECV: " + mail_message...
997,551
296fabd355d0aed1bb0e31fefe465f37b292b71f
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: ListNode) -> bool: ''' If there is no cycle in the list, the fast pointer will eventually reach the end and we can r...
997,552
018c1e712d40e4235604f2cd525eb4e5bd5c1987
#! /usr/bin/env python # -*- coding: utf-8 -*- # Author: "Zing-p" # Date: 2017/11/14 import numpy as np import os from kNN import k_class def img2vector(filename): """循环读取文件前32行,每行的前32位字符串。转换为1行1024列的numpy数组""" vector = np.zeros((1, 1024)) f = open(filename, "r") for i in range(32): line_str =...
997,553
70f332b82df545d37200da3f1b82646c5b8bd9a2
import pyperclip def main(): while True: word = input("Enter word: \n") output = "" # output += str(ord(char) - 96) for char in word.lower() for char in word.lower(): output += str(ord(char) - 96) pyperclip.copy(output) print(output) if __name__ == "__ma...
997,554
f2aa09f3fe8fbc4b877da0f6e1a9921b44702063
# coding: utf-8 """ OANDA v20 REST API The full OANDA v20 REST API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more. To authenticate use the string 'Bearer ' followed by the token which can be obtained at https://www.oanda.com/demo-account/tpa/perso...
997,555
a59d807d188c0cab03b8543efb7fb28f8ea233f1
import pygame from sys import exit import numpy as np import math def draw_dashed_line(surf, color, start_pos, end_pos, width=1, dash_length=10): x1, y1 = start_pos x2, y2 = end_pos dl = dash_length if (x1 == x2): ycoords = [y for y in range(y1, y2, dl if y1 < y2 else -dl)] ...
997,556
d95b92a1e1042f91f81f08a5122442b12d101abc
from matplotlib.pyplot import figure from numpy import arange x = arange(1, 11, 1) y = x ** 2 x_labels = list('abcdefghij') x_ticks = range(len(x_labels)) figura = figure(figsize=(15, 11.25), dpi=90) subplot = figura.add_subplot(1, 1, 1) subplot.plot(y) subplot.set_xticks(x_ticks) subplot.set_xticklabels(x_labels) fig...
997,557
0e390315d0eefad756d23d839e921f710c8f97c6
from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.test import TestCase from django.urls import reverse from .models import CustomField, CustomFieldValue class CustomFieldTest(TestCase): def setUp(s...
997,558
0463cad9fed5c548c694cca5620a009d232e1718
from keras.callbacks import TensorBoard TensorBoard( log_dir='./logs', histogram_freq=0, write_graph=True, write_images=False) # tensorboard --logdir=path_to_logs
997,559
cc97ce72d35f46880c54f096932a59e3521bbe79
#a sorted_x1 #b onewordcategorylist #c categorydict #d sorted_x #s splitted #o order #e twowordcategorylist #f sorted_xc #h capitalcategorylist import wikipediaapi import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition import NMF, LatentDirichletAlloc...
997,560
80f2f36bbc06e5b4c52b3abb79a7ae39fc5c66bf
# !/usr/bin/env python # -*- coding: utf-8 -*- # __author__: Shane # _datetime_: 2018/6/18 import os import sys from config.config import Config from common.logger import Logger __app = None # api客户端,singleton __rpc = None # rpc客户端,singleton __block = None # block客户端,singleton __limiter = None # 限流器,singleton ...
997,561
b7f61b1c1211a21495c16c1e8c984cb9d800221b
class Parent(): def __init__(self,eyecolor,money): print "Parent constructor is called !" self.eye = eyecolor self.mony = money class Child(Parent): def __init__(self,eyecolor,money,toys): print "Child constructor is called ! " Parent.__init__(self,eyecolor,money) ...
997,562
cec742347922aa7f05f78006614bbe6156ba9e72
# Copyright 2012 Midokura Japan KK from resource_base import ResourceBase import vendor_media_type class HostInterfacePort(ResourceBase): media_type = vendor_media_type.APPLICATION_HOST_INTERFACE_PORT_JSON def __init__(self, http, uri, dto): super(HostInterfacePort, self).__init__(http, uri, dto) ...
997,563
97fff9e6c9ced005f764af1d37ac21f1b9094bb2
#~~~~ Standard calculator ~~~~# #~~~~~ c. Indya Dodson ~~~~~~# def add(num1, num2): return num1 + num2 def subtract(num1, num2): return num1 - num2 def multiply(num1, num2): return num1 * num2 def divide(num1, num2): return num1/num2 number1 = int(input("Please enter a number: ")) number2 = int(inp...
997,564
e1420cabc9a20908e1cac84220ab20aebbdf01c6
"""Makes test cases pass.""" import functools import inspect import types def passit(func): """Make test cases pass.""" @functools.wraps(func) def wrapper_makepass(*args, **kwargs): try: return func(*args, **kwargs) # We're not here for the good code, are we? except Ex...
997,565
6654c0ab08c3c9e1923453496bcef787a4a690b7
#!/usr/bin/python3 nFiles = int(input("Enter the number of files: \n")) fileType = str(input("Enter the file type (eg: main): \n")) fileExt = str(input("Enter file extension: \n")) for i in range(nFiles + 1): open(str(i) + "-" + fileType + fileExt, "w+") print("Files creted successfully")
997,566
a064f23093422b2eec9a46f53b10e195ffd9a835
""" Write a program that prints a message if a variable is less than or equal to 10, another message if the variable is greater than 10 but less than or equal to 25, and another message if the variable is greater than 25. """ num1 = 130 if num1 <= 10: print("num1 is <= 10") elif num1 <= 25: print("num1 is > 1...
997,567
230075df276d36e46e6e7ac7e6478744b73cd958
#!/usr/bin/python class logger: f = None fn = "" elems = [] def __init__(self, fni): self.fn = fni def add(self, elem): self.elems.append(elem) def open(self): self.f = open(self.fn, "w") # self.f.write("ts, ") for elem in self.elems: self.f.write(" " + elem.header); self.f...
997,568
06ad6ee0bc3b96e2d55ca64918a6482fd4f68abd
import os from src.microservices import FlaskChassis from src.user.modules import user_blueprint microservice = FlaskChassis(service_name="users", config_file="flask-dev.cfg") app, db = microservice.app, microservice.db app.register_blueprint(user_blueprint, url_prefix='/api/v1/users')
997,569
be170881bd27343a606757cb8dea621673d12240
import argparse import cProfile, pstats, sys import logging from typing import List logging.basicConfig() logging.root.setLevel(logging.DEBUG) """ leetcode 435. Non-overlapping Intervals https://leetcode.com/problems/non-overlapping-intervals/ """ class Solution(object): def eraseOverlapIntervals(self, interva...
997,570
bdf57964326f0fb15dd4722e00783a6463a3de0b
from unittest import TestCase from .bst import BSTNode, BST class BSTNodeTestCase(TestCase): def setUp(self): self.left = BSTNode(data=5) self.right = BSTNode(data=15) self.root = BSTNode(data=10, left=self.left, right=self.right) def test_assigned_variables(self): self.assert...
997,571
d66b4cb957d21996215c61f13f1c00209695f6cf
#!/usr/bin/python # # Read or Write data from/to the Adafruit 32KB I2C FRAM Breakout Board # from Raspberry Pi # # Can be called from command line or public functions can be imported: # # string = FRAMread(int address, int length) # (to retrieve binary data, use ord() on characters in string) # # FRAMwri...
997,572
c31b5f752dd2333e31120f7f6fd7a96e0809281c
''' <단순 변수 사용> 1. 순차형 1-3. 현금교환기 (10000원, 1000원, 100원, 10원) 1626035 이주호 ''' #계산할 가격 입력 money = int(input("교환할 금액을 정수로 입력 >> ")) ##계산 #10000won _10000won = money / 10000 #1000won _1000won = money % 10000 _1000won = _1000won / 1000 #100won _100won = money % 1000 _100won = _100won / 1...
997,573
114e4212e5266b5fc6b54ffa0dc79ed6a658458c
#! /usr/bin/env python ############# #Written for python 2.7 ############# import nltk, re, sys, os, getopt, pandas, time from collections import Counter import numpy as np from datetime import datetime from nltk import word_tokenize as token_d from nltk.tokenize import RegexpTokenizer as token_re from collections im...
997,574
6353d7bfaaac1bf25de5f7e08ba57a9c76f115c8
#coding:utf-8 from django.conf.urls import url from django.conf.urls.static import static from django.conf import settings import uuid from django.conf.urls import include from rest_framework import routers from rest_framework_jwt.views import obtain_jwt_token,jwt_response_payload_handler from wechat import views fro...
997,575
f7fbc66e2e8484d798bebdce45b5c5e3dde2974d
class Solution(object): def lengthOfLongestSubstring(self, s: str) -> int: # 字符串为空则返回零 if not s: return 0 window = [] # 滑动窗口数组 max_length = 0 # 最长串长度 # 遍历字符串 for c in s: # 如果字符不在滑动窗口中,则直接扩展窗口 if c not in window: ...
997,576
8af87a9b0a4d5235d7c302408dc18f2ecfc5bfc6
#!/usr/bin/env python __author__ = "Stephen P. Henrie, Michael Meisinger" import ast import inspect import os import string import sys import time import traceback from flask import Blueprint, request, abort import flask # Create special logging category for service gateway access import logging webapi_log = logging...
997,577
b8a5741ddfbd2de818a56d9a65c5ef098286336a
import pytest import torch from torch.utils.data.dataloader import DataLoader from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.data import ( _get_dataloader_init_kwargs, _replace_dataloader_init_method, _update_dataloader, ...
997,578
4396144c8f9031c41f939e4d71da101ded574d9f
from __future__ import unicode_literals from django.contrib.auth.models import User from django.db import models ## Create your models here. from django.utils import timezone from django.contrib.postgres.fields import JSONField class Movie(models.Model): def __str__(self): return "%s" % self.title ti...
997,579
a78f9e9144390b0d1c05fcf30aaa68ac5a59f30a
import csv import json from app.database import db_session, Base, engine from app.models import App, AppBundle, Target, AppType, Organization, Department, Tag, Connection, Header, DNS from app.serializer import \ TagSerializer, ConnectionSerializer, HeaderSerializer,\ AppTypeSerializer, OrganizationSer...
997,580
3e04605324eb45076a140f4e66aa877162046598
from Question import Question from info_gain import info_gain from Question_gain import Question_gain from partition import partition import random def choose_split(data,treshold): """Find the best question to ask by iterating over every feature / value and calculating the information gain.""" n_features =...
997,581
b4e9a7f598efedb3f8c03c4a40123cf0059afbba
import random deck1= dict() deck2= dict() deck3= dict() deck4= dict() for n in range (1,14): if n == 1: card = "A" elif n ==11: card = "J" elif n ==12: card = "Q" elif n == 13: card = "k" else: card = str(n) de...
997,582
252645dbd3d606920fcb46acdcbde0a10f101606
from mainapp.models import * # def get_all_discussions: # for q in Question.objects.order_by(timestamp):
997,583
fc284e5bdcc79bc574b0ec2820884d378c39bb02
#!/usr/bin/env python # coding:utf-8 # vi:tabstop=4:shiftwidth=4:expandtab:sts=4 import neon import random import numpy as np import math from ..stacked import Layers, register_layers_class from ..stacked import register_concat_handler, register_inputs_handler from ..stacked import register_flag_handler, r...
997,584
6c71b754cb3e332f5b5f413017dbc03528bf7ee6
# 문제 : https://programmers.co.kr/learn/courses/30/lessons/76503 # 아이디어 : https://prgms.tistory.com/47?category=882795 # 18개 중 11개 성공, 7개 실패..ㅠㅠ # 그리디로 접근 # 시작 리프 노드, 교환 횟수, 간선 정보 def greedy(start, a): global visited, edge_info # print("시작노드", start, a[start], "도착노드", edge_info[start]) temp = 0 temp += ...
997,585
f6dac5ae3907625774819b96781d8e2319cc05a1
import socket import sys MASK_ERRORS = True AFINN_FILE = '/usr/local/metaLayer-sentiment/resources/AFINN.txt' ERROR_NOTEXT = {'status':'failed', 'code':101, 'error':'The required POST field \'text\' was not supplied' } if socket.gethostname() == 'matt-griffiths': MASK_ERRORS = False AFINN_FILE = '/home/matt/...
997,586
2289b503aa0d95e034ee43aab9e69bf65de65aba
# coding=utf-8 # Copyright 2019 The Tensor2Tensor Authors. # # 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...
997,587
3624779fb4a89c6ff1a9199d68ab13ae092d3697
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/epicBattle/EpicBattlesAfterBattleView.py import SoundGroups from gui.Scaleform.daapi.view.lobby.missions.awards_formatters import EpicCurtailingAwardsComposer from gui.Scaleform.daapi.view.meta.EpicBat...
997,588
b493188c0e0cfe8b4ed25cf04357dfcae00a6cc3
""" The purpose of this file is to train our networks. This is the file you want to run from root folder with specified dataset and options. """ # Importing Python packages import argparse import json import torch import torchvision import torchvision.transforms as transforms # Importing our own files and classes f...
997,589
d7e90a55a8b8473f7da997df08b434ab8c0022ef
#!/usr/bin/env python3 -u ''' Тулза для кодирования/декодирования base64/base85/base32/ascii85/hex, которая в отличие от некоторых специализированных инструментов (не будем показывать пальцем на утилиту base64) не пытается запихать в память обрабатываемые данные полностью ''' from base64 import * im...
997,590
b96fbbf8a150b0d26603e84344a6bccd0fad09b3
# Image processing functions import os import numpy as np from PIL import Image from scipy.ndimage import zoom #%% Functions used in the SSL method for transforming def get_identity(): return np.identity() def get_random_gaussian_noise(shape, sigma): return np.random.normal(scale = sigma, size = sha...
997,591
aec5b6ce42f615d7add4a1ae703b0ca29b1efadf
__FILENAME__ = console from . import Event, get_timestamp from ..shared import console_repr class Console(Event): contains = ('line', 'time', 'user', 'source', 'kind', 'data', 'level') requires = ('line',) line = Event.Arg(required=True) kind = Event.Arg() time = Event.Arg() us...
997,592
358108fc75a0e3450126d4c2e3c06332341cff61
import difflib import lxml.html import sys def main(): if len(sys.argv) == 3: path1 = sys.argv[1] path2 = sys.argv[2] else: usage = "Usage: %s <file 1> <file 2>" sys.stderr.write(usage % sys.argv[0]) sys.exit(1) tags1 = get_tags(lxml.html.parse(path1)) tags2 = ...
997,593
37720369c76093ceaebb4b86ff59071422a41f65
import sys import logging import PySimpleGUI as sg import numpy as np import datetime import expenseJSONFile, variables logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) # # Default global variables # dictExpenses = {} # # First tab layaout # categories = [[sg.Radio(value, "CAT", key=variables.T1_KEY+var...
997,594
cbccbc85653a81e1081e8f25ae4957af04812261
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2016-12-24 05:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fias', '0013_auto_20160825_0524'), ] operations = [ migrations.AddField( ...
997,595
0c0bbc63c603bc4ec536b972b274687eaeea9dfb
from kivy.app import App from kivy.base import runTouchApp from kivy.lang import Builder runTouchApp(Builder.load_string(''' Label: Button: text: 'Hello' color: .8, .9, 0, 1 font_size: 32 pos: 50, 300 size: 100, 150 Button: text: 'World' color: .8, .9, ...
997,596
c2f8f5ffca5efadcb6127c52cd36a56d0c00fe92
import math N = int(input()) A_list = list() B_list = list() A_list.append(0) B_list.append(0) for i in range(N): A,B = map(int, input().split()) A_list.append(A) B_list.append(B) #末尾から考える ans = 0 for i in range(N): A = A_list.pop(-1) B = B_list.pop(-1) #print(A,B,"→",end="") A += ans ...
997,597
c33fa06f167b61a07c0a0dae1757a88af4afa3f8
from math import * class ArmConversion: def __init__(self): self.las_min = 12 # was 13 self.las_max = 17.0+3/16.0 # was 16 self.lae_min = 15 # was 15 self.lae_max = 20.0+15/16.0 # was 20 self.sx = 2.5 self.sy = 3 self.A = 15.375 self.la ...
997,598
1f2c424cbeee712273f81691fdbf331819eb75d3
#!/usr/bin/python import csv import json import requests import time from sys import argv script, club = argv segmentid=20545879 path=("/home/ubuntu/") memberlist=(path + club + "/input/membersdiv.csv") webhook=(path + "Strava/log/webhook.log") segmentlist=(path + club + "/segmentlist.csv") segmentsummary=(path + cl...
997,599
686b3d72bec9643b57ab1ca1238717304d866e93
# Generated by Django 2.2.5 on 2019-09-04 11:27 import datetime 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)...