index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
987,000 | ba2b2fd8d77cf59e57d3b70b6017f76c63f872d6 | import math
def nCr(n,r):
f = math.factorial
return int(f(n) / f(r) / f(n-r))
print(nCr(40, 20)) |
987,001 | 717557bc4ee46e4ce4ea427b4c931e35598c1b26 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ==============================================================================
import sys
import os
import lxml.objectify
import lxml.etree
# ==============================================================================
f = sys.stdin.read()
data = lxml.objectify.parse... |
987,002 | f7a600fa4ec9bb74e2fee7eaf718f9dcf9da8c9d | from pathlib import Path
def validate_dir(path: Path):
return path.exists() and path.is_dir()
def clear_dir(path: Path):
for child in path.iterdir():
if child.is_file():
child.unlink(missing_ok=True)
else:
clear_dir(child)
|
987,003 | 2a303dd1067499b95259ed83e188eb8f393bc758 | #!/usr/bin/env python
#######
####### permute_wiki.py
#######
####### Copyright (c) 2010 Ben Wing.
#######
from __future__ import with_statement
import random
import re
import sys
from nlputil import *
from process_article_data import *
"""
We want to randomly permute the articles and then reorder the articles
in t... |
987,004 | 9abd17e032220c643768b81df660c8c8268f63a3 | # Brian Blaylock
# March 1, 2017 Toothaches are not fun
"""
Use python to execute an rclone command that copies HRRR files from the
horel-group/archive/models/ to the horelS3:HRRR archive buckets.
This script should be run by the mesohorse user on meso1.
Requirements:
rcl... |
987,005 | d72039d9c6cc7a141798c2d733b9e3e800550f78 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import socket
from gevent import monkey
monkey.patch_all()
import gevent
import gevent.pool
import sys
import getopt
port_service = {'21': 'ftp', '22': 'SSH', '23': 'Telnet', '80': 'web----Http.sys远程代码执行漏洞', '161': 'SNMP', '389': 'LDAP',
'443':... |
987,006 | b90a6e41bcf54b541f82f4b73b26cec61a44eebe | from SessionTimedOutException import SessionTimedOutException
from datetime import datetime
import time
import httplib
class Shell:
def __init__(self, toolbox, index, prompt):
self._toolbox = toolbox
self._index = index
self._prompt = prompt # old shell
def write(self, command):
... |
987,007 | 6db822df9b776fea315838977ff6f27e745d9bdd | def is_unique(strr):
"""Without using any library functions"""
def _contains(string, char):
for c in string:
if c == char: return True
return False
for index in range(len(strr)):
if _contains(strr[:index], strr[index]): return False
return True
num = int(input())... |
987,008 | 54fcbb83d3a525212ef79aad5804b5bdfb657d66 | import math
import os
import random
import re
import sys
# local
import trie
def longest_common_substring(s1, s2):
t1 = trie.Trie()
lcstr = ''
lcstrlen = 0
for i in range(0, len(s1)):
for j in range(0, len(s1)):
k = s1[i:j+1]
if len(k) > 0:
t1.put(k, '.'... |
987,009 | a6324518728642463ff22cef658806bbe116a5dc | """
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
Copyright 2015 Google 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
Unl... |
987,010 | 243dfe6adf8c8c2350156fb94772b94be5efdb59 | from django.contrib import admin
from .models import Vision, Research
admin.site.register(Vision)
admin.site.register(Research) |
987,011 | d76bf2a679b9464bd4006997fb666f97c9a71c0f | from main import *
from flask import Blueprint
blueprint = Blueprint("board", __name__, url_prefix="/board")
category = [
{"박물관소개": {
"관장 인사글": "about",
"관람 안내 및 오시는 길": "location",
"관련 기사": "news",
"로고 소개": "logo",
}},
{"풀짚공예 전시실": {
... |
987,012 | 17b62650f2617ea2f196c3c2e8464d36c4c2a678 | from functools import wraps
from .error import SCBPaymentError
def check_in_kwargs(kwarg_names):
"""
check if the wrapped function's class have the specified kwargs
:param kwarg_names: array of kwargs names to check
:return:
"""
def layer(func):
@wraps(func)
def wrapper(self, *... |
987,013 | 1b0d485c0c130cabf5f1146f54da6ce166aa3f81 | import numpy as np
import matplotlib.pyplot as plt
# それっぽいデータを作る処理
from datetime import datetime, timedelta
import scipy
import scipy.stats
def create_dummy_data(days):
x = np.linspace(2, 2 + days, days)
y = scipy.stats.norm.pdf(x, loc=0, scale=4) * 4 + 0.15
y = y + np.abs(np.random.randn(len(y)))/25
d... |
987,014 | e878a38f872bf4ed95db52a69be9b1098a4a38b9 | x,y = map(int,input().split())
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
C = [2]
ans = 'No'
if (x in A) and (y in A):
ans ='Yes'
elif (x in B) and (y in B):
ans ='Yes'
elif (x in C) and (y in C):
ans ='Yes'
print(ans) |
987,015 | 2274d7ee86ee46e66f8f171f6b458297178c41ce | # https://cryptopals.com/sets/1/challenges/1
hex_string = '49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d'
decoded = hex_string.decode('hex')
base_64_string = decoded.encode('base64')
print(base_64_string)
|
987,016 | a087f803da75bb57d41d401523ac91021deaba21 | # Generated by Django 2.1.2 on 2018-10-26 11:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('watcher', '0010_auto_20181026_1107'),
]
operations = [
migrations.AlterField(
model_name='websitechecksettings',
nam... |
987,017 | 2101a1c1dd558c8bcf74d378912e6ecbd09fdede | number = 7
while True:
user_input = input("Would you like to play? (Y/n)")
if user_input == "n":
break
user_number = int(input("Guess our number: "))
if user_number == number:
print("You guessed correctly!")
elif (number-user_number) in (1, -1):
print("You were of... |
987,018 | c727440d1bf1185091ff8e2aaaab5bc7d0b96bdf | # Generated by Django 2.2.8 on 2019-12-05 20:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0040_project_currently_creating_pr"),
]
operations = [
migrations.AddField(
model_name="project",
name="pr_nu... |
987,019 | 86c128372f10522c6f30888f0cc1036ab2afaf14 | import pygame
import time
import random
from classes.Image import Image
import classes.Asset as Asset
from games.diskShooting.classes.Button import Button
from classes.Color import Color
class Start():
def __init__(self):
self.clock = pygame.time.Clock()
self.state = 'intro'
# decorate game... |
987,020 | 5b018926e31282cf487be4f13b505f9774862144 | """
Code by Ricardo Musch - February 2020
Get the latest release at:
https://github.com/RicardoMusch/rtm-tk-nuke-lut-app
"""
import nuke
import os
import sgtk
# List of Luts to Update. Last one will be the default.
luts = ["SHOW LUT", "SHOT LUT"]
def update():
for lut in luts:
# Get the J... |
987,021 | 246ebc9dab45595ad60794b014a9a1b1b051d771 | """Test that the vacuum analyzer system"""
from math import isclose,pi
import numpy as np
from vacuum_modeling.vacuum_analyzer import VacuumSystem, solve_vac_system,tube_conductance
def test_vacuum_results_with_hand_values():
# test that differential pumping works as expected
S1, S2, Q, L, D = 100.0, 1.0, ... |
987,022 | 387a5ba3c768b34fe2bdb256e09351c9e1a35d1f | __author__ = 'cmotevasselani'
class EquipmentConstants:
# Slots
RIGHT_HAND = 'right-hand'
LEFT_HAND = 'left-hand'
# Equipment
SWORD = 'sword'
SHIELD = 'shield'
DAGGER = 'dagger'
|
987,023 | 42a0010998b81cc8958ee49538b1d71cf9982fa6 | import Const
from Exchange import Exchange
import requests
class Bitstamp(Exchange):
def __init__(self):
super().__init__('Bitstamp', 'https://www.bitstamp.net')
self.prices = {}
def update_coins(self):
self.prices.clear()
coins = requests.get(self.api_base+'/api/v2/trading-pairs-info/')
if coins.status_... |
987,024 | 45ab991e1c0350af806fe5a39feeb00e1420f77c | # -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('billing', '0023_auto_20150428_1348'),
]
operations = [
migrations.AlterField(
model_name='invoiceitem',
name='instance_name',
fie... |
987,025 | 401de1bd6d6c35ab8f8b625086ec8dbd4a9865e2 | from ...base.base_metric import BaseMetric
class Accuracy(BaseMetric):
def __init__(self):
pass
def compute_value_for_one_batch(self, teacher, pred):
pass
def get_mean(self) -> any:
pass
def get_name(self) -> str:
pass
def clear(self):
pass
|
987,026 | 35db26cb54e852b701025e7439e0fc3aed231e60 | #faça uma classe soma. Está classe terá 2 atributos v1 e v2
#o programa deverá declarar 2 objetos da classe some.
#O programa devrá mostrar na tela a soma dos 2 valores
#a classe deverá ter um método chamado "somar"
class Somar:
def __init__(self,v1,v2):
self.vlr1 = v1
self.vlr2 = v2
d... |
987,027 | fa1455c64a1fd7dda894c04c510a19d454093678 | # -*- coding: utf-8 -*-
import base64
import hashlib
import hmac
def is_valid_webhook_event_signature(request_body: str, signature_header: str, signature_key: str,
notification_url: str) -> bool:
"""
Verifies and validates an event notification. See the `documentation`_ f... |
987,028 | ef4061e5b5c970e5807133002b50190189fefe63 | import streamlit as st
import pandas as pd
import requests
import json
import matplotlib.pyplot as plt
import plotly.express as px
st.title('Coronavírus no Brasil')
DATA_URL = 'https://brasil.io/dataset/covid19/caso?format=csv'
NULL = '---'
data = pd.read_csv(DATA_URL)
data = data.loc[data.place_type == 'city']
s... |
987,029 | 8a2fd8586eb73dbf11b1c6b6eb1986d914a9910d | import json
import copy
from selenium import webdriver
def get_growth(channel_id, yno):
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--headless')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("user-agent=Mozilla/5.0 (Windows ... |
987,030 | 16f54600e5de80b03f4062976273d10a2244cfa9 | from django.db import models, reset_queries
from .feeds import URLGenerator
class Url(models.Model):
id = models.AutoField(primary_key=True)
url = models.TextField()
key = models.CharField(max_length=255, null=True, blank=True)
created = models.DateTimeField(auto_now_add=True)
def save(self, *arg... |
987,031 | 8234c1eb0b49ae5e83aad881925730a42d217910 | #
# [42] Trapping Rain Water
#
# https://leetcode.com/problems/trapping-rain-water
#
# Hard (36.81%)
# Total Accepted:
# Total Submissions:
# Testcase Example: '[]'
#
#
# Given n non-negative integers representing an elevation map where the width
# of each bar is 1, compute how much water it is able ... |
987,032 | 92cb26c32349d448b887fa4c1ebc5039e9ce68b5 | from os.path import exists, join, dirname
from os import symlink
def init(conf, indir):
for name in ('js', 'css', 'scss'):
basedir = join(indir, conf.get(name, name))
if not exists(basedir):
continue
# Project lib directory (e.g. myapp/js/lib)
projpath = join(basedir, ... |
987,033 | ef3d545dd0f38638f294e1e72fd614c853b7fe38 | import os
import os.path
import getopt
import sys
import ConfigParser
import datetime
import logging
from time import sleep
from dateutil.parser import *
from lib.db import DB
from lib.backup import Backup
class UmaticsSync:
"""UmaticsSync is an universal backup utility with different storage
engines and the abilit... |
987,034 | 560b6053167a13a563e6e7d51ec7b4aa6d6776af | # import os to use os.path.join
# import panda to read csv file
# import cv2 to resize images to shape (64, 64)
# import torch.utils.data to use dataloader of Pytorch
import os
import pandas as pd
import cv2
import numpy as np
from torch.utils.data import Dataset, DataLoader
# create dataloader class for train set
cla... |
987,035 | 2de9f4e8e055063308dbfd629e0612a5ec3a49c0 | # https://st2.fileurl.link/file/825529672950506/
import urllib.request
url = input("Enter link: ")
url_name = input("name for vid: ")
video = "C:\\Users\\wazih\\Desktop\\"+ url_name + ".mp4"
urllib.request.urlretrieve(url, video) |
987,036 | ce94c2340bcd2bd615253254235b0888f61ee4d8 | # -*- coding: utf-8 -*-
import copy
import arrow
DEFAULT_DATA = dict(
ex='',
contract='',
last=0,
change_percentage=0,
funding_rate=0,
funding_rate_indicative=0,
mark_price=0,
index_price=0,
total_size=0,
volume_24h=0,
volume_24h_usd=0,
volume_24h_btc=0,
quanto_bas... |
987,037 | dde2a6dbcd51ba452ae4e9761e9108649b93b2d3 | class Solution:
def isMatch(self, s: str, p: str) -> bool:
string, pattern = [], []
string[:0], pattern[:0] = s, p
string.insert(0, 0)
pattern.insert(0, 0)
s, p = len(string), len(pattern)
dp = [[False for _ in range(p)] for __ in range(s)]
dp[0][0] = True
... |
987,038 | 53b2e78aa9cae63be9749eae2de5d6135160c667 | #encoding=utf-8
from django.apps import AppConfig
class ProduccionConfig(AppConfig):
name = 'produccion'
verbose_name = u"Producción"
def ready(self, *args, **kwargs):
from .signals import *
|
987,039 | ce882e339c126d03b328c1ba2baa55684b88ee4c | # Copyright (C) 2018 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Admin dashboard page smoke tests."""
# pylint: disable=no-self-use
# pylint: disable=invalid-name
# pylint: disable=too-few-public-methods
# pylint: disable=protected-access
import random
import re
impor... |
987,040 | e86834faf5fe19688e2c69c8e831246fc4389884 | #training resource - https://atrium.ai/resources/build-and-deploy-a-docker-containerized-python-machine-learning-model-on-heroku/
#loading datasets from sklearn
from sklearn import datasets
#to build accuracy we split the dataset into train and text
from sklearn.model_selection import train_test_split
#build model usin... |
987,041 | 3fdd2ff6b75e8f7fc60e6c3f4525e15836039967 | from flask import render_template, url_for, redirect, request, Blueprint
from flask_login import login_user, current_user, logout_user, login_required
from app import db, bcrypt
from app.models import User, Post
from app.users.forms import (RegistrationForm, LoginForm, UpdateAccountForm,
R... |
987,042 | 37ce26ab016274145c0523c476b9052d49d17f1c | #!/usr/bin/env python3
#!/usr/bin/env bash
# subprojects=(fmt GSL tinyxml2)
# for subproject in "${subprojects[@]}"
# do
# pushd "subprojects/${subproject}"
# git remote update
# git checkout origin/master
# git status
# popd
# done
import subprocess
subprojects = ['fmt', 'GSL', 'tinyxml2']
for... |
987,043 | 71531760834cc440156aea09e8af95d499c19cf7 | import os
import cv2
import random
import albumentations as A
import xml.etree.ElementTree as ET
from glob import glob
from tqdm import tqdm
from lxml.etree import Element, SubElement
def write_xml(save_path, bboxes, labels, filename, height, width, format):
root = Element("annotation")
folder = SubElem... |
987,044 | 19448c04b8135ce7c7d506070717021dca137ec0 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from datetime import date
dataInicio = date.fromisoformat('2020-01-26')
print(dataInicio)
print(type(dataInicio))
Mudou = dataInicio.strftime('%d/%m/%y')
print(Mudou)
print(type(Mudou))
|
987,045 | c5cdec634159fe260553f2359ccf69fe72a03fb7 | # from prm_core.models import *
# from rest_framework.views import APIView, Response
# from django.contrib.auth.models import AbstractUser,Group, Permission
#
#
# class getPermission(APIView):
# """
# """
# def get(self, request):
#
# # start = request.GET.get('start', 0)
# data = Permission... |
987,046 | ba1a519127d64787487127fbba0c2a7141b37d74 | # -*- coding: utf-8 -*-
from .twxproperty import TWX_Property
class TWX_Template():
def __init__(self,name, **kwargs):
self.name = name
self.allProperties = kwargs.get('allProperties',{}) #{name, TWX_Property}
self.simulateList = kwargs.get('simulateList',[]) #[name] = simulate but not f... |
987,047 | d2ae1daf5cd4fdd594a6f1b376fa0d3623c67a13 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Sotfmax.py
#
# Copyright 2016 DC2 <dc2@UASLP-DC2>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or... |
987,048 | 354cbf65c7a70074edd01d05b2dd762cbffc216c | # -*- coding: utf-8 -*-
"""
Solucion de la ecuacion de calor usando un esquema implicito
@author: Nicolas Guarin-Zapata
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from diferencias import resolver_implicito
niter = 10000
nx = 50
alpha = 1.0
fuente = lambda x: 1
x ... |
987,049 | 20634085137ec945a9317c7b78ed7a1a01bbafd4 | """
Not yet functional.
"""
from argparse import Namespace
from medikit.events import subscribe
from medikit.feature import Feature
from medikit.structs import Script
DEFAULT_NAME = '$(shell echo $(PACKAGE) | tr A-Z a-z)'
DOCKER = 'docker'
ROCKER = 'rocker'
class DockerConfig(Feature.Config):
def __init__(self... |
987,050 | e3b4c4cd60893b64f0554baa380985821f962863 | # Generated by Django 2.0.3 on 2018-03-30 09:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('police', '0002_auto_20180328_1811'),
]
operations = [
migrations.CreateModel(
name='constable',
fields=[
... |
987,051 | 1d422d979cf265f2c8c09b7f0dbca007b7d04da8 | from mypackage import db
class StoreModel(db.Model):
__tablename__= 'stores'
id=db.Column(db.Integer,primary_key=True)
name=db.Column(db.String(80))
#one_to_many
items=db.relationship('ItemModel',backref='stores',lazy='dynamic')
def __init__(self,name):
self.name=name... |
987,052 | c08d5d5d17bd77281c9162e43b51e37bdb1bf4fd | import datetime
from django.conf import settings
from django.test import TestCase
from timepiece import utils
from timepiece.tests import factories
from timepiece.reports.utils import generate_dates
class ReportsTestBase(TestCase):
def setUp(self):
super(ReportsTestBase, self).setUp()
self.use... |
987,053 | 8ab8e012f9a20841b12cc8427cab463192612bef | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
__all__ = ['ToastNotifier']
# #############################################################################
# ########## Libraries #############
# ##################################
# standard... |
987,054 | 1c273967aadd12ca32e7a1e4313e5a6ef424aa8b | from flask import Flask, request, jsonify
import distilbert_model as model
app = Flask(__name__)
@app.route('/')
def hello():
return 'Congrats! Server is working'
# get the json data
@app.route('/get_sentiment', methods = ['POST'])
def get_sentiment():
tx = request.get_json(force = True)
text = tx['Review']
s... |
987,055 | 3b9ef36c5b9a9886d9123dd2510da7d4eaa8ab70 | import sys
import json
import os.path
import colorsys
from PIL import Image,ImageDraw
import numpy as np
def run():
if len(sys.argv) > 1:
imgpath = sys.argv[1]
else:
imgpath = "assets/test/tree.png"
inpImg = Image.open(imgpath)
if inpImg.size != (16,16):
raise Exception("invali... |
987,056 | 9b0255f8dc03dcffc156826fb195f44e649484ef | import numpy as np
import numpy.matlib
import scipy.io as sio
# scale the data to the desired range (default is 0:1)...will work on matrices down columns (i.e. matlab style)
def scaleData(data, minVal=0, maxVal=1):
data = np.asanyarray(data) # this will convert lists/tuples etc to array...if data already an... |
987,057 | 4470a85b2a5261b77efbec6e726bddb110a327b0 | # -*- coding: utf-8 -*-
"""
Created on Sat May 16 12:17:30 2020
@author: Achuth MG
"""
import PyPDF2
pdffileobj = open('C://Users//kotre/Desktop/Chartered-Data-Scientists-Curriculum-2020 (1).pdf','rb')
pdfreader=PyPDF2.PdfFileReader(pdffileobj)
print(pdfreader.getNumPages())
pageobj=pdfreader.getPage(1)
text_in... |
987,058 | 648a1bb966db74db0625e4aa5ada5f4ae29c400f | #!/usr/bin/env python
## This file is part of Scapy
## This program is published under a GPLv2 license
"""
TLS client used in unit tests.
Start our TLS client, send our send_data, and terminate session with an Alert.
Optional cipher_cuite_code and version may be provided as hexadecimal strings
(e.g. c09e for TLS_DHE... |
987,059 | 77724fcd40696209198497a80e74c85f646906c7 | from Implementation import *
from Suduku_entropy import *
import numpy as np
x_y_joint_distribution = np.array([[1/8, 1/16, 1/16, 1/4],
[1/16, 1/8, 1/16, 0],
[1/32, 1/32, 1/16, 0],
[1/32, 1/32, 1/16, 0]])
w_given_... |
987,060 | ddd4ddb0b201709666a2067c23fae24c682556c1 | import re
import random
import jieba
import jieba.posseg as pos
jieba.add_word("放假", tag="n")
def get_rule_list(rule):
rule_list = []
for k in list(rule.keys()):
rule_list.append(''.join(re.findall('x(.*?)\?', k)))
for i in range(len(rule_list) - 1): # 冒泡排序,最大匹配
for j in ran... |
987,061 | 5d33ca50114ab5be0764237c359b513a3b7dc282 | import json
from models import *
from database import *
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for, jsonify
)
#success response
def success(obj):
return jsonify({'code':0,'msg':'success','data':obj}), 200
#failed response
def failed(code,msg):
return jso... |
987,062 | a4bfb72529025b462ed384d82b994182ecf5957a | import pytest
import duckdb
class TestExplain(object):
def test_explain_basic(self):
res = duckdb.sql('select 42').explain()
assert isinstance(res, str)
def test_explain_standard(self):
res = duckdb.sql('select 42').explain('standard')
assert isinstance(res, str)
res ... |
987,063 | e5942fba96c4239c1e919c83b597c9712991d9aa | import requests
from lxml import etree
url = "http://www.36yeye.com/search.asp"
datas = {"type":"vedio","searchword":"教师".encode("gbk")}
responses = requests.post(url,data=datas)
responses_html = etree.HTML(responses.content.decode("gbk"))
page_elements = responses_html.xpath('//div[@class="pagination"]/ul/li')
page_u... |
987,064 | e6118bc8036f7e6051af60122c32395253f16686 | # -*- coding: utf-8 -*-
__author__ = 'Javier Andrés Mansilla'
__email__ = 'javimansilla@gmail.com'
__version__ = '0.1.0'
import logging
def basicConfig(**kwargs):
options = {'level': logging.INFO,
'format': "%(name)s %(levelname)s %(asctime)s - %(message)s"
}
options.update(kwargs)
loggi... |
987,065 | c59c4d1e2f3e81341d40170a5de9760c83804753 | import shelve
berkas = open('L200190180.txt', 'r')
F = shelve.open('kegiatan1.data')
print (F['Data'][2])
print (F['Data'][0])
print (F['Data'][1])
|
987,066 | 0c9ab97bc28b7a02d57cb3f1c8312a7e96c78f20 | from flask import Flask
import requests
import string
import os
import urllib
# reinitialising my file
f = open("listing.txt", "w")
f.write("")
f.close()
# request the list of metadata and convert it to string then split the content in to list
resp= requests.get("http://169.254.169.254/latest/meta-data/")
getco... |
987,067 | db9c8bbc85909701296c2564c723abe729a578eb | from django.db.models import Count
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.models import City, CityFact, CityImage, CityVisitLog
from api.modules.city.serializers import AllCitiesSerializer, CitySerializer, CityImageSerializ... |
987,068 | deb8761f8ee53f3ae682e4c961a405048613f306 | from django.conf import settings
from sentry.utils.services import LazyServiceWrapper
from .base import StringIndexer
backend = LazyServiceWrapper(
StringIndexer,
settings.SENTRY_METRICS_INDEXER,
settings.SENTRY_METRICS_INDEXER_OPTIONS,
)
backend.expose(locals())
from typing import TYPE_CHECKING
if TYP... |
987,069 | 314e7e7c48ed5dc6a4085cc9ecd3c42ff5ac8b80 | # Original algorithm by gdkchan
# Ported and improved (a tiny bit) by Stella/AboodXD
BCn_formats = [0x42, 0x43, 0x44, 0x49, 0x4a, 0x4b, 0x4c]
bpps = {0x25: 4, 0x38: 4, 0x3d: 4, 0x3c: 2, 0x3b: 2, 0x39: 2, 1: 1, 0xd: 2,
0x42: 8, 0x43: 16,0x44: 16, 0x49: 8, 0x4a: 8, 0x4b: 16, 0x4c: 16}
xBases = {1: 4, 2: 3, 4: ... |
987,070 | 69608e002cdabe2d13338c3285477cae31e0994d | #!/usr/bin/python3
import random
x = []
for _ in range(4):
x.append(str(random.randint(1,10)))
print(' '.join(x)) |
987,071 | aa9765d793f00d7b9d71c79a80b68d9ada59f177 | import sys
import imp
import os
MEMORY_LAYPUT = '''
MEMORY
{
ram : ORIGIN = 0x%x, LENGTH = 0x%x
}
'''
LDS_FORMAT1 = '''
SECTIONS
{
. = 0x%(text_addr)x;
.text : { *(.text) }
.data : { *(.data) }
%(other_sections)s
}
'''
LDS_FORMAT2 = '''
SECTIONS
{
.text : { *(.text) } > ram
.data : { *... |
987,072 | 58466ee3935c4aec18684b164a07bbb3552b0327 | #!/usr/bin/env vpython
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Script for determining which tests are unexpectedly passing.
This is particularly of use for GPU tests, where flakiness is heavily... |
987,073 | 7720dae211df98d13df5a37fbbcb74157644c05a | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^backend/loginAction/', 'backend.views.loginAction'),
url(r'^backend/quitAction/', 'backend.views.quitAction'),
url(r'^backend/getNewsList/', '... |
987,074 | c166f0379d819bc40e4afe84e0024e7c543510c1 | from os import environ
from pathlib import Path
import numpy as np
import torch
data_root_path = Path(environ.get('DATA_PATH', './data'))
def random_mask_from_state(x):
return torch.randint(0, 2, size=x.shape, device=x.device)
def mask_idx_to_mask(n, i):
i = np.asarray(i)
assert np.all(i < 2**n)
... |
987,075 | 1eec195a1c7c6642bc9e96609e68ca1874b2c135 | import SocketServer
import socket
class EchoHandler(SocketServer.BaseRequestHandler):
def handle(self):
print "Got connection from : " , self.client_address
data = "sandeep"
while len(data):
data = self.request.recv(1024)
print "Client Send: " + data
se... |
987,076 | 92de29fc65463d958007f3db582f32469cc6e4c4 | import time
import os.path
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Pylint code to name mapping: https://github.com/janjur/readable-pylint-messages
from behave import * # pylint:disable=wildcard-import,unused-wildcard-import
from webdriver_... |
987,077 | 7fa161da0010b392af7b449c5590c1146f97de90 | #! /usr/bin/env python
# -*- coding:utf-8 -*-
"""
北京中学信息爬取
"""
import csv
import requests
import pymongo
from gevent.pool import Pool
import json
import re
from copy import deepcopy
from lxml import etree
import sys
HEADERS = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gec... |
987,078 | 6ac88feab39667fbd791cb195fd0e3684f7db41a | import xlsxwriter
from use_def import handle_text
from use_class import *
from codon_table import *
from codon import *
#from enc import *
from rscu import RSCU
#from basic_index import BASIC_INDEX
import sys
file = sys.argv[1] #
f = open(file,"r")
#f = open("cds","r") #
#file = "cds"
gene_text = f.read()
gene_objs ... |
987,079 | 64607ebda6c5a8318bf2a4a9891d076d2f7253f4 | from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import random
pt_cloud = []
with open("pt_cloud_experiment.asc") as file:
next(file)
next(file)
for row in file:
pt_cloud.append(row.strip().split(" "))
pt_cloud = np.array(pt_cloud, dtype=np.float64)
pt_cl... |
987,080 | 2a1dfdc7dbe3ae29a9db7c04f2748c07e47c28d4 | import re
phone_list = ["555-555-5555","555 555 5555","555.555.5555",
"(555) 555-5555","(555)555-5555","(555)555.5555"]
pattern = r'\D'
for phone in phone_list:
phone_num = re.sub(pattern, "", phone)
print "Phone Num : ", phone_num
|
987,081 | 4d858878bb6ec3ea37361e003ddea433cf86aa36 | #!/usr/bin/env python
#######################################################################
# This file is part of Fusuma website management system.
#
# Copyright (c) hylom <hylomm at gmail.com>, 2008.
#
# This file is released under the GPL.
#
# $Id: TemplateMan.py,v 1.6 2009/01/04 18:27:48 hylom Exp $
############... |
987,082 | 823beed0983176628e2bd097312f71ad2733d5bd | # Generated by Django 3.1.1 on 2020-11-06 17:33
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0003_auto_20201106_2118'),
]
operations = [
migrations.AlterField(
model_name='accou... |
987,083 | 590e6a53b4eaf541daf4dacbcf79fab4671b1236 | from datetime import datetime
from flask import request, render_template, session, redirect, url_for, abort
from enums.enums import UserRole, EventStatus, Gender
from models.event import Event
from models.forms.edit_settings_form import EditSettingsForm, EditSettingsNoPasswordForm
from models.forms.event_form import ... |
987,084 | 31d6bf0e463098818f6396688700536f3929c2a2 | # generated with class generator.python.order_factory$Factory
from marketsim import registry
from marketsim.gen._out._ifunction._ifunctionside import IFunctionSide
from marketsim.gen._out._iobservable._iobservableiorder import IObservableIOrder
from marketsim.gen._out._ifunction._ifunctionfloat import IFunctionfloat
fr... |
987,085 | baef19784218c93db4463b90f75d80c5bf872b51 | from collections import Counter
most_frequent=lambda data:Counter(data).most_common(1)[0]
|
987,086 | 9a49b85212d0174b7d235d0cbfc4b8eba8e859bb | """
The :class:`.Session` class provides TinyAPI's core functionality. It manages the authentication cookies and token for all requests to TinyLetter's undocumented API.
"""
import requests
import re
import json
from .draft import Draft
URL = "https://app.tinyletter.com/__svcbus__/"
DEFAULT_MESSAGE_STATUSES = [
... |
987,087 | 2b505005709fe6dd042daa080c72a26a71467da5 | from .customization import *
|
987,088 | b7f3e527ebd7ad313b0908723783b50d0d395a85 | import logging
import threading
from typing import List
from django.core.mail import EmailMessage
from mailer.exceptions import EmailError
logger = logging.getLogger(__name__)
class EmailSender(threading.Thread):
def __init__(self, messages: List[EmailMessage]):
super().__init__()
for message i... |
987,089 | 956ecac299b5ff44d28b5a631978a16724531e00 | import numpy as np
from pymoo.model.survival import Survival, split_by_feasibility
from pymoo.util.mathematics import Mathematics
from pymoo.util.non_dominated_sorting import NonDominatedSorting
from pymoo.util.randomized_argsort import randomized_argsort
class RankAndCrowdingSurvival(Survival):
def _do(self, po... |
987,090 | 200dc0c8bc63942e81598e1d36e2f83c52743a4f | import asyncio
import time
import pytest
from google.protobuf import json_format
from grpc import RpcError
from jina.parsers import set_pea_parser
from jina.peapods.grpc import Grpclet
from jina.proto import jina_pb2
from jina.types.message.common import ControlMessage
@pytest.mark.slow
@pytest.mark.asyncio
@pytest... |
987,091 | d7ea2ea0828ca0957e8632ea1159708e77c15ff5 | from django.contrib import admin
# Register your models here.
from .models import User
from .models import Userfile, Ordremission, Message, Envoi
admin.site.register(User)
admin.site.register(Userfile)
admin.site.register(Ordremission)
admin.site.register(Envoi)
admin.site.register(Message) |
987,092 | 2edd826f8b0ce18093c8385f3cc8a007f07266a0 | #import sys
#input = sys.stdin.readline
from math import sqrt
def main():
N = int( input())
SX = [0 for _ in range(4)]
SY = [0 for _ in range(4)]
x_plus = 0
x_minus = 0
y_plus = 0
y_minus = 0
for _ in range(N):
x, y = map( int, input().split())
if x >= 0:
if y... |
987,093 | 2a4e57c3b7ff19731af2715bb8e60b13a4537e0b | """" Module used in order to extract Marshmallow validation errors to pyBabel """
from gettext import gettext
def get_translations():
return [
gettext('Missing data for required field.'),
]
|
987,094 | 567b0bd3aa207ec17a0504619ce169ab508ba670 | # -*- coding: utf-8 -*-
"""
The sequence of triangle numbers is generated by adding the natural numbers.
So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.
The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
... |
987,095 | 62b54c37c09eca77dad4cf52664d28a548df9a58 | #
# Example file for working with date information
#
from datetime import date
from datetime import time
from datetime import datetime
from datetime import timedelta
def main():
# ## DATE OBJECTS
# # Get today's date from the simple today() method from the date class
# day = date.today()
# print("Todays date ... |
987,096 | 89eecf9daaff0f4a9d56db2f73d712da7af4a0f1 | def triangle():
print(" /\\\n/ \\\n----")
def rectangle():
print("+--+\n| |\n| |\n+--+")
|
987,097 | d6066e40b31230d089c6b44e641f4a93d379c94c | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-05-06 04:07
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.Crea... |
987,098 | b44961ca679df134aae82e4898ff6316bc005426 | from django.conf.urls import url, include
from . import views
urlpatterns = [
url(r'^query_by_pos/$', views.query_by_pos, name='query_by_pos'),
url(r'^query_by_name/$', views.query_by_name, name='query_by_name'),
url(r'^query_by_name/result$', views.query_by_name, name='query_by_name_result'),
url(r'^... |
987,099 | c746aaade1b8437998ee1c3ff96291237c657981 | from django.conf.urls import patterns, url
from encuestas import views
urlpatterns = patterns('',
url(r'^$', views.index, name="index"),
url(r'^(?P<encuesta_id>\d+)/$', views.detalles, name="detalles"),
url(r'^(?P<encuesta_id>\d+)/resultados/$', views.resultados, name="resultados"),
url(r'^(?P<encuesta_id>\d+)/v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.