seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
74002868457 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.device import GenericDevice
from .devices import GenericDevice as GenericHandlerDevice
from time import time, sleep
import sys
import logging
logger = logging.getLogger(__name__)
try:
import serial
driver_ok = True
except Import... | clavay/PyScada-Serial | pyscada/serial/device.py | device.py | py | 1,198 | python | en | code | 0 | github-code | 90 |
25043929262 | from fastapi import APIRouter, Depends, HTTPException, Request
from fastapi.responses import JSONResponse
from loguru import logger as log
from sqlalchemy.orm import Session
from ..config import settings
from ..db import database
from ..db.db_models import DbUser
from ..users import user_crud
from .osm import AuthUser... | hotosm/fmtm | src/backend/app/auth/auth_routes.py | auth_routes.py | py | 2,810 | python | en | code | 27 | github-code | 90 |
18213793459 | a,b,c,k = list(map(int,input().split()))
ans = 0
if a >= k:
print(k)
elif a+b >= k:
print(a)
else:
ans += a
k -= (a+b)
ans -= k
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p02682/s338292176.py | s338292176.py | py | 164 | python | zh | code | 0 | github-code | 90 |
72985708455 | import sys
r = sys.stdin.readline
stack = []
n = int(r())
for i in range(n):
input = r().rstrip().split(" ")
if input[0] == '1':
stack.append(input[1])
elif input[0] == '2':
if stack: print(stack.pop())
else: print("-1")
elif input[0] == '3':
print(l... | dayeong089/python_algorithm_study | 백준/Silver/28278. 스택 2/스택 2.py | 스택 2.py | py | 503 | python | en | code | 0 | github-code | 90 |
14623044113 | # NOTE: must set PYTHONPATH variable for pytest to recognize local modules
# export PYTHONPATH=/my/path/to/modules
# OR
# export PYTHONPATH=$(pwd)
import numpy as np
# absehrd modules
from realism import Realism
class TestRealism:
def create_multimodal_object(self, n=1000):
count_min = 5
... | Innovate-For-Health/absehrd | tests/test_realism.py | test_realism.py | py | 6,370 | python | en | code | 5 | github-code | 90 |
27308565021 | import os
import random
from config.Config import DATA_FILES_PATH
def getGeneUniverseOfGivenSize(filename, size):
with open(filename) as genefile:
txt = genefile.read()
words = txt.splitlines()
geneuniverse_list = random.sample(words,size)
geneuniverse = set(geneuniverse_list)
r... | uio-bmi/track_rand | lib/hb/quick/extra/trueGOProject/trueGO/simulatedata.py | simulatedata.py | py | 1,898 | python | en | code | 1 | github-code | 90 |
10243592300 | import datetime
from django.http import HttpRequest
from django.shortcuts import render
from django.forms import ModelForm
from peminjaman.models import Peminjaman
# Create your views here.
def index(request):
data = {
'peminjaman' : Peminjaman.objects.all(),
}
return render(request, 'peminjaman.ht... | gitavns/simimaru27 | peminjaman/views2.py | views2.py | py | 2,609 | python | en | code | 0 | github-code | 90 |
11202001645 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import json
import tensorflow as tf
from qa_data import PAD_ID
from qa_model import Encoder, QASystem, Decoder
from os.path import join as pjoin
import logging
logging.basicConfig(level=logging.IN... | pratyakshs/reading-comprehension | code/train.py | train.py | py | 8,347 | python | en | code | 1 | github-code | 90 |
17963674569 | import collections
N = int(input())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
B = []
i = 0
while i < N-1:
if A[i]==A[i+1]:
B.append(A[i])
i += 2
else:
i += 1
if len(B)<2:
print(0)
else:
print(B[0] * B[1]) | Aasthaengg/IBMdataset | Python_codes/p03625/s522719217.py | s522719217.py | py | 261 | python | en | code | 0 | github-code | 90 |
18298041569 | k = 34
K = 1<<k
nu = lambda L: int("".join([bin(K+a)[-k:] for a in L[::-1]]), 2)
st = lambda n: bin(n)[2:] + "0"
li = lambda s: [int(a, 2) if len(a) else 0 for a in [s[-(i+1)*k-1:-i*k-1] for i in range(len(B)*2-1)]]
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [0] * 100001
for a in A:
... | Aasthaengg/IBMdataset | Python_codes/p02821/s764239547.py | s764239547.py | py | 451 | python | en | code | 0 | github-code | 90 |
16463348587 | from django import forms
from django.core.exceptions import ValidationError #№7 25:25, 36:07, 43:33
from django.forms import ModelMultipleChoiceField
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
import datetime
from .models import Fiz_l, Marriage, Property, Distri... | JokerJudge/divorce_project | divorce/forms.py | forms.py | py | 11,898 | python | ru | code | 0 | github-code | 90 |
71019826217 | import snippets
import tensorflow as tf
import os
# print("Select the training material of the model:")
# path = snippets.fileexplorer(True, "file")[0]
path='./Datasets/fam-final-christina.txt'
model = snippets.model_of_spec(path)
# print("Select directory that holds the checkpoints:")
# checkpoint_path = snippets... | TrainFanatic/WhatsGPT | self/model-resume-training.py | model-resume-training.py | py | 956 | python | en | code | 0 | github-code | 90 |
18249481689 | from collections import Counter
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline
def combinations_count(n, r):
r = min(r, n - r)
numer = reduce(mul, range(n, n - r, -1), 1)
denom = reduce(mul, range(1, r + 1), 1)
return numer // denom
def main():
N = int(... | Aasthaengg/IBMdataset | Python_codes/p02732/s596149484.py | s596149484.py | py | 855 | python | en | code | 0 | github-code | 90 |
69896645418 | import cv2
import os
import tkinter as tk
import tkinter.ttk as ttk
import numpy as np
from PIL import Image, ImageTk
class Application():
def __init__(self):
height = 1000
width = 1500
images = []
tkImages = []
self.selected = 0
self.param1_val = 50
... | dakota0064/Fluorescent_Robotic_Imager | hough_circles_parameter_search.py | hough_circles_parameter_search.py | py | 8,881 | python | en | code | 0 | github-code | 90 |
17177339146 | import pprint
f = open("input", "r")
data = [x.rstrip("\n") for x in f if x.rstrip("\n") != ""]
data = [int(i) for i in data[0].split(",")]
data.sort()
lanternfish = {
0: len([i for i in data if i == 0]),
1: len([i for i in data if i == 1]),
2: len([i for i in data if i == 2]),
3: len([i for i in data ... | feiming/adventofcode2021 | day6/part2.py | part2.py | py | 997 | python | en | code | 0 | github-code | 90 |
18110545879 | from collections import deque
d = deque()
n = int(input())
for i in range(n):
s = input()
if s == "deleteFirst":
d.popleft()
elif s == "deleteLast":
d.pop()
elif s[:6] == "insert":
d.appendleft(int(s[7:]))
else:
delkey = int(s[7:])
if delkey in d:
... | Aasthaengg/IBMdataset | Python_codes/p02265/s362502911.py | s362502911.py | py | 366 | python | en | code | 0 | github-code | 90 |
15238354787 | import abc
import copy
class Product(abc.ABC):
@abc.abstractmethod
def use(self, s):
pass
@abc.abstractmethod
def create_clone(self):
pass
class Manager(object):
def __init__(self):
self._show_case = dict()
def register(self, name, product):
self._show_case... | ElvinKim/python_master | oop_design_pattern/design_pattern_beginning/prototype_pattern/text_style_example.py | text_style_example.py | py | 1,815 | python | en | code | 2 | github-code | 90 |
18314380629 | import sys
sys.setrecursionlimit(10**9)
n = int(input())
graph = [[] for _ in range(n)]
ans = [0] * (n-1)
for i in range(n-1):
a, b = map(int, input().split())
a, b = a-1, b-1
graph[a].append([b, i])
# coloring
def dfs(now, color):
cnt = 1
for to, num in graph[now]:
if cnt == color:
... | Aasthaengg/IBMdataset | Python_codes/p02850/s982712674.py | s982712674.py | py | 455 | python | en | code | 0 | github-code | 90 |
71327916778 | import json
from applications.flow.models import ProcessRun, NodeRun, Process, Node, SubProcessRun, SubNodeRun
from applications.task.models import Task
from applications.utils.dag_helper import PipelineBuilder, instance_dag, instance_gateways
def build_and_create_process(task_id):
"""构建pipeline和创建运行时数据"""
t... | xhongc/streamflow | applications/flow/utils.py | utils.py | py | 3,437 | python | en | code | 81 | github-code | 90 |
23815764187 | from __future__ import annotations
import sys
import uuid
from globus_cli.login_manager import LoginManager
from globus_cli.parsing import command, endpoint_id_arg
from globus_cli.termio import TextMode, display
from ._common import server_id_arg, server_update_opts
if sys.version_info >= (3, 8):
from typing im... | globus/globus-cli | src/globus_cli/commands/endpoint/server/update.py | update.py | py | 2,171 | python | en | code | 67 | github-code | 90 |
9884141212 | from time import time
start_time = time()
with open("14_input.txt") as f:
lines = f.readlines()
def get_all_values(data):
if "X" in data:
start, end = data.split("X", 1)
return get_all_values(start + "0" + end) + get_all_values(start + "1" + end)
return [data]
data = {}
mask = None
for ... | luk2302/aoc | 2020/14_2.py | 14_2.py | py | 947 | python | en | code | 0 | github-code | 90 |
17978512609 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
read = sys.stdin.read
N, *ab = map(int, read().split())
a, b = zip(*zip(*[iter(ab)] * 2))
graph = csr_matrix(([1] * (N - 1), (a, b)), shape=(N + 1, N + 1))
distance = dijkstra(graph, directed=False, indices=[1, N])
d1 = distance[... | Aasthaengg/IBMdataset | Python_codes/p03660/s920027729.py | s920027729.py | py | 482 | python | en | code | 0 | github-code | 90 |
18435446769 | A, B = map(int, input().split())
def f(X):
a = 1
temp = 2
ret = []
while a > 0:
a, b = divmod(X+1, temp)
if temp == 2:
ret.append(a%2)
else:
ret.append(max(b-(temp//2), 0)%2)
temp *= 2
return "".join(map(str, reversed(ret)))
print(int(f(max(0, A-1)), 2)^int(f(B), 2)) | Aasthaengg/IBMdataset | Python_codes/p03104/s991588444.py | s991588444.py | py | 307 | python | en | code | 0 | github-code | 90 |
480573625 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 5 19:44:31 2018
@author: maozhang
"""
# coding: utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
path = os.getcwd()
number = 0
for root, dirname, filenames in os.walk(path):
for filename in filenames:... | zhangmaohust/md_scripts | molecular_dynamics_analyses/ZrCuO_NG_ShearStrainLocalization_20181207.py | ZrCuO_NG_ShearStrainLocalization_20181207.py | py | 1,128 | python | en | code | 0 | github-code | 90 |
12938496173 | '''
Here, we first find the number the xth digit is part of. A number whose largest
power of 10 is n contributes n + 1 digits. The number of digits consumed per decade
is 9n(n + 1). Once the correcth decade is identified, the remainder is used
to indentify which number it belongs to, and the specific digit.
'''
import... | zemanntru/Project-Euler | p40-champernownes-constant.py | p40-champernownes-constant.py | py | 834 | python | en | code | 0 | github-code | 90 |
18381119529 | N = int(input())
L = [list(map(int,input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
w = 0
for x,y in L:
w += x
if w > y:
print('No')
exit()
print('Yes') | Aasthaengg/IBMdataset | Python_codes/p02996/s651003168.py | s651003168.py | py | 191 | python | en | code | 0 | github-code | 90 |
18470405931 | from django.shortcuts import render
import requests
# Create your views here.
def contact(request):
if request.method=="POST":
data={'name':request.POST['name']
,'email':request.POST['email']
,'number':request.POST['number']
,'message':request.POST['message']}
requests.post(... | Aexki/AexBot | Contact/views.py | views.py | py | 485 | python | en | code | 0 | github-code | 90 |
18381431569 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def main():
n, k = list(map(int, input().split()))
a = (n-1)*(n-2)//2
if k > a:
print('-1')
else:
print(n-1+a-k)
#頂点1を中心とするスターグラフ作成
for i in range(2, 1+n):
print(1, i)
cnt = 0
... | Aasthaengg/IBMdataset | Python_codes/p02997/s035541089.py | s035541089.py | py | 533 | python | ja | code | 0 | github-code | 90 |
3527681817 | import numpy as np
import math
import pyhdust.beatlas as bat
from operator import is_not
from functools import partial
import os
import pyfits
from utils import bin_data, find_nearest
from scipy.interpolate import griddata
import atpy
# ==============================================================================
de... | tangodaum/bemcee | reading_routines.py | reading_routines.py | py | 18,952 | python | en | code | 1 | github-code | 90 |
35089669775 | import mat4py
import numpy as np
import gzip
import os
import urllib.request
import sys
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import jax
from utils import dense_to_one_hot
class ImageDataSet(object):
def __init__(self, images, labels, if_autoencoder, input_reshape):
... | someauthors/fishleg | jax/image_datasets.py | image_datasets.py | py | 8,263 | python | en | code | 0 | github-code | 90 |
18100208209 | from functools import lru_cache
n = int(input())
@lru_cache(maxsize=None)
def fib(n):
if n==0 or n==1:
return 1
else:
return fib(n-1)+fib(n-2)
print(fib(n))
| Aasthaengg/IBMdataset | Python_codes/p02233/s579323796.py | s579323796.py | py | 198 | python | en | code | 0 | github-code | 90 |
18315932759 | def main():
from collections import deque
INF = float('inf')
n, m = map(int, input().split())
s = list(map(int, input()))
dp = [INF] * (n + 1)
dp[n] = 0
queue = deque([0])
i = n - 1
while i >= 0:
while True:
if not queue:
print(-1) ... | Aasthaengg/IBMdataset | Python_codes/p02852/s899272089.py | s899272089.py | py | 831 | python | en | code | 0 | github-code | 90 |
4999577336 | from __future__ import print_function
import gym
import tensorflow as tf
import tensorlayer as tl
from rlflow.core import tf_utils
from rlflow.policies.f_approx import Network
from rlflow.algos.grad import PolicyGradient
from rlflow.core.input import InputStreamDownsamplerProcessor, InputStreamSequentialProcessor, Inp... | tpbarron/rlflow | examples/nnet_pong_pg.py | nnet_pong_pg.py | py | 2,188 | python | en | code | 20 | github-code | 90 |
39711509498 | from PIL import Image
import requests
import streamlit as st
from streamlit_option_menu import option_menu
from streamlit_lottie import st_lottie
img_1 = Image.open("C:\\Users\\sneha\\OneDrive\\Desktop\\website\\images\\img1.png")
img_2 = Image.open("C:\\Users\\sneha\\OneDrive\\Desktop\\website\\images\\img2.... | Sneha12123/Python-projects | 4_Certificates.py | 4_Certificates.py | py | 2,188 | python | en | code | 0 | github-code | 90 |
12692186327 | import os
import time
import rospy
import numpy as np
from datetime import datetime
from learning_fc import model_path, datefmt
from learning_fc.robot import RobotInterface
from learning_fc.models import ForcePI
from learning_fc.training import make_eval_env_model
N_TRIALS = 30
N_SECS = 6.0
# load policy and env
... | llach/learning_fc | learning_fc/robot/video_eval.py | video_eval.py | py | 1,970 | python | en | code | 0 | github-code | 90 |
10876127047 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
from os.path import join
from Attention_Classification.WordAttn import WordAttn
from Attention_Classification.SentenceAttn import SentenceAttn
class HierarchicalAttention(nn.Module):
def __init__(self, config):
super(Hierarchi... | raja-1996/Pytorch_TextClassification | Attention_Classification/HierarchicalAttention.py | HierarchicalAttention.py | py | 2,327 | python | en | code | 0 | github-code | 90 |
4295566602 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 17 17:26:39 2017
@author: LFU
"""
#%% Import packages
from eo_exp_functions_trackpy import *
import platform
# ==========================================================================
## Main ##
def analysis_trackpy(dirname, z_list, voltage, fit... | ss555/deepFish | 0-identification-static/dev/tracking-alpha/track_alpha.py | track_alpha.py | py | 5,386 | python | en | code | 0 | github-code | 90 |
39814235067 | ## Reecepbcups - December 10th, 2018.
## Discord: Reecepbcups#3370
# A python app to scan google dorks and gather network cameras to homes, businesses, and the Government
# Ex. http://camera.buffalotrace.com/view/view.shtml?id=92509&imagePath=/mjpg/video.mjpg&size=1
# -------------------------------------------... | readloud/dorkgen | DorkCameraFinder/CameraFinderBeta.py | CameraFinderBeta.py | py | 2,572 | python | en | code | 10 | github-code | 90 |
18178500659 | #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
L, R, d = map(int, input().split())
l = list(range(L, R+1))
cnt =0
for i in l:
if i%d==0:
cnt += 1
print(cnt)
if __name__ == '__main__':
main() | Aasthaengg/IBMdataset | Python_codes/p02606/s587958852.py | s587958852.py | py | 244 | python | en | code | 0 | github-code | 90 |
20031649730 | import glob
import os
import shutil
import pytest
from cobbler import tftpgen
from cobbler.items.distro import Distro
def test_copy_bootloaders(tmpdir, cobbler_api):
"""
Tests copying the bootloaders from the bootloaders_dir (setting specified in /etc/cobbler/settings.yaml) to the
tftpboot directory.
... | SolitaryGarrison/cobbler-t | tests/tftpgen_test.py | tftpgen_test.py | py | 2,913 | python | en | code | 0 | github-code | 90 |
74948532 | import sys
input=sys.stdin.readline
input_ = list(input().strip())
sign = []
num_li = []
num = ""
minus_index = []
j=0
for i in range(len(input_)):
if input_[i] == '+':
j+=1
sign.append(input_[i])
if num != '':
num_li.append(int(num))
num=''
elif input_[i]=='-':... | YeongHyeon-Kim/BaekJoon_study | 0627/1541_잃어버린괄호.py | 1541_잃어버린괄호.py | py | 1,173 | python | en | code | 1 | github-code | 90 |
18446553779 | p = []
for i in range(3):
a, b = input().split()
p.append(a)
p.append(b)
if sorted(p) == ['1','2','2','3','3','4']:
print("YES")
else:
print("NO") | Aasthaengg/IBMdataset | Python_codes/p03130/s737031972.py | s737031972.py | py | 157 | python | en | code | 0 | github-code | 90 |
3493233744 | import random
class Winner:
def __init__(self):
self.winning_messages = [
"You can do it!",
"Believe in yourself!",
"Go get 'em tiger!",
"Success is just around the corner!",
"You are doing great!",
"Awesome! Keep it up!",
... | shib1111111/Rock-Paper-Scissors-Game | winner.py | winner.py | py | 435 | python | en | code | 0 | github-code | 90 |
36215832820 | def solution(n, money):
answer = 0
dp = [0] * (n+1)
dp[0] = 1
for m in money:
for i in range(1, n+1):
if i - m >= 0:
dp[i] += dp[i-m]
print(dp, m)
answer = dp[n] % 1000000007
return answer
| nbalance97/Programmers | Lv 3/거스름돈.py | 거스름돈.py | py | 272 | python | en | code | 0 | github-code | 90 |
72207928938 | # -*- coding: utf-8 -*-
# @Time : 2019/8/8 0008 14:06
# @Author : 没有蜡笔的小新
# @E-mail : sqw123az@sina.com
# @FileName: Move Zeroes.py
# @Software: PyCharm
# @Blog :https://blog.csdn.net/Asunqingwen
# @GitHub :https://github.com/Asunqingwen
"""
Given an array nums, write a function to move all 0's to the end of ... | Asunqingwen/LeetCode | easy/Move Zeroes.py | Move Zeroes.py | py | 687 | python | en | code | 0 | github-code | 90 |
15167295671 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import streamlit as st
import folium
import requests
from streamlit_folium import folium_static
import requests
import calendar
import json
sns.set(style='whitegrid')
bStates = pd.read_csv("output/final_dataframe.csv")
bSellers = pd.read_csv("... | khalidbagus/olist-ecom | dashboard/dashboard.py | dashboard.py | py | 12,376 | python | en | code | 0 | github-code | 90 |
3961675807 | import os
import sqlite3
from collections import Counter
def parse_decompositions(decomposition_file_path, database_path):
if not os.path.isfile(decomposition_file_path):
raise Exception("Couldn't find {}!".format(decomposition_file_path))
with open(decomposition_file_path) as f_decomposition:
... | Mr-Pepe/pengyou-data-generator | src/cjdecomp_parser.py | cjdecomp_parser.py | py | 1,829 | python | en | code | 0 | github-code | 90 |
39019517757 | #!/usr/bin/env python
"""
Create TimeSeries Model Data
"""
import numpy as np
import pandas as pd
import logging
from ep_clustering._utils import (
Map, fix_docs, convert_matrix_to_df, convert_df_to_matrix
)
from ep_clustering.data._gibbs_data import (
GibbsData, _categorical_sample
)... | aicherc/EP_Collapsed_Gibbs | ep_clustering/data/_timeseries_data.py | _timeseries_data.py | py | 9,049 | python | en | code | 1 | github-code | 90 |
11393586133 | from django.urls import path
from django.conf.urls import include
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('dashboard/', views.dashboard, name='dashboard'),
path('accounts/login/dashboard/',views.dashboard,name='dashboard'),
path('atendimento/<int:pk>/', views.atend... | Andressa-Anthero7/LP-ANTHERUS-V1 | lp/urls.py | urls.py | py | 1,495 | python | pt | code | 0 | github-code | 90 |
14064949971 | from typing import List
import iris
import numpy as np
import pandas as pd
import pytest
from iris.coords import AuxCoord, DimCoord
from iris.cube import Cube
from improver.calibration.dz_rescaling import ApplyDzRescaling
from improver.constants import SECONDS_IN_HOUR
from improver.metadata.constants.time_types impor... | metoppv/improver | improver_tests/calibration/dz_rescaling/test_apply_dz_rescaling.py | test_apply_dz_rescaling.py | py | 9,295 | python | en | code | 95 | github-code | 90 |
13622530898 | #! /usr/bin/python
from subprocess import Popen, PIPE
from PSRpy.tempo import read_resid2
import numpy as np
import sys
def write_TOAs_to_file(
toas,
toa_uncertainties,
frequency_channels,
n_epochs,
n_channels_per_epoch,
observatory_code = "@",
output_file="simulated.tim"
):
"""
... | emmanuelfonseca/PSRpy | PSRpy/simulate/simulate_toas.py | simulate_toas.py | py | 5,643 | python | en | code | 2 | github-code | 90 |
20971826245 | from typing import List
from boto3 import client
def list_s3_contents(bucket_name: str, prefix: str) -> List[str]:
s3_conn = client('s3') # type: BaseClient ## again assumes boto.cfg setup, assume AWS S3
s3_result = s3_conn.list_objects_v2(Bucket=bucket_name, Prefix=prefix)
print(s3_result)
if 'Co... | 0x2539/simpleCI | src/screenshots_s3/s3_utils.py | s3_utils.py | py | 1,021 | python | en | code | 1 | github-code | 90 |
12093058834 | # -*- coding: utf-8 -*-
"""
File script_note.py
@author:ZhengYuwei
"""
import tensorflow as tf
def visual_meta_with_tensorboard():
""" 使用tensorflow查看checkpoint、meta文件中的网络结构 """
sess = tf.Session()
saver = tf.train.import_meta_graph('model.ckpt.meta') # load meta
saver.restore(sess, 'model.ckpt') # l... | zheng-yuwei/YOLOv3-tensorflow | utils/script_note.py | script_note.py | py | 483 | python | en | code | 5 | github-code | 90 |
18148803059 | n = int(input())
p_taro = 0
p_hanako = 0
for i in range(n):
taro, hanako = map(str, input().split())
cards = tuple(sorted((taro, hanako)))
#print(cards)
if taro == hanako:
p_taro += 1
p_hanako += 1
else:
if cards == (taro, hanako):
p_hanako += 3
#print("hanako win")
else:
p_taro += 3
#print("t... | Aasthaengg/IBMdataset | Python_codes/p02421/s827158192.py | s827158192.py | py | 354 | python | en | code | 0 | github-code | 90 |
306016764 | """Module containing the tests for the default scenario."""
# Standard Python Libraries
import os
# Third-Party Libraries
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
@pytest.mark.par... | cisagov/ansible-role-kali | molecule/default/tests/test_default.py | test_default.py | py | 2,811 | python | en | code | 9 | github-code | 90 |
25293959382 | # Função para verificar notas
def notas (*num, sit = False):
'''
Função para adicionar notas a determinado aluno e saber sua situação
:param num: lista com varios numeros
:param sit: True printa a situação , False omite a situação
:return: dicionario sobre a informação d eum aluno
'''
# inic... | Merovizian/Aula21 | Desafio105 - Funçao le notas.py | Desafio105 - Funçao le notas.py | py | 943 | python | pt | code | 0 | github-code | 90 |
36843673446 | from rest_framework.test import APIClient
from django.urls import reverse
def test_workspace_membership_permission_by_slack_api_call(worker_user_mock, mocker):
random_protected_url = reverse("choose-actions")
client = APIClient()
client.credentials(HTTP_USER_AGENT="Slackbot 1.0")
mocker.patch("request... | COXIT-CO/lannister_bot | frontend/tests/slack/test_external_api_calls.py | test_external_api_calls.py | py | 548 | python | en | code | 0 | github-code | 90 |
26194617115 | from django.conf import settings
from django.db import models
import uuid
class Project(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='user_projects')
name = models.CharField(max_length=... | chpancrate/ocrpy_project10 | support/models.py | models.py | py | 3,970 | python | en | code | 0 | github-code | 90 |
12078344534 | import pytest
import torch
from bayes_dip.data import get_ray_trafo, get_kmnist_testset, SimulatedDataset
from bayes_dip.dip import DeepImagePriorReconstructor
from bayes_dip.probabilistic_models import get_default_unet_gaussian_prior_dicts, ParameterCov, NeuralBasisExpansion, MatmulNeuralBasisExpansion, ImageCov, Matm... | educating-dip/bayes_dip | tests/test_observation_cov.py | test_observation_cov.py | py | 3,284 | python | en | code | 2 | github-code | 90 |
18168477719 | #ABC 175 C
x, k, d = map(int, input().split())
x = abs(x)
syou = x // d
amari = x % d
if k <= syou:
ans = x - (d * k)
else:
if (k - syou) % 2 == 0: #残りの動ける数が偶数
ans = amari
else:#残りの動ける数が奇数
ans = abs(amari - d)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02584/s180422158.py | s180422158.py | py | 293 | python | ja | code | 0 | github-code | 90 |
6087254473 | import reverse_mapping as revm
import mbuild as mb
import mdtraj as md
import time
import sys
sys.setrecursionlimit(10000)
def from_traj(compound, traj):
atom_mapping = dict()
for residue in traj.top.residues:
res_compound = mb.compound.Compound()
for atom in residue.atoms:
new_ato... | uppittu11/reverse_mapping | reverse_mapping/rigorous/test.py | test.py | py | 5,552 | python | en | code | 0 | github-code | 90 |
10021487072 | """
Anaflow subpackage providing miscellaneous tools.
Subpackages
^^^^^^^^^^^
.. currentmodule:: anaflow.tools
.. autosummary::
:toctree:
laplace
mean
special
coarse_graining
Functions
^^^^^^^^^
Annular mean
~~~~~~~~~~~~
.. currentmodule:: anaflow.tools.mean
Functions to calculate dimension depen... | GeoStat-Framework/AnaFlow | src/anaflow/tools/__init__.py | __init__.py | py | 1,662 | python | en | code | 33 | github-code | 90 |
18326598609 | n = int(input())
furui = [i for i in range(10**6+2)]
ans = 9999999999999
yakusuu = []
for i in range(1,int(n**0.5)+1+1):
if n%i == 0:
yakusuu.append(i)
for i in yakusuu:
ans = min(i+n//i,ans)
# print(i,ans)
print(ans-2)
| Aasthaengg/IBMdataset | Python_codes/p02881/s109314325.py | s109314325.py | py | 283 | python | en | code | 0 | github-code | 90 |
19255791705 | from sys import stdin
from collections import deque
def main():
stdin = open('./test_case.txt', 'r')
test_case = int(stdin.readline())
for _ in range(test_case):
queue = deque()
positions = []
num_of_stores = int(stdin.readline())
home_pos = list(map(int, stdin.readline().... | ag502/algorithm | Problem/BOJ_9205_맥주 마시면서 걸어가기/main.py | main.py | py | 1,304 | python | en | code | 1 | github-code | 90 |
9513504940 | import numpy as np
import matplotlib.pyplot as plt
class LSTM:
def __init__(self, n_inputs):
self.n_inputs = n_inputs
self.weights_input_X = .1 * np.random.randn(n_inputs)
self.weights_input_y = .1 * np.random.randn(n_inputs)
self.bias_input = 0
self.weights_i... | CANTSOAR/SimpleNeuralNet | lstmfromscratch.py | lstmfromscratch.py | py | 10,093 | python | en | code | 0 | github-code | 90 |
18672328169 | from django.urls import path
from .views import *
from rest_framework.routers import DefaultRouter
app_name = "customer"
urlpatterns = [
path('customer/', CustomerRegistrationView.as_view(), name='customer_registration'),
path('surety/', SuretyRegistrationView.as_view(), name='surety_registration'),
path('add_supp... | khoji2001/Django-project | customer/urls.py | urls.py | py | 831 | python | en | code | 0 | github-code | 90 |
21735877711 | # 在开发时想要预判到所有的错误,还是有一定的难度
try:
# 1.提示用户输入一个整数
num = int(input("输入一个整数:"))
# 2.使用8除以用户输入的整数并且输出
result = 8 / num
print(result)
# except ZeroDivisionError: # 错误类型1
# print("除0错误") # 针对错误类型1 ,对应的代码处理
except ValueError:
print("请输入正确整数")
except Exception as result:
print("未知错误 %s" % res... | niushufeng/Python_202006 | 算法代码/面向对象/异常/捕获未知错误.py | 捕获未知错误.py | py | 499 | python | zh | code | 3 | github-code | 90 |
27616785214 | import unittest
class PaymentTest(unittest.TestCase):
def test_paymentDolar(self):
print("This is test payment by dolar")
self.assertTrue(True)
def test_paymentTk(self):
print("This is test payment by TK")
self.assertTrue(True)
if __name__=="__main__":
unitte... | nazmul-cse48/PYTHON_CODE_ALL | All_test_Suites/Package2/TC_paymentTest.py | TC_paymentTest.py | py | 329 | python | en | code | 0 | github-code | 90 |
13733372500 | # -*- coding: ISO-8859-1 # Encoding declaration -*-
# file: ctp_performance.py
#
# description
"""\n\n
grep abs msecs, ctp no, msecs this ctp out of given logfile
"""
import sys
import re
def grep_data(filename):
"""open file, grep data, write to stdout"""
rgx = re.compile(r'abs_msecs\: (\d+) ... | bbbkl/python | id_grabber/ctp_performance.py | ctp_performance.py | py | 798 | python | en | code | 0 | github-code | 90 |
34838778934 | from bs4 import BeautifulSoup
import urllib.request as urllib2
import random
import os
import sys
import requests
import time
alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
double_alphabet = []
for char_1 in alphabet:
for char_2 in alphabet:
... | jacobjinkelly/clinical-ad | allacronyms/scrape_allacronyms.py | scrape_allacronyms.py | py | 11,614 | python | en | code | 3 | github-code | 90 |
18211595729 | N, M = map(int, input().split())
A = []
B = []
for _ in range(M):
a, b = map(int, input().split())
A.append(a)
B.append(b)
P = [[] for _ in range(N + 1)]
for a, b in zip(A, B):
P[b].append(a)
P[a].append(b)
ans = [0] * (N + 1)
ans[1] = 1
next_numbers = [1]
while next_numbers:
check_number ... | Aasthaengg/IBMdataset | Python_codes/p02678/s566234244.py | s566234244.py | py | 576 | python | en | code | 0 | github-code | 90 |
15041150889 | '''
Something Good as indicated by ...
'''
import random
def welcome_message(): # Welcome message
print("Welcome to this sorting algorithm")
def create_a_random_list(n):
arr = []
for i in range(n):
arr.append(random.randint(1, 100))
return arr
def babble_sorting(arr):
n = len(arr)
... | Ethanlinyf/Pokemon-Park | DataStructure&Alogrighm/Sorting/sorting.py | sorting.py | py | 630 | python | en | code | 4 | github-code | 90 |
70043441578 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import random
import PIL
import torch
import scipy.signal
from IPython.display import *
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
def imageFromTensor(tensor, mean, std):
img ... | briandw/ColorEmbeddings | graph_utils.py | graph_utils.py | py | 2,571 | python | en | code | 1 | github-code | 90 |
26757653098 | def get_text():
with open("day12/test.txt", "r") as file:
the_text = file.read()
return the_text
input=get_text
print(input)
### dict={'strat': [, , ], 'A': [ , , ], 'end': [ , , ] }
def read_input_into_dict():
input =get_text()
dict={}
lines_split_into_arrays= input.split('\n')
ite... | Bokha/AdventOfCode | day12/run.py | run.py | py | 692 | python | en | code | 0 | github-code | 90 |
46371615853 | import numpy as np
import cv2
from scipy.spatial.distance import cdist
class sub_frame:
"""Algorithms which work over the domain of a single frame."""
def mse(frame1,frame2):
#return np.average(cdist(frame1,frame2)**2)
return np.average(np.square(np.subtract(frame2,frame1)))
def psnr(frame... | liampulles/WITS_Repo | subify/helper.py | helper.py | py | 4,143 | python | en | code | 0 | github-code | 90 |
17971903127 | import connexion
import six
from swagger_server.models.book import Book # noqa: E501
from swagger_server.models.error import Error # noqa: E501
from swagger_server import util
books = []
def create_book(body): # noqa: E501
"""Метод добавления новой книги в каталог
Метод предназначен для сохранения в БД д... | DariaDon/HW_Swagger_REST_API_Library | controllers/book_controller.py | book_controller.py | py | 3,199 | python | ru | code | 0 | github-code | 90 |
24782224619 | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from website import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^pages/aboutus/$', views.AboutUsView.as_view(), name="AboutUsView"),
url(r'^p... | contrerasjlu/bullpen-arepas-prod | website/url.py | url.py | py | 2,152 | python | en | code | 0 | github-code | 90 |
4705422993 | import hashlib
import hmac
import time
from typing import Dict
from urllib.parse import urlencode
import requests
class LocalBitcoinsError(Exception):
pass
class Client:
def __init__(
self,
hmac_key: str,
hmac_secret: str,
root_addr: str = "https://localbitcoins.com",
):... | Nurlan23/localbitcoins | localbitcoins/client.py | client.py | py | 1,931 | python | en | code | 0 | github-code | 90 |
21509697125 | import io
from typing import Annotated
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
from fastapi.responses import Response
from sqlalchemy.orm import Session
from config import HOST, PORT
from src.media_upload.crud import _upload_media
from src.media_upload.models import Media
from src.medi... | Hastred45/bewise_task_2 | src/media_upload/routers.py | routers.py | py | 1,831 | python | en | code | 0 | github-code | 90 |
74737654697 | import unittest
from romaji.transliterator import transliterate
class TestTransliterator(unittest.TestCase):
case = {
'きょうと': [
'kilyoto',
'kilyouto',
'kixyoto',
'kixyouto',
'kyoto',
'kyouto',
],
'トッキョ': [
... | jikyo/romaji4p | romaji/tests/test_transliterator.py | test_transliterator.py | py | 1,190 | python | en | code | 1 | github-code | 90 |
1864333768 | def long(l1):
a=[]
for i in l1:
b=len(i)
a.append(b)
a.sort()
print("The length of longest word is",a[-1])
l1=[]
el=input("Enter the words:")
l1=el.split(" ")
print(l1)
long(l1)
| anjana-c-a/Programmimg-Lab | longest_word.py | longest_word.py | py | 189 | python | en | code | 0 | github-code | 90 |
18388221129 | import sys
sys.setrecursionlimit(10**6)
#a = int(input())
#b = list(map(int, input().split()))
p, q, r = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]
ans = min([... | Aasthaengg/IBMdataset | Python_codes/p03011/s482367011.py | s482367011.py | py | 347 | python | en | code | 0 | github-code | 90 |
33855575791 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 15 22:01:25 2018
@author: varunmiranda
Citations:
https://www.geeksforgeeks.org/break-list-chunks-size-n-python/
https://stackoverflow.com/questions/17870612/printing-a-two-dimensional-array-in-python
https://www.geeksforgeeks.org/minimax-alg... | sumeetmishra199189/Elements-of-AI | Games and Bayes/betsy test.py | betsy test.py | py | 6,459 | python | en | code | 2 | github-code | 90 |
11481379739 | import os, select
import sys
import pathlib
import PIL
import time
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
import numpy as np
checkpoint_path = "/data/model2.tf"
checkpoint_dir = ... | sagor999/poker_ml | card_recognizer_ml/main.py | main.py | py | 7,488 | python | en | code | 18 | github-code | 90 |
25744674342 | '''
Write a program to select random door as prize door and randomly select a
contestant door.
Charlie Say
Alex Nylund
CS 161 10:00AM
_____PSUEDO_____
import random
make door options as objects in list
track game counts
track win counts
for loop:
prize door = random
contestant = random
if prize door == ... | Charlie-Say/CS-161 | assignments/assignment 11/monty_hall_1.py | monty_hall_1.py | py | 855 | python | en | code | 0 | github-code | 90 |
14484996156 |
import curses
class Target:
def __init__(self, width, xoff, yoff):
self.width = width
self.win = curses.newwin(10, self.width, yoff, xoff)
self.win.refresh()
self.current = None
def paint(self):
self.win.clear()
if self.current != None:
for p in self.current.pieces:
self.win.addstr(0, p.x, " ",... | munglaub/ctris | target.py | target.py | py | 362 | python | en | code | 0 | github-code | 90 |
14501289406 | from direct.directnotify import DirectNotifyGlobal
import HoodDataAI
from toontown.toonbase import ToontownGlobals
from toontown.safezone import ButterflyGlobals
from toontown.episodes.DistributedPrologueEventAI import DistributedPrologueEventAI
class SBHoodDataAI(HoodDataAI.HoodDataAI):
notify = DirectNotifyGloba... | TTOFFLINE-LEAK/ttoffline | v2.5.7/toontown/hood/SBHoodDataAI.py | SBHoodDataAI.py | py | 1,186 | python | en | code | 3 | github-code | 90 |
18452899489 | n=int(input())
num=[]
a=[]
b=[]
for i in range(n):
A,B=map(int,input().split())
a.append(A)
b.append(B)
num.append([A,B,A+B])
ansa=sum(a)
ansb=sum(b)
num.sort(key=lambda x: x[2],reverse=True)
for i in range(n):
if i%2==0:
ansb-=num[i][1]
else:
ansa-=num[i][0]
print(ansa-ansb)
| Aasthaengg/IBMdataset | Python_codes/p03141/s582983832.py | s582983832.py | py | 317 | python | en | code | 0 | github-code | 90 |
3600096614 | # _*_ coding: UTF-8 _*_
# @Time : 2020/12/2 19:38
# @Author : LiuXiaoQiang
# @Site : http:www.cdtest.cn/
# @File : token_test.py
# @Software : PyCharm
import requests
import pprint
class scp:
def token_test(self):
ak = "06F8XRdDMg9Fk3zeXDvNGRDf"
sk = "AvynGXGhYd5EOZoFxssnZOgiKNB8i4U... | qq183727918/influence | verification/token_test.py | token_test.py | py | 692 | python | en | code | 0 | github-code | 90 |
31473155847 | import time
from Crypto.Cipher import AES
import cv2
import numpy as np
import pywt
from tkinter.filedialog import askopenfilename, askdirectory
import tkinter as tk
from tkinter import messagebox
from PIL import Image, ImageTk
import PIL
class Application(tk.Frame):
def __init__(self, master=None):
tk.Fr... | SonThanhNguyen13/stegano | GUI_extract.py | GUI_extract.py | py | 9,048 | python | en | code | 0 | github-code | 90 |
44531349193 | from flask import Flask, redirect, session, request, jsonify, send_from_directory
from flask_restful import Api, Resource, reqparse
#from flask_cors import CORS #comment this on deployment
from validate_email_address import validate_email
from flask_cors import CORS, cross_origin
from flask_session import Session
impo... | Aaryanmukherjee/CatHack2022 | app.py | app.py | py | 4,926 | python | en | code | 0 | github-code | 90 |
5223285727 | #!/usr/bin/env python3
Infinite = 1000000
RATE_DEATH = 100
# Dangers
DANGER_RATE_ZOMBIE = RATE_DEATH #death
DANGER_RATE_NEAR_ZOMBIE_FACE = RATE_DEATH #int(RATE_DEATH*0.9)
DANGER_RATE_NEAR_ZOMBIE_BACK = (RATE_DEATH*2)//3
DANGER_RATE_ZOMBIE_EXIT = RATE_DEATH//2
DANGER_RATE_NEAR_PLAYER_BACK = (RATE_DEATH*2)//3 #c... | BlackVS/Bots | EPAM/2020/Zombie/current/game_rates.py | game_rates.py | py | 1,460 | python | en | code | 1 | github-code | 90 |
71775290536 | __author__ = 'Fabian Gebhart'
# This file "AO_reset.py" resets the Adaptive Optics Model, to
# start all over again. If, for any reason, the main program
# should be confused or # messed up. Just quit it and run this
# file. It iterates through all # steppers and assigns the
# found (moving) laser points. For mo... | fgebhart/adaptive-optics-model | code/AO_reset_old.py | AO_reset_old.py | py | 12,786 | python | en | code | 5 | github-code | 90 |
30298551050 | from kivy.app import App
from kivy.uix.screenmanager import Screen
from kivy.factory import Factory
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.uix.popup import Popup
import os
class Editor(Screen):
pass
class LoadDialog(FloatLayout):
load = ObjectPrope... | HitechXXI/MyContas | main.py | main.py | py | 1,568 | python | en | code | 0 | github-code | 90 |
18814510657 | import pytz
import lxml
import dateutil.parser
import datetime
import re
from utils import LXMLMixin
from openstates.scrape import Scraper, Event
from openstates.exceptions import EmptyScrape
class MAEventScraper(Scraper, LXMLMixin):
_TZ = pytz.timezone("US/Eastern")
date_format = "%m/%d/%Y"
verify = Fal... | openstates/openstates-scrapers | scrapers/ma/events.py | events.py | py | 4,929 | python | en | code | 820 | github-code | 90 |
18362545079 | from heapq import heapify, heappush, heappop
def divisor(n):
divisors = []
i = 1
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i != n / i:
divisors.append(n // i)
i += 1
divisors.sort()
return divisors
N, K = map(int, input().split(... | Aasthaengg/IBMdataset | Python_codes/p02955/s700446557.py | s700446557.py | py | 837 | python | en | code | 0 | github-code | 90 |
72096022057 | import logging
import requests
logger = logging.getLogger(__name__)
#------------------------------------------------------------------------------------------#
def create_component_inventory_item(baseURL, projectID, componentId, componentVersionId, licenseId, authToken, inventoryItemName ):
logger.debug("Enterin... | flexera-public/sca-codeinsight-restapi-python | inventory/create_inventory.py | create_inventory.py | py | 2,832 | python | en | code | 1 | github-code | 90 |
30615893043 | import pytest
from sodic.drawables import Rectangle
from sodic.drawables.annotations import BoundingBox, Segmentation
@pytest.mark.parametrize(
"rectangle,expected_segmentation",
[
(Rectangle(10, 10, 60, 60), Segmentation([10, 10, 60, 10, 60, 60, 10, 60])),
(
Rectangle(10.5, 10.5,... | Xalanot/sodic | tests/drawables/rectangle_test.py | rectangle_test.py | py | 1,276 | python | en | code | 0 | github-code | 90 |
38736489250 | import torch
import math
import torch.nn as nn
import torch.nn.functional as F
#---bam---
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class ChannelGate(nn.Module):
def __init__(self, gate_channel, reduction_ratio=16, num_layers=1):
super(ChannelGate... | pjirayu/STOS | models/bam.py | bam.py | py | 5,418 | python | en | code | 1 | github-code | 90 |
23111029918 |
from src.pipe.recommend import RecommenderPipeline
import logging
from memory_profiler import profile as mem_profile
import warnings
warnings.filterwarnings("ignore")
def recommend_pipeline(key_skills_query):
try:
recommender = RecommenderPipeline()
results = recommender.get_recommendations(key_s... | bsb4018/job_rec_ss_bsb | src/profile/predict_memory_profile.py | predict_memory_profile.py | py | 677 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.