index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
7,000 | 248b9b9d613f71e0130353f0792083b7d3f6ccd6 | lista = [x for x in range(11)] ##todo: wazne
kwadraty = [i**2 for i in lista]
kwadraty = [(i, i**2, i**3) for i in range(-10, 11)]
zbior_wyr = {'aa', '1233', '111111'}
slownik = {i : len(i)for i in zbior_wyr}
print(kwadraty, slownik, sep='\n') |
7,001 | e7d7a002547047a9bcae830be96dd35db80a86e8 | from authtools.models import AbstractNamedUser
class User(AbstractNamedUser):
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['name']
|
7,002 | a967b97f090a71f28e33c5ca54cb64db3967aea3 | import pandas as pd
# ์นผ๋ผ๊ฐ์ผ๋ก ์ถ๊ฐ - ํจ์ ์์ฑ
# 1. cv_diff_value : ์ข
๊ฐ ์ผ๊ฐ ๋ณํ๋
def cv_diff_value(prevalue, postvalue):
return postvalue - prevalue
# 2. cv_diff_rate : ์ข
๊ฐ ์ผ๊ฐ ๋ณํ์จ
def cv_diff_rate(prevalue, postvalue):
return (postvalue - prevalue) / prevalue * 100
# 3. cv_maN_value : ์ข
๊ฐ์ N์ผ ์ด๋ํ๊ท
def cv_maN_value(cv, ... |
7,003 | 2b82d66803ae0a0b03204318975d3c122f34f0cf | import gdal
import sys, gc
sys.path.append("..")
import getopt
import redis
import time
import subprocess
import numpy as np
from os import listdir, makedirs
from os.path import isfile, join, exists
from operator import itemgetter
from natsort import natsorted
from config import DatasetConfig, RasterParams
from datase... |
7,004 | 01d545e77c211201332a637a493d27608721aad5 | from os import environ as env
import json
import utils
import utils.aws as aws
import utils.handlers as handlers
def put_record_to_logstream(event: utils.LambdaEvent) -> str:
"""Put a record of source Lambda execution in LogWatch Logs."""
log_group_name = env["REPORT_LOG_GROUP_NAME"]
utils.Log.info("Fet... |
7,005 | c5a2c00d53111d62df413907d4ff4ca5a02d4035 | import argparse
from time import sleep
from threading import Thread
from threading import Lock
from multiprocessing.connection import Listener
from multiprocessing.connection import Client
ADDRESS = '127.0.0.1'
PORT = 5000
# Threaded function snippet
def threaded(fn):
def wrapper(*args, **kwargs):
thread ... |
7,006 | 80469fd945a21c1bd2b5590047016a4b60880c88 | '''
Created on May 18, 2010
@author: Abi.Mohammadi & Majid.Vesal
'''
from threading import current_thread
import copy
import time
from deltapy.core import DeltaException, Context
import deltapy.security.services as security_services
import deltapy.security.session.services as session_services
import deltapy.unique... |
7,007 | ac46aa6f8f4f01b6f3c48532533b9dd41a8a1c1c | import abc
class Connector:
"""@abc.abstractmethod
def connect(self):
pass
"""
@abc.abstractmethod
def save(self, item):
pass
@abc.abstractmethod
def load_all(self):
pass
@abc.abstractmethod
def load_by_id(self, i... |
7,008 | 7d21e76383b80e8a4433fb11cb3b64efee7a6d3b | from angrytux.model.game_objects.obstacle_states.HittedState import HittedState
from angrytux.model.game_objects.obstacle_states.ObstacleState import ObstacleState
class NewState(ObstacleState):
@property
def delete(self) -> bool:
"""
Don't delete this obstacle
:return: False
... |
7,009 | e7b2e716fbcaf761e119003000bf1b16af57a2b7 | import numpy as np
import matplotlib.pyplot as plt
import csv
category = ["Ecological Well-being", "Health & Human Services", "Arts & Culture", "Community Building", "Environment"]
arr = np.empty((0, 6), str)
moneyGranted = [[0]*5 for _ in range(6)]
moneyRequested = [[0]*5 for _ in range(6)]
perFull = [[0]*5 f... |
7,010 | ab9d8e36518c4d42f1e29fbc5552078a5a338508 | # Exampleย 15-5. Using a BookDict, but not quite as intended
>>> from books import BookDict
>>> pp = BookDict(title='Programming Pearls',
... authors='Jon Bentley',
... isbn='0201657880',
... pagecount=256)
>>> pp
{'title': 'Programming Pearls', 'authors': 'Jon Bentley', 'isbn'... |
7,011 | 7168a8eb401478aa26ee9033262bb5c8fe33f186 |
# This file imports all files for this module for easy inclusions around the game.
from viewController import *
from navigationController import *
from noticer import *
from Images import *
from fancyButton import *
from constants import *
from textObject import *
from UIButton import *
# from spriteFromRect import ... |
7,012 | 865121e7eb5f9c70adf44d33d21f30c22f13ec56 | import numpy as np
import torch
import torch.nn as nn
from torch.nn.functional import interpolate
from torchvision.ops.boxes import batched_nms
class MTCNN():
def __init__(self, device=None, model=None):
if device is None:
device = 'cuda' if torch.cuda.is_available() else 'cpu'
self.device = device
url = '... |
7,013 | d4621ef378b89490278c09e569f781aef1fcef3f |
class WSCommand:
handshake_hi='handshake_hi'
ping = 'ping'
pong = 'pong'
http_call = 'http_call'
http_return = 'http_return'
class WSMessage:
def __init__(self, command: str, data: any = None) -> None:
self.command = command
self.data = data
def strData(self) -> str:
return se... |
7,014 | 3882aaf94b19967a1d1eff23fa4862ea71de3b38 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 8 18:04:13 2018
@author: zhangchi
"""
class Solution(object):
def transpose(self, A):
"""
:type A: List[List[int]]
:rtype: List[List[int]]
"""
row = len(A[0])
result = [[] for _ in range(row)]
... |
7,015 | 43362c564be0dfbc8f246a0589bcebde245ab7b5 | import requests
save_result = requests.post(
'http://localhost:5000/save',
json={'value': 'witam'}
)
print(save_result.text)
read_result = requests.get('http://localhost:5000/read')
print(read_result.text) |
7,016 | 1cfb0690ebe1d7c6ab93fa6a4bc959b90b991bc8 | {
"module_spec": {
"module_name": "Spec1"
}
}
|
7,017 | 8e317d4d8ae8dc3d692d237e7e0abfaf37aecbb6 | from .kahfm_batch import KaHFMBatch |
7,018 | 6defbe25fc17e53df2fc4d32886bba1cb141bdfd | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
from sklearn.preprocessing import normalize
def blackbox_function(x, y=None, sim=False):
if sim:
if y is None:
return -x ** 2 + 6
else:
return -(x+y) ** 2 + 6
# Reading the magnitude of t... |
7,019 | 2bc5711839ccbe525551b60211d8cd79ddb7775a | # coding=utf-8
# @FileName: test_json.py
# @Author: ZhengQiang
# Date: 2020/1/15 5:26 ไธๅ
import json
a = "{\"ddd\": {{}}}"
def boyhook(dic):
print('test')
if dic['name']:
return dic['name'], dic['age']
return dic
new_boy = json.loads(a, object_hook=boyhook)
print(new_boy) |
7,020 | 2bfdc259bcd5ff058ee8661a14afd8a915b8372b | """.. Ignore pydocstyle D400."""
from rolca.payment.api.views import (
PaymentViewSet,
)
routeList = ((r'payment', PaymentViewSet),)
|
7,021 | a1bf4b941b845b43ec640b19a001e290b46c488c | #!/usr/bin/env python
# coding: utf-8
# HR Employee Retension Rate, predicting an employee likely to leave or not.
# In[ ]:
import numpy as np # ๆฐ็ปๅธธ็จๅบ
import pandas as pd # ่ฏปๅ
ฅcsvๅธธ็จๅบ
from patsy import dmatrices # ๅฏๆ นๆฎ็ฆปๆฃๅ้่ชๅจ็ๆๅๅ้
from sklearn.linear_model import LogisticRegression # sk-learnๅบLogistic Regressionๆจกๅ
from skl... |
7,022 | 96bb865b66e5d9ba62bab210705338f1799cc490 | # Generated by Django 3.2.5 on 2021-08-28 12:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('userProfile', '0022_auto_20210823_1858'),
]
operations = [
migrations.RemoveField(
model_name='... |
7,023 | a094207b2cd9a5a4bd409ac8a644268f3808e346 | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
TYPE_ENT = (
( 'ROOT' , 'ROOT' ),
( 'TIERS', 'TIERS'),
)
class EntiteClass(models.Mode... |
7,024 | 28ed494939d0928bf3ad4f07f58186374e925426 | import numpy as np
from random import randint
def combinacaoDeEmbralhamento(qtdeLinhas):
while True:
a = randint(0,qtdeLinhas)
b = randint(0,qtdeLinhas)
if a == b :
continue
else:
break
resp = [[a,b]]
return resp
def embaralhaMatriz(x):
for i in range(qtdeLinhas):
print(i)
combinacaoDeEmbralha... |
7,025 | 2749a262bf8da99aa340e878c15a6dba01acc38c | """
ๅคไน
้ขๅๅฏน่ฑก๏ผ่่้ฎ้ขไปๅฏน่ฑก็่งๅบฆๅบๅ.
ๆฝ่ฑก๏ผไปๅคไธชไบ็ฉไธญ๏ผ่ๅผไธชๅซ็/้ๆฌ่ดจ็็นๅพ(ไธ้่ฆ)๏ผ
ๆฝๅบๅ
ฑๆง็ๆฌ่ดจ(้่ฆ็)่ฟ็จใ
ไธๅคง็นๅพ๏ผ
ๅฐ่ฃ
๏ผๅฐๆฏไธชๅๅ็นๅ็ฌๅ่งฃๅฐไธๅ็็ฑปไธญใ
ไพๅฆ๏ผ่ๅผ ๅผ่ฝฆๅปไธๅ
ๅๆณ๏ผๅฎไนไบบ็ฑป๏ผๅฎไน่ฝฆ็ฑปใ
็ปงๆฟ๏ผ้็จ็ฐๆ็ฑป็ๅ่ฝๅๆฆๅฟต๏ผๅนถๅจๆญคๅบ็กไธ่ฟ่กๆฉๅฑใ
็ปไธๆฆๅฟต
ไพๅฆ๏ผๅพๅฝข็ฎก็ๅจ๏ผ็ป่ฎกๅๅฝข/็ฉๅฝข.....้ข็งฏใ
... |
7,026 | 17db8f7a35004a1f2bd8d098aff39928d20511da | # https://docs.python.org/3/library/math.html
# https://metanit.com/python/tutorial/6.2.php
# https://habr.com/ru/post/337260/
# https://habr.com/ru/post/112953/
import math
num = 8
float_num = 2.5
power = 8
rad = 0.5
grad = 90
n = 16
n10 = 1000
base = 2
print("math.pow:", math.pow(num, power)) # ะฟัะพะฑะปะตะผะฐ ัะพัะฝะพััะธ ... |
7,027 | 8dff22249abbae9e30ba1ad423457270e0cd9b20 | # Generated by Django 2.1.1 on 2018-09-24 04:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Aro',
fie... |
7,028 | 5acbd6002c5e3cfac942d52b788f18c6afa92da2 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('examen', '0002_auto_20161122_1836'),
]
operations = [
migrations.RemoveField(
model_name='actuacionventa',
... |
7,029 | 55b4448caa73bcb50a15eb46d07328934fce72c8 | import os
import numpy as np
import nibabel as nib
def loop_access(n,m,data,tpl):
if n >m:
return loop_access(n,m+1,data[tpl[m]],tpl)
else:
return data[tpl[m]]
def loop_rec(n,m,mapCoords,dims,data,tple):
if n >= m:
for x in range(dims[m]):
loop_rec(n,m+1,mapCoords,dims,... |
7,030 | 30f030d48368e1b103f926ee7a15b4b75c4459c7 | from datetime import timedelta
import pandas as pd
__all__ = ["FixWindowCutoffStrategy"]
class CutoffStrategy:
"""
Class that holds a CutoffStrategy. This is a measure to prevent leakage
Parameters
----------
generate_fn: a function that generates a cutoff time for a given entity.
input... |
7,031 | ad474f5120ca2a8c81b18071ab364e6d6cf9e653 | from typing import List
from fastapi import Depends, FastAPI, HTTPException
from sqlalchemy.orm import Session
from myfirstpython.fastapi import models, crud, schemas
from myfirstpython.fastapi.dbconnection import engine, SessionLocal
models.Base.metadata.create_all(bind=engine)
app = FastAPI()
# Dependency
def g... |
7,032 | 2064fe029bc7db14505a5b38750e324b55556abb | # Copyright 2022 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... |
7,033 | ddeff852e41b79fb71cea1e4dc71248ddef85d79 | import itertools
import numpy as np
SAMPLER_CACHE = 10000
def cache_gen(source):
values = source()
while True:
for value in values:
yield value
values = source()
class Sampler:
"""Provides precomputed random samples of various distribution."""
randn_gen = cache_gen(la... |
7,034 | 02d7022c7d864354379009577d64109601190998 | '''
Inspection of the network with unlabelled data
'''
import numpy as np
import matplotlib.pyplot as plt
from main import IMG_SIZE, MODEL_NAME, model
model.load(MODEL_NAME)
''' COMMENT OUT FOLLOWING AS APPROPRIATE '''
# if you need to create the data:
# test_data = process_test_... |
7,035 | 146aca6c7da17ddccb815638292cbcdda66f28e6 | #!/usr/local/bin/python
''' side_on.py
Open a 3d trajectory file (x y z) and produce a side-on plot of the
y-z plane, with straight line between start and end and a virtual
wall superimposed at 10 yards.
arg1 = infile
arg2 = optional outfile
'''
import sys
import matplotlib.pyplot as plt
infile... |
7,036 | 6c86b4823756853bb502b34492ac8ad0a75daf7e | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-19 15:17
from __future__ import absolute_import
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Count
from tqdm import tqdm
def remove_duplicate_legal_reasons(apps, purpose_slug, source_obje... |
7,037 | e8e52cd0a0685e827ecbc6272657de5158fa0d94 | import re
โ
print("ะัะปะธะบ ะะฐะปะตััั ะะฐะบัะธะผัะฒะฝะฐ\n "
"ะะฐะฑะพัะฐัะพัะฝะฐ ัะพะฑะพัะฐ โ2 \n "
"ะะฐััะฐะฝั 10 \n "
"ะะฐะฒะดะฐะฝะฝั โ1. ะะฑัะธัะปะธัะธ ัะพัะผัะปั")
โ
โ
def int_input(text):
while True:
user_input = input(text)
if re.match('^[0-9]{1,}$', user_input):
break
else:
print("ะะพ... |
7,038 | 16302f23edf16e201c3f3e9800dc4a9290ddc29e | from django.conf.urls import url, include
from . import views
from django.conf import settings
from django.conf.urls.static import static
app_name = 'stock_main'
urlpatterns = [
url(r'^$', views.Stock_main.as_view(), name='stock_main'),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_RO... |
7,039 | 471ce1eeb3293a424de74e25f36b76699a97ec2b | from mrjob.job import MRJob
from mrjob.step import MRStep
from collections import Counter
import csv
def read_csvLine(line):
# Given a comma delimited string, return fields
for row in csv.reader([line]):
return row
class MRTopVisitorCount(MRJob):
# Mapper1: emit page_id, 1
def mapper_coun... |
7,040 | 83e1c86095de88692d0116f7e32bd485ab381b29 | #!/usr/bin/env pypy
from __future__ import print_function
from __future__ import division
import subprocess
import random
import math
import sys
import string
randmin = int(sys.argv[1])
randmax = int(sys.argv[2])
random.seed(int(sys.argv[3]))
n = random.randint(randmin, randmax)
print('%d' % n)
|
7,041 | 9905559909f10831373e659cde0f275dc5d71e0d | # Generated by Django 2.1.7 on 2019-03-18 02:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('training_area', '0006_remove_event_day'),
]
operations = [
migrations.Crea... |
7,042 | 33f766bf12a82e25e36537d9d3b745b2444e1fd7 | import turtle
def draw_triangle(brad):
brad.color("blue", "green")
brad.fill(True)
brad.forward(300)
brad.left(120)
brad.forward(300)
brad.left(120)
brad.forward(300)
brad.end_fill()
#jdjjdd brad.color("blue", "white")
brad.fill(True)
brad.left(180)
brad.forward(150)
... |
7,043 | 82c426836fee0560e917848084af4ca124e74dff | #Homework 09
#Raymond Guevara
#018504731
#Algorithm Workbench
#Question 1
print("Question 1")
height = int(input("Please enter your height: "))
print()
#Question 2
print("Question 2")
color = input("please enter your favorite color: ")
print()
#Question 3
print("Question 3")
a = -8/3 #Solved for variable "a" usin... |
7,044 | b935c48210b1965ebb0de78384f279b71fc17d5d | #!/usr/bin/python3
################################################################################
# Usefull functions to shorten some of my plotting routine #####################
################################################################################
import matplotlib.pyplot as plt
import seaborn as sns
i... |
7,045 | b9622bede471c76ae36d3f59130d2be113310d4c | def watch():
print("์์ฒญํ๋ค")
watch()
print("tv.py์ module ์ด๋ฆ์",__name__) #name์ __main__์ผ๋ก ๋์ด |
7,046 | 948b793359555f98872e0bdbf6db970ed1ff3b83 | # Ques1:
# To create a program that asks the user to enter their name and their age
# and prints out a message addressed to them that tells them the year that
# they will turn 100 years old. Additionally, the program asks the user for
# another number and prints out that many copies of the previous message on
... |
7,047 | 41350714ce13e3627b9bd56eb934846a99f8e1b3 | # -*- coding: utf-8 -*-
import socket
import os
def http_header_parser(request):
headers = {}
lines = request.split('\n')[1:]
for string in lines:
first_pos = string.find(":")
headers[string[:first_pos]] = string[first_pos + 2:]
return headers
def create_response(http_code, http_co... |
7,048 | 665a868ee71f247a621d82108e545257296e0427 | '''
Given a string S and a string T,
find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers all characters in T, return the empty string "".
If there are multipl... |
7,049 | 521b90ffb4bace4cbd50d08ed4be278d4f259822 | from texttable import Texttable
from nexuscli import exception
from nexuscli.api import cleanup_policy
from nexuscli.cli import constants
def cmd_list(nexus_client):
"""Performs ``nexus3 cleanup_policy list``"""
policies = nexus_client.cleanup_policies.list()
if len(policies) == 0:
return excepti... |
7,050 | f59e61977f7c72ab191aadccbd72d23f831b3a1c | import items
import grupo
class Conexion:
def __init__(self, direccion, destino):
self.set_direccion(direccion)
self.set_destino(destino)
def __repr__(self):
return str(self.direccion()) + ' => ' + str(self.destino())
def direccion(self):
return self._direccion
def se... |
7,051 | f13a2820fe1766354109d1163c7e6fe887cd6f34 | import sys, os
sys.path.append(os.path.abspath('../models'))
from GANSynth import flags as lib_flags
from GANSynth import generate_util as gu
from GANSynth import model as lib_model
from GANSynth import util
from GANSynth import train_util
import tensorflow as tf
import numpy as np
import json
from models.G... |
7,052 | e086bebaa166abeea066fe49076f1b007858951f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 17 17:24:39 2020
@author: code
"""
import sys
import keras
import cv2
import numpy
import matplotlib
import skimage
print('Python: {}'.format(sys.version))
print('Numpy: {}'.format(numpy.__version__))
print('Keras: {}'.format(keras.__version__))
p... |
7,053 | 09dac7bfe98a15b3e79edcb0d0a53c0ab4d771ca | import os
import random
import pygame
# Class for all the game's obstacles
class Obstacle(pygame.sprite.Sprite):
# Class constructor
def __init__(self, game_params, game_speed):
self.obs_type = random.randrange(0, 3)
# Becomes a pterodactyl obstacle
if (self.obs_type == 0):
... |
7,054 | 4ed5ceb784fb1e3046ab9f10c4b556f2e94274db | import json
import requests
from pyyoutube import Api
def get_data(YOUTUBE_API_KEY, videoId, maxResults, nextPageToken):
"""
ะะพะปััะตะฝะธะต ะธะฝัะพัะผะฐัะธะธ ัะพ ัััะฐะฝะธัั ั ะฒะธะดะตะพ ะฟะพ video id
"""
YOUTUBE_URI = 'https://www.googleapis.com/youtube/v3/commentThreads?key={KEY}&textFormat=plainText&' + \
... |
7,055 | 0b5fb649dc421187820677ce75f3cd0e804c18a3 | #! /usr/bin/env python3
__all__ = [
'FrameCorners',
'CornerStorage',
'build',
'dump',
'load',
'draw',
'without_short_tracks'
]
import click
import cv2
import numpy as np
import pims
from _corners import FrameCorners, CornerStorage, StorageImpl
from _corners import dump, load, draw, withou... |
7,056 | c4f39f9212fbe0f591543d143cb8f1721c1f8e1e | """
Schema management for various object types (publisher, dataset etc). Loads
the jsonschema and allows callers to validate a dictionary against them.
"""
import os
import json
import pubtool.lib.validators as v
from jsonschema import validate, validators
from jsonschema.exceptions import ValidationError
SCHEMA = ... |
7,057 | b4eb62413fb8069d8f11c34fbfecc742cd79bdb8 | import random
import matplotlib.pyplot as plt
import tensorflow.keras as keras
mnist = keras.datasets.mnist # MNIST datasets
# Load Data and splitted to train & test sets
# x : the handwritten data, y : the number
(x_train_data, y_train_data), (x_test_data, y_test_data) = mnist.load_data()
print('x_train_d... |
7,058 | 502e2d2222863236a42512ffc98c2cc9deaf454f |
import os
import subprocess
import re
# import fcntl
# path_ffmpeg =
path_ffmpeg = r'C:\work\ffmpeg\ffmpeg-3.4.2-win64-static\bin\ffmpeg.exe'
dir_ts_files = r'E:\ts'
dir_output = r'E:\hb'
path_lock = r'C:\work\ffmpeg\encode.lock'
def get_work_base(f_base):
re_num = re.compile(r'(\d+)\-.+')
r = re_num.searc... |
7,059 | 6a609c91122f8b66f57279cff221ee76e7fadb8c | ๏ปฟ# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def splitListToParts(self, root, k):
"""
:type root: ListNode
:type k: int
:rtype: List[ListNode]
"""
if not root:
return [None]*k
res... |
7,060 | e4845e5aa949ec523515efc4d7996d647fddabdb | line_numbers = input().split(", ")
print("Positive:", ", ".join(list(filter((lambda x: int(x) > -1), line_numbers))))
print("Negative:", ", ".join((list(filter((lambda x: int(x) < 0), line_numbers)))))
print("Even:", ", ".join((list(filter((lambda x: int(x) % 2 == 0), line_numbers)))))
print("Odd:", ", ".join((list(fil... |
7,061 | e9a929dfef327737b54723579d3c57884fe61057 | class Solution:
# This would generate all permutations, but that's not what this question asks for
# def combo(self, cur, n, ret, arr):
# if cur == n:
# arr.append(ret)
# return
# self.combo(cur+1, n, ret + "1", arr)
# self.combo(cur+1, n, ret + "0", arr)
def c... |
7,062 | e6b84a2190a84c871e7191ef49fb7ee8b8148c9a | #finding postgresql info
import re
import subprocess
def get_postgre_version():
p = subprocess.Popen("psql --version",stdout=subprocess.PIPE,shell=True)
k = re.findall(r'psql\s+\(PostgreSQL\)\s+(.*)',p.stdout.read())
postgre_version = k[0]
return postgre_version
version=get_postgre_version()
print ver... |
7,063 | 5ce5fbfa33c241fc316d5e414df01a39bfc9be18 | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed =... |
7,064 | 70cda2d6d3928cd8008daf221cd78665a9b05eea | #!/usr/bin/env python
#coding:utf-8
"""
Author: Wusf --<wushifan221@gmail.com>
Purpose:
Created: 2016/2/29
"""
import os,sys,sqlite3
MyQtLibPath = os.path.abspath("D:\\MyQuantLib\\")
sys.path.append(MyQtLibPath)
import PCA.PCA_For_Stat_Arb2 as pca
import pandas as pd
import numpy as np
import time
def Compu... |
7,065 | 85903f0c6bd4c896379c1357a08ae3bfa19d5415 | import logging
import random
from pyage.core.address import Addressable
from pyage.core.agent.agent import AbstractAgent
from pyage.core.inject import Inject, InjectOptional
logger = logging.getLogger(__name__)
class AggregateAgent(Addressable, AbstractAgent):
@Inject("aggregated_agents:_AggregateAgent__agents")... |
7,066 | b01ff71792895bb8839e09ae8c4a449405349990 | '''
Created on Mar 27, 2019
@author: Iulia
'''
from Graph import Graph
from Controller import *
from Iterators.Vertices import *
from File import File
from Iterators.EdgesIterator import EdgesIterator
def test():
tup = File.readInput("file.txt")
graph = tup[0]
edgeData = tup[1]
ctrl = Controller(grap... |
7,067 | 30c2d46d6587df3cbc3e83ecb7af787fcd86eb1f | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck
class FunctionAppDisallowCORS(BaseResourceNegativeValueCheck):
def __init__(self):
name = "Ensure function apps are not acces... |
7,068 | fab75c5b55d85cef245fa6d7e04f4bf3a35e492c | from pwn import *
DEBUG = False
if DEBUG:
p = process("binary_100")
else:
p = remote("bamboofox.cs.nctu.edu.tw", 22001)
padding = 0x34 - 0xc
payload = padding * "A" + p32(0xabcd1234)
p.send(payload)
p.interactive()
p.close()
|
7,069 | 96131e3d6c67c0ee4ff7f69d4ffedcbf96470f14 | # -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (C) 2019-Antti Kรคrki.
# Author: Antti Kรคrki.
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed ... |
7,070 | b24ce9ed2df11df4cbf47949915685c09ec7543a | #!/usr/bin/python
import sys
import os
import sqlite3
from matplotlib import pyplot as plt
import numpy as np
def main():
if len(sys.argv) < 2:
print('usage: sqlite_file ...')
sys.exit()
db_filenames = sys.argv[1:]
num_of_dbs = len(db_filenames)
conn = sqlite3.connect(":memory:")
c... |
7,071 | e79cdd32977eb357c3f6709887b671c50eb1fa45 | # boj, 9237 : ์ด์ฅ๋ ์ด๋, python3
# ๊ทธ๋ฆฌ๋ ์๊ณ ๋ฆฌ์ฆ
import sys
def tree(l):
return max([i+j+2 for i,j in enumerate(l)])
N = int(sys.stdin.readline())
t = sorted(list(map(int, sys.stdin.readline().split())), reverse = True)
print(tree(t)) |
7,072 | 8a6028aa477f697946ab75411b667f559e87141c | from aspose.email.storage.pst import *
from aspose.email.mapi import MapiCalendar
from aspose.email.mapi import MapiRecipientType
from aspose.email.mapi import MapiRecipientCollection
from aspose.email.mapi import MapiRecipient
import datetime as dt
from datetime import timedelta
import os
def run():
dataDir = "Dat... |
7,073 | 5bd7160b6b2e283e221aeb0a6913e6d13511c1db | #!/usr/bin/env python
"""
Plot EEG data.
Usage:
plotting.py [options] [<file>]
Options:
-h --help Show this screen.
--version Show version.
--center Center the data before plotting
--sample-index=N Row index (indexed from one).
--transpose Transpose data.
--x... |
7,074 | 1d529e2ea5526ddcda0d0da30ed8ed4724002c63 | import asyncio
import logging
import os
from async_cron.job import CronJob
from async_cron.schedule import Scheduler
from sqlalchemy import asc
import spider
import squid
import verifier
from db import sess_maker
from model import Proxy, STATUS_OK, STATUS_ERROR
from server import run_api_server
from tool import logge... |
7,075 | 3e7e6d7a0137d91dc7437ff91a39d7f8faad675e | #ERP PROJECT
import pyrebase
import smtplib
config = {
"apiKey": "apiKey",
"authDomain": "erproject-dd24e-default-rtdb.firebaseapp.com",
"databaseURL": "https://erproject-dd24e-default-rtdb.firebaseio.com",
"storageBucket": "erproject-dd24e-default-rtdb.appspot.com"
}
firebase = pyrebase.initialize_app(conf... |
7,076 | 9a7c6998e9e486f0497d3684f9c7a422c8e13521 | import sys
def caesar( plaintext, key ):
if int( key ) < 0:
return
plaintext_ascii = [ ( ord( char ) + int( key ) ) for char in plaintext ]
for ascii in plaintext_ascii:
if ( ascii < 97 and ascii > 90 ) or ascii > 122:
ascii -= 25
ciphertext = ''.join( [ chr( ascii ) for a... |
7,077 | c36625dfbd733767b09fcb5505d029ae2b16aa44 | # pylint: disable=wrong-import-position,wrong-import-order
from gevent import monkey
monkey.patch_all()
from gevent.pywsgi import WSGIServer
from waitlist.app import app
http_server = WSGIServer(("0.0.0.0", 5000), app)
http_server.serve_forever()
|
7,078 | 70d740a7003ca3f2d2cde039b2fc470ef2165e77 | import struct
from coapthon import defines
from coapthon.utils import byte_len, bit_len, parse_blockwise
__author__ = 'Giacomo Tanganelli'
__version__ = "2.0"
class BlockwiseLayer(object):
"""
Handles the Blockwise feature.
"""
def __init__(self, parent):
"""
Initialize a Blockwise L... |
7,079 | f9f835b24aa8fc77109db9e2d89a3f43bcb4b181 | ''' Load a variety of relevant physical parameters.
All quantities are in atomic units, such that
m_e = 1
e = 1
hbar = 1
1/4\pi\epsilon = 1
'''
import numpy as np
hbar = 1.0
m_e = 1.0
h22m = hbar**2 / (2*m_e)
pi = np.pi
eV = 1/27.21138505
eV_Ha = eV
nm = 18.89726124565
kB_eV = 8.6173324e-5
kB = kB_e... |
7,080 | 5e0affbd295d7237784cd8e72926afeda6456500 | import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
# 1. sepal length in cm
# 2. sepal width in cm
# 3. petal length in cm
# 4. petal width in cm
TrainingData = np.loadtxt("Data2",delimiter = ',',skiprows = 1,dtype = str)
class Knn(object):
"""docstring for data"""
def ... |
7,081 | ccb131171472d0a92d571e94453be97b323b4484 | from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os
# Init app
app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file__))
# Database
app.config['SQLALCHEM_DATABASE_URI'] = 'sqlite///' + \
os.path.join(basedir, 'db.sql... |
7,082 | e0d7fb8a9799c91dca0ca0827a5149804c9efabb | from quiz.schema.base import Schema
from quiz.schema.schemas import UserSchemas
class RegisterSchema(Schema):
"""
ๆณจๅ
"""
_schema = UserSchemas.REG_SCHEMA.value
class LoginSchema(Schema):
"""
็ปๅฝ
"""
_schema = UserSchemas.LOGIN_SCHEMA.value
|
7,083 | 785b54dce76d6906df513a8bde0110ab6fd63357 | from unittest import TestCase
# auto-test toggled test class to monitor changes to is_palindrome function
class Test_is_palindrome(TestCase):
def test_is_palindrome(self):
from identify_a_palindrome import is_palindrome
self.assertTrue(is_palindrome("Asdfdsa"))
self.assertTrue(is_palindrome... |
7,084 | a667c4cb0a30ee67fe982bb96ece6bb75f25f110 | import pygame
from pygame.locals import *
pygame.init()
ttt = pygame.display.set_mode((300,325)) #loome mรคnguakna
pygame.display.set_caption = ("Trips-Traps-Trull")
vรตitja = None
def init_tabel(ttt):
taust = pygame.Surface(ttt.get_size())
taust = taust.convert()
taust.fill((250,250,250))
#tรตm... |
7,085 | 85fc2fc0a404c20b1f0806412424192ea4a50a9b | import pygame
import random
from lb_juego import*
#Dimensiones de la pantalla
ALTO=400
ANCHO=600
#lista de colores basicos
ROJO=(255,0,0)
SALMON=(240,99,99)
BLANCO=(255,255,255)
NEGRO=(0,0,0)
AZUL=(59,131,189)
VERDE=(0,255,0)
if __name__=='__main__':
#Inicializacion de la aplicacion en pygame
pygame.init()
... |
7,086 | e1f003b6a687e5654a1ee6c595e789ced02cd6c3 | from pptx import Presentation
import csv
prs = Presentation()
slide_layout = prs.slide_layouts[1]
slide = prs.slides.add_slide(slide_layout)
shapes = slide.shapes
title_shape = shapes.title
body_shape = shapes.placeholders[1]
title_shape.text = "Tekst"
tf = body_shape.text_frame
tf.text = "Zawartoลฤ tekst frame"
wi... |
7,087 | 4556febd5fddf390f370a8e24871eacf08d34c9f | #!/usr/bin/env python3
import sys
import os
import math
import tempfile
import zlib
import lzma
import struct
import bitstruct
# a swf file unpacker and analyzer
# majority of information taken from https://www.adobe.com/devnet/swf.html (version 19)
# some additional information taken from https://github.com/cla... |
7,088 | 05badb45c2249dc52b72a46779a8e619cd8a3ca9 | import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
XZ_MESH = np.meshgrid(
np.linspace(0, 1, 100), np.linspace(0.5, 1, 100)
)
XZ_GRID = np.append(
XZ_MESH[0].reshape(-1, 1), XZ_MESH[1].reshape(-1, 1), 1
)
QI_MESH = np.meshgrid(
np.linspace(0, 1, 100), np.linspace(0, 1, 100)
)
Q... |
7,089 | 227a56c970a74d515ab694d2c0924885e2209cfe | #
# @lc app=leetcode id=67 lang=python3
#
# [67] Add Binary
#
# https://leetcode.com/problems/add-binary/description/
#
# algorithms
# Easy (46.70%)
# Likes: 2566
# Dislikes: 331
# Total Accepted: 572.1K
# Total Submissions: 1.2M
# Testcase Example: '"11"\n"1"'
#
# Given two binary strings a and b, return their ... |
7,090 | 80454a3935f0d42b5535440fc316af1b5598d8a1 | Desafios:
1: Crie um script python que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas de acordo com o valor digitado.
Script:
Desafio 01:
1: Crie um script python que leia o nome de uma pessoa
e mostre uma mensagem de boas-vindas de acordo com o valor digitado."""
nome=input('Qual รฉ o seu nome?')
print... |
7,091 | 44dbb7587530fac9e538dfe31c7df15b1a016251 | #from graph import *
#ex = open('ex_K.py', 'r')
#ex.read()
import ex_K
ex = ex_K
print "digraph K {"
print (str(ex.K))
print "}"
|
7,092 | 806124926008078e592141d80d08ccfbb3046dbf | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ==============================================================================
# Created By : Karl Thompson
# Created Date: Mon March 25 17:34:00 CDT 2019
# ==============================================================================
"""nasdaq_itch_vwap - Genera... |
7,093 | 4d1ea6522a01603f0159a1f27da70b65c4f387cb | from dbmanager import DbManager
from message import Message
def list_returner(f):
def wrapper(*args, **kwargs):
result = f(*args, **kwargs)
if result:
return result
else:
return [dict()]
return wrapper
class Messenger:
def __init__(self, messages_count=20)... |
7,094 | 045ad27f46c2090ed39a49144c3aa17093b0d9c7 | #-*- coding:utf-8 -*-
"""
Django settings for hehotel project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.... |
7,095 | ece20c8c8fae2225cbac3552e254314b7116057c | import numpy
#Matrixmultiplikation
#Matrixinvertierung
#nicht p inv
#selbst invertierbar machen
import math
import operator |
7,096 | 2f6e5ed4e2d52190551dec2ac18441b8355699b5 | import random
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_mldata
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, LabelBinarizer
from ann.act import relu, softmax_with_xentropy
from ann.loss import xentropy_with_softmax
fr... |
7,097 | bc3e94c3fb8e563f62fcf0ca628d4aa73c668612 | from telegram.ext import Dispatcher,CommandHandler,CallbackQueryHandler
import random
from telegram import InlineKeyboardMarkup, InlineKeyboardButton
gifGOODBOAT = 'https://media3.giphy.com/media/3oz8xRQiRlaS1XwnPW/giphy.gif'
gifBADBOAT = 'https://media1.giphy.com/media/l2Je3n9VXC8z3baTe/giphy.gif'
gifGOODMAN = 'https... |
7,098 | 0004e90622f8b13ec7ce0c1f49e8c8df7ea07269 | def merge_the_tools(string, k):
if(len(string)%k != 0):
exit()
else:
L = []
for i in range(0, len(string), k):
L.append(''.join(list(dict.fromkeys(string[i:i+k]))))
print('\n'.join(L))
if __name__ == '__main__':
string, k = input(), int(input())
merge_the_to... |
7,099 | 1f7147c914eee37776c0418575e93e3d36ee3aa5 | import os
import json
basedir = os.path.abspath(os.path.dirname(__file__))
# CHECK IF PRODUCTION CONFIG EXISTS
if os.path.exists('/etc/config.json'):
with open('/etc/config.json') as config_file:
config = json.load(config_file)
else:
with open('dev_config.json') as config_file:
config = json.l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.