index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
993,600 | 4dbd1398e4b40b9ecf78df6cf26a0b820323205f | import math
from functools import reduce
from collections import deque
from heapq import heappush,heappop
import sys
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline().strip()
# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
return [ int(s) for s in input().split(" ")]
# 改行区切りの入力をn行読み込んで数... |
993,601 | eaafcb6b0a5b9216bf5908310573621d8fc68917 | from appium import webdriver
class TestApp:
def setup(self):
capabilities = {}
# Android平台测试
capabilities['platformName'] = 'Android'
# 测试手机版本为5.0
capabilities['platformVersion'] = '5.1.1'
capabilities['deviceName'] = '127.0.0.1:62001'
capabilities['appPacka... |
993,602 | 570ed1c0790e47a84601084ca67515aa14366729 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 13:22:03 2020
@author: zhouming
"""
import torch,pickle,os
from os.path import join as pjoin
from PIL import Image
import numpy as np
import pandas as pd
from skimage import transform
from dnnbrain.dnn.models import AlexNet
from dnnbrain.dnn.base... |
993,603 | 1308f0aa5ec8937a50ee23f070afa36f00cfa909 | """------------------for Dehumidifier"""
import enum
import logging
from typing import Optional
from .const import (
FEAT_HUMIDITY,
FEAT_TARGET_HUMIDITY,
FEAT_WATER_TANK_FULL,
)
from .core_exceptions import InvalidRequestError
from .device import Device, DeviceStatus
CTRL_BASIC = ["Control", "basicCtrl"]
... |
993,604 | 7b9a85ca9fd1fb354cd76dff8bf59aaad3feee2b | import dramatiq
import importlib
from django.conf import settings
DEFAULT_BROKER = "dramatiq.brokers.rabbitmq.RabbitmqBroker"
DEFAULT_SETTINGS = {
"BROKER": DEFAULT_BROKER,
"OPTIONS": {
"host": "127.0.0.1",
"port": 5672,
"heartbeat_interval": 0,
"connection_attempts": 5,
},... |
993,605 | 449c099422f22df2988d9957dd34bcb0972a899b | """
Classes for writing and filtering of processed reads.
A Filter is a callable that has the read as its only argument. If it is called,
it returns True if the read should be filtered (discarded), and False if not.
To be used, a filter needs to be wrapped in one of the redirector classes.
They are called so because ... |
993,606 | fbfbd36c2d9eb5ff3cbe8d15dff01546ce4ac1f7 | import os
from django.db import models
from django.utils.translation import ugettext_lazy as _
from apps.category.models import Category
from apps.publication.models import Publication
from settings.common import MEDIA_ROOT
class News(Publication):
"""Stores HTML content and an optional featured image, besides ca... |
993,607 | 524be494e0182bb5fe63a444aed49238a254fe75 | #!/usr/bin/env python3
load_frozen_lake = __import__('0-load_env').load_frozen_lake
q_init = __import__('1-q_init').q_init
env = load_frozen_lake()
Q = q_init(env)
print(Q.shape)
env = load_frozen_lake(is_slippery=True)
Q = q_init(env)
print(Q.shape)
desc = [['S', 'F', 'F'], ['F', 'H', 'H'], ['F', 'F', 'G'... |
993,608 | 7c21c5b534fd1b5fe62d74e5bc89d6a2e72977c0 | stocks = {
"GOOGLE": 520.54 ,
"FB": 76.45 ,
"YAHOO": 39.28 ,
"AMAZON": 306.21 ,
"APPLE": 99.76
}
# Sorts numerically
print(sorted(zip(stocks.values(), stocks.keys())))
# Sorts alphabetically
print(sorted(zip(stocks.keys(), stocks.values())))
# Grabs minimum number
print(min(zip(stocks.values(), s... |
993,609 | 4b32eac2d7ff7ce6074184b5239dce0a3a061791 | # 204. Count Primes
# Count the number of prime numbers less than a non-negative number, n.
# Example:
# Input: 10
# Output: 4
# Explanation:
# There are 4 prime numbers less than 10, they are 2, 3, 5, 7.
class Solution:
def countPrimesSimple(self, n: int) -> int:
"""
Time to sift out multiples of... |
993,610 | af14ff155765f427d6de8670ac2eb0ef7d1b1c51 | chrodata = ((0.005666666666666667, 0.0285, 0.0515, 0.0745, 0.09733333333333333, 0.12033333333333333, 0.14333333333333334, 0.16633333333333333, 0.18916666666666668, 0.21216666666666667, 0.23516666666666666, 0.258, 0.28099999999999997, 0.304, 0.3268333333333333, 0.34983333333333333, 0.37283333333333335, 0.395666666666666... |
993,611 | 007643de6617849b8a2cac54291edb091acd42f8 | from bs4 import BeautifulSoup
import coinmarketcap as cmc
import custom_utils.HTTP_helpers as HTTPh
import log_service.logger_factory as lf
logging = lf.get_loggly_logger(__name__)
name_lookup_table = cmc.get_name_symbol_lookup_table(lookup_by_name=True)
parent_blockchain_stats = []
parent_blockchain_url_list = []
... |
993,612 | 094262c03f6cc2d551172dab95700a707f85c46e | from .cli import main, cli
from .d2 import video_capture
|
993,613 | 8344ffc018bb3859c157d1a8c0bd066661597b9c | # -*- coding: utf-8 -*-
import autograd as ad
import numpy as np
from autograd import config
class C_graph():
"""
aggregating class for the nodes in the computational graph
"""
def __init__(self, nodes=[]):
self.ids=[]
self.input_node=[]
self.output_node=None
self.i... |
993,614 | cdc6eb23d04b05e66379e3deeaf69974c2490400 |
# pair of parentheses to denote the empty tuple
t1 = ()
# trailing comma for a singleton tuple
t2 = 1,
t3 = (2,)
# separating items with commas
t4 = 1,2,3
t5 = (3,4,5)
# using the tuple()
t6 = tuple()
t7 = tuple([1,2,3,4])
print(t1)
print(t2)
print(t3)
print(t4)
print(t5)
print(t6)
print(t7)
|
993,615 | 27bd976760446078f21e2a974f3f645147fa8b1d | # coding=utf-8
from engineer.unittests.config_tests import BaseTestCase
__author__ = 'Tyler Butler <tyler@tylerbutler.com>'
finalization_draft_output = """title: Finalization Draft
status: draft
slug: finalization-draft
tags:
- tag
---
This is a finalization test post.
"""
finalization_fenced_output = """---
tit... |
993,616 | 2c729b3dec28875f99e7b16cd4787e5b59aafefc |
import pathlib
import yara
from pprint import pprint
base_dir = pathlib.Path(__file__).parent.absolute()
rule_path = base_dir.joinpath('rules', 'string_match.yar').as_posix()
rules = yara.compile(filepath=rule_path)
with open(base_dir.joinpath('sample.txt'), 'rb') as f:
matches = rules.match(data=f.read())
ppr... |
993,617 | 5ef9a0dd9c58573113afdbecbfa646eb95efbf8c | import asyncio
import inspect
import logging
import os
import traceback
import random
from contextlib import redirect_stdout
from datetime import datetime
from difflib import get_close_matches
from io import StringIO, BytesIO
from itertools import zip_longest, takewhile
from json import JSONDecodeError, loads
from text... |
993,618 | 8073873a79495cde696926a4e503ec744052ce80 | # Generated by Django 3.0.3 on 2020-02-21 06:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('firstsiteapp', '0004_year_name'),
]
operations = [
migrations.RemoveField(
model_name='year',
name='update',
... |
993,619 | 8709fd5908773f5e491bed752e38a75419527a7a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Screen(object):
@property
def width(self):
return self._width
@width.setter
def width(self,value):
self._width = value
@property
def height(self):
return self._height
@height.setter
def height(self,value):
self._height = value
@property
def re... |
993,620 | 43bc4500b9bea33d1e722aaf88d1f01ac74c0ece | #!/usr/bin/env python3
import logging
import yaml
from pathlib import Path
from ops.charm import CharmBase
from ops.main import main
from ops.framework import StoredState
from ops.model import ActiveStatus, MaintenanceStatus
from jinja2 import Template
import os
from oci_image import OCIImageResource, OCIImageResource... |
993,621 | f0f0a264a4ab96277422f610591626d5f61b8f43 | class Diffstat(object):
def __init__(self):
self.lines_added = 0
self.lines_deleted = 0
self.filename = '' |
993,622 | 4d8fd957759e0f597eb30b56abed13e7a625ad26 | import hashlib
import itertools
import logging
import time
from functools import reduce
from operator import or_
from flask import current_app as app
from flask import request_started, url_for
from flask_login import AnonymousUserMixin, UserMixin, current_user
from passlib.apps import custom_app_context as pwd_context... |
993,623 | ad4fe739103382994d7dbed7889abd8eaccfa619 | import pandas as pd
from random import randint
def get_random_bipartite(n_edges=10000000, n_a=10000, n_b=10000):
return pd.DataFrame([(f"a{randint(0, n_a)}", f"b{randint(0, n_b)}") for x in range(n_edges)], columns=["A_id", "B_id"]) |
993,624 | ab7c2ed09aeb2d96a0f83e253010bd742a71513e | from aocd import get_data
content = get_data(day=4, year=2018)
numGuards = content.count("Guard")
content = content.split("\n")
content.sort()
schedule = [[["a"],["0" for i in range(60)]] for j in range(numGuards)]
currentGuard = 0
currentSpot = -1
startTime = 0
for i in range(0,len(content)):
line = content[i]
... |
993,625 | 2ee5ade35d56433370e3d43ffd68b153fac1a86c | from ..java_class_def import JavaClassDef
from ..java_field_def import JavaFieldDef
from ..java_method_def import java_method_def, JavaMethodDef
class File(metaclass=JavaClassDef, jvm_name='java/io/File'):
def __init__(self, path):
self.__path = path
#
@java_method_def(name='getPath', signatu... |
993,626 | e549cb21a02c16017d5db430e579355a7d57176a | from collections import defaultdict
names = 'bob julian tim martin rod sara joyce nick beverly kevin'.split()
ids = range(len(names))
users = dict(zip(ids, names)) # 0: bob, 1: julian, etc
friendships = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3),
(3, 4), (4, 5), (5, 6), (5, 7), (5, 9),
(6,... |
993,627 | a335f7cb8da78ddcf79d0b037399a66f51813b90 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 30 22:22:33 2015
@author: thoma
"""
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.datasets import load_digits
from random import sample
from sklearn.ensemble import BaggingClassifier, RandomForestClassifier
from scipy.stats import m... |
993,628 | c98810eca094f8231ca523394fafa2390ac6b15a | import sys
sys.exi
|
993,629 | 47ce23087190686739ac9b3c5e7b7fb5e57be9db | """ Command-line tool for use with Strom services.
User is able to upload and register a local template file, and retrieve a unique stream token back for that template.
Allows uploading of local data files for event recognition.
Can return event object containing all found events in given data file.
"""
import click
im... |
993,630 | c7a064d5748eec5c5065e584ac07f8dbfd5ee100 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sms.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import ... |
993,631 | bd46532cc5d6c1ebb7cd1b4aec6d510282dc3c84 | # Generated by Django 3.2.5 on 2021-07-26 10:28
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AU... |
993,632 | 53f8c5d48b7b8f355130356d2b0dee1cc1f78382 | soma = qtd = 0
for c in range(6):
num = float(input())
if num > 0:
qtd += 1
soma += num
print(qtd, "valores positivos")
print("{:.1f}".format(soma/qtd))
|
993,633 | 42693e443e4b741ed8502146fbbb73f545a26db2 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import json
def jsonTextReader(jsonFilePath):#讀取 json 的程式
with open(jsonFilePath, encoding="utf-8") as f:#將讀入的json檔案以純文字載入並回傳
text = json.loads(f.read())
return text
def text2Sentence(inputSTR):#將字串轉為「句子」列表的程式
symbol=[ "、", ",","。", ","] #斷句符號
... |
993,634 | f9863ac5a3d641b692c18f6a8d073c3f8418096d | import urllib.request
import json
"""
Capsules
Detailed info for serialized dragon capsules
Get all capsules : GET /capsules
Get one capsule : GET /capsules/:id
Query capsules : POST /capsules/query
lock Create a capsule : POST /capsules
lock Update a capsule : PATCH /capsules/:id
lock... |
993,635 | 2ea91cd8dda5e8b6075dc005555ed0b166ab3f03 | # Generated by Django 2.1.5 on 2019-01-10 10:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('proposal', '0002_auto_20181228_0050'),
]
operations = [
migrations.AlterField(
model_name='prop... |
993,636 | e14c432f0f765bdf607f45fc5225a6c45f055379 | #Nguyen Thi Yen Khoa
# MSSV: B1709343
#---------------Cau1-----------------
#print("Hello ! welcome to python!")
#------------------------------------
#--------------------------------Cau2----------------------
#print("Nhap ten cua ban: ")
#x = input()
#print("Hello " + x + " Welcome to Python")
#------------------... |
993,637 | 3c403889219a11b5d3ae4b2158d5a1ea80bda766 | #!/usr/bin/env seiscomp-python
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (C) GFZ Potsdam #
# All rights reserved. #
# ... |
993,638 | b10cc9cc3565a3d58a9482f0e59146255f625728 | #!usr/bin/python3
# 主界面
# 使用tk模块
# 包含一个菜单栏,工具栏,状态栏的图形化程序
import tkinter as tk
from tkinter import messagebox as mes
from tkinter import ttk
class Main():
pass
if __name__ == '__main__':
vi = Main()
vi.mainloop()
|
993,639 | ca55a43dfc14a33095e18b68e109077050eb4017 | """
In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies properties 1 and 2.
You a... |
993,640 | 032e1e45ebb701f1898f05b1afbf76579221c01e | import tkinter as tk
import socket
import errno
import sys
import threading
import json
from tkinter import messagebox
from ttkthemes import ThemedTk
from functools import partial
# TODO: Lanjut fix ui, export & restore, refactor, close window and server is all destroy function and message finalizing
class ClientWind... |
993,641 | dc969752031740eddc7570d79664f46ea342a359 | import urllib2
from common import *
from crawler import download_pdb_file
class PdbFileDownloaderTest(unittest.TestCase):
def test_download_file_length(self):
file_content = download_pdb_file("1LSG")
actual = len(file_content)
expected = 122472
self.assertEqual(actual, expected)
... |
993,642 | fd9978f1ea0d4ceda2af0a72c413df1984610f8a | # Autogenerated from KST: please remove this line if doing any edits by hand!
import unittest
from bits_signed_b64_le import _schema
class TestBitsSignedB64Le(unittest.TestCase):
def test_bits_signed_b64_le(self):
r = _schema.parse_file('src/bits_signed_b64_le.bin')
self.assertEqual(r.a_num, 0)
... |
993,643 | 5708bf36bb260d09d933199d806f541fb632403d | from django.contrib.auth.models import User
from django.contrib.auth import *
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Address(models.Model):
street = models.CharField(max_length=200)
number = models.CharField(max... |
993,644 | 1a3da7d1f13aac213e6f6175f8822a0542f6d195 | from firebase import firebase
import functions as f
import json
import time
fire = firebase.FirebaseApplication('https://proj1-6f30a.firebaseio.com/',None)
data = fire.get("/macs", None)
print(data)
diction = dict()
diction["macs"] = data
def algorithm(point):
t_point = f.cal_avg_std(point)
ref_points =... |
993,645 | 486b1c58eb46315aad8b74edb0fc2412322cfbf7 | #!/usr/bin/env python
# coding: utf-8
import sys
from oar.lib import (config, get_logger)
from oar.lib.job_handling import (get_job_frag_state, job_arm_leon_timer, job_finishing_sequence,
get_jobs_to_kill, set_job_message, get_job_types,
set_job_state... |
993,646 | 2bd4a4d790abecc0742a37679b819f7f944d9707 | import json
import logging
import os
from trpycore.zookeeper_gevent.client import GZookeeperClient
from trpycore.zookeeper_gevent.watch import GHashringWatch
from trpycore.zookeeper.watch import HashringWatch
from trsvcscore.hashring.base import ServiceHashring, ServiceHashringNode, ServiceHashringException, ServiceHa... |
993,647 | c37f07334f36cb94b0abe938379fa3f829713fd2 | A,B,C = map(int,input().split())
ans = A+B+C
if ans <= 21:
print('win')
else:
print('bust') |
993,648 | e59dff5dd9ab61d615b68462a168974478cce9e4 | import logging
from mtg_search.version import __version__
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
|
993,649 | ae5ce8051ab42f8da14cdf818257b5cfb4c90b57 | import time
import io
import sys
import webbrowser
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.com... |
993,650 | fec94463636b8d80cef5e934c1981e76470d4d3b |
from flask_restful import Resource, reqparse
#resource is something that our API can return and create, such as student, piano, item, store, ..
# Resources are also mapped into database tables as well
from models.item_model import ItemModel
from flask_jwt import jwt_required
# api is working with resources and e... |
993,651 | 6478b4807ea599efc21da6f0b91a8cfb76582f08 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from django.shortcuts import render
from django.shortcuts import redirect
from main.models import Facilities
from main.models import FacOverview
from main.models import Users
from main.models import AccountMoney
from djan... |
993,652 | b31681385a9af653a8ed52bba9c7f7b686d84198 | from PIL import Image, ImageOps, ImageFilter
import torchvision.transforms as transforms
import random
'''
#####
Adapted from https://github.com/facebookresearch/barlowtwins
#####
'''
class GaussianBlur(object):
def __init__(self, p):
self.p = p
def __call__(self, img):
if rand... |
993,653 | 93a5a7494690c6219e7c1ecf872ea97b41592358 | import logging
import os
from pathlib import Path
from typing import List, TypeVar
import numpy as np
from tqdm import tqdm
from jmetal.core.observer import Observer
from jmetal.core.problem import DynamicProblem
from jmetal.core.quality_indicator import InvertedGenerationalDistance
from jmetal.lab.visualization impo... |
993,654 | 9f8bce39c463818651596c31c56b383910a264d9 | import torch
import random
from nltk.translate.bleu_score import corpus_bleu
from model.visualization import Visualization
def evaluate(model, test_loader, vocab, device, epoch):
model.eval()
total_loss = 0.
with torch.no_grad():
for idx, batch in enumerate(iter(test_loader)):
img, target = batch
img... |
993,655 | a244e75cfe105f1e9f7fdd2a8be893351520e726 | # FlagsTracksDefault.py
# (C)2014
# Scott Ernst
from __future__ import print_function, absolute_import, unicode_literals, division
import sqlalchemy as sqla
from pyglass.sqlalchemy.PyGlassModelsDefault import PyGlassModelsDefault
from pyglass.sqlalchemy.ConcretePyGlassModelsMeta import ConcretePyGlassModelsMeta
impo... |
993,656 | 7bede769a48a7fe4d0d7f4d33b9dad66a9c39b57 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 5 19:55:18 2021
"""
from tkinter import *
from tkinter.ttk import *
import tkinter.scrolledtext as st
import aiml
import os
import gtts
from gtts import *
import pyttsx3
import webbrowser
from playsound import playsound
def start_GUI():
def ... |
993,657 | 0cfca8ab721243293628a95f38eb1d8854c16f67 | from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Restaurant, MenuItem
engine = create_engine("sqlite:///restaurantmenu.db")
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()
#myFirstRestaurant = Restaurant(name = ... |
993,658 | df50af78e5648e5f85a18b66457cdb33f553ab28 | # -*- coding: utf-8 -*-
from cobra.core.loading import is_model_registered
from .abstract_models import * # noqa
__all__ = []
if not is_model_registered('accessgroup', 'AccessGroup'):
class AccessGroup(AbstractAccessGroup):
pass
__all__.append('AccessGroup')
|
993,659 | 7ef52e92b06600c3bca77d7689fd31b3b2af6323 | # coding=utf-8
'''
Created on 13 Feb 2018
@author: Administrator
'''
class Solution:
def swimInWater(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
import heapq
visited = {(0, 0)}
q = [(grid[0][0], 0, 0)]
ans = 0
N = len(grid)... |
993,660 | b819c8707508d9dbdde42b2d94e368a1a424f066 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 16:45:01 2018
@author: Dartoon
"""
import numpy as np
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt
import pickle
import copy
import matplotlib as matt
import matplotlib.lines as mlines
from matplotlib import colors
matt.rcPar... |
993,661 | 427ea0c2538f031d75ca7547e72d8a6e2bbcb23e | from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def inorderTraversal(self, root: TreeNode) -> List[int]:
stack = [root]
seen = set()
seen.add(None... |
993,662 | d8c58d227701bf3cf311e98bd5d757bef3a5a526 | def resolve():
'''
code here
'''
N, K = [int(item) for item in input().split()]
xs = [int(item) for item in input().split()]
min_lr = 10**9
min_rl = 10**9
if N != K:
for i in range(N-K+1):
min_lr = min(min_lr, abs(xs[i]) + abs(xs[i+K-1] - xs[i]))
min... |
993,663 | 06e2167ba1378437a0f9de818a5d6cc5a47f8c3a | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the designerPdfViewer function below.
def designerPdfViewer(h, word):
d = dict()
for i in range(26):
d[chr(i+97)] = h[i]
list = []
for e in word:
list.append(d[e])
return max(list)*len(word)
if __na... |
993,664 | 9922c1db724eb53341d009a27ce148733ee5708d | # Generated by Django 2.1.7 on 2019-04-17 05:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0010_auto_20190416_1352'),
]
operations = [
migrations.AddField(
model_name='estatusactividad',
name='color',... |
993,665 | 67690540bff8d3d771523ccf6a374282f683d2f9 | from app.models.base import BaseModel
from google.appengine.ext import ndb
import logging
class CommentModel( BaseModel ):
Name = ndb.StringProperty(indexed=True, required=True)
Email = ndb.StringProperty(indexed=False, required=True)
Comment = ndb.BlobProperty(indexed=False, required=Tr... |
993,666 | a48b2fc5099fbc9fc8dbc76274cf505902c4976a | from petsc4py import *
from petsc4py import PETSc
import graphviz
import numpy as np
import matplotlib.pyplot as plt
from collections import namedtuple
VERTEX_DEPTH_STRATUM = 0
EDGE_DEPTH_STRATUM = 1
FACE_DEPTH_STRATUM = 2
# Cell Quality Measure datatype
# We care about a cell's area (measure), minimum angle, aspect ... |
993,667 | 9bc204820a073b0595bd27b365aba3a1b71e4a47 | #coding=utf-8
#Version:python3.7.3
#Tools:Pycharm
"""
:r 只读方式打开文件,指针在开头
:w 以只写方式打开文件
:a 以追加方式打开文件,文件指针会放在文件的结尾
:r+ 以读写方式打开文件,文件的指针放在开头
:w+ 以读写的方式打开问津,如果文件存在会被覆盖
:a+ 以读写的方式打开文件。如果文件存在,指针就会放在结尾
"""
__date__ = '2019/4/3 17:00'
__author__ = 'Lee7'
# 1.打开文件
file = open("README.txt","a+")
# 2.写入文件
file.writ... |
993,668 | 122fbce353ae1cc0a90e12aada74add3f7978b4d | import random
import json
import os
import tempfile
import sys
from multiprocessing import Pool
with open('merged_backsplice_sequences.json') as handle:
data = json.load(handle)
def run_primer3(circ_id):
temp_file_data = "SEQUENCE_ID=%s\nSEQUENCE_TEMPLATE=%s\n=\n" % (circ_id, data[circ_id])
temp_file = tempfile.N... |
993,669 | c89789fa4012d9eed1ebad0d691132bb6e25ea77 | from time import time
from utility.printable import Printable
class Block(Printable):
def __init__(self, index, previous_hash, transactions, proof, time=time()):
self.index = index
self.previous_hash = previous_hash
self.timestamp = time
self.transactions = transactions
self.proof = proof
|
993,670 | 8128db189617b5820a41c001b95ad8083af58a3f | #!/usr/bin/python2.7
from __future__ import division
import os
import numpy
import scipy
import matplotlib
import pandas
import statsmodels
import patsy
import sys
import argparse
import matplotlib.pyplot as plt
import re
from random import shuffle,random,randint,choice,seed
from collections import Counter
from os im... |
993,671 | fd4a91350b6b29d0905524543b9c0943faa07bbe | import sys
def main(N, *arg):
values = sorted(list(map(int, arg)), reverse=True)
return sum(values[::2]) - sum(values[1::2])
if __name__ == '__main__':
N = int(sys.argv[1])
main(N, sys.argv[2:])
|
993,672 | b45d11db566e74ab95d8df3b9e468007397879ba | import numpy as np
import scipy.io.wavfile as wf
import matplotlib.pyplot as plt
rate, data = wf.read('challenge.wav')
data = data / 32768.0
# strip off the constant tone from both sides
points = data[6752:77120:8]
plt.plot(points[:, 0], points[:, 1], 'o')
angles = np.angle(points[:, 0] + points[:, 1] * 1j)
vals = ... |
993,673 | c39e704f98ab8a7d2ff76483af66b360a8985e37 | from src.test.run.testObject import testObject
from src.test.run.testSet import testSet
from copy import deepcopy
#import src.test.run.example
#import pytest
import sys
from pyrallei import Rally, rallyWorkset #By using custom package pyrallei as a workaround for the bug: bug: https://github.com/RallyTools/RallyRestTo... |
993,674 | 5a8f5edd5db62f7c7915bf2a456f81f9482f1caa | import requests
import json
BASE_URL = "https://api.jdoodle.com/v1/execute"
headers = {'content-type': 'application/json'}
with open('tests/test_wealth_manger.py', 'r') as f:
code = f.read()
data = {
'script': code,
'language': "python3",
'versionIndex': '2',
'clientId': '8acba1648460ab5cc5e502f507d3230e',
'cl... |
993,675 | b78d8b698040bafba3e30598a8ba132739e84da0 | import fileinput
import time
import re
from collections import defaultdict
from operator import itemgetter
INPUT_FILE = "aoc_2018_04.dat"
start = time.time()
inputs = sorted(fileinput.input(INPUT_FILE))
totals = defaultdict(int)
minutes = defaultdict(lambda: defaultdict(int))
for line in inputs:
... |
993,676 | 84d8be22001ce4a1ed56d35348f49cd5bd225419 | import charm.cryptobase
from charm.pairing import pairing,ZR
#from toolbox.pairinggroup import pairing,ZR
from charm.integer import integer,int2Bytes
import hashlib, base64
class Hash():
def __init__(self, htype='sha1', pairingElement=None, integerElement=None):
if htype == 'sha1':
self... |
993,677 | d064e0c49d5b9d4f7b04f2d478ba9eddc06a7fde | #Comentario
print ("programa que suma dos números")
a= int (input ("Ingresa el sumando 1: "))
b= int (input ("Ingresa el sumando 2: "))
suma = a + b
print ("El resultado es" , suma)
|
993,678 | 44fe554d8f53b65502ece1607d497d5e635714cc | import logging
class Log(logging):
self.getLogger(__name__)
|
993,679 | 668285051bfcafc3098ff3db91944c1e7dd1f180 | /Users/jingwang/anaconda/lib/python3.6/functools.py |
993,680 | 06f921fc45a560ae49eee0ec1ed8b9428f01fd8f | API_ENDPOINT = 'https://openexchangerates.org/api/'
LATEST_ENDPOINT = 'latest.json'
HISTORICAL_ENDPOINT = 'historical/{date}.json' |
993,681 | 6a02481e04f10538aad9ce43a28a6af64eb62a3c | # Problem #10 - Linear Function http://www.codeabbey.com/index/task_view/linear-function
# Submission by MPadilla - 21/Jun/2015
def linearf(coord):#Función para calcular la pendiente A y el intercepto B de la función lineal
global i,entr
Xi=entr[i][0]
Xf=entr[i][2]
Yi=entr[i][1]
Yf=entr[i... |
993,682 | c21f121dc1d0009ca4752e2de3175c2af934ee3b | #! /usr/bin/env python
import os
files = [
# full filenames
"var/log/apache/errors.log",
"home/kane/images/avatars/crusader.png",
"home/jane/documents/diary.txt",
"home/kane/images/selfie.jpg",
"var/log/abc.txt",
"home/kane/.vimrc",
"home/kane/images/avatars/paladin.png",
]
# unfoldin... |
993,683 | 4682ebdcb27c488363d08b90bab86b71f2a24026 | from correlcalc import *
bins = np.arange(0.0005,0.0505,0.0005)
acorrdr122xap=atpcf('/usr3/vstr/yrohin/Downloads/galaxy_DR12v5_CMASS_North.fits',bins,bins,randfile='/usr3/vstr/yrohin/randcat_dr12cmn_2x_pdf10k.dat',vtype='ap',estimator='ls',weights='eq')
|
993,684 | f6f489dc18fff2699c35b4253e7a8d123b0fa1ea | #WWALK
t = int(input())
for _ in range(t):
n =int(input())
l = list(map(int,input().split()))
m = list(map(int,input().split()))
s1 = 0
s2 = 0
main = 0
for i in range(n):
try:
if s1==s2 and l[i]==m[i]:
main+=l[i]
except:
pass
print... |
993,685 | 79ab0c2a9af58a1100e0c57f5bfd0c591c430b5b | from collections import AsyncIterable
from asyncpgsa import PG
from sqlalchemy import select
from scrapnow.lib.component import Component
from .schema import (
scrap_task,
scrap_document_fields,
article,
TaskStatus
)
class QueryAsyncIterable(AsyncIterable):
PREFETCH = 100
def __init__(self,... |
993,686 | 4a6ea386304d158da44ecc358b0ba2ed99122f92 | n=int(input())
str1=input()
str2=input()
if(n==2):
if((str1=="timetopractice" and str2=="toc")or str1=="metopractice"):
print("toprac\napzo",end="\n")
else:
print("toprac\n-1",end="\n")
|
993,687 | d00676891fe12aee02c54869da4b8a1c172d7ee8 | import requests
import unittest
import json
from xmdCW.chewudata.get_data import cheWu
from xmdCW.gettoken.getToken import GetToken
from BeautifulReport import BeautifulReport as bf
# 该接口写的是待核准状态的问题反馈,其他状态均类似,都是一个接口
class TestFanKui(unittest.TestCase, GetToken):
# @unittest.skip(1)
def test1_fankui_notoken(... |
993,688 | dc18468a68c5e55339fa821b278f5edd911378ca | from django.contrib.auth.forms import UserCreationForm, forms
from django.contrib.auth.models import User
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
full_name = forms.CharField(max_length=30)
contact_number = forms.IntegerField()
# lname = forms.CharField(max_length=10... |
993,689 | 105536f8e07d8988b64bcd9310dd698df4d4b031 | import plotly.graph_objects as go
import sqlite3
def grafik_player_id(userid):
grafik_player_teg(get_teg(userid))
def get_teg(userid):
conn = sqlite3.connect("clanstat.db")
cursor = conn.cursor()
cursor.execute("SELECT teg FROM telegram_main WHERE id_telegram = ?",(userid,))
teg = cursor.fetcho... |
993,690 | a21303db31234fa36886c9c2125cec88eaf3540e | """
地址:https://leetcode.com/problems/power-of-four/description/ 不实用循环递归完成
描述:
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example 1:
Input: 16
Output: true
Example 2:
Input: 5
Output: false
Follow up: Could you solve it without loops/recursion?
思路:
这道题是在leetcodeNo.231:... |
993,691 | 19fd7f4ee1a14afe73caca6116239012b223b1e3 | from mongoengine import DynamicEmbeddedDocument
from mongoengine.fields import StringField, ListField, EmbeddedDocumentField
class DruggabilitySearch(DynamicEmbeddedDocument):
meta = {'allow_inheritance': True, 'abstract': False, 'strict': False}
name = StringField()
def __init__(self, **kwargs):
... |
993,692 | 2bd1113776d970c48b50bf40aae77aa22b1f0e63 | somaidade = 0
mediaidade = 0
maioridadehomem = 0
nomevelho = ''
totalm = 0
for lista in range(1, 5):
nome = str(input('Digite seu nome:')).strip()
idade = int(input('Digite sua idade: '))
sexo = str(input("Digite seu sexo: (H/M) ")).strip()
somaidade += idade
if lista == 1 and sexo == 'Hh':
... |
993,693 | eff078e29bed5c6dfa3b68b85959f114f89e8175 | import ctypes
from dongtai_agent_python import global_var as dt_global_var
from dongtai_agent_python.common.content_tracert import dt_tracker_get
from dongtai_agent_python.assess.deal_data import wrapData
class PyObject(ctypes.Structure):
pass
Py_ssize_t = hasattr(ctypes.pythonapi, 'Py_InitModule4_64') and ctyp... |
993,694 | d337657a4405711dde884890d995d295530a0977 | """
Copyright (c) 2018 Doyub Kim
I am making my contributions/submissions to this project solely in my personal
capacity and am not conveying any rights to any intellectual property of any
third parties.
"""
import numpy as np
import pyjet
def test_init2():
ps = pyjet.ParticleSystemData2()
assert ps.numberO... |
993,695 | 772773a8c22a68712b639221317cb30801aa3d8a | stuff = {"name": "Steven", "Age": "39", "HeightCM": "179"}
print(stuff["name"])
stuff["name"] = "Bob"
print(stuff["name"])
del stuff["name"]
print(stuff)
states = {
"newsouthwales": "nsw",
"westernaustralia": "wa",
"northernterritory": "nt",
"victoria": "vic",
"queensland": "qld",
"southaustral... |
993,696 | cfe37679bce33e9263fb40919e3fada008fb9439 | # import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from s... |
993,697 | e467c1353d337f9f05cf12fab1fca1361bfb5057 | import numpy as np
class ActivationFunction(object):
@staticmethod
def Forward(x): raise Exception("Function not impolemented")
@staticmethod
def Backward(output,a, dO): raise Exception("Function not impolemented")
from ActivationFunction.Sigmoid import *
from ActivationFunction.ReLU import *
from Ac... |
993,698 | ac0db5b8ffa30ae9308bd2c8a84b3cc0ef69a9ff | # -*- coding:utf-8 -*-
import outlook
import config
import botModule
from menuRecognizer import *
menuRec = menuRecognizer()
mail = outlook.Outlook()
mail.login(config.address, config.password)
mail.inbox()
mail.read()
menuRec.setValidExcelMenuFileName()
ValidExcelFileName = menuRec.getExcelFileName()
if ValidExcelFi... |
993,699 | 63dff96e598ae6594f8bedd4a7a5f55319dc2580 | #adriana ku
print ("Introdusca un rango de aņos")
print ("Aņo de inicio")
startYear = int(input())
print ("Aņo final")
endYear = int(input())
##print ("leap years:")
for year in range(startYear, endYear):
if (0 == year % 4) and (0 != year % 100) or (0 == year % 400):
print ('{} is leap year'.forma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.