index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
994,100
bc18a228393c5e94b5de50e2b890cea60e5574cb
from django.db import models from moderator.models import BaseTimestamp class Doctor(BaseTimestamp): """ Doctor model with OneToOne relation with custom user model. """ user = models.OneToOneField("accounts.user", on_delete=models.CASCADE) specialization = models.CharField(max_length=64...
994,101
455e83ce0816270521c066a6ddb8fa36f486c671
import csv with open("data.csv") as csv_file: csv_reader = csv.reader(csv_file, delimiter=',', quotechar='"') for row in csv_reader: print(row[0]) import json with open("data.json") as json_file: data = json.load(json_file) print(data)
994,102
6d8f2189d7b92b01336ee9d4ff87430db7d0e89e
import datetime import re import socket from _thread import start_new_thread import config import db import utils infobool = False def main(): s = socket.socket() # установка соединения utils.connection(s) # -//- print(s) file = open('log.txt', 'a') # запись в лог даты текущего запуска file.wri...
994,103
d8d8229a99eeea28295c91c3d39e5d2413b81803
import cv2 import os import time import numpy as np from keras import backend as K from keras.models import load_model from yad2k.models.keras_yolo import yolo_eval, yolo_head class YOLO(object): def __init__(self): self.model_path = 'model_data/yolo.h5' self.anchors_path = 'model_data/yolo_anchors.txt' ...
994,104
57151c2867ff07aa1d9002d2491dca17fe188299
from rest_framework import serializers from fees.models import conductedFees class conductedFeesSerializer(serializers.ModelSerializer): class Meta(): model = conductedFees fields = ('user','room', 'totalFees','adminFees') lookup_field = 'user' extra_kwargs = { ...
994,105
5e422d28ecafdedc046ad5b35934dd212173e324
import json from steppygraph.machine import Branch, Parallel from steppygraph.states import Choice, ChoiceCase, Comparison, ComparisonType, Task, StateType, to_serializable, \ Pass, Catcher, ErrorType, State, BatchJob, EcsTask from steppygraph.states import Resource, ResourceType from steppygraph.test.testutils im...
994,106
2ac550ae9f2f81b11c348c1e6008f748d79bd3ad
from operator import add, sub from _utils import * inp = get_input(2020, 8) tape = inp.strip().split("\n") def step(i, acc): op = {"+": add, "-": sub} instr, arg = tape[i].split() sign, num = arg[:1], arg[1:] if instr == "nop": i += 1 elif instr == "acc": i += 1 acc = op[...
994,107
78b96d5adbdde3e7433701663d9b5344ccaee955
from django.template import Library, Node from distribution.models import FoodNetwork class FoodNet(Node): def render(self, context): try: answer = FoodNetwork.objects.all()[0] except IndexError: answer = None context['food_network'] = answer return '' ...
994,108
6e7221bfbbb27e7d5207f6fa33b80c2d4d7801d3
from __future__ import unicode_literals from django.apps import AppConfig class Schedule1Config(AppConfig): name = 'schedule1'
994,109
28dcc6b55b3a4470a519605d85e8dc7b64a898b3
from hashlib import sha1 as sha1_oracle from hypothesis import given from hypothesis.strategies import binary, lists from firmware import Sha1 def test_empty() -> None: assert Sha1().digest().hex() == sha1_oracle().digest().hex() def test_short() -> None: chunk = b"abc" actual = Sha1() expected = ...
994,110
efa0eeddaceb76c67d1d07f222be1c4c14d215b7
# -*- coding: utf-8 -*- { 'name': 'Project Weekly Report', 'version': '1.0', 'category': 'Project', 'sequence': 1, 'summary': ' create weekly report', 'description': "This module will create project report weekly.", 'website': 'http://www.hashmicro.com/', 'author': 'Hashmicro / Niyas', ...
994,111
98c565a141ca8d0b3d3664f7bf19a6582d359a05
# number two practice problem # # all in m/s # a = 9.8 ang = 45 v_i = 26.8 y = 2 # physics is wrong # x = ang*v_i*y print(x)
994,112
a8eebd21b8453709c7dab6eaae93ff36893dfecd
from generators.lib.dates_generator import DatesGenerator from generators.lib.hash_splitter import HashSplitter from generators.lib.length_cutter import LengthCutter from generators.lib.file_splitter import FileSplitter import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_a...
994,113
9101c47ec1e472d3dd5bc65f7fd75a8fe42eff42
# coding: utf-8 from Tkinter import * from pprint import * from random import randint import os.path phase = "init" # les autres phases possibles sont : "in-game" / "end-game" def initGrid(): # Retourne une liste de liste de 10*10 liste = [0] * 10 temp = liste[:] for i in range(len(liste)): ...
994,114
c4c4b1872669693e704a0a29cad023acf929b671
# Modules from keras.layers import Dense from keras.layers.core import Activation from keras.layers.normalization import BatchNormalization from keras.layers.convolutional import UpSampling2D from keras.layers.core import Flatten from keras.layers import Input from keras.layers.convolutional import Conv2D, Conv2DTransp...
994,115
7031a2a8644c9f78c791c738105ae73957adcf67
import os import tempfile import time from mock import Mock, patch import pytest from clicast.cast import Cast, CastReader, url_content, _url_content_cache_file CAST_URL = 'https://raw.githubusercontent.com/maxzheng/clicast/master/test/example.cast' CAST_FILE = os.path.join(os.path.dirname(__file__), 'example.cast'...
994,116
c803314c381f7fcff937861b69e6bb263405a8ab
# Generated by Django 3.0.3 on 2020-02-10 08:03 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('poll', '0001_initial'), ] operations = [ migrations.CreateModel( name='User', fields=[ ('no', models...
994,117
1c6bc93703c449e28cae303ed6532052d431fb12
import requests import base64 ak = 'QsPqs20yfvQ7QcdnYfdWC5Ei' sk = 'EEMdjil0u1CW5uI3ts1mLD0VCQvTGYs6' def get_at(api_key, secret_key): host = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=" + api_key + \ "&client_secret=" + secret_key response = requests.get(hos...
994,118
217a838b6cc58212f992a046b03345febb6dbdc1
# Generated by Django 2.1 on 2018-09-01 23:15 import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('weatherApp', '0005_auto_20180901_1558'), ] operations = [ migrations.AddField( ...
994,119
adb5945f1995e57bba817b7e8763d19fb9f81be5
# -*- coding: utf-8 -*- """ Created on Sat Jul 11 17:45:07 2020 @author: sifan """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops f...
994,120
23cc26adad4bf94f316bea66dbf2535635921e2a
n=int(input("Enter a number:")) sum=0 while(n>0): rem=n%10 sum=sum+rem n=(n//10) print("The total sum of digits is:",sum)
994,121
2e52ba3453c7b629f4b6c1862ffa78b63afec7f7
import subprocess import os import getpass def connection(): path = r"core\\login.bat" p = subprocess.Popen(path,stdout=subprocess.PIPE,shell=True) stdout,stderr = p.communicate('dir c:\\') print stdout def disconnect(): path = r"core\\delete.bat" p = subprocess.Popen(path,stdout=subpr...
994,122
09834ef9aa03abb6c2757e0774b804b49c84bbca
def product(*num): result = 1 for i in num: result *= i print(result) product(10, 20, 30) def sum(num1, *arg): result = 0 for i in arg: result += i print(result) sum(5000, 20, 30)
994,123
6c814da40b377cc8539dce8e14893a46392dd656
def solve(): N, M = map(int, input().split()) if N == 1 and M == 1: print(1) exit() if M < N: N, M = M, N if N == 1: print(M - 2) exit() print((N - 2) * (M - 2)) if __name__ == '__main__': solve()
994,124
bdd5e8208540a462359d09c04ea3d54d34017f68
import carla import erdos # Pylot specific imports. import pylot.utils import pylot.simulation.utils DEFAULT_VIS_TIME = 30000.0 class CanBusVisualizerOperator(erdos.Operator): """ CanBusVisualizerOperator visualizes the CanBus locations. This operator listens on the `can_bus` feed and draws the locations o...
994,125
c6bf80e6001a27f353b8d94cc608998b811d0dc8
#!/usr/bin/env python # coding=utf-8 from __future__ import unicode_literals, print_function, division import sys import binascii from diameterparser.decode_diameter import decode_diameter def convertMac(octet): mac = [binascii.b2a_hex(x) for x in list(octet)] return "".join(mac) class DiameterConn: ...
994,126
99c5545cfa2923f80093b8f54b4105075f6a5e43
import multiprocessing bind = "0.0.0.0:8000" workers = 2 # multiprocessing.cpu_count() * 2 + 1 worker_tmp_dir = '/tmp_gunicorn'
994,127
ab174d5f62f09444e0caa82fac6ce6eef9885be8
#!/usr/bin/env python3 import os from pyblake2 import blake2b from sapling_generators import SPENDING_KEY_BASE from sapling_jubjub import Fr, Point, r_j from sapling_key_components import to_scalar from sapling_utils import cldiv, leos2ip from tv_output import render_args, render_tv def H(x): digest = blake2b(pe...
994,128
1e62c472b562a30cf42f1be049425df9e35ce1c8
# -*- coding: utf-8 -*- class Frob(object): def __init__(self, name): self.name = name self.before = None self.after = None def setBefore(self, before): self.before = before def setAfter(self, after): self.after = after def getBefore(self): return self.bef...
994,129
1cbcef34ffd194a5e8fd8cb111d05423d76fa9ad
import pandas as pd import numpy as np import seaborn as sns from tensorflow.python.ops.gen_array_ops import pad_eager_fallback sns.set() df = pd.read_csv("../data/fake_reg.csv") sns.pairplot(df) from sklearn.model_selection import train_test_split X = df[["feature1", "feature2"]].values y = df["price"].values X...
994,130
4773586881229fa669e4516ae4e514105ca3e270
def circulo(): r=int(input("Ingrese radio")) import math t=math.pi*pow(r,2) print("Área= ",t,"\n") def triangulo(): a=int(input("Ingrese Base")) b=int(input("Ingrese altura")) t=(a*b)/2 print("Área= ",t,"\n") def rectangulo(): a=int(input("Ingrese Largo")) b=int(input("Ingrese A...
994,131
9e2c318da890f30b8e8164a93b705e89329219a5
s1=input() l1=s1.split(' ') d1={} for i in l1: d1[i]=l1.count(i) for i,j in zip(d1.keys(),d1.values()): print(i,":",j)
994,132
213fdaae53055fa2a46abc0e5f63ed989741ee91
from django.contrib.auth.decorators import login_required from django.urls import path from . import views app_name = 'gamescoring' urlpatterns = [ path('ScoreConfirm/', login_required(views.ScoreConfirm), name = "ScoreConfirm" ), path('SaveScore/', login_required(views.SaveScore), name = "SaveScore" ), ...
994,133
ec2af862fe2bd0162e4a75fa9c581b9d308eb872
from django.shortcuts import render, redirect from django.views.decorators.cache import cache_control from django.contrib.auth.decorators import login_required from tests.models import TestInfo, QuestionInfo, TestingResults, QuestionAnswer, QuestionAnswerUser, HtmlBlocks import datetime from enum import Enum from djang...
994,134
445f68417a57e1bbe4b7c685a662f2354362dd1b
import unittest from csvtools.test import ReaderWriter import csvtools.unzip as m class TestUnzip(unittest.TestCase): def test_out_spec(self): csv_in = ReaderWriter() csv_in.writerow('a b c'.split()) csv_in.writerow('a1 b1 c1'.split()) csv_in.writerow('a2 b2 c2'.split()) ...
994,135
0251ceec4bf5492529bb1076496524d014c70a90
# -*- coding: utf-8 -*- """ Microsoft-Windows-Provisioning-Diagnostics-Provider GUID : ed8b9bd3-f66e-4ff2-b86b-75c7925f72a9 """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dt...
994,136
7809922a9b4274cf738c0032193d287eb8c28f41
""" Test of ABARES report_builder script """ #%load_ext autoreload #%autoreload 2 #%cd "J:\ProductivityAndWaterAndSocial\Water\_Resources\ABARESdocs\\charts_and_tables" import pandas as pd import report_builder import numpy as np import os home = os.getcwd() tablesf = home + "\\output\\" home_1 = os.path.dirname(ho...
994,137
3f4a620e83fa8c8e6fd3ee3a51f9628964c80631
from typing import List, Optional from kubernetes.client import V1beta1CronJob from streams_explorer.models.kafka_connector import KafkaConnector from streams_explorer.models.sink import Sink from streams_explorer.models.source import Source class Extractor: sources: List[Source] = [] sinks: List[Sink] = []...
994,138
3dc2073e149521a6993307dcb26bce9ebb3adbc3
version https://git-lfs.github.com/spec/v1 oid sha256:1d4a7d60bede05345f4fc82cea2ada325e8cdd8be80f17c59a4930c26ae88a78 size 15392
994,139
d6d6b765671a6f5d0750ab4044d732e6bb24c554
#! python3 #### Builing a text classifier import zipfile import pandas as pd import numpy as np import pickle import nltk from nltk import FreqDist import re import sys import sklearn sys.path.append("C:\Python34\Scripts\Mike AI Job\Final") #import tweepy2 from text_preprocessing import remove_st...
994,140
3f9ac7d5f3b9b7c9a8f12cee2ace589c024375bf
class Timeline: """タイムラインの取得と ``since_id`` と ``max_id`` を保存、取得するクラス Attributes ーーーーーー home_timeline_ids : TimelineIndex or None ホームタイムラインの ``since_id`` と ``max_id`` を保持するオブジェクト """ def __init__(self, api, storage): """ Parameters ---------- api : tweepy.a...
994,141
abc4a581916abf8c87b4ade2dc8962a050bb8ebd
n = int(input()) li =[] for _ in range(n): li.append(int(input())) def gogo(li): cnt=1 s =li[0] for i in range(1,n): if li[i]>=s: s= li[i] cnt+=1 if s == max(li): break print(cnt) gogo(li) li.reverse() gogo(li)
994,142
31f85fa991342fd8531451e21e43dbe8d2622f0c
import PyPDF2 class PDF2Txt(): def __init__(self,pdf): self.pdf = pdf self.pdfObj = open(self.pdf,'rb') self.CompleteStr = "" self.AllPages() def Read(self): return self.CompleteStr def AllPages(self): self.pdfRead = PyPDF2.PdfFileReader(self.pdfOb...
994,143
c5f677ab0db77914ee3572a236c292b0ce5e6395
# -*- coding: utf-8 -*- # Sõnastikud # Väino Tuisk sonastik = {"janku":[(100,250),"red","mjau.vaw"],"raamat":"book","auto":"car","meri":"sea"} hinded ={"A":96,"B":90,"C":76,"D":66,"E":50} for i in sonastik: print (i,end = " ") print (" ") eesti = input("mis sõna tõlkida? ") print (sonastik[eesti]) ##print ("") ##p...
994,144
0cb119f2d5528351ca3432e7f2d89b1307515e72
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2018 Cesar Sinchiguano <cesarsinchiguano@hotmail.es> # # Distributed under terms of the BSD license. """ Everthing done with open3d, pyntcloud, CloudCompare, meshLab and python_pcl binding(wrapper) -----------------------------------------...
994,145
d52e2155960779ba0716af74d344f4e681d5552e
# -*- test-case-name: signing.test.test_persistence -*- from twisted.internet import defer class Persistence(object): """ Simple deferred key:(field:value) store. If a field is set which already has a value, the value is overwritten. get_all returns a list of all fields for that key. """ key...
994,146
c21d77989748fe9e49f93d38fa1e0d80b589f085
import itertools import numpy as np import pytest from chunkblocks.global_offset_array import GlobalOffsetArray from chunkblocks.iterators import Iterator from chunkblocks.models import Block, Chunk class IdentityIterator(Iterator): def get_all_neighbors(self, index, max=None): return index def get...
994,147
6df2ceda44307f438ed54c15fb12913082fc1f90
#!/usr/bin/env python """ Constructs quantum system for ASE-internal water molecule descript in and extracts ESP""" from ase.io import read from ase.io import write from gpaw import GPAW from gpaw import restart from ase.build import molecule from ase.optimize.bfgslinesearch import BFGSLineSearch #Quasi Newton from ...
994,148
cdba7675594ef20fc33e3d310fb8e828355ad0b7
""" test_passwordless ~~~~~~~~~~~~~~~~~ Passwordless tests """ import re import time from urllib.parse import parse_qsl, urlsplit import warnings import pytest from flask import Flask from tests.test_utils import ( capture_flashes, capture_passwordless_login_requests, logout, ) from flask_se...
994,149
b3b6fb5557c71c6d7b6fd053b455bc351f67f571
from django.db import models from django.utils.translation import gettext as _ from django.urls import reverse from django.forms import ModelForm class Meta: managed = True class Squirrels(models.Model): X = models.FloatField( help_text=_('Longitude'), ) Y = models.FloatField( ...
994,150
b69cc5c07cc0be99471c1fa869d09c382749cae5
__author__ = 'julian' from agent import Agent from house import House import pandas as pd class Dilemma(): dilemma_count = 0 def __init__(self, num_rounds, num_houses): self.id = Dilemma.dilemma_count + 1 self.round = 0 self.final_round = None # Final round with rented houses ...
994,151
dcfa564e3b1b8bd22de06f483276f5c6ad983f0e
#! /usr/bin/env python # ---------------------------------------------------------------- # @author: Shamail Tayyab # @date: Thu Apr 4 12:33:00 IST 2013 # # @desc: Redis/Python ORM for storing relational data in redis. # ---------------------------------------------------------------- import inspect import redis r =...
994,152
b14e07c70375ae7e24e3bb60cec32b869746f50e
import tinychain as tc import unittest from testutils import start_host class TestGraph(tc.graph.Graph): __uri__ = tc.URI("/test/graph") def _schema(self): users = tc.table.Schema( [tc.Column("user_id", tc.U64)], [tc.Column("email", tc.String, 320), tc.Column("display_name", ...
994,153
2ba219e22f32cda13de75827b39586633f7c6ddb
# -*- coding: utf-8 -*- """ Created on Fri Nov 03 14:59:03 2017 统计基因类型 @author: Administrator """ import numpy as np #from pandas import DataFrame as df import pandas as pd import datetime value12=[] with open("Methlytion4.3-new.txt",'r') as f: m=0 for line in f.readlines(): line = line.strip('\n') ...
994,154
642b2c1a62421694d937981d9fb0d4d422c012d4
import json import requests from .config_connect import config, confluence_url_request, con_request # separate calls for data as one function def dpl_title_list(): url_root = confluence_url_request(config()) url = url_root + "/rest/api/content/search?cql=(type=page and space=DEP and title ~ '2018' and (title ~...
994,155
c3e27f35079b55818ce3b5463b7aab1d6ef0dc09
""" Use a stack to check if a string has balanced usage of parenthesis. Example: (), ()(), (({[]})) <- Balanced. ((), {{)}], [][]]] <- Not Balanced. """ from stack_ds import Stack def is_match(top, p): if top == "{" and p == "}": return True if top == "[" and p == "]": return True ...
994,156
6bfa4fda3eb8dea650a7194bb104e37b9a442441
import preprocess as prp from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn import svm import preprocess as prp from sklearn import metrics import numpy as np from sklearn.pipeline import make_pipeline from sklearn import preprocessing import matplotlib.pyplot as plt from dat...
994,157
7e0ca838a84511d2b6d9d2c2daaea7ad57b4f531
# -*- coding:utf8 -*- # *************************************************************************** # Create on 2015-12-10 # # @Author:sunlf # # *************************************************************************** import os import logging from config.dbconfig import * ENV = "beta" BASE_DIR = os.path.dirname...
994,158
ffc4d9d9fa1a77464b386ded277578c14df5eff0
# -*- coding: utf-8 -*- from infra_scraper.input.saltstack import SaltStackInput from infra_scraper.utils import setup_logger logger = setup_logger('input.reclass') class SaltReclassInput(SaltStackInput): def __init__(self, **kwargs): super(SaltReclassInput, self).__init__(**kwargs) self.kind =...
994,159
14a1b7f31044929330f5de54df0c474f3846b48b
from sqlite3 import Connection as SQLite3Connection from datetime import datetime from sqlalchemy import event from sqlalchemy.engine import Engine from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy import linked_list import hash_table import binary_search_tree import custom_queue import...
994,160
f2cc7628e19e30ddae49e2b4774ef0efa943448c
from django.shortcuts import render, redirect from .forms import ContactForm from django.core.mail import send_mail from django.template.loader import render_to_string from django.conf import settings # Create your views here. def index(request): form = ContactForm() if request.method == 'POST': form...
994,161
0012c12553a71e5f40bc38786abb157eb8a7b1b4
from ._components import * # noqa: F403, F401 from ._contents import * # noqa: F403, F401 from ._core import * # noqa: F403, F401 from ._deletion import * # noqa: F403, F401 from ._referrer import * # noqa: F403, F401 from ._tokens import * # noqa: F403, F401
994,162
9e2bca3f51203718d2927d7c109531bee7b7f819
__author__ = 'pmagdon' import sys import os import time import argparse from im import * start = time.time() parser = argparse.ArgumentParser(description='Process to orthorectify RapidEye L1B data based on RPC correction.') parser.add_argument("InFileName",action='store', help="Path to the corresponding MetaD...
994,163
77da71ae2711559b7dab525ccdc05896f7fa6a06
'''' from math import sqrt multisqrt = vectorize(sqrt) multisqrt(4.0, 25.0, 1.0, 10.0) [2.0, 5.0, 1.0, 3.1622776601683795] ''' from math import sqrt def vectorize(func): def inner(*args): return [func(x) for x in args] return inner if __name__ == "__main__": multisqrt = vectorize(s...
994,164
2130057edb2507505e485508bf53e1b130ce7a89
import tensorflow as tf from net import load_data import matplotlib.pyplot as plt import matplotlib.image as Image from net import U_Net def loss_func(v_xs, v_ys): result = tf.reduce_mean(tf.reduce_mean(tf.square(v_xs-v_ys), axis=[1, 2, 3])) return result def main(_): config = tf.ConfigProto() confi...
994,165
aeb51a268b99b57c6784395f33bf4e1f71d3c91e
class Solution: def reverse(self, x): b = '' a = str(x) if int(x) < 0: a = a[1:] b = -int(a[::-1]) if int(x) > 0: b = int(a[::-1]) if -2 ** 31 < b < 2 ** 31 - 1: return b else: return 0 print(Solution().rev...
994,166
c5cfe653c1060688c1df993e002289ec0dddd247
def getAltitudeLatLon(self,lat,lon): row = int(round((lat - self.__latBias)*self.__delAlevation)) col = int(round((lon - self.__lonBias)*self.__delAlevation)) sz = self.__altidata.shape if row >= sz[0]: row = sz[0]-1 if col >= sz[1]: col = sz[1]-1 ...
994,167
58006def2b6ff38b88c8f697f23140fdbc2a0c6a
import sqlite3 import projectcommands as project import taskcommands as task def initial_options(): print " 1. Select a Project" print " 2. Add a Project" print " 3. View Task Due this Week" print " 4. View Task Due this Month" print " 5. View Critical Task" print " 6. View All Incomplete Task"...
994,168
e469f0f0e14ae5b9e16ce6ee22cc0f6ff130d2fb
""" UnitAPI Edit the variables with your API Token and API Server. You can create an API token in Unit Dashboard. # noqa: E501 The version of the OpenAPI document: dfec2411-22b5-4a3b-8d43-fcf778bd42a5 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F40...
994,169
063a7e686045567b529ecf0aafc9a30c57b46f10
import pytest import json from name.models import Location, Name from django.urls import reverse # Give all tests access to the database. pytestmark = pytest.mark.django_db def test_entry_detail_returns_ok(client, name_fixture): response = client.get( reverse('name:detail', args=[name_fixture.name_id]))...
994,170
99fa356d934f6b19bf8958fbcdaffa0128db931d
import os import config import base64 import requests import mysql.connector import telebot import time import json from PIL import Image from mysql.connector import errorcode DB_HOST = os.environ.get('DB_HOST') DB_NAME = os.environ.get('DB_NAME') DB_USER = os.environ.get('DB_USER') DB_PASSWORD = os.environ.get('DB_P...
994,171
7a3cd2f8a2bce933c4022e4f70ebf86af3220a22
import logging import argparse import yaml import os import subprocess import re import datetime import pickle import sklearn import xgboost import pandas as pd import numpy as np from src.load_data import load_data from src.helpers import Timer, fillin_kwargs from src.generate_features import choose_features, get_t...
994,172
c8118cbe560c792b14afcba647d2c18b8cad232d
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.support.ui import Select import time url = 'http://cbseaff.nic.in/cbse_aff/schdir_Report/userview.aspx' driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get(url) driver.implici...
994,173
b43b6f8e880706551bad0f8fdb85b4ab8728e25b
from django import forms from django.urls import path, reverse from django.views import generic from ryzom_django.html import template from ryzom_django_mdc import html class ExampleDocument(html.Html): title = 'Secure Elections with homomorphic encryption' # Serves to demonstrate template composition based on...
994,174
806836765bceafef6d465664c0546e1b32584c20
class Node(object): def __init__(self,item): self.item=item self.next=None class SinCycLinkedlist(object): """单向循环链表""" def __init__(self): self._head=None """判断链表是否为空""" def is_empty(self): return self._head==None """返回链表的长度""" def length(self): if self.is_empty(): return 0 count=1 cur=self...
994,175
2c52f470a229ed9eeb8fe6f692e010a7017a492a
class Solution: def searchMatrix(self, matrix: [[int]], target: int) -> bool: list = [itm for row in matrix for itm in row] left, right = 0, len(list)-1 while left <= right: mid = left + (right - left) // 2 val = list[mid] if(val == target): ...
994,176
4efaa5985d6f130edd1e713a890c18e33288dab9
import json import urllib2 import math import pyaudio import sys import time def getRate(): content = urllib2.urlopen("http://blockchain.info/de/ticker").read() data = json.loads(content) rate = data['USD']['15m'] return(float(rate)) def playBeep(RATE, WAVE): PyAudio = pyaudio.PyAudio p = PyAudio() data = ''.j...
994,177
d295206c82596ebb005e1810c7e593b1ac629a85
import numpy as np import os import pickle def get_baseline_estimates(ratings): #print('inside get_baseline_estimates') if not os.path.isfile("baseline_estimates.pkl"): user_count = ratings.shape[0] movie_count = ratings.shape[1] avg_user = [] avg_movie = [] global_mea...
994,178
6e774a89f9d0c05939def00d1779130b4757fdec
import socket import hashlib from Crypto.Cipher import AES from Crypto.PublicKey import RSA from Crypto import Random from Crypto.Random.random import getrandbits import registrar import sys from charm.toolbox.integergroup import RSAGroup from charm.schemes.pkenc import pkenc_paillier99 from charm.core.math import...
994,179
4564de10ad98465c0b79e78b1b6e02ebaf142259
from internet_usage import get_usage from flask import Flask, render_template, Response import time app = Flask(__name__) @app.route('/') def home(): global usage usage = get_usage() return render_template('home.html', usage=usage)
994,180
7cf4c799271168dd8cf53b68603c9b88ab6cb03d
from collections import defaultdict from aocd import get_data from dotenv import load_dotenv load_dotenv() t = """mxmxvkd kfcds sqjhc nhms (contains dairy, fish) trh fvjkl sbzzf mxmxvkd (contains dairy) sqjhc fvjkl (contains soy) sqjhc mxmxvkd sbzzf (contains fish)""" def parse_foods(input: str): foods = [] ...
994,181
51d9a0bcd8d26e4444d3a4ff41dd62b00ef93afc
import sys sys.path.append("..") import struct import pickle from time import ctime import tcp.tcpclisock as tcp from PyQt5 import QtCore HOST = '106.15.225.249' PORT = 21567 BUFSIZE = 1024 ADDR=(HOST,PORT) class Loginbackend(QtCore.QObject): loginresult = QtCore.pyqtSignal(int) feedback = QtCore.pyqtSignal(in...
994,182
222a5cdb31c3df73fbf26c137d303536c2b22572
#!/usr/bin/env python import sqlite3 import os import logging from modules import utils class Database(object): def __init__(self, root): self.root = root self.conn = sqlite3.connect("data/main.db") self.cursor = self.conn.cursor() self._checkItemTable() def _checkItemTable(s...
994,183
eb929c6a12cefdd3914ce742cea6a6f169a3ae9d
# -*- coding: utf-8 -*- """ Created on Fri Mar 12 12:37:17 2021 @author: Administrator """ import sys #from PyQT5.QtWidgets import QApplication,QWidget #from ui_Widget import Ui_Widget #class QmyWidget(QWidget): # def __init__(self,parent=None): # super().__init__(parent) # self.ui=Ui_Widget() # ...
994,184
b687fed66e6cdd09f16046bf03dc5396405ba854
from fpdf import FPDF from datetime import date import pandas as pd class PDF(FPDF): def header(self): self.image(resources+'header.png', 0, 0, 300,10) self.ln(10) def footer(self): self.image(resources+'footer.PNG', 0,190,282,20.5) self.set_y(-7) self.set_font('Arial', '', 8) self.set_t...
994,185
1b1f14fdefb660de046f5680133a3ee0b2398b0c
def encontra_maximo (matriz): lista0 = matriz[0] lista1 = matriz[1] lista2 = matriz[2] maximo = lista0[0] for e in lista0: if e > maximo: maximo = e for e1 in lista1: if e1 > maximo: maximo = e1 for e2 in lista2: if...
994,186
d7c86b17a6dacdd8730aad0f8760cabdb5510b53
import math import sys # hundred 3 # thousand 4 # million 7 # billion 10 def execute(arr): if len(arr) < 4: return False a, b, c, (d, e, f) = 0, 0, 0, arr[:3] for i in range(3, len(arr)): a, b, c, d, e, f = b, c, d, e, f, arr[i] if e < c - a and f >= d: return True if c - a <= e ...
994,187
3fdac8bfb9d6dec44aea7d11983874540b231eec
# -*- coding: utf-8 -*- token = '499870364:AAEsRg6v6kAi9fdUiP-efrt7VakemN4CScI'
994,188
6609c9094a9ef87a68e7524ced7507353ba80e34
import pretty_errors import pandas as pd import os import numpy as np import openpyxl as op import datetime # 部门列表 DEPARTS = ["销-2部", "销-3部", "销-5部", "销-6部", "销-8部", "销-9部", "市场部", "国际部", "资-香槟组", "资-Bgo无底薪", "资-Bgo有底薪"] MAIN_DEPARTS = ["销-2部", "销-3部", "销-5部", "销-6部", "销-8部", "销-9部", "市场部", "国际部", "资源部"] # 桌面路径 DIR_D...
994,189
49326e1294c8f303db50c33b173131e4381b27b1
#simple linear regression to model the relationship between methylation ratio and mutation frequency in various cancers #goal is to compare the models derived from coding regions vs. all other regions #normal WGBS data from various tissues is used in conjunction with mutation data of cancers originating in same tissue ...
994,190
10527cd9b836dc5e563d3c35fdf7c686773ec47c
import sys print (__name__, 'path=', sys.path) import sub.spam # <== Works if move modules to pkg below main file
994,191
4f3a9f61e4b64862ddbf93dd340b60ada16df306
from django.contrib import admin from django.urls import path # from .import views from .views import product_list, product_detail, Product_list1, post_list2, displaydata, createpost urlpatterns = [ path('product/', product_list), path('product/<int:pk>', product_detail), path('classproduct/', Product_list1...
994,192
07e7c65fc5550a274827f5079681f6935c85cf96
#kata link: https://www.codewars.com/kata/52efefcbcdf57161d4000091 #Instruction : The main idea is to count all the occurring characters in a string. If you have a string like aba, then the result should be {'a': 2, 'b': 1}. #What if the string is empty? Then the result should be empty object literal, {}. #Code:...
994,193
630875f504a2334f135946524d237060b0894565
from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from core.models import Category, Article # from recipe.serializers import ArticleSerializer ARTICLES_URL = reverse('recipe:art...
994,194
ba4f4ed873afa4038c26d92f1760e3a9bedab053
from .forcast import PostForcastInteractor from .prize import GetPrizeInteractor from .rdb import CreateTableInteractor, DropTableInteractor, ITableInteractor from .user import CreateUserInteractor, GetUserInteractor __all__ = [ "CreateTableInteractor", "DropTableInteractor", "ITableInteractor", "PostF...
994,195
c2090d8c90b91d87ace17a0ffdeda8640929908b
# ------------------------------------------------------ # profile.py # ------------------------------------------------------ # handles the profile functionality for each dog walker or dog owner # ------------------------------------------------------ # Last updated - 2019-01-12 # -----...
994,196
bfea72d6c6057ee692df0e0f68d170f8e7d8c1d2
import random from IPython import embed import time seed = round(time.time()) random.seed(seed) print("Seed is: "+str(seed)) with open('HUGEthumbdrive.img', 'rb') as f: HUGEthumbdriveData = bytearray(f.read()) print(len(HUGEthumbdriveData)) numToSplit = 50000 chunksOfData = [HUGEthumbdriveData[i:i+numToSplit] for ...
994,197
bd3bce261447055f2873445b966882d92479bc83
import numpy as np import tensorflow as tf from tensorflow import keras class QSP(keras.layers.Layer): """Parameterized quantum signal processing layer. The `QSP` layer implements the quantum signal processing circuit with trainable QSP angles. The input of the layer is/are theta(s) where x = cos(theta),...
994,198
03dfafb622fefd7d2410132ecbecc766706fc4d0
#!/urs/bin/env python from argparse import ArgumentParser import logging from nltk import sent_tokenize, word_tokenize, pos_tag from nltk.stem import WordNetLemmatizer import psycopg2 logger = logging.getLogger() logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.INFO) # This part-of-speech map doe...
994,199
acf2f19b60551fb41b336692c118666604dfc749
""" modified by mtc-20 """ import RPi.GPIO as GPIO import time class AlphaBot(object): def __init__(self,in1=12,in2=13,ena=6,in3=20,in4=21,enb=26,s1=27,s2=22): self.IN1 = in1 self.IN2 = in2 self.IN3 = in3 self.IN4 = in4 self.ENA = ena self.ENB = en...