index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,800 | 3df7dac62e87a5d5cd908d3c79dfe302b8c679ad | # -*- coding:utf-8 -*-
import logging
from stompest.config import StompConfig
from stompest.sync import Stomp
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
uri = 'failover:(tcp://x:61613,tcp://y:61613,tcp://z:61613)?randomize=false,startupMaxReconnectAttempts=3,initialReconnectDelay=7,maxReconnect... |
988,801 | feac1708da65ef2bcd890e2e812e2537cb480aa5 | import pytest
from web3 import Web3, EthereumTesterProvider
import vyper
from hypothesis import given, strategies as st
from trie.smt import calc_root
@pytest.fixture(scope="module")
def merkle_root_contract():
w3 = Web3(EthereumTesterProvider())
with open("contracts/MerkleRoot.vy", "r") as f:
inter... |
988,802 | 9ef270b190eed3fba09ea17de563158c50b769cb | #!/usr/bin/env python
# coding:utf-8
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "firstdjango.settings")
django.setup()
def main():
from blog.models import Article
f = open('oldblog.txt')
BlogList = []
for line in f:
title, content = line.split('****')
a... |
988,803 | a8a36b21173f3028be3c4c17f3b54389ab15ad9d | from django.conf.urls import patterns, url
from .views import CountryAsia, ContactUsMarkAsRead, ContactUsCreate
urlpatterns = patterns(
'',
url(r'^countries/$', CountryAsia.as_view(), name='country_asia'),
url(r'^countries/(?P<slug>[a-zA-Z0-9-]+)/$', ContactUsCreate.as_view(), name='contact_add'),
url(... |
988,804 | ae87c3582b594bb4f4cf3c754b4a03ce44aea345 | import argparse
import base64
import numpy as np
import socketio
import eventlet.wsgi
from PIL import Image
from flask import Flask, render_template
from io import BytesIO
from model import preprocess
from keras.models import model_from_json
sio = socketio.Server()
app = Flask(__name__)
model = None
... |
988,805 | 54bb7d38a390f2b07bd6e259ca6b398a21faa350 | import os
# Where the repository exists
base_path = ""
bert_config_file = os.path.join(base_path, "bert_config.json")
# Where you want to save models (this requires lots of space - better on hhds)
save_path = ""
pretrained_path = os.path.join(save_path, "pretrained_berts")
finetuned_path = os.path.join(save_path, "fi... |
988,806 | efd5f51c616973dc5d934562db033412acd92857 |
print()
"""
format方法
"""
#括号及其里面的字符 (称作格式化字段) 将会被 format() 中的参数替换
print("我叫{},今年{}!".format("张三",22))
#括号中的数字用于指向传入对象在 format() 中的位置
print("我叫{0},今年{1}!".format("张三",22))
print("我叫{1},今年{0}!".format("张三",22))
#
#在format()中使用关键字参数,它们的值会指向使用该名字的参数
print("我叫{name},今年{age}!".format(name="张三",age=22))
print(... |
988,807 | 1d544b7321ccd9fca279efea5ff8e6aa71db354f | # Generated by Django 2.0.2 on 2018-02-27 18:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0009_page_gender'),
]
operations = [
migrations.RenameField(
model_name='page',
old_name='gender',
new_n... |
988,808 | f0c0137f9876d1c898c282560037acdced46f2b3 | # coding=utf-8
from utils import FifoList, BoundedPriorityQueue
from models import (SearchNode, SearchNodeHeuristicOrdered,
SearchNodeStarOrdered, SearchNodeCostOrdered)
def breadth_first(problem, graph_search=False):
return _search(problem,
FifoList(),
gr... |
988,809 | 863bfbd434c96d7b19d3df58caf091877816549e | #!/usr/bin/env python
#import SimpleXMLRPCServer
import xmlrpc.server
import os
def ls(directory):
try:
return os.listdir(directory)
except OSError:
return []
def ls_boom(directory):
return os.listdir(directory)
def cb(obj):
print("OBJECT::", obj)
print("OBJECT.__class__::", obj.... |
988,810 | a0a29c0c629b1ff5947c43f389e519d6264b9dd9 | class TextBox(RibbonItem):
""" The TextBox object represents text-based control that allows the user to enter text. """
Image=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The image of the TextBox.
Get: Image(self: TextBox) -> ImageSource
Set: Image(self: TextBox)=value
... |
988,811 | 1cee54791d78ae474887453215b57fecc43bc499 | from polygon import Polygon
from segitiga import Segitiga
from segilima import Segilima
#menunjukan bahwa file ini merupakan kelas main
if __name__ == "__main__":
#s4 adalah objek dari kelas segiempat
s3 = Segitiga()
#method inputsisi() dan dispSisi() dimiliki polygon (kelas induk)
s3.inputSisi()
... |
988,812 | 671e1509883f5e83bf87a3525897f3a2d7f730c9 | import logging
try:
from .func import load_config
except (ImportError, ValueError):
from guang_toolkit import load_config
logger = logging.getLogger(__name__)
class Basic:
def set_input(self, keys, values, path_config):
"""
设置属性
:param keys: 属性名称列表
:param values: 属性值列表
... |
988,813 | 9e2027336d498f9e8231b9c23d6802bcd9977a9d | # =============================================================================
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source ... |
988,814 | 0c2163de99bd92ae49ee3d882cdcf24143d7cf7a | from header import *
def solution(A):
# Kadane's algorithm
mn = inf
ans = -inf
for p in A:
mn = min(mn, p)
ans = max(ans, p-mn)
return ans if ans!=-inf else -1
A = input()
A = [int(x) for x in A.split()]
ans = solution(A)
print(ans)
"""
""" |
988,815 | 694efbeabc13e2c1a224753aa6aa80e6749a623b | from . import test_context
import sys
import io
import unittest
import keyring
import keyring.backend
import re
import os
import tempfile
from requests.exceptions import HTTPError
from requests import Response
try:
from contextlib import redirect_stdout, redirect_stderr
except ImportError:
from contextlib2 i... |
988,816 | f448df5b05534b693baf1240b329c9f090263a55 | class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
dic = {}
for index in range(len(list1)):
name = list1[index]
dic[name] = [index, -1]
pa... |
988,817 | a1011d4530475d102b99dc175ee80f4a1afa6868 | import argparse, io, json, logging, os, re, subprocess, sys, tempfile
from collections import defaultdict
import vcf
import pysam
import pysam.bcftools as bcftools
import pybedtools.bedtool as bed
import numpy as np
import pandas as pd
from pathlib import Path
from shlex import quote
from .sample import Sample
from .va... |
988,818 | c4a01a1ca263d321446485673ccc207aec18f46d | from collections import OrderedDict
from datetime import datetime
from flask_login import UserMixin, AnonymousUserMixin, current_user
from mongoengine.context_managers import switch_db
from markdown.util import etree
import difflib
from . import db, login_manager, wiki_pwd
from .wiki_util import unified_diff
@login_... |
988,819 | abdefc152064347bb69667b0854e22b55da98f99 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 09 21:32:57 2019
@author: Illusion
"""
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Activation
from keras.layers import Convolution2D, MaxPooling2D
from keras.optimizers import SGD
from keras import backend as K
... |
988,820 | a31fb79fd472c98061c9c4bbafbc01c444e2f728 | catlog = ['Image Referenced'] |
988,821 | 001ef8c9b15be4a6ee266f85f068ac67274f4ea8 | #! /usr/bin/env python
def main():
#Open a file for writing
#f = open("textfile.txt", "w+")
# Open the file for appending text to the end
f = open("textfile.txt", "r")
# Write some lines of data to the file
# for i in range(10):
# f.write("This is line " + str(i) + "\r\n")
#close file
#f.close()
... |
988,822 | bedf8a7b2c3c195108b9f87a887dcbcbbe10d8c6 | # coding: utf-8
pi = "3.141592653589793238462643383279"\
+"50288419716939937510582097494459230"\
+"7816406286208998628034825342117067"
import re
import utility
from commands import Command
def control_pi(argument):
argument = argument.strip()
if not argument:
return "No argument given"
if argument == "3":
ret... |
988,823 | df7b6a8626c19a654f99475fa45c70660f1eb743 | def StringMutation(string, position, char):
#To get substring = string[startIndex, length]
string = string[:position] + char + string[position+1:]
return string
str = input()
position, newChar = input().split()
newString = StringMutation(str, int(position), newChar)
print(newString) |
988,824 | 22d51684352655c2eadef6c9d46ee0e87016dc4f | """Modify the variables below to define the execution of the balancer.
Read the description (below each variable as comments) for each variable carefuly.
"""
## INPUT DEFINITION
###############################################################################
PATH_TO_CSV = 'survey.csv'
# Type string
# Path to the csv ... |
988,825 | 12393597e7b225d77bdcf3a84f25b39626349fc0 | """Current version of package bioinformatica."""
__version__ = "1.0.0" |
988,826 | ab9c7ab5f70d5fec0eb3a7b017818cd841445115 | class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
后面的一个数减前面一个数的max值
"""
if not prices :
return 0
max=0
min_price=prices[0]
for i in range(1,len(prices)):
profit=prices[i]-min_price
... |
988,827 | 8cc414cfb312be50c3191fd525c11ec0edc8608d | class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
count = 0
for i, j in enumerate(nums):
if j != val:
nums[count] = j
count += 1
return count
num_input = [1, 2, 3, 4, 4, 4, 4, 5]
val_input = 4
first = Solution()
result ... |
988,828 | b58c5a211f870e68a7232ed56af0e6969177df0a | from tkinter import *
from pickleTools import psave,pload
class MyTable(Frame):
def __init__(self,value,total,headlie,headhang):
Frame.__init__(self)
self.value = value
self.total_lie=total
self.headlie=headlie
self.headhang=headhang
self.entryWidth=10
self.... |
988,829 | 4bb2a2d7bccf2fe24c734f33e6a2c46fb5c3c6a2 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: Gözde Gül Şahin
Test Stack Generalizer Model
"""
import subprocess
import argparse
from IO.conllWriter import *
from IO.util import *
from loader import *
from scorer import *
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-test_file... |
988,830 | 8592378886ee42d3e56ac226002e5b6c35318032 | #!/usr/bin/env python3
# from numba import njit
import itertools
from bisect import bisect_right,bisect_left
INF = 10**10
# @njit
def solve(n,m,x):
if n >= m:
return 0
else:
d = list(sorted(x[i+1] - x[i] for i in range(m-1)))[::-1]
res = x[-1] - x[0]
for i in range(min(m-1,n-1)):
res -= ... |
988,831 | a8560b6ddd95f61ecc6e781fc99546001d44bc4a | import json
import zipfile
import difflib
import os
import pymysql
import re
import csv
from datetime import datetime
import boto3 #used to connect to aws servies
from io import BytesIO #used to convert file into bytes in order to unzip
import dateutil.tz
##... |
988,832 | fa19b8ca7d0dbb29b7e9c94ca3c4b3f0b16efec0 | """Contains a Node class which implements an AVL binary search tree.
Each node can be considered a binary search tree and has the usual
methods to insert, delete, and check membership of nodes. By default,
the insert and delete methods will perform self-balancing consistent
with an AVL tree. This behavior can be suppr... |
988,833 | 81d42d08bbbb637ca8a7f840033bad8871c76533 | """命令行火车票查看器
Usage:
tickets [-gdtkz] <from> <to> <date>
"""
# Options:
# -h,--help 显示帮助菜单
# -g 高铁
# -d 动车
# -t 特快
# -k 快速
# -z 直达
# Example:
# tickets 北京 上海 2016-10-10
# python tickets.py 上海 北京 2018-08-02
from docopt import docopt
f... |
988,834 | c20452250d7ec10cb767f82e23c8fcf442a1877c |
def get_url():
url = 'http://test.cwty.bet/api'
def get_header():
headers = {"Content-Type": "application/json-patch+json"}
|
988,835 | 9f7013f6b4b6f627d5b650d8249074dadf36c869 | import random
from collections import deque
from typing import List
import numpy as np
import stock_exchange
import time
from experts.obscure_expert import ObscureExpert
from framework.vote import Vote
from framework.period import Period
from framework.portfolio import Portfolio
from framework.stock_market_data import ... |
988,836 | 0fcd3ef21b6ff7bf6e91dda61b67f5d84698abcd | # Generated by Django 2.1.7 on 2019-08-15 05:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CDapp', '0003_auto_20190813_1306'),
]
operations = [
migrations.RenameField(
model_name='class',
old_name='universty... |
988,837 | 6aa0bda42314db86e6f211506da270e278e6ee2e | import unittest
from hstest.check_result import CheckResult
from hstest.dynamic.dynamic_test import dynamic_test
from hstest.stage_test import StageTest
class TestFeedback(StageTest):
@dynamic_test(feedback="feedback 1")
def test(self):
return CheckResult.wrong("feedback 2")
class Test(unittest.Tes... |
988,838 | 88834e74f10374e3ef5ec5a28104d0dc3553690a | from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.ui import WebDriverWait as WD
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import Ch... |
988,839 | d94cd0faa8cadc2b3e9fcf9eec5ea9c8a68b13fa | #!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Fri Sep 11 14:50:34 2015
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio impor... |
988,840 | af43a4fad5c93c8f89661b245f84a9b669804118 | import numpy as np
import pylab as pl
from get_data import import_data_to_denoise, reconstruct_data
linear_0, non_linear_0, sigma, type_of_data, time_para, test_0, linear, non_linear, method, test = import_data_to_denoise()
to_test = 6 #78 #6 #151
i = 2
i_0 = np.where(test_0 == to_test)[0][0]
index = np.where(test ... |
988,841 | 67c8d428439de5e2fe43c9c7ea1ce2cec2895c18 | from pyscf import gto, scf, grad
import time
import numpy as np
import scipy
from zeroth_order_ghf import rhf_to_ghf, get_p0, get_hcore0, get_pi0, get_f0,\
get_e0_nuc, get_e0_elec
def get_s1(mol, atom, coord):
r"""Calculates first order pertubation to the orbital overlap matrix
.. math::
\mathbf{S}^... |
988,842 | ad3e822a848fb09cb289c5f4a5df3359ac7a962e | '''
Membership Application Views
membership/views.py
@author Teerapat Kraisrisirikul (810Teams)
'''
from datetime import datetime
from django.contrib.auth import get_user_model
from django.utils.translation import gettext as _
from rest_framework import permissions, status, viewsets
from rest_framework.de... |
988,843 | 7017e121eb2bdbd50359befe17b1225b3bd699ae | import spacy
from collections import Counter, defaultdict
import multiprocessing as mp
import numpy as np
class WordCloud():
def __init__(self, docs, ratings):
"""Initialize word cloud
Arguments:
docs {list[str]} -- list of document strings
ratings {list[float]} -- list of... |
988,844 | 9ccb650bc1c4e2ec52e0cdb87b89d51d940c54af | TOKEN = '998969136:AAFS4NvKyHBsTjvWycKPMK4B_77oJ_MAbVY'
SAPA = " 👨🔧 Halo Perkenalkan Nama Saya Softeng Bot" |
988,845 | 7688c65d8c1a85b92f4a53a6c5cca4a8f66e75cb | import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
from app.models import User, Post, Location
from app import db
def sendpandas(filename):
varfile=filename
df = pd.read_excel('uploads/{0}'.format(varfile), sheetname='Sheet1')
print(df.columns)
print(df['Standort'][0])
... |
988,846 | 2d3819a6299bf80de2ec604921bffbc643ca2be2 | # we need pycrypto(dome)
from Crypto.Cipher import AES
import base64
with open("7.txt") as f:
raw = base64.b64decode(f.read())
key = "YELLOW SUBMARINE".encode()
cipher = AES.new(key, AES.MODE_ECB)
print(cipher.decrypt(raw).decode()) |
988,847 | 5459abc84331019d81d484c6da8b292e683a3d07 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-24 18:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... |
988,848 | 383f28a31f412b5fa46ad27394d8dabbad8ea60a | #+
# Copyright 2015 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and t... |
988,849 | 581891dda6da12af1e30f47361dc08cb27459307 | import random
import torch
from .functions import one_hot
class Vocabulary:
def __init__(self, text):
self.__chars = sorted(list(set(text)))
self.size = len(self.__chars)
# char to index and index to char maps
self.char2ix = {ch: i for i, ch in enumerate(self.__chars)}
s... |
988,850 | c27ac5572f9c82fd7528f589469c103acf83d662 | loop_variable = 0
while loop_variable != 1:
age = int(input("How old are you? "))
if age >= 18:
print("You are an adult.")
loop_variable = 1
elif age < 0:
print("Invalid Choice.")
else:
print("You are a child.")
loop_variable = 1
|
988,851 | 86a57a1833a653f1a01b1cc9a84bfb7fc4656d9e | a = ["x"]
b = ["y"]
start = [1]
k=0
pow = int(input("Enter power: "))
print("(x + y)^" +str(pow))
for i in range(pow):
#print("\n")
binomial = []
binomial.append(1)
for i in range(0,len(start)-1):
binomial.append(start[i]+start[i+1])
binomial.append(1)
start = binomial
for j in range(pow... |
988,852 | 3a9ccb5b7780e5788a90cfcf805b02c14ace08e8 | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
import donkey
INPUTS_SIZE = 2 + donkey.ANGLES_WINDOW
class Policy(nn.Module):
def __init__(self, config):
super(Policy, self).__init__()
self.hidden_size = c... |
988,853 | c3a239437f1b2b7944f10bb6aa7a971735c324b3 | from .utils import *
from .api_resource import APIResource
|
988,854 | f9f8339954b62934308fbe79dc85786bf145f603 | from django.urls import path
from . import views
from django.contrib.auth.views import LoginView
urlpatterns = [
path('alumniLogin/', LoginView.as_view(), name="login_"),
path('', views.home_view, name="home"),
path('Login/Signup/', views.register),
path('alumniDetails/', views.info_input),
path('d... |
988,855 | eb69b0ab455868a8d82ee72f934fea69202a78a1 | import pathlib
import ecole
SOURCE_DIR = pathlib.Path(__file__).parent.parent.parent.resolve()
DATA_DIR = SOURCE_DIR / "vendor/ecole/libecole/tests/data"
def get_model():
"""Return a Model object with a valid problem."""
model = ecole.scip.Model.from_file(str(DATA_DIR / "bppc8-02.mps"))
model.disable_c... |
988,856 | ce192056fb2ebb67d1e6af96db8de33ae8aa194b | from PyObjCTools.TestSupport import *
from WebKit import *
class TestWKOpenPanelParameters (TestCase):
@onlyOn64Bit
@min_os_level('10.12')
def testMethods10_12(self):
self.assertResultIsBOOL(WKOpenPanelParameters.allowsMultipleSelection)
@onlyOn64Bit
@min_os_level('10.13.4')
def testM... |
988,857 | e460c00d0fdcfcd6c0a519da34024a3f22beae3b | __author__ = 'ProvanAlex'
import sys
import os
import configparser
import pygame as pg
from pygame.locals import *
screensize = (800, 800)
directdict = {pg.K_LEFT: (-1, 0),
pg.K_RIGHT: (1, 0),
pg.K_UP: (0, -1),
pg.K_DOWN: (0, 1)}
class Player(object):
def __init__(self, re... |
988,858 | fd62795a330d7d13f4459ae8d693c4d5279fe4c4 | import numpy as np
import Ajua_env
env = Ajua_env.AJUA()
done = False
steps = 0
agent_1 = 0
agent_2 = 0
while not done:
steps += 1
action = np.random.randint(0, 18)
state, reward, done, _ = env.step(action)
if env.current_player == 9:
agent_2 += reward
else:
agent_1 += reward
pr... |
988,859 | bd935188f5d8dc00d185ec3ebd5eb2a8a05744a4 | import os
ENCODING = "utf-8" # кодировка
MSG_SIZE = 1024 # размер сообщения
WORKERS = 5
DEFAULT_SERVER_IP = ""
DEFAULT_PORT = 7777
# DEFAULT_SERVER_IP = "0.0.0.0"
# DEFAULT_PORT = 7777
# База данных для хранения данных сервера:
SERVER_DATABASE = "sqlite:///server/db/server_db.sqlite3"
BASE_DIR = os.path.dirname(o... |
988,860 | a62f2235aa81b84b2656a065e179eb158155a175 |
import open_fortran_parser
from path import Path
import collections.abc
import pathlib
import re
import textwrap
import typing as t
import itertools
from pycropml.transpiler.pseudo_tree import Node
import logging
import typed_ast
import typed_ast.ast3 as ty
import ast
import xml.etree.ElementTree as ET
import horast
i... |
988,861 | 6569ca20d80a05f564ebc848be03b27a8d312bdf | print("I hate this class")
print("I do too!")
print("ok")
|
988,862 | 14acfa82a4803112cb765488ca96507ffdfc6243 | # Generated by Django 3.2.6 on 2021-08-19 13:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('soju', '0015_delete_user'),
]
operations = [
migrations.AlterField(
model_name='beer',
name='ABV',
field... |
988,863 | 1dd33cdebcc6c4e6c1d9f93dad289a7d1aeda3f0 | from datetime import datetime as dt
from datetime import time
from matrr import models
def update_monkeys_derived_attribute():
cnt = 0;
for m in models.Monkey.objects.all():
cnt += 1
print cnt
m.populate_age_at_intox()
m.populate_drinking_category()
m.save()
def convert... |
988,864 | ac69f5312f23af0432ccf93b284a2ca3d2be1324 | import re
ID_PATTERN = re.compile("\d*:")
NODE_PATTERN = re.compile(r"(\d+):\[(.+)\]")
LEAF_PATTERN = re.compile(r"(\d+):(leaf=.+)")
EDGE_PATTERN = re.compile(r"yes=(\d+),no=(\d+),missing=(\d+)")
EDGE_PATTERN2 = re.compile(r"yes=(\d+),no=(\d+)")
def _parse_node(text):
match = NODE_PATTERN.match(text)
if mat... |
988,865 | 1e08580b8c08a6174943a22e85f09213583e2c35 | # python equivalent for while and for loops
a = 5
while a>0:
print a
a = a-1
for i in range(0, 5):
print i
|
988,866 | 2855b2009573b3b60ca336ac2de28ed8dc816fe9 | """
hi rohit
"""
sentence = input("enter any sentence:")
frequency_words = {}
words = sentence.split()
for word in words:
if word in frequency_words:
frequency_words[word] += 1
else:
frequency_words[word] = 1
print("Text : ", sentence)
for word in sorted(frequency_words):
print("{:<} : {} ".... |
988,867 | efb7a661e4dabb2e6d9ef072c7f2bc9f78d7d4ce | from PIL import Image
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
import clsdefect.transforms_image_mask_label as T
from clsdefect.preprocessing.preprocessing_training import get_label
import tqdm
from clsdefect.utils import list_all_files_sorted, list_all_folders, load_obj
classes = [... |
988,868 | 403ac422badd9397741848cae2fc17f5494f18e9 | # -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='markdown-jinja',
version='1.0.0',
py_modules=['markdown_jinja'],
description='Python Markdown extension which adds Jinja2 support',
author='Józef Sokołowski',
author_email='pypi@qzb.me',
url='https://github.com/qzb/markdown-... |
988,869 | 76d654eb1a0faedab8dc18065d7f1e2665068001 | # 547. 朋友圈
# 班上有 N 名学生。其中有些人是朋友,有些则不是。他们的友谊具有是传递性。如果已知 A 是 B 的朋友,B 是 C 的朋友,那么我们可以认为 A 也是 C 的朋友。所谓的朋友圈,是指所有朋友的集合。
# 给定一个 N * N 的矩阵 M,表示班级中学生之间的朋友关系。如果M[i][j] = 1,表示已知第 i 个和 j 个学生互为朋友关系,否则为不知道。你必须输出所有学生中的已知的朋友圈总数。
# 示例 1:
# 输入:
# [[1,1,0],
# [1,1,0],
# [0,0,1]]
# 输出:2
# 解释:已知学生 0 和学生 1 互为朋友,他们在一个朋友圈。
# 第2个学生自己在一个朋友圈。所... |
988,870 | dbfbcff0bde04912d921db80ef1d9d2c661bb1f1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from uline_risk.handlers.baseHandlers import RESTfulHandler
from uline_risk.model.uline.info import MchBalance
from uline_risk.utils import db
class GetAllFreezeMerchant(RESTfulHandler):
def prepare(self):
pass
def get(self):
freeze_mch_ids = []... |
988,871 | 35effdc439d1b4072a819df621c8f2e8f9403f96 | import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
step = 0
MAX = 0
Threshold = 32
MAX_LENGTH = 256
ff = open("target_label.txt",'w')
for filename in os.listdir('image_1000/'): #'/home/h/a/hanlins/Desktop/OCR/image_1000/'):
#for i in range(1):
# filename = "TB1... |
988,872 | 5a1d704effc959144d752bcc13425fbd102cfa21 | from aerolinea import Aerolinea
from destino import Destino
from terminal import Terminal
from avion import Avion
from horario import Horario
from boleto import Boleto
'''Casos prueba:
##PRUEBAS##
>>>
h1 = Horario("12:30 PM")#crea un horario
d1 = Destino("Hawaii", 1500)#crea un destino con costo base
t1 = Te... |
988,873 | eb965643d9c31e48313dd5e916a07ca77859599e | """
http://openbookproject.net/thinkcs/python/english3e/classes_and_objects_II.html
"""
from Point import Point
class Rectangle:
"""
A class to manufacture rectangle objects
"""
def __init__(self, posn : Point, w : float, h: float):
"""
Initialize rectangle at posn, with width w, height... |
988,874 | 0dc52ee9e1fa12805d6d55bc272339883aa66baa | for i in range(10):
print(i)
print("Se acabo el programa")
#cont = 0
#while cont < 10:
# print(cont)
# cont = cont + 1
#print("Se acabo el programa") |
988,875 | 380cc7bf82280053b71ddcd3b6076f303863653f | import matplotlib.pyplot as plt
import deltametrics as dm
golfcube = dm.sample_data.golf()
fig, ax = plt.subplots(figsize=(8, 2))
golfcube.register_section('demo', dm.section.StrikeSection(distance_idx=5))
golfcube.sections['demo'].show('velocity')
|
988,876 | 35ca4f419cb7e9ee3c8ded13d9e64524122dd58d | #!/usr/bin/python3
import sys
import argparse
import string
import pprint
import re
pp = pprint.PrettyPrinter()
# Parse command-line arguments
parser = argparse.ArgumentParser()
parser.add_argument("input", help="Input file")
args = parser.parse_args()
def pretty_marbles():
output = []
for i in range(len(ma... |
988,877 | f594d9fd9bd276fdb49b1b4993576fb61cd6bf21 | class Theme:
text_bg_color;
text_fg_color;
pass
class DarkTheme(Theme):
pass
class LightTheme(Theme):
pass
class BlueTheme(Theme):
pass
|
988,878 | 5da8260474b54fee20dcfd1441d23d204abcb0a2 | import json
import urllib.request
from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream
from bs4 import BeautifulSoup
import requests
from pytrends.request import TrendReq
import datetime
from pushbullet.pushbullet import PushBullet
from tokens import A_S, A_T, C_K, C_S, API_KEY
now = datetime.datetime.... |
988,879 | f8a10c0c0ee33f999b8e4a1191e9944609d0e235 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============================================================================
# \file merge-label.py
# \author chenghuige
# \date 2017-11-24 15:52:00.828515
# \Description
# ===========================================================... |
988,880 | 95ada1c188ddddb40673ed811f75308cd047fd49 | class Solution(object):
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
numDic=['','','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']
if len(digits) == 0:
return []
res=['']
for i in digits:
... |
988,881 | 72fcc652a0214aa82e432edd6df12af603e71854 | from builtins import any
import mysql.connector
ny_restaurants = []
# Populate database with array of dictionaries #
mydb = mysql.connector.connect(
host = 'localhost',
user = 'root',
passwd = 'i18111958',
database = 'myce_yelp'
)
mycursor = mydb.cursor()
mycursor.execute("DROP TABLE ... |
988,882 | dcb577eb1d7f97665e727184427249797c818998 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# created at : `(format-time-string "%F %T")`
# author : `user-full-name` <`user-mail-address`>
#
|
988,883 | b24c39ce9073b878da648a3cad8dbfa641d242d1 | """
@author Mayank Mittal
@email mittalma@ethz.ch
@brief Defines helper functions to create primitives and set their properties
into the stage programmatically.
"""
from typing import Tuple, Optional
from pxr import Usd, UsdGeom, UsdShade, Sdf, Semantics, PhysicsSchema
def create_prim(sta... |
988,884 | 38fcb99e5569104487b62c7d6792595edb148bc7 | """
@auther Hyunwoong
@since 7/5/2020
@see https://github.com/gusdnd852
""" |
988,885 | 8add5d342e48e8ae9b8b482ca824d6015c95a161 | from sqlalchemy import Column, Integer, ForeignKey, String
from sqlalchemy.orm import relationship
from database import Base, engine
class PersonModel(Base):
__tablename__ = 'person'
person_id = Column(Integer, primary_key=True)
username = Column('username', String)
fullname = Column('fullname', String... |
988,886 | 348f3488ab9934243983e0c5e40e9ca9043f0e06 |
def divisao(x, y):
try:
resultado = x / y
except ZeroDivisionError:
print("Divisão por zero")
else:
print(f"o resultado é {resultado}")
finally:
print("executando o finally")
if __name__ == "__main__":
divisao(2, 1)
divisao(2, 0)
divisao('2', '1') |
988,887 | 532f8bfe39d5c2037ea98eeccc4c6aa46bd6ed73 | import pytest
from LongestSubstring import Solution
def test_abcabcbb():
s = Solution()
input = 'abcabcbb'
expect = 3
result = s.lengthOfLongestSubstring(input)
assert expect == result
def test_bbbbb():
s = Solution()
input = 'bbbbb'
expect = 1
result = s.lengthOfLongestSubstring(... |
988,888 | 374fdb5d6a78e73188ff275dee2cfd0c1ba91629 | def rev(a, b = 0):
if a == 0:
return b
else:
return rev(a / 10, b * 10 + a % 10)
print rev(2132353)
|
988,889 | 547bf6a783f05e9380d2347a9137f5d5c8befc63 | import unittest
from UAM_team_optimization.components.Aero.cdi_tail_comp import CDiTailComp
from openmdao.api import Problem
from openmdao.utils.assert_utils import assert_check_partials
class TestCDiTailComp(unittest.TestCase):
def test_component_and_derivatives(self):
prob = Problem()
prob.mo... |
988,890 | 7a49e14b64dbe3b093909b68d0a648f3f2af43bd |
# linked list
empty = 'empty'
def is_link(s):
"""s is a linked list if it is empty or a (first, rest) pair."""
return s == empty or (len(s) == 2 and is_link(s[1]))
def link(first, rest):
"""
Construct a linked list from its first element and the rest.
"""
assert is_link(rest), "rest must be... |
988,891 | 2661732c83055e71537b08b5e0c28b059264d92b | from django.test import TestCase
from polls.models import User
from polls.services.user_service import UserService
class UserServiceTestCase(TestCase):
@classmethod
def setUpClass(cls):
UserService().register_new_user('Test user','1234','test@gmail.com','country name','')
def setUp(self):
... |
988,892 | 9b8dea18cd12deea612c773e8f919b4b6ccbf3b9 | #!/usr/bin/env python
import time
from random import randint
import getopt
import sys
import os
import glob
import re
import tweepy
from keys import keys
def return_cred():
CONSUMER_KEY = keys['consumer_key']
CONSUMER_SECRET = keys['consumer_secret']
ACCESS_TOKEN = keys['access_token']
ACCESS_TOKEN_... |
988,893 | 4ab523622f503ed03e441e46ae726d7a3b33f372 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class AbstractNorm(object):
def _norm(self, x):
return torch.norm(x, p=1 if self.l1 else 2, dim=1)
class AbstractDropout(object):
def _dropout(self, x):
return F.dropout(x, p=self.dropout, training=self.tra... |
988,894 | 9c151c5f4b644c2c6a75a65f2daf7d2447f15528 | def is_alpha(sym):
return 'a' <= sym <= 'z'
def is_digit(sym):
return '0' <= sym <= '9'
def is_allowed_special(sym):
return sym == ' ' or sym == "\""
|
988,895 | 78081b341b70388eed60c45df86914fd1c275727 | # 闭包与装饰器
def make_power(y):
def fx(arg):
return arg ** y
return fx
pow2 = make_power(2)
print('3**2 = ', pow2(3))
pow3 = make_power(3)
print('3**3 = ', pow3(3))
# 用参数返回响应数学函数的实例
# y = a*x**2 + b*x + c
def make_function(a, b, c):
def fx(x):
return a * x**2 + b * x + c
return fx
... |
988,896 | bcb9d770ce29b33c612a7e46bc6cb792e358608e | import base64
import binascii
from tools import cryptotools
import requests
from requests.auth import HTTPBasicAuth
from secret.credentials import Credentials
def main():
level = 18
level_about = 'In this level you can see a sourcecode of vulnerable website, which is quite handy. We can see \n' \
... |
988,897 | 4963319159895d14aeaa9977910b8487a8a00c2e | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from django.contrib.auth import get_user_model
from impact.v1.views.base_history_view import BaseHistoryView
from impact.v1.events import (
UserBecameConfirmedJudgeEvent,
UserBecameConfirmedMentorEvent,
UserBecameDesiredJudgeEvent,
UserBecameDesire... |
988,898 | edf27e88fe09bbae43071d84c97a2fd13e219aa1 | import StringIO
import urllib
from django.http import HttpResponse
import PIL
import PIL.ImageDraw as imdraw
# import PIL.ImageEnhance as imenhance
# import PIL.ImageFont as imfont
def reduce_opacity(im, opacity):
"""Returns an image with reduced opacity."""
assert opacity >= 0 and opacity <= 1
if im.m... |
988,899 | 8d5b356f09564c78a24994a5dd9ac4004fdc641a | __author__ = 'Administrator'
#coding:utf-8
from parseIni import *
from parseIniFile import *
def test0():
# 一般写法
# f = open("0.ini","rb")
# print getValue(f,"global","port");
# f.close()
# 自动管理close,try catch [with open as 从python2.5引入(需要通过 from __future__ import with_statement 导入后才可以使用),从 2.6 版本... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.