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
32328440349
#--------------------------------- ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ --------------------------------- # ์†Œ์ผ“ ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ from PIL import Image, ImageFile from io import BytesIO import socket from PIL import Image import pybase64 # ๋ชจ๋ธ ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ from PIL import Image import tensorflow as tf from tensorflow.keras.applications import Res...
MultiFinal/Fish_Project
PC.py
PC.py
py
8,991
python
ko
code
0
github-code
6
41734453103
from __future__ import absolute_import, unicode_literals from lol_stats_api.helpers.redis import db_metadata, db_matchlist from celery.decorators import task, periodic_task from celery.schedules import crontab from redis import Redis from celery_singleton import Singleton, clear_locks import os from datetime import dat...
fabran99/LolStatisticsBackend
bard_app_api/lol_stats_api/tasks.py
tasks.py
py
4,723
python
en
code
1
github-code
6
17779473058
#!/usr/bin/python3 """Query reddit API for work count in hot list using recusion""" import requests def count_words(subreddit, word_list, after=None, count={}): """Count words in word_list in subreddit""" if after is None: subred_URL = 'https://www.reddit.com/r/{}/hot.json'.format(subreddit) else:...
robertrowe1013/holbertonschool-interview
0x13-count_it/0-count.py
0-count.py
py
1,364
python
en
code
0
github-code
6
21360428026
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer path1 = 'project_data/DC_Crime.csv' path2 = 'project_data/DC_Properties.csv' path3 = 'project_data/DC_crime_test.csv' data = pd.read_csv(path1) Features =['SHIFT', 'OFFENSE', 'METHOD','BID',"NEIGHBORHOOD_...
montpelllier/MA333_Introduction-to-Big-Data-Science
decisiontree.py
decisiontree.py
py
1,129
python
en
code
0
github-code
6
31099193784
""" Greg McClellan Created: 8/25/13 Last Edited: 8/25/13 Problem: n! means n ร— (n โˆ’ 1) ร— ... ร— 3 ร— 2 ร— 1 For example, 10! = 10 ร— 9 ร— ... ร— 3 ร— 2 ร— 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the digits in the number 100! """ fr...
gsmcclellan/project_euler
Factorial_digit_sum.py
Factorial_digit_sum.py
py
565
python
en
code
0
github-code
6
7485160594
from datetime import datetime from os.path import basename from types import SimpleNamespace import math import numpy as np __version__ = "2020.10.06" def solve(length, supports, loads, EI, GA, top, bottom, shear): # {{{ """Solve the beam problem. Arguments: length: The length of the beam in mm. Th...
rsmith-nl/beammech
beammech.py
beammech.py
py
18,941
python
en
code
26
github-code
6
12799024256
import webapp2, jinja2, os # Import requests with app engine adapter import requests, requests_toolbelt.adapters.appengine from bs4 import BeautifulSoup import datetime, time from google.appengine.ext import ndb # Patch adapter requests_toolbelt.adapters.appengine.monkeypatch() # os.path.dirname(__file__) is the c...
jQwotos/better-shareproint-slides
main.py
main.py
py
3,061
python
en
code
0
github-code
6
29675107674
from trees.binary_sort_tree import BinarySortTree def build_dictBinTree(entries): dic = BinarySortTree() for k, v in entries.items(): dic.insert(k, v) dic.insert(20, 20) return dic def main(): dic = build_dictBinTree( {57: 57, 36: 36, 89: 89, 7: 7, 43: 43, 65: 65, 96: 96, 18: 18,...
caominglong/data_structures_and_algorithms
trees/test/binary_sort_tree_test.py
binary_sort_tree_test.py
py
402
python
en
code
0
github-code
6
31655899927
def find_anagrams(word, candidates): anagrams = [] for w in candidates: if len(w) == len(word) and w.lower() != word.lower(): if sorted(w.lower()) == sorted(word.lower()): anagrams.append(w) return anagrams """ The solution below only fails 1 test: when the wo...
ilee38/exercism-io-coding-exercises
python/anagram/anagram.py
anagram.py
py
838
python
en
code
0
github-code
6
25649315535
import ctypes import sys class DynamicArray(object): def __init__(self): self.n = 0 #Actual count of the actual elements self.capacity = 1 #Default capacity self.A = self.make_array(self.capacity) #To call make.array def __len__(self): return self...
Emre-Yaz/emre-yaz
DS-A/ArraySequences/DynamicArrayImp.py
DynamicArrayImp.py
py
1,536
python
en
code
1
github-code
6
22949757973
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # k2hat.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - 07/15 # License: MIT. See the LICENCE file for license text. ''' This contains functions for reading K2 CSV light-curves produced by the HAT Project into a Python dictionary. Requires numpy. The only external func...
waqasbhatti/astrobase
astrobase/hatsurveys/k2hat.py
k2hat.py
py
25,449
python
en
code
50
github-code
6
30906484831
from reportlab.platypus import (SimpleDocTemplate, Paragraph, PageBreak, Image, Spacer, Table, TableStyle) from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet from reportlab.pdfgen import canvas from reportlab.graphics.shapes import Line, LineShape, Drawing from reportlab.lib.pagesizes import LETTER, i...
GregorMonsonFD/holmly_sourcing_legacy
scripts/python/pdfGen/page_format_handler.py
page_format_handler.py
py
5,949
python
en
code
0
github-code
6
3847347050
import matplotlib matplotlib.use('Agg') import numpy as np import tinyarray import matplotlib.pyplot as plt from scipy.sparse import spdiags from scipy.sparse import eye from scipy.sparse import kron from scipy.sparse.linalg import inv from scipy.sparse import csr_matrix import adaptive from functools import partial fr...
hainingpan/nanowire_matlab
Ldos_dis.py
Ldos_dis.py
py
5,110
python
en
code
0
github-code
6
74740608828
from tkinter import * from PIL import Image,ImageTk from tkinter import messagebox import pymysql def bookRegister(): ## When the user clicks the submit button this bookRegister function is run # BookInfos are stored in these variables. # and then these are uploaded to the database using the cursor metho...
DarkCodeOrg/library_management_system
AddBook.py
AddBook.py
py
3,270
python
en
code
0
github-code
6
10430336572
from pathlib import Path import argparse import sys import random from lib.conll import CoNLLReader def main(): parser = argparse.ArgumentParser(description="""Extract data based on comments info""") parser.add_argument('input', help="conllu file") parser.add_argument('output', help="target file", type=Pa...
coastalcph/ud-conversion-tools
extract.py
extract.py
py
2,049
python
en
code
3
github-code
6
40025821479
from django.urls import path from . import views from .views import ( TicketCreateView, AssignCreateView, StatusCreateView, StatusLstCreateView, CgyCreateView, CgyListView, TicketListView ) urlpatterns = [ path('', views.home, name='sticket-home'), path('categories', C...
uppgrayedd1/webapp
webapp/sticket/urls.py
urls.py
py
783
python
en
code
0
github-code
6
43266445764
from urllib.request import urlopen import json import matplotlib.pyplot as plt url = "http://cyrilserver.ddns.net:8080/hardware/esp32/all" # store the response of URL response = urlopen(url) arrData = [] # storing the JSON response # from url in data data_json = json.loads(response.read()) for i in range(len(d...
Monest-eco/Tools
graphData/allData.py
allData.py
py
434
python
en
code
0
github-code
6
6836155009
# -*- coding: utf-8 -*- from windows import DSFWindow, PlateResWindow from epyparser import viia_parser, exparser from matplotlib.pyplot import figure, show from optim import linmelt from scipy import array, sqrt import csv def info(args): if args.csv_wells is not None: well_info = exparser(args.csv_wells,...
pozharski/epydsf
dsfactions.py
dsfactions.py
py
5,760
python
en
code
0
github-code
6
32628905214
from odoo import models, fields,api class NticCherifProduct(models.Model): _inherit = "sn_sales.product" displayed_tags = fields.Text(string='List des prix', compute='_compute_displayed_tags') @api.depends('pricelist_item_ids') def _compute_displayed_tags(self): for record in self: ...
soufnet39/ntic-cherif
clients/cherif/models/product.py
product.py
py
582
python
en
code
0
github-code
6
26917994924
"""Crie um programa que vai ler vรกrios nรบmeros e colocar em uma lista. Depois disso, mostre: A) Quantos nรบmeros foram digitados. B) A lista de valores, ordenada de forma decrescente. C) Se o valor 5 foi digitado e estรก ou nรฃo na lista.""" print("\n", "DESAFIO 81".center(60), "\n") lista = list() while True...
mcsilva-dev/Exercicios-Curso-em-Video
ex081.py
ex081.py
py
1,272
python
pt
code
0
github-code
6
3029439171
#!/usr/bin/env python3 import os import csv import sys import matplotlib.pyplot as plt # Get theta values from file (if it exists) def readTheta (thetaFile): theta0 = 0 theta1 = 0 dataFile = "" if os.path.isfile(thetaFile): with open(thetaFile, newline='') as csvfile: spamreader = ...
cclaude42/ft_linear_regression
estimate.py
estimate.py
py
3,472
python
en
code
0
github-code
6
9178811450
MyPoorlyDocumentedInfo = provider() MyFooInfo = provider( doc = "Stores information about a foo.", fields = ["bar", "baz"], ) MyVeryDocumentedInfo = provider( doc = """ A provider with some really neat documentation. Look on my works, ye mighty, and despair! """, fields = { "favorite_food": "A...
bazelbuild/bazel
src/test/java/com/google/devtools/build/skydoc/testdata/provider_basic_test/input.bzl
input.bzl
bzl
570
python
en
code
21,632
github-code
6
37076376474
"""Level Order Traversal""" def level_order_traversal(self): queue = [] current = self.root queue.append(current) while queue: count = len(queue) while count > 0: visited = queue[0] print(visited.data, end=' ') if visited.left: queue.a...
piyush9194/data_structures_with_python
data_structures/trees/traversal/breadth_first_search_traverasl_using_list.py
breadth_first_search_traverasl_using_list.py
py
486
python
en
code
0
github-code
6
32398148937
import os #Make this a module def get_all_filenames_from_location(folder_path): print("json_file_v1 received the folder path: "+folder_path) #initialize returning list filenames = [] #Get a list of all files in the folder files = os.listdir(folder_path) #Print the file names ...
alif666/market-app-v1
json_file_v1.py
json_file_v1.py
py
622
python
en
code
0
github-code
6
30571932153
import asyncio import datetime from queue import PriorityQueue import validators import youtube_dl class Player: queue = asyncio.Queue() # queue = PriorityQueue() play_next_song = asyncio.Event() next_song = None youtube_dl.utils.bug_reports_message = lambda: '' ytdl_format_options = { ...
MKA01/grajdelko
pl/savera/grajdelko/player/Player.py
Player.py
py
3,155
python
en
code
0
github-code
6
30804251376
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait driver = webdriver.PhantomJS() driver.get('http://fund.eastmoney.com/fund.html') page_text = driver.find_element_by_id('pager').find_element_by_xpath('span[@class="nv"]').text page_count = ''.join(filter(str.isdigit, pag...
bobchi/learn_py
14.py
14.py
py
1,125
python
en
code
0
github-code
6
18648883751
#!/usr/bin/env python3.7 import matplotlib matplotlib.use('Agg') import pylab as pl from matplotlib import rc import matplotlib.cm as cm from matplotlib.colors import Normalize rc('text', usetex=True) import numpy as np import numpy.linalg as nl import numpy.random as nr import os.path from numpy import cos, sin imp...
AmFamMLTeam/metric-space-magnitude
src/mobius.py
mobius.py
py
2,198
python
en
code
1
github-code
6
19265168130
import smtplib from email.message import EmailMessage, MIMEPart import time from typing import Tuple class SendAMessage(): def __init__(self,action,msg_body,config,attach=None): self.config = config self.msg_body = msg_body self.attach = attach self.action = action self.set...
netmet1/constellation-node-automation
classes/send_sms_email.py
send_sms_email.py
py
2,744
python
en
code
2
github-code
6
74309704827
import pandas data = pandas.read_csv("weather_data.csv") # print(data["temp"]) Series # print(data) Data-Frame # print(data["temp"].max()) # print(data.condition) # print(data[data.day == "Monday"]) # print(data[data.temp == data.temp.max()].temp) # fahr = (9/5)*(data[data.day == "Monday"].temp)+32 # print(fahr) # Cr...
shuklaritvik06/PythonProjects
Day - 25/main.py
main.py
py
504
python
en
code
0
github-code
6
36261973545
from collections import deque def solution1(graph): queue = deque([(0,0,0)]) n = len(graph) m = len(graph[0]) while queue: x,y,v = queue.popleft() if x>=n or y>=m or x<0 or y<0: continue if graph[x][y] == 1: graph[x][y] += v queue.append((x+1...
hon99oo/PythonAlgorithmStudy
์ด์ฝ”ํ…Œ/DFS_BFS/์˜ˆ์ œ_๋ฏธ๋กœ ํƒˆ์ถœ/solution.py
solution.py
py
1,924
python
ko
code
0
github-code
6
42112403480
from oauth2_provider.models import get_application_model # create oauth application for export-opportunities Application = get_application_model() if Application.objects.count() == 0: Application.objects.create( name='export-opportunities', redirect_uris='http://opportunities.trade.great:8002/expor...
mkieblesz/local-workspace
patches/directory-sso/fixtures/sso_api_clients.py
sso_api_clients.py
py
756
python
en
code
0
github-code
6
22899839710
from evennia import create_object from evennia import DefaultCharacter from evennia.utils.test_resources import EvenniaTest from world import space class TestSpace(EvenniaTest): """ Unit tests for Space. A modification of unit tests for Wilderness Contrib Only minor changes were required to make this ...
QBFreak/SolarWinds-Evennia
world/test_space.py
test_space.py
py
5,129
python
en
code
1
github-code
6
17308026422
#!/usr/bin/python3 import collections import fileinput import functools import heapq import itertools import math import re import sys rps = { 'A': 'rock', 'B': 'paper', 'C': 'scissors', } loseto = { 'rock': 'scissors', 'paper': 'rock', 'scissors': 'paper', } defeats = {v: k for k, v in loset...
zmerlynn/advent-of-code
2022/d02p2.py
d02p2.py
py
890
python
en
code
0
github-code
6
28199024080
import logging import os import json from flask import Flask from flask_ask import Ask, request, session, question, statement import datetime as DT os.system('sh transactions.sh > output.json') data = json.load(open('output.json')) app = Flask(__name__) ask = Ask(app, "/") logging.getLogger('flask_ask').setLevel(logg...
Interplay/HoyaHacks-18
main.py
main.py
py
6,607
python
en
code
0
github-code
6
21379769063
import test, gui, wx, config from unittests import dummy from domain import task, effort, category class ViewerContainerTest(test.wxTestCase): def setUp(self): self.settings = config.Settings(load=False) self.taskList = task.sorter.Sorter(task.TaskList(), settings=self.settings) ...
HieronymusCH/TaskCoach
branches/Release0_62_Branch/taskcoach/tests/unittests/guiTests/ViewerContainerTest.py
ViewerContainerTest.py
py
928
python
en
code
2
github-code
6
34084281401
from rc.resources.apps.scrape.loader import GenericLoader from rc.resources.apps.education.models import AcademicCenter, \ AcademicCenterType from rc.resources.apps.education.models import CampusSustainabilityCourseTeacher from rc.resources.apps.education.models import StudyAbroadProgram from aashe.organization.mo...
AASHE/django-irc
rc/resources/apps/scrape/loader/education.py
education.py
py
4,212
python
en
code
0
github-code
6
31490583356
from django.contrib.auth import authenticate, login from django.contrib.auth import logout from django.shortcuts import render, redirect from django.http import JsonResponse import PathFinder.PathFinderModels.pathfinder_chat_bot as qamodel from langchain.vectorstores import Pinecone from langchain.embeddings.open...
Susa0823/PathFinderProject
PathFinder/PathFinderApp/views.py
views.py
py
16,953
python
en
code
0
github-code
6
37974761109
''' Not a true display, but a stub for directly running applications from the menu Designed for Light Demos Generic classs customize by the config file and main_menu setup Author: Howard Webb Date: 2/28/2021 ''' from exp import exp from Exp_Util import save from Client import SocketClient from variables import UP, DOW...
webbhm/GBE-Digital
python/Display_Run.py
Display_Run.py
py
1,932
python
en
code
1
github-code
6
4669064041
from Bio.Seq import Seq with open('rosalind_ba1b.txt') as file: text = file.readline().rstrip() k = int(file.readline().rstrip()) def get_pattern_count_dict(text, length=3): pattern_dict = {} seq = Seq(text) for i in range(len(text) - length + 1): pattern = text[i:i + length] if p...
Partha-Sarker/Rosalind-Problems
Lab Assignment - 1/chapter 1/ba1b Find the Most Frequent Words in a String.py
ba1b Find the Most Frequent Words in a String.py
py
987
python
en
code
0
github-code
6
2207915794
import unittest from util.env_pool import * class TestEnvPool(unittest.TestCase): def setUp(self): self.ep = EnvPool("Pong", 2) def tearDown(self): self.ep.close() def test_reset_state(self): obs = self.ep.reset() obs_, reward, done, info = self.ep.step([1, 2]) se...
Seraphli/gym-rl
test/test_env_pool.py
test_env_pool.py
py
475
python
en
code
0
github-code
6
33378605635
""" 1. construct the head by taking all the starting string before first *, then check if there is a string that can satisfy all 2. construct tail using strings after last * 3. take all leftovers (between first * and last *) and put them, in any order of rules, from left to right. 4. Profit? """ if __name__ == "__main...
shstan/codejam_1a_2020
pattern_matching.py
pattern_matching.py
py
1,428
python
en
code
0
github-code
6
30916279052
import smtplib file = "students.txt" students = {} with open(file, "r") as f: for line in f: data = line.strip().split(",") email = data[0] name = data[1] surname = data[2] points = int(data[3]) if len(data) > 4: grade = int(data[4]) status =...
opaciorkowski/ppy5
main.py
main.py
py
2,649
python
en
code
0
github-code
6
13389188618
from __future__ import print_function import torch import torchvision from torchvision import transforms import torch.nn as nn import torch.nn.functional as F from torchvision import models class Vgg16c(torch.nn.Module): def __init__(self): super(Vgg16c, self).__init__() vgg_pretrained...
jhilikb/NLBM
model/vgg_nlbm_cuhk.py
vgg_nlbm_cuhk.py
py
7,190
python
en
code
0
github-code
6
43263411443
def plot_data_with_fit(data, fit_curve, format_x, format_y): import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as mp mp.title('Final Curve Plot') format_x format_y plt.scatter(data[0],data[1], label='Data', s=1,) plt.plot(fit_curve[0],fit_curve[1], ...
UW-ParksidePhysics/Delgado-Omar
plot_data_with_fit.py
plot_data_with_fit.py
py
352
python
en
code
0
github-code
6
42360574813
# Using Python 3 # https://open.kattis.com/problems/mountainbiking from math import pow from math import cos from math import radians from math import sqrt N, gravity = input().split(' ') N = int(N) gravity = float(gravity) seg = [] for _ in range(N): dist, angle = input().split() dist = float(dist) an...
Resethel/Kattis
Problems/mountainbiking/Python3/mountainbiking.py
mountainbiking.py
py
569
python
en
code
1
github-code
6
26008064699
import json from pathlib import Path def get_average_mark_student(student): overall_mark = 0 for mark in student: if mark in subjects: overall_mark += student[mark] student['average'] = overall_mark / len(subjects) return student # return student report card with added average mar...
1lubo/Student-Performance
main.py
main.py
py
2,482
python
en
code
0
github-code
6
580231828
# ะะฐะฟะธัะฐั‚ัŒ ัะฒะพะน ะธั‚ะตั€ะฐั‚ะพั€(ั€ะตะฐะปะธะทะพะฒะฐั‚ัŒ ัƒ ะฝะตะณะพ ะธ ะผะตั‚ะพะด __next__ ะธ __iter__), # ั‡ั‚ะพะฑั‹ ะฟั€ะธ ะพะฑั…ะพะดะต ั†ะธะบะปะพะผ ะพะฝ ะพั‚ะดะฐะฒะฐะป ั‚ะพะปัŒะบะพ ัะปะตะผะตะฝั‚ั‹ ะฝะฐ ั‡ะตั‚ะฝั‹ั… ะธะฝะดะตะบัะฐั…, ะฒะพะทะฒะตะดะตะฝะฝั‹ะต ะฒ ะบะฒะฐะดั€ะฐั‚. class MyIterator: def __init__(self, collection, cursor=-1): self._collection = collection self._cursor = cursor def __iter_...
MrDumper/Roma
14.2HW.py
14.2HW.py
py
874
python
ru
code
0
github-code
6
15757093517
from flask import Flask, request, abort import os import face_detect as f # face_detect.py import base64 from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import ( MessageEvent, TextMessage, TextSendMessage, ImageMessage #ImageMes...
kentamseisyou/myahutest
main.py
main.py
py
2,201
python
en
code
0
github-code
6
28075967300
import numpy as np import matplotlib matplotlib.use("Qt5Agg") print("BACKEND: ", matplotlib.get_backend()) from matplotlib import pyplot as plt import utility as ut import network as nt from tqdm import tqdm as tqdm import plot as pt delta_T = 1e-3 # bars spiking_input = False dim = 8 n_outputs = 2*dim n_inputs = dim...
zimmerrol/spiking-bayesian-networks
bars_binary.py
bars_binary.py
py
1,960
python
en
code
6
github-code
6
13415308592
from pickletools import uint8 import time import numpy as np from onnxruntime import InferenceSession import cv2 import numpy as np # ๅŠ ่ฝฝONNXๆจกๅž‹ sess = InferenceSession('output.onnx') image = cv2.imread('38.jpg') image=cv2.resize(image,(1024,512)) cv2.normalize(image,image,0,255,cv2.NORM_MINMAX) #print(image) image=ima...
Tommy-Bie/Logistics-Package-Separation-Software
DatasetUtils/test.py
test.py
py
763
python
en
code
1
github-code
6
38029553646
# ๅˆ†ๆ•ฐ/ๆฆ‚็އ่ง†ๅ›พ from rest_framework import generics, filters, status from rest_framework.response import Response from ..models import User, Score, Probability, Question, History, Detail from ..serializer.results import ScoreSerializer, ProbabilitySerialzer from ..serializer.history import HistorySerializer, DetailSerializer...
Frank-LSY/LungCancerModel
back/lungcancer/polls/view/results.py
results.py
py
3,205
python
en
code
0
github-code
6
74286785467
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: res=ListNode() #This made a ...
aameen07/Leetcode_Solutions
0021-merge-two-sorted-lists/0021-merge-two-sorted-lists.py
0021-merge-two-sorted-lists.py
py
1,118
python
en
code
0
github-code
6
20206845666
def eelarve(kรผlalised): rent = 55 summa = kรผlalised * 10 + rent return summa tulijad = 0 ma_ei_tea_inimesed = 0 file = open(input("Sisestage failinimi: "), "r") for line in file: for char in line: if char == "+": tulijad += 1 elif char == "?": ma_ei_tea_inimese...
Ax-SylvesterHommuk/proge_alused
Praks 1/7.4 Tรคiendatud peo eelarve.py
7.4 Tรคiendatud peo eelarve.py
py
584
python
en
code
0
github-code
6
71484315388
N, K = map(int, input().split()) mod = 10**9+7 def inv(x): return pow(x, mod-2, mod) def nCk(n, k): ret = 1 for i in range(k): ret *= n-i ret %= mod ret *= inv(i+1) ret %= mod return ret def nHk(n, k): return nCk(n+k-1, k-1) if N <= K: gs, gl = K % N, N - K % N ...
knuu/competitive-programming
atcoder/arc/arc039_b.py
arc039_b.py
py
387
python
en
code
1
github-code
6
70267336189
import config from epyk.core.Page import Report # Create a basic report object page = Report() page.ui.text("#This is a text", options={"markdown": True}) page.ui.button("This is a test").click([ page.js.alert("test") ]) page.outs.publish(server="node", app_path=config.OUTPUT_PATHS_LOCALS_TS, module=config.OUT_F...
epykure/epyk-templates
web/app_nodejs.py
app_nodejs.py
py
328
python
en
code
17
github-code
6
26377974734
def partial_sums(*numbs): numbs = list(numbs) if numbs == []: return [0] default = [0, numbs[0]] if len(numbs) == 1: return default result = [] for i in range(2, len(numbs) + 1): result.append(sum(numbs[:i])) result = default + result return result
tatanaratko/python
Yandex.Lyceum/partial_sums.py
partial_sums.py
py
309
python
en
code
0
github-code
6
3578850080
filepath = 'input.txt' lines = [] with open(filepath) as fp: line = fp.readline() while line: lines.append(line) line = fp.readline() print(len(lines)) total = 0 for n in lines: num = int(n) num = int(num/3) num = num - 2 if(int(num/3) -2 > 0): test = int(num/3) -2 ...
Sami1309/adventofcode
day1.py
day1.py
py
440
python
en
code
0
github-code
6
7074661101
import pandas as pd import pandas_datareader as web import matplotlib.pyplot as plt import datetime as dt start = dt.datetime(2021,1,1) end = dt.datetime.now() ticker_symbol = input('Enter the stock ticker which you wish to analyse: ') data = web.DataReader(ticker_symbol, 'yahoo', start, end) #print(data) delta = ...
amanpanditap/Python_Projects
finance_python/technical_stock_analysis/technical_stock_analysis.py
technical_stock_analysis.py
py
2,507
python
en
code
3
github-code
6
72231186747
from __future__ import print_function, division, unicode_literals import os import yaml from pymatgen.io.vasp.inputs import Kpoints, Incar from pymatgen.io.vasp.outputs import Vasprun import twod_materials.utils as utl from pymatgen.matproj.rest import MPRester from monty.serialization import loadfn import twod_ma...
ashtonmv/twod_materials
twod_materials/pourbaix/startup.py
startup.py
py
9,663
python
en
code
18
github-code
6
23978857817
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def compute_dct_coeffs(blockSize): T = np.zeros((blockSize, blockSize)) T[0, :] = np.sqrt(1.0/blockSize) for i in range(1, blockSize): for j in range(blockSize): T[i][...
vince-robin/Image-compression
soft/functions/dct.py
dct.py
py
3,672
python
en
code
2
github-code
6
39839888743
#!/usr/bin/python3 """ script that fetches https://alx-intranet.hbtn.io/status """ import urllib.request with urllib.request.urlopen("https://alx-intranet.hbtn.io/status") as response: data = response.read() decoded = str(data.decode("utf-8")) t = type(data) p1 = "Body response:\n\t- type:" ...
George-9/alx-higher_level_programming
0x11-python-network_1/0-hbtn_status.py
0-hbtn_status.py
py
446
python
en
code
0
github-code
6
18886739040
import re import ast from tkinter import Tk, Button, Text, Scrollbar, END from pathlib import Path from retroperm.project import RetropermProject from retroperm.rules import Rule from retroperm.rules.filesystem_rule import FilesystemRule from retroperm.rules.ban_library_function_rule import BanLibraryFunctionRule from...
SpiritSeal/retroperm
ui/gui2.py
gui2.py
py
3,484
python
en
code
0
github-code
6
74918964666
import re from collections import defaultdict XMIN = -2 def find(rules,current): if len(current) < 5: return "" if current in rules: return rules[current] elif len(current) == 5: return "." else: size = len(current) left=find(rules,current[0:size-1]) rig...
aarroyoc/advent-of-code-2018
python/day12/day12_2.py
day12_2.py
py
1,670
python
en
code
1
github-code
6
8747023453
# -*- coding: utf-8 -*- """ Created on Fri Jul 19 13:34:12 2019 @author: ADMIN """ import AllFunctions as af import pandas as pd import numpy as np import pandas_profiling #import H2OHandler as hh df=pd.read_csv('train.csv') orgCC = df['cc_cons'].copy() df['isTrain']=True df2=pd.read_csv('test.csv') df2['isTrain']=...
kinjaldand/MLProjects
CreditCardConsumptionPatternAMEX/InitialExplore.py
InitialExplore.py
py
10,737
python
en
code
0
github-code
6
39907609427
""" ============================ Project: python_class Author:ๆŸ ๆชฌ็ญ-Tricy Time:2021/8/14 19:19 E-mail:3247119728@qq.com Company:ๆน–ๅ—้›ถๆชฌไฟกๆฏๆŠ€ๆœฏๆœ‰้™ๅ…ฌๅธ Site: http://www.lemonban.com Forum: http://testingpai.com ============================ """ ''' ๅญ—ๅ…ธ๏ผš-- dict -{} --้‡่ฆ 1ใ€ๅ…ƒ็ด ๏ผš ๅคšไธช้”ฎๅ€ผๅฏน key ๏ผš value 2ใ€ไฝฟ็”จๅœบๆ™ฏ๏ผšไป€ไนˆๆ—ถๅ€™้œ€่ฆไฝฟ็”จๅญ—ๅ…ธไฟๅญ˜ๆ•ฐๆฎ๏ผŸ -- ๅฑžๆ€งๅๅญ—-ๅฑžๆ€งๅ€ผ == ...
GDSDvzz/vzz_01
pythonc/lesson_03.py
lesson_03.py
py
7,037
python
zh
code
0
github-code
6
17868781057
# How to Hit Inaccurate Text with a Vector (Arrow) ! from manimlib.imports import * class HittingInaccurateText(Scene): def construct(self): vector = Vector(3 * RIGHT) runtime = 5 parts = 300 part = 0 theta = 0 while part <= parts: self.play(Rotating(v...
tinfungster/My_Animations
HittingInaccurateText.py
HittingInaccurateText.py
py
695
python
en
code
1
github-code
6
45342937416
import torch import numpy as np import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F from torch.autograd import Variable from allennlp.modules.augmented_lstm import AugmentedLstm from allennlp.modules.input_variational_dropout import InputVariati...
makyr90/DL_Syntax_Models
Biaffine_parser_PyTorch/char_lstm.py
char_lstm.py
py
4,586
python
en
code
2
github-code
6
70571557627
'''Auxiliary functions''' import numpy as _np import pandas as _pd def update_mindex(dataframe, lvl_name,loc=0,axis=1): '''Inserts a level named as lvl_name into dataframe df in loc position. Level can be inserted either in columns (default axis=1) or index (axis=0)''' mindex_df = dataframe.columns if axi...
aaronhammondgagovau/ginan
scripts/gn_lib/gn_aux.py
gn_aux.py
py
1,941
python
en
code
0
github-code
6
5510824333
from detectron2.engine import DefaultPredictor from detectron2.config import get_cfg import cv2 import numpy as np from detectron2 import model_zoo cfg = get_cfg() cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")) cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 cfg.MODEL.WEIGHTS...
hoainv99/mc-ocr
modules/image_segmentation/predict.py
predict.py
py
1,630
python
en
code
26
github-code
6
74934799227
def cal(s, d): m = min(s) t = '' i = s.index(m) if(m < d): t += m + d * i s = s[i + 1::] else: s = [] return s, t # print(i) # print(min(s)) for _ in range(int(input())): n,d = [x for x in input().split()] s = list(n) # print(s) ans = [] ans_final = '' while(len(s) > 0): # print(s) s, t = cal(s...
Chhekur/codechef-solutions
MARCH19B/CHDIGER.py
CHDIGER.py
py
592
python
en
code
1
github-code
6
70211689149
from math import sqrt from os import system """ ะ’ะฐั€ั–ะฐะฝั‚ 29 ะ”ะปั ะทะฐะดะฐะฝะพะณะพ ะฝะฐั‚ัƒั€ะฐะปัŒะฝะพะณะพ ั‡ะธัะปะฐ n ะพะฑั‡ะธัะปะธั‚ะธ """ sum = 0 n = int(input('ะ’ะฒะตะดั–ั‚ัŒ ะบั–ะปัŒะบั–ัั‚ัŒ ั‡ะปะตะฝั–ะฒ n: ')) # ะ’ะฒะตะดะตะฝะฝั ะบั–ะปัŒะบะพัั‚ั– ั‡ะปะตะฝั–ะฒ if n < 1: # ะŸะตั€ะตะฒั–ั€ะบะฐ ะบั–ะปัŒะบะพัั‚ั– ั‡ะปะตะฝั–ะฒ ะฝะฐ ะฝะฐั‚ัƒั€ะฐะปัŒะฝั–ัั‚ัŒ print('ะงะธัะปะพ n ะฝะต ะผะพะถะต ะฑัƒั‚ะธ ะผะตะฝัˆะธะผ ะทะฐ 1') exit(0) for i i...
Compich/KPI-FICT
ะžัะฝะพะฒั‹ ะฟั€ะพะณั€ะฐะผะผะธั€ะพะฒะฐะฝะธั/1 ะบัƒั€ั/ะ›ะฐะฑะพั€ะฐั‚ะพั€ะฝะฐั ั€ะฐะฑะพั‚ะฐ โ„–4/Python/main.py
main.py
py
756
python
uk
code
0
github-code
6
39508101385
import numpy as np import matplotlib.pyplot as plt baseline = np.loadtxt('sub-AD4009_ses-baseline_acq-AP_date-2011-07-07_trc-av45_pet.csv', delimiter=',') followup = np.loadtxt('sub-AD4009_ses-followup_acq-AP_date-2013-07-03_trc-av45_pet.csv', delimiter=',') prediction = followup + np.random.normal(0, .025, size=foll...
SanoScience/MP-spreading-prediction
pictures/Graphical_abstract/plot.py
plot.py
py
1,090
python
en
code
4
github-code
6
5683288254
import torch.nn as nn from torch.nn.parameter import Parameter import torch import torch.nn.functional as F class DNN(nn.Module): def __init__(self, n_input, n_hidden, n_output, real): super(DNN, self).__init__() self.loss = 0 self.hidden1 = nn.Linear(n_input, n_hidden, True) ...
asd1354403003/NON
DNN.py
DNN.py
py
637
python
en
code
0
github-code
6
73558579389
import re import math def bigram_letter_count(text): bigram_letter = re.findall(r'(?=(\w{2}))', text) bigram_letter_count = {} for item in bigram_letter: if item in bigram_letter_count: bigram_letter_count[item] += 1 else: bigram_letter_count[item] = 1 return bi...
bs-feng/GWU_NLP_2017Fall
hw2/letterLangld.py
letterLangld.py
py
3,087
python
en
code
0
github-code
6
38710107620
from discord_slash import cog_ext from discord.ext import commands from txns import get_wallet import asyncio from embeds import * import discord import pytz from datetime import datetime import random from client import client from txns import * from whitelist import ghosts, ghostsIcons, fo_rank1, fo_rank2, fo_rank3, ...
AngelsOfAres/Fallen-Order-Keepers
c_heimdall/transfers.py
transfers.py
py
32,658
python
en
code
1
github-code
6
12026015047
import pygame # Global Consts # Colors BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) BLUE = ( 0, 0, 255) RED = ( 255, 0, 0) GREEN = ( 0, 255, 0) SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 class Player(pygame.sprite.Sprite): # -- Attribute # Set speed vector change_x = 0...
danielp28/Python-Testing
platformer.py
platformer.py
py
8,838
python
en
code
0
github-code
6
30324581341
import os, sys, re, pickle, json import numpy as np import cv2 import pandas as pd def get_seq(seq_dir, seq_name): seq_file = seq_dir + "/" + seq_name + ".pkl" seq = pickle.load(open(seq_file, "rb"), encoding='latin1') return seq def get_3dkeypoints(seq, frame_id, model_id): """ SMPL joints ...
egirgin/occlusionIndex
3dpw/src/utils.py
utils.py
py
4,338
python
en
code
0
github-code
6
21253269122
from django.urls import path from .views import TagContentView #ๅฏผๅ…ฅTagContentView from .views import XieyiConfigDateView from .views import NodeConfigMakeDevRequest,NodeConfigCopyRequest,NodeConfigReadAndSaveRequest,NodeConfigDeleteRequest from .views import XieyiConfigDateOrderView,XieyiTestCaseView,SenderHexDataOrd...
wawj901124/shangbaogongju
apps/shucaiyidate/urls.py
urls.py
py
3,118
python
zh
code
0
github-code
6
6428170708
# File: LangChainchatOpenAI.py # Author: Denys L # Date: October 8, 2023 # Description: import os import sys import hashlib from typing import Any import streamlit as st from dotenv import load_dotenv from langchain.callbacks.base import BaseCallbackHandler from fundamentals.langchain_utils import StuffSummarizerByCh...
lyepustin/bookNLP
app.py
app.py
py
2,293
python
en
code
0
github-code
6
71723953788
# coding:utf-8 import datetime from sqlalchemy import Column, Integer, DateTime, Numeric, create_engine, VARCHAR from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from config import DB_CONFIG, DEFAULT_SCORE ''' sqlๆ“ไฝœ็š„ๅŸบ็ฑป ๅŒ…ๆ‹ฌip๏ผŒ็ซฏๅฃ๏ผŒtypes็ฑปๅž‹(0้ซ˜ๅŒฟๅ๏ผŒ1้€ๆ˜Ž)๏ผŒprotocol(0 http,1 https ht...
xindemeng/python-projects
jd_spider/jd_spider/db/SqlHelper.py
SqlHelper.py
py
6,761
python
en
code
0
github-code
6
18100621514
""" 1971. Find if Path Exists in Graph https://leetcode.com/problems/find-if-path-exists-in-graph/ """ from typing import List, Tuple from unittest import TestCase, main class UnionFind: def __init__(self, n: int) -> None: self.root = list(range(n)) def find(self, a: int) -> int: """Returns t...
hirotake111/leetcode_diary
leetcode/1971/solution.py
solution.py
py
2,023
python
en
code
0
github-code
6
24177027496
import pygame from pygame.locals import * class MyPlane(pygame.sprite.Sprite): def __init__(self,bg_size, screen): pygame.sprite.Sprite.__init__(self) self.screen = screen self.image1 = pygame.image.load('../img/hero1.png').convert_alpha() self.image2 = pygame.image.load('../img/he...
daniel-yaoyuan/paperplane
src/hero.py
hero.py
py
4,088
python
en
code
0
github-code
6
23138969943
import argparse from random import sample def load_data(fr_file,fw_file): all_users = [] all_moives = [] for lines in fr_file: if lines.startswith('i'): all_moives.append(lines.replace('\n','')) if lines.startswith('u'): all_users.append(lines.replace('\n','')) ...
55TFSI/RKGE
all_paths.py
all_paths.py
py
1,138
python
en
code
0
github-code
6
10909511760
from datetime import datetime from settings import ORDER_TTL, TCS_ACCOUNT_ID from tinkoff.invest import OrderDirection, OrderType from tinkoff.invest.schemas import StopOrderDirection as SODir from tinkoff.invest.schemas import StopOrderExpirationType as SType from tinkoff.invest.schemas import StopOrderType as SOType...
holohup/trademan-1.0-alpha-public
bot/tools/adapters.py
adapters.py
py
3,580
python
en
code
2
github-code
6
27597631498
import math def coinSums(coins, target): coins.sort(reverse=True) if(len(coins) == 1): if(target % coins[0] == 0): return 1 else: return 0 c = coins[0] del coins[0] newCoinSum = 0 for i in range(0, math.floor(target/c)+1): newtarget = target-i*c ...
AbhishekVangipuram/ProjectEuler
031.py
031.py
py
454
python
en
code
0
github-code
6
75112397948
from flask import Flask, render_template, request, redirect, url_for import requests app = Flask(__name__) @app.route("/", methods=["GET", "POST"]) def index(): try: nom = request.form['NOM'] prenom = request.form['PRENOM'] email = request.form['EMAIL'] return redirect(url_for(".t...
Foodjubi/fortnite-news
app.py
app.py
py
4,379
python
en
code
0
github-code
6
34528771620
# https://medium.com/javarevisited/the-ultimate-guide-to-binary-trees-47112269e6fc # There are two ways check both #udacity course way class Node(object): def __init__(self, value): self.value = value self.left = None self.right = None class BinaryTree(object): def __init__(self, ...
ved93/PythonPractice
data-strutures/binary_tree.py
binary_tree.py
py
3,507
python
en
code
0
github-code
6
37366648878
import configparser working_dir_list = ['./examples/test-ex1-50d/', './examples/test-ex2'] task_name_list = ['example 1', 'example 2'] task_id = 1 conjugated_eigvec_flag = 0 with_FVD_solution = False #with_FVD_solution = True working_dir_name = working_dir_list[task_id] task_name = task_name_list[task_id] # read p...
zwpku/EigenPDE-NN
plot_scripts/common.py
common.py
py
954
python
en
code
3
github-code
6
34042177473
import datetime import logging from django.contrib import auth from django.http import HttpResponseRedirect, HttpResponseNotFound from django.utils.translation import check_for_language from django.shortcuts import render from blueapps.account.components.bk_token.forms import AuthenticationForm from gcloud.core.signa...
caiyj/bk-sops
gcloud/core/views.py
views.py
py
2,776
python
en
code
null
github-code
6
38870006486
import gym import tensorflow as tf from tensorflow import keras import random import numpy as np import datetime as dt import imageio import os # # conda activate tf # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/ # conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0 # o pip install tensorflow # p...
nhovadia/CSCI4830_final_project
SpaceInvaders_Training.py
SpaceInvaders_Training.py
py
21,331
python
en
code
0
github-code
6
410815561
from typing import Tuple import jax import jax.numpy as jnp import jax.scipy.linalg as linalg from numpy.typing import ArrayLike def transition_function(F: jnp.array, u: jnp.array, L: jnp.array, h: float, n_linspace=10000) -> Tuple[ ArrayLike, ArrayLike, ArrayLike]: r""" A prior of the form \...
hallelujahylefay/bayesianSDEsolver
bayesian_sde_solver/ode_solvers/probnum/transition_function.py
transition_function.py
py
1,114
python
en
code
0
github-code
6
17689667482
import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") no_resBlocks = 16 HR_shape = 96 train_data_path = '../data/train' val_data_path = '../data/val' advLossFactor = 0.001 VGGLossFactor = 0.006 mse_lr = 0.0001 mse_epochs = 700 initial_lr = 0.0001 second_lr = 0.00001 gan_epochs = 140 batch_...
abed11326/Training-a-Super-Resolution-GAN-for-4x-image-upscaling
hypParam.py
hypParam.py
py
365
python
en
code
0
github-code
6
5390277363
class Node: def __init__(self, val): self.val = val self.next = None root = Node(10) tempNode = root import numpy as np for i in np.random.randint(0,100,[10]): tempNode.next = Node(i) tempNode = tempNode.next print(i) stack = [] print("") while root: stack.append(root) root...
JarvisFei/leetcode
ๅ‰‘ๆŒ‡offerไปฃ็ /ๆ•ฐๆฎ็ป“ๆž„/้ข่ฏ•้ข˜6:ไปŽๅคดๅˆฐๅฐพๆ‰“ๅฐ้“พ่กจ.py
้ข่ฏ•้ข˜6:ไปŽๅคดๅˆฐๅฐพๆ‰“ๅฐ้“พ่กจ.py
py
388
python
en
code
0
github-code
6
34658203548
from math import exp def Newton2(f, dfdx, x0, max_it=20, tol= 1e-3): f0 = f(x0) iter = 0 while abs(f0) > tol and iter < max_it: x1 = x0 - f0/dfdx(x0) x0 = x1 f0 = f(x0) iter += 1 converged = iter < max_it return x0, converged, iter #call the method for f(x)= x**2-4...
sundnes/python_intro
docs/src/chapter4/Newton2.py
Newton2.py
py
612
python
en
code
5
github-code
6
5503967408
# https://www.hackerrank.com/challenges/py-the-captains-room/problem k = int(input()) array = list(map(int, input().split())) frequencies = dict() for element in array: frequencies[element] = (frequencies[element] if element in frequencies else 0) + 1 for key in frequencies: if frequencies[key] == 1: ...
Nikit-370/HackerRank-Solution
Python/the-captains-room.py
the-captains-room.py
py
347
python
en
code
10
github-code
6
9174066290
load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", "find_vc_path", "setup_vc_env_vars") load("@bazel_tools//tools/cpp:cc_configure.bzl", "MSVC_ENVVARS") # Keys: target architecture, as in <Windows-SDK-path>/<target-architecture>/bin/rc.exe # Values: corresponding Bazel CPU value under @platforms//cpu:* _TARGET_A...
bazelbuild/bazel
src/main/res/winsdk_configure.bzl
winsdk_configure.bzl
bzl
3,643
python
en
code
21,632
github-code
6
35004221053
def solution(word): seq = {'E': 1, 'I': 2, 'O': 3, 'U': 4} res = 0 for i in range(len(word)): char = word[i] if char == 'A': res += 1 continue for j in range(4, i, -1): res += (5 ** (j-i)) * seq[word[i]] res += seq[word[i]] + 1 ret...
Inflearn-everyday/study
SimEunJu/programmers/๋ชจ์Œ์‚ฌ์ „.py
๋ชจ์Œ์‚ฌ์ „.py
py
328
python
en
code
5
github-code
6
30341447680
count = 0 n = int(input()) for i in range(0,n): a, b, c = input().split() if int(a) + int(b) + int(c) >= 2: count += 1 else: continue print(count)
rakbidb/meng-CP
Codeforces/Python/Problem A/Difficulty 800/Solved/231A-Team.py
231A-Team.py
py
177
python
en
code
0
github-code
6
14712071511
from fastapi import APIRouter, Header from fastapi.exceptions import HTTPException from client import get_ccxt_client router = APIRouter() @router.get("/info/") async def list_markets(x_connection_id: str = Header()): try: client = get_ccxt_client(x_connection_id) return client.load_markets() ...
masked-trader/raccoon-exchange-service
src/server/routes/market.py
market.py
py
2,242
python
en
code
0
github-code
6
42435364768
import threading import time import PySimpleGUI as sg import psutil from pathlib import Path import subprocess def is_running(process_name): running = False for proc in psutil.process_iter(): if process_name in proc.name(): running = True break return running def the_thre...
activatedtmx/GTAV-Auto-DLL-Injector
injector.py
injector.py
py
5,140
python
en
code
1
github-code
6