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
13212916594
import asyncio import json from datetime import datetime, timedelta import discord from discord.ext import commands import libs.config as config from libs.embedmaker import officialEmbed from libs.utils import has_role ##################### # Strings variables # ##################### s_vote = config.get_string("vo...
rroethof/thm-discord-bot
cogs/vote.py
vote.py
py
10,111
python
en
code
null
github-code
90
69929985256
# init import numpy as np import matplotlib.pyplot as plt file = open("HW_1_output.txt","w") ###### Prob 1 file.write("Prob 1 Results:"+"\n") ### (a) new matrix with new row file.write("(a):"+"\n") A = np.array([[1,2,3,1],[4,1,3,2],[4,4,3,1],[3,2,3,3]]) z = np.array([[1,1,3,1]]) B = np.vstack((A[0:2,:],z,A[2:5,:]))...
gigamosh57/CU_NuMeth_Fall2014
HW_1.py
HW_1.py
py
1,540
python
en
code
0
github-code
90
18202538499
n = int(input()) a = list(map(int, input().split())) m = 1 if 0 in a: print(0) else: for i in range(n): m = m * a[i] if m > 10 ** 18: print(-1) break elif i == n - 1: print(m)
Aasthaengg/IBMdataset
Python_codes/p02658/s353224254.py
s353224254.py
py
243
python
en
code
0
github-code
90
35289690038
import tkinter as tk from PIL import ImageTk,Image global entry global colour import math from math import ceil, floor g = 9.8 Rdir = "FLAT" #input window root = tk.Tk() canvas1 = tk.Canvas(root, width=800, height=550) canvas1.pack() labeltop = tk.Label(root, text='User Input') labeltop.config(font...
asatapathy3254/object_on_ramp
ObjectOnRampWUserInterface.py
ObjectOnRampWUserInterface.py
py
10,349
python
en
code
0
github-code
90
71232343336
#! -*- coding:utf-8 -*- import heapq l1 = [34, 25, 12, 99, 87, 63, 58, 78, 88, 92] l2 = [ {'name': 'IBM', 'shares': 100, 'price': 91.1}, {'name': 'AAPL', 'shares': 50, 'price': 543.22}, {'name': 'FB', 'shares': 200, 'price': 21.09}, {'name': 'HPQ', 'shares': 35, 'price': 31.75}, {'name': 'YHOO', '...
buptatx/myPython100Days
scripts/16_heapq.py
16_heapq.py
py
571
python
en
code
0
github-code
90
15329333205
from autopilot import prefs # if prefs.AGENT in ("TERMINAL", "DOCS"): HAVE_PYSIDE = False try: from PySide2 import QtCore HAVE_PYSIDE = True except ImportError: pass import json import pandas as pd from scipy.stats import linregress # from subprocess import call from threading import Thread import os impor...
pauljerem/autopilot
autopilot/core/utils.py
utils.py
py
6,843
python
en
code
null
github-code
90
34730775437
#!/usr/bin/env python3 """Defines `mat_mul`.""" def mat_mul(mat1, mat2): """Performs 2D-matrix multiplication.""" if len(mat1) == 0 or len(mat1[0]) != len(mat2): return None # transpose matrix 2 mat2 = list(zip(*mat2)) dot_products = list() for mat1_row in mat1: dot_products.ap...
keysmusician/holbertonschool-machine_learning
math/0x00-linear_algebra/8-ridin_bareback.py
8-ridin_bareback.py
py
574
python
en
code
1
github-code
90
33895874605
from functools import wraps import time def cache(timeout=3600): def deco(func): memo = {} times = {} @wraps(func) def _wrapper(*args): res = memo.get(args, None) if res is not None and (timeout < 0 or (time.time() - times[args] < timeout)): ...
KAILINYmq/python-flask-gotel
agile/commons/simple_cache.py
simple_cache.py
py
524
python
en
code
1
github-code
90
38844783276
# coding:utf-8 import json import pytest from datetime import datetime from apis.device_management.device_account.apis_device_account import Apis @pytest.mark.bvt @pytest.mark.device @pytest.mark.flaky(reruns=3, reruns_delay=3) def test_get_measurement_group(): """ 获取默认采集定义信息 """ try: params =...
zj1995-09-09/supercare_api
testcase/device_management/device_account/test_measure_get_measurement_group.py
test_measure_get_measurement_group.py
py
873
python
en
code
0
github-code
90
23475304188
from django import forms from django.http import HttpResponseRedirect from django.test import RequestFactory, TestCase from data_research.handlers import ConferenceRegistrationHandler class MockConferenceRegistrationForm(forms.Form): def __init__(self, *args, **kwargs): kwargs.pop('capacity') kwa...
KonstantinNovizky/Financial-System
python/consumerfinance.gov/cfgov/data_research/tests/test_handlers.py
test_handlers.py
py
3,817
python
en
code
1
github-code
90
20442746291
import re def loadDataFromFile(fname): res = [] with open(fname, 'r') as fp: for line in fp: lineStep = re.sub('bags contain|bag\,|bags\,', ':', line.strip()) lineClean = re.sub('bag\.|bags\.', '', lineStep) lineSplit = lineClean.strip().split(':') containerColor = lineSplit[0].strip() ...
tmarketin/AdventOfCode
2020/Day7/sol_day7.py
sol_day7.py
py
1,782
python
en
code
0
github-code
90
18122201649
class Dice(object): """Dice Class """ def __init__(self, numbers): """ Args: numbers: """ self.numbers_inverse = {numbers[0]: 1, numbers[1]: 2, numbers[2]: 3, numbers[3]: 4, numbers[4]: 5, numbers[5]: 6} self.numbers = {1...
Aasthaengg/IBMdataset
Python_codes/p02384/s814678894.py
s814678894.py
py
3,383
python
en
code
0
github-code
90
34855857663
#Write a program that accepts a sequence of whitespace separated words as input and #prints the words after removing all duplicate words and sorting them alphanumerically. #Suppose the following input is supplied to the program: #hello world and practice makes perfect and hello world again #Then, the output should be: ...
mukulverma2408/PracticeGeeksforGeeks
PythonPracticeQuestion-Part2/Git-Ques10.py
Git-Ques10.py
py
545
python
en
code
0
github-code
90
39271215519
# ---------------------------------------------------------------------------- # # Imports # # ---------------------------------------------------------------------------- # # Server Stuff from flask import Flask, render_template, request, send_file ...
PaddeCraft/TouchPanel
touchpanel/__main__.py
__main__.py
py
12,584
python
en
code
0
github-code
90
24384812017
#!/usr/bin/env python from __future__ import print_function import sys import os.path import argparse import re from subprocess import call """ Script for preparing and running deTIN """ epi = ('\ \n\ Make the preparation for CANVAS, test tumour and normal sample\n\ \n\ \n\ ') # Describe what the s...
MagdalenaZZ/Python_ditties
run_CANVAS.py
run_CANVAS.py
py
4,533
python
en
code
0
github-code
90
5793347765
#!/usr/bin/env python3 from urllib.parse import quote from urllib.request import Request, urlopen, HTTPError import json, csv from settings import * import ast import argparse parser = argparse.ArgumentParser(description='debut / fin / nombres de datasets') parser.add_argument('-s', '--start', type=int, default=0, hel...
Open-Initiative/epidemium-import
import_datasets.py
import_datasets.py
py
4,915
python
en
code
0
github-code
90
29939992881
import urllib2 import requests import json import socket import ssl ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE def downloadFile(url, magicNumber = None, maxSize = 10 * 1024 * 1024): try: f = urllib2.urlopen(url, timeout=10, context=ctx) if magicNumber is None: ...
JaanusKaapPublic/Rehepapp
Scripts/Libs/Web.py
Web.py
py
1,249
python
en
code
54
github-code
90
28365412298
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverse(self, node): if node==None or node.next==None: return node last_node=self.reverse(node.next) node.next.next=node node.next=None r...
neverset123/coding_leetcode
python/leetcode/linked_list/revert_linked_list.py
revert_linked_list.py
py
1,659
python
en
code
0
github-code
90
20927858043
from jinja2 import Environment, FileSystemLoader import markdown2 from collections import namedtuple from glob import glob from pathlib import Path Info = namedtuple( "Info", ["name", "profession", "email", "linkedin", "github", "orcid"] ) Site = namedtuple("Site", ["title", "url", "content"]) def replace_umlau...
hannahmccall/hannahmccall.github.io
generate.py
generate.py
py
1,925
python
en
code
0
github-code
90
10385078305
from pprint import pprint from urllib.parse import urlencode import requests import time import json import os import vk_params VERSION = '5.67' API_GET_GROUP = 'https://api.vk.com/method/groups.get' API_GET_FRIENDS = 'https://api.vk.com/method/friends.get' AUTHORIZE_URL = 'https://oauth.vk.com/authorize' ERROR_REQUES...
VinGeorge/etcetera
vk_parsing.py
vk_parsing.py
py
3,968
python
en
code
0
github-code
90
27566256342
import numpy as np class DisjointSet: def __init__(self, elements): self.elements = elements self.cant = dict() self.parents = dict() for element in elements: self.parents[element] = element self.cant[element] = 1 def getParent(self, element): ...
juandamdc/MFA_WTMM
utils/disjointSet.py
disjointSet.py
py
907
python
en
code
1
github-code
90
28748239571
fin=open("mixmilk.in","r") fout=open("mixmilk.out","w") arr=[] for i in range(3): s=fin.readline().strip().split() for i in range(len(s)): s[i]=int(s[i]) arr.append(s) curr=0 for i in range(100): if curr==2: next=0 else: next=curr+1 if arr[curr][1]<=arr[next...
SriramV739/CP
USACO/Contest/Bronze/2018December/mixmilk.py
mixmilk.py
py
574
python
en
code
0
github-code
90
20404098904
import time from clients.AbstractClient import AbstractClient import config import sqlite3 class SqliteClient(AbstractClient): initialization_query = None def __init__(self): self.db = sqlite3.connect('sqlitedb', timeout=100) self.cursor = self.db.cursor() self.cursor.execute('PRAGMA ...
robertclaus/python-database-concurrency-control
clients/SqliteClient.py
SqliteClient.py
py
1,192
python
en
code
0
github-code
90
29197722426
# -*- coding: utf-8 -*- """ USE: python bif_exel2brical.py infile outfile """ import sys import math import json import openpyxl def createModules(ws): modules = {} for p in range(2): for i in range(ws.max_row - 1): val = ws.cell(row=i + 2, column=1).value if val is not Non...
wbap/BriCAL
bif_excel2brical/bif_excel2brical.py
bif_excel2brical.py
py
6,115
python
en
code
5
github-code
90
14992421542
import itertools import pandas as pd from statsmodels.tsa.stattools import acf # x = real component, right +ve # y = imag component, up +ve WIDTH = 7 _ROCKS = [ [complex(0, 0), complex(1, 0), complex(2, 0), complex(3, 0)], [complex(1, 0), complex(0, 1), complex(1, 1), complex(2, 1), complex(1, 2)], [comp...
jimhendy/AoC
2022/17/b.py
b.py
py
3,105
python
en
code
0
github-code
90
29542827837
# -*- coding: utf-8 -*- # @Time : 2021/9/12 10:35 # @Author : 模拟卷 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 152. 乘积最大子数组.py # @Software: PyCharm # =================================== """给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。   示例 ...
monijuan/leetcode_python
code/AC2_normal/152. 乘积最大子数组.py
152. 乘积最大子数组.py
py
1,980
python
zh
code
0
github-code
90
16077029621
import os import joblib import pandas as pd import statsmodels.api as sm class Modeler: def __init__(self): self.df = pd.read_csv('C:/Users/abdul/Desktop/FYP/FinalDataset.csv') try: self.model = joblib.load('models/satisfaction.model') except: self.model = None def fit(self): ...
Adeeb-Khoja/Pre-Launch-Forecaster---Data-Science-Project
Models Development/NLP - Sentiment Analysis - Satisfaction Model/deployment/modeler/Modeler.py
Modeler.py
py
952
python
en
code
0
github-code
90
882682977
import heapq file = open("Median.txt", "r") r_data = file.readlines() data = [int(x) for x in r_data] print(data) medians = [] k = 0 l_heap = [] u_heap = [] while k < len(data): new = data[k] l_max = 0 u_min = 0 if len(l_heap) > 0: l_max = l_heap[0][1] if len(u_heap) > 0: u_mi...
plancker/Algorithms
Course 2/median_maintenance.py
median_maintenance.py
py
1,124
python
en
code
0
github-code
90
41608107292
chaa,choo=map(int,input().split()) saaa=[] for p in range(chaa+1,choo+1): if p>1: for f in range(2,p): if(p%f==0): break else: saa.append(f) print(len(saa)+1)
chokkuu1998/david
5.py
5.py
py
189
python
en
code
0
github-code
90
18559041509
def check(): N,K = map(int, input().split()) total = 0 if K == 0: return N**2 for b in range(1,N+1): if b <= K: continue amari = N-b*(N//b) test = amari-K+1 if amari >= K else 0 total += (b - K) * (N//b) + test return ...
Aasthaengg/IBMdataset
Python_codes/p03418/s179499244.py
s179499244.py
py
340
python
en
code
0
github-code
90
11175739171
from django.shortcuts import render from django.http import HttpResponse from django.http.response import HttpResponseRedirect from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import authenticate,login,logout #for apis from .serial...
yogendrasapkar/kingzo
firstApp/views.py
views.py
py
7,157
python
en
code
0
github-code
90
7572287877
from langchain.prompts.prompt import PromptTemplate _template = """给定以下对话和后续问题,请将后续问题重新表述为一个独立的问题,使用中文回答. 对话历史: {chat_history} 接下来的输入: {question} 独立问题:""" CONDENSE_QUESTION_PROMPT_ZH = PromptTemplate.from_template(_template) prompt_template = """使用下面的上下文来回答最后的问题。如果你不知道答案,只需要说你不知道,不要试图编造一个答案. {context} 问题: {questio...
toby911/learngit
chains/condense_quest_prompt.py
condense_quest_prompt.py
py
645
python
zh
code
0
github-code
90
4128436901
import os import sys import logging from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from collections import defaultdict from datetime import datetime, timedelta import pandas as pd from pyhdf.HDF import HDF, HDF4Error from pyhdf import VS def key_from_fname(fname): """ Return the ACE data...
butala/pyrsss
pyrsss/l1/hdf4to5.py
hdf4to5.py
py
3,445
python
en
code
6
github-code
90
73844656936
import numpy as np import computeCostMulti as costMultiModule def gradientDescentMulti(X, y, theta, alpha, num_iters): """Performs gradient descent to learn theta theta = GRADIENTDESCENT(X, y, theta, alpha, num_iters) updates theta by taking num_iters gradient steps with learning rate alpha """ m...
hzitoun/machine_learning_from_scratch_matlab_python
algorithms_in_python/week_2/ex1/gradientDescentMulti.py
gradientDescentMulti.py
py
861
python
en
code
30
github-code
90
28773248495
def matches(a,b): c=len(a) d=len(b) e=0 for i in range(max(c,d)): if(i<c): if(i<d): if(a[i]==b[i]): e+=1 return e a=input("Enter 1st string :") b=input("Enter 2nd string :") print("Matches :",matches(a,b))
07python/python-programs
similar letters.py
similar letters.py
py
295
python
en
code
0
github-code
90
28488218869
import django import os import random import decimal import uuid from datetime import datetime, timedelta from django_seed import Seed os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings") django.setup() from api.transactions.models import Product, Transaction cities = ( 'Makati City', 'Pasig City...
rrviloria/pizza-transaction
seed.py
seed.py
py
1,055
python
en
code
0
github-code
90
18130451720
class Solution: def dp_solution(self,nums): n=len(nums) dp=[0]*n #dp[i] means minimum number of jump to reach ith index for i in range(1,n): ans=1e4+1 for j in range(i): if j+nums[j]>=i: ans=min(ans,dp[j]+1) dp[i...
narendrasingodia1998/LeetCode
0045-jump-game-ii/0045-jump-game-ii.py
0045-jump-game-ii.py
py
657
python
en
code
0
github-code
90
18469978299
# https://atcoder.jp/contests/caddi2018/tasks/caddi2018_b n = int(input()) odd = even = 0 for _ in range(n): apple = int(input()) if apple % 2 == 0: even += 1 else: odd += 1 if odd: print('first') else: print('second')
Aasthaengg/IBMdataset
Python_codes/p03197/s811334150.py
s811334150.py
py
256
python
en
code
0
github-code
90
42263671057
import os import numpy as np from datetime import datetime, timedelta from netCDF4 import Dataset from osgeo import gdal, osr from gdalconst import * from utils.s3_updnload import downloadBatch_s3 from utils.utils import mkfolder import time as t import glob # =====Below adopted from remap.py # Define KM_PER_DEGREE KM...
nasa/GHRC-FieldCampaign-eXplorer-core
mk_gdaltif.py
mk_gdaltif.py
py
6,893
python
en
code
1
github-code
90
33557712089
# just copying over most of "carml checkpypi" because it's a good # example of "I want a stream over *this* circuit". from __future__ import print_function from twisted.internet.defer import inlineCallbacks from twisted.internet.task import react from twisted.internet.endpoints import TCP4ClientEndpoint import txtor...
meejah/txtorcon
examples/web_client_treq.py
web_client_treq.py
py
1,085
python
en
code
245
github-code
90
8471033018
from itertools import product from restaurant_db import restaurants_given_state NUM_ALTERNATIVES = 5 PRICE_ALTERNATIVES = [{"cheap", "moderate"}, {"moderate", "expensive"}] LOCATION_ALTERNATIVES = [{"centre", "north", "west"}, {"centre", "north", "east"}, ...
jokke150/Restaurant-Recommendation-System
alternative_rules.py
alternative_rules.py
py
4,968
python
en
code
1
github-code
90
24083365304
import pandas as pd import text_analytic_tools.common.text_corpus as text_corpus DATA_FOLDER = '../../data' CORPUS_NAME_PATTERN = '*.txt.zip' CORPUS_TEXT_FILES_PATTERN = '*.txt' DOCUMENT_FILTERS = [ { 'type': 'multiselect', 'description': 'Pope', 'field': 'pope' }, ...
humlab/text_analytic_tools
text_analytic_tools/domain/Vatican/domain_logic.py
domain_logic.py
py
3,090
python
en
code
1
github-code
90
70279937897
from flask_wtf import FlaskForm from wtforms import IntegerField,SelectField,SubmitField from wtforms.validators import DataRequired,NumberRange states=[('kerala','Kerala'),('bihar','Bihar'),('tamil_nadu','Tamil nadu'),('assam_and_meghalaya','Assam & Meghalaya'), ('nagaland_manipur_mizoram_tripura','Nagalan...
aryapande/rainfallML
forms.py
forms.py
py
1,460
python
en
code
0
github-code
90
18558979639
n, k = map(int, input().split()) ans = 0 for i in range(k + 1, n + 1): ans += (n // i) * (i - k) if k == 0: m = n % i else: m = n % i - k + 1 ans = max(ans, ans + m) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03418/s102268010.py
s102268010.py
py
210
python
fr
code
0
github-code
90
43869991178
import xml.etree.ElementTree as ET import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import r2_score tree = ET.parse('HY202103_D08_(0,2)_LION1_DCM_LMZC.xml') root = tree.getroot() def snf(a): splt = a.text.split(',') flst = list(map(float,splt)) return flst wvlen = [] itst = [] for...
ChiYoSeop/Gitprac
PE02_TW03/PE02_TW03_REF_Raw & fit.py
PE02_TW03_REF_Raw & fit.py
py
933
python
en
code
0
github-code
90
39377083240
def create_environment(): global length,breadth,x_axis,y_axis print("Enter data for environment: ") length = int(input("Enter length: ")) breadth = int(input("Enter breadth: ")) print("Co-ordinate of rectangular area (4 - corners) is:") print("[0,0] {} {} {} in clockwise direction".format ...
suraj7337/Robot-Assembling
Environment.py
Environment.py
py
874
python
en
code
0
github-code
90
22770196073
class Solution: def ladderLength2(self, beginWords, endWord, wordList): """ :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int """ if not wordList or endWord not in wordList: return 0 next_beginWords = [] ...
amisyy/leetcode
ladderLength.py
ladderLength.py
py
1,596
python
en
code
0
github-code
90
7145796448
from rest_framework import serializers from rest_framework_simplejwt.serializers import TokenObtainPairSerializer as BaseTokenObtainSerializer from rest_framework_simplejwt.settings import api_settings from rest_framework_simplejwt.tokens import RefreshToken from Apps.Authentication.models.login import DeviceLogin c...
khan-asfi-reza/RaydBlog
backend/Apps/Authentication/serializers/jwt.py
jwt.py
py
1,688
python
en
code
0
github-code
90
12926100654
import requests import numpy as np import matplotlib.pyplot as plt import datetime import os def get_github_snk_data(username): url = f"https://api.github.com/users/{username}/events" response = requests.get(url) if response.status_code == 200: events = response.json() contributions = [0] ...
WangYingJay/WangYingJay
service/request_create_snake_api.py
request_create_snake_api.py
py
1,989
python
en
code
0
github-code
90
27011018664
from camera_algorithms.camera1_model import PeopleDetector #Loading model net = PeopleDetector() net.load_network() # Get the video writer initialized to save the output video def queue (img) : # get frame from the video frame=img #Get te predictions from the model outs = net.predict(frame) #Use m...
omaralam96/COVID-19-Prevention-CVC-Competition
camera_algorithms/camera1.py
camera1.py
py
517
python
en
code
2
github-code
90
18592905919
n=int(input()) f=[] P=[] for i in range(n): a=list(map(int,input().split())) f.append(a) for i in range(n): a=list(map(int, input().split())) P.append(a) from itertools import product ans=-(10**10) for p in product([0, 1], repeat = 10): if sum(p)!=0: ret = 0 for i in range(n): ...
Aasthaengg/IBMdataset
Python_codes/p03503/s091731182.py
s091731182.py
py
512
python
en
code
0
github-code
90
19976050115
from collections import deque from math import floor, ceil class Pair: def __init__(self, a, b): self.a = a self.b = b def copy(self): result = Pair(self.a, self.b) if type(self.a) is Pair: result.a = self.a.copy() if type(self.b) is Pair: result....
bitwitch/advent-of-code
aoc2021/18-snailfish/snailfish.py
snailfish.py
py
6,139
python
en
code
1
github-code
90
30071786820
import random from datetime import timedelta, datetime from copy import deepcopy import pytest from faker import Faker from django.utils import timezone from auditor.bolean_auditor.process_protocol import TodayExternalIP, PortRank, \ ProtocolIPRank, IPSource, Processor, IPQueueProcess, PreProcess, Attack...
liushiwen555/unified_management_platform_backend
auditor/tests/test_protocol_synchronize.py
test_protocol_synchronize.py
py
18,117
python
en
code
0
github-code
90
21639260894
from django.shortcuts import render, HttpResponseRedirect, reverse # Create your views here. from App_post.models import PartnerRequestModel, JobPostModel, PartnerApplicationModel def home(request): return render(request, 'App_post/home.html') def partner_request(request): if request.method == '...
evana27perveen/WePoka
App_post/views.py
views.py
py
3,366
python
en
code
0
github-code
90
42291859717
import numpy as np import crocoddyl class CostModelDoublePendulum(crocoddyl.CostModelAbstract): def __init__(self, state, activation, nu): activation = ( activation if activation is not None else crocoddyl.ActivationModelQuad(state.ndx) ) crocoddyl.Cost...
loco-3d/crocoddyl
bindings/python/crocoddyl/utils/pendulum.py
pendulum.py
py
2,778
python
en
code
584
github-code
90
72483618858
import wave import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set() import random wf = wave.open('../input/flute.wav') ch = wf.getnchannels() fn = wf.getnframes() amp = (2**8) ** wf.getsampwidth() / 2 data = wf.readframes(fn) data = np.frombuffer(data, 'int16') data = data /...
ymt117/Mute_speaker
src/flute_freq_spectrum2.py
flute_freq_spectrum2.py
py
934
python
en
code
0
github-code
90
1859653235
# Converts a hexadecimal number (input) to binary number hex_num = input('Enter a hexadecimal number to convert to binary: ') # Unnecesary conversion, just for assuring '.' is included in the string print(hex_num, 'in decimal is', end=' ') is_neg = None resul = '' if hex_num[0] == '-': is_neg = True hex_num ...
rubengr16/OSSU
ComputerScience/2_MIT6.00.1x_Introduction_to_Computer_Science/3_Simple_Algorithms/hexadecimal_to_binary_float.py
hexadecimal_to_binary_float.py
py
1,182
python
en
code
0
github-code
90
4039836372
import threading import numpy as np import dotsandboxes.gui.global_var from Arena import Arena #from dotsandboxes.gui.main import GUI import time from dotsandboxes.gui import global_var class RandomPlayer: def __init__(self, game): self.game = game def play(self, board): a =...
cuijiayu20/alphazero_dotsandboxes
alpha-zero-general 1.2_now/dotsandboxes/DotsAndBoxesPlayers.py
DotsAndBoxesPlayers.py
py
3,118
python
en
code
0
github-code
90
29108212606
import socket import time import os import datetime from threading import Thread #from scapy.all import ARP, Ether, srp #-----------------------------------------------------------------------------# # Locating Nodes Part # #-------------------------------------------------------...
CristofearSantillan/Peer-to-Peer-Network
main.py
main.py
py
12,489
python
en
code
0
github-code
90
70943698857
import scrapy from fed_scraper.items import FedScraperItem, serialize_url from fed_scraper.parse_pdf import parse_pdf_from_url import re MEETING_DATES_FILE_PATH = "../meeting_dates.csv" class BeigeBookArchiveSpider(scrapy.Spider): name = "beige_book_archive" allowed_domains = ["www.federalreserve.gov"] s...
rw19842/Fed-Scraper
fed_scraper/fed_scraper/spiders/beige_book_archive.py
beige_book_archive.py
py
2,849
python
en
code
1
github-code
90
12350292707
from typing import List class Solution: def orangesRotting(self, grid: List[List[int]]) -> int: minute = 0 length = len(grid) width = len(grid[0]) # count = 0 return minute a = Solution() b = [[2,1,1],[1,1,0],[0,1,1]] b = [[2,1,1],[0,1,1],[1,0,1]] b = [[0,2]] p...
Panamera-Turbo/MyPython
leetcode/994-orange.py
994-orange.py
py
345
python
en
code
0
github-code
90
9594035472
import os from patient import Patient import datetime import matplotlib.pyplot as plt import discord from dotenv import load_dotenv import asyncio from discord.ext import commands, tasks load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') GUILD = os.getenv('DISCORD_GUILD') bot = commands.Bot(command_pre...
benjshao/MediBot
bot.py
bot.py
py
4,011
python
en
code
0
github-code
90
2401327859
from camera import Camera import open3d as o3d import cv2 import os if __name__ == "__main__": cam = Camera([]) pcd = o3d.geometry.PointCloud() vis = o3d.visualization.Visualizer() vis.create_window("Point Clouds", width=848, height=480) added = True rgb_img, depth_img = cam.stream(colored_de...
juyong0000/pose_estimation
utilities/HowToCapturePcd/capture_pcd/save_pcd.py
save_pcd.py
py
1,143
python
en
code
0
github-code
90
33990635386
TC=int(input()) for i in range(TC): N = int(input()) ind = [list(map(int, input().split())) for _ in range(N)] res = 0 for j in range(N - 1): for k in range(j + 1, N): l1, r1 = ind[j] l2, r2 = ind[k] if ((l1 > l2 and r1 < r2) or (l1 < l2 and r1 > r2)): ...
eunjakim98/Algorithm_Python
SWEA/D3/10580. 전봇대/전봇대.py
전봇대.py
py
364
python
en
code
0
github-code
90
27705974855
import os import dgl import torch import random import numpy as np import pandas as pd import scipy.sparse as sp from scipy.spatial import distance_matrix from sklearn.metrics import roc_auc_score, f1_score, accuracy_score import torch.nn.functional as F from torch.nn.modules.loss import _Loss import torch.optim as opt...
ZzoomD/FairGKD
utils.py
utils.py
py
13,623
python
en
code
0
github-code
90
34980334805
#!/usr/bin/env python import sys from functools import reduce from collections import Counter from collections import defaultdict def reducer(): """Input: stdin or hastag and number of times it occurs. Output: hastag followed by number of times hastag occurs ranked by frequency.""" top_hashtags = de...
dannypaz/class
dsci-6007/4.3 - MapReduce Intro/lab-4.3-top-ten-hashtags-Jonathan-Jaime.py
lab-4.3-top-ten-hashtags-Jonathan-Jaime.py
py
912
python
en
code
3
github-code
90
5737702494
class User: bank_name = "International Bank" def __init__(self, name): self.name = name self.account_balance = 0 #deposit method def make_deposit(self, deposited_amount): self.account_balance += deposited_amount #withdrwal method def make_withdrawal(self, withdrew_amount)...
AmanielyMkamba/python_algo
user_assignment.py
user_assignment.py
py
1,337
python
en
code
0
github-code
90
69966761898
import tensorflow as tf import numpy as np from pathlib import Path import collections from tensorflow.contrib import rnn import pickle import os import datetime import unicodedata from tensorflow.python.client import device_lib import matplotlib.pyplot as plt import re # from sklearn.utils import shuffle as shuffle im...
imosafi/LSTM
Code/main.py
main.py
py
5,116
python
en
code
0
github-code
90
42853975565
import sys, string, math m = input() if m == m[::-1] : print('yes') sys.exit() n = 0 for i in m[::-1] : if i == '0' : n += 1 else : break s1 = '0'*n + m if s1 == s1[::-1] : print('yes') else : print('no')
Shamabanu/python
quasi palindromic.py
quasi palindromic.py
py
248
python
en
code
2
github-code
90
4964954192
def create_table(connection, tbl_name, col_name, col_type, row_list) : import math import dismod_at import copy primary_key = tbl_name + '_id' name_column = tbl_name + '_name' # cmd = 'create table ' + tbl_name + '(' n_col = len( col_name ) cmd += '\n\t' + tbl_name + '_id integ...
bradbell/dismod_at
python/dismod_at/create_table.py
create_table.py
py
1,304
python
en
code
6
github-code
90
72677807657
import unittest import numpy as np import torch from pero_ocr.decoding.decoders import BLANK_SYMBOL from pero_ocr.decoding.decoders import find_new_prefixes from pero_ocr.decoding.decoders import GreedyDecoder from pero_ocr.decoding.decoders import CTCPrefixLogRawNumpyDecoder from pero_ocr.decoding.decoders import g...
DCGM/pero-ocr
test/test_decoding/test_decoders.py
test_decoders.py
py
17,774
python
en
code
38
github-code
90
25251422569
class Solution: # @param tokens, a list of string # @return an integer def ceil(self, x): if x == int(x): return int(x) else: return int(x)+1 def isOperSym(self, token): if token == "+" or token == "-" or token == "*" or token == "/": return True ...
sevenseablue/leetcode
src/leet/Evaluate Reverse Polish Notation.py
Evaluate Reverse Polish Notation.py
py
1,587
python
en
code
0
github-code
90
35390242387
import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPool2D from keras.preprocessing.image import ImageDataGenerator from keract import get_activations, display_activations datagen = ImageDataGenerator() train_data = ...
ildar-dev/python-ad
convolutional-n-n/model.py
model.py
py
1,264
python
en
code
0
github-code
90
1230187940
""" 该模块:`visul`包含数据可视化的类和函数。 """ # Author: Sandiagal <sandiagal2525@gmail.com>, # License: GPL-3.0 import math from pickle import load import os import cv2 from keras import backend as K from keras.models import Model import matplotlib.pyplot as plt import numpy as np import PIL.Image as Image from idiplab_cv.datas...
IDIPLAB/IDIPLAB_CV
idiplab_cv/visul.py
visul.py
py
18,245
python
en
code
4
github-code
90
42642533497
from __future__ import division from ignite.metrics.metric import Metric import numpy as np import heapq import torch def recognition_rate_at_k(probe_x, probe_y, gallery_x, gallery_y, k, measure): """Compute the recognition rate at a given level `k`""" # (75,75) label_eq_mat = np.equal(probe_y.reshape(-1...
houweidong/models
training/cmc_metric.py
cmc_metric.py
py
3,259
python
en
code
0
github-code
90
8868225052
from Commons import gtk from Commons import os from Commons import _ from AF import AudioFile class TagsEditor(gtk.Dialog): def __init__(self, cfname, treeModel, path, columns, colToKey): gtk.Dialog.__init__(self) i = cfname.rfind('/') self.set_title(_('Edit Tags')) fil...
andrebask/cometsound
src/TagsEditorDialog.py
TagsEditorDialog.py
py
2,598
python
en
code
0
github-code
90
18523439359
import sys N, M = map(int, input().split()) pm = [(i,j,k) for i in range(-1,2,2) for j in range(-1,2,2) for k in range(-1,2,2)] lst = [] for _ in range(N): x,y,z = map(int, input().split()) lst.append((x,y,z)) rlt = -sys.maxsize for a,b,c in pm: tmp = [] for x,y,z in lst: tmp.append(a*x+b*y+c*z) tmp.s...
Aasthaengg/IBMdataset
Python_codes/p03326/s020824031.py
s020824031.py
py
382
python
en
code
0
github-code
90
30616608738
"""Extension of optical_gater_server for emulating gating with saved brightfield data""" # Python imports import sys, os, time, argparse, glob, warnings, platform import numpy as np import json import urllib.request # Module imports from loguru import logger from tqdm.auto import tqdm # See comment in pypr...
Glasgow-ICG/open-optical-gating
open_optical_gating/cli/file_optical_gater.py
file_optical_gater.py
py
16,916
python
en
code
3
github-code
90
43146249364
import pytest import uuid from typing import List from domains.entities.notes_entity import ( NoteEntity, KeywordEntity ) from tests.fixtures.notes import ( note_entity_fixture, note_summary_entity_fixture ) from apps.notes.exceptions import ( NoteNameLengthLimitError ) from domains.constants impor...
knock-version-1-0/backend-main
src/tests/notes/entity_tests.py
entity_tests.py
py
2,769
python
en
code
0
github-code
90
40898867343
import json from typing import Dict, List, Any from paramiko import SSHClient from paramiko.client import AutoAddPolicy hostname = "10.20.40.224" port = 22 username = "vedant" password = "Mind@123" try: client: SSHClient = SSHClient() client.set_missing_host_key_policy(AutoAddPolicy()) client.con...
Pruthviraj1223/pythonPlugins
ssh/cpu.py
cpu.py
py
1,437
python
en
code
0
github-code
90
23782550601
# -*- coding: utf-8 -*- from __future__ import print_function from keras.models import Model from keras.layers import Flatten, Dense, Input from keras.layers import Convolution2D, MaxPooling2D from keras import backend as K import utils K.set_image_dim_ordering('th') import warnings warnings.filterwarnings("ignore...
noagarcia/keras_rmac
vgg16.py
vgg16.py
py
2,688
python
en
code
84
github-code
90
17927440269
n,c=map(int,input().split()) p=[list(map(int,input().split())) for _ in range(n)] p.sort() res = [0 for _ in range(100005)] res0 = [[0,0] for _ in range(c)] np = [] for s,t,c in p: if res0[c-1][0] == 0: res0[c-1] = [s,t] elif res0[c-1][1] ==s: res0[c-1][1] =t else: np.append(res0[c-1...
Aasthaengg/IBMdataset
Python_codes/p03504/s583156389.py
s583156389.py
py
548
python
en
code
0
github-code
90
32086045363
"""CLI interaction implementation.""" import cmd import shlex import Dungeon.logic.DungeonUtils as utils class Dungeon(cmd.Cmd): """Class that implements game.""" prompt = '(Dungeon) ' dungeon_map = [[[] for i in range(10)] for i in range(10)] player_pos = (0, 0) def do_add(self, args): ...
sanyavertolet/pythonprac
20220328/1/Dungeon/cli/DungeonCli.py
DungeonCli.py
py
2,073
python
en
code
1
github-code
90
35014018837
import json from os import mkdir from os.path import expanduser, isfile, isdir from todo_list.task import Task class TaskNotFound(Exception): def __init__(self,mes:str="")->None: super().__init__() self.mes=mes def __str__(self)->None: return f"TaskNotFound: {self.mes}" class List...
Jonas-Luetolf/Todo-List
todo_list/listhandler.py
listhandler.py
py
2,272
python
en
code
1
github-code
90
18140681949
while 1: list = [input().split()] m = int(list[0][0]) f = int(list[0][1]) r = int(list[0][2]) if m == -1 and f == -1 and r == -1 : break elif m == -1 or f == -1 : print("F") elif m + f >= 80 : print("A") elif 65 <= m + f and m + f < 80 : print("B") eli...
Aasthaengg/IBMdataset
Python_codes/p02411/s766298256.py
s766298256.py
py
547
python
en
code
0
github-code
90
13005146302
from typing import List, Union import torch import torch.nn.functional as F from torch import nn from ..modeling_utils import ModuleUtilsMixin from .composition import AdapterCompositionBlock, BatchSplit, Parallel, Stack, adjust_tensors_for_parallel from .configuration import PrefixTuningConfig from .context import A...
adapter-hub/adapter-transformers
src/transformers/adapters/prefix_tuning.py
prefix_tuning.py
py
30,155
python
en
code
1,700
github-code
90
27613156404
import os import readline from ghost.core.badges import Badges from ghost.core.server import Server from ghost.core.helper import Helper from ghost.core.ghost import Ghost class Console: def __init__(self): self.badges = Badges() self.server = Server() self.helper = Helper() self....
Farhan-Malik/Ghost-adb
ghost/core/console.py
console.py
py
3,698
python
en
code
0
github-code
90
12973337052
################################ # Timecomplexity: O(N) # Spacecomplexity: O(1) ################################ def findComplement(num): temp_array = num # Bit for performing xor with each bit one_bit = 1 # Loop for performing one's compliment while temp_array : # Performing XOR op...
harishdasari1595/Personal_projects
Algorithms and Datastructure/Arrays/one_s_complement.py
one_s_complement.py
py
601
python
en
code
0
github-code
90
18594915272
import fileinput import json import pprint import re import string import gmplot import gensim from tweet_parser.tweet import Tweet from tweet_parser.tweet_parser_errors import NotATweetError from textblob import TextBlob from collections import Counter def open_tweets(filename): tweets = [] for line in fil...
sruti/talktransit
main.py
main.py
py
4,340
python
en
code
0
github-code
90
13892873274
import random # Q3 a class Rectangle: def __init__(self, width, height, color): if not isinstance(width, (int, float)): raise TypeError("Width must be number") if not isinstance(height, (int, float)): raise TypeError("Height must be number") self.width = width ...
seanrattigan/SW_Arch_OOP
exam_code/oop_2021_exam_code.py
oop_2021_exam_code.py
py
2,287
python
en
code
0
github-code
90
32408780806
import os import random import cv2 badcase_path = r'E:\L2_eval\new_data\badcase\badcase.txt' data_path = r'G:\test_data\new_data\crop_images' save_path = r'E:\L2_eval\new_data\images' record_txt_path = r'E:\L2_eval\new_data\images\1.txt' badcase_list = list() with open(badcase_path, 'r') as f: line = f.readline()...
Daming-TF/HandData
scripts/Cleaning_Metric_Evaluation_Tool/test.py
test.py
py
946
python
en
code
1
github-code
90
45814153703
# -*- coding: utf-8 -*- import cv2 import numpy as np from pyzbar.pyzbar import decode video = cv2.VideoCapture(0, cv2.CAP_DSHOW) video.set(3, 640) video.set(4, 480) with open("pessoas_autorizadas.txt") as arquivo: minha_lista = arquivo.read().splitlines() # separar por linhas while True: check, frame = vi...
veniciocosta/barcode_scaner
scan_autenticate.py
scan_autenticate.py
py
1,157
python
pt
code
0
github-code
90
35170106156
import numpy as np import cv2 as cv import tensorflow as tf import os import matplotlib.pyplot as plt #convert image to tensor XDIM = 2048 YDIM = 11*XDIM//8 LINE = 3*XDIM//8 #assumes the images in the folder look like Band1.jpg, Band2.jpg etc def folder_to_array(folder): images = [] for i in range(1,1...
colefranks/MarshBoundaries
PredictFromSaved.py
PredictFromSaved.py
py
3,703
python
en
code
0
github-code
90
73034649898
import unittest # Utils libs import os import numpy as np import pandas as pd from words_n_fun.preprocessing import synonym_malefemale_replacement # Disable logging import logging logging.disable(logging.CRITICAL) class SynonymTests(unittest.TestCase): '''Main class to test all functions in synonym_malefemale_r...
OSS-Pole-Emploi/words_n_fun
tests/test_5_synonym_malefemale_replacement.py
test_5_synonym_malefemale_replacement.py
py
2,559
python
en
code
20
github-code
90
43017290689
import importlib import plone.testing.zope from plone.testing.layer import Layer from plone.testing.zca import ZCMLSandbox from plone.testing.zope import WSGI_SERVER from Testing.makerequest import makerequest from zope.publisher.browser import TestRequest ZCMLLayer = ZCMLSandbox( None, 'Products.Formulator:ZCML...
infrae/Products.Formulator
src/Products/Formulator/testing.py
testing.py
py
1,759
python
en
code
1
github-code
90
5044763802
from collections import Counter def main(): N = int(input()) A = list(map(int, input().split())) c = Counter(A) c = sorted(c.items(), reverse=True) for i in range(N): if len(c) > i: print(c[i][1]) else: print(0) if __name__ == "__main__": main()
valusun/Compe_Programming
AtCoder/ABC/ABC273/C.py
C.py
py
314
python
en
code
0
github-code
90
26807918441
# -*- coding:utf-8 -*- import sqlite3 def executeSelectOne(sql): conn = sqlite3.connect('my_db.sqlite3') curs = conn.cursor() curs.execute(sql) data = curs.fetchone() conn.close() return data def executeSelectAll(sql): conn = sqlite3.connect('my_db.sqlite3') curs = conn.cursor() ...
UstymHanyk/python_hmwr
week 6/executeSqlite3.py
executeSqlite3.py
py
669
python
en
code
0
github-code
90
16948290871
from typing import List class Solution: def sortedSquares(self, nums: List[int]) -> List[int]: n = len(nums) res = [0] * n left = 0 right = n - 1 for i in range(n-1, -1, -1): if abs(nums[left]) > abs(nums[right]): num = nums[left] ...
iamsuman/algorithms
iv/Leetcode/easy/977_squares_of_sorted_array.py
977_squares_of_sorted_array.py
py
841
python
en
code
2
github-code
90
1213076764
# @Time : 2019/9/2 13:54 # @Author : Libuda # @FileName: user_login.py # @Software: PyCharm from TestMain.utils import Utils from TestMain.test_data_config import TestDataConfig class Login: """ 专门为登录测试服务 因为其并不是提交数据 而是将数据封装到请求头中 """ def __init__(self, file_name=None): self.utils = Utils...
budaLi/Unittest
MyAutoTest/templete/user_login.py
user_login.py
py
1,100
python
en
code
4
github-code
90
25749801554
import os import json import argparse import numpy as np import pandas as pd from sklearn.metrics import r2_score from fbprophet import Prophet from fbprophet.serialize import model_to_json from azureml.core import Workspace, Dataset from azureml.core.run import Run train_dataset_name = 'sales_train1' test_dataset_...
elbertsoftware/ML-Engineering
script/train.py
train.py
py
4,366
python
en
code
1
github-code
90