index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,600 | d16c1132d1f6f2bc75bff7fe745f09a6a4762da0 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: notification_entry.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 reflectio... |
988,601 | 6bfd8919aa9dfbbf561f71b4c7621977f346dee4 | num=input()
a=0
for x in num:
if x.isdigit():
a=a+1
print (a)
|
988,602 | a3dafd81bc492eff26576573fa6ae8a5b1d542d2 | # -*- coding: utf-8 -*-
"""Implements object data persistence with "Active Record".
$Id: record.py 953 2012-03-25 13:26:19Z anovgorodov $
"""
import zope.interface
import zope.schema
from zope.interface import implements
from rx.ormlite2 import dbop
from rx.ormlite2.interfaces import IRecord, IActiveRec... |
988,603 | eb1eff31635e4c83d8080bbdfa70e76c4e634313 | #!/usr/bin/python
from kafka import KafkaConsumer;
kafkaHosts=["kafka01.paas.longfor.sit:9092"
,"kafka02.paas.longfor.sit:9092"
,"kafka03.paas.longfor.sit:9092"]
'''
earliest
当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
latest
当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下... |
988,604 | 070483279a5249491b27fb1969490ce0e5e489d7 | # 파일 열기 => 작업 => 닫기
# (w)write:덮어쓰기,(a)append:이어쓰기,(r)read
#1.파일 쓰기
file = open("E:/python/Chapter10/filetest/data0823.txt", "w", encoding="utf8")
file.write("1.인생은고통이다")
file.close
#2. 파일추가
file = open("E:/python/Chapter10/filetest/data0823.txt", "a", encoding="utf8")
file.write("\n2.상위 5% 뺴면 시궁창이다.")
file.close()... |
988,605 | 37672c75ed5c712eb458d7e08c5fb3e78b89fc26 | # ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2018/11/2 0:46
import os
import time
from selenium import webdriver
from PIL import Image
from baidu_ai.baidu_ai_api_test import BaiduOCR
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_... |
988,606 | 5c663e6ceac57842d49338e6f3c13ae6899c90a1 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=100 et ai si
import cv2
import imutils
import threading
from PIL import Image, ImageTk
class VideoStream:
"""This class handles obtainig video stream from the ip camera."""
def video_loop(self):
"""
Loop which displays the video. ... |
988,607 | 3dabc4590012dead6839a03bbc52d164ee14d0e1 | def pfreq(a, b, c):
dic,leng, conc, blank={},len(c), "", 0
for x in range(leng):
if len(c[x].replace("M", "")) != 0:
c[x]=c[x].replace("M", "")
tp=len(c[x].replace("A", "P"))
dp=len(c[x].replace("A", ""))
dic[b[x]]=((dp*100)/tp)
if dic[b[x]] < 75:
conc += ((" "*blank)+b[x])
blank = 1
print "%s... |
988,608 | 6948a68c5ab73ee6af4466f33741ebe759b2cd5f | # create functions in python that will take an argument and will return 1 for True or 0 for False for the following checks:
# - if the entry is numberic
# - if the entry is alphanumberic (chars and numbers)
# - if the entry is chars only
# - if entry is lowwercase
# - if entry is uppercase
def is_numberic(a):
fro... |
988,609 | fbab026fe8875f683b7771b589718ec4d029685e | import csv
def main():
game = {}
move = {}
mode = None
gamefieldnames = ['white', 'black', 'date', 'halfmoves', 'moves', 'result', 'whiteelo', 'blackelo', 'gamenumber', 'event', 'site', 'eventdate', 'round', 'eco', 'opening']
movefieldnames = ['movenumber', 'side', 'move', 'fen', 'gamenumber']
... |
988,610 | 07ee0e0fd3f71c07790297b6872f00b2fa1bed1a | """
visualize results for test image
"""
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
from torch.autograd import Variable
import transforms as transforms
from skimage import io
from skimage.transform import resize... |
988,611 | 2324fb3e6bbea3f4d5117b1422d77fe296ee66a8 | #!/usr/bin/python3
import logging
from lulu_pcol_sim import sim
import sys # for argv
import time # for strftime()
import natsort # for natural sorting of alphabet (needed because the order of objects has to be B_0, B_1, B_2, B_10, B_11 and not B_0, B_1, B_10, B_11, ...)
def createInstanceHeader(pcol, path, originalFi... |
988,612 | 3c4461998ab6672a739fd6d99695d96135777721 | from flask import Flask, request
app = Flask(__name__)
lista = ['Ambroży', 'Barnaba', 'Celina', 'Danuta', 'Eligiusz', 'Felicja']
@app.route('/osoby')
def odczyt_z_listy():
# spróbuj http://127.0.0.1:5000/osoby?id=2 query string to jest w tym wypadku id=2
indeks = request.args.get('id')
if indeks:
... |
988,613 | 3c6940846c041888788e3b5462d82d8335aade2c | class Solution:
def isHappy(self, n: int) -> bool:
func = lambda x : sum(int(ch) ** 2 for ch in str(x))
slow = func(n);
fast = func(func(n));
while slow != fast:
slow = func(slow)
fast = func(func(fast))
if slow == 1:
return True
el... |
988,614 | 3e93fc509eecdbd745cab11854abd15be7f3db6b | #!/usr/bin/{{ pillar['pkgs']['python'] }}
import dns.query
import dns.resolver
import dns.reversename
import dns.update
eth_ip = '{{ salt["network.interfaces"]()["eth0"]["inet"][0]["address"] }}'
server_addr = 'ns.skynet.hiveary.com'
fqdn = '{{ grains["host"] }}.skynet.hiveary.com.'
ttl = 7200
skynet_update = dns.up... |
988,615 | 592e5eaf156c8f1eeb498734f6f4213ac9da921f | from flask import jsonify
import db_helper
import api_utils
def list_customers():
"""List of all customers and customer_id"""
customers = db_helper.get_all_customers()
return jsonify({"customers": customers})
def show_accounts(customer_id):
"""Show a list of accounts for requested customer_ID"""
... |
988,616 | a7f72635e7196d1cc059aa8caa49ed1804d8912f | # coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
# Command line :
# python -m benchmark.HIGGS.explore.tau_effect
import os
import datetime
import numpy as np
import pandas as pd
import matplotlib.pypl... |
988,617 | e33d0f6ffd29ec1ee7a55069fabbcc0fc6352ddd | from django import template
register=template.Library()
@register.filter(name='trunc')
def truncate_n(value,n):
result=value[:n]
return result |
988,618 | 419189ba840f3baffd14eebd053d85a1aff8e3fb | #!/usr/bin/env python
import sys
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
df = pd.read_csv(sys.argv[1])
lr = LinearRegression()
X = df[['circle_x']]
Y = df['sin_theta']
lr.fit(X, Y)
print('coef=', lr.coef_)
print('intercept=', lr.intercept_)
plt.scatter(X,... |
988,619 | 24928c891ac1e8f096364baf460a2222fc3da2d6 | from admin import BaseNoteAdmin
from widgets import ReminderWidget
from forms import LockoutFormSetMixin, NoteFormSet, NoteForm
from models import Note, NotesField
|
988,620 | 572d3027de6f8fb05a799337686ef6f649abf2d4 | #Author: Molly Creagar
#coding the Perceptron algorithm (linear classifier) from scratch
import numpy as np
import matplotlib.pyplot as plt
def perceptron(Xpos,Xneg,t):
#run algorithm 50000 times
numEpochs = 50000
#we want to see the boundary every 500 epochs
boundaryVis = 500
#starting vector
... |
988,621 | 3e020aa0a6ad9a7cb6ca3b2d424f534b76d5d0e6 | # -*- coding: utf-8 -*-
import os
import numbers
import filecmp
import warnings
from collections import defaultdict
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import matplotlib.patches as patches
from matplotlib.lines import Line2D
from matplotlib_venn import venn3
im... |
988,622 | 15eb05424d0b2679415f7d4867e0bf8f9d995371 | from fruits_db import session, Fruit
fruits = session.query(Fruit).all()
for fruit in fruits:
print()
print(f'Fruit: { fruit.name }')
print(f'Price: { fruit.price_cents } cents') |
988,623 | 753606f1fc4f73c391fe4565e9b2831f0f53535f | '''
상담원으로 일하고 있는 백준이는 퇴사를 하려고 한다.
오늘부터 N+1일째 되는 날 퇴사를 하기 위해서, 남은 N일 동안 최대한 많은 상담을 하려고 한다.
백준이는 비서에게 최대한 많은 상담을 잡으라고 부탁을 했고, 비서는 하루에 하나씩 서로 다른 사람의 상담을 잡아놓았다.
각각의 상담은 상담을 완료하는데 걸리는 기간 Ti와 상담을 했을 때 받을 수 있는 금액 Pi로 이루어져 있다.
N = 7인 경우에 다음과 같은 상담 일정표를 보자.
1일 2일 3일 4일 5일 6일 7일
Ti 3 5 1 1 2 4 2
Pi 10 20 10 20 15 40 200
1... |
988,624 | 20b82fe1703534ef657140dab7e2e186d3155474 | from MF_bias import MF_bias
import numpy as np
R = np.array([
[1.0, 4.0, 5.0, 0, 3.0],
[5.0, 1.0, 0, 5.0, 2.0],
[4.0, 1.0, 2.0, 5.0, 0],
[0, 3.0, 4.0, 0, 4.0]
])
mf = MF_bias(data=R, K_feature=2, beta=0.002, lambda_value=0.01, iterations=20000)
mf.train()
print(mf.gradient_descent()) |
988,625 | e2e0fbfc311d2b9fe40c76e0b02c64715a8a1d6f | import tensorflow as tf
import numpy as np
from feature_helpers.feature_generator import make_tfidf_combined_feature_5000, load_tfidf_y
seed = 12345
def weight_variable(name, shape):
return tf.get_variable(name=name, shape=shape,
initializer=tf.contrib.layers.variance_scaling_init... |
988,626 | 94f77f1a6721ca5cb7e53d776ff1d201f4169107 | ## 012345678901234
frase = ' Roberto Mota'
## [Inicio:Fim:intervalo]
# vai do slot 1 até o slot 6 do array
print(frase[1:6])
# vai do slot 1 até o slot 6 do array pulando de 3 em 3
print(frase[1:14:3])
# vai do slot INICIO até o slot FIM pulando de dois em dois
print(frase[::2])
# utilizando aspas triplas, ele ... |
988,627 | 27f783c27712a2f301238664d16971d74c9a4cc2 | #!/usr/bin/env python3
#エクサウィザーズ2019 A
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgette... |
988,628 | e1d68814a9193e343df1abc6b2d6bc12d779312b | #coding = 'utf-8'
import os
def origin_path():
'''
使用config文件提供原始路径等
:return: 运行文件所在的根目录
'''
origin_path = os.path.dirname(os.path.abspath(__file__))
# print(origin_path)
return origin_path |
988,629 | dcdea8c0e0572b53a34f30198a0ed1337b5e9398 | import pandas
import scipy.stats
import seaborn
import matplotlib.pyplot as pyplot
aData = pandas.read_csv('ool_pds.csv', low_memory=False)
# W1_A11: Frequency of watching national news
# invalid data -1
# PPAGE: age
aSubData = aData[['PPAGE' , 'W1_A11']]
aSubData = aSubData[(aSubData['W1_A11']!= -1)]
print ('Asso... |
988,630 | dc8dcfb84929df26d1ac8a91aa82225e261e2b30 | def get_current_ranges(current_readings):
if len(current_readings) == 0:
return 'ERR_EMPTY_INPUT'
return True
|
988,631 | 94cce7fab62914b8f32fe5903aabd7e412762d68 | import torch.nn as nn
# # Parameters to define the model.
# params = {
# 'nc' : 3,# Number of channles in the training images. For coloured images this is 3.
# 'nz' : 100,# Size of the Z latent vector (the input to the generator).
# 'ngf' : 64,# Size of feature maps in the generator. The depth will be mult... |
988,632 | 5260432940ddff25a052b1bddfc5e58250057c46 | import os
import sys
import zipfile
# Make sure we have the correct command line arguments
if len(sys.argv) != 3:
print "Please provide command line arguments as follows:"
print "'python ziptool.py <Directory> <Zip File>' to append to zip file"
print "'python ziptool.py <Zip File> <Directory>' to extract from z... |
988,633 | 44f5ce2fbe32b40468c5739d99e2a1c81d3175be | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
988,634 | 6574f7c45da816be198d16ce51bf3ca45c36f705 | from django.shortcuts import render
from django.http import *
from .models import Quote
from .forms import *
def index(request):
return HttpResponse("<h1>Quote Index</h1>")
def quoteout(request):
obj = Quote.objects.all()
return render(request, 'quotation/quoteout.html', {'obj':obj})
def quotein(request):
if re... |
988,635 | 0e43d7e9c9879d4aa0268fcc9d9b27d40842655e | class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums_len = len(nums)
start_idx = 0
for curr_idx in range(nums_len):
if start_idx == curr_idx:
majority_element = nums[curr_idx]
... |
988,636 | 99f747016e0df5615465b81cd975ae1909643b9a | from os import walk
from LTM import *
from TRM import *
from HistBP import *
import cv2
import numpy as np
import matplotlib.pyplot as plt
import nltk
#from deep_activations import *
class vTE:
def __init__(self, settings=""):
self.settings = settings
self.task_graph = None
self.hist... |
988,637 | dd74951a9ca39fe3ad6cd4f50ca11a9299b1b910 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Benjamin Preisig
import logging
import lirc
from soco import SoCo
from soco.exceptions import SoCoException
import config
def is_playing(transport_info):
state = transport_info['current_transport_state']
if state == 'PLAYING':
return True
... |
988,638 | 8afa8fea2a298e4e82e5c6cd9881e11615ac053c | from dataclasses import dataclass, field
from typing import List, Optional
from datexii.models.eu.datexii.v2.fuel_type2_enum import FuelType2Enum
from datexii.models.eu.datexii.v2.load_type2_enum import LoadType2Enum
from datexii.models.eu.datexii.v2.vehicle_type2_enum import VehicleType2Enum
from datexii.models.eu.dat... |
988,639 | 37e8d738e9efa95193d324343b4f6435ae6fa34e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 10 10:02:07 2019
@author: BrunoAfonso
"""
from surprise import AlgoBase
from MovieLens import MovieLens
from surprise import PredictionImpossible
import math
import numpy as np
import heapq
class ContentBasedAlgorithm(AlgoBase):
def __init__(... |
988,640 | ebbb69984c2a5223d6f075e38c47d17e7b75e96a |
import ttg
table = ttg.Truths(['p', 'q'] , ['p and q', 'p or q', 'p xor q', 'p = q'], ints=False)
print(table.as_prettytable())
Ariels touch
|
988,641 | e714dc452f3cafa721717d9faf832de991e7b791 | from math import sqrt
type = input()
pi = 3.14
if type == 'треугольник':
a = float(input())
b = float(input())
c = float(input())
p = (a + b + c) / 2
print(sqrt(p*(p-a)*(p-b)*(p-c)))
elif type == 'прямоугольник':
a = float(input())
b = float(input())
print(a*b)
elif type == 'круг':
r... |
988,642 | 975916c0bba76a3750222474b78bd7c6270de0c2 | # Generated by Django 2.2.3 on 2019-10-30 11:01
import ckeditor.fields
import ckeditor_uploader.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... |
988,643 | 54ef5fe2459abfb9cc8d5be454836d4f8431e0b6 | import src.utilities.custom_logger as cl
import logging
from src.base.basepage import BasePage
class NavigationPage(BasePage):
log = cl.custom_logger(logging.DEBUG)
def __init__(self, driver):
super().__init__(driver)
self.driver = driver
# Locators
_main_page_logo = "//a[@class='na... |
988,644 | 4b80751fc23aa3156b05041350a1a96db68f4723 | from collections import namedtuple
Context = namedtuple('Context', ['id', 'folder'])
|
988,645 | a51cae2b51b91d2b8551ae9574aa11a48af4d47b | # Generated by Django 2.2.10 on 2020-04-09 06:43
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0019_auto_20200409_1202'),
]
operations = [
... |
988,646 | efec2260ce9b74071604b5d3a5e3a3f8b77b6a55 | import datetime as dt
import json
import sys
from . import __version__
from .config import is_dry
from .dry import dummy_function
from .dry import dryable
class Stats:
"""Class used to collect kb run statistics.
"""
def __init__(self):
self.kallisto_version = None
self.bustools_version =... |
988,647 | 8500fbef8e71add23cccc704361ec78009f0b2f3 |
import pandas as pd
#loading data from a file
df_realty = pd.read_csv('train.tsv',sep='\t',names=['price', 'num_of_rooms', 'area', 'num_of_floors', 'address', 'desc'])
df_desc = pd.read_csv('description.csv', header=0)
#joining data from files
df_realty = pd.merge(df_realty, df_desc, left_on='num_of_floors', right_on=... |
988,648 | c6fcb731b3876236831a718d4d7036ca83d0a4a7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
__url__ = ur"$URL$"[6:-2]
__author__ = ur"$Author$"[9:-2]
__revision__ = int("0" + ur"$Rev$"[6:-2])
__date__ = ur"$Date$"[7:-2]
extra = {}
from trac.util.dist import get_l10n_cmdclass
cmdclass = get_l10n_cmdclass()
if cmdclass:... |
988,649 | 1a152a61ece8b6e047c389fe9c05123eb649a4cb | from django.urls import path
from .views import cart_detail, add_to_cart, update_cart, remove_cart_item
urlpatterns = [
path("cart/", cart_detail, name="cart"),
path("cart/add/<item_id>/", add_to_cart, name="add_to_cart"),
path("cart/update/<item_id>/", update_cart, name="update_cart"),
path("cart/rem... |
988,650 | 18777dc0e57cd6b507119058797d20be08d5b10e | import subprocess
def _check_output(*popenargs, **kwargs):
if 'stdout' in kwargs: # pragma: no cover
raise ValueError('stdout argument not allowed, '
'it will be overridden.')
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
output, _ = process.com... |
988,651 | 697fb5e75d61275ac77e100c6837fc5900779ae4 | import os
import sys
import time
import argparse
import torch
from torchvision import utils
from model import Generator
from tqdm import tqdm
import numpy as np
def generate(args, g_ema, device):
with torch.no_grad():
g_ema.eval()
for i in tqdm(range(args.pics)):
sample_z = torch.ran... |
988,652 | 629df16ed492254663479c6f34ea0f2e61efb781 | import os
import pprint
import argparse
import humanfriendly
import boto3
import botocore.utils
DEFAULT_CHUNK_SIZE = 67108864 # 64MB
class Upload(object):
def __init__(self, args):
self.vault = args.vault
self.file = args.file
self.description = args.description
self.chunk_size... |
988,653 | 4a82c7dfebb1662f0d95b0d63623e148fefd70a5 | # -*- coding: utf-8 -*-
"""
camplight.cli
~~~~~~~~~~~~~
This module implements the command-line interface to the Campfire API.
"""
import sys
import os
import optparse
from .api import *
from .exceptions import *
def die(msg):
sys.exit('error: %s' % msg)
def main(argv=None):
usage = 'Usage: %prog [opti... |
988,654 | a87f49a1aaa039470c163b32b573e960c42b2b97 | import sys
import re
data = sys.stdin.read()
result = re.findall("you", data)
print(len(result))
|
988,655 | 05c44b33f9f8e2aefdaa9b64b4aa12a046a11705 | """webapps URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... |
988,656 | a571055ce9ef24f9a915f99088fc9c0fd0d02c18 | # -*- encoding: utf-8 -*-
from . import FixtureTest
class HideEarlyNoAreaGardenTest(FixtureTest):
def test_allotments_node(self):
import dsl
z, x, y = (16, 32683, 21719)
self.generate_fixtures(
# https://www.openstreetmap.org/node/1271465901
dsl.point(1271465901,... |
988,657 | a393bfcdf9a78b6c69c165da824f013f66db06e1 | def remove_last_e(str):
if str[-1] == "e" and str[-2] == "e":
array = list(str)
array.pop()
return(''.join(array))
else:
return(str)
|
988,658 | e2be3ea3e2596d78c6fb70b570bd1f164bb28c5e | '''
You have an empty sequence, and you will be given queries. Each query is one of these three types:
1 x -Push the element x into the stack.
2 -Delete the element present at the top of the stack.
3 -Print the maximum element in the stack.
Input Format
The first line of input contains an integer, . The next ... |
988,659 | 55d1f3713016d87f86091c9fb8de33791bd3d325 | # Exercício Python 027: Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o
# último nome separadamente.
# Ex: Ana Maria de Souza (primeiro = Ana; último = Souza.
name = str(input('Digite seu nome: ')).title().strip().split()
print('Muito prazer em te conhecer')
print('Seu prime... |
988,660 | ea536855ec460688c2b0a385e35baebfb603ba60 | #!/usr/bin/env python
"""GRR specific AFF4 objects."""
import re
import time
import logging
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import flow
from grr.lib import queue_manager
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import utils
from grr.lib.aff4_obj... |
988,661 | fb60cdc8f21c3aced00eb72caa4e1109318b609c | from diagrams import Cluster, Diagram, Edge
from diagrams.aws.compute import EC2, ECS
from diagrams.aws.network import ELB, Route53
from diagrams.aws.database import RDS
graph_attr = {
"fontsize": "45",
"bgcolor": "white"
}
with Diagram("Environment-Model", show = False, graph_attr= graph_attr):
with Clu... |
988,662 | f0c4e781bd6e8b61f8d7181d3404e254e8db0d5a | import os
import re
from maya import cmds as m
from fxpt.fx_refsystem.com import REF_ROOT_VAR_NAME, REF_ROOT_VAR_NAME_P, isPathRelative
from fxpt.fx_refsystem.transform_handle import TransformHandle
from fxpt.fx_utils.utils import cleanupPath
from fxpt.fx_utils.utils_maya import getLongName, getShape, getParent, pare... |
988,663 | 94f5c543076a5d5287b2f63da7503203e47c61da | import smtplib, ssl
port = 587 # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "kryonps@gmail.com"
receiver_email = "kryonps@gmail.com"
password = "Kryon123!"
SUBJECT = "subject"
TEXT = "text"
message = 'Subject: {}\n\n{}'.format(SUBJECT, TEXT)
context = ssl.create_default_context()
with smtplib.SMTP(s... |
988,664 | 313dee84b7f618388e61fc75c1a4f73e23a2c6f2 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import deal_email_data
import os
import sys#sys.argv
import dnspod
import opendkim
import statistics
import iptable
import verifyemail
import verifyweb
import apiemail
reload(sys)
sys.setdefaultencoding('utf8')
print('————发邮件准备步骤,从上到下依次完成!,打错字按crtl+删除键回删!——... |
988,665 | 21d5c7863542db59828a3bd8e4497ddac73b5a14 | class Position:
""" A class representing latitude and longitude coordinates """
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "{}, {}".format(self.x, self.y)
def move_north(self):
self.y += 1
def move_south(self):
self.y -= ... |
988,666 | 4dc03cfc9ee2b5f1d20c69176dd1b9a98a875375 | import fileinput
from functools import reduce
# BFFFBBFRRR: row 70, column 7, seat ID 567.
# FFFBBBFRRR: row 14, column 7, seat ID 119.
# BBFFBBFRLL: row 102, column 4, seat ID 820.
seats = [line.strip() for line in fileinput.input()]
to_bits = lambda str, zero, one: [{zero: 0, one: 1}[x] for x in str]
bits_to_num = ... |
988,667 | b6be9d22de8774058871deeab53c176c92f70fe1 | import json
import boto3
from datetime import datetime
RESOURCE = boto3.resource('dynamodb', region_name='us-east-1')
def lambda_handler(event, context):
print(event)
response = "failed"
table = RESOURCE.Table('user')
usernames = table.scan()
if event['part'] == "1":
for user in usernames... |
988,668 | 5e65848af4adeeb5c2867f72b356c3d8c664449b | import urllib2, urllib
import re
import base64
from mod_python import util
def index(req):
req.content_type = "text/xml"
theurl = 'https://prodweb.rose-hulman.edu/regweb-cgi/reg-sched.pl'
# Search Data
userToLookup = req.form.getfirst('infestor')
term = req.form.getfirst('templar')
view = 'table'
bt1 = 'ID/Us... |
988,669 | 3a9ddaa0d9b021e65beb1a4bf4cc9c22fe0df57e | from django.views.generic import ListView, TemplateView
from django.views.generic.edit import CreateView
from django.core.urlresolvers import reverse
from .models import Room, Message
class CreateRoom(CreateView):
"""Users can create chat rooms"""
model = Room
fields = ('name',)
def get_success_url(... |
988,670 | 39a820b59010fc0accdf3a1b3e04b58f2a2613fb | import datetime
from twisted.internet import reactor
from twisted.internet.defer import ensureDeferred
from twisted.trial.unittest import TestCase
from twisted.web.client import Agent, HTTPConnectionPool
from .. import treq as gh_treq
from .. import sansio
import treq._utils
class TwistedPluginTestCase(TestCase):
... |
988,671 | dcdc719a4f187d550b516b2b4b653f35e1c43935 | import logging
from datetime import datetime, date, timedelta
from pathlib import Path
import requests
import os
from io import BytesIO
import zipfile
import csv
from pathlib import Path
requests.packages.urllib3.disable_warnings()
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
class Gesu... |
988,672 | ef484f852e548d5cabef86970a65d4ea10a28c36 | # class Mobile:
# def __init__(self):
# print("Mobile Constructor Called")
# realme=Mobile()
class Mobile:
def __init__(self):
self.model="Realme X"
def show_model(self):
print(self.model)
realme=Mobile()
redmi=Mobile()
oneplus=Mobile()
print(realme.model)
print(... |
988,673 | 735a2627301fdbfe6cfbe6450725b2113fe802eb | from collections import deque
def add_bomb_to_pouch(bombs, val,bomb_pouch):
for key, value in bombs.items():
if value == val:
bomb_pouch[key] +=1
return bomb_pouch
def bomb_pouch_is_full(bomb_pouch):
if bomb_pouch['Datura Bombs']>=3 and bomb_pouch['Cherry Bombs']>=3 and bomb_p... |
988,674 | 3c4cf1a538e26b03e44a78ef2c8cdcd86ccb9273 | # Generated by Django 3.2.7 on 2021-09-18 03:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='servery',
old_name='open_saturday',
... |
988,675 | d9b1b3bd96312b4de4ebedbbf03509f1bba171c2 | import json
import os
database={}
defaultDatabasePath='data'
def load():
global database
if os.path.exists(defaultDatabasePath):
with open(defaultDatabasePath ,'r' ,encoding='utf-8') as f:
database=json.loads(f.read())
def dump():
global database
with open(defaultDatabasePath ,'w... |
988,676 | f53716a199e5b3724663f6cc7a612a708540656e | import re
import pprint
# 标记订单起始、价格
TITLE_reg = re.compile(r'订单已送达')
PRICE_reg = re.compile(r'^-?¥?(?P<price>[0-9]{0,3}(?:\.[0-9]{1,2})?)$')
# 标记折扣、附加费关键字
DISCOUNT_wds = ['红包', '满减', '立减']
ADDITION_wds = ['配送费', '包装费']
def ocr():
resp = {
'words_result': [
{'words': '23:15'}, {'words': '19.0... |
988,677 | 731323fdca54e8b6fc0b7156dc54bac36fcc3a4d | # Parser for hosts file
import re
class ParseError(Exception):
pass
entry_regex = re.compile(r"""^
\s*
(?:
([0-9a-fA-F.:]+)\s+ # rough IP
( # All HostNames
(?:
[a-zA-Z0-9:_.-]+
\s? ... |
988,678 | 772c202d451328f7cd30c3809e5c8cb8f92083ba | def insort_right(a, x, lo=0, hi=0):
a.append(x)
def insort_left(a, x, lo=0, hi=0):
a.append(x)
def insort(a, x, lo=0, hi=0):
a.append(x)
def bisect_right(a, x, lo=0, hi=0):
return 1
def bisect_left(a, x, lo=0, hi=0):
return 1
def bisect(a, x, lo=0, hi=0):
return 1
|
988,679 | 7b2c48a5fb5e232fc4017949dbee42ddd850c214 | from rest_framework import generics
from .models import listItem
from .serializers import TaskSerializer
class TasksList(generics.ListCreateAPIView):
"""
List all tasks, or create a new task.
"""
queryset = listItem.objects.all()
serializer_class = TaskSerializer
class TaskDetail(generics.RetrieveUpdateDestroyA... |
988,680 | 94197d701e2906fdb5ccafff053cf047d29ef113 | import flask_login
from app import app
login_manager = flask_login.LoginManager()
login_manager.init_app(app)
username = app.config['USERNAME']
password = app.config['PASSWORD']
users = {username: {'pw': password}}
class User(flask_login.UserMixin):
pass
@login_manager.user_loader
def user_loader(email):
... |
988,681 | b81978781e835a5d81417ea7cdb1c3aba73323fd | import numpy as n
from brainpipe.feature.brainfir import fir_filt, fir_order, filtvec
from scipy.signal import hilbert
__all__ = [
'phase'
]
####################################################################
# - Get the phase either for an array or a matrix :
##########################################... |
988,682 | db9678b475476ca0ee7dd7e84e6f656ee03d12dc | from .models import Task
from rest_framework import serializers
class TaskSerializers(serializers.ModelSerializer):
class Meta:
model = Task
fields = ("id", "task_name", "task_desc", "is_completed", "date_created")
|
988,683 | 1961a82599c124a22703f306a6ec648cda076685 | # https://docs.python.org/ja/3/library/socket.html
import socket
HOST = '127.0.0.1'
PORT = 31415
with socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) as sock:
sock.bind((HOST, PORT))
sock.listen(1)
while True:
conn, client_addr = sock.accept()
with conn:
print(f... |
988,684 | 054049b35e0969b533e8735f59944f71784297c7 | #!/usr/bin/python3
'''
First Common Ancestor:
Design an algorithm and write code fo find the first common ancestor of two nodes in a binary tree.
Avoid storing additional nodes in a data structure.
NOTE: This is not necessarily a binary search tree.
'''
|
988,685 | 2aae0fc1fc223c7539631c93b56be1a945e1df72 | class Initializer:
pass
|
988,686 | a940765af20feb7ab221bd583c4876d5b86ed474 | palabra = "Un texto de varias palabras"
# print(palabra[0])
# print(palabra[1])
# print(palabra.replace("e","o",1))
#print(palabra[0])
#slices
print(palabra[::-1])
#Crear funcion que permita ingresando un texto, saber si algo es palindromo
#Ana
#Luz azul
#Anita lava la tina |
988,687 | e22382340446cbb36db70ed82fc86e473a83a769 | import flask_wtf
from wtforms import StringField, validators, SubmitField, IntegerField
from larigira.formutils import AutocompleteStringField
class Form(flask_wtf.Form):
nick = StringField('Audio nick', validators=[validators.required()],
description='A simple name to recognize this audio... |
988,688 | 1bdabd9d17d30fedd12ba2d4978511aca9e59e70 | class Insertion(object):
"""Insertion candidate"""
def __init__(self, arc, start_position, end_position, hval=None):
self.arc = arc
self.hval = hval
self.add_cost = 0
# This is position of the first node of the arc in the node list
self.start_position = start_position
... |
988,689 | ab3388354053d9c2c82f9338d2ca8cd1dd46c07b | class cal3():
p=0
t=0
r=0
def __init__(self,p,t,r):
self.p=p
self.t=t
self.r=r
print('The principal is', p)
print('The time period is', t)
print('The rate of interest is',r)
def calinterst(self):
interst = (self.p * self.t *... |
988,690 | 7d7383b300f8a035749394262e1f5434c0cf2f86 | import typing
import inspect
from .model import CogCommandObject, CogSubcommandObject
from .utils import manage_commands
def cog_slash(
*,
name: str = None,
description: str = None,
guild_ids: typing.List[int] = None,
options: typing.List[dict] = None,
connector: dict = None
):
"""
Dec... |
988,691 | bc09fd8b0738c1cb15d5b7eb3eac37cfb48b7fb0 | # TASK: 12/27/2019
# Words like first, second, and third are referred to as ordinal numbers.
# They correspond to the cardinal numbers 1, 2, and 3.
# Write a function called "cardinalToOrdinal()" that takes an integer from 1 to 15 and
# returns a string containing the corresponding English ordinal number as
# its onl... |
988,692 | 9eee1af2a2fb836660728f8638f5055db4209483 | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division,print_function,absolute_import,unicode_literals
import os
from TSF_Forth import *
def TSF_uri_Initwords(TSF_words): #TSF_doc:URLとファイルパス関連のワードを追加する(TSFAPI)。
TSF_words["#TSF_mainfile"]=TSF_uri_mainfile; TSF_words["#メインファイル名"]=TSF_uri_m... |
988,693 | d602439bc40c0ad8f208123df5485a7873951f0e | from django.db import models
from accounts.models import DiscordUser
# Create your models here.
import datetime, jwt, time
from skillbase_api import settings
from rest_framework.authtoken.models import Token
from asgiref.sync import sync_to_async
class Mod(models.Model):
name = models.CharField(max_length=128)
... |
988,694 | 9bfac9733043f6b713eba63713b03b3183ec6e73 | import requests
from bs4 import BeautifulSoup as bs
import urllib
#get source code to parse
r = requests.get("http://www.co.pacific.wa.us/gis/DesktopGIS/WEB/index.html")
html = r.text
#parse through to get links to files
soup = bs(html)
#link containers
h, j = [], []
#gets all the links
for link in soup.find_all("a... |
988,695 | 880e641a9a032710839c0cbc97de150e71c753fd | #!/usr/bin/env python3
from binascii import unhexlify
def xor_two_str(s1,s2):
if len(s1) != len(s2):
raise "XOR EXCEPTION: Strings are not of equal length!"
return ''.join(format(int(a, 16) ^ int(b, 16), 'x') for a,b in zip(s1,s2))
KEY1 = "a6c8b6733c9b22de7bc0253266a3867df55acde8635e19c73313"
KEY2 ... |
988,696 | 04eeab411d8c780cfcfd276eb14f202302e87b11 | from django.contrib.auth.models import User
from django.db.models import Avg
from app import models
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'password', 'email',
'first_name', ... |
988,697 | a3a3caa4efe699665c6db00fcb4ef026f19bba74 | # !/usr/bin/env python
# coding=utf-8
"""
Make a graph for lecture 2, hippo digestion
"""
from __future__ import print_function
import sys
import numpy as np
from scipy import interpolate
from common import make_fig, GOOD_RET
__author__ = 'hbmayes'
def graph_alg_eq():
"""
Given a simple algebraic equation, ... |
988,698 | dc62734db3e292c3b034a4313f9dddf2c407d1cb | import random
#menu options lists
appetizer=["fries","stuffed potatoes","mozzerella sticks"]
main=["shrimp", "pizza", "pasta"]
dessert=["lava cake", "carrot cake", "cookie", "ice cream"]
#defines the function meal
def meal():
print(main[random.randint(0,2)])
#begin program output
print("The chef will choose your me... |
988,699 | dba10d47ce5624132fa973d1dde29e0ac64d8c13 |
def digit_sort(lst):
return [int(x) for x in sorted(sorted([str(n) for n in lst]),key=len,reverse=True)]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.