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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
70802423978 | from scipy.io import loadmat
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
# load training and... | aojiu/street_view_SVHN | wx2251_WeiyaoXie_individualProject.py | wx2251_WeiyaoXie_individualProject.py | py | 6,602 | python | en | code | 0 | github-code | 90 |
41463743134 | #Author guo
#动作链
#交互作用都是针对某个节点进行的
#还有一些操作,他们没有特定的执行对象,比如鼠标拖拽,键盘按键
#这些通过动作链来执行
from selenium import webdriver
from selenium.webdriver import ActionChains
url='https://www.runoob.com/try/try.php?filename=jquery-api-droppable'
browser=webdriver.Chrome()
browser.get(url)
browser.switch_to.frame('iframeResult')#switch_to... | guojia60180/guo.github-io | 爬虫实例/selenium学习4.py | selenium学习4.py | py | 789 | python | zh | code | 0 | github-code | 90 |
34047383474 | import turtle
#side = 20
window = turtle.Screen()
window.bgcolor("lightgreen")
def draw_square (animal, size):
for _ in range (4):
animal.forward(size)
animal.left(90)
def draw_gap (animal,size):
animal.stamp()
animal.penup()
animal.forward(50)
animal.pendown()
animal.stamp(... | AJoh96/BasicTrack_Alida_WS2021 | Week40/Exercise 4.9.1.py | Exercise 4.9.1.py | py | 434 | python | en | code | 0 | github-code | 90 |
18290533779 | N = int(input())
slist = []
tlist = []
from itertools import accumulate
for _ in range(N):
s, t = input().split()
slist.append(s)
tlist.append(int(t))
cum = list(accumulate(tlist))
print(cum[-1]-cum[slist.index(input())])
| Aasthaengg/IBMdataset | Python_codes/p02806/s394686276.py | s394686276.py | py | 234 | python | en | code | 0 | github-code | 90 |
18349073559 | import sys
input = sys.stdin.readline
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
league = [0]*(n+1)
cnt = 0
while True:
topop = []
if cnt == 0:
for i,player in enumerate(a):
x = player[-1]
if league[x] == i+1:
topop.append(x)
topop.append(i+1)
else... | Aasthaengg/IBMdataset | Python_codes/p02925/s957494724.py | s957494724.py | py | 806 | python | en | code | 0 | github-code | 90 |
34655861551 | import os
import json
import nltk
from nltk.tokenize import word_tokenize
from DEA_methods import *
fileDir = os.path.dirname(os.path.abspath(__file__)) #
parentDir = os.path.dirname(fileDir) # Directory of the Module directory
def entityVal(entityFinderOutput):
'''
Run the validation (comparison to gener... | strath-ace/smart-nlp | SpaceLexiconGenerator/OntologyEntitiesFinder/entityVal.py | entityVal.py | py | 4,148 | python | en | code | 12 | github-code | 90 |
70543227818 | """A simple geometric Brownian Motion Model"""
import numpy as np
def gbm_model(mu, sigma, start, steps, t_step=1.0):
"""Implementation of the model"""
prices = [start]
for _ in range(steps - 1):
prices.append(prices[-1] *
(1.0 + mu * t_step +
sigma * n... | jamlamberti/Py4FinOpt | backtest/gbm_model.py | gbm_model.py | py | 375 | python | en | code | 1 | github-code | 90 |
5745376990 |
import threading
from wsgiref import simple_server
import seaborn as sns
import os
from logger_class import getLog
from flask import Flask, render_template, request, jsonify, Response, url_for, redirect
from flask_cors import CORS, cross_origin
import pandas as pd
from datamongodb import MongoDBmanagement
from Flipkar... | Vish2427/Flipkart-Scrapper | app.py | app.py | py | 6,704 | python | en | code | 0 | github-code | 90 |
41783984949 | from pyfirmata import Arduino, util
import os
if os.name == 'nt':
from pynput import keyboard
import time
"""defining pins"""
#define ENB 5
#define IN1 7
#define IN2 8
#define IN3 9
#define IN4 11
#define ENA 6
ENB = 5
IN1 = 7
IN2 = 8
IN3 = 9
IN4 = 11
ENA = 6
def forward():
"""
ORIGINAL function
void... | ArifSohaib/morpheus_chair_arduino | morpheus_chair_pkg/scripts/simple_firmata.py | simple_firmata.py | py | 4,531 | python | en | code | 0 | github-code | 90 |
4459137510 | #!/usr/bin/env python
# coding: utf-8
# In[70]:
import tensorflow as tf
import cv2
import os
import numpy as np
import matplotlib.pyplot as plt
# In[74]:
img=cv2.imread("D:\EDI_dataset\With_mask\\0_0_0 copy 18.jpg")
# In[75]:
img=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img)
# In[13]:
img.shape
... | anamaymb/Myfiles2 | Python/Major project/Mask/Untitled1 (1).py | Untitled1 (1).py | py | 4,647 | python | en | code | 0 | github-code | 90 |
37804772934 | #!/usr/bin/python
from notify import NotifyBase
import filecmp
import logging as log
import os
import subprocess
class Pingsweep(NotifyBase):
CONF_SECTION = "Pingsweep"
def get_help_configuration(self):
return ""
def get_mailto(self):
return self.get_configs().get(self.CONF_SECTION, "mailto")
def get_me... | acreations/acreations-scripts | src/python/pingsweep.py | pingsweep.py | py | 2,670 | python | en | code | 0 | github-code | 90 |
66380874 | #Write a Python program to remove and print every third number from a list of numbers until the list becomes empty
num_list = []
def print_function(num_list):
while len(num_list) >= 3:
print(num_list.pop(2))
items = int(input('enter numbers of items in list:'))
for n in range(1,items+1):
element = i... | vedang-jammy/Python-Programs | exercises/basic-part2/b2.py | b2.py | py | 399 | python | en | code | 0 | github-code | 90 |
20046054680 | """Entry point for raster stats."""
import glob
import time
import itertools
import os
import tempfile
import struct
import argparse
import sys
import logging
import heapq
import math
import pygeoprocessing
import numpy
from osgeo import gdal
LOGGER = logging.getLogger(__name__)
_BLOCK_SIZE = 2**2... | springinnovate/raster_calculations | raster_stats/__main__.py | __main__.py | py | 10,571 | python | en | code | 6 | github-code | 90 |
17298832848 | # File name: data_noise.py
# Author: Julia Hardy
# Date created: 22/01/2020
# Python Version: 3.7
# program options:
# 1. Numeric description of noise of this test (provide number or numbers) --noise
# 2. Regressions, improvements (provide version(s) of driver) --performance
# 3. Any other observations --observations
... | JuliaHardy/DataNoise | data_noise.py | data_noise.py | py | 4,178 | python | en | code | 0 | github-code | 90 |
71232338216 | #! -*- coding:utf-8 -*-
import turtle
class TurtlePortal(object):
@staticmethod
def draw_colorful_lines(loops):
colors = ["red", "purple", "blue", "green", "yellow", "orange"]
turtle.hideturtle()
turtle.screensize(800, 800, "black")
for i in range(loops):
turtle.... | buptatx/myPython100Days | scripts/1.turtle_practise.py | 1.turtle_practise.py | py | 554 | python | en | code | 0 | github-code | 90 |
74869927337 | from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.factories import UserAdminFactory
from categories.factories import CategoryFactory, SubCategoryFactory
# from categories.models import Category, SubCategory
# from cate... | Ekatche/amen-app-api | app/tests/test_categorie/test_categories_api.py | test_categories_api.py | py | 1,977 | python | en | code | 0 | github-code | 90 |
43334554676 | #!/usr/bin/env python3
import sys
def parse(f):
for line in f:
path = [tuple(map(int, xy.split(','))) for xy in line.split(' -> ')]
for i in range(len(path) - 1):
(xs, ys), (xe, ye) = sorted(path[i:i + 2])
for x in range(xs, xe + 1):
for y in range(ys, ye + 1... | taddeus/advent-of-code | 2022/14_sand.py | 14_sand.py | py | 989 | python | en | code | 2 | github-code | 90 |
70103657898 | import numpy as np
from concurrent.futures import ThreadPoolExecutor, Future
from queue import Queue
import math
from executor import Executor
from utils import *
from classic import Classic
import psutil
from time import perf_counter
import cv2
import argparse
def draw(canvas):
imscaled = cv2.resize(canvas, (1270... | Timu5/pwio | main.py | main.py | py | 2,876 | python | en | code | 0 | github-code | 90 |
28769138180 | # Modified by Microsoft Corporation.
# Licensed under the MIT license.
import json
import os
import random
import numpy as np
import torch.nn as nn
from tqdm import tqdm
from torch import optim
from torch.optim import lr_scheduler
from ..utils.config import *
from ..utils.masked_cross_entropy import *
from ..utils.m... | ConvLab/ConvLab | convlab/modules/e2e/multiwoz/Mem2Seq/models/Mem2Seq.py | Mem2Seq.py | py | 25,658 | python | en | code | 398 | github-code | 90 |
17654749507 | from uuid import uuid4
from datetime import datetime
from libs.models import (
ParamsSchema,
StatusSchema,
MessageSchema,
MessageStatus,
)
from config import SERVICE_NAME, REDIS_JOBS_CONSUMER_GROUP, WORKER_ID
from libs.redis_utils import get_connection, JOBS
def create_message():
p = {
"... | myaspm/interview | getir-price-scraper/test.py | test.py | py | 1,302 | python | en | code | 0 | github-code | 90 |
17946619969 | def main():
N = int(input())
# 4hnw = N(hn + nw + wh)
# (4hn - N(n + h)) w = Nhn
for h in range(1, 3501):
for n in range(1, 3501):
d = 4 * h * n - N * (n + h)
if d <= 0 or (N * h * n) % d != 0 or (N * h * n) // d > 3500:
continue
w = (N * h * n... | Aasthaengg/IBMdataset | Python_codes/p03583/s380275886.py | s380275886.py | py | 413 | python | en | code | 0 | github-code | 90 |
5340739196 | #!/usr/bin/env python
# python=
dic ={"HELLO" :"ENGLISH",
"HOLA":"SPANISH",
"HALLO":"GERMAN",
"BONJOUR":"FRENCH",
"CIAO":"ITALIAN",
"ZDRAVSTVUJTE":"RUSSIAN"}
i = 0
while 1:
a = input()
i+=1
if a == "#":
break
if a in dic:
print(f"Case {i}: {dic[a]}")
else:
print(f"Case {i}: UNKNOWN")
| 10946009/upload_data | ok/U11/zj-a135/dom/ans.py | ans.py | py | 308 | python | en | code | 0 | github-code | 90 |
16548556944 | import environ
from pathlib import Path
# Load the Environment vars from FabricRoom/.env
env = environ.Env()
environ.Env.read_env()
SECRET_KEY = env("SECRET_KEY")
DEBUG = False
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 3600
SECURE_HSTS_INCLUDE_SUBDOMAINS =... | sixtycycles/FabricRoom | FabricRoom/settings.py | settings.py | py | 5,211 | python | en | code | 1 | github-code | 90 |
11250709550 | """
First check whether the changes in GitHub is frequent
"""
from bs4 import BeautifulSoup
import os
from tqdm import tqdm
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC... | soarsmu/TOSEM-DBRD | src/state-bias/github_recover.py | github_recover.py | py | 4,301 | python | en | code | 6 | github-code | 90 |
8663230751 | #Accept 3 numbers and return the multiplicatioon.
def mul(no1,no2,no3):
if(no1==0 or no2==0 or no3==0):
return 0;
if(no1==0):
no1=1
if(no2==0):
no2=1
if(no3==0):
no3=1
ret=no1*no2*no3
return ret
def main():
#print("Accept three number from user")
n1=int(input())
n2=in... | AratiBudihale/Python-Basic-Coding | Mul3.py | Mul3.py | py | 444 | python | en | code | 0 | github-code | 90 |
11031977573 | # This file is part of applesauce.
#
# applesauce is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# applesauce is distributed in the ... | abhishekmukherg/applesauce | applesauce/sprite/effects.py | effects.py | py | 1,733 | python | en | code | 1 | github-code | 90 |
9492673577 | import pandas as pd
import cv2
import numpy as np
import matplotlib.pyplot as plt
def get_RLE_from_mask(mask):
mask = (mask / 255).astype(int)
pixels = mask.flatten()
pixels = np.concatenate([[0], pixels, [0]])
runs = np.where(pixels[1:] != pixels[:-1])[0] + 1
runs[1::2] -= runs[::2]
return '... | ngaggion/CheXmask-Database | TechnicalValidation/IndividualRCA/how_we_saved_annotations.py | how_we_saved_annotations.py | py | 2,914 | python | en | code | 8 | github-code | 90 |
40206114341 | from math import ceil, floor
class simple_math_int_out_class:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"int_input_1": ("INT", {
"default": 1,
"min": -1000000, #Minimum... | Extraltodeus/CustomComfyUINodes | simple_math_2x1_int.py | simple_math_2x1_int.py | py | 1,809 | python | en | code | 5 | github-code | 90 |
28185429625 | # 使用函数来实现多多任务的封装
import threading
import time
def sing():
for i in range(5):
print("{}---sing---".format(threading.current_thread().name))
time.sleep(1)
def dance():
for i in range(10):
print("{}---dance---".format(threading.current_thread().name))
time.sleep(1)
def main():... | baiyang0223/python | testmulthread/multhread1.py | multhread1.py | py | 1,098 | python | en | code | 0 | github-code | 90 |
14189443083 | # 43. Multiply Strings
class Solution:
def multiply(self, num1: str, num2: str) -> str:
t = 0
for num in num2:
s = 0
n = int(num)
for c in num1:
s = s * 10 + n * int(c)
t = t * 10 + s
return str(t)
print(Solution().multiply("1... | Minho16/leetcode | Leetcode_75_Level_2/MultiplyStrings_Samu.py | MultiplyStrings_Samu.py | py | 333 | python | en | code | 0 | github-code | 90 |
927727 | import os
import numpy as np
import pandas as pd
from datetime import datetime
import pytorch_lightning as pl
from constants.constants import*
from torch.utils.data import DataLoader
from lab.training_tools import TrainingToolsFactory
from utils.nilm_reporting import save_appliance_report
from datasources.datasource im... | Datalab-AUTH/HEART-Project | lab/nilm_trainer.py | nilm_trainer.py | py | 6,295 | python | en | code | 1 | github-code | 90 |
26037063888 | # -*- coding: utf-8 -*-
from Products.Five.browser import BrowserView
from collective.dexteritytextindexer import searchable
from os.path import splitext
from plone.dexterity.content import Item
from plone.namedfile.field import NamedBlobFile
from plone.supermodel import model
from unep import _
from unep.utils import... | garbas/unep | src/unep/file.py | file.py | py | 3,201 | python | en | code | 0 | github-code | 90 |
18586899149 | s = input()
t = input()
anas = sorted(s)
at = sorted(t,reverse = True)
miji = min(len(s),len(t))
for i in range(miji):
if ord(anas[i]) < ord(at[i]):
print('Yes')
exit()
elif ord(anas[i]) > ord(at[i]):
print('No')
exit()
if len(s) < len(t):
print('Yes')
else:
print('No')... | Aasthaengg/IBMdataset | Python_codes/p03486/s659454334.py | s659454334.py | py | 323 | python | en | code | 0 | github-code | 90 |
3510810136 | # coding=gbk
#!/usr/bin/env python
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen, based on code from Ross Girshick
# --------------------------------------------------------
"""
Demo script showin... | 4399123/faster_rcnn_learning | tools/demo.py | demo.py | py | 3,703 | python | en | code | 0 | github-code | 90 |
8703492140 | import random
from sqlalchemy import false, true
############### Our Blackjack House Rules #####################
# The deck is unlimited in size.
# There are no jokers.
# The Jack/Queen/King all count as 10.
# The the Ace can count as 11 or 1.
# Use the following list as the deck of cards:
## cards = [11, 2, 3, 4, 5,... | calebthewood/Python-100-Days | 100_days/day_11/day_11.py | day_11.py | py | 3,189 | python | en | code | 0 | github-code | 90 |
26413819833 | import logging
import warnings
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from mappers.ads_ssd_hashing_mapper import AdsSSDHashingMapper
from mappers.ads_user_list_pii_hashing_mapper import \
AdsUserListPIIHashingMapper
from models.execution import DestinationType, ... | elazarte/megalista | megalista_dataflow/main.py | main.py | py | 11,629 | python | en | code | null | github-code | 90 |
31228710012 | # -*- coding: utf-8 -*-
from ..utils import get_offset, verify_series
def sma(close, length=None, offset=None, **kwargs):
"""Indicator: Simple Moving Average (SMA)"""
# Validate Arguments
close = verify_series(close)
length = int(length) if length and length > 0 else 10
min_periods = int(kwargs['mi... | RoveAllOverTheWorld512/hyb_ta | build/lib/pandas_ta/overlap/sma.py | sma.py | py | 1,500 | python | en | code | 3 | github-code | 90 |
8935749277 | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def index():
activities = [
{"name":"Archery", "size":12, "requirements": True, "description":"Open for people trying to shoot for their silver, gold or platinum"},
{"name":"Arts", "size":21, "requirem... | Holmes-rgb/CS50 | chapter9/classwork/minilesson_jinja/application.py | application.py | py | 1,063 | python | en | code | 0 | github-code | 90 |
14351012481 | import torch
from rlsuite.agents.agent import Agent
from torch.distributions import Categorical
import torch.nn.functional as F
from abc import abstractmethod
class ActorCritic(Agent):
def __init__(self, num_of_actions, network, criterion, optimizer, gamma=0.999, gpu=False):
super().__init__(num_of_actio... | nikmand/Reinforcement-Learning-Algorithms | rlsuite/agents/nn_agents/actor_critic_agent.py | actor_critic_agent.py | py | 4,091 | python | en | code | 0 | github-code | 90 |
2817998100 | import os
from .meta_data import predefined_data
from .similarity import match
from .process_video import get_data
def get_timestamp(video_id, caption):
print('Video ID: {}. Caption {}'.format(video_id, caption))
if (video_id in predefined_data()):
scene_data = predefined_data()[video_id]
else:
... | petrpan26/Nemo | scripts/core.py | core.py | py | 904 | python | en | code | 0 | github-code | 90 |
30824123255 | import time
import gym
from IPython.core.display_functions import clear_output
from matplotlib import pyplot as plt
from agents.cDDQN_pytorch import DQNLoadedPolicy, DDQN_torch
from agents.cRainbow_pytorch import *
from environments_and_constraints.lunar_lander.utils import *
def sliding_average(values, w=5):
... | Choi1234567/CSRL | main.py | main.py | py | 5,505 | python | en | code | 0 | github-code | 90 |
18568908429 | import bisect
def main():
n = int(input())
print(0)
s = input()
seat_dict = {"Male": 1, "Female": 2}
if s == "Male":
ls = [1, 2] * ((n - 1) // 2) + [1] * ((n -1) % 2)
elif s == "Female":
ls = [2, 1] * ((n - 1) // 2) + [2] * ((n - 1) % 2)
else:
return
up = n - 1
... | Aasthaengg/IBMdataset | Python_codes/p03439/s372237152.py | s372237152.py | py | 662 | python | en | code | 0 | github-code | 90 |
10180156723 | from flask import *
# from flask_restplus import Resource, Api
# from flask_restplus import fields
# from flask_restplus import inputs
# from flask_restplus import reqparse
from flask import Flask, jsonify
from flask import request
from flask_restplus import Resource, Api
from flask_restplus import fields
from flask_re... | cfdoge/comp9321_proj3_final | src/Adventure_2_Comp9321_proj3/app.py | app.py | py | 12,190 | python | en | code | 0 | github-code | 90 |
10539236755 | import requests
from threading import Thread
from tqdm import tqdm
class ApkDownloaderTools:
def __init__(self) -> None:
self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"}
def download_w_progress_ba... | 09u2h4n/PyAPKDownloader | PyAPKDownloader/apkdownloadertools.py | apkdownloadertools.py | py | 1,405 | python | en | code | 0 | github-code | 90 |
18572163329 | # bfs?
def main():
from collections import deque
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
g = tuple(set() for _ in range(N))
h = [0] * N # 入り次数
for _ in range(M):
L, R, D = map(int, input().split())
L -= 1
R -= 1
g[L].add((R, ... | Aasthaengg/IBMdataset | Python_codes/p03450/s423109408.py | s423109408.py | py | 1,265 | python | ja | code | 0 | github-code | 90 |
4066136581 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from datetime import datetime
import os
import plotly.express as px
from func4stat import *
from func4mapping import *
'''
# Notes: Using conda env irp on local PC
# Plot time series of both ls and gwlevels
# input data ----... | pvh1983/ML4sub | scripts/plot_ls_ts.py | plot_ls_ts.py | py | 5,717 | python | en | code | 0 | github-code | 90 |
17988922909 | # A - Restricted
# 二つの整数 A B を入力
# A + B を出力
# A + B >= 10 の時 error と出力
# A B を標準入力から得る
A, B = map(int, input().split())
# print(A, B)
# A + B < 10 の時 A + B を代入
# それ以外は error を代入
if (A + B) < 10:
answer = A + B
else:
answer = "error"
# 結果を出力
print(answer)
| Aasthaengg/IBMdataset | Python_codes/p03697/s861104658.py | s861104658.py | py | 355 | python | ja | code | 0 | github-code | 90 |
29399773711 | import gevent
from toolz import partial
import socket
from corens.ns import *
from corens.tpl import nsMk
from corens.gevt import *
def _net_client_init(ns, *args, **kw):
nsMkdir(ns, "/net/tcp/out")
nsMkdir(ns, "/net/udp/out")
def _net_tcp_cli_proto(ns, name, port, fun_read=None, fun_write=None):
nsMkdir(... | vulogov/core.ns | corens/stdlib/nsNetwork.py | nsNetwork.py | py | 946 | python | en | code | 0 | github-code | 90 |
18561580869 | from collections import Counter
from itertools import combinations
n = int(input())
l = [input()[0] for _ in range(n)]
lc = Counter(l)
con = []
for c in 'MARCH':
if c in lc:
con.append(lc[c])
ans = 0
for a, b, c in combinations(con, 3):
ans += a*b*c
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03425/s339237466.py | s339237466.py | py | 274 | python | en | code | 0 | github-code | 90 |
18134384659 | import sys
while True:
a,b = map(int, raw_input().split())
if a ==0 and b == 0:
break
for i in range(a):
for j in range(b):
sys.stdout.write("#")
print
print | Aasthaengg/IBMdataset | Python_codes/p02403/s945507647.py | s945507647.py | py | 210 | python | en | code | 0 | github-code | 90 |
4126594251 | import numpy as np
import time
def frequency(frequencies, first_pair, last_pair):
counts = {}
none_zero_indices = np.where(frequencies > 0)[0]
for i in none_zero_indices:
count = frequencies[i]
pair = pair_from_index(i)
c1 = pair[0]
if c1 not in counts:
counts[c... | butakun/AoC2021 | 14/14_2.py | 14_2.py | py | 3,264 | python | en | code | 0 | github-code | 90 |
71020107176 | from tkinter import *
import tkinter.messagebox
from tkinter import ttk
from DataBase import getStudent
from DataBase import getStudentScore
from DataBase import getCNAME
from DataBase import getAvg
from DataBase import getName
from DataBase import getTNAME
from DataBase import getCredit
from DataBase import connectDB
... | zhonghongshu/StudentSystem | Student.py | Student.py | py | 9,875 | python | en | code | 1 | github-code | 90 |
42425845844 | """
https://www.hackerrank.com/challenges/grading/problem?isFullScreen=true
"""
#
# Complete the 'gradingStudents' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts INTEGER_ARRAY grades as parameter.
#
def gradingStudents(grades):
for i in range(len(grades)):
... | vijay2930/HackerrankAndLeetcode | com/hackerrank/algorithms/implementation/GradingStudents.py | GradingStudents.py | py | 693 | python | en | code | 0 | github-code | 90 |
37296179866 |
from Utils import bsr_utils
from itertools import groupby
import pydash
import json
def _monthly_emi(transaction_month_wise):
"""
Calculate emi deposit.
:param transaction_month_wise: A list, transaction details
:return: A dictionary, with emi deposit
"""
Emi_deposit = 0
result = 0
tr... | roshan6111/cred | src/PdfAnalyser/PdfAnalysers.py | PdfAnalysers.py | py | 4,806 | python | en | code | 0 | github-code | 90 |
20018866852 | # General Libraries
# Django Libraries
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
# Project Libraries
urlpatterns = patterns('issue.views',
url(r'^$','issue_list', name='issue-list'),
url(r'^(?P<issue_id>\d+)/$', 'issue_detail', name='issue-detail'),
url... | tanepiper/hgfront | issue/urls.py | urls.py | py | 446 | python | en | code | 0 | github-code | 90 |
7019447076 | from unicodedata import name
from django.contrib import admin
from django.urls import path, include
from .views import (
HomeView,
TodoView
)
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('base.urls')),
path('', HomeView, name="home"),
path('todo/<int:id>/', TodoView, na... | Nepul321/Todo-List-with-ReactJS-and-Django-Backend | src/urls.py | urls.py | py | 384 | python | en | code | 0 | github-code | 90 |
12922079258 | #!/usr/bin/env python
import sys, os, re
import numpy as np
from sklearn.cluster import DBSCAN
from optparse import OptionParser
from collections import defaultdict
import fnmatch
description = "Cluster TMalign scores."
def ParseArguments():
"""Parse command-line options.
"""
parser = OptionParser(descr... | minmarg/ropius0 | bin/clusterTMalignScores.py | clusterTMalignScores.py | py | 5,176 | python | en | code | 0 | github-code | 90 |
27096991138 | from spack import *
class SstCore(AutotoolsPackage):
"""The Structural Simulation Toolkit (SST) was developed to explore
innovations in highly concurrent systems where the ISA, microarchitecture,
and memory interact with the programming model and communications system"""
homepage = "http://sst-simula... | matzke1/spack | var/spack/repos/builtin/packages/sst-core/package.py | package.py | py | 1,458 | python | en | code | 2 | github-code | 90 |
12566291712 | #!/usr/bin/env python3
from open3d_ros_helper import open3d_ros_helper as orh
import rospy
import numpy as np
import tf2_ros
from visualization_msgs.msg import MarkerArray
from v4r_util.util import ros_bb_to_o3d_bb, transformPointCloud, o3d_bb_list_to_ros_bb_arr, ros_bb_arr_to_rviz_marker_arr, get_minimum_oriented_boun... | v4r-tuwien/table_plane_extractor | src/get_objects_on_table.py | get_objects_on_table.py | py | 6,842 | python | en | code | 0 | github-code | 90 |
30373212159 | import string
from collections import Counter, defaultdict, OrderedDict
from pprint import pprint
import random
import json
from nltk.corpus import stopwords, words
import phrasefinder # @see https://github.com/mtrenkmann/phrasefinder-client-python
# set of possible keys (assumption)
alphabet = string.ascii_... | SeanErfurt/samples | cryptology/python/cracksub.py | cracksub.py | py | 19,622 | python | en | code | 0 | github-code | 90 |
18171888640 | '''
DataNormalization
Author: Luben Popov & Yuan Zi
This library handles normalization of cross sectional images into 3D arrays.
'''
import numpy as np
from skimage.transform import ProjectiveTransform
import cv2
from scipy.ndimage import zoom
from ACVProject import Visualization, MathUtil
# Normalizes a cross secti... | tab10/Med3DResNet | ACVProject/DataNormalization.py | DataNormalization.py | py | 9,420 | python | en | code | 3 | github-code | 90 |
28046297598 | import cherrypy
userss = {
'1': {
'username': 'van',
'email': 'vanbyvan@fmail.ru',
'department': 'production',
'date_joined': '2011-11-11T11:10:09'
},
'2': {
'username': 'billy',
'email ': 'billyjeans@fmail.ru',
'department': 'pr',
'date_join... | Soffira/Exam_project_step | api/data.py | data.py | py | 2,656 | python | en | code | 0 | github-code | 90 |
25734535809 | import os
os.system("cls")
def validate():
try:
while True:
os.system("cls")
num: int = int(input("Enter num (1..10) :"))
if num > 0 and num <= 10:
starter = 1
while starter <= num:
displayOut(num, starter)
... | Sandatang/Python | Messy coding/bahaw.py | bahaw.py | py | 818 | python | en | code | 0 | github-code | 90 |
21633550028 |
# Code to get geometry data for mapping, and create document outputs
# Before running this, run process_data.py to acquire and wrangle necessary data
# Adam Bricknell, Feb 2021
import os
import pandas as pd
import geopandas as gpd
import requests
from shapely.geometry import Polygon
import json
import warnings
imp... | adam-jb/camden_crime_data | make_documents.py | make_documents.py | py | 8,674 | python | en | code | 0 | github-code | 90 |
13941987294 | #! /usr/bin/env python
# encoding: utf-8
APPNAME = 'boost'
VERSION = '4.0.2'
def configure(conf):
if conf.is_mkspec_platform('linux'):
if not conf.env['LIB_PTHREAD']:
# If we have not looked for pthread yet
conf.check_cxx(lib='pthread')
def build(bld):
bld.env.append_uniqu... | steinwurf/boost | wscript | wscript | 2,397 | python | en | code | 34 | github-code | 90 | |
43959393411 | # task 2G analysing the most at risk places
from re import S
from floodsystem.stationdata import build_station_list
from floodsystem.flood import stations_highest_rel_level
from floodsystem.stationdata import update_water_levels
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.flood import stat... | impulseCoolKid/jm-nat- | Task2G.py | Task2G.py | py | 2,996 | python | en | code | 0 | github-code | 90 |
18391903739 | # https://atcoder.jp/contests/agc034/tasks/agc034_a
import sys
n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(a - 1, c - 1):
if s[i] == '#' and s[i + 1] == '#':
print('No')
sys.exit()
for i in range(b - 1, d - 1):
if s[i] == '#' and s[i + 1] == '#':
print('N... | Aasthaengg/IBMdataset | Python_codes/p03017/s032452383.py | s032452383.py | py | 550 | python | en | code | 0 | github-code | 90 |
40581751396 | """
557. Reverse Words in a String III
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Note: In the string, each word is separated ... | venkatsvpr/Problems_Solved | LC_Reverse_Words_in_a_String_3.py | LC_Reverse_Words_in_a_String_3.py | py | 1,105 | python | en | code | 3 | github-code | 90 |
73674095337 | import json
from collections import defaultdict
from django.shortcuts import render, get_object_or_404
from django.http import Http404
from squad.http import auth
from squad.core.models import Test, Suite, SuiteMetadata, Environment
from squad.core.history import TestHistory
from squad.core.queries import test_confi... | Linaro/squad | squad/frontend/tests.py | tests.py | py | 8,713 | python | en | code | 54 | github-code | 90 |
37794254884 | """
Script to plot the total TVL, total TVL without double counting, and TVR of the protocol
"""
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from config.constants import CHAIN_LIST, FIGURES_PATH
from environ.data_processing.preprocess_tvl import preprocess_ptc... | lyc0603/tvl-measurement | scripts/plot/plot_total_tvl.py | plot_total_tvl.py | py | 2,825 | python | en | code | 1 | github-code | 90 |
35308095089 | from math import factorial
def multiply_permutations(p1, p2):
return [p1[i] for i in p2]
def inverse_permutation(p1):
result = [None for x in range(len(p1))]
for i, s in enumerate(p1):
result[s] = i
return result
class PermutationEnumerator:
def __init__(self, perm_length, base=None):
... | danielbarter/artin_wedderburn_GPU | PermutationEnumerator.py | PermutationEnumerator.py | py | 2,277 | python | en | code | 0 | github-code | 90 |
26326989325 | import sys
import io
sys.setrecursionlimit(10**8)
_INPUT="""\
3
1
1
1
2
1
3
0
"""
sys.stdin=io.StringIO(_INPUT)
N = int(input())
kake = []
Clist = []
for i in range(N):
C = int(input())
Clist.append(C)
kake.append(list(map(int, input().split())))
X = int(input())
ans = []
minc = 100
for index, p in enumerat... | Amano-take/Atcoder | 300/10/314/B.py | B.py | py | 630 | python | en | code | 0 | github-code | 90 |
18327265729 | import math
N = int(input())
N_root = math.sqrt(N)
M = int(N_root)
list = []
for i in range(1,M+1):
if N%i == 0:
list.append(i+N//i-2)
list = sorted(list)
print(list[0])
| Aasthaengg/IBMdataset | Python_codes/p02881/s947354430.py | s947354430.py | py | 176 | python | en | code | 0 | github-code | 90 |
34107895179 | import gzip
import shutil
def gzip_file(input_file, output_file):
"""
Check if a file is gzipped and either zip it or copy the file
Args:
input_file (str): filepath of input file (gzipped or not)
output_file (str): filepath of output gzipped file
"""
is_gzipped = input_file.endswi... | beardymcjohnface/Trimnami | trimnami/scripts/copyOrGzip.py | copyOrGzip.py | py | 1,264 | python | en | code | 6 | github-code | 90 |
18457515529 | import sys
S = input()
target = "keyence"
del_len = len(S) - len(target)
for i in range(len(S) - del_len+1):
s = S[:i] + S[i + del_len:]
if s==target:
print("YES")
sys.exit()
print("NO") | Aasthaengg/IBMdataset | Python_codes/p03150/s377678259.py | s377678259.py | py | 212 | python | en | code | 0 | github-code | 90 |
40686505220 | from google.appengine.ext.webapp.util import run_wsgi_app
import webapp2
from handlers import Home
from handlers import Admin
import os
path = os.path.dirname(__file__)
config = {}
config['webapp2_extras.sessions'] = {
'secret_key': 'a1b2c3a4b5c6',
}
app = webapp2.WSGIApplication([('/', Home.IndexHandler),
... | rodcero/levelblocks | main.py | main.py | py | 1,383 | python | en | code | 1 | github-code | 90 |
13640282208 | """Create complex images from in-game assets."""
import os
import PIL
from PIL import Image, ImageDraw, ImageEnhance
pre = "../"
cwd = os.getcwd()
cwd_split = cwd.split("\\")
last_part = cwd_split[-1]
pre = ""
if last_part.upper() == "BUILD":
pre = "../"
def getDir(directory):
"""Convert directory into the... | 2dos/DK64-Randomizer | base-hack/Build/createComplexImages.py | createComplexImages.py | py | 21,965 | python | en | code | 44 | github-code | 90 |
37713444592 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 19 20:36:34 2017
@author: Faaiz
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 17 17:44:48 2017
@author: Faaiz
"""
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
#creating column names for wine quality data
nc1=["fixed ac... | faaizuddin/Linear-Regression-with-Gradient-Descent | LRwGD.py | LRwGD.py | py | 3,330 | python | en | code | 0 | github-code | 90 |
33895842325 | from flask import jsonify, render_template, Blueprint
from apispec import APISpec
from apispec.exceptions import APISpecError
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
class FlaskRestfulPlugin(FlaskPlugin):
"""Small plugin override to handle flask-re... | KAILINYmq/python-flask-gotel | agile/commons/apispec.py | apispec.py | py | 1,707 | python | en | code | 1 | github-code | 90 |
13224636931 | from typing import Any
import pytest
from safeds.data.tabular.containers import Column
from safeds.exceptions import IndexOutOfBoundsError
@pytest.mark.parametrize(
("column", "index", "expected"),
[
(Column("a", [0, 1]), 0, 0),
(Column("a", [0, 1]), 1, 1),
],
ids=["first item", "seco... | Safe-DS/Library | tests/safeds/data/tabular/containers/_column/test_getitem.py | test_getitem.py | py | 1,533 | python | en | code | 11 | github-code | 90 |
19255754045 | from sys import stdin
def main():
n = int(stdin.readline())
enter = set()
for _ in range(n):
name, status = stdin.readline().split()
if status == 'enter':
enter.add(name)
elif status == 'leave':
enter.remove(name)
enter = sorted(enter, reverse=True)
... | ag502/algorithm | Problem/BOJ_7785_회사에 있는 사람/main.py | main.py | py | 400 | python | en | code | 1 | github-code | 90 |
8805779311 | """
"""
import os
import sys
import logging
from . import scrape_espn, data_prep, google_io
from .config import CONFIG
LOGGER = logging.getLogger(__file__)
def run_data_pull(week, year=None, output_dir=None, return_all_games=False):
"""
Execute data pull from ESPN and create data frames for game views
... | djheezy/football_friends | ff_app/execution.py | execution.py | py | 3,993 | python | en | code | 0 | github-code | 90 |
20038431136 | #!/usr/bin/env python3
import json, random, os, __main__
from pymongo import ASCENDING
from tornado import websocket
from housepy import server, config, log, strings, s3, process
process.secure_pid(os.path.abspath(os.path.join(os.path.dirname(__file__), "run")))
class Home(server.Handler):
def get(self, pag... | brianhouse/TempletonServer | main.py | main.py | py | 5,721 | python | en | code | 0 | github-code | 90 |
24196178458 | from copy import copy
from django.conf import settings
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework import status
from .serializers import TaskSerializer, DeviceSerializer
from task_manager.models import Device, Task
from task_manager.service import R... | bsdemon/django-network-config | django_network_config/api/views.py | views.py | py | 1,787 | python | en | code | 0 | github-code | 90 |
9128235065 | import logging
from langchain.chat_models.base import BaseChatModel
from langchain.schema import HumanMessage, OutputParserException
from core.constant import llm_constant
from core.llm.llm_builder import LLMBuilder
from core.llm.streamable_open_ai import StreamableOpenAI
from core.llm.token_calculator import TokenCa... | parity-asia/hackathon-2023-summer | projects/26-Dynamo/src/ai-project/api/core/generator/llm_generator.py | llm_generator.py | py | 5,842 | python | en | code | 14 | github-code | 90 |
27958888734 | import random
import os
from xml.etree.ElementTree import parse, Element
class SystemLocation(object):
""" Defines a location object which is in the data set. """
def __init__(self, path):
""" Initializes the path. """
self._path = path
self.files = []
def anonymize(self):
... | Sciprios/Anonymizer | anonymizer/models.py | models.py | py | 3,574 | python | en | code | 0 | github-code | 90 |
35726468098 | import re
from strip_hints import strip_file_to_string
import os
import fnmatch
import sys
def _find_files(directory, pattern):
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename, pattern):
filename = os.path.join(root, basename)
... | PaulSchweizer/ascii-canvas | strip-type-hints.py | strip-type-hints.py | py | 772 | python | en | code | 7 | github-code | 90 |
15666175073 | from __future__ import unicode_literals, print_function
import datetime
from concurrent import futures
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.preprocessors.execute import CellExecutionError
from .iorw import write_ipynb
# tqdm creates 2 globals lock which raise OSException if the exe... | cHYzZQo/papermill | papermill/preprocess.py | preprocess.py | py | 6,391 | python | en | code | null | github-code | 90 |
11570260031 | #!/usr/bin/env python3
import codecs
from os import path
import re
import setuptools
name = "gibberify"
def find_version():
with codecs.open(path.join('gibberify', 'utils', 'general.py'), 'r') as f:
version_file = f.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
... | brisvag/gibberify | setup.py | setup.py | py | 1,531 | python | en | code | 18 | github-code | 90 |
42796240019 | import json,pymongo,re
from os import getenv
from dotenv import load_dotenv
load_dotenv()
_URI = getenv('MONGO_URI')
_DB = getenv('MONGO_DB')
_COLL = getenv('MONGO_COLLECTION')
mConnection = pymongo.MongoClient(_URI)
mDatabase = mConnection[_DB] # Specify the Database
mCollection = mDatabase[_COLL] # Speci... | djadoomen/swtor_item_bot | bot/import_mongo.py | import_mongo.py | py | 781 | python | en | code | 0 | github-code | 90 |
74139255975 | import board
import digitalio
d0 = digitalio.DigitalInOut(board.D0) # D0を設定
d0.direction = digitalio.Direction.INPUT # 入力ピン
d0.pull = digitalio.Pull.UP # Pull-up
ledg = digitalio.DigitalInOut(board.LEDG) # LED(緑)
ledg.direction = digitalio.Direction.OUTPUT # 出力ピン
while True:
sts = d0.value # D0の状態を取得... | interplanwireless/IB-DUAL_Samples | digitalin_out/code.py | code.py | py | 549 | python | ja | code | 0 | github-code | 90 |
18016342079 | import sys
from itertools import accumulate
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
def main():
N = int(input())
A = sorted(list(map(int, input().split())))
B = list(accumulate(A))
for i in range(N - 1):
if B[N - i - 2] * 2 >= A[N - i - 1]:
... | Aasthaengg/IBMdataset | Python_codes/p03786/s818720744.py | s818720744.py | py | 447 | python | en | code | 0 | github-code | 90 |
5802873129 | from __future__ import print_function
import os
import fnmatch
import re
import numpy as np
import dicom
import cv2
from LoadData import crop_resize
import random
import matplotlib.pyplot as plt
# TODO add method for storing resulting numpy arrays as theano shared variables
# Declare the top level directories that ho... | htylab/HeartMRI_ML | LoadDataSB.py | LoadDataSB.py | py | 6,856 | python | en | code | 1 | github-code | 90 |
13581903901 | """
Base class for Othello Core
Must be subclassed by student Othello solutions
"""
#
from OthelloCore import *
import random, copy
EMPTY, BLACK, WHITE, OUTER = '.', '@', 'o', '?'
MAX = BLACK
MIN = WHITE
PIECES = (EMPTY, BLACK, WHITE, OUTER)
PLAYERS = {BLACK: 'Black', WHITE: 'White'}
# To refer to nei... | natyz/othello_ai | Othello_Minmax.py | Othello_Minmax.py | py | 3,652 | python | en | code | 0 | github-code | 90 |
9490031913 | #!/usr/bin/env python
# Caculating the column co2 concentration.
# Authors:
# Wenhan TANG - 02/2021
# ...
########################
import numpy as np
import xarray as xr
import datetime as dtm
from pdb import set_trace
str_Start = "2019-01-13_05:30:00"
str_End = "2019-01-21_00:00:00"
dtMins = 15
DomID = 2
InDir = ... | tangwhiap/WRF_CO2-v3.1 | utils/XCO2/Scripts/xco2.py | xco2.py | py | 4,831 | python | en | code | 0 | github-code | 90 |
72571113258 | from pathlib import Path
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from tensorflow.keras.models import save_model
import seaborn as sns
class PoiCategorizationLoader:
def __init__(self):
pass
def heatmap(self, dir, df, filename, title, size, annot):
plt.figu... | claudiocapanema/poi_gnn | loader/poi_categorization_loader.py | poi_categorization_loader.py | py | 4,987 | python | en | code | 1 | github-code | 90 |
11984369318 | class Table:
import sqlalchemy
SELECT = "select {fields} from {table}"
def __init__(self, db_name, t_name, fields):
self.db_name = db_name
self.table_name = t_name
self.fields = fields
self.create_engine()
def create_engine(self):
self.engine = self.sqlalchemy.c... | AlexandrSech/Z63-TMS | examples/2601 db/classes.py | classes.py | py | 613 | python | en | code | 0 | github-code | 90 |
43934728721 | """
"Problem Solving with Algorithims and data structures unsing python"
- modexp : Modular Exponentiation
- gcd : Greatest common divisor
- ext_gcd : extended euclidian algorithm
- (used to find multiplicable inverse)
"""
def modexp(x, n, p):
"""
Recursive definition for x^n (mod p)
"... | crazcalm/Crypto_textbook | Classic_Cryptosystems/cryptoMath.py | cryptoMath.py | py | 1,235 | python | en | code | 0 | github-code | 90 |
40219440595 | '''
Given two integer arrays A and B, of dimensions NxM, perform the
following operations:
Add
Subtract
Multiply
Integer Division
Mod
Power
Print the result
'''
import numpy as np
N, M = map(int, input().split())
A = np.array([input().split() for _ in range(N)], int)
B = np.array([input().split() for _ in range(N)... | Algorant/HackerRank | Python/array_math/array.py | array.py | py | 477 | python | en | code | 2 | github-code | 90 |
22222205500 | # nxpy_ccase -----------------------------------------------------------------
# Copyright Nicola Musatti 2011 -2014
# Use, modification, and distribution are subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# See https:... | nmusatti/nxpy_ccase | test/bin/setup_test_env.py | setup_test_env.py | py | 2,437 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.