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
26659129001
def normalize_scores(values): # This normalise function rescales the users score between a given range for better display range_min = 0 range_max = 6 min_score = min([value["score"] for value in values]) max_score = max([value["score"] for value in values]) # If all question responses are the s...
ClimateMind/climatemind-backend
app/personal_values/normalize.py
normalize.py
py
783
python
en
code
14
github-code
90
19444691645
import django import sys, os rootpath = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/") rootpath = rootpath.split("/apps")[0] # print(rootpath) syspath = sys.path sys.path = [] sys.path.append(rootpath) # 指定搜索路径绝对目录 sys.path.extend([rootpath + i for i in os.listdir(rootpath) if i[0] != "."]) # 将工程目录下的...
LianjiaTech/sosotest
AutotestWebD/apps/webportal/scripts/web_portal_ui_coverage.py
web_portal_ui_coverage.py
py
10,456
python
en
code
489
github-code
90
31700154187
for x in range(6): print("X") a = 6 while(a == 6): print("a") break while True: print(a) a = a +1 if(a==10): break b = 10 print(b==90)
mingabire809/Python-Work
Track/track.py
track.py
py
169
python
en
code
0
github-code
90
9043954526
import streamlit as st import yfinance as yf import pandas as pd import plotly.express as px import style as style from datetime import datetime #import numpy as np #import pandas as pd # import yfinance as yf # #import time # import matplotlib.pyplot as plt # import plotly.express as px # import seaborn as sns # impor...
robertoricci/QAF
app_bolsa_eleicoes.py
app_bolsa_eleicoes.py
py
5,959
python
en
code
0
github-code
90
25613781712
#Les fonctions de base sur la manipulation des arbres binaires. def creerArbre(val,gauche,droit): return [val,[gauche,[],[]],[droit,[],[]]] def vide(a): return a==[] def val(a): if a!=[]: return a[0] else: return None def filsGauche(a): if not v...
IDSOUGOU/Binary-Tree
exercices Arbres.py
exercices Arbres.py
py
8,538
python
fr
code
0
github-code
90
16023138156
import os.path import glob from blender import run_blender _CYCLES_DEVICE = "OPTIX" def _get_python_expr(samples, motion_blur): return f""" import bpy scene = bpy.context.scene scene.cycles.samples = {samples} scene.render.use_motion_blur = {motion_blur} """ def render_ble...
george-hawkins/boto3-renderer
render.py
render.py
py
1,319
python
en
code
0
github-code
90
18410782159
n=int(input()) ans=0 #約分 def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) # divisors.sort() return divisors l=make_divisors(n) for li in l: m=(n-li)//li if l...
Aasthaengg/IBMdataset
Python_codes/p03050/s429239302.py
s429239302.py
py
355
python
en
code
0
github-code
90
20078630497
DIGITAL_STORAGE = { "name": "Digital Storage", "units": [ { "name": "Bit", "symbol": "b" }, { "name": "Hecobit", "symbol": "hb" }, { "name": "Kilobit", "symbol": "kb" }, { "name": "Megabit", "symbol": "Mb" }, { "name": "Gigabi...
giangpham95/unit-converters
units/digital_storage.py
digital_storage.py
py
2,278
python
la
code
0
github-code
90
18531081649
n=int(input()) l=list(map(int,input().split())) bitlist=[] for i in range(n): bit=[] num=l[i] for j in range(20): bit.append(num%2) num//=2 bitlist.append(bit) left=0 right=0 b=True ans=1 now={} for i in range(20): if bitlist[0][i]==1: now[2**i]=1 else: now[2**i]=0 b=1#b=1の時右を伸ばす while right...
Aasthaengg/IBMdataset
Python_codes/p03340/s473925940.py
s473925940.py
py
747
python
en
code
0
github-code
90
22219857130
r""" File related utilities. """ # Python 2.5 compatibility from __future__ import with_statement from __future__ import absolute_import import os import six from six.moves import zip import nxpy.core.past def compare(file1, file2, ignore_eof=True, encoding=None): r""" Compare two text files for equa...
nmusatti/nxpy
libs/file/nxpy/core/file/file.py
file.py
py
1,304
python
en
code
7
github-code
90
70943368297
import time t1 = time.time() import re def backward_segment(text, dic): word_list = [] i = len(text) - 1 while i >= 0: # 掃描位置作為終點 longest_word = text[i] # 掃描位置的單字 for j in range(0, i): # 遍歷[0, i]區間作為待查詢詞語的...
rwrewrwer/forward_backward_segment
forward_backward.py
forward_backward.py
py
4,692
python
en
code
0
github-code
90
18032869439
from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter import itertools from itertools import permutations,combinations import sys import bisect import string import math import time import random def I(): return int(input()) def MI(): return map(int,input().split()) def LI...
Aasthaengg/IBMdataset
Python_codes/p03837/s259206870.py
s259206870.py
py
2,185
python
en
code
0
github-code
90
32015688341
import subprocess import sys try: import streamlit as st from datetime import date import yfinance as yf from neuralprophet import NeuralProphet from plotly import graph_objs as go except ImportError: subprocess.check_call([sys.executable, "-m", "pip", "install", 'streamlit']) subprocess....
arivvid27/Track
main.py
main.py
py
2,753
python
en
code
0
github-code
90
8331596794
### SSH Username & password for netbox importer ### username = None password = None ### SSH connection timeout conn_timeout = 10 ### Token from flask SECRET_KEY ### TOKEN = "" ### config_file = None logging_file = None ### LDAP Settings ### # If you need ldap (AD) login AD_USE_SSL = False AD_PORT = 389 AD_ADDRESS = ""...
Sivolen/NABS
config_example.py
config_example.py
py
1,422
python
en
code
2
github-code
90
43923487287
from distutils.errors import DistutilsOptionError from setuptools import Command from pkg_resources import safe_name, working_set from pkglib.setuptools import dependency, graph from base import CommandMixin class depgraph(Command, CommandMixin): """ Print a dependency graph of this package """ description...
micktwomey/pkglib
pkglib/setuptools/command/depgraph.py
depgraph.py
py
4,343
python
en
code
null
github-code
90
16991422487
"""Core functions for econ-sim""" import datetime import sys class world: """The games world object, contains all information about a game""" def __init__(self, name, compname): self.name = name self.date = datetime.date(1950, 1, 1) self.player_comp = player_comp(compname) self....
ITSecspam/Econ-Sim
core.py
core.py
py
4,218
python
en
code
1
github-code
90
17227109375
#!/usr/bin/env python3 ''' Database code for author: Lai Man Tang(Nancy) email: cloudtang030@gmail.com ''' import psycopg2 ''' create view articlesLog as select au.name as author, a.title, l.id as logID, l.status as logStatus from log as l, articles as a, authors as au where l.path like concat('%/', a.slug) a...
littlecloud1/news-logs-analysis
newsdb.py
newsdb.py
py
1,697
python
en
code
0
github-code
90
18392812959
s = input() aaa = 0 ans = 0 i = 0 while i < len(s) - 1: if s[i] == 'A': aaa += 1 elif s[i:i+2] == 'BC': ans += aaa i += 1 else: aaa = 0 i += 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03018/s174703130.py
s174703130.py
py
203
python
en
code
0
github-code
90
27682550339
import zipfile import os import re import hashlib import requests import codecs import csv import openpyxl # задание 1 directory_to_extra_to = 'C:\\zip folder' arch_file = 'C:\\test.zip' test_zip = zipfile.ZipFile('test.zip', 'r') test_zip.extractall(directory_to_extra_to) test_zip.close() # задание №2 t...
hoangnv2906/hoangnv2906.github.io
lab1python.py
lab1python.py
py
3,735
python
en
code
0
github-code
90
21775592871
from PYmodule import * t1 = time.time() f_seed = 0.01 fMname = '../rhoM_evol.txt'# %int(abs(np.log10(f_seed))) fLname = '../rhoL_evol.txt' prex = '../ndraw100' fMname = prex+'rhoM_evol.txt'# %int(abs(np.log10(f_seed))) fLname = prex+'rhoL_evol.txt' f_seedlabel = 'f%d'%abs(int(np.log10(f_seed))) prex = '../4p/M0r8_' ...
lovetomatoes/BHMF_QLFz4z5
h5rhozplot.py
h5rhozplot.py
py
2,557
python
en
code
0
github-code
90
43040236467
#### MFI from itertools import combinations def pruneCandidatesUsingMFS(candidate_itemsets, MFS): candidate_itemsets = candidate_itemsets.copy() for itemset in candidate_itemsets.copy(): if any(all(_item in _MFS_itemset for _item in itemset) for _MFS_itemset in MFS): candidate_itemsets.remove(itemset) ...
KausikN/BTech_BigData_Files
Assignment_1/Codes/PincerSearch.py
PincerSearch.py
py
7,508
python
en
code
1
github-code
90
18435306889
A, B = map(int, input().split()) def func(n): res = 0 if ((n + 1) // 2) % 2 == 0 else 1 res ^= n if n % 2 == 0 else 0 return res print(func(B) ^ func(A - 1))
Aasthaengg/IBMdataset
Python_codes/p03104/s803215834.py
s803215834.py
py
175
python
ru
code
0
github-code
90
70165978536
import webbrowser import imaplib import bs4 import email from email.header import decode_header # Required Config for Gmail accounts. # Others, please look up the documentation.... # Or let me know in the comment section to make another video :) imaplib._MAXLINE = 10000000 IMAP_SERVER = 'imap.gmail.com' # fo...
Glort572/python-email-scripts
python_delete_and_unsub_script.py
python_delete_and_unsub_script.py
py
4,486
python
en
code
0
github-code
90
30191427257
import os import random import unittest from distutils.util import strtobool from typing import Union import torch import PIL.Image import PIL.ImageOps import requests from packaging import version global_rng = random.Random() torch_device = "cuda" if torch.cuda.is_available() else "cpu" is_torch_higher_equal_than_...
stochasticai/x-stable-diffusion
FlashAttention/diffusers/src/diffusers/testing_utils.py
testing_utils.py
py
2,780
python
en
code
520
github-code
90
20412688229
from re import sub, findall import nltk from string import punctuation from nltk.corpus import stopwords from unidecode import unidecode from nltk.stem import RSLPStemmer from sqlalchemy import create_engine, text from src.settings import TABLE_NAME, DATABASE_STRING_DEFAULT from src.exceptions.exceptions import Databas...
douglasdcm/search-jobs
src/helper/helper.py
helper.py
py
4,325
python
en
code
7
github-code
90
18045918629
# -*- coding: utf-8 -*- """ Created on Thu May 14 18:16:23 2020 @author: shinba """ s = input() start = s[0] cnt1 = 0 for i in range(1,len(s)): if s[i] == start: continue cnt1 += 1 start = s[i] start = s[-1] cnt2 = 0 for i in range(len(s)-1,-1,-1): if s[i] == start: continue cn...
Aasthaengg/IBMdataset
Python_codes/p03945/s473141427.py
s473141427.py
py
367
python
en
code
0
github-code
90
24643501401
import pickle as pk from pathlib import Path from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences #Get raw smiles dataset path_to_raw_smiles_data = Path.cwd().joinpath("training_data","smiles","training_data.pkl") raw_smiles_equations = pk.load( open( path_to_raw_smiles...
Dr-Musho-Research-Group/AGoRaS
src/create_tokenized_dataset.py
create_tokenized_dataset.py
py
1,090
python
en
code
3
github-code
90
31364608970
import math import scipy.integrate as I import numpy as np from numpy import linalg as LA import matplotlib.pyplot as plt from matplotlib import mlab Eps = 1 p = 10 q = 1 a1 = 1.23 a2 = 1.05 w = 1.54 def a1(w): a1 = (-math.sin(p*w) - Eps*w*math.cos(p*w)) / math.sin((p-q)*w) return a1 def a2(w...
Daniel-Grezhdieru/Theory
tusa.py
tusa.py
py
1,094
python
en
code
0
github-code
90
13642396548
"""Dump information from various custom location files into a json format in tools/dump.""" import inspect import json import os import sys from copy import deepcopy from enum import IntEnum, auto import randomizer.Lists.CBLocations.AngryAztecCBLocations import randomizer.Lists.CBLocations.CreepyCastleCBLocations impo...
2dos/DK64-Randomizer
dumper.py
dumper.py
py
18,714
python
en
code
44
github-code
90
21070603051
from flask import Response import json class JSON: status_code = 200 @staticmethod def json_response(obj): response = Response( response=json.dumps(obj, default=str, sort_keys=False), status=JSON.status_code, mimetype="application/json", ) retur...
krobison10/apply-v2-api
app/utils/json.py
json.py
py
331
python
en
code
0
github-code
90
10555059406
import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output import plotly.express as px tips = px.data.tips() col_options = [dict(label=x, value=x) for x in tips.columns] app =dash.Dash(__name__) app.layout = html.Div(children= [ html.H1('Demo: ...
caiquemiranda/studies-data-visualization
Web-dash/demo3.py
demo3.py
py
628
python
en
code
0
github-code
90
3939168577
# -*- coding: utf-8 -*- """ Convert photo data to numpy data. """ import numpy as np from PIL import Image #Pythonの画像処理ライブラリ import glob, random # 指定したフォルダ内の画像をnumpy形式のデータに変換+ラベルのリストを生成 def glob_imgs(imgFolderPath, imgExt, imgCount, imgW, imgH, classes, label): # ファイルリストを取得し順番をシャッフル files = glob.glob(img...
okagen/pyML
b02-2-Make_NPZ.py
b02-2-Make_NPZ.py
py
2,637
python
ja
code
0
github-code
90
19193225149
from sys import stdin, stdout from collections import defaultdict, deque def bfs(start): q = deque() q.append([start, 0]) visited[start] = True dist[start] = 0 while len(q) > 0: node, d = q.popleft() if node == n: return True for x in graph[node...
ashutoshdumiyan/CSES-Solutions
graphs/messageroute.py
messageroute.py
py
1,044
python
en
code
0
github-code
90
36272134674
# general app constants URL_GITHUB = "https://github.com/Soundwave2142/music-backuper" # theme and quick element related THEME_DEFAULT_NAME = 'default' THEME_NIGHT_NAME = 'default_night' # config keys CONFIG_KEY_BACKUPPER_PATH_FROM = "backupper_remembered_path_from" CONFIG_KEY_BACKUPPER_PATH_TO = "backupper_remembere...
Soundwave2142/music-backuper
src/providers/constants.py
constants.py
py
392
python
en
code
0
github-code
90
35349287137
recongnise_options = { "API": "google", "energy_threshold": True } voice_options = { "gender": "female", "speech_rate": 140, } ai_options = { "learn_file": "voca.aiml", "brain_file": "voca.dump", "predicates": { "name": "Voca", "master": "Sreyas", "botmaster": "Srey...
Sreyas-Sreelal/Voca
config.py
config.py
py
364
python
en
code
1
github-code
90
14716782619
import torch.utils.data as data import os from PIL import Image import torchvision.transforms as tt from .PairAug import pair_augmentation import platform import numpy as np class RESIDE_Dataset(data.Dataset): def __init__(self, path, img_size, if_train, trans_hazy=None, trans_gt=None, if_identity_name=...
guijiejie/AADN
defense_utils/dataset/RESIDEDataset.py
RESIDEDataset.py
py
3,163
python
en
code
3
github-code
90
18372780529
N = int(input()) A = list(map(int, input().split(' '))) a = 0 for i in range(N): a += (-1) ** i * A[i] res = [0 for _ in range(N)] res[0] = a print('{} '.format(res[0]), end='') for i in range(1, N - 1): res[i] = 2 * A[i-1] - res[i-1] print('{} '.format(res[i]), end='') res[N-1] = 2 * A[N-2] - res[N-2] print(res[...
Aasthaengg/IBMdataset
Python_codes/p02984/s345767143.py
s345767143.py
py
325
python
en
code
0
github-code
90
30623877040
import pytest from dynamic.climbing_stairs import Solution """ You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? """ @pytest.mark.parametrize( "n,expected", [ (2, 2), (3, 3), ...
sledenev/algos
dynamic/tests/test_climbing_stairs.py
test_climbing_stairs.py
py
488
python
en
code
0
github-code
90
3729918776
import requests from bs4 import BeautifulSoup import re import MySQLdb """ 提取报关要素 """ BASE_URL = "http://www.hscode.net/IntegrateQueries/YsInfoPager" def get_data(index, cur): rs = requests.post(BASE_URL, {"pageIndex": index}) # re.encoding('utf-8') html = rs.text bs = BeautifulSoup(html, "html5lib"...
yiyisf/webswarp
customs.py
customs.py
py
3,927
python
en
code
0
github-code
90
13468582
import socket as sk import pickle as pkl import json import sys try: import pygame as pg except ImportError: print("Библиотека pygame не найдена, пробую установить...") try: import pip pip.main(["install", "pygame"]) except ImportError: print("Не найден pip") ...
Dmitry450/Simple-Modding-2
Main.py
Main.py
py
6,336
python
en
code
1
github-code
90
28393275239
# User function Template for python3 class Solution: def min_lights(self, h, n): # code here l = [] for j, i in enumerate(h): if i >= 0: l.append([j-i, j+i]) l.sort(key=lambda x: x[0]) m = len(l) target = 0 cnt = 0 i = 0 ...
pappubishwas/GeeksForGeeks
Contest-134/illuminate_hall.py
illuminate_hall.py
py
1,050
python
en
code
1
github-code
90
25742955504
from model.opened import Opened from model.point_node_g import Node class KUCS: def __init__(self, grid, start, goals): self.grid = grid self.start = start self.goals = goals self.active_goals = set(goals) self.is_found = False self.best = None self.opened ...
valdas1966/kg
algo/kucs.py
kucs.py
py
1,692
python
en
code
0
github-code
90
9218161772
def Repeat(s): finalstr = "" state = "Norm" repeat = "" repeatnum = 0 bodystr = "" braket = 0 for idx, n in enumerate(s): if state == "Norm" and n.isdigit(): state = "digit" repeat += n elif state == "digit" and n.isdigit(): rep...
yaleliyu/leetcode
test.py
test.py
py
1,145
python
en
code
0
github-code
90
18068471589
N = tuple([int(j) for j in input().split(' ')]) #0が含まれたら0 if N[0] <= 0 and N[1] >= 0: print("Zero") elif N[0] < 0 and N[1] < 0: if (N[0] * - 1 - N[1] * - 1) % 2 == 0: print("Negative") else: print("Positive") elif N[0] > 0 and N[1] > 0: print("Positive")
Aasthaengg/IBMdataset
Python_codes/p04033/s347382610.py
s347382610.py
py
304
python
en
code
0
github-code
90
19345524723
import time from datetime import datetime from urllib.parse import urlparse import allure from allure_commons.types import AttachmentType from selenium.common import TimeoutException, NoSuchElementException, ElementNotInteractableException from selenium.webdriver import ActionChains, Keys from selenium.webdriver.commo...
sergioortiz17/Stori-QA-Automation-Challenge-Selenium
support/BaseActions.py
BaseActions.py
py
15,990
python
es
code
0
github-code
90
29347606620
from src.util import dateTime from src.reportGenerator import searchSummaryGenerator from src.responseBuilder import vehicleRegistrationResponseBuilder, errorResponseBuilder from . import backendService from . import redisPublishService from src.dbService import esService as es from src.constant import constant from fl...
mahmudur-rahman-dev/flask-elasticsearch-caching
src/services/vehicleRegService.py
vehicleRegService.py
py
2,064
python
en
code
0
github-code
90
19012325341
import numpy as np def update_cc(cc, group_units, clu=[]): if clu == []: all_units = np.array(group_units) else: all_units = np.unique(clu) x = np.where(all_units == group_units[0]) new_cc = cc n = len(group_units) for i in range(n-1, 0, -1): idx = np.where(all_units ...
ayalab1/neurocode
spikeSorting/AutomatedCuration/Automated-curation/update_cc.py
update_cc.py
py
854
python
en
code
8
github-code
90
38294686494
import requests from access_tokens.access_token import AccessToken class RequestMaker: """ MUST BE SINGLETON """ def __init__(self, access_token: AccessToken, friends_limit_ceil=999999, friends_limit_floor=0): self.access_token = access_token self.ceil_limit = friends_limit_ceil ...
archmight/vk_hidden_friends
requests_to_vk_api/request_maker.py
request_maker.py
py
2,263
python
en
code
0
github-code
90
37835048885
# -*- coding: utf-8 -*- """ Created on Tue Jul 3 17:03:50 2018 @author: 李立宗 lilizong@gmail.com 《OpenCV图穷匕见——Python实现》 电子工业出版社 """ o=cv2.imread("image\\lena.bmp") kernel = np.ones((9,9),np.float32)/81 r = cv2.filter2D(o,-1,kernel) cv2.imshow("original",o) cv2.imshow("Gaussian",r) cv2.waitKey() cv2.destroyAllWindows()...
taochangwan/learnOpencv
源代码及图像/chapter7/7.10filter2D.py
7.10filter2D.py
py
361
python
en
code
1
github-code
90
26960691457
import pathlib from torch._C import parse_type_comment from torch.utils.data.dataset import Dataset import numpy as np import os import cv2 import torch from torch.utils.data import Dataset import skimage.io import json from pathlib import Path from .factory import DatasetFactory @DatasetFactory.register('dataset_lu...
fatcatofbupt/medical-algo-dev
backend/lib/datasets/dataset_lungseg.py
dataset_lungseg.py
py
3,112
python
en
code
null
github-code
90
21030228760
#%pip install tensorflow-addons import tensorflow as tf #import tensorflow.keras as keras from tensorflow import keras from tensorflow.keras.models import Model, Sequential from tensorflow.keras.layers import Input from tensorflow.keras.layers import Dense, Dropout, Layer, LayerNormalization from tenso...
Phidaimonia/laughing-octo-sniffle
MAE_large_pretrain.py
MAE_large_pretrain.py
py
11,455
python
en
code
0
github-code
90
25676262181
# Напишите программу, удаляющую из текста все слова, содержащие "абв". В тексте используется разделитель пробел. text = 'Напишите абв напиабв програбвмму программу, удаляющую из этого абв текста все вабвс слова, содерабващие содержащие "абв"' def del_abv(text): text = list(filter(lambda x: 'абв' not in x, text.s...
AntonSavchenko88/World-of-programming
PythonSeminar05/Task01.py
Task01.py
py
597
python
ru
code
0
github-code
90
17369413217
from coding_files import connection_to_database ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg'} def insert_list_to_sql_tuple(insert_list): for i in range(len(insert_list)): if insert_list[i] == '': insert_list[i] = 'N/A' return tuple(insert_list) def get_all_request_for_all_al...
JordanOCodes/SeniorCourseEquivalency
coding_files/preparing_to_connect_to_database.py
preparing_to_connect_to_database.py
py
794
python
en
code
0
github-code
90
18814507967
import lxml.html from openstates.scrape import Scraper, Organization class MACommitteeScraper(Scraper): def scrape(self, chamber=None): page_types = [] if chamber == "upper" or chamber is None: page_types += ["Senate", "Joint"] if chamber == "lower" or chamber is None: ...
openstates/openstates-scrapers
scrapers/ma/committees.py
committees.py
py
1,480
python
en
code
820
github-code
90
9667773667
import sys def fafile2dict(): ''' read a single FASTA file (SHH.fa) into a dictionary object and calculate the contig N50 size of this FASTA file run as : python3 N50.py < ./asm/contigs.fasta Rerurn -------------- N50:int the N50 number of this FASTA file -------------- '''...
JialinKang/comparative_genomics
assignment2/asm/N50.py
N50.py
py
1,047
python
en
code
0
github-code
90
73337534058
import torch.nn as nn from torchcrf import CRF from torch.nn.utils.rnn import (pack_padded_sequence, pad_packed_sequence) class RNNTagger(nn.Module): def __init__(self, nemb, nhid, nlayers, drop, ntags): super(RNNTagger, self).__init__() self.tagger_rnn = nn.LSTM( input_size=nemb, ...
akurniawan/sequence-pos-tagging
deep-learning/models.py
models.py
py
1,433
python
en
code
3
github-code
90
12301036270
""" FIT1045: Sem 1 2023 Assignment 1 (Solution Copy) """ import random import copy from math import ceil import os def clear_screen(): """ Clears the terminal for Windows and Linux/MacOS. :return: None """ os.system('cls' if os.name == 'nt' else 'clear') def print_rules(): ...
timothymoniaga/FIT-1045
Assignment 1/connect4.py
connect4.py
py
13,726
python
en
code
0
github-code
90
883998386
#!/usr/bin/env python3 # Implement a method to perform basic string compression using # the counts of repeated characters. For example, the string # 'aabcccccaaa' would become 'a2b1c5a3'. If the compressed string # is longer than the original string, return the original string. #--------------------------------------...
raygolden/Cracking-The-Coding-Interview-1
Ch 1 - Arrays and Strings/prob1-5.py
prob1-5.py
py
1,124
python
en
code
0
github-code
90
16623191076
# https://adventofcode.com/2022/day/13w import pathlib import time from pprint import pprint as pp import json from copy import deepcopy from functools import cmp_to_key script_path = pathlib.Path(__file__).parent input = script_path / "input.txt" # 5280 // 25792 input_test = script_path / "test.txt" #...
TragicMayhem/advent_of_code
aoc_2022/day13/aoc2022d13.py
aoc2022d13.py
py
3,600
python
en
code
0
github-code
90
18328325510
from django.conf import settings from django.urls import include, path from rest_framework.routers import DefaultRouter, SimpleRouter from rest_framework_nested import routers from rest_framework_nested.routers import NestedSimpleRouter from course_api.tasks.views import BoardViewset, StatusViewset, TaskViewSet from c...
anuran-roy/wd301-capstone-alt
config/api_router.py
api_router.py
py
1,442
python
en
code
1
github-code
90
4181002117
import os, csv in_dir = "2DCNN/" ls = os.listdir(in_dir) res = [k for k in ls if 'results' in k] with open('ProcessedLogs.csv', 'w', newline='') as csvfile: spamwriter = csv.writer(csvfile, delimiter=',',quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(["Opt", "CNN_Layers", "Dense_Layers", "Arch"...
m0zjo-code/SIGNAL_CNN_TRAIN_KERAS
process_logs.py
process_logs.py
py
661
python
en
code
0
github-code
90
13553820382
from sdaps import model from sdaps import script from sdaps.utils.ugettext import ugettext, ungettext _ = ugettext parser = script.add_project_subparser("cover", help=_("Create a cover for the questionnaires."), description=_("""This command creates a cover page for questionnaires. All the metadata of th...
sdaps/sdaps
sdaps/cmdline/cover.py
cover.py
py
665
python
en
code
183
github-code
90
18197664219
import sys read = sys.stdin.read readlines = sys.stdin.readlines def main(): x, n, *p = map(int, read().split()) sa = 10000 r = 10000 for i1 in range(-101, 202): if i1 not in p: if abs(x - i1) < sa: sa = abs(x - i1) r = i1 print(r) if __name__ == ...
Aasthaengg/IBMdataset
Python_codes/p02641/s287581144.py
s287581144.py
py
343
python
en
code
0
github-code
90
44033088647
from discord.ext import commands import config class Support(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_ready(self): print('Support is ready') @commands.command() async def help(self, ctx): await ctx.send(config.HELP) def setu...
Crying-Soul/discord_bot
cogs/Support.py
Support.py
py
357
python
en
code
0
github-code
90
2256361069
def is_it_a_letter(new_key, letter): alpha = "ABCDEFGHIJKLMNOPQRSTUWXYZ" if letter in alpha: return alpha[new_key] else: return letter def decrypt(key, text): text = text.upper() alphabet = "ABCDEFGHIJKLMNOPQRSTUWXYZ" result = "" for letter in text: n...
kitti-sec/Caesar-decryption
caesarhw.py
caesarhw.py
py
728
python
en
code
0
github-code
90
74106494695
#!/system/bin/env python3 from flask import Flask, request, redirect, url_for, render_template import html import calendar import db_utils import response from flask import session as login_session from flask import jsonify import random import string from google.oauth2 import id_token from google.auth.transport imp...
davidaik/item-catalog
server.py
server.py
py
15,145
python
en
code
0
github-code
90
24222363065
# importing required modules import socket import os import pybase64 import time import csv from Crypto.PublicKey import RSA from tkinter import Tk, filedialog from datetime import datetime from Crypto.Cipher import PKCS1_OAEP from getpass import getpass from pwn import * # assigning necessary information...
ShyamSunder149/Secure-file-transfer-using-TCP
client.py
client.py
py
2,493
python
en
code
0
github-code
90
18377154469
from functools import reduce class comb_mod: mod = 1000000007 MAX = 10 ** 5 fac = [0 for i in range(MAX)] finv = [0 for i in range(MAX)] inv = [0 for i in range(MAX)] def __init__(self): self.fac[0], self.fac[1] = 1, 1 self.finv[0], self.finv[1] = 1, 1 self.inv[1] = 1 ...
Aasthaengg/IBMdataset
Python_codes/p02990/s773780257.py
s773780257.py
py
1,144
python
en
code
0
github-code
90
27965476551
import pytest from sqltask.database.sqlparser import RelativeId, RelativeIdReplacer, SQLParser class FakeRelativeIdLoader(object): def __init__(self, storage_table=None): self.storage_table = storage_table def load(self, keyset, keyname): return self.storage_table[keyset][keyname] def asser...
vecin2/em_automation
sqltask/test/test_sqlparser.py
test_sqlparser.py
py
5,143
python
en
code
0
github-code
90
41293721769
import sys E, S, M = map(int, sys.stdin.readline().split()) year = 0 while True: if year % 15 + 1 == E and year % 28 + 1 == S and year % 19 + 1 == M: print(year + 1) break year += 1
du2lee/BOJ
BOJ/python/1476.py
1476.py
py
208
python
en
code
3
github-code
90
18436815979
import math def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors a,b,c=map(int,input().split()) n=math.gcd(a,b) ans=make_divisors(n) ...
Aasthaengg/IBMdataset
Python_codes/p03106/s670384804.py
s670384804.py
py
334
python
en
code
0
github-code
90
27575735742
# encoding: utf-8 """ File: core_service Author: twotrees.zf@gmail.com Date: 2020年7月30日 31周星期四 10:55 Desc: """ import uuid import os from os import path import zipfile import plistlib import re import jsonpickle from .keys import Keyword import json import subprocess HOST_ORIGIN = 'https://ipafly.inke...
twotreeszf/IPAFly
core/core_service.py
core_service.py
py
5,936
python
en
code
0
github-code
90
72453414376
from numpy import sin, cos, tan, pi, inf import matplotlib.pyplot as plt from geometry import LineSet from innerbilliards import InnerBilliards from outerbilliards import SmoothBilliards as OuterBilliards fDist = 1.5 minor1 = 2 major1 = (minor1**2 + fDist**2)**0.5 Bi = InnerBilliards(lambda t: [ major1 * cos(2*p...
barefootbrock/OuterBilliards
inner vs outer.py
inner vs outer.py
py
1,077
python
en
code
0
github-code
90
19512108427
import numpy as np def greenTheorem(array): array = array[array[:, 0].argsort()] x_vector = array[:,0] y_vector = array[:,1] rolled_x_vector = np.roll(x_vector.copy(), shift=1) rolled_y_vector = np.roll(y_vector.copy(), shift=1) return 0.5 * (( rolled_x_vector @ y_vector) - ( rolled_y_vector...
NicolasNigno/computational_geometry
1.convex_hull_2d/greenTheorem.py
greenTheorem.py
py
335
python
en
code
1
github-code
90
29490577343
# This file will be mainly used for basic functionality of the bot. import discord from dotenv import load_dotenv import os import responses load_dotenv() # This is the return function for sending the user messages async def send_message(message, user_message, private): try: response = responses.test_resp...
CNicdao/MindfulBot
bot.py
bot.py
py
1,303
python
en
code
1
github-code
90
37846392535
''' This file is part of GEAR_mc. GEAR_mc is a fork of Jeremie Passerin's GEAR project. GEAR is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at...
miquelcampos/GEAR_mc
gear/xsi/rig/__init__.py
__init__.py
py
18,675
python
en
code
24
github-code
90
21750823272
from sqlalchemy import ( Column, Enum as MariaEnum, Integer, Float, Boolean, MetaData, String, Table, Text, ) convention = { 'all_column_names': lambda constraint, table: '_'.join([ column.name for column in constraint.columns.values() ]), 'ix': 'ix__%(table_name)s__%(all_column_names)s', ...
lamedevelop/nsdhackathon2021
app/db/schema.py
schema.py
py
2,167
python
en
code
0
github-code
90
22598533807
#detection of colors in an image to detect multiple colored blocks. #Ryan Donald UML PeARL February 2021 import rospy from sensor_msgs.msg import Image from sensor_msgs.msg import PointCloud2 import sensor_msgs.point_cloud2 as pc2 import cv2 import numpy as np import struct from cv_bridge import CvBridge, CvBridgeErro...
ryan-donald/NumberBlockSorting
number_block_sorting/src/vision/colormask_simulation.py
colormask_simulation.py
py
6,569
python
en
code
0
github-code
90
17361321618
# coding=utf-8 ''' 1. 全局解释锁GIL PYthon虚拟机(解释器主循环)只能有一个控制线程在执行,就像单核CPU一样 每个执行的线程,必须先获得 GIL;除非线程执行IO 2. 驼峰式函数都已经取消 直接设置值: 使用下划线: ''' ####################################################################################### ''' thread 已经被弃用 1. 同步源于很少 2. 对子进程何时...
Martians/code
basic/python/0_common/5_thread/1_threading.py
1_threading.py
py
1,602
python
zh
code
1
github-code
90
73679570855
from collections import deque def bfs(x, y, cnt): q = deque() q.append((x, y, cnt)) visited[x][y] = 0 while q: x, y, cnt = q.popleft() if r2 == x and c2 == y: print(cnt) exit() for i in range(6): nx = x + dx[i] ny = y + dy[i] ...
y7y1h13/Algo_Study
beakjun/86일차/데스 나이트.py
데스 나이트.py
py
661
python
en
code
0
github-code
90
10901399593
import re, logging class BrowserDetails: def __init__(self, user_agent_string): self.user_agent = user_agent_string if user_agent_string.find("Chrome") >= 0: self.browser_name = "Chrome" self.browser_family = "Chrome" self.browser_engine = "Webkit" elif user_agent_string.find("Chr...
JohnSmithDev/js1kpiano
content.py
content.py
py
2,803
python
en
code
1
github-code
90
11949482708
import requests from twilio.rest import Client import os OWA_Endpoint = "https://api.openweathermap.org/data/2.5/onecall" api_key = os.environ.get("OWA_API_KEY") auth_token = os.environ.get("AUTH_TOKEN") account_sid = os.environ.get("ACCOUNT_SID") parameters = {'lat': your_latitude, "lon": your_longitude, "appid": api...
alexandru-ghibea/weather_project_api-s
main.py
main.py
py
918
python
en
code
0
github-code
90
1447477987
class Solution: def findMedianSortedArrays(self, nums1, nums2): def getKthElement(k): index1, index2 = 0, 0 while True: # 特殊情况 if index1 == m: return nums2[index2 + k - 1] if index2 == n: return n...
Dod-o/LeetCode
1-10/4.Median_of_Two_Sorted_Arrays.py
4.Median_of_Two_Sorted_Arrays.py
py
1,281
python
en
code
24
github-code
90
18800778282
import torch import numpy as np from networks import get_network, set_requires_grad from util.hausdorff import directed_hausdorff from agent.base import GANzEAgent class MainAgent(GANzEAgent): def __init__(self, config): super(MainAgent, self).__init__(config) self.weight_z_L1 = config.weight_z_L...
ChrisWu1997/Multimodal-Shape-Completion
agent/agent_gan.py
agent_gan.py
py
4,918
python
en
code
93
github-code
90
29260706091
import threading import time class mythread(threading.Thread): def __init__(self,threadID,name,count): #表示定义 加self #threading.Thread.__init__(self) #表示调用 不加self super().__init__() self.threadID = threadID self.name = name self.count = count def run(self): ...
johnkle/FunProgramming
Python/pythonBasic/thread1.py
thread1.py
py
903
python
en
code
0
github-code
90
43050221676
import csv import logging import os import smtplib import sys from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application import MIMEApplication from importlib import resources from pathlib import Path try: import tomllib except ModuleNotFoundError: import to...
alexcheng628/carrier-services
src/carrier_services/utils/utils.py
utils.py
py
4,268
python
en
code
0
github-code
90
70191942696
#!/bin/env python3 # Based on https://gitlab.gnome.org/GNOME/mutter/-/blob/main/check-style.py import argparse import os import re import shutil import subprocess import sys import tempfile # Path relative to this script uncrustify_cfg = 'tools/gtk.cfg' def check_progs(): git = shutil.which('git') patch = ...
GNOME/gnome-system-monitor
check-style.py
check-style.py
py
4,246
python
en
code
71
github-code
90
17944798839
N,K = map(int,input().split()) XY = [tuple(map(int,input().split())) for i in range(N)] xs = [] ys = [] for x,y in XY: xs.append(x) ys.append(y) xs.sort() ys.sort() ans = float('inf') for l in range(N-1): for r in range(l+1,N): w = xs[r] - xs[l] for d in range(N-1): for u in ran...
Aasthaengg/IBMdataset
Python_codes/p03576/s160918635.py
s160918635.py
py
674
python
en
code
0
github-code
90
14048401011
from enum import Enum import numpy as np from matplotlib import pyplot as plt from sklearn.metrics.pairwise import euclidean_distances from sklearn.preprocessing import normalize class ForcesConfig: SAFE_DIVISION_EPSILON = 1e-8 class Strategy(Enum): SINGLE_FORCE_SCALES = 1, # 1 scale factor f...
AlexDeLos/Circles_in_a_squares
forces.py
forces.py
py
4,812
python
en
code
0
github-code
90
34871717830
from datetime import ( datetime, timedelta, ) import dateutil.tz from dateutil.tz import gettz import numpy as np import pytest import pytz from pandas import ( DatetimeIndex, Timestamp, bdate_range, date_range, offsets, to_datetime, ) import pandas._testing as tm try: from zonein...
pandas-dev/pandas
pandas/tests/indexes/datetimes/methods/test_tz_localize.py
test_tz_localize.py
py
14,830
python
en
code
40,398
github-code
90
16571083087
""" 手动写GCD """ import collections from functools import reduce class Solution(object): def hasGroupsSizeX(self, deck): vals = collections.Counter(deck).values() gcd = reduce(self.gcd0, vals) return gcd >= 2 def gcd0(self, a, b): if a > b: smaller = b ...
superggn/myleetcode
array/easy/914-x-of-a-kind-in-a-deck-of-cards-3.py
914-x-of-a-kind-in-a-deck-of-cards-3.py
py
645
python
en
code
0
github-code
90
21857998249
n, k, prime = map(int, input().split()) # 특정 프라임 진법 구하기 def primeNatation(n, k): resN, resK = [], [] while n: resN += [n % prime] resK += [k % prime] n //= prime k //= prime return resN, resK d = [0] * 4_000_001 d[:3] = [0, 1, 2] def combination(n, k): if k > n: ...
dlams/Algorithm-Practice
Backjoon/11000/11402 이항 계수 4.py
11402 이항 계수 4.py
py
778
python
en
code
1
github-code
90
4939114057
import pandas as pd import matplotlib.pyplot as plt def plot_roc(x, y): plt.plot(x, y) plt.xlabel('FPR') plt.ylabel('TPR') plt.show() def auc(x, y): ans = 0 for i in range(0, len(x) - 1, 1): ans += 0.5 * (x[i + 1] - x[i]) * (y[i + 1] + y[i]) return ans df = pd...
tystys404/nju-ml2023
hw1/编程题/code/roc.py
roc.py
py
1,008
python
en
code
0
github-code
90
32941691327
import json import KickerScore import stattypes class Match: def __init__(self, match, week_stats_df): home_kicker = self.get_kicker(match.home_lineup) away_kicker = self.get_kicker(match.away_lineup) home_kicker_name = self.format_name(home_kicker.name) away_kicker_name = self.format_name(away_kicker.name...
garettmiller/SqahhFantasy
python/Match.py
Match.py
py
1,412
python
en
code
0
github-code
90
23545690801
import os from mpi4py import MPI ksdgdebug = set(os.getenv('KSDGDEBUG', default='').split(':')) def log(*args, system = 'KSDG', **kwargs): comm = MPI.COMM_WORLD rank = comm.rank if system in ksdgdebug or 'ALL' in ksdgdebug: print('{system}, rank={rank}:'.format(system=system, rank=rank), *args, fl...
leonavery/KSDG
KSDG/ksdgdebug.py
ksdgdebug.py
py
340
python
en
code
0
github-code
90
20841406827
import shelve d = shelve.open('shelve_test') print(d.get('seasons')) print(d.get('pp')) # seasons = ['spring', 'summer', 'autumn', 'winter'] # # pp = {'temperature': 'comfy', 'special': 'flower'} # # d['seasons'] = seasons # d['pp'] = pp d.close()
hi-andy/python-study
Module/shelve_module.py
shelve_module.py
py
253
python
en
code
0
github-code
90
16040967395
class Calcultor(object): # 静态方法 @staticmethod def add(a, b): return a + b @staticmethod def minus(a, b): return a - b print(Calcultor.add(1, 4)) print(Calcultor.minus(9, 2)) class Person: type = "human" def __init__(self, name, age): self.name = name sel...
EricWord/PythonStudy
15-oop/oop_demo12.py
oop_demo12.py
py
1,714
python
zh
code
0
github-code
90
40112184844
import torch import torch.nn as nn import torch.nn.functional as F from pytorchvideo.layers.utils import set_attributes from pytorchvideo.transforms.functional import convert_to_one_hot class SoftTargetCrossEntropyLoss(nn.Module): """ Adapted from Classy Vision: ./classy_vision/losses/soft_target_cross_entrop...
facebookresearch/pytorchvideo
pytorchvideo/losses/soft_target_cross_entropy.py
soft_target_cross_entropy.py
py
3,321
python
en
code
3,050
github-code
90
70593472937
import numpy as np import logging from hyperparameters import NEIGHBORS, DISTANCE def get_owned_squares(game_map, id): """ Returns all currently owned squares by id that have a strength > 0 """ # Run through gamemap and check if condition is met # add correct squares to lists owned_squares = [...
sselbach/production-seizer
window.py
window.py
py
1,779
python
en
code
0
github-code
90
10750302380
import os import optparse import sys import pandas as pd import numpy as np import random from scipy import stats sys.path.insert(0, '..') from constant_values import * def add_flag_to_processed_csv(data_folder): text_files = [] for root, dirs, files in os.walk(data_folder): for file in files: ...
romanroads/hedwig
python/tools/add_flag_to_processed_csv.py
add_flag_to_processed_csv.py
py
4,290
python
en
code
0
github-code
90