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
23667141606
import math class Node: def __init__(self, value=None, next=None,skip_next=None,term_frequency=0,tf_idf=0.0): """ Class to define the structure of each node in a linked list (postings list). Value: document id, Next: Pointer to the next node Add more parameters if needed. ...
lbodapat/Search_Engine_Indexing_Query_Retrieval
linkedlist.py
linkedlist.py
py
5,845
python
en
code
0
github-code
90
33597117897
from Labs.Lab06_MVC.lab06_AnsMvc.model.degree_minutes_seconds import degree_minutes_seconds def format_location(location): """ Функция возвращает строку с информацией о локации в виде широты и долготы :param location: (iterable): географические координаты местоположения. Первый элемент итерации - ...
ASPRTK/ITMO
Course.Python/Labs/Lab06_MVC/lab06_AnsMvc/model/format_location.py
format_location.py
py
1,227
python
ru
code
0
github-code
90
41293396279
N, M = list(map(int, input().split())) line_w = [] line_b = [] graph = [] graph_w = [] graph_b = [] for i in range(8): if i % 2 == 0: line_w.append('W') line_b.append('B') else: line_b.append('W') line_w.append('B') for i in range(8): if i % 2 == 0: graph_w.append(...
du2lee/BOJ
BOJ/python/1018.py
1018.py
py
2,101
python
en
code
3
github-code
90
8209172362
import math import numpy as np import pygame.draw from sim.settings import BLUE from sim.noodle import Noodle from sim.food import Food from sim.helpers import circularize, fill_pie # Pred is a child of Creature class, with additional health and smart predator attributes class Pred(Noodle): # initialize pred ...
ggdurrant/EvoNoodles
sim/pred.py
pred.py
py
1,262
python
en
code
0
github-code
90
73251343977
import sys import requests from jnpr.junos.device import Device #################################### # UDFs # #################################### # Get the hostname of the device def get_hostname(**kwargs): device_info = get_device_info_healthbot(**kwargs) return device_info['fa...
Juniper/healthbot-rules
juniper_official/System/generic_functions.py
generic_functions.py
py
11,697
python
en
code
41
github-code
90
18455629839
from collections import defaultdict import heapq N,K=map(int,input().split()) hq=[] tset_all=set() for i in range(N): t,d=map(int,input().split()) heapq.heappush(hq,(-d,t)) tset_all.add(t) #print(heapq) hq_K=[] dsum=0 tdic=defaultdict(int) for i in range(K): md,t=heapq.heappop(hq) heapq.heappush(hq_K,((-md,...
Aasthaengg/IBMdataset
Python_codes/p03148/s000229899.py
s000229899.py
py
847
python
en
code
0
github-code
90
18372522289
N = int(input()) A = list(map(int,input().split())) S = sum(A) damu_sum = sum(A[1::2]) ans = S - 2 * (damu_sum) ans_list = [ans] for i in range(N-1): ans = 2 * A[i] - ans ans_list.append(ans) print(*ans_list)
Aasthaengg/IBMdataset
Python_codes/p02984/s016009366.py
s016009366.py
py
219
python
en
code
0
github-code
90
71789653418
#!/usr/bin/env python3 import itertools import curses from enum import Enum from collections import defaultdict class Tiles(Enum): EMPTY = 0 WALL = 1 BLOCK = 2 PADDLE = 3 BALL = 4 def getTexture(self): textures = { 0: "", 1: "|", 2: "█", ...
alu-/advent-of-code-2019
intcode/screen.py
screen.py
py
4,067
python
en
code
0
github-code
90
21246789823
"""Models for Cupcake app.""" from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() DEFAULT_CUPCAKE_URL = 'https://tinyurl.com/demo-cupcake' class Cupcake(db.Model): """Cupcake.""" __tablename__ = "cupcakes" id = db.Column( db.Integer, primary_key=True, autoincrement=True ...
jasjoh/flask-cupcakes
models.py
models.py
py
1,074
python
en
code
0
github-code
90
17622316108
#!/usr/bin/python3 """ Export to json """ import json import requests import sys def create_json_file(employee_id): """ Create a json file with all tasks from all employees """ base_url = "https://jsonplaceholder.typicode.com/" res = requests.get(base_url + "users/{}".format(employee_id)).json() ...
Grace-ngigi/alx-system_engineering-devops
0x15-api/2-export_to_JSON.py
2-export_to_JSON.py
py
912
python
en
code
0
github-code
90
10966169421
#!/usr/bin/env python3 from lib import prime ways = [0]*11 for i in range(10): if prime(i): ways[i] = 1 else: ways[i] = 0 for j in range(i): if prime(i-j): ways[i] += ways[j] print(ways)
martinmongi/project_euler
77.py
77.py
py
202
python
en
code
1
github-code
90
17963362529
import collections n=int(input()) a=list(map(int,input().split())) c = collections.Counter(a) b=[0,0] d=[0,0] for i in c: if c[i]>=4: b.append(i) elif c[i]>=2: d.append(i) b.sort(reverse=True) d.sort(reverse=True) if b[0]>d[0]: print(b[0]*b[0]) elif b[0]<d[1]: print(d[0]*d[1]) else: ...
Aasthaengg/IBMdataset
Python_codes/p03625/s170126791.py
s170126791.py
py
337
python
en
code
0
github-code
90
70297684778
from itertools import combinations from sys import stdin n = int(stdin.readline().rstrip()) nums = [i for i in range(0,10)] temp = list() result = list() for i in range(1,11): for j in combinations(nums,i): temp = list(j) temp.sort(reverse=True) result.append(int(''.join(map(str,temp)))) ...
JKbin/Study-of-Coding-with-Python
BaekJoon/Gold_V/1038.py
1038.py
py
459
python
en
code
0
github-code
90
4239356288
# # @lc app=leetcode id=65 lang=python3 # # [65] Valid Number # # @lc code=start class Solution: def isNumber(self, s: str) -> bool: def if_digits(s): n = len(s) if n == 0: return False for c in s: if c not in list("0123456789"): ...
wangyerdfz/python_lc
65.valid-number.py
65.valid-number.py
py
3,011
python
en
code
0
github-code
90
74132736297
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 16 14:51:31 2023 2) Show that for Thiessen polygons drawn around randomly placed points within continents (for the number of points in each continent, use the true number of groups), the empirical relationship between geographic variability at the...
amarchenko26/ethnolinguistic
create_thiessen.py
create_thiessen.py
py
8,051
python
en
code
0
github-code
90
23414187383
from flask import Flask, render_template, request, redirect, url_for, flash app = Flask(__name__) ALLOWED_EXTENSIONS = {'jpeg', 'jpg', 'png'} app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['RECAPTCHA_USE_SSL']= False app.config['RECAPTCHA_PUBLIC_KEY'] ='6LeBCfIZAAAAAO39_L4Gd7f6uCM0PfP_N3XjHxkW' app...
Qazqazqaz2/proxy_checker
web_interface.py
web_interface.py
py
1,343
python
en
code
0
github-code
90
18528203349
def dig_sum(N): ans=0 while N>0: ans+=N%10 N=N//10 return ans N=int(input()) ans=100 for i in range(1,N): tmp=dig_sum(i)+dig_sum(N-i) if tmp<ans: ans=tmp print(ans)
Aasthaengg/IBMdataset
Python_codes/p03331/s944140510.py
s944140510.py
py
210
python
fr
code
0
github-code
90
34917784157
from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.image import load_img, img_to_array import numpy as np from flask import Flask, request, render_template from werkzeug.utils import secure_filename import os, sys, glob, re app = Flask(__name__) model_path = "rice.h5" classes = {0...
19wh1a0576/BVRITHYDERABAD
CSE/CSE Major Projects - 2017_21/Rice Crop Disease Detection/app.py
app.py
py
1,912
python
en
code
0
github-code
90
15834722488
from aws_cdk import ( aws_rds as rds, aws_ec2 as ec2, Duration, RemovalPolicy, ) from constructs import Construct from typing import Optional, Any from provena.custom_constructs.db_instance import INSTANCE_TYPE # Setting for RDS instance BACKUP_RETENTION_DAYS = 10 BACKUP_DURATION = Duration.days(BACKU...
provena/provena
infrastructure/provena/custom_constructs/db_instance_from_snapshot.py
db_instance_from_snapshot.py
py
4,303
python
en
code
3
github-code
90
18395911839
N = int(input()) D = {} q = set() for i in range(N): s,p = input().split() if s in q: D[s].append([int(p),i]) else: D[s] = [[int(p),i]] q.add(s) ans = [] for i in sorted(list(q)): D[i].sort(reverse=True) for j in D[i]: ans.append(j[1]) [print(i+1) for i in ans]
Aasthaengg/IBMdataset
Python_codes/p03030/s000431407.py
s000431407.py
py
317
python
en
code
0
github-code
90
23158454615
#!/usr/bin/env python3 """ Description: Wakurtosis load simulator """ """ Dependencies """ import sys, logging, yaml, json, time, random, os, argparse, tomllib, glob import requests import rtnorm # from pathlib import Path # import numpy as np # import pandas as pd # import matplotlib.pyplot as plt # import cloudpick...
alrevuelta/wakurtosis
wsl-module/wsl.py
wsl.py
py
15,209
python
en
code
null
github-code
90
18429577189
from collections import deque N=int(input()) b=list(map(int,input().split())) flag=0 op=deque() #1→12→122→1232→11232→121232→1221232→11221232→111221232 #print(b) while len(b)>0: for i in range(len(b)-1,-1,-1): if b[i]==i+1: #print(b[i]) op.appendleft(b.pop(i)) flag=1 ...
Aasthaengg/IBMdataset
Python_codes/p03089/s749279218.py
s749279218.py
py
505
python
en
code
0
github-code
90
25599000076
from django.contrib import admin from django.urls import path from home.views import * admin.site.site_header = "Raj Tours Admin" admin.site.site_title = "Raj Tours Admin Portal" admin.site.index_title = "Welcome to Raj Tours" urlpatterns = [ path('admin/', admin.site.urls), path("",index,name='home'), p...
AkshayKamble2312/web_devlopment_projects
firstproject/rajtours/home/urls.py
urls.py
py
544
python
en
code
0
github-code
90
9891441718
# -*- coding: utf-8 -*- """ Created on Fri Dec 28 21:37:43 2018 @author: William Keilsohn """ ''' Count the accurance of a given character in a string. ''' # Import packages import re inString = input('Please enter a string: ') inChar = input('Please enter a single character to search for: ') def ...
wkeilsohn/Python-Interview-Problems
Character_counter.py
Character_counter.py
py
557
python
en
code
0
github-code
90
18194038099
# import sys # input = sys.stdin.readline import itertools import collections from decimal import Decimal from functools import reduce # 持っているビスケットを叩き、1枚増やす # ビスケット A枚を 1円に交換する # 1円をビスケット B枚に交換する def main(): n = int(input()) numbers = input_list() ans = [] s = reduce(lambda a, b: a ^ b, numbers) f...
Aasthaengg/IBMdataset
Python_codes/p02631/s849016927.py
s849016927.py
py
1,403
python
en
code
0
github-code
90
20748158127
# Take refresh token and encoded auth string and return new tokens def get_new_token(): import requests import json JSON_FILE_DIRECTORY = r'user_data.json' TOKEN_URL = 'https://accounts.spotify.com/api/token' open_file = open(JSON_FILE_DIRECTORY) #Open json into variable json_da...
Gavie05/Streamer-Queue
token_refresh.py
token_refresh.py
py
1,106
python
en
code
0
github-code
90
18548902899
def actual(A, B, K): min_left = A max_left = min(A + (K - 1), B) min_right = max(B - (K - 1), max_left + 1) max_right = B left = set(range(min_left, max_left + 1)) right = set(range(min_right, max_right + 1)) unique_nums = left | right return '\n'.join(map(str, sorted(unique_nums))) ...
Aasthaengg/IBMdataset
Python_codes/p03386/s590165116.py
s590165116.py
py
379
python
en
code
0
github-code
90
73529831976
import pickle from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from sklearn import metrics import matplotlib.pyplot as plt import seaborn as sns import json import os from diagnostics import model_predictions ###############Load config.json and get path variables with open('c...
lcwcharles/a-dynamic-risk-assessment-system
reporting.py
reporting.py
py
1,951
python
en
code
0
github-code
90
74785351977
minim = -100000 def RodCutting(price, n): val = [0 for x in range(n + 1)] val[0] = 0 maintain_len=[[] for x in range(n+1)] maintain_len[0]=[0] length_arr=len(price) max_val = minim for i in range(1, n + 1): j=0 while j<length_arr and i-j-1>=0: if max_val<(price[j]...
codejigglers/leetcodes
Rod_cutting_problem.py
Rod_cutting_problem.py
py
772
python
en
code
0
github-code
90
18443877229
N=int(input()) A=list(map(int,input().strip().split())) A.sort() def gcd(a,b): while True: r=a%b if r==0: break a=b b=r return b ans=A[0] for n in range(N): ans=gcd(ans,A[n]) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03127/s469818631.py
s469818631.py
py
244
python
en
code
0
github-code
90
18257368769
import sys import numpy as np import math as mt read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n, a, b = map(int, readline().split()) ans = a * (n//(a + b)) if n%(a+b) < a: ans += n%(a+b) else: ans += a print(ans)
Aasthaengg/IBMdataset
Python_codes/p02754/s329777931.py
s329777931.py
py
285
python
en
code
0
github-code
90
43136646063
import pygame from scripts.common.utils import State PLAYER_SPEED = 1 JUMP_HEIGHT = 7 GRAVITY = 0.5 class Player(pygame.sprite.Sprite): def __init__(self, game, assets, *groups, **kwargs): super().__init__(groups) self.game = game self.assets = assets self.image = pygame.image.lo...
lsglucas/hurricane-in-hawaii
scripts/sprites/player.py
player.py
py
4,496
python
en
code
0
github-code
90
17956236719
import math from typing import List, Counter, Tuple from collections import Counter from itertools import permutations def read_int() -> int: return int(input().strip()) def read_ints() -> List[int]: return list(map(int, input().strip().split(' '))) def solve() -> int: N, M, R = read_ints() r = [a...
Aasthaengg/IBMdataset
Python_codes/p03608/s281123310.py
s281123310.py
py
965
python
en
code
0
github-code
90
32276575457
import itertools import os.path as path import numpy as np import pandas as pd from src import constants def load_feature_set(name): file_path = path.join(constants.RAW_TAGGED_FEATURE_SET_PATH, 'msd-' + name + '/msd-' + name + '.csv') whole = np.array(pd.read_csv(file_path, header=None)) return whole b...
EngineerLaroche/MusicTypeDetection
scripts/split_other_dataset.py
split_other_dataset.py
py
1,179
python
en
code
0
github-code
90
348029338
from parsimonious.nodes import Node from parsimonious.grammar import Grammar, NodeVisitor class Range: start_open: bool end_open: bool val_type: str precision: int start: float end: float floor: bool ceil: bool def __init__( self, start_open: bool = False, ...
sethjuarez/fibberio
fibberio/range.py
range.py
py
5,099
python
en
code
5
github-code
90
657053692
from ..locators.executive_secretary_locators import ExecutiveSecretaryLocators from ..components.button import Button from ..components.text_box import TextBox class ExecutiveSecretaryPage(Button, TextBox): def open_new_case_add_steps(self): if self.is_element_present(*ExecutiveSecretaryLocators.MENU_CLAI...
gulida/mtc
pages/executive_secretary_page.py
executive_secretary_page.py
py
1,723
python
en
code
0
github-code
90
18135963686
# User-initiated helper script for parsing Ensembl FASTA Files to dataframes and saving import pandas as pd from Bio import SeqIO def main(fasta_path): data = [] records = [record for record in SeqIO.parse(fasta_path, "fasta")] for record in records: ensembl_protein_id = record.id protein_...
noelgarber/PACM
general_utils/ensembl_fasta_parser.py
ensembl_fasta_parser.py
py
1,310
python
en
code
0
github-code
90
18348847599
N=int(input()) a=[[0 for j in range(N-1)] for i in range(N)] for i in range(N): line=list(map(int,input().split())) for j in range(N-1): a[i][j]=line[j]-1 a[i]=a[i][::-1] stack=[] def addmatch(i): if len(a[i])==0: return j=a[i][-1] if a[j][-1]==i: stack.append([i,j]) for i in range(N): ...
Aasthaengg/IBMdataset
Python_codes/p02925/s644493706.py
s644493706.py
py
676
python
en
code
0
github-code
90
15662277349
import urlparse import time import datetime class Throttle: """Add delay between two scrapy to same domain """ def __init__(self, delay): self.delay = delay self.domain = {} def wait(self, url): domain = urlparse.urlparse(url).netloc lastVisistTime = self.domain.get...
HelloWorldCAT/WebJobCrawler
Throttle.py
Throttle.py
py
587
python
en
code
0
github-code
90
23362975164
word = input() liste = list(word) #fct list convertit la séquence en liste #liste=[word] :def une liste avec une seule variable liste_inverse = liste[::-1] while len(word) % 2 == 0: #si la longueur du mot est paire for letter in range (len(liste)): #pour chaque lettre présente dans mon mot if liste[lett...
Stellupo/JetBrainsAcademyPython
PalidromeLetter.py
PalidromeLetter.py
py
487
python
fr
code
0
github-code
90
36275045257
# coding: utf-8 import tensorflow as tf def create_adam_optimizer(learning_rate, momentum): return tf.train.AdamOptimizer(learning_rate=learning_rate, epsilon=1e-4) def create_sgd_optimizer(learning_rate, momentum): return tf.train.MomentumOptimizer(learning_rate=lea...
hccho2/Tacotron-Wavenet-Vocoder-Korean
wavenet/ops.py
ops.py
py
1,985
python
en
code
162
github-code
90
18579186762
import math import numpy as np """ Finding point of intersection between line and circle: https://stackoverflow.com/questions/30844482/what-is-most-efficient-way-to-find-the-intersection-of-a-line-and-a-circle-in-py Circle and line segment intersection: https://stackoverflow.com/questions/22747702/finding-x-and-y-axi...
rahulsinghk998/Crowd-behaviour-modelling
mathHelper.py
mathHelper.py
py
5,236
python
en
code
0
github-code
90
35281066047
import torch import pandas as pd import numpy as np import sys import copy from tqdm import tqdm import torch.nn as nn from sklearn.metrics import confusion_matrix from models.losses import LogitAdjustLoss, FocalLoss, CrossEntropyLoss, instance_weighted_loss, DiscriminativeLoss from utils.help_functions import Voting,...
zili98/ELEC576-Deep-Learning-Final-Project
src/train_function.py
train_function.py
py
16,799
python
en
code
0
github-code
90
18476969609
class PrimeFactor(): def __init__(self, n): """ エラトステネス O(N loglog N) """ self.n = n self.table = list(range(n+1)) # 最小素因数のリスト self.table[2::2] = [2]*(n//2) for p in range(3, int(n**0.5) + 2, 2): if self.table[p] == p: for q ...
Aasthaengg/IBMdataset
Python_codes/p03213/s464282704.py
s464282704.py
py
1,664
python
en
code
0
github-code
90
20857985297
#!/usr/bin/env python from __future__ import print_function from six.moves import input import sys import copy import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg from math import pi from std_msgs.msg import String from moveit_commander.conversions import pose_to_list from pkg_vb_sim....
hi-18-K/inventory_simulation
Task2/pkg_task2/scripts/node_t2_ur5_1_pick_place.py
node_t2_ur5_1_pick_place.py
py
11,910
python
en
code
0
github-code
90
17863143812
import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial) def mai...
Alyndre/DeepLearningPython
TensorFlow/TF_mnist.py
TF_mnist.py
py
1,524
python
en
code
0
github-code
90
18550850459
#11208467 t="abcdefghijklmnopqrstuvwxyz" s=input() if s==t[::-1]:print(-1);exit() if len(s)!=26: for i in t: if i not in s:print(s+i);exit() i=25 while s[i-1]>s[i]:i-=1 tt=s[i-1] ss=list(s[i-1:]) ss.sort() print(s[:i-1]+ss[ss.index(tt)+1])
Aasthaengg/IBMdataset
Python_codes/p03393/s991491343.py
s991491343.py
py
245
python
en
code
0
github-code
90
73059217576
import json import hw1.morph as morph from gensim.models import KeyedVectors import numpy as np LIMIT = 300 input1 = "example_texts.json" input2 = "dataset_43428_1.txt" xml_dict = '../hw1/dict.opcorpora.xml' xml_corpus = '../hw1/annot.opcorpora.no_ambig.xml' middle_punctuation_remover = str.maketrans({key: None for ...
KatyaKos/nlp-kr
nlp/hw2/refer.py
refer.py
py
5,886
python
en
code
0
github-code
90
73367799978
import conllu from tqdm import tqdm import torch from torch.utils.data import Dataset, DataLoader from torch.nn.utils.rnn import pad_sequence import torch.multiprocessing as mp from torch.utils.data.distributed import DistributedSampler from torch.nn.parallel import DistributedDataParallel as DDP from torch.distribute...
P-Balaramakrishna-Varma/NLPA2
neural_tag.py
neural_tag.py
py
8,400
python
en
code
0
github-code
90
18428624847
from django.shortcuts import render from admin.models import admin from admin.form import AdminForm # Create your views here. def create(request): if request.method=="POST": form=AdminForm(request.POST) form.save() return redirect("/dashboard") else: form=AdminForm() return ...
Bishal789/webdev
Admin/views.py
views.py
py
376
python
en
code
0
github-code
90
12704450191
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]: remove = ListNode(-1) remove.next = head previous...
FevenBelay23/competitive-programming
0082-remove-duplicates-from-sorted-list-ii/0082-remove-duplicates-from-sorted-list-ii.py
0082-remove-duplicates-from-sorted-list-ii.py
py
780
python
en
code
0
github-code
90
4129671612
import sys import numpy as np state = np.array([int(x) for x in sys.stdin.readline().split(',')]) for i in range(80): zeros = state.shape[0] - np.count_nonzero(state) state[state == 0] = 7 state = np.concatenate([state, np.full((zeros,), 9)]) state -= 1 print(state.shape[0])
folded/aoc-2021
06/06-1.py
06-1.py
py
286
python
en
code
0
github-code
90
44009984238
# import libraries import pandas as pd from sklearn.preprocessing import OneHotEncoder def one_hot_encoding(data: pd.DataFrame, categorical_features:list) -> pd.DataFrame: """Apply one hot encoding to categorical features in a dataframe. Args: data (pd.DataFrame): Input dataframe. categorical...
mawada-sweis/Clustering-Analysis
src/utils/transform_data.py
transform_data.py
py
2,355
python
en
code
3
github-code
90
71319205417
from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse from sport_academy.models import Player class DriverTest(TestCase): fixtures = [ "sport_club_db_data.json" ] def setUp(self): self.user = get_user_model().objects....
anastasiia-tsurkan/iCoach
sport_academy/tests/test_forms.py
test_forms.py
py
707
python
en
code
1
github-code
90
25788940903
from hedera import ( Hbar, PrivateKey, AccountBalanceQuery, AccountCreateTransaction, TransferTransaction, Transaction, ) from get_client import client from jnius import cast exchangeKey = PrivateKey.generate() userKey = PrivateKey.generate() print("Exchange Key : ", exchangeKey.toString()...
wensheng/hedera-sdk-py
examples/multi_app_transfer.py
multi_app_transfer.py
py
2,741
python
en
code
18
github-code
90
23410225016
#!/usr/bin/env python3 import asyncio, random from irctokens import build, Line from ircrobots import Bot as BaseBot from ircrobots import Server as BaseServer from ircrobots import ConnectionParams # aaaaaaaaaaaaaAAAAAAAAAAAAAAA # im too lazy to import more stuffs :tm: from ircrobots.server import * from config imp...
xfnw/relay
bot.py
bot.py
py
4,938
python
en
code
0
github-code
90
18317568279
N=int(input()) L=list(map(int,input().split())) suml=sum(L) l,ll,i=L[0],0,0 while l<suml/2: i+=1 ll=l l+=L[i] key=min(l-suml/2,suml/2-ll) print(int(key*2))
Aasthaengg/IBMdataset
Python_codes/p02854/s925779179.py
s925779179.py
py
162
python
en
code
0
github-code
90
7671707668
import pandas as pd from method.frame.checking_data import DataMining class ScoreCardProcess(DataMining): def __init__(self, data, label: str = 'label', show_plot: bool = False): self.data = data self.label = label self.show_plot = show_plot self.u...
JPL-JUNO/Collections
scorecard/method/process.py
process.py
py
4,542
python
en
code
0
github-code
90
73951313257
import os import csv import pandas as pd class AddingStuff: def __init__(self): self.categories = self.load_csv() def load_csv(self): arr = [] path = os.path.abspath(os.path.dirname(__file__)) file_path = os.path.join(path, 'database/expenses.csv') w...
arsh939/Python-Projects
python-budget/addingStuff.py
addingStuff.py
py
1,075
python
en
code
3
github-code
90
37778018200
from rest_framework.authtoken.models import Token from astrobin.middleware.mixins import MiddlewareParentClass from common.services import AppRedirectionService REST_FRAMEWORK_TOKEN_COOKIE = 'classic-auth-token' class RestFrameworkTokenCookieMiddleware(MiddlewareParentClass): def _process(self, request): ...
astrobin/astrobin
astrobin/middleware/rest_framework_token_cookie_middleware.py
rest_framework_token_cookie_middleware.py
py
1,011
python
en
code
100
github-code
90
13810613079
from datetime import timedelta from functools import wraps from django.conf import settings from django.utils import timezone from user.models import LoginRequest import requests def check_recaptcha(view_func): @wraps(view_func) def _wrapped_view(view, request, *args, **kwargs): request.recaptcha_i...
HackAssistant/hackassistant
user/verification.py
verification.py
py
2,846
python
en
code
6
github-code
90
27088036128
import re from llnl.util.argparsewriter import ArgparseWriter import spack.cmd import spack.main from spack.main import SpackCommand commands = SpackCommand('commands') parser = spack.main.make_argument_parser() spack.main.add_all_commands(parser) def test_commands_by_name(): """Test default output of spack c...
matzke1/spack
lib/spack/spack/test/cmd/commands.py
commands.py
py
1,203
python
en
code
2
github-code
90
8281775305
# -*- coding:utf-8 -*- """ Created by haven on 16/8/20. """ import requests from config import config # from Dach import Dache from Dache import Dache class Uber(Dache): def __init__(self, from_lat, from_lon, to_lat, to_lon): # Dache.__init__(self) # super(from_lat, from_lon, to_lat, to_lon) ...
Teisei/TaxiRobot
lib/RouteCompare/uberApi.py
uberApi.py
py
3,510
python
en
code
0
github-code
90
9093289282
import pymel.core as pm import mtoa.utils as utils import mtoa.ui.ae.utils as aeUtils from mtoa.ui.ae.shaderTemplate import ShaderAETemplate class AEH_ThinFilmInterferenceTemplate(ShaderAETemplate): def setup(self): # Add the shader swatch to the AE self.addSwatch() self.beginScrollLayout(...
splicerlabs/H_ThinFilmInterference
source/mtoa/H_ThinFilmInterferenceTemplate.py
H_ThinFilmInterferenceTemplate.py
py
1,743
python
en
code
13
github-code
90
3690741544
# coding=utf-8 import cv2 import os.path import sys def splitVideo(video_path, out_path, interval, start, end): """ 拆分视频 :param video_path: 视频路径 :param out_path: 输出影像的文件夹 :param interval: 采样间隔,1表示逐帧输出 :param start: 起始时间,单位为秒 :param end: 结束时间,单位为秒 :return: 空 """ separator = os...
zhaoxuhui/TookitsForVideoProcessing
splitVideo.py
splitVideo.py
py
2,178
python
en
code
2
github-code
90
4962944762
import os import sys import time import math import shutil # import at_cascade with a preference current directory version current_directory = os.getcwd() if os.path.isfile( current_directory + '/at_cascade/__init__.py' ) : sys.path.insert(0, current_directory) import at_cascade import dismod_at # BEGIN_PYTHON # # c...
bradbell/at_cascade
test/csv_fit.py
csv_fit.py
py
6,619
python
en
code
3
github-code
90
74405158057
import numpy as np from icecube import icetray, dataclasses from icecube.dataclasses import I3Particle def pick_em_or_had(type): em_types = [I3Particle.EMinus, I3Particle.Brems] had_types = [I3Particle.Hadrons, I3Particle.NuclInt] if type in had_types: return 'HAD' elif type in em_types: return 'EM' else: ...
clark2668/icetradio
python/util_phys.py
util_phys.py
py
335
python
en
code
0
github-code
90
21473642975
# Splash scene - first scene the user sees import pygwidgets import pyghelpers from Constants import * class SceneSplash(pyghelpers.Scene): def __init__(self, window): self.window = window self.backgroundImage = pygwidgets.Image(self.window, (0, 0), ...
IrvKalb/Object-Oriented-Python-Code
Chapter_16/Dodger/SceneSplash.py
SceneSplash.py
py
2,392
python
en
code
207
github-code
90
18607934946
import os from jsonc_parser.parser import JsoncParser import requests from fastapi.responses import PlainTextResponse import subprocess from subprocess import PIPE CONFIG_FILE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/server/config.jsonc" CONFIG = JsoncParser.parse_file(CONFIG_FILE) async de...
acenturyandabit/code2dia
code2dia/convertPlantUMLToSVG.py
convertPlantUMLToSVG.py
py
897
python
en
code
0
github-code
90
17764060430
# Leer letras de líneas (ver la entrada a continuación). Cada letra está en un cuarto índice, comenzando desde el índice 1. # ENTRADA # [D] # [N] [C] # [Z] [M] [P] # SALIDA DESEADA # [' D ', 'NC', 'ZMP'] # VERSION CON DOBLE CICLO FOR PARA RECORRER LINEAS Y LETRAS with open("11. Desafíos/letras.txt") as archivo:...
manutorres/python
11. Desafíos/4. slicing.py
4. slicing.py
py
895
python
es
code
0
github-code
90
31599144608
class Department: def __init__(self, name, emps=0): self.name = name self.emps = emps def display(self): print('Deartment: ', self.name) print('Employees: ', self.emps) class Employee(Department): def __init__(self, name, age, department): self.name = name ...
tilvaanjali/python_exe1
main.py
main.py
py
807
python
en
code
0
github-code
90
73090191335
"""1588. Sum of All Odd Length Sub arrays Given an array of positive integers' arr, return the sum of all possible odd-length sub arrays of arr. A subarray is a contiguous subsequence of the array. Example 1: Input: arr = [1,4,2,5,3] Output: 58 Explanation: The odd-length subarrays of arr and their sums are: [1] = 1 [...
devWorldDivey/mypythonprogrammingtutorials
Python Problems/Leetcode Problem 1588. Sum of All Odd Length Subarrays.py
Leetcode Problem 1588. Sum of All Odd Length Subarrays.py
py
1,319
python
en
code
0
github-code
90
71186130218
from assento import Assento class controladorAssentos(): PrecoDevolvido = 0 PessoasNaSala = 0 cont = 0 ValorApurado = 0 PrecoPessoaSala = 0 def __init__(self): self.__linhas = None self.__colunas = None self.__lista = [] self.__saldodevolucoes = None def cri...
artillisprado/Cinema-Python-II-OO
controladorassento.py
controladorassento.py
py
5,534
python
pt
code
1
github-code
90
19456584133
class Node: def __init__(self, data): self.data = data self.next = None self.prev = None class DoublyLinkedList: def __init__(self): self.head = None self.tail = None def append(self, data): new_node = Node(data) if not self.head: self.he...
tonianev/data-structures
src/doubly_linked_list.py
doubly_linked_list.py
py
490
python
en
code
0
github-code
90
29521802946
# Challenge 1 def split_gold(golds): a = [] b = [] for i in range(len(golds)): if i % 2 == 0: if golds[0] >= golds[-1]: a.append(golds[0]) golds.pop(0) else: a.append(golds[-1]) golds.pop(-1) else: ...
coding-plus-equals-one/meeting-materials-2022-2023
5_lists_and_dicts/solutions.py
solutions.py
py
1,559
python
en
code
0
github-code
90
16416910965
#Actual log parser u_ex180414.log full parse import re import os import functools import operator import sys import cx_Oracle #pip install cx_oracle #Read a file and parse it(convert it to csv) logPath = os.path.join("C:\\","home","harish","Desktop","u_ex180414.log") f = open(logPath,'r') #will we get stac...
Chandrakhasin/conserve-energy
energyLogFileParser.py
energyLogFileParser.py
py
2,006
python
en
code
0
github-code
90
34998486844
#! /usr/bin/env python """ eight queens, whose gui uses Tkinter """ import tkinter as Tk import queen as Q import os Q_font = ("Times", 14) def move_queen(now, next): return [(i, z1-z0) for i, (z0, z1) in enumerate(zip(now, next)) if z0 != z1] class Cboard(Tk.Canvas): cell_size = 46 margin = 5 ...
96no3/PythonStudy
Python/201912/191204/tkinter9/8queens.py
8queens.py
py
3,302
python
en
code
0
github-code
90
22685140972
import json import base64 import requests from datetime import datetime class er_agent(): def __init__(self, hostname, log=None): self.my_hostname = hostname self.log = log self.unload_v_drm_schedule() def load_v_drm_schedule(self, v_drm_schedule_json): self.URL = "https://"+v_drm_schedule_json['...
Frentree/python-for-pc
client/lib_er.py
lib_er.py
py
6,001
python
en
code
0
github-code
90
23959792172
# Imports # Standard imports import importlib import random import os # Globals global cardinalDirs cardinalDirs = ("north", "east", "south", "west") # Functions # No idea on credit for clearScreen() def clearScreen(): """Clears the screen""" if os.name == "nt": os.system("cls") else: os.system("clear...
ericl16384/old-python-projects
BotsBuildBots/utilities.py
utilities.py
py
12,200
python
en
code
0
github-code
90
15481789105
from __future__ import annotations from typing import Union as _Union from typing import List as _List from typing import TYPE_CHECKING if TYPE_CHECKING: from ._disease import Disease from ._demographics import Demographics from ._demographic import Demographic from ._parameters import Parameters ...
chryswoods/MetaWards
src/metawards/_run.py
_run.py
py
26,754
python
en
code
null
github-code
90
22325934431
from os import read import pygame from generic_entity import GenericEntity from player import Player from generic_enemy import GenericEnemy, phf from sys import exit from weapon import Weapon from setting import* from ui import* from level import Level from game_data import level_0 from random import randint # Starts ...
sandstone991/soup
demo.py
demo.py
py
4,244
python
en
code
1
github-code
90
11941471888
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Jun 30 13:00:40 2019 @author: hitham """ import os import requests, zipfile, StringIO def downloaddata(parentdir,datbase_link,libname): #if not os.path.exists(parentdir): # os.makedirs(parentdir) r = requests.get(datbase_link, strea...
hjleed/Open-Set-Audio-Recognition-for-Multi-class-Classification-with-Rejection
Install_data_toolbox/toolBOX.py
toolBOX.py
py
1,454
python
en
code
4
github-code
90
28151333871
import OpenGL.GL as gl import PyDelFEM2 as dfm2 import PyDelFEM2.gl.glfw def draw_func(): gl.glEnable(gl.GL_LIGHTING) msh.draw() msh = dfm2.Mesh() msh.read("../test_inputs/bunny_2k.ply") msh.scale_xyz(0.03) win = dfm2.gl.glfw.WindowGLFW(1.0,winsize=(400,300)) win.list_func_draw.append(draw_func) dfm2.gl.setSom...
nobuyuki83/pydelfem2
examples_py/01_openwin_glfw2.py
01_openwin_glfw2.py
py
348
python
en
code
10
github-code
90
74791737577
import numpy as np from tqdm import tqdm import torch import os from sklearn.decomposition import PCA import umap.umap_ as umap import plotly.graph_objects as go import argparse from pathlib import Path def adapt_hidden_embeddings(instance): # if the embeddings of all the generation steps were saved in a...
lovodkin93/unanswerability
figures_generation/PCA_plots_generation.py
PCA_plots_generation.py
py
12,510
python
en
code
3
github-code
90
27308158831
''' Created on Jun 18, 2015 @author: boris ''' from numpy import concatenate, add from gold.statistic.MagicStatFactory import MagicStatFactory from gold.statistic.Statistic import MultipleRawDataStatistic from gold.track.TrackFormat import TrackFormatReq class RawOverlapCodedEventsStat(MagicStatFactory): ''' ...
uio-bmi/track_rand
lib/hb/gold/statistic/RawOverlapCodedEventsStat.py
RawOverlapCodedEventsStat.py
py
2,758
python
en
code
1
github-code
90
17938506929
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) k = int(input()) res = 1 for _ in range(n): if res < k: res *= 2 else: res += k print(res) if __name__ == '__main...
Aasthaengg/IBMdataset
Python_codes/p03564/s361440470.py
s361440470.py
py
339
python
en
code
0
github-code
90
26484924760
import json import os from django.conf import settings from apps.api.tests.base import BaseTestCase class SearchInterestTestCase(BaseTestCase): fixtures = [ "trend.json", "user.json" ] def test_search_interest_unauthorized(self): resp = self.api_client.get("search_interest/") ...
GrigoriLab/daily_trend
apps/api/tests/test_search_interest.py
test_search_interest.py
py
1,167
python
en
code
0
github-code
90
3118654017
# This module provides the whole program with the nessary methods # the main F bool function values counter def bool_function(x1, x2, x3, x4): if (x1 + x2 + x3) * (x2 + x3 + x4): return 1 else: return 0 # the full error between F and Y counter def fault_counter(F, Y): E = 0 for i in ra...
thelacker/ITIB
LAB_1/Tools.py
Tools.py
py
519
python
en
code
1
github-code
90
20862512561
import copy import random import sys sys.path.append(".") from rpg2_classdefinitions import (Player_PC, Pet_NPC, ItemBag_PC, Spell_PC, Monster_NPC, Weapon_PC, Armor_PC, QuestItems_NPC, Access_NPC) import rpg2_party_management_functions as part...
DXing330/rpg_practice
RPG2v3/RPG2v3/RPG2subfiles/rpg2_quest_function.py
rpg2_quest_function.py
py
4,635
python
en
code
0
github-code
90
18296293069
# Original Submission At: https://atcoder.jp/contests/abc149/submissions/16823042 import sys sys.setrecursionlimit(1000000) x= int(input()) def prime_check(num,count): if (num % count) != 0: if num <= count**2: print(num) else: prime_check(num,count+1) else : pr...
Aasthaengg/IBMdataset
Python_codes/p02819/s532168997.py
s532168997.py
py
391
python
en
code
0
github-code
90
71957206057
import unittest def solution(H): S=[] count = 0 for h in H: while(len(S) > 0 and h < S[-1]): S.pop() if len(S) == 0 or h != S[-1]: S.append(h) count += 1 return count S=[] S.append([[[8,8,5,7,9,8,7,4,8]],7]) class TestSolution(unittest.TestCase): ...
eavaria/codility
lesson_7d.py
lesson_7d.py
py
481
python
en
code
0
github-code
90
42569575236
import pandas as pd import sys def add_completeness(codon, a_struct, a_errors, t_struct, t_errors, tRNA): complete = "" bad_aterm = pd.isna(a_struct) or not(pd.isna(a_errors)) bad_term = pd.isna(t_struct) or not(pd.isna(t_errors)) if pd.isna(codon) and bad_aterm and bad_term: complete = "None" ...
mpiersonsmela/tbox
pipeline/add_completeness.py
add_completeness.py
py
889
python
en
code
0
github-code
90
40236438791
import unittest import mock from opencensus.trace.ext.requests import trace class Test_requests_trace(unittest.TestCase): def test_trace_integration(self): mock_wrap = mock.Mock() mock_requests = mock.Mock() wrap_result = 'wrap result' mock_wrap.return_value = wrap_result ...
pombredanne/opencensus-python
trace/tests/unit/ext/requests/test_requests_trace.py
test_requests_trace.py
py
3,522
python
en
code
null
github-code
90
31822842239
import pygame from Mode.Components import Component from Mode.Components.Text import Text class Button(Component): def __init__(self, state, pos, size, label, on_click, icon=None, color=None): super().__init__(state, pos, size) self.enabled = True self.label = label self.on_click ...
Hypnopompia/PrinterController
Mode/Components/Button/Button.py
Button.py
py
2,075
python
en
code
0
github-code
90
14760508567
import pygame import random from settings import * from sprites import * from time import sleep class Game(): def __init__(self): pygame.init() pygame.mixer.init() self.screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption(TITLE) self.c...
AbeerVaishnav13/Flappy-by-Abeer
Flappy.py
Flappy.py
py
7,659
python
en
code
0
github-code
90
37761598283
from django.shortcuts import render from django.http import HttpResponse from django.views.generic import View from django.template.loader import get_template import datetime from .utils import render_to_pdf #created in step 4 class GeneratePdf(View): def get(self, request, *args, **kwargs): template = ...
ian-yitzhak/receipt
myapp/views.py
views.py
py
981
python
en
code
0
github-code
90
25698287902
from django.conf import settings from rest_framework import serializers from revibe._errors import network from accounts.models import CustomUser from content.models import Song from metrics.models import * # ----------------------------------------------------------------------------- class StreamSerializer(seria...
Revibe-Music/core-services
metrics/serializers/v1.py
v1.py
py
4,598
python
en
code
2
github-code
90
26278504916
''' This file defines how to train and test the neural network. The main function takes the following arguments: - modes: A list containing a subset of ['train', 'test'] - epochs: Number of training epochs - dataset_type: A string from ['torchvision', 'folder', 'custom']. See dataset.py for more details. - ...
IVPLatNU/Sample_PyTorch_Code
run_model.py
run_model.py
py
10,028
python
en
code
6
github-code
90
4367169019
import os, sys, urlparse from inc.functions import * from PySide.QtGui import QMainWindow from ui.mainwindow import Ui_MainWindow from inc.modules import themes, presets class MainWindow(QMainWindow): def __init__(self): # Load window super(MainWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupU...
kmklr72/LMMS-Theme-Installer
ui/mainwindow.py
mainwindow.py
py
1,091
python
en
code
1
github-code
90
25244086854
from gpytorch.kernels import MaternKernel, ScaleKernel from gpytorch.priors import GammaPrior from gpytorch.likelihoods import GaussianLikelihood from gpytorch.mlls import ExactMarginalLogLikelihood from gp_models import StrictlyAdditiveKernel, ExactGPModel, RPPolyKernel, ProjectionKernel from fitting.optimizing import...
idelbrid/Randomly-Projected-Additive-GPs
synthetic_test_script.py
synthetic_test_script.py
py
7,910
python
en
code
25
github-code
90