index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
995,100 | fa16f6836e7ae9a359d66d5070d6bdf6d203d3ca | from bs4 import BeautifulSoup
import requests
import os
port = input("Socks listener port: ") # Port that Tor Socks listener working on
direactory = input("Please specify dirlectory: ") # Directory to dump website contents
proxies = {
'http': 'socks5h://127.0.0.1:'+ port,
'https': 'socks5h://127.0.0... |
995,101 | 912d31b57545c890e7960d04456eaf232601cfb7 | import unittest
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import src
class DatabaseClassTests(unittest.TestCase):
def test_vault_connection_error(self):
#TODO give some "valid" url
self.fail()
def test_vault_non_existent_database(s... |
995,102 | 3e25d2c8c2b494636ac71ea1212bfd83930026f1 | # Edit and move fits
# A module to move and edit the raw FITS files as the become available from the ICS
import numpy as np
import pyfits
import os
import datetime
import re
def movefits(CurrentFileName,DayNumber,current_obs_ra,current_obs_dec,current_obs_az,current_obs_alt,current_epoch):
NEWCARDS = ['R... |
995,103 | e52de144ba1e2ec9e280b6234c4fdcfaf819af67 | """
Fonction recherche, prenant en paramètre un tableau non vide tab (type list) d'entiers et un entier n,
et qui renvoie l'indice de la dernière occurrence de l'élément cherché.
Si l'élément n'est pas présent, la fonction renvoie la longueur du tableau.
"""
def recherche(tab, element):
tmp = ""
if t... |
995,104 | cb99f609054bdeb014c9fcdf8d0f4f6721562d4e | """
========================================================
TEST THE PERCEPTRON CLASSIFIER IN MORE THAN 2 DIMENSIONS
========================================================
"""
#create labels associated with X
def get_y(X):
#create the classification labels
y = np.zeros(N)
#choose condition for... |
995,105 | c70e3def3edb71cfa46ba929b26e02eaf0cc225d | # coding=utf-8
import datetime
__author__ = 'xbw'
from sqlalchemy import Column, String, create_engine, Integer,DateTime, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.ext.declarative import declarative_base
# 创建对象的基类:
Base = declarative_base()
class Admin(Base):
# 表的名字:
_... |
995,106 | 68900d819d08b08bfa6ad81a8dd4159ec327b5e0 | # Copyright 2019 TWO SIGMA OPEN SOURCE, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
995,107 | 56211561b11ce33e734625c466e48d7fb3bf3537 | import fnmatch
def deployment(change, *options):
message = change["message"]
deploy_strings = ["*PRODUCTION*",
"*STAGING*",
"deploy:"
]
if any(s in message for s in deploy_strings):
change["tags"] = ["deployment"]
return cha... |
995,108 | 6b340f367e2ecf8c3e8778fda38ea01a0499780d | ''' Convert Sorted Array to Binary Search Tree
Easy
1046
104
Favorite
Share
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ... |
995,109 | 3e9af7aa69391118ec3e7484bde9dc4f6f8a1ea2 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 1.0.1 on Sat Apr 3 16:27:01 2021
#
# (C)By BigSam
import wx
from wx.core import DIRP_DIR_MUST_EXIST
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
import os
import shutil
from PIL import Image
from os.pat... |
995,110 | ce8a28431d8f6cf56d46573e28e87d44a29b67b2 | # Write a program that displays a table of the Celsius temperatures 0 through 20
# and their Fahrenheit equivalents. The formula for converting a temperature
# from Celsius to Fahrenheit is F = (9/5)C + 32
# Your program must use a loop to display the table
print('Celsius\tFahrenheit')
print('-------------------... |
995,111 | e83ce18439b38731a41137098bdb170ef86c7979 | """Plot clustered data.
"""
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from ad_sensitivity_analysis.plot.aux_functions import get_save_name
from ad_sensitivity_analysis.plot.latexify import parse_word
from ad_sensitivity_analysis.plot.latexify import ... |
995,112 | f6f689ce823d72e1c215479ddf3dc69ed23b498a | __all__ = ['factor_db']
from yearonedb import factor_db
|
995,113 | e0d5c1fd5928328d76c5336b1fd73c733cd9ef59 | # coding: utf-8
import lglass.rpsl
import lglass.database.base
import urllib.parse
import netaddr
@lglass.database.base.register("cidr")
class CIDRDatabase(lglass.database.base.Database):
""" Extended database type which is a layer between the user and another
database. It performs CIDR matching and AS range match... |
995,114 | 7578334934392e592229137cca64aee2cebbc3f4 | class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
def cal(n):
ans = 0
while n != 0:
ans += (n % 10)**2
n //= 10
return ans
dic = {}
while n not in dic:
... |
995,115 | fbde879416a003dfa44105eeae96246114714fc6 | # Generated by Django 2.0.1 on 2018-01-31 10:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gate', '0005_auto_20180131_0959'),
]
operations = [
migrations.AlterField(
model_name='qrcode',
name='qrcode_require... |
995,116 | a64225c6cd3ebf71763cdfcc934f5acb95da6670 | # -*- coding: utf-8 -*-
# Part of Inceptus ERP Solutions Pvt.ltd.
# See LICENSE file for copyright and licensing details.
from odoo import models, fields, api, _, SUPERUSER_ID
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
import time
class POSConfig(models.Model):
_n... |
995,117 | 28419c4eca5138553f75660ef80f4d8044ab82b7 | # This test requires CPython3.5
try:
b'' % ()
except TypeError:
print("SKIP")
raise SystemExit
print(b"%%" % ())
print(b"=%d=" % 1)
print(b"=%d=%d=" % (1, 2))
print(b"=%s=" % b"str")
print(b"=%r=" % b"str")
|
995,118 | 1c7603d98cc162f4efe64322361cd31bc557a4b8 | from __future__ import print_function
from LinearTransform import LinearTransform
from omg import *
import sys
from PIL import Image, ImageDraw
def drawmap(wad, width, format):
xsize = width - 8
i = 77
for level in wad.maps:
edit = MapEditor(wad.maps[level])
xmin = ymin = 32767
x... |
995,119 | f155daba149e34aab14e1eb39bfcb5002f7a9e13 | import cx_Oracle
con = cx_Oracle.connect("ankit123/ankit")
cur = con.cursor()
print("Select from the below options ")
print("---------------------------------------- ")
print("Press 1 for Max Likes")
print("Press 2 for Min Likes")
print("Press 3 for Music Pictures")
print("Press 4 for Popular Tag")
print("Press 5 for M... |
995,120 | b2cad34733fff19ed031518ba5002f689e41ac26 | import pytest
@pytest.fixture
def supply_AA_BB_CC():
aa=25
bb=35
cc=45
return [aa,bb,cc]
@pytest.fixture
def supply_url():
return "https://reqres.in/api"
|
995,121 | 668abf1dea6b7906f8ceb3d6ab8d8cd6050f8966 | # Script to rename sound files according to the era the tech is in and to the name we actually
# see when ingame. FUTURE_TECH -> 14_simulation_awareness, etc
# NOTE: THIS ASSUMES THAT VANILLA .MP3 FILES ARE THOSE FOLLOWING THE "TECH_TECHNAME" FORMAT
# It won't catch techs that are pointed to a nonexistent mp3 file fol... |
995,122 | b2d1fe688129941b7c95d44e4fa8582d38fefe34 | import argparse
import os
import subprocess
from bs4 import BeautifulSoup
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert notebook to hugo mardown')
parser.add_argument('--input_nb', action='store', help='path to notebook')
parser.add_argument('--hugo_dir', action='stor... |
995,123 | 98fc5dceda491c93d8248f56bf1deb37dd4a8f97 | #!/usr/bin/python3
import os
import pickle
import nltk
import numpy as np
import sys
sys.setrecursionlimit(1000000) #设置为一百万,否则dump数据的时候显示递归层次过多!
# 切分数据集
from sklearn.cross_validation import train_test_split
from keras.utils import np_utils
from keras.models import Sequential,Graph
from keras.layers.embeddings impor... |
995,124 | 92fbb5c2b5fc0ee36ee11be06b6ab70ea53f94a1 | # Generated by Django 2.1.7 on 2019-02-25 23:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0011_eventannouncement'),
]
operations = [
migrations.AlterField(
model_name='eventan... |
995,125 | 280b999768614d423a07eba7606a0ebce23ff718 | # -*- coding: utf-8 -*-
from odoo import models, fields
class AccountPaymentOrder(models.Model):
_inherit = 'account.payment.order'
state = fields.Selection(
[
('draft', 'Draft'),
('open', 'Confirmed'),
('generated', 'File Generated'),
('uploaded', 'Fi... |
995,126 | 8dbde580be3445dfd71fbfc5e62ba01411a2be25 | #!/usr/bin/env python3
import requests
import json
import urllib
papers_path = 'data/papers.json'
api_endpoint = 'http://ieeexploreapi.ieee.org/api/v1/search/articles'
api_key = '2quujqxvyzwpzztgkud8w2x6'
query_string = urllib.parse.urlencode({
'apikey': api_key,
'format': 'json',
'content_type': 'Conferences... |
995,127 | a46e83fcbeb6933a448ad71d661a96d4dd74e49c | from bs4 import BeautifulSoup
import urllib2
import re
from newspaper import Article
import csv
import articleDateExtractor
from geotext import GeoText
press=["https://www.ndtv.com/","http://www.news18.com/"]#"http://timesofindia.indiatimes.com/",
#press=["http://www.news18.com/"]
regexList = [r'www.news18.com/news',r'... |
995,128 | 2576ceba3c37a13394e94ec4b739f72147d8fc88 | # 读取Excel需求通报文件
import os
import sys
import getopt
import xlrd
from datetime import date,datetime
from pandas import DataFrame,Series
import string
DATA_DIR = 'd:/Python/WXRobot/data/' # Excel数据文件存放目录
DATA_FILE = 'BI需求看板.xlsx' # Excel数据文件存放目录
# SHEET1 = '重点关注临时需求(领导关注、集团上报需求、KPI需求)'
def read_excel():
# 打开文件... |
995,129 | 2f8d6bdd2dd4673e74ca37aa4609cd9340e5319c | from direct.distributed.DistributedObject import DistributedObject
from direct.showbase.MessengerGlobal import messenger
class Message(DistributedObject):
def __init__(self, clientRepo):
DistributedObject.__init__(self, clientRepo)
def sendText(self, messageText):
"""Function which is caled fo... |
995,130 | 95dbbfa3d902ccecf3cbaa4b9959f3e4150b1cb0 | '''
项目任务调度总成
1.日AUM 每日
2.生命周期 每季度
3.AUM总和 每月???
4.DEBT负债总和 每月???
5.客户价值 每半年
'''
from product.jj_analysis import DataAnalysis
from product.band_card import DataHandler
import datetime
from apscheduler.schedulers.background import BlockingScheduler
import logging
import logging.config
try:
from mys... |
995,131 | e458e2ffbb842d7491d53b4e24fcc46bd1794b97 | #====================================================================
# Took extracts from
# https://code.activestate.com/recipes/119466-dijkstras-algorithm-for-shortest-paths/
# for Dijkstra()
#====================================================================
#
# functionsD.py : functions used in part 4
#
import... |
995,132 | 0e16267738e820973832ea4de236f19c61f38c16 | #!/usr/bin/env python3
from pathlib import Path
class ThreadWriter(object):
"""Custom class to write data to a file accross threads"""
def __init__(self, file_: str, out_dir: str):
"""Initialize a ThreadWriter instance.
Arguments:
file_: name of file to write to
out... |
995,133 | cda7cd48366580b9ec94c46f9b65e3e54ed3717b | # Generated by Django 2.1.4 on 2018-12-26 01:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0002_auto_20181225_1720'),
]
operations = [
migrations.AddField(
model_name='bookins... |
995,134 | e9198b4109dee93ea432c9944396dbed118a5c8d | from mmsystem import Goldbeter_1995
from ssystem import SSystem
from sigmoidal import Sigmoidal
import matplotlib.pyplot as plt
import numpy as np
mm_model = Goldbeter_1995()
steps = 50
delta = 0.01
#states, velocities = mm_model.run(state=initial_state, velocity=initial_velocity, delta=0.1, steps=3)
#for i in range(... |
995,135 | 405807956c069399963b39df28bdf44e2d341b8d | class ActiveCalls:
def __init__(self, pytgcalls):
self.pytgcalls = pytgcalls
# noinspection PyProtectedMember
@property
def active_calls(self):
return self.pytgcalls._active_calls
|
995,136 | c25b6126e07372c583e2d7e7e827edcced157cc7 | from django import forms
from django.db import models
from django.conf import settings
from django.urls import reverse
from django.core.exceptions import ValidationError
class MultiSelectFormField(forms.MultipleChoiceField):
widget = forms.CheckboxSelectMultiple
def __init__(self, *args, **kwargs):
... |
995,137 | 3d171d177f4c025fa76f7d457e85e5ead6046836 | import os
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(ROOT_DIR, 'README.md'), 'r') as readme:
long_description = readme.read()
setup(
name='antiafk',
version='1.0.0',
description='Antiafk has been designed to utilize the py... |
995,138 | d234e7f107f018f8ae055650c85443178886baf5 | from compose import compose
from pprint import pprint
from flask import current_app as app
from commands.filter import INDEXES, query_filter_from
from utils.database import db
@compose(app.manager.option('-n',
'--name',
help='model name'),
app.manager.... |
995,139 | 371a46fe7b76704ef10fe5e6998ea7d8bad982c1 | # coding: utf-8
"""
errors.py
~~~~~~~~~
api 错误处理文件
利用内容协商机制,将html错误响应转变为json格式响应
"""
from flask import jsonify
from app.exceptions import ValidationError
from . import api
def not_found(message):
"""404无法找到"""
response = jsonify({'error': 'not found', 'message': message})
respon... |
995,140 | e6b027430f9f1134e00d63d9f85ee53209e2e87a | from django.urls import path
from . import views
urlpatterns = [
path('login', views.Login.as_view(), name='login'),
path('logout', views.Logout.as_view(), name='logout'),
path('register', views.Register.as_view(), name='register'),
path('reset-password', views.ResetPassword.as_view(), name='reset-pas... |
995,141 | 63484de04f08d4f1f4554ac029e4a8a74d05e6a8 | from os import startfile
from selenium import webdriver
import json
# Open incognito chrome session and navigate to UBC page
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--incognito')
# options.add_argument('--headless')
driver = webdriver.Chrome(executa... |
995,142 | 48611c208a67e3d6e9bd7e5f8c325ba9be472432 | import argparse
import os
from tqdm import tqdm
cmd_opt = argparse.ArgumentParser(description='Argparser')
cmd_opt.add_argument('-data_root', default=None, help='root of dataset')
cmd_opt.add_argument('-file_list', default=None, help='list of programs')
cmd_opt.add_argument('-init_model_dump', default=None, help='init... |
995,143 | 5fbcb97e7157fa8ba3608a861b4d6f8bb9202782 | from source.data import char_span_to_token_span
import unittest
class SpanTest(unittest.TestCase):
def test_from_beginning(self):
passage = "The College of Arts and Letters was established as the university's first college in 1842 with" \
" the first degrees given in 1849. The university... |
995,144 | 35552e899802a851fd4d1f4fec79606785f681cb | import requests
from geopy.geocoders import Nominatim, GoogleV3
import what3words
import json
import config
# get your key from https://developer.what3words.com/public-api
key = config.API_KEY
class Location:
def __init__(self, w1, w2,w3):
self.w1 = w1
self.w2 = w2
self.w3 = w... |
995,145 | bbad27c31b5fcca6c7cedbbe146b226ee5796839 | """
- Dynamic Programming
- TLE
"""
class Solution:
def numWays(self, words: List[str], target: str) -> int:
# c_to_match_pos example:
# a -> [0, 3],[1, 3]
# b -> [0, 1, 2, 3]
# a -> [0, 3],[1, 3]
MOD = 10 ** 9 + 7
c_to_match_pos = defaultdict(list)
... |
995,146 | 0f2636b1e6ae98e77750532f364bc9ab736c19bd | from django.conf.urls import url
from JQ import views
urlpatterns = [
url(r'^apps/$', views.AppView.as_view(), name='apps'),
url(r'^apps/(?P<pk>\d+)$', views.AppDetail.as_view() ,name='app_detail'),
url(r'^company/$', views.CompanyView.as_view(), name='company'),
url(r'^company/create/$', views.AddComp... |
995,147 | 150c072aeaf1543339466e90a5e601f009cced10 | from game.board import *
from game.player import *
from game.move import *
from game.board_drawer import *
import random
import copy
class Game():
def __init__(self, board_type, board_size, open_cells):
if board_type == 'triangular':
self.board = TriangularBoard(size=board_size, open_cells=open_cells)
else:
... |
995,148 | e1142b8379880e743b82e7b67873113f8ec634d0 | #!/usr/bin/env python3
from selenium.webdriver.common.by import By
class LoginPageLocators:
# URL
URL = "login"
# Login Form
USERNAME_FIELD = (By.NAME, "username")
PASSWORD_FIELD = (By.NAME, "password")
REMEMBER_CHECKBOX = (By.ID, "remember-me")
# Page Buttons
LOGIN_BTN = (... |
995,149 | e880131c3b11ac2b9b029314ca3157982b4b2fb4 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-23 17:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... |
995,150 | 00b9d14009754fc6ecfc9dc19338b04766e894a7 | n=int(input())
print(n//2+1)
#for 1's and 2's
|
995,151 | ed4e23f5a3fe17b2895f0ebcaa2bdf4e2b924f0b | """
Given a collection of intervals, merge all overlapping intervals.
Ex 1.
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Ex 2.
Input: [[1,4],[4,5]]
Output: [[1,5]]
Explanation: Intervals [1,4] and [4,5] are considered ... |
995,152 | d08f2764c99e634e923cd2edd307292dffcd5cec | import collections
import math
import numpy as np
import pandas as pd
from scipy.stats import entropy, skew, kurtosis
from skimage.feature import canny
from skimage.measure import regionprops
from skimage.segmentation import find_boundaries
from skimage.morphology import disk, dilation
def FeatureExtraction(Label, In... |
995,153 | 4adbb7a46fa5ca709825b41bd28a66ea99c5e1b3 |
from rest_framework import serializers
from .models import User,UserProfile,Product
from django.contrib.auth import authenticate
from django.contrib.auth.models import update_last_login
from rest_framework_jwt.settings import api_settings
class UserSerializer(serializers.ModelSerializer):
class Meta:
... |
995,154 | c9a123c50c64b27c5245387d6b69a0f89e679120 | def load(file_path):
with open(file_path, 'r') as f:
x = f.readlines()
return x |
995,155 | a9ebda76015a763d33df388e0b97ab7fd9287de1 | from django.shortcuts import render
from django.views import View
from django.shortcuts import get_object_or_404
from django.db.models import Q
from .models import University, Department, DepName, Year
from home.mixins import SidebarUnies
class UniversityPageView(SidebarUnies, View):
def get(self, request, *args... |
995,156 | 69ab1984997e7b651af103e8600b18418c2288ad | import unittest
import reservarecursos
class TestReserva(unittest.TestCase):
def test_convertir_reserves_a_ics(self):
ics_esperat = open("test1.ics", "r").read()
json = open("test1.json", "r").read().replace('\\','')
ics = reservarecursos.convertir_reserves_a_ics_per_json(json)
... |
995,157 | 71b7f42a56bd4572decb365d4c45cb26bed25040 | 3 3 1 1
3 3 2 2
3 3 3 3
3 3 4 4
3 3 5 4
3 3 6 5
3 3 7 6
3 3 8 7
3 3 9 8
3 4 1 1
3 4 2 2
3 4 3 3
3 4 4 4
3 4 5 4
3 4 6 5
3 4 7 6
3 4 8 6
3 4 9 7
3 4 10 8
3 4 11 9
3 4 12 10
3 5 1 1
3 5 2 2
3 5 3 3
3 5 4 4
3 5 5 4
3 5 6 5
3 5 7 6
3 5 8 6
3 5 9 7
3 5 10 8
3 5 11 8
3 5 12 9
3 5 13 10
3 5 1... |
995,158 | 1113ee7b6422d26dd1dbd9c13681249fdbc166e7 | from TreeLogger import TreeLogger, Mode
from TreeReciever import TreeReciever
import binary
receiver = TreeReciever()
receiver.start()
def kill():
receiver.stop()
exit()
|
995,159 | 6a3f4ca42913a6a633c198b37fd8195a10a7b2f2 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/perception/onboard/proto/lidar_component_config.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
... |
995,160 | bbc00467cecb37252040050b7efde9bacf9d118e | import sys
sys.path.append('../balderdash')
import unittest
import random
import balderdash
dg = balderdash.grafana
teamname = "teamname"
appname = "appname"
envname = "envname"
def random_metric():
name = str(random.random())
return dg.Metric(name, right_y_axis_metric_name=name)
def random_panel():
... |
995,161 | 3dee7ea2d66e7acdd6a8c78256864b07dbb3cb2b | # -*- coding: utf-8 -*-
import io
import sys
import fcntl
import struct
import termios
from .csi import *
from .text import Text, TEXT_ENCODING
from ..disposable import Disposable
__all__ = ('Console', 'ConsoleError',)
#------------------------------------------------------------------------------#
# Console ... |
995,162 | 8d33bf9ff976da738e99b14a9f9be552c7164fa1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#=======================
#### file: TestController.py ####
#=======================
import sys
import os
import nose
from nose import with_setup
import urllib2
import urllib
c_path = os.getcwd()
base_path = c_path[:c_path.rfind("backend_tests")]
sys.path.append(base_pat... |
995,163 | 7d1a4163e1652fca6b48d1305526d5fbf14e8aec | from node_reader import NodeReader
from edge_reader import EdgeReader
from intersection_reader import IntersectionReader
from printer import Printer
from shortest_path import ShortestPath
import pickle
class Grid:
"""
Builds a grid used for translating the graph into a meaningful 2D arrangement.
"""
... |
995,164 | 8295a358785e3d2b89d4b660d3bd9192d3645007 | #!/usr/local/bin/python
# Problem URL : https://www.hackerrank.com/challenges/py-set-intersection-operation/problem
# Enter your code here. Read input from STDIN. Print output to STDOUT
set_one_cnt = raw_input()
set_one = set(map(int, raw_input().strip().split()))
set_two_cnt = raw_input()
set_two = set(map(int, ... |
995,165 | 11771db48191279b7859876fc7e9a5cffefb5e4b | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# @Time: 2020-03-22 00:11
# @Project: python-basic-knowledge
# @Version: 2020.03 builder 220011
# @Author: Adam Ren
# @Email: adam_ren@sina.com
# @Github: https://github.com/ren-adam/python-basic-knowledge
# @Site: http://renpeter.com
# @File : __init__.py.py
# @Software... |
995,166 | 7c294ce321824ac5327d73627a1f132725aafa98 | #!/bin/env python
print("Hello world.") |
995,167 | 38ad6ba0dd951679f98ef640d30935718c0421ad | from __future__ import absolute_import
from random import randint
from collections import OrderedDict
from rest_framework.serializers import CharField
from django_alexa.api import fields, intent, ResponseBuilder
@intent(app="presentation")
def SoundCheck(session):
"""
---
the soundcheck
"""
messag... |
995,168 | 297707ada280ad787cb1c6680ed4967cfac258cd | import requests, json, re
from grafana_backup.commons import log_response
def health_check(grafana_url, http_get_headers, verify_ssl, client_cert, debug):
url = '{0}/api/health'.format(grafana_url)
print("grafana health: {0}".format(url))
return send_grafana_get(url, http_get_headers, verify_ssl, client_c... |
995,169 | bb49a81b061d076adc48af49c352f9ea036e643c | from ecs.core.components.gfx import GfxAnimatedSprite, GfxAnimSpriteList, GfxMultiSprite
from ecs.core.main.entity import Entity
from shmup.common.constants import SCREEN_HEIGHT, ZIDX_HUD, SCREEN_WIDTH, MAX_PLAYERS
from shmup.scripts.hudLife import HudLife
from shmup.scripts.updatescores import UpdateScores
class Hud... |
995,170 | dd78f76303c5d9faee5d2794a8dde65ab8764009 | #start
discount = 0
age = int(input("What is your age?: "))
if age >= 13 and age <=15:
discount = 30
else:
if age >=16 and age <=17:
discount = 20
else:
if age >= 50:
discount = 40
print("Your discount is %d%%" %discount)
|
995,171 | 472031d32e621a8383cd1e9131df005f4828235c | # Generated by Django 2.2.2 on 2019-07-12 20:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('media', '0007_auto_20190701_1600'),
]
operations = [
migrations.AlterModelOptions(
name='book',
options={'ordering': ['-aver... |
995,172 | 3973874d1a146edbc9c52fddbac67bf41f44d03b | # coding: utf-8
"""
Cyclos 4.11.5 API
The REST API for Cyclos 4.11.5 # noqa: E501
OpenAPI spec version: 4.11.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.token_t... |
995,173 | 193754778560189afea1d5083f0765ee581c181a | from tools import *
class Solution(object):
@print_
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
dp = [True] + [False] * len(s)
for i in range(len(s)):
for idx, w in enumerate(wordDict):
... |
995,174 | ba7a158c1929ed0fe1ead87551dea68d9dc9099d | # -*- coding: utf-8 -*-
from odoo import fields, models, tools, api
class PayrollInheritsMail(models.Model):
_inherit = 'hr.payslip'
user_id = fields.Many2one('res.users','Current User', default=lambda self: self.env.user)
# partner_id = fields.Many2one('res.partner', string='Related Partner')
f... |
995,175 | 5fbc6a411a52a4efef5114658ac45885c135983d |
# Case01_哪一個問題不適合用資料科學解決?
print("挑選 Mr./Ms. Right")
# Case02_以你的角度來分析,為什麼這樣的問題,較不適合用資料來解決?
print("個性/原生家庭/淺力無法使用演算法或模型來套用") |
995,176 | 9d006c7e3651abf0130f138b12998ddb363de558 | class Vehicle:
tag: ''
chassis_no = ''
def turn_on_air(self):
print('turn on air')
class Car(Vehicle):
color = ''
class Pickup(Vehicle):
color = ''
class Van(Vehicle):
color = ''
class Estate_Car(Vehicle):
color = ''
car1 = Car()
car1.turn_on_air()
pickup1 = Pickup... |
995,177 | 7e7bc02214075202a99ea8042e8d3454289afc85 | #!/usr/bin/python
from flup.server.fcgi import WSGIServer
def application(environ, start_response):
content = "Hello world"
headers = [('Content-Type', 'text/plain"', 'Content-Length', str(len(content)))]
start_response('200 OK', headers)
return content
def main():
options = { 'bindAddress': '/v... |
995,178 | c4a1de0a279f2d245455d39b99542fb577f1a398 | from flask import Flask
app = Flask(__name__)
@app.route('/f/<celsius>')
def f(celsius=""):
return int(celsius) * 9 / 5 + 32
if __name__ == '__main__':
app.run()
|
995,179 | 1a3fe2ee4139337523dd57e453ea71fd4dd50c3d | from django.shortcuts import render
from .models import Service
from .forms import ServiceForm, OfferForm
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.shortcuts import render, get_object_or_404
from djang... |
995,180 | 3c6557bfeab841168b6d8d88ad0900e09b8a4240 | from .PlayerInfo import PlayerInfo
from .Classes import Time, AccountInformationMetaData, PromotionChannel
from .utils import Requests
from .Twocaptcha import TwoCaptcha
class PlayerAuth:
def __init__(self, request: Requests):
self.request = request
"""
Represents a authenticated User.
... |
995,181 | f7fdeb13c5930f4319878c8e8e2d6de914acf357 | from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
process = CrawlerProcess(get_project_settings())#to get setting instance
#passing
process.crawl('ht')
process.crawl('th')
process.crawl('toi')
process.start() # the script will block here until the crawling is finished |
995,182 | 2016625df2865d4c66a99960f9c0b1434c04157e | """
.. currentmodule:: compas_fab.backends.interfaces
This package defines the interfaces required to integrate backends into
the simulation, planning and execution pipeline of COMPAS FAB.
Client interfaces
=================
.. autosummary::
:toctree: generated/
:nosignatures:
ClientInterface
Planne... |
995,183 | 305724a03d732144bf69697e812a2ecf16314ef5 | from django.contrib import admin
from .models import User, Listing, Bid, Comment
class ListingAdmin(admin.ModelAdmin):
filter_horizontal=("watchers",)
# Register your models here.
admin.site.register(User)
admin.site.register(Listing, ListingAdmin)
admin.site.register(Bid)
admin.site.register(Comment)
|
995,184 | cb6a07101d2ff58ecaba4ab3a229557185757b0d | """This script will get GPS coordinates and upload sensor data by MQTT."""
# !/usr/bin/python
# -*- coding: utf-8 -*-
# written by Freeman Lee
# Version 0.1.0 @ 2017.8.11
# License: GPL 2.0
import serial
import time
import datetime
import threading
import os
import json
import csv
import collections
import syslog
impor... |
995,185 | 8d28986aae1f34678e8be9816642c72c76677c77 | #!/usr/bin/env python
import unittest
import time
import os
from os.path import join, exists
from tests import TestCase, FILES_DIR
from modipyd.monitor import Event, Monitor
class TestSimpleMonitor(TestCase):
def setUp(self):
self.monitor = Monitor(join(FILES_DIR, 'cycles'), [FILES_DIR])
def test_i... |
995,186 | 4f73f6eb0e6863d36113c108004e1957802967b7 | from django.urls import path
from . import views
urlpatterns = [
path("", views.EntryListView.as_view(), name="entry_list"),
path("unos/<int:pk>", views.EntryDetailView.as_view(), name="entry_detail"),
path("dodaj/", views.EntryCreateView.as_view(), name="entry_create"),
path("unos/<int:pk>/izmeni", views.EntryUpd... |
995,187 | ccb7b6a38ff7c45b181e82586cb879e48772f598 | #!/usr/bin/python3
def fizzbuzz():
for i in range(1, 101):
th = i % 3 == 0
fv = i % 5 == 0
ftn = i % 15 == 0
if ftn:
rep = "FizzBuzz "
elif th:
rep = "Fizz "
elif fv:
rep = "Buzz "
else:
rep = str(i) + " "
... |
995,188 | ca39c7bc8e9274fbeb344120f0baa710460e6276 | import os
import sys
import json
import subprocess
# Step 1: Build the project from scratch
subprocess.run(["./scripts/build.sh"])
# Step 2: get file sizes for various distributed files
files = [
'./dist/federalist.st',
'./dist/stork.wasm',
'./dist/stork.js'
]
sizes = dict([(file.split('./dist/')[1], flo... |
995,189 | b25c54a9ca69e2f4fa2ad7199934342875180b2a | from __future__ import print_function
import sys
import os
# hacky input func to handle Python 2
if sys.version_info[0] < 3:
from compat import input
# keep the clutter down
def clear_term():
os.system('cls' if os.name == 'nt' else 'clear')
# grab email/phone, pwd, group id
def get_data():
data={}
... |
995,190 | b148c60e655d98526ed0241c68d0ddefef8ee501 | from pycricbuzz import Cricbuzz
import json
c = Cricbuzz()
matches = c.matches()
print(json.dumps(matches,indent=4))
input('does it usefull') |
995,191 | ae7407073b11c74948370cd0324477d79ab1dfb0 | """
Helper for getting data from redis
Debug redis calls with:
::
export DEBUG_REDIS=1
# to show debug, trace logging please export ``SHARED_LOG_CFG``
# to a debug logger json file. To turn on debugging for this
# library, you can export this variable to the repo's
# included file with the comma... |
995,192 | e5bf8cd272118185e73b4bd4f32ac4629ca2f278 | import gl
import sys
print(sys.version)
print(gl.version())
import os
#sys.path.append(['C:\\Users\\Enzon\\Documents\\Projects\\MEP\\mep-scripts', 'C:\\Program Files\\JetBrains\\PyCharm 2020.1.2\\plugins\\python\\helpers\\pydev', 'C:\\Users\\Enzon\\Documents\\Projects\\MEP\\mep-scripts', 'C:\\Program Files\\JetB... |
995,193 | 6b885e9771cd143904c432dfd25b19f0e1d49f2a | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements base classes for forecasting in sktime."""
__all__ = [
"ForecastingHorizon",
"BaseForecaster",
]
from sktime.forecasting.base._base import BaseForecaster
from sktime.forecasting.base._fh import For... |
995,194 | e4aadbcc64168d15375ba8ab24154a8860058d5c | #-----------------------------------
# 字符串格式设置 使用 % (百分号)
#-----------------------------------
str = '%s是一个充满活力的国家' % '中国'
print(str)
str = '编号: %04d 今日营收: %.2f' % (32, 15.8)
print(str)
|
995,195 | 88903d5d2e86c3804d013213d402bbb1e4078cf6 | #/usr/bin/python2.7
import pygame
from pygame.locals import *
import time
import sys
import pgbutton
import datetime
import GIFImage
import os
import ptext
from sense_hat import SenseHat
import forecastio
import math
api_key = "3c8457364063f406ccc3ce8e71861dc9"
lat = "-37.907910"
lng = "145.020583"
forecast = forec... |
995,196 | 75144fd6b4374c46cfca1390812c40a2fd67b5a1 | COL_FIN_POS = 'Fin Pos'
COL_CAR_ID = 'Car ID'
COL_CAR = 'Car'
COL_CAR_CLASS_ID = 'Car Class ID'
COL_CAR_CLASS = 'Car Class'
COL_TEAM_ID = 'Team ID'
COL_CUST_ID = 'Cust ID'
COL_NAME = 'Name'
COL_START_POS = 'Start Pos'
COL_CAR_NUM = 'Car #'
COL_OUT_ID = 'Out ID'
COL_OUT = 'Out'
COL_INTERVAL = 'Interval'
COL_LAPS_LED = '... |
995,197 | 8a732ae31333c2337473a5f833c2777770ecaf88 | import asyncio
import websockets
from motion_sensor import MoSensor
import random
import json
ROOM_NAME = 'JET'
sensor = MoSensor()
sensor.start()
status = 'no movement'
async def room_status(websocket, path):
# sensor.start()
status = 'no movement'
while True:
past_status = status
status = ... |
995,198 | 315f1c41e9dad0c66b67be13bcd5e36fee70c6b7 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from .cpu_nms import nms, soft_nms
# from .nms import py_cpu_nms
import... |
995,199 | 221f845ee313dfed7b23855587d3bfd428450e3a | print(min(2,3))
print(min(2,3,-1))
list1 = [1,2,3,4,5,-54]
print(min(list1))
list2 = ['a','b','c']
print(min(list2))
List3 = ['1','2','abc','xyz']
print(min(List3))
# List4=[]
# print(max(List4)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.