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
72952290858
import numpy as np import matplotlib.pyplot as plt numpy_str1 = np.linspace(0,10,20) #random 20 tane float sayı oluştur 0 dan 10 a kadar numpy_str2 = numpy_str1 ** 2 #scatter plt.scatter(numpy_str1,numpy_str2) #histogram new_str = np.random.randint(0,100,150) plt.hist(new_str) #boxplot plt.boxplot(num...
berkayberatsonmez/Matplotlib
Matplotlib/other_graphs.py
other_graphs.py
py
346
python
en
code
0
github-code
90
14640755073
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __mtime__ = '2018/9/14' """ def GetCantor(src, cantor, slen): for i in range(slen): for j in range(i+1,slen): if src[j] < src[i]: cantor[i] +=1 print('原数组:',src,'其cantor数组为:',cantor) def FromCantorToSrc(cantor, res): clen...
ares5221/Data-Structures-and-Algorithms
04数组/08Cantor展开/GetCantor.py
GetCantor.py
py
819
python
en
code
1
github-code
90
7363793977
from __future__ import print_function import os import os.path import sys from optparse import OptionParser, OptionGroup index = 0 def harvest_constants(options, path, constants): global index # open the file try: inputfile = open(path, "r") except Exception as e: print("File {path} c...
openpmix/openpmix
contrib/construct_dictionary.py
construct_dictionary.py
py
15,192
python
en
code
193
github-code
90
18259647199
def main(): N, P = (int(i) for i in input().split()) L = [int(s) for s in input()][::-1] ans = 0 if P == 2 or P == 5: for i, e in enumerate(L): if e % P == 0: ans += N-i else: A = [0]*N d = 1 for i, e in enumerate(L): A[i] = (e*...
Aasthaengg/IBMdataset
Python_codes/p02757/s159463276.py
s159463276.py
py
649
python
en
code
0
github-code
90
36701692554
#!/usr/bin/env python3 import rospy from humanoid_league_msgs.msg import GameState, RobotControlState from geometry_msgs.msg import PoseWithCovarianceStamped from dynamic_stack_decider.dsd import DSD from bitbots_localization.localization_dsd.localization_blackboard import LocalizationBlackboard import os class Loc...
MosHumanoid/bitbots_thmos_meta
bitbots_navigation/bitbots_localization/src/bitbots_localization/localization_handler.py
localization_handler.py
py
3,239
python
en
code
3
github-code
90
34184982505
# -*- coding: utf-8 -*- """ Created on Mon Feb 10 11:18:28 2020 @author: filipavaldeira """ import numpy as np import random import open3d as o3d from utils.convert import find_complementary_id # General class to transform a shapes dict class ModifyShapes(object): def transform_shapes(self,id_list,sha...
FilVa/GPReg
shapes/modify_shapes.py
modify_shapes.py
py
6,272
python
en
code
0
github-code
90
24981507813
import socket HOST = "127.0.0.1" PORT = 2000 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST,PORT)) # these two steps are required because julia's readline expecet "\n" fast s.send("\n") response = s.recv(1024) def g(str): s.send(str+"\n") response = s.recv(1024) print(response) ...
HiroIshida/snippets
julia/tcp/client.py
client.py
py
332
python
en
code
6
github-code
90
18189139609
import math def facts(n): ans = [] for i in range(1, int(math.sqrt(n)+1)): if(n%i==0): ans.append(i) ans.append(n//i) ans = sorted(list(dict.fromkeys(ans))) if(ans[-1]==n): ans = ans[:-1] return ans n, m,k = map(int, input().split()) a = list(map(int, inpu...
Aasthaengg/IBMdataset
Python_codes/p02623/s792883455.py
s792883455.py
py
651
python
en
code
0
github-code
90
26211176754
from twilio.rest import Client import firebase_admin from firebase_admin import firestore import base64 import os fire_app = firebase_admin.initialize_app() DATABASE = firestore.client() def env_vars(var): return os.environ.get(var, 'Specified environment variable is not set.') # Define global constants using en...
gavmac33/ChoreBot
harasser/main.py
main.py
py
1,111
python
en
code
0
github-code
90
40330088365
# -*- coding: utf-8 -*- #爬虫抓取代理服务器ip #http://f.dataguru.cn/thread-54108-1-1.html #############################################33 class proxy_ip(): """从http://www.proxy360.cn/default.aspx上爬取代理IP地址及其端口号 reptile()根据url爬取ip及端口号, write_txt将ip及端口号写人txt文件, start调用多个url运行reptile。 """ def reptile(s...
gswyhq/hello-world
爬虫/爬虫抓取代理服务器ip.py
爬虫抓取代理服务器ip.py
py
11,177
python
zh
code
9
github-code
90
72555426538
import sys from wx import ID_OK import invesalius.constants as const import invesalius.gui.dialogs as dlg from invesalius import inv_paths from invesalius.pubsub import pub as Publisher # TODO: Disconnect tracker when a new one is connected # TODO: Test if there are too many prints when connection fails # TODO: Redes...
invesalius/invesalius3
invesalius/data/tracker_connection.py
tracker_connection.py
py
20,875
python
en
code
536
github-code
90
18461219659
N = int(input()) h_list = list(map(int, input().split())) dp_list = [0, abs(h_list[0] - h_list[1])] for n in range(2, N): h0 = h_list[n-2] h1 = h_list[n-1] h2 = h_list[n] tmp_min = min(abs(h2-h1)+dp_list[n-1], abs(h2-h0)+dp_list[n-2]) dp_list.append(tmp_min) print(dp_list[-1])
Aasthaengg/IBMdataset
Python_codes/p03160/s929746949.py
s929746949.py
py
300
python
en
code
0
github-code
90
4817200642
""" Author: Byungsoo Ko Time complexity: O(nlogm) where n is nums and m is sum array of nums Space complexity: O(n) """ class Solution: def countPieces(self, nums, mid): pieces = 0 tmpSum = 0 for num in nums: if tmpSum + num > mid: tmpSum = num p...
zhouxiaoxu/Coding-Challanges
LeetCode/410.Split_Array_Largest_Sum.py
410.Split_Array_Largest_Sum.py
py
747
python
en
code
0
github-code
90
26423296704
""" Knowledge Graph Construction based on the context The function can be embedded into main run file, or it can be executed isolately. """ import argparse import os import numpy as np import random import json from tqdm import tqdm import pickle from collections import Counter import torch from torch.utils.data impo...
Nardien/KALA
KGC/construct_ner.py
construct_ner.py
py
14,098
python
en
code
29
github-code
90
43334417486
#!/usr/bin/env python3 import sys def read_dots(f): for line in f: if line == '\n': break x, y = line.split(',') yield int(x), int(y) def read_folds(f): for line in f: axis, at = line.split()[-1].split('=') yield axis == 'y', int(at) def flip(i, at): re...
taddeus/advent-of-code
2021/13_fold.py
13_fold.py
py
929
python
en
code
2
github-code
90
34963086525
""" Testing and logging functions in the churn_library file Update numpy and seaborn before running this script: pip install -U numpy pip install -U seaborn Author: Furkan Gul Date: 13.12.2021 """ import os import logging import churn_library as cl os.environ['QT_QPA_PLATFORM'] = 'offscreen' logging.basicConfig( ...
frkangul/credit_card_customer_churn
churn_script_logging_and_tests.py
churn_script_logging_and_tests.py
py
4,168
python
en
code
0
github-code
90
18208308549
n = int(input()) a_li = list(map(int, input().split())) ans = 0 li = [0]*(n+1) for i,a in enumerate(a_li): ans += (i+1)*a for i,a in enumerate(a_li[::-1]): if i >= 1: li[i] = li[i-1]+a else: li[i] = a li = li[::-1] flag = True ne = 0.5 for i in range(n+1): if li[i] > 2*ne: ans -= li[i] -int(2...
Aasthaengg/IBMdataset
Python_codes/p02665/s549115443.py
s549115443.py
py
487
python
en
code
0
github-code
90
4747532406
import os import cv2 import pydicom from pathlib import Path from pydicom.pixel_data_handlers import apply_voi_lut from joblib import Parallel, delayed import numpy as np all_files = list(Path("/mnt/vmk/datasets/tumor_mri").glob("**/*.dcm")) outdir = "/root/histology_lib/data/processed_images/" if not os.path.exists...
maloyan/histology_lib
scripts/dcm2png.py
dcm2png.py
py
1,361
python
en
code
0
github-code
90
34401648402
# -*- coding: utf-8 -*- import unittest from cwr.parser.encoder.dictionary import AuthoredWorkDictionaryEncoder from cwr.work import AuthoredWorkRecord """ AuthoredWorkRecord to dictionary encoding tests. The following cases are tested: """ __author__ = 'Bernardo Martínez Garrido' __license__ = 'MIT' __status__ = ...
weso/CWR-DataApi
tests/parser/dictionary/encoder/record/test_authored_work.py
test_authored_work.py
py
2,576
python
en
code
32
github-code
90
18505548169
n,m,q=map(int,input().split()) grid=[] for i in range(n+1): grid.append([]) for j in range(n+1): grid[-1].append(0) grid2=[] for i in range(n+1): grid2.append([]) for j in range(n+1): grid2[-1].append(0) for i in range(m): l,r=map(int,input().split()) grid[r][l]+=1 for sumxy in range(0,2*n+1): if ...
Aasthaengg/IBMdataset
Python_codes/p03283/s849493434.py
s849493434.py
py
571
python
en
code
0
github-code
90
2205702985
# Name: Manvi Goel # Roll No: 2019472 # Importing Libraries import spacy import nltk from pyswip import Prolog # Prolog and consulting the advisory. swipl = Prolog() swipl.consult("C:/Users/HP/Desktop/Manvi/Semesters/5_MonsoonSemester2021/Artificial Intelligence/AI-A5-Manvi Goel-2019472/ElectivesAdvisory_.pl") # ...
ManviGoel26/Artificial_Intelligence_Assignments
Assignment5/A5_2019472.py
A5_2019472.py
py
3,129
python
en
code
0
github-code
90
42781956041
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # 文件目的:演示通过前向逐步回归算法来控制过拟合 # 创建日期:2018/2/3 # ------------------------------------------------------------------------- import numpy as np from bk.pa.common import open_url from sklearn import linear_model from sklearn.me...
oraocp/pystat
bk/pa/03/fwdStepwiseWine.py
fwdStepwiseWine.py
py
2,727
python
en
code
0
github-code
90
18494096839
def prime_factor(n): factors = {} if n % 2 == 0: cnt = 0 while n % 2 == 0: cnt += 1 n //= 2 factors[2] = cnt i = 3 while i * i <= n: if n % i == 0: cnt = 0 while n % i == 0: cnt += 1 n //= i ...
Aasthaengg/IBMdataset
Python_codes/p03253/s640424022.py
s640424022.py
py
773
python
en
code
0
github-code
90
18103818189
def main(): N = int(input()) print(IsPrime(N)) def IsPrime(N): count = 0 for i in range(N): inputNum = int(input()) if(inputNum == 2): count += 1 continue elif(inputNum % 2 == 0): continue flag = 0 for j in range(3, int(pow(in...
Aasthaengg/IBMdataset
Python_codes/p02257/s051139767.py
s051139767.py
py
569
python
en
code
0
github-code
90
19600652549
from model import * import config as cfg import time import os from sklearn.utils import shuffle loss,train_decode_result,pred_decode_result=build_network(is_training=True) optimizer=tf.train.AdamOptimizer(cfg.learning_rate) #optimizer = tf.train.MomentumOptimizer(learning_rate=cfg.learning_rate, momentum=cfg.momentum,...
wushilian/CRNN_Attention_OCR_Chinese
train.py
train.py
py
3,682
python
en
code
334
github-code
90
23774432255
import numpy from pywmi import Domain def test_projection(): domain = Domain.make(["a", "b"], ["x", "y"], real_bounds=(0, 1)) data = numpy.array([ [1, 0, 0.5, 0.3], [0, 0, 0.2, 0.1], ]) # Get boolean variables domain1, data1 = domain.project(["a", "b"], data) assert domain1.v...
weighted-model-integration/pywmi
pywmi/tests/test_domain.py
test_domain.py
py
843
python
en
code
17
github-code
90
44958136609
import csv import json #-------------------2020510091 and 2021510069---------------------# #-------------Evrim Gizem İşci and Eylül Pınar Yetişkin-----------# # parse condition def parse_condition(condition): condition = condition.strip() operators = ['<=', '>=', '!=','!<', '!>' ,'<', '>', '='] ...
evrmgzm/SQL-query
Group12_2020510091_2021510069.py
Group12_2020510091_2021510069.py
py
12,483
python
en
code
0
github-code
90
25698363222
from django.shortcuts import get_object_or_404 from rest_framework import serializers import logging logger = logging.getLogger(__name__) from revibe._errors import auth, data, network from revibe._helpers.debug import debug_print from accounts.models import ArtistProfile from content.models import * from content.se...
Revibe-Music/core-services
music/serializers/v1.py
v1.py
py
7,352
python
en
code
2
github-code
90
9887783318
import json from urllib import request import os import sys import arrow import numpy as np import netCDF4 from scipy.interpolate import interp1d, RegularGridInterpolator import dbdreader import latlonUTM try: import fast_gsw except ImportError: import gsw class fast_gsw(object): @classmethod...
smerckel/glidersim
glidersim/environments.py
environments.py
py
11,424
python
en
code
1
github-code
90
37118986873
# 1.0.5 Ex.5 Remove Nth to Last # Remove the nth to last element of a singly linked list # 两个 pointers from LinkedList import Node, LinkedList def remove_nth(lst, n): assert n > 0 and n <= lst.length fast = lst.head while n > 0: fast = fast.next n -= 1 slow = lst.head while ...
nanw01/python-algrothm
Python Algrothm Advanced/practice/080205remove_nth.py
080205remove_nth.py
py
679
python
en
code
1
github-code
90
18146790855
import logging import os import re from lsst.ctrl.bps.panda.constants import PANDA_MAX_LEN_INPUT_FILE _LOG = logging.getLogger(__name__) class CommandLineEmbedder: """Class embeds static (constant across a task) values into the pipeline execution command line and resolves submission side environment var...
zhaoyuyoung/ctrl_bps_panda
python/lsst/ctrl/bps/panda/cmd_line_embedder.py
cmd_line_embedder.py
py
5,818
python
en
code
0
github-code
90
69882451816
from setuptools import setup url = "https://github.com/jic-dtool/dtool-irods" version = "0.10.1" readme = open('README.rst').read() setup( name="dtool-irods", packages=["dtool_irods"], version=version, description="Add iRODS support to dtool", long_description=readme, include_package_data=True...
jic-dtool/dtool-irods
setup.py
setup.py
py
709
python
en
code
0
github-code
90
42494978851
import config import grogu import drive_utils def run_trip(): # Initilize our motors left_motor = grogu.Motor(grogu.Port.A) right_motor = grogu.Motor(grogu.Port.D) front_motor_1 = grogu.Motor(grogu.Port.C) # Initialize the color sensors and motors. right_sensor = grogu.ColorSensor(grogu.Po...
aryasarukkai/Season2020
new_trip4.py
new_trip4.py
py
5,269
python
en
code
0
github-code
90
5260093081
from cc_user import user from cc_booking import info, booking, volunteer from cc_calendar import update_calendar, display_calendar std_pointer = " \033[92m->\033[0m " def view_bookings(): """ Retrieves the booking information which the user is involved in from the dictionary and prints out the details ...
tony-rsa/CodeClinic_CLI
cc_booking/view_bookings.py
view_bookings.py
py
1,948
python
en
code
1
github-code
90
18484461259
n = int(input()) if n == 1: print('Yes') print(2) print(1,1) print(1,1) exit() for i in range(2,10**3): if i*(i+1) == n*2: k,l = i+1, i break else: print('No') exit() print('Yes') ans = [ [] for _ in range(k)] top = 0 bottom = 1 for i in range(1,n+1): ans[top].app...
Aasthaengg/IBMdataset
Python_codes/p03230/s675597660.py
s675597660.py
py
503
python
en
code
0
github-code
90
816672989
from flask import g, current_app, abort, url_for from flask.ext.restful import reqparse from flask.ext import restful def req_boolean(val): val = val.strip().lower() if val not in ('true', 'false'): raise ValueError() return val in ('true',) def min_length_str(length): def validator(s): ...
Dav1dde/vs
vs/views/rest/v1/domain.py
domain.py
py
2,555
python
en
code
2
github-code
90
43607786041
import os from tqdm import tqdm if not os.path.exists('test_repositories'): os.mkdir('test_repositories') os.chdir('test_repositories') for repo_name in tqdm(open('../repositories_list.txt', 'r').readlines()): repo_name = repo_name.strip() if repo_name != "": os.system(f"git clone --quiet --dept...
petroolg/typilus
src/data_preparation/test_data/download_testing_data.py
download_testing_data.py
py
338
python
en
code
null
github-code
90
75137703336
# import the necessary packages from PIL import Image import pytesseract import argparse import cv2 import os import numpy as np import matplotlib.pyplot as plt def display(im_path): dpi = 80 im_data = plt.imread(im_path) height, width = im_data.shape[:2] # What size does the figure need to be ...
yab-tad/Amharic-OCR
flask_module/ocr.py
ocr.py
py
4,838
python
en
code
1
github-code
90
23816630367
import datetime from globus_cli.commands.timer.create.transfer import resolve_start_time EST = datetime.timezone(datetime.timedelta(hours=-5), name="EST") def test_resolve_start_time_defaults_to_now(): value = resolve_start_time(None) assert isinstance(value, datetime.datetime) assert value.tzinfo is no...
globus/globus-cli
tests/unit/test_timezone_handling.py
test_timezone_handling.py
py
1,314
python
en
code
67
github-code
90
9264747111
class PlayerCharacter: membership = True # can change as following # def __init__(self, name='anonymous', age=0): def __init__(self, name, age): # only ppl over 18 if (age > 18): self.name = name self.age = age ...
MBee05/Section6_Python_advanced_00P
4_init_.py
4_init_.py
py
626
python
en
code
0
github-code
90
33314657138
# Difficulty : Medium # Tag : array, binary search, dailly leetcode challenge 25 July 2023 def peakIndexInMountainArray(self, arr: List[int]) -> int: # define variable left, right = 0, len(arr)-1 # iterate until left >= right while right>left: # calculate mid # avoid overflow mid...
Harisalghifary/competitive-programming
leetcode/852-Peak-Index-in-the-Mountain-Array.py
852-Peak-Index-in-the-Mountain-Array.py
py
459
python
en
code
2
github-code
90
72201252458
# Medium # LC 1650 # You're given three inputs, all of which are instances of an AncestralTree class that have an ancestor # property pointing to their youngest ancestor. The first input is the top ancestor in an ancestral tree # and the other two inputs are descendants in the ancestral tree. # Write a function that ...
ArmanTursun/coding_questions
AlgoExpert/Graphs/Medium/Youngest Common Ancestor/Youngest Common Ancestor.py
Youngest Common Ancestor.py
py
3,067
python
en
code
0
github-code
90
34891787926
import typing import numpy as np import numpy.typing as npt from sklearn.metrics import accuracy_score import gates.nor_gates as ng EvalutedIndividual = tuple[ng.NorClassifier, float] Fitness = float def evaluate_fitness( individual: ng.NorClassifier, features: npt.NDArray[np.bool_], targets: npt.NDArr...
Mirandatz/gates
gates/fitnesses.py
fitnesses.py
py
912
python
en
code
0
github-code
90
29145052154
""" From Python-Robotics Toolbox Path planning Sample Code with RRT* author: Atsushi Sakai(@Atsushi_twi) """ import math import os import sys import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../RRT/") try: from rrt import RRT except ImportError: ...
jgraeb/AutoValetParking
motionplanning/rrt_star.py
rrt_star.py
py
6,845
python
en
code
14
github-code
90
11618526696
'''Exercício Python 105: Faça um programa que tenha uma função notas() que pode receber várias notas de alunos e vai retornar um dicionário com as seguintes informações: - Quantidade de notas - A maior nota - A menor nota - A média da turma - A situação (opcional) Adicione também as docstrings dessa função para cons...
Dawisonms/Python
Curso em video/Exercicios/Modulo 3/Ex105.py
Ex105.py
py
805
python
pt
code
1
github-code
90
16283796384
import os import pandas as pd validation_accuracies = [] weight_name = "weight-data-20201124-110-0.58-0.75.hdf5"# THIS is initial weight weight_names = [] weight_epochs = [] for current_weight in os.listdir("save_weight"): if ".hdf5" in current_weight: print(current_weight) weight_name = cu...
dybalabak/4angle_cctv_recognition
all_validation.py
all_validation.py
py
863
python
en
code
1
github-code
90
4290563282
import os from typing import Dict, Optional import numpy as np import torch import torchdata.datapipes as dp from pytorch_lightning import LightningDataModule from torch.utils.data import DataLoader from torchvision.transforms import transforms from climax.pretrain.dataset import ( Forecast, IndividualForecas...
microsoft/ClimaX
src/climax/pretrain/datamodule.py
datamodule.py
py
7,967
python
en
code
341
github-code
90
24673007857
# coding: utf-8 # from importlib import import_module from __future__ import annotations from typing import Optional from logging.config import dictConfig from flask import Flask from flask_cors import CORS from flask_apidoc import ApiDoc # from core.request import ExtRequest from core.request_middleware...
sekil9529/flask-demo
app/__init__.py
__init__.py
py
2,827
python
en
code
0
github-code
90
18522710369
# -*- coding: utf-8 -*- """ Created on Fri Sep 18 10:08:18 2020 @author: liang """ N = int(input()) A = [int(x) for x in input().split()] ans = 0 for a in A: while a%2 == 0: a //= 2 ans += 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03325/s123323502.py
s123323502.py
py
222
python
en
code
0
github-code
90
26188981562
from typing import Dict, Union import bs4 import pygments as pyg from pygments import lexers, util from util import LINE_SEPARATOR from plugins.syntax_highlighting import IndFormatter Options = Dict[str, Union[str, bool]] # Maximum length of a line in a code block MAX_PRE_LINE_LENGTH = 48 def highlight_code(pre_c...
ktrieu/prepress
plugins/preformatted.py
preformatted.py
py
6,627
python
en
code
0
github-code
90
21466519855
from selenium import webdriver from selenium.webdriver.firefox.options import Options as FirefoxOptions import time class WebScraper: def __init__(self, geckdrive_path=None): self.options = FirefoxOptions() self.options.add_argument("--headless") self.geckdriver_path = '/Users/saips/base/...
anirudh-arunkumar/PCtrack
py/webscraper.py
webscraper.py
py
805
python
en
code
1
github-code
90
25290379150
from gensim.models.wrappers.fasttext import FastText from pimlico.core.modules.base import BaseModuleExecutor class ModuleExecutor(BaseModuleExecutor): def execute(self): path = self.info.options["path"] # Use Gensim's tool to load the data self.log.info("Loading FastText vectors from {}...
markgw/pimlico
src/python/pimlico/modules/input/embeddings/fasttext_gensim/execute.py
execute.py
py
803
python
en
code
6
github-code
90
2931957176
import sys import re import csv if __name__ == "__main__": infile = sys.argv[1] with open(infile) as fin: reader = csv.reader(fin, delimiter=',') writer = csv.writer(sys.stdout) cnts = {} for r in reader: w = r[0].strip() w = re.sub("_\(.*\)$","",w) #drop...
jasontrigg0/mystery_hunt
src/word_list/preprocess_wiki.py
preprocess_wiki.py
py
590
python
en
code
0
github-code
90
18044369188
import numpy as np from scipy.linalg import expm from scipy import stats from tqdm import tqdm import pandas as pd # Functions def make_Xo(ROI, ROInames): """From a ROI (str) and by matching with the index of the ROInames, it returns a column vector filled with 0 except at the index of the ROI wh...
MathieuBo/PathoSpreading
fitfunctions.py
fitfunctions.py
py
4,694
python
en
code
0
github-code
90
1449637988
import torch import torch.nn as nn from torch.nn import functional as F from nets.resnet import ResNetBackbone from nets.module import PoseNet, Pose2Feat, MeshNet, ParamRegressor from nets.loss import CoordLoss, ParamLoss, NormalVectorLoss, EdgeLengthLoss from utils.smpl import SMPL from utils.mano import MANO from con...
mks0601/I2L-MeshNet_RELEASE
main/model.py
model.py
py
7,580
python
en
code
681
github-code
90
27187867407
#!/usr/bin/python # -*- coding: utf-8 -*- #<--Import lib import threading import time import os from ezprint import * from tkinter import * from cracker import * from help.authors import * from tkinter import filedialog as fd v = None file_name = '' firstFrame = None start_frame = None def insertText(radio3, v, ...
midaef/md5-cracker
main.py
main.py
py
2,206
python
en
code
3
github-code
90
37403365602
from __future__ import print_function import threading import time import yarp from yasp.base_module import BaseModule from yasp.controller.marytts import MaryTTS from yasp.controller.face_controller import FaceController pho2mou = { # J E L U R D ...
BrutusTT/yasp
yasp/m_speak.py
m_speak.py
py
8,644
python
en
code
0
github-code
90
46192534490
def listsum(l): total = 0 for n in l: total += n return total print(listsum([1, 2, 5, 9, 13])) def sumlist(l): if l == []: return 0 return l[0] + sumlist(l[1:]) print(sumlist([1, 2, 5, 9, 13])) print({i : i%2==0 for i in range(5)}) words = ["Hello", "There", "How", "Are", "Yo...
gabrielamuller/stream2
day3/sum.py
sum.py
py
373
python
en
code
0
github-code
90
9429926486
import tensorflow as tf import matplotlib.pyplot as plt import random from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("../../res/data/mnist", one_hot=True) number_classes = 10 width = 28 height = 28 learning_rate = 0.01 X = tf.compat.v1.placeholder(tf.float32, [None, widt...
sungwonkim-dev/MLS
src/example/mnist.py
mnist.py
py
1,968
python
en
code
0
github-code
90
73820277097
class Solution: def maxScoreWords(self, words: List[str], letters: List[str], score: List[int]) -> int: letterPool = collections.Counter(letters) result = 0 return self.helper(words, 0, letterPool, score) def helper(self, words, start, letterPool, score): result = 0 siz...
HarrrrryLi/LeetCode
1255. Maximum Score Words Formed by Letters/Python 3/solution.py
solution.py
py
899
python
en
code
0
github-code
90
18375771651
#------------------------------------------------------------------------------- #Program: Designing a Program From a Desciption - BMI #Programmer: Gary Heisler #Date: 9/1/2010 # 7/1/2011 - Revised for Python 3 #Abstract: This program calculates the body mass index (BMI) for a user ...
Musicachic-zz/CITP_110
CITP 110/Chapter 4/Designing_a_Program_BMI/Designing a Program From a Description Without Comments.py
Designing a Program From a Description Without Comments.py
py
1,182
python
en
code
2
github-code
90
14508431435
import multiprocessing # for multiprocessing.cpu_count() import numpy as np import psutil import rosgraph import rospy from ros_statistics_msgs.msg import HostStatistics class HostMonitor(object): """ Tracks cpu and memory information of the host. """ def __init__(self): self._hostname = rosgraph.n...
osrf/rosprofiler
src/rosprofiler/host_monitor.py
host_monitor.py
py
2,713
python
en
code
7
github-code
90
22766855179
import os import json import s3dataEndpoint import labelStudioAPI import streamlit as st import xmltodict from pathlib import Path ########################################################################################################## token = '303a7e45277180b93567209aeca063088856ddf8' lsAPI = labelStudioAPI.LabelStu...
Seagate/cortx
doc/integrations/label-studioAPI/app.py
app.py
py
9,013
python
en
code
631
github-code
90
13860286622
''' http://forum.portswigger.net/thread/557/jython-error-convert-pylist http://forum.portswigger.net/thread/829/format-payloadpositions-sendtointruder ''' from burp import IBurpExtender from burp import IContextMenuFactory from javax.swing import JMenuItem import sys import os import re import jarray import java #Add...
arvinddoraiswamy/mywebappscripts
BurpExtensions/IntruderPositions.py
IntruderPositions.py
py
3,420
python
en
code
169
github-code
90
37119436103
class Solution(object): def quickSort(self, array): """ input: int[] array return: int[] """ # write your solution here self.quick_sort(array, 0, len(array)-1) return array def quick_sort(self, array, left, right): if left >= right: re...
nanw01/python-algrothm
laioffer/Code/10. Quick Sort copy 2.py
10. Quick Sort copy 2.py
py
1,283
python
en
code
1
github-code
90
15898211786
from django.contrib import admin from django.urls import path, include from rest_framework.routers import DefaultRouter from django.views.decorators.cache import cache_page from .views import (ShopIndexView, # products_list, ProductsListView, # order_list, ...
skaiiheda/Django-App
mysite/shopapp/urls.py
urls.py
py
2,327
python
en
code
0
github-code
90
72386832297
import numpy as np import zarr np.random.seed(0) z = zarr.open( "dummy_dataset.zarr", shape=(3, 1000), chunks=(1, 500), compressor=None, dtype=np.float32, ) z[0] = np.arange(1000) z[1] = np.sin(np.arange(1000) / 100) z[2] = np.random.rand(1000) print("Index 0:", z[0, :5]) print("Index 1:", z[1, ...
gzuidhof/zarr.js
examples/create_dummy_dataset.py
create_dummy_dataset.py
py
353
python
en
code
113
github-code
90
41444054958
from models import has_won_models, get_correct_position_models, get_random_puzzle_models, empty_cell_location_models, make_movements_models from settings import PUZZLE_SIZE def get_available_movements(puzzle): movements = ["LEFT", "RIGHT", "UP", "DOWN"] empty_cell_x, empty_cell_y = empty_cell_location_models(...
J-H-Schwartz/Algo_taquin-py-2
controler.py
controler.py
py
1,026
python
en
code
0
github-code
90
15944950467
# 11727 import sys sys.setrecursionlimit(10000) n = int(input()) mod = 10_007 cache = [0] * 1001 cache[1] = 1 cache[2] = 3 cache[3] = 5 cache[4] = 11 # top-down: memoization def dp(n): if cache[n]: return cache[n] else: cache[n] = dp(n-1) + 2 * dp(n-2) return cache[n] print(dp(n) % mod) ...
ojg1993/PS_practice
algorithm basic1/다이나믹 프로그래밍 1/11727.py
11727.py
py
433
python
en
code
0
github-code
90
9533238698
#Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. #You must write an algorithm that runs in O(n) time and without using the division operation. class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: ...
anguzz/leetcode
arrays/05-ProdArrayExceptSelf.py
05-ProdArrayExceptSelf.py
py
845
python
en
code
0
github-code
90
70611673578
""" @Author: Rossi Created At: 2021-02-21 """ import json import os from Broca.utils import find_class from .agent import FAQAgent from Broca.message import BotMessage class FAQEngine: def __init__(self): self.agent = None self.frequent_query_retriever = None @classmethod def from_conf...
lawRossi/Broca
Broca/faq_engine/engine.py
engine.py
py
1,793
python
en
code
4
github-code
90
9462879056
#! /usr/bin/env python import sys def gcdI(i, j): while (i!= j): if (i > j): i = i - j else: j = j - i; return i; def gcdF(i, j): while (i!= j): if (i > j): if(i%j==0): return j else: ...
bogyshi/cs471
hw1/gcd_full.py
gcd_full.py
py
658
python
en
code
0
github-code
90
33986917810
import constants import os import sys TEAMS = [] PLAYERS = [] def clean_teams_data(): constants_teams_copy = constants.TEAMS.copy() for team in constants_teams_copy: new_team_dict = { team.lower(): [] } TEAMS.append(new_team_dict) def clean_players_data(...
tsevein/Basketball-Team-Stats-Tool
application.py
application.py
py
7,580
python
en
code
0
github-code
90
2753924988
import gspread from google.oauth2.service_account import Credentials SCOPE = [ "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive" ] CREDS = Credentials.from_service_account_file("creds.json") SCOPED_CREDS = CREDS.with_scope...
CatBackmanCasino/love_sandwiches
run.py
run.py
py
3,911
python
en
code
0
github-code
90
19031763280
import os import os.path from pathlib import Path import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt import seaborn as sns from keras import Sequential from sklearn.preprocessing import MinMaxScaler from keras.models import load_model from sklearn...
snigdha89/ResNet_implementation
ResNet_implementation.py
ResNet_implementation.py
py
8,203
python
en
code
0
github-code
90
20890012507
"""Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. """ from euler.solutions import solution_3 def prime_sum(limit): """Compute the sum of all primes below the given limit. Arguments: limit (int): The limit below which prime...
rlucioni/euler
euler/solutions/solution_10.py
solution_10.py
py
531
python
en
code
3
github-code
90
25254225552
import sys N, M = map(int, sys.stdin.readline().split()) lesson = list(map(int, sys.stdin.readline().split())) start, end = sum(lesson)//M, sum(lesson) answer = end while start <= end: mid = (start + end) // 2 if mid < max(lesson): start = mid + 1 continue cnt, temp = 0,0 for i in ran...
choinara0/Algorithm
Baekjoon/Binary Search/2343번 - 기타 레슨/2343번 - 기타 레슨.py
2343번 - 기타 레슨.py
py
641
python
en
code
0
github-code
90
33542790656
# # ACMICPC # 문제 번호 : 5363 # 문제 제목 : 요다 # 풀이 날짜 : 2020-11-20 # Solved By Reamer # N = input() for i in range(0, int(N)): sentence = input().split() for j in range(2, len(sentence)): print(sentence[j], end=" ") for j in range(0, 2): print(sentence[j], end=" ") print()
LeeGyeongHwan/Algorithm_Student
Python/acm_5363.py
acm_5363.py
py
334
python
ko
code
3
github-code
90
264125467
from __future__ import division import wx import os import wx.lib.scrolledpanel as scrolled from wx.lib.pubsub import pub from threading import Thread import subprocess from Helper.xmlTree import XMLTree from Helper.AutoCloseMessageBox import MessageDialog import wx.grid as GD from collections import OrderedD...
RealLau/AppAutoViewer
UI.py
UI.py
py
40,496
python
en
code
2
github-code
90
25683498353
import pathlib from PyQt5 import QtCore, QtWidgets from .matrix_dataset import MatrixDataset from .matrix_filter import MatrixFilter from .matrix_element import MatrixElement class DataMatrix(QtWidgets.QWidget): quickviewed = QtCore.pyqtSignal(pathlib.Path, list) def __init__(self, parent=None, analysis=ra...
ZELLMECHANIK-DRESDEN/ShapeOut-Qt-studies
shapeout2/gui/matrix.py
matrix.py
py
3,535
python
en
code
0
github-code
90
18173454219
from collections import Counter n = int(input()) s = input() b = Counter(s) ans = min(b["R"],b["W"]) a = 0 for i in range(b["R"]): if s[i] == "W": a += 1 print(min(ans,a))
Aasthaengg/IBMdataset
Python_codes/p02597/s361126139.py
s361126139.py
py
196
python
en
code
0
github-code
90
72142280938
from setuptools import setup, find_packages, find_namespace_packages from functools import partial def version_dev(version): from setuptools_scm.version import get_local_node_and_date if version.dirty: return get_local_node_and_date(version) else: return "" package_dir = { 'dao_analyzer...
Grasia/dao-analyzer
setup.py
setup.py
py
1,471
python
en
code
33
github-code
90
18323725689
from collections import Counter def solve(n, arr): if arr[0] != 0: return 0 c = Counter(arr) if c[0] != 1: return 0 for i in range(max(c) + 1): if i not in c: return 0 c = list(c.items()) c.sort() prev = 1 ans = 1 mod = 998244353 for _,...
Aasthaengg/IBMdataset
Python_codes/p02866/s611401078.py
s611401078.py
py
492
python
en
code
0
github-code
90
13052888422
""" Module: Feature_Selector.py Use: Determines which features are best for use when creating MLP Last Edited: Akrit Sinha, 06-28-2019 """ # Packages import pandas from datetime import datetime from textblob import TextBlob from sklearn import preprocessing from sklearn.ensemble import ExtraTreesClassifier # Import da...
anooppanyam/NBAEngagementEstimator
Feature_Selector.py
Feature_Selector.py
py
1,944
python
en
code
0
github-code
90
42093808311
before_Sort = list(map(int, input().split())) print('Before : ', end='') print(' '.join(str(i) for i in before_Sort)) def Bubble_Sort(list): if len(list) == 1: return list for i in range(len(list)): for j in range(len(list)-i-1): if list[j] > list[j+1]: temp = list[...
GreenClothes/BAEKJOON
SORTING/BASIC/Bubble_Sort.py
Bubble_Sort.py
py
516
python
en
code
0
github-code
90
37546578511
import pymysql import pandas as pd import pylab as pl # amplio el tapaño de los puntos pl.rcParams['agg.path.chunksize'] = 10000 try: conexion = pymysql.connect(host='127.0.0.1', user='root', password='', db='employees') t...
ISPC2020/tscdprog2020_g3-team-grupo-3
archivos_soporte_octavio/buscar_datos_DB.py
buscar_datos_DB.py
py
1,472
python
es
code
0
github-code
90
17967736469
import sys from heapq import heappush, heappop read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N = int(readline()) G = [[] for _ in range(N)] for i in range(N - 1): a, b, c = map(int, rea...
Aasthaengg/IBMdataset
Python_codes/p03634/s594122212.py
s594122212.py
py
945
python
en
code
0
github-code
90
33323192434
''' Três candidatos concorreram a uma eleição (A, B, C). O usuário deve informar quantos votos cada candidato recebeu, quantos foram os votos brancos e quantos foram os votos nulos. O programa deve calcular e informar: o número total de eleitores, o percentual de votos que cada candidato recebeu (em relação ao núm...
LauraLuz/COMPUTATIONALTHINKINGUSINGPYTHON
aula5e6/exerciciosPython/exercicio10.py
exercicio10.py
py
1,188
python
pt
code
0
github-code
90
5338762131
from celery import shared_task from django.core.mail import send_mail import cloudinary from .models import Posts,Comments from cloudinary import uploader import os from Authentication.models import CustomUser @shared_task def send_notification_email(user_email, notification_type, post_content): subject = "New N...
douglas-danso/django_assessment
User_Relationship/tasks.py
tasks.py
py
2,536
python
en
code
0
github-code
90
72208068138
# -*- coding: utf-8 -*- # @Time : 2020/4/6 0006 19:51 # @Author : 没有蜡笔的小新 # @E-mail : sqw123az@sina.com # @FileName: 编辑距离.py # @Software: PyCharm # @Blog :https://blog.csdn.net/Asunqingwen # @GitHub :https://github.com/Asunqingwen """ 给你两个单词 word1 和 word2,请你计算出将 word1 转换成 word2 所使用的最少操作数 。 你可以对一个单词进行如下三种操作: ...
Asunqingwen/LeetCode
每日一题/编辑距离.py
编辑距离.py
py
2,154
python
en
code
0
github-code
90
18198000469
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 x,n = map(int,input().split()) S = set(map(int,input().split())) for i in range(100): if x-i not in S: print(x-i) bre...
Aasthaengg/IBMdataset
Python_codes/p02641/s705163073.py
s705163073.py
py
366
python
en
code
0
github-code
90
1180323407
import io, PIL import PySimpleGUIQt as sg from gui import helpers from PIL import Image from .helpers import BlackWhite def ButtonsAndStatus(): return [ [sg.Button('Ok',button_color=BlackWhite, pad=(10,7), border_width=2, size=(7,1), bind_return_key=True, ...
gorenje/pclxtool
gui/layouts.py
layouts.py
py
11,498
python
en
code
0
github-code
90
10105786372
#! /usr/bin/env python3 # # Author: Tatsu import sys import os import math import re import matplotlib import pylab import time if len(sys.argv) < 2: print("Usage: ", sys.argv[0], "<file>") sys.exit(1) if not os.path.exists(sys.argv[1]): print("%s does ...
Tatsuonline/Dark-Matter-Research
pulse-gradient-analysis.py
pulse-gradient-analysis.py
py
6,258
python
en
code
2
github-code
90
14012083248
from functools import cache import torch from torch.cuda._utils import _get_device_index elixir_cuda_fraction = dict() @cache def gpu_device(): return torch.device(torch.cuda.current_device()) def set_memory_fraction(fraction, device=None): torch.cuda.set_per_process_memory_fraction(fraction, device) ...
hpcaitech/Elixir
elixir/cuda.py
cuda.py
py
779
python
en
code
8
github-code
90
36215865100
import heapq def solution(jobs): answer = 0 heap = [] jobs.sort() currentTime = jobs[0][0]; # 초기 작업의 시간으로 세팅 jobidx = 1 # 작업 시간을 기준으로 최소 히프 구성 heapq.heappush(heap, [jobs[0][1], jobs[0][0]]) while heap: # 현재 기준 최소 시간의 작업 가져옴 jobtime, arrive = heapq.heappop(...
nbalance97/Programmers
Lv 3/디스크 컨트롤러.py
디스크 컨트롤러.py
py
946
python
ko
code
0
github-code
90
6937450569
#! /usr/bin/env python import rospy from std_srvs.srv import Empty, EmptyResponse from geometry_msgs.msg import Twist class cSrvServer(object): def __init__(self): self.start_srv_ = rospy.Service('/move_bb8_in_circle', Empty, self.start_service) self.stop_srv_ = rospy.Service('/stop_bb8', Empty,...
rafaelrojasmiliani/rosignite
rosbasics5days/unit04/src/unit_4_services/src/bb8_move_in_circle_service_server.py
bb8_move_in_circle_service_server.py
py
1,016
python
en
code
1
github-code
90
18108412709
def insertionSort(A, N, g=1): global count for i in range(g, N): v = A[i] j = i-g while A[j] > v and j >= 0: A[j+g], A[j] = A[j], A[j+g] count += 1 j -= g def bubbleSort(A, N): flag = 1 while flag: flag = 0 for j in range(N-1,...
Aasthaengg/IBMdataset
Python_codes/p02262/s745784158.py
s745784158.py
py
1,139
python
en
code
0
github-code
90
72227007978
import numpy as np import pdb """ This code was based off of code from cs231n at Stanford University, and modified for ECE C147/C247 at UCLA. """ class SVM(object): def __init__(self, dims=[10, 3073]): self.init_weights(dims=dims) def init_weights(self, dims): """ Initializes the weight matrix of the SV...
Amir-Omidfar/C247
hw2/nndl/svm.py
svm.py
py
9,617
python
en
code
4
github-code
90
39128642909
import cv2 import numpy as np import matplotlib.pylab as plt img = cv2.imread('../img/bright.jpg') img_yuv = cv2.cvtColor(img, cv2.COLOR_BGR2YUV) img_eq = img_yuv.copy() img_eq[:,:,0] = cv2.equalizeHist(img_eq[:,:,0]) img_eq = cv2.cvtColor(img_eq, cv2.COLOR_YUV2BGR) img_clahe = img_yuv.copy() clahe = cv2.createCLAH...
YeonwooSung/ai_book
CV/OpenCV/image_processing/histo_clahe.py
histo_clahe.py
py
592
python
en
code
17
github-code
90
36382300787
import os import luigi from luigi_pipelines import run_cmd, config from qiime2 import Artifact import pandas as pd import qiime2 class basic_luigi_task(luigi.Task): tab = luigi.Parameter() odir = luigi.Parameter() dry_run = luigi.BoolParameter() log_path = luigi.Parameter(default=None) def get_l...
444thLiao/16s_based_qiime2
luigi_pipelines/share_tasks.py
share_tasks.py
py
3,413
python
en
code
1
github-code
90