index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
3,300 | 11072601e31ceba13f8adf6c070f84ca5add35e9 | # 5/1/2020
# Import median function from numpy
import numpy as np
from numpy import median
# Plot the median number of absences instead of the mean
sns.catplot(x="romantic", y="absences",
data=student_data,
kind="point",
hue="school",
ci=None,
estimator = median)
# S... |
3,301 | 6ca7b896cc20220f790c06d4ba08fef7bda8400f | # test CurlypivSetup
"""
Notes about program
"""
# 1.0 import modules
import numpy as np
from skimage import io
import glob
from os.path import join
import matplotlib.pyplot as plt
from curlypiv.utils.calibrateCamera import measureIlluminationDistributionXY, calculate_depth_of_correlation, calculate_darkfield, plot_fi... |
3,302 | 3ea123aceb72e4731afe98cf4c5beced2d424035 | from django.conf.urls import url
from tipz import views
urlpatterns = [
# /tipz/
url(r'^$', views.IndexView.as_view(), name='index'),
# /tipz/login
url(r'^login/$', views.LoginFormView.as_view(), name='login'),
# /tipz/logout
url(r'^logout/$', views.LogoutFormView.as_view(), name='logout'),
... |
3,303 | 0d32fe36f71ffb3df56738664c5dbd0b8ae585e3 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 19 17:15:58 2021
@author: Professional
"""
#son = int(input("Biror son kiriting: ") )
#print(son, "ning kvadrati", son*son, "ga teng")
#print (son, "ning kubi", son*son*son, "ga teng")
#yosh = int(input("Yoshingiz nechida: "))
#print("Siz", 2021 - yosh, "yil... |
3,304 | 442c6c4894fc01d0f8142f3dcedfd51ba57aedd1 | from enum import Enum
from typing import List, Optional
from pydantic import BaseModel
class Sizes(str, Enum):
one_gram = "1g"
two_and_half_gram = "2.5g"
one_ounce = "1oz"
five_ounce = "5oz"
ten_ounce = "10oz"
class PriceSort(str, Enum):
gte = "gte"
lte = "lte"
class Metals(str, Enum):... |
3,305 | ec625bf57388281b3cbd464459fc3ad1c60b7db9 | '''
多线程更新UI数据(在两个线程中传递数据)
'''
from PyQt5.QtCore import QThread , pyqtSignal, QDateTime
from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit
import time
import sys
class BackendThread(QThread):
update_date = pyqtSignal(str)
def run(self):
while True:
data = QDateTime.current... |
3,306 | 3657d02271a27c150f4c67d67a2a25886b00c593 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 1 11:06:35 2020
@author: fitec
"""
# version 1
print(" Début du projet covid-19 !! ")
print(" test repository distant")
|
3,307 | acf69cd714f04aeceb4be39b8a7b2bc5d77cd69f | from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE
from sqlalchemy.orm import relationship
from database import Base
class User(Base):
__tablename__ = "users"
username = Column(String, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
name = Column(... |
3,308 | 63830a3c09a2d0a267b030a336062d5e95b9a71a | from django.urls import path
from . import views
app_name = 'restuarant'
urlpatterns = [
path('orderplaced/',views.orderplaced),
path('restaurant/',views.restuarent,name='restuarant'),
path('login/restaurant/',views.restLogin,name='rlogin'),
path('register/restaurant/',views.restRegister,name='rregister... |
3,309 | 1cc8695aa694359314b6d478fe6abed29fdc6c91 |
def DFS(x):
# 전위순회
if x > 7:
return
else:
DFS((x * 2))
print(x)
DFS((x*2)+1)
if __name__ == "__main__":
DFS(1) |
3,310 | 67eb9985fc0ae9a00ce84a2460b69b00df1c9096 | # Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client
account_sid = 'AC76d9b17b2c23170b7019924f709f366b'
auth_token = '8fba7a54c6e3dc3754043b3865fa9d82'
client = Client(account_sid, auth_token)
user_sample = [
{
"_id": "5e804c501c9d440000986adc",
"name"... |
3,311 | abb2cfd2113e8de6c7bba42c357f0ec140b224a9 | from scrapy import cmdline
cmdline.execute("scrapy crawl ariz".split()) |
3,312 | e5979aeb7cff0e2a75966924382bae87aebcfcb2 | from random import random
def random_numbers():
print('start generator')
while True:
val = random()
print(f'will yield {val}')
yield val
def run_random_numbers():
print(f'{random_numbers=}')
rnd_gen = random_numbers()
print(f'{rnd_gen=}')
print(f'{next(rnd_gen)=}')
... |
3,313 | 63822d60ef9dcc1e123a3d20874e9f492b439c6d | #! /usr/bin/env python3
# -*- coding:utf-8 -*-
"""
企查查-行政许可[工商局]
"""
import json
import time
import random
import requests
from lxml import etree
from support.use_mysql import QccMysql as db
from support.others import DealKey as dk
from support.others import TimeInfo as tm
from support.headers import GeneralHeaders a... |
3,314 | ae71cbd17ec04125354d5aac1cf800f2dffa3e04 | # new libraries
import ConfigParser
import logging
from time import time
from os import path
# imports from nike.py below
import smass
import helperFunctions
import clusterSMass_orig
import numpy as np
from joblib import Parallel, delayed
def getConfig(section, item, boolean=False,
userConfigFile="BMA_StellarMass_C... |
3,315 | 3d0fe0c11e62a03b4701efb19e1c15272ccc985e | """
Batch viewset
Viewset to batch serializer
"""
# Django Rest Framework
from rest_framework import viewsets
# Inventory models
from apps.inventory.models import Batch
# Inventory serializers
from apps.inventory.serializers import BatchSerializer
class BatchViewSet(viewsets.ModelViewSet):
"""
Batch views... |
3,316 | 5485fe4f612ededc11e3a96dfd546e97a56cbe2a | # Generated by Django 2.2.5 on 2019-10-09 12:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MOD... |
3,317 | fa045ccd4e54332f6c05bf64e3318e05b8123a10 | # Generated by Django 2.2.13 on 2021-08-11 15:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("notifications", "0011_auto_20171229_1747"),
]
operations = [
migrations.AlterField(
model_name="notification",
name... |
3,318 | 7a2b33d1763e66335c6a72a35082e20725cab03d | # -*- coding:utf-8 -*-
#
from django.core.paginator import Paginator
def pagination(request, queryset, display_amount=15, after_range_num=5, bevor_range_num=4):
# 按参数分页
paginator = Paginator(queryset, display_amount)
try:
# 得到request中的page参数
page = int(request.GET['page'])
except:
... |
3,319 | 07aafcb3db9c57ad09a29a827d72744ef0d22247 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from eight import *
from whoosh.fields import TEXT, ID, Schema
bw2_schema = Schema(
name=TEXT(stored=True, sortable=True),
comment=TEXT(stored=True),
product=TEXT(stored=True, sortable=True),
categories=TEXT(stored=True),
... |
3,320 | 33c241747062ab0d374082d2a8179335503fa212 | """ Problem statement:
https://leetcode.com/problems/contains-duplicate-ii/description/
Given an array of integers and an integer k, find out whether
there are two distinct indices i and j in the array such that nums[i] = nums[j]
and the absolute difference between i and j is at most k.
"""
class Solution:
def c... |
3,321 | 05454cc6c9961aa5e0de6979bb546342f5bd7b79 | # The following code causes an infinite loop. Can you figure out what’s missing and how to fix it?
# def print_range(start, end):
# # Loop through the numbers from start to end
# n = start
# while n <= end:
# print(n)
# print_range(1, 5) # Should print 1 2 3 4 5 (each number on its own line)
# Solution
# Vari... |
3,322 | 8ee26d181f06a2caf2b2b5a71a6113c245a89c03 | #!/usr/bin/python
# -*- coding : utf-8 -*-
"""
@author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com>
"""
# Director
class Director(object):
def __init__(self):
self.builder = None
def construct_building(self):
self.builder.new_building()
self.builder.build_floor... |
3,323 | d1402469232b5e3c3b09339849f6899e009fd74b | # -*- coding: utf-8 -*-
scheme = 'http'
hostname = 'localhost'
port = 9000
routes = [
'/available/2',
'/available/4'
]
|
3,324 | b8c749052af0061373808addea3ad419c35e1a29 | v1=int(input("Introdu virsta primei persoane"))
v2=int(input("Introdu virsta persoanei a doua"))
v3=int(input("Introdu virsta persoanei a treia"))
if ((v1>18)and(v1<60)):
print(v1)
elif((v2>18)and(v2<60)):
print(v2)
elif((v3>18)and(v3<60)):
print(v3) |
3,325 | e12c411814efd7cc7417174b51f0f756589ca40b | was=input()
print(was)
|
3,326 | 4ba0f7e947830018695c8c9e68a96426f49b4b5b | from ddt import ddt, data, unpack
import sys
sys.path.append("..")
from pages.homepage import HomePage
from base.basetestcase import BaseTestCase
from helpers.filedatahelper import get_data
@ddt
class QuickSearchTest(BaseTestCase):
testingdata = get_data('testdata/QuickSearchTestData.xlsx')
@data(*testingdata... |
3,327 | 896329a8b14d79f849e4a8c31c697f3981395790 | # 문제 풀이 진행중..(나중에 재도전)
import collections
class Solution(object):
def removeStones(self, stones):
"""
:type stones: List[List[int]]
:rtype: int
"""
# 전체 연결점 개수 확인한다.
# 개수가 적은 것 부터 처리한다
# # 연결된 게 0개인 애들은 제외
#
# data init
stones_share_li... |
3,328 | 7db31940aea27c10057e2ce1e02410994bd2039b | from ROOT import *
import math
import os,sys,time,glob,fnmatch
import argparse
import ROOT
import sys
sys.path.append("utils")
from moments import *
from dirhandle import *
from plothandle import *
from AnalysisGeneratorMT import *
def doAnalysis( blabla):
return blabla.DoThreatdAnalysis()
if __name__ =... |
3,329 | 60617ff6eda880e5467b3b79d3df13a7147f5990 | import math
def sieve(n):
sieve = [1] * (n+1)
sieve[1] = 0
sieve[0] = 0
for i in range(2, int(math.sqrt(n) + 1)):
if sieve[i] == 1:
for j in range(i*i, n + 1, i):
sieve[j] = 0
return sieve
def odd_prime(a):
while a != 0:
y = a % 10
if y == 3 ... |
3,330 | c925bed2f4d8120e156caebbe8e6bf9d6a51ee37 | import csv
import glob
import random
import sys
from math import ceil, floor
from os.path import basename, exists, dirname, isfile
import numpy as np
import keras
from keras import Model, Input, regularizers
from keras.layers import TimeDistributed, LSTMCell, Reshape, Dense, Lambda, Dropout, Concatenate
from keras.cal... |
3,331 | 10990282c8aa0b9b26a69e451132ff37257acbc6 | from django.views.generic import ListView
class ExperimentList(ListView):
pass
|
3,332 | 09698649510348f92ea3b83f89ffa1c844929b8f | import numpy
def CALCB1(NVAC,KGAS,LGAS,ELECEN,ISHELL,L1):
# IMPLICIT #real*8(A-H,O-Z)
# IMPLICIT #integer*8(I-N)
#CHARACTER*6
# SCR=""#(17)
# SCR1=""#(17)
#COMMON/GENCAS/
global ELEV#[17,79]
global NSDEG#(17)
global AA#[17]
global BB#[17]
global SCR,SCR1
#COMMON/MIXC/
global PRSH#(6,3,17,17)
global ESH#(6... |
3,333 | 9c85252b4048b5412978b3ac05cd6dde4479e3bf | from ctypes import CDLL
svg2pdf = CDLL("./libsvg2pdf.so")
svg2pdf.svg2pdf("report.svg", "teste2.pdf")
svg2pdf.svg2pdf2("report.svg", "teste3.pdf")
|
3,334 | 61b28088e4344d8a94006e5c04c189a44bbb6ff3 | #!c:\Python\python.exe
# Fig 35.16: fig35_16.py
# Program to display CGI environment variables
import os
import cgi
print "Content-type: text/html"
print
print """<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">"""
print """
<html xmlns = "http://www... |
3,335 | 8de82d09c8a9a1c1db59b0cac9cf8dda04f35847 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
import json
import os
import convlab
from convlab.modules.dst.multiwoz.dst_util import init_state
from convlab.modules.dst.multiwoz.dst_util import normalize_value
from convlab.modules.dst.state_tracker import Tracker
from convlab.mo... |
3,336 | 6e6c6c5795e8723a86ae5dfc8f40df57d3dd10f7 | #!/usr/bin/env python
import argparse
import csv
import glob
import os
import sys
def run_main():
"""
Main function to process user input and then generate the description files for each run
:return: exit code -- 0 on success, 1 otherwise
"""
parser = argparse.ArgumentParser(description="Scan a... |
3,337 | 00587de133ee68415f31649f147fbff7e9bf65d5 | # Print name and marks
f = open("marks.txt", "rt")
for line in f:
line = line.strip()
if len(line) == 0: # Blank line
continue
name, *marks = line.split(",")
if len(marks) == 0:
continue
marks = filter(str.isdigit, marks) # Take only numbers
total = sum(map(int, marks)) ... |
3,338 | 0dd17d8872b251fbc59a322bf3c695bd8079aba4 | #-*- coding: utf-8 -*-
"""
Django settings for HyperKitty + Postorius
Pay attention to settings ALLOWED_HOSTS and DATABASES!
"""
from os.path import abspath, dirname, join as joinpath
from ConfigParser import SafeConfigParser
def read_cfg(path, section=None, option=None):
config = SafeConfigParser()
config.r... |
3,339 | 894fa01e16d200add20f614fd4a5ee9071777db9 | # -*- coding: utf-8 -*-
from scrapy import Request
from ..items import ZhilianSpiderItem
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from scrapy_redis.spiders import RedisCrawlSpider
class ZhilianSpider(RedisCrawlSpider):
name = 'zhilianspider'
headers = {
'User-Ag... |
3,340 | 8435a69ee9793435c7483df9bb15f01ef8051479 | movies = ["Abraham Lincoln", "Blue Steel", "Behind Office Doors", "Bowery at Midnight", "Captain Kidd", "Debbie Does Dallas", "The Emperor Jones", "Rain"]
movies_tuple = [("Abraham Lincoln", 1993), ("Blue Steel", 1938), ("Behind Office Doors", 1999), ("Bowery at Midnight", 2000), ("Captain Kidd",2010), ("Debbie Does D... |
3,341 | 97bbbbe6a3a89b9acc22ebdff0b96625d6267178 | import numpy as np
import itertools as itt
from random import random
from sys import float_info
DIGITS = 3
ACCURACY = 0.001
UP_MAX = 30
class AngleInfo(object):
def __init__(self, information):
# 0 <= spin <= 360
# 0 <= up <= UP_MAX
# -1 <= sin, cos <= 1
if len(information) == 2:
... |
3,342 | 6d244b719200ae2a9c1a738e746e8c401f8ba4e2 | from django.conf.urls.defaults import *
## reports view
urlpatterns = patterns('commtrack_reports.views',
(r'^commtrackreports$', 'reports'),
(r'^sampling_points$', 'sampling_points'),
(r'^commtrack_testers$', 'testers'),
(r'^date_range$', 'date_range'),
(r'^create_report$', 'create_report'),
(... |
3,343 | d7daf9b26f0b9f66b15b8533df032d17719e548b | """
This is a post login API and hence would have APIDetails and SessionDetails in the request object
-------------------------------------------------------------------------------------------------
Step 1: find if user's ip address is provided in the request object, if yes then got to step 2 else goto step 4
Step 2: ... |
3,344 | 9cb3d8bc7af0061047136d57abfe68cbb5ae0cd7 | '''给定一个只包含小写字母的有序数组letters 和一个目标字母 target,寻找有序数组里面比目标字母大的最小字母。
数组里字母的顺序是循环的。举个例子,如果目标字母target = 'z' 并且有序数组为 letters = ['a', 'b'],则答案返回 'a'。输入:
示例:
letters = ["c", "f", "j"]
target = "a"
输出: "c"
'''
class Solution(object):
def nextGreatestLetter(self, letters, target):
"""
:type letters: List[str]
... |
3,345 | 00f95733505b3e853a76bbdd65439bcb230fa262 | import subprocess
import glob
import os
import time
import sys
import xml.etree.ElementTree as ET
import getpass
import psutil
if len(sys.argv)==1:
photoscanname = r"C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe"
scriptname = r"C:\Users\slocumr\github\SimUAS\batchphotoscan\agiproc.py"
#xmlnames ... |
3,346 | 1c6077d965f5bc8c03344b53d11851f5cd50bca8 | from Task2.src.EmailInterpreter import EmailInterpreter
import os
# Part B:
# -------
# Write a child-class of the previously written base class, which
# implements the 'split_file' function, simply by treating each line as a
# unit (it returns the list of lines).
class LineBreaker(EmailInterpreter):
def split_file... |
3,347 | b091d00f5b5e997de87b36adbe9ce603a36ca49c | from django.apps import AppConfig
class ScambioConfig(AppConfig):
name = 'scambio'
|
3,348 | 2a6b373c443a1bbafe644cb770bc163536dd5573 | ###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... |
3,349 | 73a4b3497952f90029ba24b73b835de53fc687ec | import constants
from auth.storage import Storage
from utils import create_error_with_status
from flask import jsonify, request, current_app
def register_user():
try:
email = request.json["email"]
password = request.json["password"]
except KeyError:
status = constants.statuses["user"... |
3,350 | 6bd47fb71a32b8383a75e72111d802008bc6bc68 |
# coding: utf-8
# In[2]:
from HSTLens_base_classifier_resnet17_s import BaseKerasClassifier
from keras.layers import Activation, AveragePooling2D, MaxPooling2D
from keras.layers import Conv2D, ELU, Dropout, LeakyReLU
from keras.layers.normalization import BatchNormalization
class deeplens_classifier(BaseKerasCl... |
3,351 | f3da38f2c4fda0a1d54e79c2c21070f98002b88d | # -*- coding=utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
3,352 | 85fff1f6e1f69dd0e2e9b5acc90db31d27329c7c | from django import forms
class PasswordChangeForm(forms.Form):
password = forms.CharField(min_length=8,
label="New Password*",
strip=False,
widget=forms.PasswordInput(
attrs={'autocomple... |
3,353 | 70fcf25cd7d70972e8042dc882f6ecb12d36461a | from django.shortcuts import render,redirect,get_object_or_404
from .models import Blog,UseCase,Comment
from courses.models import offerings
from django.contrib.auth.models import User
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.utils import timezone
from django... |
3,354 | 8205541dcdd4627a535b14c6775f04b80e7c0d15 | '''
Created on Dec 23, 2011
@author: boatkrap
'''
import kombu
from kombu.common import maybe_declare
from . import queues
import logging
logger = logging.getLogger(__name__)
import threading
cc = threading.Condition()
class Publisher:
def __init__(self, exchange_name, channel, routing_key=None):
s... |
3,355 | e2e34db52e17c188cab63a870f0bc77cbc9ef922 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
import helper as hp
def insertion_sort(items, start, end):
"""
Arguments:
- `items`:
"""
n = end - start + 1
for i in range(start+1, end+1):
for j in range(i, start, -1):
if items[j] < items[j-1]:
... |
3,356 | 96910e9b6861fc9af0db3a3130d898fd1ee3daad | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 foree <foree@foree-pc>
#
# Distributed under terms of the MIT license.
"""
配置logging的基本配置
"""
import logging
import sys
import os
from common.common import get_root_path
FILE_LEVEL = logging.DEBUG
STREAM_LEVEL = logging.WARN
LOG_DIR = ... |
3,357 | e533b7aadd1cd7137301af8862dd2987622e499e | #!/bin/env python
from boincvm_common.stomp.StompProtocol import StompProtocolFactory
from stomp.HostStompEngine import HostStompEngine
from boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService
from twisted.internet import reactor
from ConfigParser import SafeConfigParser
import coilmq.start
import loggi... |
3,358 | fcfec521e071aa586febc74efb2deb0e9d0a331e | from sys import stdin
def IsPrime(x):
for i in range(2, int(x ** 0.5) + 1):
if not x % i:
return False
return True
for x in stdin:
x = x[:-1]
y = x[::-1]
a = IsPrime(int(x))
b = IsPrime(int(y))
if not a:
print("%s is not prime." %x)
elif (a and not ... |
3,359 | 0065a493767a2080a20f8b55f76ddeae92dc27f1 | /home/mitchellwoodbine/Documents/github/getargs/GetArgs.py |
3,360 | 1ab5c6a56ac229c5a9892a9848c62a9a19a0dda7 | print('\n----------------概率与统计--------------------')
import numpy as np
import scipy
import sympy as sym
import matplotlib.pyplot as plt
import sklearn.datasets as sd
iris = sd.load_iris()
x1 = np.random.random([10000]) # 均匀分布
x2 = np.random.normal(2, 1, [10000]) # 正态分布
x3 = np.random.normal(5, 1, [10000]) # 正态分布
#... |
3,361 | 7b9bf791d52fdc801e24d0c8541d77d91a488e12 | from typing import Any, Sequence, Callable, Union, Optional
import pandas as pd
import numpy as np
from .taglov import TagLoV
def which_lov(series: pd.Series,
patterns: Sequence[Sequence[Any]],
method: Optional[Union[Callable, str]] = None,
**kwargs) -> np.ndarray:
"""Whi... |
3,362 | 85c51f155439ff0cb570faafc48ac8da094515bf | # the age of some survivors
survived_age = [48.0, 15.0, 40.0, 36.0, 47.0, \
32.0, 60.0, 31.0, 17.0, 36.0, 39.0, 36.0, 32.5, \
39.0, 38.0, 36.0, 52.0, 29.0, 35.0, 35.0, 49.0, \
16.0, 27.0, 22.0, 27.0, 35.0, 3.0, 11.0, 36.0, \
1.0, 19.0, 24.0, 33.0, 43.0, 24.0, 32.0, 49.0, \
30.0, 49.0, 60.0, 23.0, 26.0, 24.0, 40.0, 25.0... |
3,363 | 49703775da87e8cbbe78a69c91a68128c3fd78e1 | from django.shortcuts import render, redirect
from .models import League, Team, Player
from django.db.models import Count
from . import team_maker
def index(request):
baseball = League.objects.filter(name__contains='Baseball')
women_league = League.objects.filter(name__contains='women')
hockey_league = ... |
3,364 | 68fa47e528e5c7c553c3c49ee5b7372b8a956302 | import socket
import struct
from fsuipc_airspaces.position import Position
# Adapted from tools/faker.js in github.com/foucdeg/airspaces
_START_BUFFER = bytes([68, 65, 84, 65, 60, 20, 0, 0, 0])
_END_BUFFER = bytes([0] * 20)
_START_TRANSPONDER = bytes([104, 0, 0, 0, 0, 0, 0, 0])
_END_TRANSPONDER = bytes([0] * 24)
d... |
3,365 | 362bfc5a35b09817ce071e71a72e574a28ea287d | from itertools import groupby
def solve(tribes):
attacks = []
for t in tribes:
D, N, W, E, S, DD, DP, DS = t
for i in range(N):
d = D + DD * i
w = W + DP * i
e = E + DP * i
s = S + DS * i
attacks.append((d, w, e, s))
attacks = sort... |
3,366 | 958f6e539f9f68892d77b6becc387581c6adfa16 | """
Tests for the Transformer RNNCell.
"""
import pytest
import numpy as np
import tensorflow as tf
from .transformer import positional_encoding, transformer_layer
from .cell import (LimitedTransformerCell, UnlimitedTransformerCell,
inject_at_timestep, sequence_masks)
def test_inject_at_timestep... |
3,367 | c6b80a7dfce501bfe91f818ac7ab45238a0a126b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import enhancedyaml
import vector
def roots_of_n_poly_eq(n, x, var_upper_bounds=tuple()):
'''find the all possible non-negative interger roots of a `n`-term polynomial equals `x`.'''
countdown = lambda: xrange(x if not var_upper_bounds else var_upper_bounds[0], -... |
3,368 | 1f40c0ed8e449354a5a87ef18bb07978a9fb8a1c | #!/usr/bin/env python
import utils
def revcomp(s):
comp = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}
return ''.join([comp[c] for c in reversed(s)])
def reverse_palindromes(s):
results = []
l = len(s)
for i in range(l):
for j in range(4, 13):
if i + j > l:
continue
... |
3,369 | a3fc624d6d101667ab11842eac96ed1b34d4317e | from django.apps import AppConfig
class AccountsnConfig(AppConfig):
name = 'accounts'
|
3,370 | 1c8b843174521f1056e2bac472c87d0b5ec9603e | #!/usr/bin/python
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
occl_frac = 0.445188
result = [1-occl_frac, occl_frac, 0]
#Reading res_data.txt
mnfa = [0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9] #min NN factor array
nna = [2,3,4,5,6,7,8,9,10,11,12,1... |
3,371 | c0bf146ebfdb54cce80ef85c4c7f4a61632e67d4 | # Generated by Django 3.0.2 on 2020-02-18 05:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0003_admin'),
]
operations = [
migrations.DeleteModel(
name='admin',
),
migrations.RemoveField(
mod... |
3,372 | f26b127b4d968c1a168a57825a5acfffbf027bef | # -*- coding: utf-8 -*-
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
purchase_type = fields.Many2one('purchase.order.type', string='Purchase Order Type')
|
3,373 | f9a0c3b643c2ee6bb6778477bf8fc21564812081 | # -*- coding: utf-8 -*-
# @Time : 2019/9/17 17:48
# @Author : ZhangYang
# @Email : ian.zhang.88@outlook.com
from functools import wraps
def create_new_sequence_node(zk_client, base_path, prefix, is_ephemeral=False):
if not zk_client.exists(base_path):
zk_client.ensure_path(base_path)
new_node =... |
3,374 | ad5a9e353d065eee477381aa6b1f233f975ea0ed | """
Auteur:Fayçal Chena
Date : 07 avril 2020
Consignes :
Écrire une fonction alea_dice(s) qui génère trois nombres (pseudo) aléatoires à l’aide
de la fonction randint du module random, représentant trois dés (à six faces avec
les valeurs de 1 à 6), et qui renvoie la valeur booléenne True si les dés forment un 421,
et l... |
3,375 | bf683f8e7fb5ad5f7cd915a8a01d9adf7d13e739 |
def first_repeat(chars):
for x in chars:
if chars.count(x) > 1:
return x
return '-1'
|
3,376 | bea1a5bc9c92d095a2f187a4c06d18d0a939f233 | source = open("input.txt", "r")
total = 0
def calculateWeight( weight ):
fuel = calculateFuel(weight)
if fuel > 0:
sum = fuel + calculateWeight(fuel)
return sum
else:
return max(0, fuel)
def calculateFuel ( weight ):
return weight // 3 -2
for line in source.readlines():
t... |
3,377 | 6018f35afc6646d0302ca32de649ffe7d544a765 | """
Make html galleries from media directories. Organize by dates, by subdirs or by
the content of a diary file. The diary file is a markdown file organized by
dates, each day described by a text and some medias (photos and movies).
The diary file can be exported to:
* an html file with the text and subset of medias a... |
3,378 | b865c37623f405f67592d1eabc620d11ff87827e | class subset:
def __init__(self, weight, itemSet, size, setNum):
self.weight = weight
self.itemSet = itemSet
self.size = size
self.setNum = setNum
def findCover(base, arr):
uniq = [] #array that can be union
uni = [] #array has been unionized w/ base
if len(base.itemSet) == rangeOfVal:
# print("COVER:"... |
3,379 | bb1a6815649eb9e79e2ab1e110ea8acd8adce5aa | def primeiras_ocorrencias (str):
dic={}
for i,letra in enumerate(str):
if letra not in dic:
dic [letra]=i
return dic |
3,380 | 848394e1e23d568f64df8a98527a8e177b937767 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
import shutil
class LibpopplerConan(ConanFile):
name = "poppler"
version = "0.73.0"
description = "Poppler is a PDF rendering library based on the xpdf-3.... |
3,381 | 36d596c1019dbaaf8dc394633ca464421517dc21 | """
This module takes care of starting the API Server, Loading the DB and Adding the endpoints
"""
import os
from flask import Flask, request, jsonify, url_for
from flask_migrate import Migrate
from flask_swagger import swagger
from flask_cors import CORS
from flask_jwt_extended import (
JWTManager, jwt_required, c... |
3,382 | 07332e2da5458fda2112de2507037a759d3c62db | def main():
num = int(input('dia: '))
dia(num)
def dia(a):
if a == 1:
print('Domingo !')
elif a == 2:
print('Segunda !')
else:
print('valor invalido !')
main()
|
3,383 | 60c849d213f6266aeb0660fde06254dfa635f10f | import optparse
from camera import apogee_U2000
if __name__ == "__main__":
parser = optparse.OptionParser()
group1 = optparse.OptionGroup(parser, "General")
group1.add_option('--s', action='store', default=1, dest='mode', help='set cooler on/off')
args = parser.parse_args()
options, args = parser.par... |
3,384 | 68371acc58da6d986d94d746abb4fea541d65fdd | #!/usr/bin/env python
import argparse
import subprocess
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
def quote(items):
return ["'" + item + "'" for item in items]
if module_exists('urllib.parse'):
from url... |
3,385 | 12cd3dbf211b202d25dc6f940156536c9fe3f76f | from aws_cdk import core as cdk
# For consistency with other languages, `cdk` is the preferred import name for
# the CDK's core module. The following line also imports it as `core` for use
# with examples from the CDK Developer's Guide, which are in the process of
# being updated to use `cdk`. You may delete this im... |
3,386 | c27ca6a8c38f2b96011e3a09da073ccc0e5a1467 | from django.apps import AppConfig
class Iapp1Config(AppConfig):
name = 'iapp1'
|
3,387 | 4b83887e8d8e5c5dc7065354d24044d3c3a48714 | #!/bin/env python
import sys
import os
import collections
import re
import json
import urllib
import urllib.request
import uuid
import time
PROCESSOR_VERSION = "0.1"
def process(trace_dir, out_dir):
#order files
trace_files = os.listdir(trace_dir)
trace_files = sorted(trace_files)
if trace_files[0] ==... |
3,388 | 5b3514af839c132fda9a2e6e178ae62f780f291e | from matplotlib import cm
from datascience.visu.util import plt, save_fig, get_figure
from sklearn.metrics import roc_curve, auc, confusion_matrix
import numpy as np
y = np.array([
[0.8869, 1.],
[1.-0.578, 0.],
[0.7959, 1.],
[0.8618, 1.],
[1.-0.2278, 0.],
[0.6607, 1.],
[0.7006, 1.],
... |
3,389 | 2465a73d958d88dcd27cfac75a4e7b1fcd6a884e | # -*- coding:utf-8 -*-
import datetime
import json
import os
import urllib
import requests
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import properties
from time import sleep
from appium import we... |
3,390 | c7258d77db2fe6e1470c972ddd94b2ed02f48003 | from multiprocessing import Process, Queue
def f(q):
for i in range(0,100):
print("come on baby")
q.put([42, None, 'hello'])
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
for j in range(0, 2000):
if j == 1800:
print(q.get())
... |
3,391 | 5029f3e2000c25d6044f93201c698773e310d452 | ###
# This Python module contains commented out classifiers that I will no longer
# be using
###
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import BaggingClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
# Using Decision trees... |
3,392 | d2acc789224d66de36b319ae457165c1438454a3 | from django import template
from django.conf import settings
from django.utils.html import escape
from django.utils.translation import get_language
from cms.models import Page
from cms.conf.global_settings import LANGUAGE_NAME_OVERRIDE
register = template.Library()
# TODO: There's some redundancy here
# TODO: {% cms... |
3,393 | 42d9f40dd50056b1c258508a6cb3f9875680276a | """empty message
Revision ID: 42cf7f6532dd
Revises: e6d4ac8564fb
Create Date: 2019-04-01 16:13:37.207305
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '42cf7f6532dd'
down_revision = 'e6d4ac8564fb'
branch_labels = None
depends_on = None
def upgrade():
# ... |
3,394 | 153c02585e5d536616ec4b69757328803ac2fb71 | #coding=utf-8
'''
Created on 2013-3-28
@author: jemmy
'''
import telnetlib
import getpass
import sys
import os
import time
import xlrd
from pyExcelerator import *
import
#define
Host = "192.168.0.1"
Port = "70001"
#Host = raw_iput("IP",)
username = "admin"
password = "admin"
filename = str(time.strftime('%Y%m%d%H%M%S... |
3,395 | 2866ecf69969b445fb15740a507ddecb1dd1762d | # C8-06 p.146 Write city_country() function that takes name city and country
# Print city name then the country the city is in. call 3 times with differet pairs.
def city_country(city, country):
"""Name a city and the country it resides in seperated by a comma."""
print(f'"{city.title()}, {country.title()}"\n'... |
3,396 | 464fc2c193769eee86a639f73b933d5413be2b87 | from keyboards import *
from DB import cur, conn
from bot_token import bot
from limit_text import limit_text
def send_answer(question_id, answer_owner, receiver_tel_id, short):
answer = cur.execute('''SELECT answer FROM Answers WHERE question_id = (%s) AND tel_id = (%s)''', (question_id, answer_owner)).fetchone()... |
3,397 | 66e93295d2797ca9e08100a0a1f28619acb72aa4 | from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from django.dispatch import Signal
from djangochannelsrestframework.observer.base_observer import BaseObserver
class Observer(BaseObserver):
def __init__(self, func, signal: Signal = None, kwargs=None):
super().__init__(... |
3,398 | 2345d1f72fb695ccec5af0ed157c0606f197009c | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_configuration(host):
sshd = host.file('/etc/ssh/sshd_config')
assert sshd.contains(r'^PermitRootLogin no$')
assert sshd.co... |
3,399 | c2467e94a2ad474f0413e7ee3863aa134bf9c51f | """
TestRail API Categories
"""
from . import _category
from ._session import Session
class TestRailAPI(Session):
"""Categories"""
@property
def attachments(self) -> _category.Attachments:
"""
https://www.gurock.com/testrail/docs/api/reference/attachments
Use the following API me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.