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
18108181369
count = int(input()); data = []; for i in range(count): data.append(int(input())); gaps = [1]; for i in range(99): next_gap = 3 * gaps[-1] + 1; if count > next_gap: gaps.append(next_gap); else: break; gaps.reverse(); def shell_sort(data, gaps): o = 0; for gap in gaps: fo...
Aasthaengg/IBMdataset
Python_codes/p02262/s450066225.py
s450066225.py
py
906
python
en
code
0
github-code
90
11204376917
from pysam import VariantFile def add_artifact_annotation_data(in_vcf_filename, artifacts, out_vcf_filename): artifact_dict = {} header = True caller_list = [] Empty_observation = ["0"] max_nr_observations = 0 for line in artifacts: lline = line.strip().split("\t") if header:...
hydra-genetics/annotation
workflow/scripts/artifact_annotation.py
artifact_annotation.py
py
4,486
python
en
code
1
github-code
90
4083107638
import re def reverse(text): return text[::-1] def is_palindrome(text): text = re.sub('[!@#$]', '', text) return text == reverse(text) something = input('Input text') if (is_palindrome(something)): print('Yes, palindrome') else: print('No, not palindrome')
TonyCoopeR-62/Python-temp
user_input.py
user_input.py
py
278
python
en
code
0
github-code
90
71022879017
#!/usr/bin/python3 """A script that adds all arguments to a Python list, and then save them to a file Parameters: args Raises: void Description: The script attempts to open a file if the file is not found it sets the argument to an empty list, it proceed to append the arguments in stdin to the argument v...
Bigizic/alx-higher_level_programming
0x0B-python-input_output/7-add_item.py
7-add_item.py
py
1,113
python
en
code
0
github-code
90
18263493899
from sys import stdin import sys import math from functools import reduce import functools import itertools from collections import deque,Counter,defaultdict from operator import mul import copy # ! /usr/bin/env python # -*- coding: utf-8 -*- import heapq sys.setrecursionlimit(10**6) # INF = float("inf") INF = 10**18 ...
Aasthaengg/IBMdataset
Python_codes/p02762/s925026828.py
s925026828.py
py
1,427
python
en
code
0
github-code
90
9558282602
from django.urls import path, re_path from .views import ( DecommissionView, DecomCategoriesView, DisposalView, DispCategoriesView, add_decommission, remove_decommission, add_disposal, remove_disposal ) urlpatterns = [ # Decommission path('decom/', D...
NikolajMakarovskij/myStockroom
backend/decommission/urls.py
urls.py
py
1,134
python
en
code
0
github-code
90
12483716862
import sys s = sys.argv[1] start = int(sys.argv[2]) end = int(sys.argv[3]) def shortestDistance(s, start, end): # write code from here s=s.split() n=int(len(s)**0.5) costs = [float('inf') for i in range(n)] stack = [start-1] s =list(map(int,s)) graph = [] for i in range(n): temp = [] for j in range(n): ...
krsatyam7/niet_codetantra
Competitive Coding - 1/4. Problems on Graphs/Q1.py
Q1.py
py
674
python
en
code
25
github-code
90
5705123910
import itertools # n = int(input()) n = 100 ans = pow(n,2) itr = itertools.combinations_with_replacement(range(1,n+1),2) for i,j in itr: a,b = i c,d = j if pow(a,b) == pow(c,d): ans += 2 print(ans%1000000007)
lll109512/LeetCode
jd.py
jd.py
py
230
python
en
code
0
github-code
90
13031809655
from collections import defaultdict from dataclasses import dataclass import itertools import logging import random import json import math import numpy as np import time import torch import sys from omegaconf import OmegaConf from torch import nn, Tensor from torch.nn import functional as F from typing import List, O...
albietz/transformer-birth
ihead_basic_main.py
ihead_basic_main.py
py
12,958
python
en
code
0
github-code
90
24616843343
# -*- coding: utf-8 -*- import math import cv2 import numpy as np from keras.layers import Conv2D, Dense, Dropout, Flatten, MaxPooling2D from keras.models import Sequential class Common: COLORS = 3 UPLOAD_IMG_WIDTH = 50 UPLOAD_IMG_HEIGHT = 50 IMG_WIDTH = 50 IMG_HEIGHT = 50 INPUT_SHAPE = (IM...
tknpow22/coin_toss
common.py
common.py
py
8,528
python
ja
code
0
github-code
90
3035325806
from pickle import TRUE from bs4 import BeautifulSoup import requests import time print('put some skill not want it') unfim =input('>') print(f'Filtiring out {unfim} ') def fin_job(): html_text=requests.get('https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=...
Moha077/Scraping
scarpy.py
scarpy.py
py
1,343
python
en
code
0
github-code
90
18186686329
D = int(input()) C = [0] + list(map(int, input().split())) # type_iのvの下がりやすさ = C[i] S = [0] + [[0] + list(map(int, input().split())) for _ in range(D)] T = [0] + [int(input()) for _ in range(D)] last = [0] + [0 for _ in range(26)] v = 0 # 現在の満足度 for d in range(1, 1+D): # d = 1, 2, ..., Dについて v += S[d][T[d]] # s_d...
Aasthaengg/IBMdataset
Python_codes/p02619/s755249334.py
s755249334.py
py
573
python
en
code
0
github-code
90
7663863545
from django import forms from .models import Cashbook class CashbookForm(forms.ModelForm): class Meta: model = Cashbook fields = ['title','content','email','url','created_at','image'] def __int__(self, *args, **kwargs): super(CashbookForm, self).__init__(*args, **kwargs) self.f...
i1000u/CR-practice
cashbookapp/forms.py
forms.py
py
661
python
en
code
0
github-code
90
17989877859
s = input() visited = [False] * 26 flg = True for i in range(len(s)): x = ord(s[i]) - 97 if visited[x]: flg = False break visited[x] = True print('yes') if flg else print('no')
Aasthaengg/IBMdataset
Python_codes/p03698/s999926160.py
s999926160.py
py
205
python
en
code
0
github-code
90
23858841690
import torch import numpy as np import os import h5py use_gpu = torch.cuda.is_available() if use_gpu: device = torch.device("cuda") else: device = torch.device("cpu") def get_activations(model, output_dir, data_loader, concept_name, layer_names, max_samples): ''' The function to generate the activati...
agil27/TCAV_PyTorch
tcav/utils.py
utils.py
py
1,467
python
en
code
9
github-code
90
15883467902
#!/home/wizard/anaconda3/bin/python3.7 from time import time,sleep def foo(): sleep(0.3) def bar(): sleep(0.5) t = time() foo() print('foo:', time() - t) t = time() bar() print('bar:', time() - t)
DikranHachikyan/python-verint-20190128
day02/ex19.py
ex19.py
py
212
python
en
code
0
github-code
90
37338151929
import cs50 b1 = False while b1==False: n1 = cs50.get_float("What change?")*100 if n1>=0: break count = 0 list1 = [25,10,5,1] for i in list1: c1 = False while c1==False: if n1 < i: break n1 -= i count+=1 print(count)
UdhayaShan1/HarvardX-CS50x-2022
Week 6 - Python/cash.py
cash.py
py
281
python
en
code
2
github-code
90
12888389696
import argparse import json from common.dialect import ATTRIBUTES from common.detector_result import Status from .core import load_detector_results, is_standard_dialect def prop_equal(res1, res2, attr_name): return getattr(res1.dialect, attr_name) == getattr(res2.dialect, attr_name) def compute_attribute_accu...
alan-turing-institute/CSV_Wrangling
scripts/analysis/make_summary.py
make_summary.py
py
11,433
python
en
code
26
github-code
90
13073289453
from plume.network import MLPClassifier from plume.utils import plot_decision_boundary import sklearn.datasets import numpy as np def test_mlp(): X, y = sklearn.datasets.make_moons(200, noise=0.20) y = y.reshape((-1, 1)) n = MLPClassifier((2, 4, 1), activation='relu', epochs=300, learning_rate=0.01) n....
liuslnlp/plume
tests/test_network.py
test_network.py
py
567
python
en
code
27
github-code
90
24355168214
from nmigen import Elaboratable, Signal, Module, Repl, ClockDomain, ClockSignal, DomainRenamer from nmigen.build import Platform from nmigen.lib.fifo import AsyncFIFOBuffered from ..utils.ecp5pll import ECP5PLL, ECP5PLLConfig class FT600_Test(Elaboratable): def elaborate(self, platform: Platform): led1 = ...
korken89/ovio_core_firmware
gateware/apps/ft600_test.py
ft600_test.py
py
4,840
python
en
code
1
github-code
90
28197012833
from functools import cmp_to_key class Solution: def getStrongest(self, arr: list, k: int) -> list: arr.sort() self.m = arr[(len(arr) - 1) // 2] def comp(i, j): if abs(i-self.m) > abs(j-self.m): return 1 elif abs(i-self.m) == abs(j-self.m): if ...
HandsomeLuoyang/Algorithm-books
力扣/竞赛/周赛/192周赛/5429. 数组中的 k 个最强值.py
5429. 数组中的 k 个最强值.py
py
621
python
en
code
1
github-code
90
28965602255
""" - Insertion sort is not a fast Sorting Algorithm - It Uses nested loops to sort - It is useful only for small datasets - It runs in O(n^2) """ list_to_be_sorted=[2,8,6,7,5,9,8,3,7,8,6] def selection_sort(list): for i in range (0,len(list)-1): min_index = i for j in range (i+1,len(list)): ...
Usama00004/Python-Projects
Sorting Algorithms/selection_sort.py
selection_sort.py
py
564
python
en
code
0
github-code
90
24728548435
from PySide2 import QtWidgets, QtCore import movie as m class App(QtWidgets.QWidget): def __init__(self): super().__init__() self.setWindowTitle("Cine Club") # Initialize Layout self.layout = None # Layout of the application # Initialize widgets self.write_film =...
AllanDCQ/python_mini_projects
project_cine_club/app.py
app.py
py
3,722
python
en
code
0
github-code
90
10214524322
# https://www.hackerrank.com/contests/smart-interviews/challenges/si-implement-stack '''Perform push and pop operations on stack. Implement Stacks and avoid using inbuilt library. Input Format First line of input contains T - number of operations. Its followed by T lines, each line contains either "push x" or "pop". ...
SheetanshKumar/smart-interviews-problems
Implement Stack.py
Implement Stack.py
py
866
python
en
code
6
github-code
90
38737584238
from tkinter import * import random, pandas #initialize global variables #change here and top of csv file for different data. In csv file: Question,Answer FRONT_FC_TOPIC = 'Question' BACK_FC_TOPIC = 'Answer' #change data file, question font size and time in ms between card flips GET_DATA = 'data/cs_questions.csv' QUE...
0xc0rvu5/Flash-Card-App-Capstone
flash_card_app.py
flash_card_app.py
py
3,026
python
en
code
0
github-code
90
22001533962
""" Save in-memory database object to a file with custom formatting; assume 'endrec.', 'enddb.', and '=>' are not used in the data; assume db is dict of dict; warning: eval can be dangerous - it runs strings as code; could also eval() record dict all at once; could also dbfile.write(key + '\n') vs print(key, fil...
sashnat/essential-temp
Programming Python/make_db_file.py
make_db_file.py
py
3,145
python
ru
code
0
github-code
90
16054102751
from discord.ext import commands import discord class MyHelpCommand(commands.MinimalHelpCommand): async def send_pages(self): destination = self.get_destination() e = discord.Embed(title="Commands List", color=discord.Color.gold(), description='') e.set_footer(text="No more status page lul...
RawPikachu/chest-count-rewrite
Help.py
Help.py
py
440
python
en
code
1
github-code
90
18535719209
def calc( s , k , n): bruh = {} for i in range(1, k + 1): # length for j in range( n - ( i - 1)): # start bruh[s[j: j + i:]] = 0 another = bruh.keys() another = sorted(another) print( another[k - 1]) s = input() k = int(input()) n = len(s) calc( s , k , n)
Aasthaengg/IBMdataset
Python_codes/p03353/s219201346.py
s219201346.py
py
274
python
en
code
0
github-code
90
33463841770
import torch import torch.nn as nn import numpy as np def gradients(y, x, order=1): if order == 1: return torch.autograd.grad(y, x, grad_outputs=torch.ones_like(y), create_graph=True, retain_graph=True, only_inputs=True)[0] else: return gradients(gradients(y, ...
yunbattle1994/torch_gpinn_0
basic_model.py
basic_model.py
py
5,786
python
en
code
0
github-code
90
36413429538
#! /usr/bin/env python3 import time from copy import deepcopy from geometry_msgs.msg import PoseStamped from rclpy.duration import Duration import rclpy from nav2_simple_commander.robot_navigator import BasicNavigator, TaskResult def main(): rclpy.init() navigator = BasicNavigator() # Inspection route...
SystemDiagnosticss/neo_navigation
follow_waypoints/follow_waypoints/nav2_follow_waypoints.py
nav2_follow_waypoints.py
py
2,883
python
en
code
1
github-code
90
18666098125
## ebrahim parcham eval and train faster rcnn ## import Lib import os import torch import torchvision import torch.nn as nn import copy import time import torchvision.models as models import torchsummary from torchvision import datasets, models, transforms from torchvision.transforms import functional as F from PIL imp...
Eparcham/Faster_RCNN
py_Faster_RCNN_Hard.py
py_Faster_RCNN_Hard.py
py
6,416
python
en
code
0
github-code
90
72223246056
# -*- coding: utf-8 -*- """ Created on Tue Nov 19 11:04:50 2019 @author: deesaw """ import os def myping(ip): command = "ping -n 1 {} > NUL".format(ip) respose = os.system(command) if respose == 0: return True else: return False
deesaw/Vimpp
Python/myping.py
myping.py
py
239
python
en
code
0
github-code
90
14939681398
# x = 10 while x > 0: print('{}'.format(x)) x -= 1 print("Happy New Year!") ######################### # infinite loop & break # ######################### # stop a while loop after n amount of time import time timeout = time.time() + 5 # 5 seconds from now counter = 0 while True: #co...
ewan-zhiqing-li/PYTK
exercise/book_the_self_taught_programmer/code_20201231_loop/b_while_loop_.py
b_while_loop_.py
py
1,735
python
en
code
0
github-code
90
18315343649
#146_F n, m = map(int, input().split()) s = input()[::-1] ans = [] flg = True cur = 0 while cur < n and flg: for to in range(cur + m, cur, -1): if to > n: continue if s[to] == '0': ans.append(to - cur) cur = to break if t...
Aasthaengg/IBMdataset
Python_codes/p02852/s158106143.py
s158106143.py
py
408
python
en
code
0
github-code
90
23045867281
''' 971. Flip Binary Tree To Match Preorder Traversal Medium You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n values voyage, which is the desired pre-order traversal of the binary tree. Any node in the binary tree can be...
aditya-doshatti/Leetcode
flip_binary_tree_to_match_preorder_traversal_971.py
flip_binary_tree_to_match_preorder_traversal_971.py
py
1,956
python
en
code
0
github-code
90
5829587600
from copy import copy from collections import defaultdict from datetime import datetime, timedelta import logging import re import os import sys import tempfile import backtrader as bt import pandas as pd import numpy as np from bokeh.models.widgets import Panel, Tabs from bokeh.layouts import gridplot from bokeh.e...
webclinic017/backtrader_bokeh_basic
backtrader_bokeh/app.py
app.py
py
21,938
python
en
code
1
github-code
90
11189573844
import datetime import logging import math import pathlib import pickle import shutil import tempfile import urllib from typing import Dict, List, Tuple, Union import torch import torch.nn as nn import torch.optim as optim from sklearn.metrics import f1_score from torch.utils.data.dataloader import DataLoader from .c...
aisingapore/sgnlp
sgnlp/models/sentic_gcn/train.py
train.py
py
23,734
python
en
code
32
github-code
90
6525033218
from selenium import webdriver from lxml import html from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication from email.header import Header from smtplib import SMTP_SSL from datetime import timedelta, datetime import time import xlwt import xlrd class Monitor(object): de...
changaolee/Spider_Practice
AppStore/main.py
main.py
py
7,141
python
en
code
0
github-code
90
20805099972
# -*- coding: utf-8 -*- """ Created on Wed Oct 24 07:23:14 2018 @author: Mah """ import time import numpy as np import math import random import matplotlib.pyplot as plt def distance(x1,x2,y1,y2): return math.sqrt(math.pow(y2-y1,2) + math.pow(x2-x1,2)) def cost(arr,matris): costs=0 for i in ...
AliRafieePour/Artificial-Intelligence-Assignments-
SA_tsp.py
SA_tsp.py
py
3,114
python
en
code
0
github-code
90
9483869050
# -*- coding: UTF-8 -*- ''' Author: xiaoyao jiang LastEditors: Peixin Lin Date: 2020-08-31 14:19:30 LastEditTime: 2021-01-03 21:36:09 FilePath: /JD_NLP1-text_classfication/model.py Desciption: ''' import json import jieba import joblib import lightgbm as lgb import pandas as pd import sklearn.metrics as metrics from sk...
Kelvin-Ho/Intelligence_Triage
model_ML.py
model_ML.py
py
17,750
python
en
code
4
github-code
90
39152212612
#!/usr/bin/env python3 import sys import subprocess import shutil import os build_dir = 'build_linux' def print_usage(): print("Usage:\n" "[required] argv[1] build type(release/debug)\n" "[required] argv[2] license key\n" "[optional] argv[3] license algo\n") if __name__ == "__main...
quinndiggity/iptv
build/build.py
build.py
py
1,199
python
en
code
15
github-code
90
29521246118
import zoomfunctions import Settings #Calculate x and y offsets to get center of image ###Deprecated code from pre-zoom era #def centerCalc(image): # xOffset = (1000-image.width())/2 # yOffset=(1000-image.height())/2 # return xOffset, yOffset #Stretch image to window while maintaining ratio #def i...
Calsalts/HypnoPlayer
zoomloop.py
zoomloop.py
py
3,878
python
en
code
0
github-code
90
31319659065
import requests from datetime import datetime USERNAME = 'synyster008' TOKEN = 'asdn45kk45kk' pixela_endpoint = "https://pixe.la/v1/users" user_params = { 'token': TOKEN, 'username': USERNAME, 'agreeTermsOfService': 'yes', 'notMinor': 'yes' } #response = requests.post(url=pixela_end...
Synyster008/Python_Projects
Habit Tracker/main.py
main.py
py
991
python
en
code
0
github-code
90
27022225208
#User function Template for python3 ##Complete this functiom def rotateArr(A,D,N): reverseSub(A, 0, D-1) #print(A) reverseSub(A, D, N-1) #print(A) reverseSub(A, 0, N-1) #print(A) return A def reverseSub(A,top,down): if (top>=down): return temp = A[...
riturajkush/Geeks-for-geeks-DSA-in-python
Arrays/prog9.py
prog9.py
py
949
python
en
code
1
github-code
90
15419289564
from tkinter import * from tkinter import messagebox import pymysql def addBook(): def clear(): book_id_entry.delete(0, END) book_title_entry.delete(0, END) book_author_entry.delete(0, END) book_amount_entry.delete(0, END) def addNewBookLogic(): if book_...
PremsRobot/Python
librariansystem/Add_book.py
Add_book.py
py
2,793
python
en
code
0
github-code
90
29180632856
from math import fabs def sum_numbers(num1,num2): return num1+num2 sum=sum_numbers(10,20) print(sum) #------------------------------- def is_even(number): if number%2==0: return True else: return False result=is_even(3) print(result) #------------------------------- def is_even2(nu...
ZocoLearn/Python-CodeAcademy-Python-Training
3. مقدمات زبان پایتون - بخش دوم/3.4 بازگرداندن مقدار از رشته.py
3.4 بازگرداندن مقدار از رشته.py
py
467
python
en
code
0
github-code
90
10251778047
def set_options(opt): opt.tool_options("compiler_cc") opt.tool_options("misc") def configure(conf): conf.check_tool("compiler_cc") conf.check_tool("misc") conf.check_cfg(atleast_pkgconfig_version="0.15.0") conf.check_cfg( package="check", uselib_store="CHECK", args="--...
janies/ipset
tests/wscript
wscript
1,006
python
en
code
12
github-code
90
43333903696
#!/usr/bin/env python3 import sys from math import ceil steps = { 'nw': (-1, -.5), 'n': ( 0, -1.), 'ne': ( 1, -.5), 'sw': (-1, .5), 's': ( 0, 1.), 'se': ( 1, .5), } def walk(route): x = y = 0 for step in route: dx, dy = steps[step] x += dx y += dy y...
taddeus/advent-of-code
2017/11_hexgrid.py
11_hexgrid.py
py
552
python
en
code
2
github-code
90
18101305729
# Depth First Search from collections import deque N = int(input()) nodes = [] G ={} is_visited = {} for _ in range(N): lst = list(map(int, input().split())) idx = lst[0] nodes.append(idx) is_visited[idx] = False degree = lst[1] if degree > 0: G[idx] = lst[2:] else: G[idx] ...
Aasthaengg/IBMdataset
Python_codes/p02238/s937732598.py
s937732598.py
py
927
python
ja
code
0
github-code
90
30456053397
# 프로그래머스 문자열 내 p와 y의 개수 # https://programmers.co.kr/learn/courses/30/lessons/12916 ''' p 와 y의 개수가 같은지 체크하는 문제 대소문자 구별 X ''' def solution(s): s = s.upper() num_p, num_y = 0, 0 for i in s: if i == 'P': num_p += 1 elif i == 'Y': num_y += 1 if num_p == num_y: ...
Lagom92/TIL
Algorithm/pro/Problem/num_p_and_y.py
num_p_and_y.py
py
667
python
ko
code
1
github-code
90
32134247561
""" Paw through test results to see what happened """ import argparse import os import shutil import urllib.request import xml.etree.ElementTree as ET import zipfile WORKING_DIR = ".build_analysis" LATESTBUILDS = "http://latestbuilds.service.couchbase.com/builds/latestbuilds/" JAVA_VARIANTS = ["linux", "macos", "windo...
couchbaselabs/couchbase-lite-java-tools
analyze_build.py
analyze_build.py
py
3,612
python
en
code
0
github-code
90
43262142638
from django.test import TestCase from .factory import TextFactory from ..models import Text, TextWord, Word class TextTest(TestCase): def setUp(self): self.text_body = "test text body." self.text = TextFactory(body=self.text_body) def test_words_created(self): """ a word sho...
charliewhu/Dj_Linguify
content/tests/test_models.py
test_models.py
py
1,752
python
en
code
0
github-code
90
19272593515
import turtle import tkinter t = turtle.Turtle() # 3 ------------------------------------------------------------------------ def drawPolygon(tempTurtle, length, numSides): """ Draws numSides line segments tempTurtle: Turtle object numSides: num line segments length: length of each segment angle...
statisticallyfit/Python
pythonlanguagetutorials/PythonUNE/Practicals/Practical4_#1_DowneyChapter4.3/Exercise4.3_part3.py
Exercise4.3_part3.py
py
824
python
en
code
0
github-code
90
18371736809
L ,R = map(int,input().split()) ans =[] if R - L <= 2019: for i in range(L,R+1): for j in range(i+1,R+1): ans.append(i*j%2019) else: for i in range(R-L-1010,R-L+1010): for j in range(i,R-L+1010): ans.append(i*j%2019) print(min(ans))
Aasthaengg/IBMdataset
Python_codes/p02983/s074902378.py
s074902378.py
py
284
python
en
code
0
github-code
90
27859127397
''' Model 1 - LightGBM Model with DART Booster Features Used - 2,500 CV Score: ''' import pandas as pd import numpy as np import lightgbm as lgb import gc import pickle import sys from sklearn.model_selection import StratifiedKFold from utils import amex_metric_mod, amex_metric_mod_lgbm from tqdm import tqdm from con...
demery93/American-Express-Default-Prediction
100_model1.py
100_model1.py
py
2,840
python
en
code
0
github-code
90
20133474221
#!/usr/bin/env python """ Filter otus from a biom table keeping only ones which are present in a corresponding tree file. Useful for removing non-16s otus following negative mode deblurring """ # amnonscript __version__ = "1.0" import biom import skbio.tree import argparse import sys def filterbiombytree(tablef...
biocore/emp
code/03-otu-picking-trees/deblur/scripts/filterbiombytree.py
filterbiombytree.py
py
1,698
python
en
code
148
github-code
90
71848246698
import numpy as np import pandas as pd from sklearn.neighbors import KernelDensity import matplotlib.pyplot as plt from scipy.optimize import curve_fit from scipy.signal import argrelextrema from tqdm import tqdm def exp_func(x, a, c, d): return a*np.exp(-c*x)+d def exp_fit(signals): print('Fitting is start...
SfdJucide/SamsungMachineLearningBootcamp2022
scintillation-detector-signal-types/utils.py
utils.py
py
4,570
python
en
code
0
github-code
90
42261494847
""" Tests for chrome util. """ import unittest from selenium.webdriver.common.keys import Keys from core.utils.chrome.chrome import Chrome # noinspection PyMethodMayBeStatic class ChromeTests(unittest.TestCase): def setUp(self): self.chrome = Chrome() def tearDown(self): self.chrome.kill()...
NativeScript/nativescript-tooling-qa
core_tests/e2e/core/test_chrome.py
test_chrome.py
py
749
python
en
code
4
github-code
90
27086602358
import sys import Pyro4 import pygame import server from server import Servidor from player import Player from random import randint #sys.excepthook = Pyro4.util.excepthook servidor = Pyro4.Proxy("PYRONAME:example.warehouse") # print("servidor: " + str(objServidor)) # Informações iniciais nome = input("Nome: ") pyga...
mauriciobenigno/piquepega
client.py
client.py
py
11,299
python
pt
code
1
github-code
90
74340456936
from test_monom import test from monom import Monom from repo import * from utils import * test() monoame = citire() monoame.sort(key=lambda m: m.nr1(), reverse=True) nivele = [Nivel()] grupe = [Grupa()] nr_de_1 = monoame[0].nr1() # region Grupe init nivele[0].nivel_factorizare = 0 for m in monoame: if m.nr1() =...
danielsofran/Quine-s-Method
main.py
main.py
py
5,431
python
en
code
1
github-code
90
18349409809
# coding: utf-8 def is_mul_day(m, d): d1 = d % 10 d10 = d // 10 if d1 < 2 or d10 < 2: return False else: return m == d1*d10 M, D = list(map(int, input().split())) res = 0 for i in range(1, M+1): for j in range(1, D+1): if is_mul_day(i, j): res += 1 print(res)
Aasthaengg/IBMdataset
Python_codes/p02927/s350084895.py
s350084895.py
py
320
python
ko
code
0
github-code
90
72084541736
# ESA (C) 2000-2021 # # This file is part of ESA's XMM-Newton Scientific Analysis System (SAS). # # SAS 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 yo...
rjtanner/gofpysas
pyrgsimplot/pyrgsimplot.py
pyrgsimplot.py
py
21,694
python
en
code
0
github-code
90
6741771899
##Input: Name of item, Price of item, weight in Pounds, weight ounces ##Problem Statement: Determine the price per ounce a particular item costs ## and what the total price is ##Output: Item Name, Unit price and total cost ## ## ##Variable Name Datatype ##ItemName String ##PoundPrice Float ...
VictorOwinoKe/UoM-DESIGN-THINKING-
OOP/BulkFoodPython.py
BulkFoodPython.py
py
2,857
python
en
code
1
github-code
90
37277417113
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ import os from oda.test.oda_test_case import OdaApiTestCase cwd = os.path.dirname(os.path.realpath(__file__)) class IndexTest(OdaApiTe...
vancaho/oda
django/oda/test/test_odaweb.py
test_odaweb.py
py
1,529
python
en
code
null
github-code
90
25577402147
a = input() b = len(a) if a.count(a[0]) == len(a): print(-1) exit() def is_palindrome(s): left = 0 right = len(s) - 1 while left < right: if s[left] != s[right]: return False left += 1 right -= 1 return True for i in range(len(a)): if not is_palindrom...
MisileLab/h3
projects/xobusy/bojs/problems/idks/15927.py
15927.py
py
392
python
en
code
2
github-code
90
43213795264
# 1260 인접 행렬 방식 import sys from collections import deque n, m, v = map(int, sys.stdin.readline().split()) # 노드개수, 간선개수, 시작노드 node = [[0] * (n+1) for i in range(n+1)] # 인접행렬방식으로 노드간 연결 저장. for i in range(m): # 간선 m개므로 m번 반복 n1, n2 = map(int, sys.stdin.readline().split()) # 양방향으로 연결된 두 노드 if...
siejwkaodj/Problem-Solve
SM_13th_practice/# 1260 인접 행렬 방식.py
# 1260 인접 행렬 방식.py
py
2,154
python
ko
code
1
github-code
90
13351548366
#coding=utf-8 from django.urls import path from django.contrib import admin from . import views app_name = 'polls' urlpatterns = [ path('', views.IndexView.as_view(), name='index'), path('<int:pk>/result/', views.ResultView.as_view(), name='result'), path('<int:question_id>/votes/', views.vote, name='vote...
Acivii-li/Django_blog
polls/urls.py
urls.py
py
398
python
en
code
0
github-code
90
23832692361
try: import matplotlib.pyplot as plt except RuntimeError: pass try: import plotly import plotly.graph_objs as go from masstodon.plot.plotly import get_black_layout plotly_available = True except ImportError: plotly_available = False from bisect import bisect_left, bisect_right import n...
MatteoLacki/masstodon
masstodon/spectrum/base.py
base.py
py
5,858
python
en
code
3
github-code
90
18458319839
N=int(input()) *A,=map(int,input().split()) *B,=map(int,input().split()) if sum(A)<sum(B): print(-1) exit() #A,B = map(sorted,(A,B)) res=0 count=0 for i in range(N): if B[i]>A[i]: res += B[i]-A[i] count += 1 if count==0: print(0) exit() plus = [A[i]-B[i] for i in range(N) if A[i]>B[i]] pl...
Aasthaengg/IBMdataset
Python_codes/p03151/s357095633.py
s357095633.py
py
444
python
en
code
0
github-code
90
25180487190
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, ShuffleSplit, cross_val_score, GridSearchCV from sklearn.linear_model import LinearRegression, Lasso, OrthogonalMatchingPursuit, ElasticNet from sklearn.tree import DecisionTreeRegressor import pickle from datetime import datet...
Kruthina/real-estate-price-prediction
model/price_prediction.py
price_prediction.py
py
5,936
python
en
code
1
github-code
90
70549455657
from openpyxl import workbook, load_workbook, Workbook import os import base64 from IC_stock import IC_stock_excel_read default_exel_name = 'E01_stock_IC.xlsx' if os.path.exists(default_exel_name): wb = load_workbook(default_exel_name) else: wb = Workbook() def create_sheet(sheet_name): print(f'add sheet...
gree180160/YJCX_AI
IC_stock/IC_Stock_excel_write.py
IC_Stock_excel_write.py
py
2,894
python
en
code
0
github-code
90
435949299
import sys import json, os, importlib import ast sys.path.append('./data') sys.path.append('../') sys.path.append('../../') import task_cls, task_extract def get_cls(task_name, sub_folder, args): # modules = importlib.import_module("task_extract") # myclass = getattr(modules, task_name)(sub_folder,args) ...
Alibaba-NLP/EcomGPT
src/utils.py
utils.py
py
901
python
en
code
117
github-code
90
73400120295
import streamlit as st import pandas as pd import numpy as np import nltk nltk.download('stopwords') from sklearn.feature_extraction.text import CountVectorizer import matplotlib.pyplot as plt #import seaborn as sns cv = CountVectorizer() from sklearn.decomposition import LatentDirichletAllocation as LDA import pickle ...
Emekaborisama/Open-Source-Topic-modelling-platform
app.py
app.py
py
4,780
python
en
code
7
github-code
90
35909942160
import os, torch import numpy as np from plyfile import PlyData, PlyElement ## Mapping of object_id to objects id_object = { '02691156': 'plane', '02773838': 'bag', '02801938': 'basket', '02808440': 'bathtub', '02818832': 'bed', '02828884': 'bench', '02834778': 'bicycle', '0284368...
square-1111/3D-Point-Cloud-Modeling
make_data.py
make_data.py
py
3,376
python
en
code
15
github-code
90
39127798169
def countingValleys(steps, path): level = 0 num_valleys = 0 num_mountains = 0 for step in path: prev_level = level if step == 'D': level -= 1 else: level += 1 print(level) if prev_level == -1 and level == 0: num_valleys += 1 ...
esgiraldop/coding_exercises
count_valleys.py
count_valleys.py
py
581
python
en
code
0
github-code
90
12660788802
import jwt # payload token_dict = { "iss": "WebGoat Token Builder", "aud": "webgoat.org", "iat": 1580615877, "exp": 1580615937, "sub": "tom@webgoat.org", "username": "WebGoat", "Email": "tom@webgoat.org", "Role": ["Manager", "Project Administrator"] } key = "shipping" # headers headers ...
xxxxxxxxzhang/Wannafly-zzx
webgoat/py脚本/make-token.py
make-token.py
py
783
python
en
code
0
github-code
90
19971017051
#!/usr/bin/python # -*- coding: UTF-8 -*- #allow chinese character in program ''' 处理从163下载的原始文件,导入数据库,计算各类指标''' import numpy as np import pandas as pd #import matplotlib.pyplot as plt #import urllib #import pathlib #import time #import math #import gc import sqlite3 as lite #from pylab import mpl import sys reload(...
gzpearlriver/stock
process163.py
process163.py
py
27,314
python
en
code
1
github-code
90
31943542698
import atexit import time import numpy as np from mindspore._c_dataengine import GraphDataClient from mindspore._c_dataengine import GraphDataServer from mindspore._c_dataengine import Tensor from .validators import check_gnn_graphdata, check_gnn_get_all_nodes, check_gnn_get_all_edges, \ check_gnn_get_nodes_from_e...
imyzx2017/mindspore_pcl
mindspore/dataset/engine/graphdata.py
graphdata.py
py
13,947
python
en
code
5
github-code
90
18389442389
# coding: utf-8 # Your code here! N = int(input()) W = list(map(int,input().split())) S = sum(W) ans = float('inf') for i in range(N): l = sum(W[:i+1]) r = S - l ans = min(ans, abs(l-r)) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03012/s977962254.py
s977962254.py
py
210
python
en
code
0
github-code
90
73822587175
import time import allure from Pages.BasePage import BasePage from Pages.EmptySearchPage import EmptySearch class DarazMobileAppTest(BasePage): @allure.step("Testing as Empty Search") def test_empty_search(self): app = EmptySearch(self.driver) app.click_first_next_button() ...
ArfanAbir/appium-android-daraz-Page_object_model
tests/test_EmptySearchTest.py
test_EmptySearchTest.py
py
479
python
en
code
0
github-code
90
18478094029
n=int(input()) a=list(map(int, input().split())) md=sum(a)/n dist=float("inf") ans=float("inf") for i in range(n): if abs(a[i]-md)<dist: ans=i dist=abs(a[i]-md) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03214/s858760235.py
s858760235.py
py
193
python
en
code
0
github-code
90
15171139762
fin = open("../input.in", "r"); fout = open("../part2.out", "w"); def main(): lines = [line.strip() for line in fin.read().split("\n")[0:-1]]; fout.write(str(solve(lines))); def solve(lines): cpy1 = [x for x in lines]; cpy2 = [x for x in lines]; for i in range(len(lines[0])): cnt = 0; ...
Sayeem2004/AdventOfCode
2021/D03/Python/part2.py
part2.py
py
861
python
en
code
0
github-code
90
16621216461
from bson.objectid import ObjectId from app.beers import controllers from tests import clear_db def test_beer_exists(app, mock_beer): clear_db() beer = mock_beer() assert controllers.beer_exists(id=beer.id) is True def test_beer_does_not_exist(app): clear_db() assert controllers.beer_exists(id=...
PoissonJ/beer-list-api
tests/unit/test_beers_controllers.py
test_beers_controllers.py
py
2,024
python
en
code
1
github-code
90
39186402669
#!/usr/bin/python """ Author: Scott C Jensen ################################################################## This program was created for analyzing data from the Linac Coherent Light Source (2015-2016) The experimental setup would convert a series of single shot x-ray spectroscopy experiements and examine the spec...
scott-c-jensen/LCLS_Analysis
Step1_Process_Raw_Data_MnCl2/get_xes_photon_counting_no_hits.py
get_xes_photon_counting_no_hits.py
py
15,642
python
en
code
0
github-code
90
72024093738
import requests from streamlit_lottie import st_lottie import streamlit as st from PIL import Image from geopy.geocoders import Nominatim import pydeck as pdk import pandas as pd def load_lottie(url: str): r = requests.get(url) if r.status_code!= 200: return None return r.json() #-- def load_pag...
magnesyljuasen/grunnvarme
old/funksjoner.py
funksjoner.py
py
2,218
python
en
code
2
github-code
90
37123804666
from django.db import models class MigrationHistory(models.Model): app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True, null=True) @classmethod def for_migration(cls, app_name, migration): try: retur...
sandyarmstrong/snowy
lib/south/models.py
models.py
py
575
python
en
code
16
github-code
90
39561781408
# # @lc app=leetcode.cn id=14 lang=python3 # # [14] 最长公共前缀 # # @lc code=start class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: smallest=0 for i in range(len(strs)): if len(strs[smallest])>len(strs[i]): smallest=i length=len(str...
bre01/studypython
leetcode/14.最长公共前缀.py
14.最长公共前缀.py
py
698
python
en
code
0
github-code
90
6746557409
import re from typing import List PuzzleInput = List[str] CRATE_CONFIGURATION = { 1: ["D", "H", "N", "Q", "T", "W", "V", "B"], 2: ["D", "W", "B"], 3: ["T", "S", "Q", "W", "J", "C"], 4: ["F", "J", "R", "N", "Z", "T", "P"], 5: ["G", "P", "V", "J", "M", "S", "T"], 6: ["B", "W", "F", "T", "N"], ...
VictorOnink/Advent-of-Code-2022
Day_5_Supply_Stacks/day_5_file.py
day_5_file.py
py
1,919
python
en
code
0
github-code
90
27842376766
import pandas as pd import numpy as np import datetime import os from source.abstractions import * DATE_FORMAT = "%m-%d-%Y" def backtest(backtest: Backtest): lookback = backtest.lookback trade_structure = backtest.trade_structure signals = backtest.signals agg_data = pd.read_csv("aggregated_data/agg_...
AbstractVectors/AlphaTrade
source/backtester.py
backtester.py
py
6,257
python
en
code
1
github-code
90
18286708599
N,K,S = map(int, input().split()) c = 0 for i in range(N): if c < K : print(S, end = ' ') c += 1 else: if S < 10** 9: print(S+1, end = ' ') else: print(1, end=' ')
Aasthaengg/IBMdataset
Python_codes/p02797/s664913029.py
s664913029.py
py
228
python
en
code
0
github-code
90
14837907933
""" pyclx - Handy functions in Python for working with the CELEX database ===================================================== *pyclx* provides some handy functions to work with the CELEX database. """ import os import sys import multiprocessing as mp from pip._vendor import pkg_resources __author__ = 'Motoki Sait...
msaito8623/pyclx
pyclx/__init__.py
__init__.py
py
2,165
python
en
code
0
github-code
90
20851343762
def iterdict(d): for k, v in d.items(): if isinstance(v, dict): iterdict(v) elif isinstance(v, list): for each_item in v: iterdict(each_item) elif v and type(v) != str: d.update({k: str(v)}) return d import time inp_dict = {'NIC': [{'s...
Harishkumar18/data_structures
python_practice/datatype_check.py
datatype_check.py
py
683
python
en
code
1
github-code
90
17758161100
# from urllib import response import json def getWorklogs(): print('called getWorklogs') user_id = request.vars.user_id if user_id==None: response_data = {'Result': 'User Id Not found.'} else: sql ="SELECT au.first_name as efname,au.last_name as elname,au2.first_name as afnam...
shaheenbd7/web2py
controllers/api_get_worklogs.py
api_get_worklogs.py
py
909
python
en
code
0
github-code
90
2435910419
import bpy from bpy.types import Context from .extensions import ObjectPropertyGroup, ScenePropertyGroup from .registration import register_module_classes_factory, CollectionPropBase, OperatorBase """For now, this is a module to assist with development only, but may be expanded upon if further migration is required ...
Mysteryem/AvatarBuilder
migrate.py
migrate.py
py
3,634
python
en
code
3
github-code
90
9965128958
from pyspark.sql import SparkSession from pyspark.sql.types import * from pyspark.sql.functions import from_json # Define the schema to speed up processing jsonSchema = StructType( [StructField("value0", StringType(), True), StructField("value1", ArrayType(DoubleType()), True)]) def get_spark_session(app_na...
obiliosd/testing
spark/app/src/stream workcount.py
stream workcount.py
py
2,087
python
en
code
0
github-code
90
18170562469
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): R, C, K, *RCV = map(int, read().split()) item = [[0] * C for _ in range(R)] for r, c, v in zip(*[iter(RCV)] * 3): item[r - 1][c...
Aasthaengg/IBMdataset
Python_codes/p02586/s790978427.py
s790978427.py
py
888
python
en
code
0
github-code
90
30648054753
from rest_framework.response import Response from .models import Offer from publications.models import Publication from django.conf import settings from auth.services import checkUserPermissions from transactions.services import finishBid from util.services import stringToDatetime import datetime def checkOfferServic...
OfertAp-UNAL/OfertApp-Backend
src/publications/services.py
services.py
py
5,775
python
en
code
0
github-code
90
26034650886
import collections import datetime import hashlib import json import logging from google.appengine.ext import ndb from google.protobuf import message from components import utils from . import api from . import b64 from . import exceptions from . import model from . import service_account from . import signature fro...
luci/luci-py
appengine/components/components/auth/delegation.py
delegation.py
py
17,976
python
en
code
74
github-code
90
28918113148
import pytest from pathlib import Path from extraction_tools_cache import osrs_cache_data @pytest.mark.parametrize("test_data,expected", [ ({"id": 7410, "name": "Greater abyssal demon", "models": [32921]}, "eJyrVspMUbJSMDcxNNBRUMpLzE0F8pTci1ITS1KLFBKTKouLE3MUUlJz8/OUgApy81NSc4qBSqKNjSyNDGNrAWB5EzI=") ]) def...
pmauldin/osrsbox-db
test/test_osrs_cache_data.py
test_osrs_cache_data.py
py
914
python
en
code
null
github-code
90
70713291497
#!/usr/bin/env python3 """ Restore series of Hadoop sequence files in a GCS bucket as Bigtable tables. """ __author__ = "Maciej Sieczka <msieczka@egnyte.com>" import argparse import time import logging import pickle import subprocess import re from google.cloud import bigtable, storage logging.basicConfig(format='%...
egnyte/bigtable-backup-and-restore
bigtable_import.py
bigtable_import.py
py
6,693
python
en
code
4
github-code
90