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
381786064
import gym import random import numpy as np from keras.layers import Dense, Flatten from keras.models import Sequential from rl.agents import SARSAAgent from rl.policy import EpsGreedyQPolicy env = gym.make('CartPole-v1') states = env.observation_space.shape[0] print('States', states) actions = env.action_space.n prin...
MaZeeT/MultiAgentRL
CartPole/sarsa/sarsa.py
sarsa.py
py
1,909
python
en
code
0
github-code
90
18484934699
#028_A from fractions import gcd N,M=map(int,input().split()) S=input() T=input() flg=True g=gcd(N,M) n,m=N//g,M//g for k in range(0,g): if S[k*n]!=T[k*m]: flg=False print(N*M//g if flg else -1)
Aasthaengg/IBMdataset
Python_codes/p03231/s294453782.py
s294453782.py
py
210
python
en
code
0
github-code
90
33595576449
import logging from trpycore.thread.util import join from trsvcscore.service.handler.service import ServiceHandler from trschedulesvc.gen import TScheduleService import settings from scheduler import ChatScheduler class ScheduleServiceHandler(TScheduleService.Iface, ServiceHandler): def __init__(self, service): ...
techresidents/schedulesvc
schedulesvc/handler.py
handler.py
py
1,359
python
en
code
1
github-code
90
34476209827
''' Created on 13/feb/2013 @author: sambarza@gmail.com ''' from ywnThing import Thing from pandac.PandaModules import BitMask32 class Box(Thing): ''' classdocs ''' def __init__(self, ywn): ''' Constructor ''' Thing.__init__(self, "Box", ywn) self....
sambarza/bo
world/things/box/Box.py
Box.py
py
633
python
en
code
0
github-code
90
70194252776
#!/usr/bin/env python # -*- coding: utf-8 -*- """Georeferenciació de la demanda. FORMULARIO 8: Información relativa a generación conectada a sus redes de distribución codigo empresa cil x y provincia municipio conexión potencia instalada energía activa energía reactiva """ import sys import os import multiprocessing ...
gisce/georef
bin/georef_re.py
georef_re.py
py
7,839
python
en
code
1
github-code
90
27501577894
import os import time import argparse import torch from torch.nn.utils import clip_grad_norm_ from apex import amp from tqdm import tqdm from .model import Transformer from .optim import Adam, RAdam, SGD from .optim.lr_scheduler import InverseSquareRootScheduler from .data import Dictionary, Seq2SeqDataset,...
liu-hz18/NaiveSeq
naiveseq/tasks/autoregressive.py
autoregressive.py
py
14,125
python
en
code
1
github-code
90
16375923509
import scrapy import pandas as pd from scrapy_selenium import SeleniumRequest import json import codecs import requests import re import cssselect from lxml.html import etree import time import random # from selenium.webdriver.common.by import By # from selenium.webdriver.support import expected_conditions as EC clas...
HacoK/BookLibCrawler
BookLibCrawler/spiders/all_spider.py
all_spider.py
py
7,574
python
en
code
1
github-code
90
30378688994
import cv2 import numpy as np def init_video_capture(): cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FPS, int(60)) fps = cap.get(cv2.CAP_PROP_FPS) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 360) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240) cap.set(cv2.CAP_PROP_BUFFERSIZE,0) print("fps:",fps) ...
DecXlll/STARK_Tracking
mmtracking/demo/test.py
test.py
py
1,381
python
en
code
0
github-code
90
11027786553
def Show(arr,n): max=arr[0] for i in range(1,n): if arr[i]>max: max=arr[i] return max arr=[10,35,85,45,69,96] n=len(arr) f1=Show(arr,n) print("List Of Array Is :",f1)
nazim164/python_code
MaxArray.py
MaxArray.py
py
204
python
en
code
0
github-code
90
12454274730
""" Assumption : 1/01/0001 was Monday Every month has 31 days Every year has 365 days """ x = int(input("Enter day")) y = int(input("Enter month")) z = int(input("Enter year")) r1 = x + (31 * (y-1)) r2 = (365 * (z-1)) - 1 result = (r1 + r2)%7 if result == 0: print("Monday") if result == 1: print("Tuesday") i...
SuyogAhuja/CodeCell_challenges
2nd_challenge.py
2nd_challenge.py
py
519
python
en
code
0
github-code
90
18331827969
from bisect import bisect_left n = int(input()) l = sorted(list(map(int, input().split()))) #aを1番短い辺、bを2番めに短い辺とする cnt = 0 for i in range(n-2): for j in range(i+1, n-1): c_i = bisect_left(l, l[i] + l[j]) cnt += c_i - (j+1) print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02888/s584975795.py
s584975795.py
py
287
python
en
code
0
github-code
90
18037845939
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): H, W = map(int, input().split()) C = [] for i in range(H): c = input() C.append(c) C.append(c) for c in C: print(c) if __name__ == '__main__': resolve()
Aasthaengg/IBMdataset
Python_codes/p03853/s389451136.py
s389451136.py
py
307
python
en
code
0
github-code
90
18032721489
from heapq import heappush,heappop,heapify INF=10**30 def dijkstra(G,s,n): que=[(0,s)] dist=[INF]*n last=[-1]*n dist[s]=0 while que: mincost,u=heappop(que) if(mincost>dist[u]): continue for c,v in G[u]: if(dist[u]+c<dist[v]): dist[v]=d...
Aasthaengg/IBMdataset
Python_codes/p03837/s103959509.py
s103959509.py
py
921
python
en
code
0
github-code
90
37115877304
import nidaqmx from nidaqmx.constants import AcquisitionType sample_per_second = 10 with nidaqmx.Task() as task: task.ai_channels.add_ai_voltage_chan("PCI6289/ai0", min_val=-0.1, max_val=0.1) task.timing.cfg_samp_clk_timing(rate=sample_per_second, sample_mode=AcquisitionType.CONTINUOUS) for n in r...
Kaige213/QuantumTransportExperiment
仪器使用/PCI6289采集卡/program/pci6289_ai_test.py
pci6289_ai_test.py
py
497
python
en
code
4
github-code
90
73516568298
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 3 21:37:50 2021 @author: aliuzun """ import sys sys.path.append("../Work") import csv, random import os from tkinter import Label import pandas as pd import numpy as np import matplotlib.pyplot as plt from src.OpenFile import OpenFile from src.My...
uzunali/III-V-Python-Scripts-V2.1
src/Data_Analysis.py
Data_Analysis.py
py
8,983
python
en
code
0
github-code
90
21939010290
import argparse from dstk.management.TweetManager import TweetManager """ Usage: python manage_tweets.py EVENT RUMOR ACTION --options ... Example: python manage_tweets.py sydneysiege hadley generate_training -ss 80 This will generate a training sheet for the Hadley rumor containing 80 tweets. AVALI...
emCOMP/data_science_toolkit
package/manage_tweets.py
manage_tweets.py
py
7,151
python
en
code
0
github-code
90
2797430356
# BlackJack.py from Deck import Card, Deck class Hand: """ represents a player's hand in blackjack """ def __init__(self, card1, card2): """ initializes Hand object with two cards """ self.cards = [card1, card2] # self.points = {'A': 1, 2: 2, 3: 3, 4: 4, 5: 5, 6:...
PdxCodeGuild/class_salmon
1 Python/solutions/blackjack/Blackjack.py
Blackjack.py
py
6,699
python
en
code
5
github-code
90
4547969382
# coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import sklearn as skl from sklearn.cross_validation import train_test_split from sklearn.metrics import confusion_matrix, accuracy_score, classification_report from sklearn import linear_model from sklearn.feature_select...
vikneke/cs5014_p2
binaryML/binary.py
binary.py
py
6,474
python
en
code
1
github-code
90
17997385490
import sys import pandas as pd import numpy as np import lightfm from scipy import sparse import tensorflow as tf data = pd.read_csv(sys.argv[1]) data = data.loc[:, data.columns != 'Unnamed: 0'] data.shape dt = np.array(data) dt.shape df_test = pd.read_csv('df_test.csv') print('date loaded') # LightFM model norm ...
LiviReka/CamperRecommender
model_code/lightfm_model.py
lightfm_model.py
py
1,490
python
en
code
0
github-code
90
72990653738
from flask import Flask, render_template from flask_restful import Resource, Api, reqparse, fields, marshal_with from baby_names import baby_names_utilities from imdb_scraper import imdb_scraper import json # Creat app and API app = Flask(__name__) api = Api(app) # Arg parser parser = reqparse.RequestParser(bundle_er...
brandonmburroughs/baby-names-and-movie-stars
app.py
app.py
py
2,088
python
en
code
1
github-code
90
33527403783
# -*- coding: utf-8 -*- """ Created on Tue Oct 24 15:45:00 2017 @author: dell """ import numpy as np from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import AdaBoostRegressor from sklearn import datasets from sklearn.metrics import mean_squared_error, explained_ variance_score from sk...
bsrjy/Python-Machine-Learning
example.py
example.py
py
3,737
python
en
code
0
github-code
90
7065965398
# Chennai Curler v1 # Author: Gurjot Sidhu # For: CPR Climate Team, New Delhi # Description: This script pings the GCC server and saves the result in a CSV file. Data from 01.01.2010 to 31.12.2020 is downloaded by altering the date and gender fields in the request payload. import time import requests from bs4 import B...
gsidhu/cpr-web-scraping
chennai-curler.py
chennai-curler.py
py
3,851
python
en
code
0
github-code
90
18153819909
n,k=map(int,input().split()) s=[] s2=[] mod=998244353 for i in range(k): l,r=map(int,input().split()) s+=[i for i in range(l,r+1)] s2.append([l,r]) s.sort() dp=[0]*(n+1) dpsum=[0]*(n+1) dp[1]=1 dpsum[1]=1 for i in range(2,n+1): for j in range(k): if i-s2[j][0]>=0: dp[i]+=(dpsum[i-s2...
Aasthaengg/IBMdataset
Python_codes/p02549/s016996778.py
s016996778.py
py
432
python
en
code
0
github-code
90
4126613006
import socket import sys c_socket = socket.socket() host = '192.168.56.101' port = 8889 print('waiting to connect..') try: c_socket.connect((host,port)) except socket.error as e: print(str(e)) response = c_socket.recv(1024) print(response.decode('utf-8')) print("Choose a mathematical function\n1:log10,2:SquareRoot,...
llippie/itt440-lab6-client
6.3.py
6.3.py
py
816
python
en
code
0
github-code
90
19641352252
from tools import parsers, loader from collections import deque from math import lcm from typing import NamedTuple import numpy as np class Point(NamedTuple): row: int col: int def __add__(self, other): return Point(row=self.row + other.row, col=self.col + other.col) DIRECTIONS = {'>': Point(0,...
Nyaaa/advent-of-code
2022/day 24/day24.py
day24.py
py
3,172
python
en
code
0
github-code
90
22801147302
from ..TransformerABC import Transformer as tabc import pandas as pd class NetworkDataMetricsAggregator(tabc): def __init__(self, aggregated_asset_name:str, metrics:[str]=None): self.aggregated_asset_name = aggregated_asset_name self.metrics = metrics def get_unique_metrics(self, columns:[str]...
0x2b543c/0xv8l422
modules/Transformers/Aggregators/NetworkDataMetricsAggregator.py
NetworkDataMetricsAggregator.py
py
1,062
python
en
code
0
github-code
90
18373463789
N, K = map(int,input().split()) AB = [list(map(int,input().split())) for _ in range (N-1)] import sys sys.setrecursionlimit(10**9) edge = [[] for _ in range(N)] for u,v in AB: edge[u-1].append(v-1) edge[v-1].append(u-1) MOD = 10**9+7 mod = 10 ** 9 + 7 MAX = K+10 fac = [0] * MAX finv = [0] * MAX inv = [0] * MA...
Aasthaengg/IBMdataset
Python_codes/p02985/s142327132.py
s142327132.py
py
1,201
python
en
code
0
github-code
90
14225819885
import scipy.misc as misc from matplotlib import image as mpimg from matplotlib import pyplot as plt import numpy as np import cv2 num_white = 2 def _arrange_data(inData, visize): img_ht, img_wd = visize num_data = inData.shape[2] # data has shape [ht, wd, ch] cell_wd = min(8, int(np.sqrt(num_data))) ...
jia2lin3yuan1/FilePreprocess
visualLayer.py
visualLayer.py
py
1,957
python
en
code
1
github-code
90
70470772778
import json import boto3 from datetime import datetime # Initialize DynamoDB client dynamodb = boto3.resource('dynamodb') TABLE_NAME = 'known_users' # Replace with your DynamoDB table name SESSION_TABLE_NAME = 'rise_admins' # Replace with the session DynamoDB table name def is_authorized(session_id): try: ...
sqavi/RiseApp
admin/admin.py
admin.py
py
4,728
python
en
code
0
github-code
90
30718425234
#!/usr/bin/env python # coding=utf8 import csv import datetime import os import re import sys out = csv.writer(sys.stdout) for line in file(os.path.expanduser('~/.birthdays')): m = re.match( '(?P<name>[^=]*)=(?P<day>\d+)/(?P<month>\d+)/(?P<year>\d+)\s*bd\s*', line ) if not m: pri...
mbr/birthday.py
convert.py
convert.py
py
640
python
en
code
1
github-code
90
21708178780
import numpy as np import cv2 def meanshift(particle,oldimg,newimg): r,h,c,w = particle.y-5,10,particle.x-5,10 # simply hardcoded the values track_window = (c,r,w,h) # set up the ROI for tracking roi = oldimg[r:r+h, c:c+w] hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hs...
MemSadePeSade/particle-meanshift
meanshift.py
meanshift.py
py
957
python
en
code
0
github-code
90
19533746785
from flask import jsonify, make_response, request from flask_restful import Api from flask import Blueprint from models import db, Garbage, Equipment from utils import token_required equipment_routes_blueprint = Blueprint('equipment_routes', __name__, ) api = Api(equipment_routes_blueprint) # Create Equipment @equipm...
PatriciaPaulo/ProjetoInformatico
API/routes/equipment_routes.py
equipment_routes.py
py
1,469
python
en
code
0
github-code
90
73133607655
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, cross_validate # 划分数据集函数 from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt data_df = pd.read_csv('./cwurData.csv') # 读入 csv 文件为 pandas 的 DataFrame data_df = data_df.dropna() # 舍去包含 NaN 的 row ...
LHS1998/Machine-Learning-Project
ML02/source/nation.py
nation.py
py
1,986
python
en
code
1
github-code
90
38304959530
# return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and right are gone # so "ab*cd" yields "ad" and "ab**cd" also yields "ad" def start_out(str): s = '' for x in range(len(str)): if x == 0 and str[x] != '*': s = s + ...
jemtca/CodingBat
Python/String-2/start_out.py
start_out.py
py
596
python
en
code
0
github-code
90
35730933496
import logging import time from config import Config, ConfigItem, ConfigurationError from ticker_fetcher import AlphavantageTickerExtractor, PostgresqlTickerLoader, AlphavantageTickerTransformer from ticker_fetcher.ticker_etl_runner import TickerETLRunner logging.basicConfig(level=logging.DEBUG) logger = logging.getL...
jshepp27/etl-alphaVantage
worker.py
worker.py
py
1,308
python
en
code
0
github-code
90
14492740589
""" Define a class for simulating a type of semi-Markov model. """ import numpy as np import scipy.optimize as sciopt from numba import njit from typing import Sequence, Union, Optional class SemiMarkov(object): """ A semi-Markov model. One way to describe a pure Markov model is to say that the system sta...
ttesileanu/bio-time-series
bioslds/markov.py
markov.py
py
13,174
python
en
code
1
github-code
90
18018566709
from sys import exit N,M = map(int,input().split()) if 2*N>=M: print(M//2) exit() ans = 0 ans += N M -= 2*N ans += M//4 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03797/s553876094.py
s553876094.py
py
135
python
en
code
0
github-code
90
3756722017
import sys, os dir_path = os.path.dirname(os.path.realpath(__file__)).split("/") root_path = "" for i in dir_path: root_path += i + "/" if i == "stock_trading": break sys.path.insert(0, root_path) import yfinance as yf from datetime import datetime as dt import pandas as pd import numpy as np import mu...
dangalea/stock_trading
scripts/walk_forward_analysis/Trend Following B/new_wfa.py
new_wfa.py
py
13,326
python
en
code
0
github-code
90
15766342612
from queue import Queue class Node: def __init__(self, value): self.value = value self.left = None self.right = None class BinarySearchTree: def __init__(self, root_value): self.root = Node(root_value) def insert(self, node, value): if value <= node.value: ...
bhavani-Zemoso/python
module3/binarySearchTrees/isBSTSatisfied.py
isBSTSatisfied.py
py
1,696
python
en
code
0
github-code
90
11039845752
class Solution(object): def minDeletionSize(self, A): """ :type A: List[str] :rtype: int """ res = 0 for col in zip(*A): if all(col[i]<=col[i+1] for i in range(len(col)-1)): continue else: res +=1 return ...
liangliannie/LeetCode
944. Delete Columns to Make sorted.py
944. Delete Columns to Make sorted.py
py
323
python
en
code
0
github-code
90
9788635447
#!/usr/bin/python from math import * from scipy import * # from matplotlib import pyplot # from scipy import linalg import main # ----( commands )------------------------------------------------------------- @main.command def project_unif(X=3, Y=2): "projects dJ matrix via inclusion-exclusion, WRT J metric" ...
fritzo/kazoo
test/map_optimizer.py
map_optimizer.py
py
3,779
python
en
code
5
github-code
90
33969747379
from flask import Flask, redirect, url_for, render_template, request from time import sleep app = Flask(__name__) @app.route('/',methods=['POST','GET']) def home(): if request.method == 'POST': di=request.form["dicta"] return redirect(url_for("rikrol",dict=di)) return render_template('index...
tuanlt1328/RR
server.py
server.py
py
494
python
en
code
0
github-code
90
29256246067
import numpy as np import pickle import matplotlib.pyplot as plt def plot_features(): with open('../../results/RNN_features', 'rb') as f: feature_selection = pickle.load(f) # n = feature_selection["count"] n = 30 feature_mean_errors = [] for featureNo in range(n): mean_error = np....
dzitkowskik/StockPredictionRNN
src/nyse-rnn/plotting.py
plotting.py
py
1,799
python
en
code
643
github-code
90
14343924411
from fabric.api import run from fabric.contrib.files import exists from utils import cat _key = None def setup(): global _key if not exists("~/.ssh/id_rsa"): run("ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ''") _key = None def key(): global _key if _key == None: _key = cat("~/.ssh/id_rsa.pub") return _...
conradz/system
ssh.py
ssh.py
py
325
python
en
code
0
github-code
90
23048850418
from collections import defaultdict from copy import deepcopy with open("day7_input.txt") as file: reqs = defaultdict(list) for line in file.readlines(): reqs[line.split()[7]].append(line.split()[1]) def ans1(reqs): order = "" while len(order) != ord(max(reqs.keys())) - ord("A")+1: fo...
jmjac/advent_of_code_2018
day7.py
day7.py
py
1,880
python
en
code
0
github-code
90
1991912551
import configs import loading_win import validations from search_options import Options from dialog_win import DialogWin # desc: displays trade info in gui class ViewTrade: # fintracker will be needed to update the table after edit def __init__(self, dpg, fintracker, trade_id, is_option, row_tag): sel...
gnikkoch96/Fintracker-GUI
view_trade.py
view_trade.py
py
23,203
python
en
code
2
github-code
90
35420808704
import pandas as pd import numpy as np arr = np.array( [ [12,23,34,45,56,67,78], [22,34,65,55,89,54,33], [45,56,67,78,78,78,99] ] ) # print(arr) df = pd.DataFrame(arr) # print(df) arr1 = np.array( [ ['hibernate','education','global','english',1450,200], ['sweet ben...
gauravkamble74/PythonClass
DATA-SCIENCE/PANDAS/01PandasCreate.py
01PandasCreate.py
py
1,269
python
en
code
0
github-code
90
19413737742
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 27 09:29:25 2020 @author: pavankunchala """ import cv2 import dlib import matplotlib.pyplot as plt def show_img_with_matplotlib(color_img,title,pos): img_RGB = color_img[:,:,::-1] ax = plt.subplot(1,2,pos) plt.imshow(img...
Pavankunchala/Deep-Learning
Face-Detection-All Models/Face_detection_dlib/Face_detection_dlib_hog.py
Face_detection_dlib_hog.py
py
1,398
python
en
code
31
github-code
90
69982927018
class Image: def __init__(self, file_path): file = open(file_path, 'rb') self.image_data = file.read() file.close() self.file_size = self.get_bytes_to_int(2, 4) self.pixel_data_offset = self.get_bytes_to_int(10, 4) self.header_size = self.get_bytes_to_int(14, 4) ...
anguslmm/Pyground
images/image.py
image.py
py
2,511
python
en
code
0
github-code
90
6288111551
values = [] filename = 'values-1' with open(filename, 'r') as f: for line in f: line = line.split(',') print(len(line)) print(line) loss, acc, i = [], [], 0 for value in line: if i % 2 == 0: loss.append(value) else: if len(value) > 4: acc_val = value[:4] l...
hamsterz0/GAN-Stabilization
fix.py
fix.py
py
600
python
en
code
1
github-code
90
40458651618
class Hall: def __init__(self, name, phone, addr, date, cost, owner): self.name = name self.phone = phone self.addr = addr self.date = date self.cost = cost self.owner = owner def __eq__(self, obj): # fill your code return self.name == obj.name an...
praveen-kumars/Python-OOP
CLASSANDOBJECT/IP1/Hall.py
Hall.py
py
598
python
en
code
0
github-code
90
7855622972
""" Supervisory Control under Local Mean Payoff Constraints Weighted Finite-state Automaton """ import random from string import ascii_lowercase import itertools from itertools import combinations from transitions_gui import WebMachine import time # from transitions.extensions import GraphMachine as Machine # naive ...
zhiqich/Supervisory-Control-under-Local-Mean-Payoff-Constraints-Implementation
automaton.py
automaton.py
py
19,158
python
en
code
0
github-code
90
1973916366
import sys from collections import Counter n=int(sys.stdin.readline()) arr=[] #입력값으로 배열 채우기 for _ in range(n): arr.append(int(sys.stdin.readline())) #산술평균 print(round(sum(arr)/n))#소숫점 출력 #중앙값 arr.sort() print(arr[(n-1)//2]) #최빈값 cnt=Counter(arr).most_common(2) if len(arr)>1: if cnt[0][1]==cnt[1][1]: ...
seminss/algorithm-study
solvedac/수학/2108 통계학.py3
2108 통계학.py3
py3
481
python
zh
code
0
github-code
90
38512799770
import tempfile from http import HTTPStatus from django.test import TestCase, Client from blog.models import Article class BlogURLTest(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.article = Article.objects.create( title='Привет', content='', ...
PyChenka/wStore
windstore/blog/tests/test_urls.py
test_urls.py
py
1,377
python
en
code
0
github-code
90
18336516639
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") a,b = list(map(int, input().split())) def factor(n, m=None): # mを与えると、高々その素因数まで見て、残りは分解せずにそのまま出力する arr = {} temp = n M = int(-(-n**0.5//1))+1 if m is not Non...
Aasthaengg/IBMdataset
Python_codes/p02900/s345329926.py
s345329926.py
py
833
python
en
code
0
github-code
90
34868721250
def digitCount(val): ret = 1 while(val>0): remainder = val%10 ret = ret*10 val = val//10 # print('remainder=',remainder,'ret=',ret,'val',val) return ret l=[1,21,3,4,5] num = 0 for i in l: num = num*digitCount(i) + i print(num) # print(digitCount(21))
manojdon777/Python_Programs
digitsConcat.py
digitsConcat.py
py
299
python
en
code
0
github-code
90
18067110449
s = input() n = len(s) ans = '' for i in range(n): s1 = s[i] if s1 == '0': ans += '0' elif s1 == '1': ans += '1' else: ans = ans[:-1] print(ans)
Aasthaengg/IBMdataset
Python_codes/p04030/s686042021.py
s686042021.py
py
188
python
en
code
0
github-code
90
36084558286
def primeno(a): x=0 for i in range(0,a): c=0 for j in range(1,a): if i%j==0: c=c+1 if c==2: x=x+1 return x n=int(input("enter the number")) print(primeno(n))
ruchikamehra/cyber
Assignment3/cyber3python9.py
cyber3python9.py
py
240
python
en
code
0
github-code
90
8413386397
import requests, funcoes, comandos # Armazenando token do bot (@progredes_dummy_bot) e endereço da # API do Telegram API_TOKEN = "6844908109:AAEvwS1L9ToLwN_gsLPAdlKtIxO6ffVkzEc" TELEGRAM_API = f"https://api.telegram.org/bot{API_TOKEN}" # Função para salvar a última atualização def salvar_update_id(update_id: in...
sidneypepo/ifrn
2023.2/programacao_para_redes/11_bot_telegram/requisicoes.py
requisicoes.py
py
6,011
python
pt
code
2
github-code
90
14179361049
import os import shutil import cv2 import numpy as np def load_img_float(path): """ return [0, 1] """ img = cv2.imread(path, -1) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) return img/255 def save_img_float(path, img): """ input [0, 1] """ img = (img*255).astype(np.uint8) ...
ZFhuang/MLAA-python
utils.py
utils.py
py
1,445
python
en
code
4
github-code
90
73640684456
from args import build_parser import logging import os import wandb import sys import time from chat_classifier import LLamaChatClassifier, ChatGPTChatClassifier from config import LOGGING_FORMAT, LOGGING_DATE_FORMAT, RESULTS_DIR, LOG_DIR, WANDB_DIR, WANDB_API_KEY_PATH, \ WANDB_USER_NAME_PATH from utils ...
pauli31/czech-sentiment-prompting
main.py
main.py
py
2,772
python
en
code
0
github-code
90
661774642
from oslo_log import log as logging from jacket.db import extend as db from jacket import exception from jacket.objects import base from jacket.objects import extend as objects from jacket.objects import fields LOG = logging.getLogger(__name__) @base.JacketObjectRegistry.register class ImageSync(base.JacketPersiste...
HybridF5/jacket
jacket/objects/extend/image_sync.py
image_sync.py
py
2,542
python
en
code
0
github-code
90
70640474856
import streamlit as st from Get_Details.Create_URL import CreateURL from Get_Details.Fetch_Details import GetData, StoreData from Web_App import Create_App class DisplayDetails: """ Class to initialize value and represent it """ def __init__(self, temperature, humidity, forecast): self.tempera...
siddheshshankar/Weather_API
Web_App/run_app.py
run_app.py
py
1,063
python
en
code
0
github-code
90
41458376518
import sys from collections import UserDict, namedtuple from pathlib import Path from string import ascii_lowercase import numpy as np import pytest from icecream import ic # a number longer than any path we'll be making NOT_REACHED = 1_000_000 # --> Puzzle solution def parse(input_text): all_lines = [] f...
j-carson/advent_2022
days/12/wip.py
wip.py
py
4,534
python
en
code
0
github-code
90
39166448249
class Painting: def __init__(self,paintingID,painterName,paintingPrice,paintingType): self.paintingID = paintingID self.painterName = painterName self.paintingPrice = paintingPrice self.paintingType = paintingType class ShowRoom: def __init__(self,paintings): se...
07shikhar/Python-Codes
Painting.py
Painting.py
py
1,634
python
en
code
0
github-code
90
37462131498
import argparse from planner.planner import Planner if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("map_name", type=str, help="Name of the map") parser.add_argument('source', type=str, help='Name of source node') parser.add_argument('destination', type=str, help='Nam...
anenriquez/mrta_planner
get_path.py
get_path.py
py
673
python
en
code
1
github-code
90
7633442264
# uses an arx model structure to learn a dynamic systems output probability density function # this example is for a very simple no input single output feedback system # what is interesting is that it can learn different pdfs: gaussian, cauchy, bimodal gaussian import torch import matplotlib.pyplot as plt import torch...
jnh277/ebm_arx
scalar_example.py
scalar_example.py
py
7,757
python
en
code
3
github-code
90
34697083187
from scipy.io import loadmat from scipy.spatial import distance import os, math import numpy as np def get_splits(splits_path='/home/wpc/master-thesis-master/srnn-copy/data/JHMDB/splits', ind_split = 1, JHMDB=True): train = np.array([],dtype=str) test = np.array([],dtype=str) ind_split = str(ind_split) +...
Keysmis/Action-Recognition-based-on-Structural-RNN-tensorflow
read_data_submit.py
read_data_submit.py
py
20,387
python
en
code
5
github-code
90
37972483681
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/3/6 12:01 # @Author : v_bkaiwang # @File : assert_pkg.py # @Software: win10 Tensorflow1.13.1 python3.6.3 from typing import Iterable # from .log_message import LogMessage, LOG_ERROR, LOG_INFO from Lib.CommonLib.BaseLib.log_message import LogMessage, LO...
Wangkaiof21/M1
Lib/CommonLib/BaseLib/assert_pkg.py
assert_pkg.py
py
4,152
python
en
code
0
github-code
90
29042372235
import pandas as pd import os import tensorflow as tf import numpy as np paths = { 'Data' : os.path.join(os.getcwd(),'Data'), 'Notebooks' : os.path.join(os.getcwd(),'notebooks'), 'models' : os.path.join(os.getcwd(),'models') } df = pd.read_csv(os.path.join(paths['Data'],'amazon_co_ecommerce_sample.csv')) ...
alihkousha/Task1
mainn.py
mainn.py
py
1,042
python
en
code
2
github-code
90
4949462640
import argparse from pathlib import Path import numpy as np import torch from torchvision.utils import make_grid, save_image from tqdm import tqdm import util def main(): """ Load trained generator model and save generated sampels. <n_row> x <n_row> grid image is saved into <output_dir> """ par...
raahii/infogan-pytorch
src/infer.py
infer.py
py
1,603
python
en
code
14
github-code
90
44848250026
# Advent of Code 2020 Day 8 import AOC CMD = 0 VAL = 1 def get_code() -> []: lines = AOC.get_input_lines(8, AOC.format_strip) code = [] for line in lines: line.replace("+","") split = line.split(" ") code.append(split) return code def run_code(code : [] , log_errors = False...
drantscript/AdventOfCode2020
Day8.py
Day8.py
py
1,548
python
en
code
0
github-code
90
41601161783
import os ''' Faça uma lista de compras com listas O usuário deve ter a possiblidade de inserir, apagar e listar valores da sua lista Não permita que o programa quebre com erros de índices inexistentes na lista ''' lista = [] produto = '' indice = '' while True: print("\n") try: print(5*'=', 'Minha L...
Dhaxx/PYTHON
EXERCICIOS/lista_de_compras.py
lista_de_compras.py
py
2,032
python
pt
code
1
github-code
90
72143536938
# -*- coding: utf-8 -*- """Define the top-level function for the ``sync-npm`` cli. """ from __future__ import absolute_import, division, print_function, unicode_literals import time from aspen import log from gratipay import wireup from gratipay.sync_npm import consume_change_stream, get_last_seq, production_change_...
gratipay/gratipay.com
gratipay/cli/sync_npm.py
sync_npm.py
py
1,160
python
en
code
1,121
github-code
90
39284628014
modern_family = ['CLaiRe_DunPhY', 'PHiL_dUnpHY', 'GLoRiA_PriTCheTt', 'CaMErOn_TuCKEr', 'StELLa'] indices = list() characters = list() for i, name in enumerate(modern_family): indices.append(i) characters.append(name.lower().replace('_', '-')) print(indices) print(characters) [0, 1, 2...
gajjoshi/task1
task1.py
task1.py
py
1,181
python
en
code
0
github-code
90
16492526863
try: from fuzzywuzzy import fuzz except: import os inp = input('The fuzzywuzzy package is not installed. Do you want to install? Press y.') if inp =='y': os.system( 'pip install fuzzywuzzy') from fuzzywuzzy import fuzz try: import networkx as nx except: import os inp = in...
snorre87/wordtools
string_matching.py
string_matching.py
py
3,278
python
en
code
0
github-code
90
350573927
from get_url_from_firstpage import Get_Url_From_FirstPage import requests from bs4 import BeautifulSoup import urllib import threading import json import pandasdmx import time import os import sys from selenium.common.exceptions import NoSuchElementException def get_datacode(): urlsclass = Get_Url_From_FirstPage() ...
bluesky49/OECD_scraping
src/csv_download.py
csv_download.py
py
7,549
python
en
code
1
github-code
90
37538740007
import os.path from teplo500.core import * from teplo500.salus import salus_connect EMUL_DEVICES_ONLINE_FILE = "/local/fakes/devices_online.html" EMUL_DEVICES_OFFLINE_FILE = "/local/fakes/devices_offline.html" ## args: ## return: ## true=success or false=failed def emul_load_devices(): file_path = get_app().home...
MaxBazarov/teplo500py
lib/Teplo500/salus/salus_emul.py
salus_emul.py
py
777
python
en
code
0
github-code
90
18638183918
import pygame import pyray WIDTH = 512 HEIGHT = 384 FPS = 60 display = pygame.display.set_mode((WIDTH, HEIGHT), pyray.flags) clock = pygame.time.Clock() colors = [(255, 0, 0), (0, 255, 0)] map = [[1,1,1,1,1,1,1], [1,0,0,0,0,0,1], [1,0,0,0,0,0,1], [1,0,0,2,0,0,1], [1,0,0,0,0,0,1...
lewisc64/pyray
examples/basic.py
basic.py
py
899
python
en
code
0
github-code
90
12652231753
import pickle import numpy as np import streamlit as st from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer MODEL_PKL_FILE = "model.pkl" IRIS_PKL_FILE = "iris.pkl" def main(): """This function runs/ orchestrates the Machine Learning App Registry""" st.markdown( """ # Machine ...
7125messi/streamlit-web-ml
010-streamlit-ml-predict.py
010-streamlit-ml-predict.py
py
3,324
python
en
code
1
github-code
90
15807359727
# -*- coding: utf-8 -*- # # CTCを学習します. # # Pytorchを用いた処理に必要なモジュールをインポート import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch import optim # 作成したDatasetクラスをインポート from my_dataset import SequenceDataset # 数値演算用モジュール(numpy)をインポート import numpy as np # プロッ...
ry-takashima/python_asr
05ctc/02_train_ctc.py
02_train_ctc.py
py
24,814
python
ja
code
75
github-code
90
11697120354
from userdata import User, DatabaseEntry from wordgame import InputWord def register(): fname = input("Enter your first name: ") sname = input("Enter your surname: ") uname = input("Enter a username of your choice: ") # To-CODE # If username already present, do not create database = DatabaseEnt...
raunakpalit/WGame
WordGame/userask.py
userask.py
py
2,709
python
en
code
0
github-code
90
5304257418
"""Cache manager of traced repos. """ import os import shutil import tarfile from pathlib import Path from loguru import logger from filelock import FileLock from dataclasses import dataclass, field from typing import Optional, Tuple, Generator from ..utils import ( execute, url_exists, get_repo_info, ...
lean-dojo/LeanDojo
src/lean_dojo/data_extraction/cache.py
cache.py
py
3,574
python
en
code
338
github-code
90
27932187794
from __future__ import (division as _py3_division, print_function as _py3_print, absolute_import as _py3_abs_import) from players import Human, Computer from icon import IconO, IconX class GameMode(object): def restart(self): self.player1.moves = [] ...
Sergio2409/curemetrix-python-challengue
tic-tac-toe/game_mode.py
game_mode.py
py
1,274
python
en
code
0
github-code
90
42440751061
from skyfield.api import load, wgs84 import json stations_url = 'http://celestrak.com/NORAD/elements/stations.txt' satellites = load.tle_file(stations_url) by_name = {sat.name: sat for sat in satellites} satellite = by_name['ISS (ZARYA)'] n = 25544 url = 'https://celestrak.com/satcat/tle.php?CATNR={}'.format(n) fil...
gonetoplaid74/SpaceRadar24
iss1.py
iss1.py
py
2,144
python
en
code
0
github-code
90
70760737256
import pandas as pd from sklearn.linear_model import LinearRegression data = pd.read_csv(r"C:\Users\aarus\coding\kaggle\Udacity_SVM\data.csv") X = data[['YearsExperience']] y = data.Salary model = LinearRegression() model.fit(X,y) print(model.predict(8.5))
aaru4/SVM_emails
model.py
model.py
py
264
python
en
code
0
github-code
90
14495062056
from panda3d.core import VirtualFileSystem, ConfigVariableList, Filename import sys sys.path = [ ''] vfs = VirtualFileSystem.getGlobalPtr() mounts = ConfigVariableList('vfs-mount') for mount in mounts: mountFile, mountPoint = (mount.split(' ', 2) + [None, None, None])[:2] vfs.mount(Filename(mountFile), Filenam...
TTOFFLINE-LEAK/ttoffline
v1.0.0.test/toontown/launcher/TTOffQuickStartLauncher.py
TTOffQuickStartLauncher.py
py
505
python
en
code
3
github-code
90
18395072559
N = int(input()) cnt = dict() nodes = [set() for _ in range(N+1)] for _ in range(N-1): a, b = [int(x) for x in input().split()] cnt[a-1] = cnt.get(a-1,0) + 1 cnt[b-1] = cnt.get(b-1,0) + 1 nodes[a-1].add(b-1) nodes[b-1].add(a-1) C = [int(x) for x in input().split()] C = sorted(C, reverse=True) Z...
Aasthaengg/IBMdataset
Python_codes/p03026/s977034787.py
s977034787.py
py
692
python
en
code
0
github-code
90
12207660989
import paho.mqtt.client as paho import time import matplotlib.pyplot as plt import numpy as np import serial mqttc = paho.Client() # XBee setting serdev = '/dev/ttyUSB0' s = serial.Serial(serdev, 9600) s.write("+++".encode()) char = s.read(2) s.write("ATMY <0x140>\r\n".encode()) char = s.read(3) s.write("ATDL <0x240>...
Shelley1214/EE240500_Embedded_System
final_project/publish.py
publish.py
py
1,617
python
en
code
0
github-code
90
377608578
import tensorflow as tf from instancesegmentation.loss.distancemetric import ( DistanceMetric, ManhattanDistanceMetric, ) from instancesegmentation.loss.errormetric import ( ErrorMetric, SquaredErrorMetric, ) # It is okay to use these as defaults, as they have no internal state _default_distance_metri...
fuchspa/instancesegmentation
instancesegmentation/loss/metricloss.py
metricloss.py
py
6,025
python
en
code
1
github-code
90
32012815422
import datetime import pytz import base64 from datetime import timedelta, datetime IST = pytz.timezone('Asia/kolkata') def dictfetchall(cursor): columns = [col[0] for col in cursor.description] return [ dict(zip(columns, row)) for row in cursor.fetchall() ] def write_A...
suhasnidgundi7/SCNJ_Tech
utils.py
utils.py
py
3,778
python
en
code
0
github-code
90
28508571407
import random from Words import hangmanWords import string def get_valid_word(hangmanWords): print("This is a set", set()) randomWord = random.choice(hangmanWords) # random word from this list while '-' in randomWord or ' ' in randomWord: randomWord = random.choice(hangmanWords) return random...
Yxniv/PersonalProjects
Hangman.py
Hangman.py
py
1,754
python
en
code
0
github-code
90
70087175018
#!/usr/bin/env python ################################################################### # # # Setup file for compiling and installing the python wrapper # # for dasslc # # ...
asanet/dasslc2py
setup.py
setup.py
py
1,477
python
en
code
13
github-code
90
73211779818
# # @lc app=leetcode id=877 lang=python # # [877] Stone Game # # @lc code=start class Solution(object): def stoneGame(self, piles): """ :type piles: List[int] :rtype: bool """ # Both Alice and Bob can see the array # Easy approach # If sum is always ...
ashshekhar/leetcode-problems-solutions
877.stone-game.py
877.stone-game.py
py
1,747
python
en
code
0
github-code
90
23092008774
import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) __________) (____) -...
fatiholgunoz/rock_paper_scissors
main.py
main.py
py
1,137
python
en
code
0
github-code
90
72207855658
''' 给定一个包含 [0, n] 中 n 个数的数组 nums ,找出 [0, n] 这个范围内没有出现在数组中的那个数。   进阶: 你能否实现线性时间复杂度、仅使用额外常数空间的算法解决此问题?   示例 1: 输入:nums = [3,0,1] 输出:2 解释:n = 3,因为有 3 个数字,所以所有的数字都在范围 [0,3] 内。2 是丢失的数字,因为它没有出现在 nums 中。 示例 2: 输入:nums = [0,1] 输出:2 解释:n = 2,因为有 2 个数字,所以所有的数字都在范围 [0,2] 内。2 是丢失的数字,因为它没有出现在 nums 中。 示例 3: 输入:nums = [9,6,4,2...
Asunqingwen/LeetCode
Cookbook/Array/丢失的数字.py
丢失的数字.py
py
1,448
python
zh
code
0
github-code
90
28300580455
from observer.observers.DisplayElement import DisplayElement from observer.observers.Observer import Observer from observer.observables.WeatherData import WeatherData class ForecastDisplay(Observer, DisplayElement): def __init__(self, weather_data: WeatherData): self.pressure = 1025 # hPa ...
gsegon/design_patterns
observer/observers/ForecastDisplay.py
ForecastDisplay.py
py
934
python
en
code
0
github-code
90
43502101477
from os import path def remove_comments(input_file: str, output_file: str): """ Functie om de comments van een python file te verwijderen. Als een lijn begint met een "#" dan is het een comment en kan alles daarna verwijderd worden. :param input_file: str, pad naar het bestand :param output_f...
Thom2503/basecamp
arch3/week10/problems/commentremover.py
commentremover.py
py
1,214
python
nl
code
0
github-code
90
40297402179
# encoding: utf-8 class Solution: def findDiagonalOrder(self, matrix): """ :type matrix: List[List[int]] :rtype: List[int] """ if (not matrix) or (not matrix[0]): return [] r, c = len(matrix), len(matrix[0]) if r == 1: return matrix[0] res = [] ...
3367472/Python_20180421
LeetCode/498.3.py
498.3.py
py
1,345
python
en
code
0
github-code
90
74639751015
import os from bot.bot import DiscordBot if __name__ == '__main__': bot = DiscordBot() if not os.path.exists('{0}\{1}'.format(os.getcwd(), 'config.ini')): print('Creating base configuration file...') bot.create_config() else: bot.get_token() bot.run()
Lanilor53/weeble
main.py
main.py
py
295
python
en
code
0
github-code
90