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
29813985214
#!/usr/bin/python ### MADE BY SUDHANSH AGGARWAL from datetime import datetime from time import strftime #noreps makes sure there are no repeated IDs def no_reps(group,id_, flag): if flag !=1 and flag !=2: return False else: if id_ in group: return True return False #Retur...
basilmajdi/SSW555-PatRobSud
SSW_555/sudhansh.py
sudhansh.py
py
1,491
python
en
code
0
github-code
90
72442525416
__author__ = 'colin' import openerp.tests class TestBrowserRender(openerp.tests.HttpCase): # test score calculation ajax def test_browser_render(self): test_code = 'if(d3.version == "3.3.9" && $("#chart").has("svg").length == 1){ console.log("ok"); }else{ console.log("error"); }'; self.phan...
LiberTang0/odoo-temp
phantomjs_pdf/tests/test_browser_render.py
test_browser_render.py
py
399
python
en
code
0
github-code
90
33457888804
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right from typing import List, Optional class Solution: def buildTree(self, preorder: List[int], inorder: List[int]) -> Optional[TreeNode]: d...
Samuel-Black/leetcode
construct-binarytree-from-preorder-and-inorder-traversal.py
construct-binarytree-from-preorder-and-inorder-traversal.py
py
1,123
python
en
code
0
github-code
90
34060465096
print('''######################## ##Lista composta e análise de dados## ########################''') print('→←'*20) print() lista = [[],[]] lPl = [] lPp = [] while True: nome = str(input('Digite o nome: ')).capitalize() peso = float(input(f'Digite o peso da {nome}: ')) per = str(input('Quer continuar? '))....
dougfunny1983/Hello_Word_Python3
ex084.py
ex084.py
py
851
python
pt
code
0
github-code
90
27089130958
from spack import * class Antlr(AutotoolsPackage): """ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR gener...
matzke1/spack
var/spack/repos/builtin/packages/antlr/package.py
package.py
py
1,285
python
en
code
2
github-code
90
18452676219
import sys from heapq import heappush, heappop from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: map(int, readline().split()) in_nl = lambda: list(map(int, readline().split())) in_na = lambda: map(int, read().split()) i...
Aasthaengg/IBMdataset
Python_codes/p03141/s320282422.py
s320282422.py
py
747
python
en
code
0
github-code
90
29554572448
from FourInARow import Gamelogic import MCTS import ResNet from FourInARow import Config import os game = Gamelogic.FourInARow() config = Config # Creating the NN h, w, d = game.get_board().shape agent = ResNet.ResNet.build(h, w, d, 128, config.policy_output_dim, num_res_blocks=5) agent2 = ResNet.ResNet.build(h, w, d...
CogitoNTNU/AlphaZero
TestAZ.py
TestAZ.py
py
2,346
python
en
code
15
github-code
90
17488997172
import pandas as pd import numpy as np def get_transposed_combined_df(df_comm, df_stock): frames = [df_comm, df_stock] result = pd.concat(frames) # performing transpose operation to get the stock names as columns combined_transposed=result.transpose() combined_transposed.dropna(axis=0, inplace=Tru...
ruturaj-55/Citibank_hackathon_2022
modules/correlation/correlation.py
correlation.py
py
1,792
python
en
code
1
github-code
90
17694168848
def solution(number1, denom1,number2, denom2): for b in range(min(number1,denom1),0,-1): if number1 % b ==0 and denom1 % b ==0: number1 = number1 // b denom1 = denom1 // b for c in range(min(number2,denom2),0,-1): if number2 % c == 0 and denom2 % c == 0: ...
mini9155/iot-database-2023
memo.py
memo.py
py
604
python
en
code
0
github-code
90
73271043816
from sys import stdin def getPriority(itemset): item = itemset.pop() return ord(item) - 38 if item.isupper() else ord(item) - 96 allelves = ([[*line.strip()] for line in stdin.readlines()]) groupsofelves = list(zip(*(iter(allelves),) * 3)) sum = 0 for group in groupsofelves: x, y, z = group commonitem = (set(x) ...
feliciakri/2022adventofcode
day3/rucksack2.py
rucksack2.py
py
383
python
en
code
0
github-code
90
36830228898
import dpkt import socket import pygeoip import argparse gi = pygeoip.GeoIP('GeoLiteCity.dat') def retGeoStr(ip): try: rec = gi.record_by_name(ip) city = rec['city'] country = rec['country_code3'] if city != " ": geoLoc = city+" , "+country else: ...
Cybervidyapeeth/PGDCD
PPT_Refining_CVP/Chapter-3/georecpcap.py
georecpcap.py
py
1,250
python
en
code
0
github-code
90
70072611177
from script import control_string from script.LEXER import particular_str_selection from script.LEXER import main_lexer from script.LEXER import check_if_affectation from script....
amiehe-essomba/BlackMamba
script/PARXER/INTERNAL_FUNCTION/get_string.py
get_string.py
py
17,170
python
en
code
4
github-code
90
32743446320
#!/usr/bin/python from geometry_msgs.msg import Twist, Vector3 import rospy ############################################ ## MoveBase.py ## ## ## ## Move the base of the Fetch Robot using ## ## a simple ROS publisher ## ## ...
iandevlaming/Fetch_Scripts
Movement_Tutorials/MoveBase.py
MoveBase.py
py
1,939
python
en
code
0
github-code
90
70560439658
import asyncio import discord from discord.ext import commands class Voice(commands.Cog): def __init__(self, bot): self.bot = bot self.queue = [] self.paused = False self.loop = False @commands.command(aliases=["vcjoin"]) async def join(self, ctx: commands.Context, channe...
Fripe070/FripeBot
cogs/voice.py
voice.py
py
3,247
python
en
code
7
github-code
90
31966189730
from hungry_games_classes import * from collections import OrderedDict import random import sys import traceback class GameConfig(object): def __init__(self): self.item_counts = OrderedDict() self.item_factory = DefaultItemFactory self.steps = 100 self.periodic_events = [] def...
mclsun/CS1010X
mission15/engine.py
engine.py
py
9,384
python
en
code
1
github-code
90
36895450563
from flask import Flask, render_template, request app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) # To render Homepage def home_page(): return render_template('index.html') @app.route('/math', methods=['POST']) # This will be called from UI def math_operation(): if (request.method == 'POST...
Nitish55/Calculator_deploy
main.py
main.py
py
2,445
python
en
code
0
github-code
90
71794204457
import numpy as np import matplotlib.pyplot as plt print("Input(0-10):") n=(int(input())) x=np.arange(0,40*n) y=2*np.sin(0.2*np.pi*x)+3*np.sin(0.25*np.pi*x) plt.figure(figsize=(12.8,7.2)) plt.title('3200432102') plt.xlabel('n') plt.stem(x,y) plt.show()
limpuslee/Signals-and-systems
绘制自定义图像.py
绘制自定义图像.py
py
264
python
en
code
0
github-code
90
18380990409
N = int(input()) A = [list(map(int,input().split())) for i in range(N)] A.sort(key = lambda x: x[1]) su = 0 for i in A: su += i[0] if su > i[1]: print("No") exit() print("Yes")
Aasthaengg/IBMdataset
Python_codes/p02996/s513234241.py
s513234241.py
py
200
python
ko
code
0
github-code
90
28820116363
#!/usr/bin/env python import os import sys import json import datetime import matplotlib.pyplot as plt import matplotlib.animation import matplotlib.patches import matplotlib.collections import matplotlib.path import matplotlib.gridspec import seaborn as sns import numpy as np import scipy.misc import glob plt.rc("fo...
mountainpenguin/lineage
lineage/lineage_animation.py
lineage_animation.py
py
10,704
python
en
code
0
github-code
90
29849269940
from selenium import webdriver from bs4 import BeautifulSoup import csv import time import socket import sys import requests class File: # Variables to store filename, old ratings and new ratings respectively # for the File object created. def __init__(self,x): self.file_name = x self.old...
Akshaykoushik06/Codechef-Scraper
main.py
main.py
py
5,315
python
en
code
1
github-code
90
70071901737
# Request related functions import requests headers = { 'User-Agent': "Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36" } def http_request(url, params=None): """ Fetchs url with defined param...
charitra1022/rokardo_api
helper/request_handler.py
request_handler.py
py
639
python
en
code
0
github-code
90
21115598602
import pygame import random import tkinter from tkinter import messagebox import json import itertools from datetime import datetime pygame.init() root = tkinter.Tk() root.withdraw() width = 300 height = 300 # if you want to make the height value and the width value different make sure that # the width height w_rows ...
adam-kabbara/snake
snake ai/main.py
main.py
py
13,282
python
en
code
0
github-code
90
4653011189
#2.2. s = input() suma = 0 # pomoćna varijabla za zbrajanje for i in s: suma += ord(i) # i je znak, funkcija ord vraća ASCII vrijednost znaka print(suma) """ Ovaj zadatak možda predstavlja novi koncept; for i in (niz znakova). Lijeniji mogu zapamtiti da ovo čini da varijabla i poprima vrijednost s...
NadaTheOptimist/zadaci-rjesenja
Informatika/Rjesenja/2-2.py
2-2.py
py
756
python
hr
code
0
github-code
90
41172738937
from django.shortcuts import render from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt from django.core import serializers from django.db import connections, DataError from rest_framework import status from rest_framework.decorators import api_view from rest_framewo...
napatwongchr/python-blog-app
backend/myproject/posts/views.py
views.py
py
2,129
python
en
code
0
github-code
90
13002720078
''' lock의 세배 만큼 배열 만들고 (패딩 배열처럼) key를 4번 회전할 떄 각각 비교해서 판단 이때, 열쇠가 자물쇠와 맞는지는 lock의 빈 공간 개수로 따져주었다. Point! 문제 조건 잘 보기! 열쇠의 돌기와 자물쇠의 돌기가 만나서는 안된다는 조건을 넣지 않아서 계속 틀렸었음. ''' import copy def solution(key, lock): # lock의 3배 배열 가운데에 lock을 넣는다. l = len(lock) locks = [[2] * (l * 3) for _ in range(l)] cnt = 0 f...
hyeinkim1305/Algorithm
Programmers/Level3/Programmers_Level3_자물쇠와 열쇠.py
Programmers_Level3_자물쇠와 열쇠.py
py
1,978
python
ko
code
0
github-code
90
73394251495
import numpy as np matrix = np.array([[20, -150, -250], [150, -80, -100], [250, 100, 40]]) minA= [min(matrix[i]) for i in range (3)] maxA = max(minA) print("Minmax firmy A to", maxA, "dla decyzji nr", minA.index(maxA)+1) maxB= [max(matrix[:,i]) for i in range (3)] ...
ZuzannaMisztal/Badania-Operacyjne
lab08_minimax-master/lab08_minimax-master/game1.py
game1.py
py
409
python
en
code
0
github-code
90
7318868281
import pygame, json, os from content.objects.BrickWall import BrickWall from content.objects.GolfBall import GolfBall from content.objects.GolfHole import GolfHole from content.objects.Pointer import Pointer from content.objects.Win import Win class WorldParser(): def __init__(self, canvas): self.rawData ...
HooferDevelops/Golf
content/modules/WorldParser.py
WorldParser.py
py
1,465
python
en
code
0
github-code
90
18257228889
from sys import stdin, setrecursionlimit from collections import Counter, deque, defaultdict from math import floor, ceil from bisect import bisect_left from itertools import combinations setrecursionlimit(100000) INF = int(1e10) MOD = int(1e9 + 7) def main(): from builtins import int, map N, A, B = map(int, ...
Aasthaengg/IBMdataset
Python_codes/p02754/s146194593.py
s146194593.py
py
527
python
en
code
0
github-code
90
73363754536
#!/usr/bin/env python3 import os import requests from sys import argv token = os.environ['SECRET_KEY'] def create_a_query(com_line_arguments): if len(com_line_arguments) == 1: return 'return API.users.get({"user_ids": API.friends.getOnline()});' elif len(com_line_arguments) > 2: print('Only ...
timuchin51/fun_solutions
api/vk_api.py
vk_api.py
py
1,509
python
en
code
0
github-code
90
31962517958
import os import shutil import pytest from mindspore import context # pylint: disable=W0212 # W0212: protected-access def setup_module(module): context.set_context(mode=context.PYNATIVE_MODE) def test_contex_create_context(): """ test_contex_create_context """ context.set_context(mode=context.PYNATIV...
imyzx2017/mindspore_pcl
tests/ut/python/pynative_mode/test_context.py
test_context.py
py
4,848
python
en
code
5
github-code
90
33195242584
from unittest.mock import MagicMock, Mock import pytest from accounts.factories.user_factory import UserFactory from groups.factories.group_factory import GroupFactory from groups.factories.membership_factory import MembershipFactory from groups.permissions import IsAdminUser, IsBoardMember, IsGroupLeader, IsGroupMem...
NTNUI/koiene-booking-h20
backend/ntnui/apps/groups/tests/test_permissions.py
test_permissions.py
py
4,473
python
en
code
1
github-code
90
30544879738
# Creamos dos listas para guardar los numeros pares y los impares. pares = [] impares = [] # Definimos la funcion: esta itera el largo de la lista de manera que si el resto = 0 el numero sera par. # De lo contrario, el numero sera impar. def separar(lista): for number in range(len(lista)): if lista[nu...
brokensito/Ejs_T1_David_Sanz
ej6.py
ej6.py
py
549
python
es
code
1
github-code
90
5746821521
import cv2 import numpy as np from skimage.measure import ransac from scipy.spatial import cKDTree from constants import * from utils import EssentialMatrixTransform, calc_rt, normalize, add_ones def ext_features(img, max_corners=3000): orb = cv2.ORB_create() pts = cv2.goodFeaturesToTrack(np.mean(img, axis=2...
asceznyk/monoslam
frame.py
frame.py
py
2,638
python
en
code
0
github-code
90
18476862009
from math import factorial from itertools import permutations n=int(input()) np=factorial(n) p_list=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] ans=[] for s,t,u in permutations(p_list,3): num1=(s**4)*(t**4)*(u**2) num2=(s**14)*(t**4) num3=(s**24)*(t**2) num...
Aasthaengg/IBMdataset
Python_codes/p03213/s312003508.py
s312003508.py
py
419
python
en
code
0
github-code
90
40220056605
''' Given a string, if it is a valid roman numeral print True, else print False. ''' thousand = "(?:(M){0,3})?" hundred = "(?:(D?(C){0,3})|(CM)|(CD))?" ten = "(?:(L?(X){0,3})|(XC)|(XL))?" unit = "(?:(V?(I){0,3})|(IX)|(IV))?" regex_pattern = r"^" + thousand + hundred + ten + unit + "$" import re print(str(b...
Algorant/HackerRank
Python/roman_numerals/roman.py
roman.py
py
360
python
en
code
2
github-code
90
5618893346
__author__ = 'Imman Narciso' from time import time import numpy as np """ This Adam's Bashforth method is under the dmcspy.odes While the Euler, and RK methods makes use of singel step methods, or use only a one previous point to compute the next. The Adam's Bashforth method gets two initial points x0, and x1...
ccacoba/cmsc117project
dmcspy/ode/adams_bashfort/methods.py
methods.py
py
1,837
python
en
code
0
github-code
90
70587831338
from bunk import Bunk from counsler import Counsler from person import Person from camper import Camper from allergys import Allergy class Camp: def __init__(self,name, max_bunks) -> None: self.name = name self.max_bunks = max_bunks self.num_bunks = 0 self.bunks = [] self.per...
MiriamMarsh/Guided_Project
OOP/Camp/camp.py
camp.py
py
2,747
python
en
code
0
github-code
90
30751549813
from sys import path path.append("D:/GitHub/astrophy-research/mylib") import numpy from Fourier_Quad import Fourier_Quad import tool_box from plot_tool import Image_Plot from astropy.io import fits order = 5 terms = int((order + 1) * (order + 2) / 2) data_path = "D:/noname/HDtest/" tag = "bkg1537s" img_name = "sourc...
hekunlie/astrophy-research
test/background_removing_test/background_fit.py
background_fit.py
py
2,341
python
en
code
2
github-code
90
18588526599
def main(): s = input() x, y = map(int, input().split()) d = {} d[True] = [] d[False] = [] xf = True t = 0 for i in s: if i == 'F': t += 1 else: d[xf].append(t) xf = not xf t = 0 if t > 0: d[xf].append(t) dpx...
Aasthaengg/IBMdataset
Python_codes/p03488/s715510191.py
s715510191.py
py
813
python
en
code
0
github-code
90
5837463837
num1 = int(input("Enter first number")) num2 = int(input("Enter second number")) #for loop that traverses numbers from 1 to 100 for x in range(num1,num2): #check if number is divisible by both 3 and 5 if(x%3==0 and x%5==0): print(x,"FizzBuzz") #check if number is divisible by 3 elif(x%3 == 0): print(x,"...
SalomeNderu/python-project-nderuh
Quiz/main.py
main.py
py
472
python
en
code
1
github-code
90
74770047335
from tkinter import * from tkinter import ttk import pymysql from tkinter import messagebox class Customer_Info: def __init__(self, root): self.root = root self.root.title("Customer") self.root.geometry("915x440+190+80") #====All Variables===== self.name_var = StringVar()...
naahe25/Python.Project2
MUFoodLab1-main/MUFoodLab1-main/Customer.py
Customer.py
py
10,207
python
en
code
0
github-code
90
19254201915
from sys import stdin, maxsize from copy import deepcopy stdin = open("./input.txt", "r") rows, cols = map(int, stdin.readline().split()) camera_info = [] office = [] for _ in range(rows): office.append(stdin.readline().rstrip().split()) # temp_office = deepcopy(office) answer = [maxsize] def array_copy(array...
ag502/algorithm
Problem/BOJ_15683_감시/main.py
main.py
py
3,347
python
en
code
1
github-code
90
4819199386
#!/usr/bin/env python3 def f(a,c,data = []): a.append('456') c = 100 data.append(a) return data a = ['11','12'] c = 1 print(f(a,c)) print(a,c)
Hide1nBush/shiyanlou
fuc.py
fuc.py
py
156
python
en
code
0
github-code
90
16270736366
from etapa_10 import obtener_constantes #CONSTANTES================================================================================================= CONFIGURACION = obtener_constantes() #FUNCIONES======================================================================================== def leer_archivos(palabras,defini...
LoloBusato/TP1_GrupoMate
Etapa_8.py
Etapa_8.py
py
5,306
python
es
code
1
github-code
90
18130395390
import conftest from qemu import QemuVm def run_ioctl_test(command: str, vm: QemuVm) -> None: conftest.Helpers.run_vmsh_command( [command, str(vm.pid)], cargo_executable="examples/test_ioctls" ) def spawn_ioctl_test(command: str, vm: QemuVm) -> conftest.VmshPopen: return conftest.Helpers.spawn_v...
Mic92/vmsh
tests/test_ioctl.py
test_ioctl.py
py
3,365
python
en
code
100
github-code
90
28720500368
from settings import alarm_threshold, alarm_template from datetime import datetime from logger import app_logger # response_dict["keys_info"] = [ # { # "measurement": "big_keys_info", # "time": int("{0}{1}".format(str(info_create_day_time), "000000000")), # ...
shihuizhen/aliredis_analysis
alarm.py
alarm.py
py
2,759
python
en
code
2
github-code
90
3931593457
import os import pytest from spdx.parsers import parse_anything from spdx.writers import write_anything from tests import utils_test dirname = os.path.join(os.path.dirname(__file__), "data", "formats") test_files = [os.path.join(dirname, fn) for fn in os.listdir(dirname)] UNSTABLE_CONVERSIONS = { "SPDXTagExample...
spdx/OLD-ntia-conformance-checker
tests/test_write_anything.py
test_write_anything.py
py
1,835
python
en
code
0
github-code
90
27282482708
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findTilt(self, root: TreeNode) -> int: if not root: return 0 re...
Nayald/algorithm-portfolio
leetcode/daily challenges/2020-11/08-binary-tree-tilt.py
08-binary-tree-tilt.py
py
647
python
en
code
0
github-code
90
18354499289
S = list(str(input())) T = list(str(input())) S_ = set(list(S)) T_ = set(list(T)) for c in T: if c not in S_: print(-1) exit() d = [[] for _ in range(26)] for i, s in enumerate(S): d[ord(s)-ord('a')].append(i) #print(d) q = 0 pre = -1 import bisect for t in T: j = ord(t)-ord('a') idx ...
Aasthaengg/IBMdataset
Python_codes/p02937/s716492078.py
s716492078.py
py
471
python
en
code
0
github-code
90
13281178119
from controllers.tools import Tools """Player view""" class PlayerView: def __init__(self): self.tools = Tools() self.sexe_list = ['female', 'male', 'not saying' ] def prompt_player_creation(self): """prom...
erikcaul/OC_Projet_4
views/player_view.py
player_view.py
py
2,184
python
en
code
0
github-code
90
72625969576
# __author__: liqinsong # data: 2018/12/9 from urllib import request from urllib import parse # # resp = request.urlopen("http://www.baidu.com") # # print(resp.read()) # request.urlretrieve("http://www.baidu.com", "baidu.html") # url编码 params = { "name": "张三", "age": 18, "greet": "hello world", } resul...
BrandonSong/spider
code/day13/code/demo1.py
demo1.py
py
369
python
en
code
0
github-code
90
912606535
import hydra from loguru import logger import orjson from omegaconf import DictConfig import openai from os import getenv from pathlib import Path from prompt import Prompt import time from tqdm import tqdm from typing import List, Dict, Optional import tiktoken from utils import env_setup, read_jsonl class OpenAIFi...
githubjacky/EPU_denoise
src/models/fine_tune.py
fine_tune.py
py
13,265
python
en
code
0
github-code
90
27312651212
""" Object to represent agents. Here specifically the QOLO-agent""" __author__ = "Lukas Huber" __date__ = "2021-01-17" __mail__ = "lukas.huber@epfl.ch" import os import sys import warnings import numpy as np import matplotlib.image as mpimg from dynamic_obstacle_avoidance.obstacle_avoidance.ellipse_obstacles impor...
hubernikus/dynamic_obstacle_avoidance
dynamic_obstacle_avoidance/agents/agent_qolo.py
agent_qolo.py
py
4,463
python
en
code
43
github-code
90
11044752468
from flask import request import flask from flask import jsonify import flask.ext.sqlalchemy import flask.ext.restless import json from sqlalchemy.sql import text from _mysql_exceptions import IntegrityError from apis.connection import db, app #from social_handles_data import facebook_data from social_handles_data.util...
Namita26/video_sampler
apis/insights.py
insights.py
py
2,855
python
en
code
0
github-code
90
1119096319
from person import Person def load_file(list): print("loading...") file = open("people.txt", "r") string = file.read() print(string) string_list = "" string_list = string.split("\n") print(string_list) person_string = "" list = [] for person_string in string_list: en...
devlikin/User-Data-Management
main_people.py
main_people.py
py
4,891
python
en
code
0
github-code
90
16948202101
class Solution: def toGoatLatin(self, S: str) -> str: words = S.split(" ") for i in range(len(words)): word = words[i] if word[0].lower() in ("a","e","i","o","u"): newword = word + "ma" + "a"*(i+1) else: if len(word) > 1: ...
iamsuman/algorithms
iv/Leetcode/easy/824_goat_latin.py
824_goat_latin.py
py
600
python
en
code
2
github-code
90
29393678171
import time import uuid import re import sys from fnmatch import fnmatch from coref.internal.dp import DP from coref.internal.path import * from coref.internal.util import * from coref.internal.v import Vstor from typing import Generic, Callable, Iterator, TypeVar, Iterable, Sized, Any from coref.internal.monad.interna...
vulogov/core.F
coref/internal/monad/Namespace.py
Namespace.py
py
8,884
python
en
code
0
github-code
90
21473126495
# Game class from Square import * import random class Game(): START_LEFT = 35 START_TOP = 30 def __init__(self, window): self.window = window ''' The game board is made up of 4 rows and 4 columns - 16 squares, with 15 labelled images (1 to 15) and a blank square image. ...
IrvKalb/Object-Oriented-Python-Code
Chapter_13/SliderPuzzles/Game.py
Game.py
py
4,336
python
en
code
207
github-code
90
34868957894
# coding=UTF-8 import logging from os import remove, popen from os.path import splitext, join from datetime import timedelta from django.conf import settings from django.http import Http404 from django.utils import timezone def getStudent(instance): """ /!\ Not a view, it fetches the user and verifiy if t...
grodino/refiche
app/functions.py
functions.py
py
4,969
python
en
code
0
github-code
90
2708864722
#!/usr/bin/env python import sys import os sys.path.extend(['..','.']) from includes import utility, SymTab import copy from enum import Enum import argparse from decimal import Decimal ## GLOBALS============================================================= """ Structures """ reglist = ['eax', 'ebx','ecx','edx']...
RaiManish3/lavaCompiler
src/myCodeGen.py
myCodeGen.py
py
48,802
python
en
code
0
github-code
90
70014232616
import random class Card(): def __init__(self): self.suit = '' def get_face_value(self): return (random.randint(1, 13)) class Player(): def __init__(self): self.score = 300 def winner(self): self.score += 100 def loser(self): ...
EverthUrrutia/w02
w02EverthUrrutia.py
w02EverthUrrutia.py
py
2,166
python
en
code
0
github-code
90
18302735619
# v=[] # num=251 # for i in range(num): # if i==0 or i==1: # v.append(1) # else: # v.append(i*v[i-2]) # for i in range(0,num,2): # print(i,v[i],end=' ') # print() n=int(input()) if n%2!=0: print(0) else: ans=n//10 n=n//10 i=1 while(1): ans+=n//(5**i)...
Aasthaengg/IBMdataset
Python_codes/p02833/s513275211.py
s513275211.py
py
409
python
en
code
0
github-code
90
4527353137
import os import sys from os import listdir from os.path import isdir, join from kaggle_web_client import KaggleWebClient _KAGGLE_TPU_NAME_ENV_VAR_NAME = 'TPU_NAME' _KAGGLE_TPUVM_NAME_ENV_VAR_NAME = 'ISTPUVM' _KAGGLE_INPUT_DIR = '/kaggle/input' class KaggleDatasets: GET_GCS_PATH_ENDPOINT = '/requests/CopyDatasetV...
Kaggle/docker-python
patches/kaggle_datasets.py
kaggle_datasets.py
py
1,703
python
en
code
2,270
github-code
90
26407076001
import requests import json def main(): data_movie() data_book() data_hobby() def data_movie(): try: with open('movie_data.json') as movie_data_json: movie_data = json.loads(movie_data_json.read()) movie_genre_action_title = {element['title']: element['image'] for element ...
Mklyd/cs50
project.py
project.py
py
3,605
python
en
code
0
github-code
90
71867871656
import numpy as np import matplotlib.pyplot as plt def preprocess(array): array = array.astype("float32") / 255.0 array = np.reshape(array, (len(array), 28, 28, 1)) return array def noise(array , noise_factor): noisy_array = array + noise_factor * np.random.normal( loc=0.0, scale=1.0, size=a...
Qusai1201/Denoising_mnist
processing.py
processing.py
py
1,040
python
en
code
0
github-code
90
13373116861
import numpy as np import cv2 import matplotlib.pyplot as plt def display(img): plt.imshow(img, cmap = 'gray') plt.show() img = cv2.imread('data/sudoku.jpg', 0) display(img) sobel_x = cv2.Sobel(img, ddepth = cv2.CV_64F, dx = 1, dy = 0, ksize = 5) #display(sobel_x) sobel_y = cv2.Sobel(img, ddepth = cv2.CV_64...
shandilya1998/Udemy-Courses
CV/opencv/gradients.py
gradients.py
py
871
python
en
code
0
github-code
90
42529736338
import logging import socket logging.basicConfig(format='%(levelname)s - %(asctime)s: %(message)s',datefmt='%H:%M:%S', level=logging.DEBUG) def download(server,port): s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # define a TCP socket using a IPv4 that is bidirectional in it's communication. addre...
djsevy/Networking_tutorial
tcp_client.py
tcp_client.py
py
716
python
en
code
0
github-code
90
18344476349
n,k = map(int,input().split()) B = input() happy = 0 for i in range(n): if B[i]=="L" and i != 0 : if B[i-1] == "L": happy +=1 if B[i]=="R" and i != n-1 : if B[i+1] == "R": happy +=1 print(min(happy+2*k, n-1))
Aasthaengg/IBMdataset
Python_codes/p02918/s274047383.py
s274047383.py
py
234
python
en
code
0
github-code
90
40426145504
#!/usr/bin/env python import scipy.linalg from numpy import zeros, real, sum, outer from .. import misc minimizedAngle = misc.minimizedAngle circularMean = misc.circularMean def unscented_transform (mu, Sigma, alpha=1, kappa=0, beta=2): n = len (mu) lam = alpha**2 * (n+kappa) - n sigmaPoints = zeros (n,...
pjozog/PylabUtils
PylabUtils/ut/unscented_transform.py
unscented_transform.py
py
3,103
python
en
code
0
github-code
90
10593609726
# GRUPO: # Arthur Pereira Exterkoetter # Augusto Silva de Oliveira # Gustavo Egert Ortiz import argparse import ply.lex as lex import ply.yacc as yacc from utils.column_finder import find_column class Lexer: def __init__(self): self.code_example = None # Symbol table self.symbol_table =...
Augustives/PLY-Lexical-and-Syntax
lexer.py
lexer.py
py
4,237
python
en
code
0
github-code
90
17620102391
import sys n, m, b = map(int, sys.stdin.readline().split()) heights = [list(map(int, sys.stdin.readline().split())) for _ in range(n)] count = [0] * 257 for height in heights: for h in height: count[h] += 1 answer_height = 0 answer = n*m*257*2 for i in range(257): remove_count = 0 for j in range(...
Lee-Jiseung/codingtest
boj/18111/solution.py
solution.py
py
647
python
en
code
0
github-code
90
11359853535
# %% import sys import json import time import argparse import numpy as np import matplotlib.pyplot as plt import pygrib from bullet import Bullet from mpl_toolkits.basemap import Basemap import cartopy.crs as ccr import seaborn as sns # %%選択肢の表示 def cli(msg, options): """ str msg : コマンドライン上に表示するメッセー...
sc2xos/Met
tools/grib2/cliutils.py
cliutils.py
py
1,894
python
ja
code
0
github-code
90
39663398768
def mergesort(arr, tab=0): #Tab is just to make the print prettier by indented newarr = [] if(len(arr) <= 1): #If length is 1 return print("\t"*tab*2, "Returned: ", arr) return arr if(len(arr) == arr.count(arr[0])): #If array is all one item return print("\t"*tab*2, "Duplicate Case -...
jrose0116/Small-Problems
MergeSort.py
MergeSort.py
py
1,746
python
en
code
0
github-code
90
1833974578
import jieba import jieba.posseg as psg import regex as re import json #注意:为了修复词性标注将百分数的数字和百分号分开,修改了源码:C:\Users\liuhy\AppData\Local\Programs\Python\Python36\Lib\site-packages\jieba\posseg\_init_.py # 结巴分词词典加载 word_dic_file = 'dict.txt' jieba.load_userdict(word_dic_file) # 添加自定义词库 #将输入字符串进行词性标注 input_str...
liuhyzhy0909/identifies-query
test.py
test.py
py
7,886
python
en
code
0
github-code
90
73696173737
# -*- coding: utf-8 -*- import json import re from resources.lib import logger from resources.lib.gui.gui import cGui from resources.lib.gui.guiElement import cGuiElement from resources.lib.handler.ParameterHandler import ParameterHandler from resources.lib.handler.requestHandler import cRequestHandler from resources....
anis3/plugin.video.xstream-2
sites/moviesever_com.py
moviesever_com.py
py
10,680
python
en
code
0
github-code
90
18465149749
import sys readline = sys.stdin.readline n, m = map(int, readline().split()) grid = [] for _ in range(n): row = readline() real_row = [c for c in row if c != "\n"] grid.append(real_row) dp = [] sys.setrecursionlimit(10**7) for _ in range(n): temp = [] for j in range(m): temp.append(-1) ...
Aasthaengg/IBMdataset
Python_codes/p03167/s811550836.py
s811550836.py
py
926
python
en
code
0
github-code
90
42505031378
""" 15 - Faça um Programa que peça os 3 lados de um triângulo. O programa deverá informar se os valores podem ser um triângulo. Indique, caso os lados formem um triângulo, se o mesmo é: equilátero, isósceles ou escaleno. Dicas: Três lados formam um triângulo quando a soma de quaisquer dois lados for maior que o terce...
GaDaTI/exercicios_python_br
estrutura_de_decisao/exercicio_07.py
exercicio_07.py
py
943
python
pt
code
0
github-code
90
70874696938
# Copyright (C) 2018-2023 Mark McIntyre # # python code to plot orbits given a CAMS style Orbit Info file # import sys import os import pandas as pd import datetime import matplotlib.pyplot as plt try: from wmpl.Utils.PlotOrbits import plotOrbits except: print('WMPL not available') def plot...
markmac99/MeteorTools
meteortools/rmsutils/plotRMSOrbits.py
plotRMSOrbits.py
py
2,281
python
en
code
1
github-code
90
39457718600
import os import re from bs4 import BeautifulSoup as soup import csv basedir = os.path.abspath(os.path.dirname(__file__)) result_dir = os.path.join(basedir, 'agentlist') tempdir = os.path.join(basedir, 'temp') class Company(object): def __init__(self): self.name, self.wca_id, self.address, self.phone, s...
JosephInAfrica/wcacrawl
parse_to_csv.py
parse_to_csv.py
py
6,229
python
en
code
0
github-code
90
31150232024
class EncryptionMalwareSimulator: def __init__(self): self.data = None def encrypt(self, data): self.data = data encrypted_data = "" for char in self.data: # Simulate encryption instructions encrypted_char = self.execute_instruction("INC", char...
RemainAplomb/malware-analysis
1 - Introduction/06 - Looping and Subroutine Instructions/simulate_malware.py
simulate_malware.py
py
4,487
python
en
code
0
github-code
90
1202997334
input1 = [2, 3, 4, 5, 6] input2 = [2, 3, 5, 6] def fun(lst): result = [] for i in range(0, len(lst)//2 if len(lst) % 2 == 0 else len(lst)//2 + 1): result.append(lst[i] * lst[-i-1]) return result print(fun(input1)) print(fun(input2))
c8ler/PY
12_peremnojenie_elementov_spiska.py
12_peremnojenie_elementov_spiska.py
py
256
python
en
code
0
github-code
90
70902309097
# Take a list, say for example this one: # a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] # and write a program that prints out all the elements of the list that are less than given number. def numbers_less_than(given_list): given_number = int(input("Enter one number: ")) updated_list = [] for i in given_li...
Crypto-V/Courses
practicepython/exercise3.py
exercise3.py
py
479
python
en
code
0
github-code
90
9164536615
import time start_time = time.time() with open("11.txt") as file: lines = file.readlines() lines = [[int(x) for x in line.strip()] for line in lines] flashcount = 0 for i in range(100): lines = [[x+1 for x in line] for line in lines] flashes = set() for y, line in enumerate(lines): for x, val in enumerate(line...
rrickfox/AdventOfCode
2021/11/11.1.py
11.1.py
py
1,778
python
en
code
0
github-code
90
70591426857
from scipy import polyval class Fiber: """Object collecting parameters of an optical fiber.""" def __init__( self, losses=None, raman_coefficient=7e-14, effective_area=80e-12, beta2=20 * 1e-24 / 1e3, gamma=1.3 * 1e-3, ): self.effective_area = effect...
geeanlooca/PyNLIN
pynlin/fiber.py
fiber.py
py
1,074
python
en
code
3
github-code
90
29679143585
''' ----SUMMARY---- This contains the base functionality for all options that will cause changes on the contents of the database, such as updates, insertions, and deletions. ----CLASSES THAT INHERIT FROM THIS CLASS---- BaseDeletionManager CompositeDeletionManager BaseInsertionManager BaseUpdateManager ---IMPORTS--- ...
DiegoAvena/TheUniverseDatabase
TheUniverse/Code/BaseDataModifierManager.py
BaseDataModifierManager.py
py
4,141
python
en
code
0
github-code
90
18194454893
#!/usr/bin/python3 import hidden_4 """print all the names in hidden_4 file """ if __name__ == "__main__": stream_names = dir(hidden_4) for name in stream_names: if name[0:2] != "__" and name[-1:-3] != "__": print(name)
n1klaus/alx-higher_level_programming
0x02-python-import_modules/4-hidden_discovery.py
4-hidden_discovery.py
py
248
python
en
code
0
github-code
90
17996726599
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 al=[chr(ord('a') + i) for i in...
Aasthaengg/IBMdataset
Python_codes/p03722/s523033752.py
s523033752.py
py
1,267
python
en
code
0
github-code
90
10782776058
# !/usr/bin/env python # -*- coding: utf-8 -*- # Author: yanghuizhi # Time: 2020/2/27 7:50 下午 from flask import Flask from login.views import * app = Flask(__name__) # 创建了一个Flask类的实例 app.secret_key="123" app.add_url_rule("/login/",view_func=login.as_view("login")) app.add_url_rule("/zhuce/",view_func=zhuce.as_view...
yanghuizhi/Flask_yhz
error_app4_MVC学习/main.py
main.py
py
1,018
python
zh
code
1
github-code
90
27009367076
# anagram - two strings are written using same letter # "rail safety" = "fairy tales" # "roast beef" = "eat for BSE" # It sometimes changes a proper noun or personal name into a sentence: # "William Shakespeare" = "I am a weakish speller" # "Madam Curie" = "Radium came" s1 = "rail safety" s2 = "fairy tales" s1 = s1.r...
AkshayLavhagale/Interview-Topics
Interview/Algorithms/String_Processing/is_anagram.py
is_anagram.py
py
1,387
python
en
code
0
github-code
90
34562214654
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core import hypothesis.strategies as st from hypothesis import given import caffe2.python.hypothesis_test_util as hu import numpy as np cla...
facebookarchive/AICamera-Style-Transfer
app/src/main/cpp/caffe2/python/operator_test/find_op_test.py
find_op_test.py
py
1,357
python
en
code
81
github-code
90
6336579817
import ast from typing import Iterator, Sequence, Tuple from pandas_dev_flaker._data_tree import State, register PRIVATE_FUNCTIONS_ALLOWED = {"sys._getframe"} # no known alternative MSG = "PDF020 found private import across modules" def _is_private_import(module: str, attributes: Sequence[str]) -> bool: retur...
pandas-dev/pandas-dev-flaker
pandas_dev_flaker/_plugins_tree/private_imports.py
private_imports.py
py
1,257
python
en
code
4
github-code
90
27308363271
#should be moved to tested, with tests developed #binLen of -1 gives whole chromosomes as bins from quick.util.GenomeInfo import GenomeInfo from gold.track.GenomeRegion import GenomeRegion class AutoBinner(object): def __init__(self, userBinSource, binLen, genome=None): self.genome = userBinSource.genome ...
uio-bmi/track_rand
lib/hb/quick/application/AutoBinner.py
AutoBinner.py
py
2,657
python
en
code
1
github-code
90
7258313848
from collections import deque class Solution: def numIslands1(self, grid: List[List[str]]) -> int: # BFS Approach # Space Complexity : O(mn) where m is the number of rows and n is the number of columns (have a queue for BFS) # Time Complexity : O(mn) where m is the number of rows and n is the number of columns (...
muditabysani/DFS-2
Problem1.py
Problem1.py
py
1,799
python
en
code
null
github-code
90
37201153000
""" Fits an exponential curve to Katie Ledecky's world record swims in the 800m freesyle through the 2016 Rio Olympics. Change log: 2016/08/13 -- module started; nloomis@gmail.com 2016/08/14 -- documentation added; nloomis@gmail.com """ __authors__ = ('nloomis@gmail.com',) import datetime import matplotlib.pyplot...
nickloomis/loomsci-examples
python/ledecky_wr.py
ledecky_wr.py
py
2,794
python
en
code
3
github-code
90
73673967017
import json import yaml from django.db.models import Q, F, Value as V, CharField, Prefetch from django.db.models.functions import Concat from django.db.utils import IntegrityError from django.core import exceptions as core_exceptions from django.core.exceptions import ValidationError from django.core.validators import...
Linaro/squad
squad/api/rest.py
rest.py
py
76,591
python
en
code
54
github-code
90
31228083242
# -*- coding: utf-8 -*- """ Created on Sun Dec 24 14:58:54 2017 @author: lenovo """ #coding:utf-8 import Tkinter top=Tkinter.Tk()#创建顶层窗口 label=Tkinter.Label(top,text="hello \nworld") label.pack() quit=Tkinter.Button(top,text='quit',command=top.quit,bg='red',fg='white') quit.pack(fill=Tkinter.X,expand=1) Tkinter.mainl...
RoveAllOverTheWorld512/hyb_bak
gui_demo1.py
gui_demo1.py
py
350
python
en
code
0
github-code
90
72024097898
# import all the relevant functions from GHEtool import Borefield, GroundData from scripts._utils import Plotting import numpy as np import streamlit as st import pygfunction as gt #-- import streamlit as st class GheTool: def __init__(self): self.YEARS = 50 # extras self.COP = 3.5 ...
magnesyljuasen/grunnvarme
scripts/_ghetool.py
_ghetool.py
py
10,889
python
en
code
2
github-code
90
5271659921
import logging import Queue import threading from rackclient import exceptions from rackclient.v1 import processes from rackclient.lib import RACK_CTX from rackclient.lib.syscall.default import messaging from rackclient.lib.syscall.default import pipe as rackpipe from rackclient.lib.syscall.default import file as rack...
tkaneko0204/python-rackclient
rackclient/lib/syscall/default/syscall.py
syscall.py
py
3,954
python
en
code
0
github-code
90
18406564239
n,m=map(int,input().split()) def find(x): if parents[x] < 0: # 負なら根 return x else: parents[x] = find(parents[x]) return parents[x] #xとyの属する集合の併合 def unite(x,y): x = find(x) # x,yは根の番号にする。 y = find(y) if x == y: return False else: if parents[x] >...
Aasthaengg/IBMdataset
Python_codes/p03045/s229677690.py
s229677690.py
py
668
python
ja
code
0
github-code
90
70298347497
import asyncio import json import random from math import ceil import logging from aioraft.client import NodeClient from aioraft.log import action_map, SetLogEntry from aioraft.entry import DirEntry logger = logging.getLogger(__name__) class Node: def __init__(self, host, port, peers=None, loop=None): ...
lisael/aioraft
aioraft/node.py
node.py
py
9,795
python
en
code
29
github-code
90