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
27321032293
""" Kela Purchase data preprocessing Reads Kela Purchase data, applies the preprocessing steps below and writes the result to files split by year. - Convert column names to uppercase - Rename HETU to FINREGISTRYID - Format dates to YYYY-MM-DD - Drop duplicates rows - Fix data types Input files: - For years 1995-2019...
dsgelab/finregistry-data
finregistry_data/registries/kela_purchase.py
kela_purchase.py
py
3,850
python
en
code
0
github-code
6
44138812715
def solution(data, col, row_begin, row_end): answer = 0 # col번째 인덱스 기준 오름차순 정렬 #for i in range(0, len(data) - 1): # currv = data[i][col] # for j in range(i, len(data) - 1): # nextv = data[j][col] # if currv > nextv: # data[i], data[j] = data[j], data[i] # 중복 ...
ralpioxxcs/problemsolving
programmers/table_hash.py
table_hash.py
py
1,112
python
ko
code
0
github-code
6
20840870665
""" файл с утилитами """ import os from time import perf_counter import numpy as np from sklearn.metrics import ( brier_score_loss, matthews_corrcoef, roc_curve, precision_recall_curve, auc, cohen_kappa_score, classification_report, # confusion_matrix, ) from sklearn.metrics import reca...
Lenin22/ML-Demo
utils.py
utils.py
py
1,071
python
en
code
0
github-code
6
3326207971
import json import logging from datetime import datetime import requests from system import settings from system.constants import MODACTION_WH, USELESS_DETAILS webhook = settings.DISCORD_MODLOG_WEBHOOK bots = ['AutoModerator', 'FloodgatesBot'] log = logging.getLogger('worker.dsws') def make_embed(entry): ts = d...
rchile/mod-toolbox
toolbox/discord_ws.py
discord_ws.py
py
2,511
python
en
code
3
github-code
6
16370593696
import re import sys from collections import defaultdict def get_num_overlapping_points(lines): counts = defaultdict(lambda: 0) for (x1, y1), (x2, y2) in lines: if x1 == x2: # hortizonal y11, y22 = (y1, y2) if y2 > y1 else (y2, y1) for y in range(y11, y22 + 1): ...
sjsawyer/aoc-2021
q05/q05.py
q05.py
py
1,577
python
en
code
0
github-code
6
37219847623
# For Else & while else target = 7 search = [1,2,3,4,5,6,7] searchlen = int(len(search)+1) for i in range(searchlen+1): if i == target: print(f"{i} is the target") break else: # Alltså om inte for loopen breakas så kommer detta köras print("I didn't find the target") print(f"{target} is...
GGisMee/Python
intermediate_python/trick/9__For_Else_While_Else.py
9__For_Else_While_Else.py
py
564
python
en
code
3
github-code
6
26625473616
"""Pluggable newsletter handling.""" from django import forms from django.utils.translation import ugettext_lazy as _ from livesettings import config_value from satchmo_store.accounts.signals import satchmo_registration from satchmo_store.contact.signals import satchmo_contact_view from satchmo_utils import load_modul...
dokterbob/satchmo
satchmo/apps/satchmo_ext/newsletter/__init__.py
__init__.py
py
2,206
python
en
code
30
github-code
6
41313263665
import appdaemon.plugins.hass.hassapi as hass import time from babel.numbers import format_number, format_decimal class wasserdroger(hass.Hass): def initialize(self): self.listen_state(self.inputhandler, self.args["trigger"], old="off", new="on") self.listen_state(self.inputhandler, self.args["tri...
balk77/Home-AssistantConfig
appdaemon4/conf/apps/wasserdroger.py
wasserdroger.py
py
1,208
python
en
code
3
github-code
6
29686629055
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.request import Request from rest_framework import status from drf_yasg.utils import swagger_auto_schema from ..models import ( Appeal, ) from ..serializers import ( AppealSerializer, ) class AppealCreate(A...
quvvatullayev/tour
tour/views/appeal.py
appeal.py
py
2,625
python
en
code
0
github-code
6
27213136275
import sys N, M = map(int, sys.stdin.readline().rstrip().split()) board = [[0 for i in range(N + 1)] for j in range(N + 1)] visited = [False for _ in range(N + 1)] answer = 0 def dfs(idx): visited[idx] = True for i in range(1, N + 1): if board[idx][i] == 1 and visited[i] is False: dfs(i)...
hammii/Algorithm
BAEKJOON_python/11724_연결요소의개수.py
11724_연결요소의개수.py
py
564
python
en
code
2
github-code
6
43865643259
import os import re import ssl from datetime import datetime, timedelta from typing import Any, Dict, Optional, TypeVar, Union import ciso8601 T = TypeVar("T", str, None) # From https://stackoverflow.com/questions/4628122/how-to-construct-a-timedelta-object-from-a-simple-string # Answer: https://stackoverflow.com/a/...
No767/Kumiko
Bot/Libs/utils/utils.py
utils.py
py
3,388
python
en
code
20
github-code
6
32188046557
# 프로그래머스 - 완전탐색(피로도) # 순열을 사용해서 던전 순서를 모두 만들어 주었다. # 이후 만들어진 던전 순서를 사용하고 for문을 사용해서 result의 결과가 # 가장 많은 것으로 값을 바꾸어 주는 방식을 사용하였다. from itertools import permutations def solution(k, dungeons): answer = 0 a = [] for i in range(len(dungeons)): a.append(i) permute = permutations(a,len(dungeons)) ...
kcw0331/python-for-coding-test
programmers-coding/피로도.py
피로도.py
py
794
python
ko
code
0
github-code
6
29646015431
from openerp import models class ProcurementOrder(models.Model): _inherit = 'procurement.order' def _find_procurements_from_stock_planning( self, company, to_date, states=None, from_date=None, category=None, template=None, product=None, location_id=None, periods=False, without_pu...
odoomrp/odoomrp-wip
stock_planning_procurement_generated_by_plan/models/procurement_order.py
procurement_order.py
py
1,034
python
en
code
119
github-code
6
71573663549
import requests from bs4 import BeautifulSoup import pandas as pd import numpy as np import regex as re from sqlalchemy import create_engine, String, Float, DATE import pymssql from datetime import date, datetime import matplotlib.pyplot as plt import os from dotenv import load_dotenv from empiricaldist import Cdf impo...
emadam/glassdoor
app.py
app.py
py
9,171
python
en
code
0
github-code
6
21234086726
arr=input() substr=[] for i in range(0,len(arr)): for j in range(i,len(arr)): substr.append(arr[i:j+1]) substr=list(map(int,set(substr))) pronic_set=[] n=1 p_no=0 while(p_no<=int(arr)): p_no=n*(n+1) pronic_set.append(p_no) n+=1 pronic_no=[] for i in substr: for j in pron...
AniruddhaNaidu/Python-Coding
Pronic numbers.py
Pronic numbers.py
py
413
python
en
code
0
github-code
6
25208776927
from flask import Flask, request, jsonify import os import jwt from flask_cors import CORS, cross_origin from dynamodb import DB application = Flask(__name__) db = DB() CORS(application, headers=['Content-Type', 'Authorization'], supports_credentials=True, expose_headers='Authorization', origins='*') JWT_S...
DiscreetAI/explora-server
server/main.py
main.py
py
2,020
python
en
code
9
github-code
6
34839514933
#LATIHAN 6 #PROGRAM MENAMPILKAN LIST KE DALAM TABEL nilai = [{'nim' : 'A01', 'nama' : 'Agustina', 'mid' : 50, 'uas' : 80}, {'nim' : 'A02', 'nama' : 'Budi', 'mid' : 40, 'uas' : 90}, {'nim' : 'A03', 'nama' : 'Chicha', 'mid' : 100, 'uas' : 50}, {'nim' : 'A04', 'nama' : 'Donna', 'mid' : 20, '...
tolipbukankalengkaleng/Pemrograman-Tersturktur
latihan6chapter9.py
latihan6chapter9.py
py
1,246
python
sr
code
0
github-code
6
72179452347
import json with open("test.txt","r",encoding="utf-8") as f: text = f.read() "hallo".replace() # removing unwanted characters from text words = text.replace('\n',' ').replace('.',' ').replace(',',' ').replace(';',' ').replace('!',' ').replace('?',' ').replace(':',' ') # split the text into list of words, drop ...
Zadest/python-5
word_count_dict.py
word_count_dict.py
py
889
python
en
code
0
github-code
6
14235086016
from http.client import HTTPSConnection from tkinter import filedialog as fd from tkinterdnd2 import * from threading import * from tkinter import * from json import * from sys import * from tkinter import ttk from time import sleep import tkinter as tk import pyimgur import random import sys ''' GUIDES I USED https...
vaperyy/ImageBot_for_Discord
image_bot.py
image_bot.py
py
13,058
python
en
code
0
github-code
6
36780535651
from typing import List, Union, Iterator, Tuple from cell import Cell class World: NEIGHT = ( (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1) ) def __init__(self, width, height): self.w = width self.h = ...
AzaubaevViktor/evo_life
world.py
world.py
py
2,710
python
en
code
0
github-code
6
70911318267
# -*- coding: utf-8 -*- import scrapy from time import sleep from random import randint class ImdbSpiderSpider(scrapy.Spider): name = 'imdb_spider' allowed_domains = ['www.imdb.com'] start_urls = ['https://www.imdb.com/search/title/?release_date=2019-01-01,&sort=num_votes,desc'] page_count = 0 de...
ArRosid/Scrapy-Project
scrapy_project/spiders/imdb_spider.py
imdb_spider.py
py
1,669
python
en
code
1
github-code
6
44476674074
from abc import ABCMeta, abstractmethod from typing import List import torch import torch.nn as nn import torch.nn.functional as F from app.config.settings import FONT_LABEL_TO_META, NUM_TOP_K from app.domain.entity import BoundingBox, PredictFont from app.domain.preprocess import Preprocessor from PIL.Image import Im...
kishimoto-banana/font-search-api
app/domain/predictor.py
predictor.py
py
2,308
python
en
code
0
github-code
6
2639510151
import nextcord from nextcord import ( Interaction, slash_command ) from nextcord.ext import commands coins = "<a:coins:952154182851383416>" mainshop = [ { "buyname": ["bodyguard", "bg", "Bodyguard", "BODYGUARD", "BG", "bODYGUARD"], "name": "<:Thief:952151438157570078> Bodyguard", "p...
coderFlameyosFlow/Famu-Bot
cogs/economy/shop.py
shop.py
py
2,024
python
en
code
1
github-code
6
4702516944
import math import os import random import re import sys """ 跳云问题: 假如有一串包含0或者1的数字表示云,1表示危险的云,0表示安全的 一个人最远跳2个(假设此题终有解) 编程计算最少跳几下 """ # Complete the jumpingOnClouds function below. def jumpingOnClouds(c): i=0 # current position s=0 # steps need while i<c.__len__()-1: if i+2<c.__len__() and c[i+2]==...
relidaning/myPython
hackerrank/jumpingOnClouds.py
jumpingOnClouds.py
py
607
python
zh
code
0
github-code
6
26797450576
from birch.cells.cell import Cell from birch.util import BG_COLOR from random import shuffle class ConnectableCell(Cell): _masks = { '': '00000000', '_h': '01102222', '_v': '10012222', '_tl': '00112220', '_tr': '01012202', '_bl': '10102022', '_br': '11000222'...
lysol/birch
birch/cells/connectable.py
connectable.py
py
5,363
python
en
code
0
github-code
6
73712873787
# -*- coding: utf-8 -*- import pandas as pd def DropCols(): for num in range(1,2,1): print("now is dropping columns in---"+"HO_",num,".csv") df=pd.read_csv("HO_{}.csv".format(str(num) ) ) #df=df.drop['Unnamed: 0',1] x=[0] df.drop(df.columns[x],axis=1,inpla...
jasscical/pythonLearning
03_去掉某一列.py
03_去掉某一列.py
py
895
python
en
code
0
github-code
6
42967514090
class CalibrationAlert: def __init__( self, device_id, command, session, step, direction, ): self.device_id = device_id self.command = command self.session = session self.step = step self.direction =...
sjuggernaut/smartback
infra/domain/alert/calibration_alert.py
calibration_alert.py
py
576
python
en
code
0
github-code
6
26602476689
import numpy as np import pandas as pd import datetime as dt import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func, inspect from flask import Flask, jsonify app = Flask(__name__) engine = create_engine("sqlite:///Resources/haw...
SofiaAS1/SQLalchemy-Challenge
app.py
app.py
py
3,377
python
en
code
0
github-code
6
2721595571
import random ############################################################################### # Name: recombine # # Assumption: None # # Purpose: Recombine takes two lists and change the contents of a third # to corresponding chunks of the first two lists. This is done # by copying over elements...
emanuelbust/agentlDel-Rho
cycle.py
cycle.py
py
10,802
python
en
code
0
github-code
6
70945121788
# 웹에서 검색자료 읽은 후 워드 클라우드로 출력 from bs4 import BeautifulSoup import urllib.request from urllib.parse import quote from boto.dynamodb import item #keyword = input('검색어:') keyword = '장마' print(keyword) print(quote(keyword)) # 동아일보 검색 기능 사용 target_url = "http://www.donga.com/news/search?query=" + quote(keyword)...
kangmihee/EX_python
py_morpheme/pack/morp3wordcloud.py
morp3wordcloud.py
py
1,969
python
en
code
0
github-code
6
39373093044
import requests __author__ = "Griffith Asare Awuah (@gwuah)" class ogma(): """Language Detection Library For Pythonistas""" def __init__(self, accessKey): self.payload = {'access_key': str(accessKey)} def detect(self, phrase) : self.payload['query'] = str(phrase) try : r = requests.get('http://apilaye...
gwuah/ogma
api.py
api.py
py
1,561
python
en
code
1
github-code
6
71840538747
from flask import Flask from flask import render_template from flask import Response, request, jsonify app = Flask(__name__) current_id = 4 sales = [ { "id": 1, "salesperson": "James D. Halpert", "client": "Shake Shack", "reams": 1000 }, { "id": 2, "salesperson": "Stanley Hudson", "client": "Toast", ...
haoshuai999/User-Interface
cu-paper-infinity&ppc/app.py
app.py
py
2,393
python
en
code
0
github-code
6
21430351891
''' Created For Mega Projects Repository Turtle Graphics - This is a common project where you create a floor of 20 x 20 squares. Using various commands you tell a turtle to draw a line on the floor. You have move forward, left or right, lift or drop pen etc. Do a search online for "Turtle Graphics" for more informatio...
SambitAcharya/Projects
My Solutions/Graphics-And-Multimedia/turtlegraphics.py
turtlegraphics.py
py
1,211
python
en
code
0
github-code
6
14987411881
from PIL import Image import os from tkinter import filedialog import tkinter as tk def convert_pdf(): index = 0 path_picture = filedialog.askdirectory() dire = 'Converted' path_pdf = os.path.join(path_picture , dire) os.mkdir(path_pdf) my_list = os.listdir(path_picture) for i in my_list...
Elkayamacc/Image2PDF
PDFConverterV2.py
PDFConverterV2.py
py
561
python
en
code
0
github-code
6
32397358077
import os import random import numpy as np import torch from scipy import ndimage as ndi from torch.nn import functional as F from torch.utils.data import Dataset from my_utils import normalize class UNetDataset(Dataset): def __init__(self, data_dir, shape, train, transform): self.shape = ...
alienzyj/PPos
my_dataset.py
my_dataset.py
py
10,080
python
en
code
0
github-code
6
30814462620
""" Script Description - train NADA model Usage - $ python train_nada.py --config_path [config_path] --name [exp_name] --suppress - $ cat [config_path] | python train_nada.py --pipe --name [exp_name] --suppress Author - Minsu Kim - Dongha Kim History - 230419 : MINSU , init - adaptation ...
studio-YAIVERSE/studio-YAIVERSE
train_nada.py
train_nada.py
py
13,226
python
en
code
20
github-code
6
69894764349
import sys import random class HashSolution: def __init__(self, string): # Store string input and length self.string = string self.string_len = len(string) + 1 # Initialize hash tables self.hash_table_1 = [0] * self.string_len self.hash_table_2 = [0] * self.string_len # Initialize coef tables self....
gregh13/Data-Structures
Week3_hash_tables/4_substring_equality/substring_equality.py
substring_equality.py
py
2,938
python
en
code
0
github-code
6
19214467121
from replit import clear print("Welcome to the secret auction program!") def highest_bidder(bid_record): highest = 0 winner = "" for bidder in bid_record: bid_amount = bid_record[bidder] if bid_amount > highest: highest = bid_amount winner = bidder print(f"The winner is {winner} with a bid ...
Iyemizee/Secret_Auction_Project
main.py
main.py
py
678
python
en
code
0
github-code
6
24293515303
def is_valid(board, row): if row in board: return False column = len(board) for occupied_column, occupied_row in enumerate(board): if abs(occupied_row - row) == abs(occupied_column - column): return False return True def n_queens(n, board=[]): if n == len(board): ...
ckallum/Daily-Interview-Pro
solutions/N-Queens.py
N-Queens.py
py
789
python
en
code
16
github-code
6
42786347897
import os import math import glob import time import random import torch from PIL import Image from torch.utils import data from torchvision.transforms import RandomCrop import numpy as np import core.io as io import core.clip_utils as cu import multiprocessing as mp class CachedAVSource(data.Dataset): def __ini...
fuankarion/active-speakers-context
core/dataset.py
dataset.py
py
16,534
python
en
code
52
github-code
6
9272119407
import os import numpy as np import spacy import re import json import pyttsx3 #replace it to librosa import os import librosa import numpy as np from fastdtw import fastdtw from gtts import gTTS from scipy.spatial.distance import euclidean from fastdtw import fastdtw import shutil import config def create_folder_if_...
RamSankarTheDeveloper/TeenyTinyTitleTrove
utils.py
utils.py
py
10,032
python
en
code
0
github-code
6
72333132669
""" @File : AdaBoost.py @Time : 2020-05-26 @Author : BobTsang @Software: PyCharm @Email : bobtsang@bupt.edu.cn """ # 这次用的是乳腺癌数据集做的二分类任务,因为鸢尾花数据集太小,特征较少,对于提升树不太cover # Minst:596x31 # time:62s import pandas as pd import numpy as np from sklearn import datasets import random import time # 手工实现打乱数据,不采用sklearn调...
BobTsang1995/StatisticalLearningMethod-python-
AdaBoost.py
AdaBoost.py
py
12,463
python
zh
code
2
github-code
6
70379694589
#!/usr/bin/python import pygtk pygtk.require('2.0') import gtk from gtk import gdk def destroy(widget, data=None): gtk.main_quit() w = gtk.Window(gtk.WINDOW_TOPLEVEL) w.set_title("Hello from python") w.connect('destroy', destroy) v = gtk.TextView() v.set_editable(False) b = v.get_buffer() w.add(v) w.show_all()...
carlosmn/buffer-image
pygtk-image.py
pygtk-image.py
py
451
python
en
code
0
github-code
6
16471014091
# Solution comment: Cheating. Found the list of periods on OEIS and counted the # odds from that list. from math import sqrt # First determine how many non squares there are < 10000. count = 0 for i in range(2, 10000+1): if abs(sqrt(i) - int(sqrt(i))) > 1e-6: count += 1 # Read count periods from the numb...
bsamseth/project-euler
064/64.py
64.py
py
593
python
en
code
0
github-code
6
72025042747
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import os,time while True: time.sleep(10) result = os.system("ping www.google.com -c 5 | grep '0% packet loss'") if not result == 0: os.system("echo 'No internet connection. shutting down...' >> /home/pi/cam/data/log.txt") time.sleep(5) os.system("sudo shutdown -h...
tomasBjornfot/picam
closeIfDisconnected.py
closeIfDisconnected.py
py
327
python
en
code
0
github-code
6
19200731938
import argparse from inference import Inference from model import FashionModel from train import Trainer from data import TrainDataset class ArgumentSelectError(Exception): pass def training(): train_dataset = TrainDataset( image_dir=args.train_data_dir, csv_path_train=f'data/dataset_csv/lis...
omerferhatt/deep-fashion-classification
main.py
main.py
py
4,105
python
en
code
1
github-code
6
14624971996
#coding:utf-8 from math import e import numpy as np year=150 def func(x): if x<0: return e**(g*x) else: return 1 x_1=[-3/float(40000)*x**2+3/float(200)*x for x in range(1,year)] x_2=[] T=3/2*(year-50) a=1/T**2 for x in range(1,year): if(x<=T): x_2.append(a*x**2) ...
liangzp/2018-American-Interdisciplinary-Contest-in-Modeling
Code/random_model.py
random_model.py
py
1,910
python
en
code
0
github-code
6
70732572987
""" Package for conversion between Julian date and other date/time representations. """ from .api import * __version__ = '0.1.0' __author__ = 'Nikita Churilov' __maintainer__ = __author__ __email__ = 'churilov-ns@yandex.ru' __license__ = 'MIT'
churilov-ns/juldate
juldate/__init__.py
__init__.py
py
248
python
en
code
0
github-code
6
5637517912
from urllib.request import urlopen from datetime import datetime import json from settings import my_lec_list, base_url class InfoList(object): def __init__(self): self.json = self.get_api() self.table = self.json["table"] self.count = self.json["count"] self.body = self.json["body...
pddg/learning
models.py
models.py
py
2,174
python
en
code
0
github-code
6
30614657486
from unittest import main from re import compile from ir_datasets.formats import ToucheQuery, TrecQrel, ToucheTitleQuery from ir_datasets.formats.touche import ToucheQualityQrel from test.integration.base import DatasetIntegrationTest class TestTouche(DatasetIntegrationTest): # noinspection PyTypeChecker de...
Heyjuke58/ir_datasets
test/integration/touche.py
touche.py
py
9,700
python
en
code
null
github-code
6
7627165577
from nodoProfundidad import NodoProfundidad as nodo from posicion import Posicion as posicion """ 0 -> vacio 1 -> pinocho 2 -> cigarrillos 3 -> zorro 4 -> geppeto 5 -> sin camino """ """matriz = [ [0, 3, 0, 3, 0], [1, 5, 0, 0, 0], [0, 0, 5, 5, 4], [0, 0, 0, 2, 0], [0, 0, 0, 0, 0] ]""" def Verific...
GustavoA198/proyecto1-IA
amplitud_IA.py
amplitud_IA.py
py
5,702
python
es
code
0
github-code
6
19637644362
import requests import datetime response = requests.get("https://blockchain.info/rawaddr/42e58ccd620fab780e46095f4b3f6987aa253219") data = response.json() first_tr_id = data["txs"][0]["hash"] first_tr_time = data["txs"][0]["time"] a = [1, 2, 3, 4] for n in range(len(a)): print(a[n])
maciek1066/training
bitcoin_api.py
bitcoin_api.py
py
294
python
en
code
0
github-code
6
16898559994
#!/usr/bin/env python3 import itertools def print_header(x, y, z = None): print("join_digits(", seq2digit(x), ", ", seq2some(y), ", ", seq2digit(z), ") ->", sep="") def produce(seq): while seq: if len(seq) == 4: yield seq2node(seq[:2]) yield seq2node(seq[2:]) brea...
platbox/nanometer
py/ftree_generate.py
ftree_generate.py
py
1,194
python
en
code
3
github-code
6
39931219674
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool """ fast = slow = head while fast...
bolan2014/leetcode
easy/PalindromeLinkedList.py
PalindromeLinkedList.py
py
824
python
en
code
0
github-code
6
3981438238
''' You are given an array of intervals - that is, an array of tuples (start, end). The array may not be sorted, and could contain overlapping intervals. Return another array where the overlapping intervals are merged. For example: [(1, 3), (5, 8), (4, 10), (20, 25)] This input should return [(1, 3), (4, 10), (20, 25...
MateuszMazurkiewicz/CodeTrain
InterviewPro/2019.11.17/task.py
task.py
py
1,423
python
en
code
0
github-code
6
8747012693
# -*- coding: utf-8 -*- """ Created on Sat Aug 24 23:16:21 2019 @author: ADMIN """ import pandas as pd import numpy as np import AllFunctions as af #import dateutil import math item_data=pd.read_csv("item_data.csv") log_data=pd.read_csv("view_log.csv",parse_dates=['server_time'],infer_datetime_format=True) train_d...
kinjaldand/MLProjects
AdClickPredictWNSHack/Work2.py
Work2.py
py
9,745
python
en
code
0
github-code
6
32005344445
import torch.nn as nn from transformers import BertModel from services.text_similarity.settings import Settings class BERTClassifier(nn.Module): def __init__(self, freeze_params=False): super(BERTClassifier, self).__init__() self.settings = Settings self.bert = BertModel.from_pretrained(s...
R-aryan/Text-Similarity-Using-BERT
backend/services/text_similarity/application/ai/model.py
model.py
py
1,945
python
en
code
0
github-code
6
43724697977
import random from game_logic.game import Agent from game_logic.gameExtended import GameStateExtended import numpy as np import entregables.calcular_distancias as calcular_distancias from game_logic import mcts_util, game_util class MaxNAgent(Agent): def __init__(self, index, max_depth = 2, unroll_type = "MC...
cevarodriguez/MaxN-algorithm
entregables/maxNAgent.py
maxNAgent.py
py
12,724
python
es
code
0
github-code
6
26113994325
__authors__ = ["T. Vincent"] __license__ = "MIT" __date__ = "16/05/2018" import logging import sys import numpy import pytest from silx.utils.testutils import ParametricTestCase from silx.math import colormap _logger = logging.getLogger(__name__) class TestNormalization(ParametricTestCase): """Test silx.mat...
silx-kit/silx
src/silx/math/test/test_colormap.py
test_colormap.py
py
10,291
python
en
code
106
github-code
6
42220245466
# 사용자가 이름과 이메일을 입력하면 이메일 순서대로 단순 연결 리스트를 생성하는 프로그램을 작성. """ 클래스 선언 부분 """ class Node: def __init__(self, data=None, link=None): self.data = data self.link = link """ 함수선언부분 """ def printNodes(start): current = start while current != None: print(current.data, end=' ') current...
War-Oxi/Oxi
Python_Code/Algorithm/Chapter4_Exam1.py
Chapter4_Exam1.py
py
1,370
python
ko
code
1
github-code
6
20086331044
""" Contains classes Quandle, Biquandle, Identity_Quandle, Alexander_Quandle, and Singquandle. FIXME: - Nothing for now. TODO: - If X is a rack with operation a*b, then it is a birack if we define a**b as the identity a**b == a. Thus biquandle matrix2 should be optional. - Does the above apply...
RafaelMri/Pyknots
modules/quandles.py
quandles.py
py
13,410
python
en
code
1
github-code
6
8560654831
"""Bad style, but I don't know better where to put this.""" import logging import shelve from functools import wraps logger = logging.getLogger(__name__) def shelve_memoize(filename): """On-disk cache decorator using shelve.""" def decorator_shelve_memoize(func): @wraps(func) def wrapper_shel...
leogott/document-clustering
utils.py
utils.py
py
755
python
en
code
null
github-code
6
40814128
""" Plot the results. """ import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import datasets # Set a nice seaborn style for matplotlib sns.set_theme() #%% # Load results from csv df = pd.read_csv("jeopardy_results.csv", index_col="idx") #%% # Load the dataset from the Hugging Face Hub datas...
BlackHC/player_of_jeopardy
analysis.py
analysis.py
py
6,596
python
en
code
10
github-code
6
73826476026
# # Exemplo de como usar os comando Break e Continue # def loop_break(): for x in range(5, 10): if x == 7: break print("O valor de x é: ", x) loop_break() def loop_continue(): for x in range(5, 10): if x == 7: continue print("O valor de x é: ", x) l...
Feltrim/CursoPython-LinkedInLearning
Exercicios/arquivos_de_exercicios_descubra_o_python/Cap. 02/breakContinue_start.py
breakContinue_start.py
py
337
python
pt
code
0
github-code
6
13583035400
#!/usr/bin/env python3 import random import base64 from argparse import ArgumentParser from os import urandom from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend from flask import Flask, jsonify, request, send_from_directory app = Fla...
zer0x64/breaking-aes-101
challenges/ctr/ctr2/ctr2.py
ctr2.py
py
2,060
python
en
code
1
github-code
6
73369850107
#!/usr/bin/env python3 import rospy import socket as s import numpy as np from cv_bridge import CvBridge import cv2 import pickle import struct import time # import ROS messages from sensor_msgs.msg import Image from sensor_msgs.msg import CameraInfo from std_msgs.msg import Header from utils import Msg import con...
yv1es/MRMapper
core/ros_node/mr-mapper/src/camera_publisher.py
camera_publisher.py
py
3,667
python
en
code
0
github-code
6
30777311029
from container.file import File class FileMapper: def __init__(self, diff): self.diff = diff def map_files(self, project_path, fun_get_file_content): array = self.diff.split('\n') array.pop() files = [] for line in array: args = line.split('\t') ...
farmapromlab/GITAG
mapper/file_mapper.py
file_mapper.py
py
651
python
en
code
1
github-code
6
15860887121
import pandas as pd import numpy as np def compute_difference_coverage(criteria1, criteria2, save_metrics=False): df1 = pd.read_csv("res_tests_" + criteria1 + ".csv") df2 = pd.read_csv("res_tests_" + criteria2 + ".csv") df_res = pd.DataFrame([]) for i in range(len(df1.index)): curr_df2 = df2....
Stoyan4050/Training-a-Machine-Learning-Model-for-Optimal-Fitness-Function-Selection-with-the-Aim-of-Finding-Bug
ML_Algorithm/DataPreparation.py
DataPreparation.py
py
2,000
python
en
code
0
github-code
6
7169499809
from flask import Blueprint, request, jsonify, abort from modules.logger import logging from modules.config import config import modules.database as Database import modules.models as Models import modules.ldap as Ldap import modules.scanner as Scanner from modules.tools import get_token,requires_auth,check_auth,calc_...
aDrongo/ldap-device-surveyor
backend/modules/views.py
views.py
py
4,004
python
en
code
0
github-code
6
33047477278
from threading import * from Partida import * from socket import * Uno = socket(AF_INET, SOCK_STREAM) Uno.bind(("26.52.80.182", 9997)) Uno.listen() print("\033[40m{}".format("")) def sala_de_espera(cliente, index, sala): global clientes, permissao mandar(cliente, f"""Seja Bem Vindo ao UNO ONLINE\nSala {sal...
raquelmcoelho/uno
Game.py
Game.py
py
1,814
python
pt
code
0
github-code
6
72833443067
# PET DATA PROCESSING import numpy as np import matplotlib.pyplot as plt from pathlib import Path num_examples = 1386 num_examples2 = 1386 res = 64 def folder_to_array(file_name, cat_name, X, idx1, numf, numt, y, label): idx_normal = range(idx1, idx1+numf) idx_flip = range(idx1+numf, idx1+2*num...
alexgilbert747/thesis
pets_data2.py
pets_data2.py
py
1,969
python
en
code
0
github-code
6
16542834327
import sys from nuitka import Options from nuitka.ModuleRegistry import ( getDoneModules, getUncompiledModules, getUncompiledTechnicalModules, ) from nuitka.plugins.Plugins import Plugins from nuitka.PythonVersions import python_version from nuitka.Tracing import inclusion_logger from nuitka.utils.CStrings...
Nuitka/Nuitka
nuitka/code_generation/LoaderCodes.py
LoaderCodes.py
py
5,236
python
en
code
10,019
github-code
6
73008025149
# Lesson 26 my code from pyspark.sql import SparkSession #import spark sql with session and row from pyspark.sql import Row #both of these thigns we use to itneract with SparkSQL and dataFrames spark = SparkSession.builder.appName("SparkSQL").getOrCreate() #the get or create again, creating a new spark session or conn...
CenzOh/Python_Spark
MyCode/sparkSql.py
sparkSql.py
py
2,183
python
en
code
0
github-code
6
31536555500
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_django-private-chat ------------ Tests for `django-private-chat` models module. """ from test_plus.test import TestCase from django_private_chat.models import * class DialogMethodTest(TestCase): def setUp(self): self.dialog = Dialog() self...
ridwanray/ChatApp
tests/test_models.py
test_models.py
py
2,273
python
en
code
3
github-code
6
27025126914
#Loops #python program to find the sum of all elements of a list. #list of number. list=[2,4,5,6,78,89,56,7,2] #sum variable to the numbers. sum=0 for val in list: sum=sum+val #print sum of all elements. print("The sum of all elements in list",sum) #python program which will find all such numbers which a...
geetika25/python_problems
python2.py
python2.py
py
511
python
en
code
0
github-code
6
6368283311
import datacube import sys import xarray as xr import numpy as np import geopandas as gpd from datacube.virtual import construct_from_yaml from datacube.storage.masking import mask_invalid_data from osgeo import gdal, osr site = sys.argv[1] grid = gpd.read_file('/scratch/a.klh5/mangrove_data/shapefiles/{}.shp'.format...
klh5/wm_generator
gen_water_mask.py
gen_water_mask.py
py
2,809
python
en
code
0
github-code
6
20040165317
num_list = [0.136, 0.082, 2.691, 1.175, 4.737, 0.083, 0.082, 1.161, 2.41, 0.0, 7.421, 6.496, 5.012, 1.145, 6.512, 4.547, 4.245, 2.093, 3.511, 3.059, 1.247, 1.882, 7.155, 8.881, 5.095] num_avg = 0.0 rolling_avg = [] for i,flt in enumerate(num_list, 1): num_avg += flt rolling_avg.append(num_avg/i) num_avg = num...
mwboiss/DSI-Prep
intro_py/float_accum_3.py
float_accum_3.py
py
910
python
en
code
0
github-code
6
8585416211
import torch import torch.nn as nn from torch import cat, exp import torch.nn.functional as F from torch.nn.functional import pad from torch.nn.modules.batchnorm import _BatchNorm class my_AFF(nn.Module): ''' Point-wise Convolution based Attention module (PWAtt) ''' def __init__(self, channels=64, r=...
Al-Dailami/DTSC-CAFF
dtsc_caff_model.py
dtsc_caff_model.py
py
21,192
python
en
code
1
github-code
6
18920197222
from __future__ import annotations import sys from typing import TYPE_CHECKING from ansiblelint.rules import AnsibleLintRule if TYPE_CHECKING: from ansiblelint.file_utils import Lintable from ansiblelint.utils import Task def _changed_in_when(item: str) -> bool: if not isinstance(item, str): re...
ansible/ansible-lint
src/ansiblelint/rules/no_handler.py
no_handler.py
py
2,753
python
en
code
3,198
github-code
6
28970147437
import typing as t import collections import flask_restx import flask_restx.fields as frf import marshmallow.fields as mf from marshmallow_pynamodb import ModelSchema from model.base_model import Model from common.util import create_table class Serializer(ModelSchema): _api_model = None def __init__(self, ...
wizzdev-pl/iot-starter
web_server/server/core/serializer.py
serializer.py
py
3,081
python
en
code
7
github-code
6
43085023977
# -*- coding: utf-8 -*- from InterpolatePoints import * class InterpolatePoints(object): def __init__(self): self.label = "Interpolate points" self.description = "" self.canRunInBackground = True def getParameterInfo(self): param_points_table = arcpy.Parameter( di...
gchone/ConcordiaRiverLab-FloodTools
InterpolatePoints_Interface.py
InterpolatePoints_Interface.py
py
6,053
python
en
code
1
github-code
6
22083642525
n = input() n = list(n) lst = [] for i in range(0,len(n)-1): count = 1 for j in range(i+1,len(n)): if n[i] == n[j]: count += 1 else: break lst.append(count) print(max(lst))
vamshipv/code-repo
CSES/repeat.py
repeat.py
py
224
python
en
code
0
github-code
6
72038050107
#!/usr/bin/env python # coding: utf-8 # In[5]: # Conventions are the same as Bourbaki, for example, # Type E convention 1 3 4 5 6 7 8 # 2 # Input under above convention if type E J1=[1,2,3,4]; J2=[5,6,7,8]; Type="E";n=6; D=DynkinDiagram([Type, n]); # main program. from sage.combinat.root_syst...
Hai-Yu-Chen/RegOfUnipConjClassInTP
Regularity of Unipotent Elements in Total Positivity.py
Regularity of Unipotent Elements in Total Positivity.py
py
18,759
python
en
code
0
github-code
6
27712857647
class Solution: def maxProfit(self, prices: List[int]) -> int: min = float('inf') maxProfit = 0 for i in prices: if i < min: min = i elif i -min > maxProfit: maxProfit = i - min return maxProfit
jemis140/DSA_Practice
Best_Time_To_Buy_Stock.py
Best_Time_To_Buy_Stock.py
py
304
python
en
code
0
github-code
6
7987154827
#Problem link:https://practice.geeksforgeeks.org/problems/bst-to-max-heap/1 #Time Complexity: O(N) #Space Complexity: O(N) class Solution: def convertToMaxHeapUtil(self, root): arr = [] i = 0 #inOrder traversal #to get the values sorted def ino(node): ...
Ishantgarg-web/DailyCodingProblems
Python/Tree/BST to max heap.py
BST to max heap.py
py
891
python
en
code
3
github-code
6
6916432675
from tkinter import * import first_task import second_task import third_task class Lab1: def __init__(self): self.root = Tk() # Create Gui for first task self.file_frame = Frame(self.root) self.fr1 = LabelFrame(self.file_frame, text="First task", font="Times 16") self.fr2...
Eglantinee/AMO
Lab1/main.py
main.py
py
10,546
python
en
code
0
github-code
6
70267296829
import epyk as pk # Create a basic report object page = pk.Page() page.headers.dev() tb1 = page.ui.layouts.table() tb1.style.css.border_collapse = "separate" tb1.style.css.border_spacing = 10 # Add a header (first row is by default the header) tb1 += [1, 2, 3] # Change the CSS style of a cell in the header tb1.ge...
epykure/epyk-templates
locals/layouts/table.py
table.py
py
2,026
python
en
code
17
github-code
6
17333008494
import collections class Rectangle(): def __init__(self, w, h, placed=None, free_wh=None): self.wh = w, h self.placed = placed or [] self.free_wh = free_wh or (0,0) @property def w(self): return self.wh[0] @property def h(self): return self.wh[...
yad439/pallet-packing
concat_baseline/concat_baseline.py
concat_baseline.py
py
11,602
python
en
code
0
github-code
6
71904076349
from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive gauth = GoogleAuth() gauth.LoadCredentialsFile("mycreds.txt") if gauth.credentials is None: gauth.LocalWebserverAuth() elif gauth.access_token_expired: gauth.Refresh() else: gauth.Authorize() gauth.SaveCredentialsFile("mycreds.txt") d...
gmagannaDevelop/GlcJournal
pydrive/automated_access.py
automated_access.py
py
568
python
en
code
1
github-code
6
71150367547
import numpy as np import pandas as pd import scipy from sklearn.linear_model import LinearRegression as linreg from sklearn.linear_model import LogisticRegression as logreg from sklearn.cross_validation import KFold from sklearn.cross_validation import * from sklearn import cross_validation titanic=pd.read_csv("trai...
leminhtr/kaggle
Titanic/main_linreg-logreg.py
main_linreg-logreg.py
py
4,162
python
en
code
0
github-code
6
41202734206
import tcod import random import copy import constants as const import entity import render import numpy as np import random_loot as rloot class Room: """ A room! Wow. """ def __init__(self, x, y, w, h): self.x = x # upper left point self.y = y # upper left point self.w = w ...
cpiod/1rl
game_map.py
game_map.py
py
16,741
python
en
code
3
github-code
6
26298956035
import argparse from dateutil import tz from datetime import datetime from spotipy import Spotify import spotipy.util from models import Play, Track, Album, Artist, PostgreSQLConnection import settings def set_timezone_to_datetime(datetime_to_set, timezone): return datetime_to_set.replace(tzinfo=tz.gettz(timez...
mymindwentblvnk/hoergewohnheiten
extract/main.py
main.py
py
7,345
python
en
code
16
github-code
6
9022966300
""" 4. Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ... Количество элементов (n) вводится с клавиатуры. ЧЕРЕЗ ЦИКЛ """ num_el = int(input('enter 3 ')) summ = 0 range_num = 1 for i in range(num_el): summ += range_num range_num /= -2 print(summ)
Bulgakoff/PyAlg
Lesson_02/task_4/task_4_1.py
task_4_1.py
py
360
python
ru
code
0
github-code
6
648181227
import numpy as np import torch from affogato.affinities import compute_affinities from torchvision.utils import make_grid from inferno.extensions.criteria import SorensenDiceLoss class ConcatDataset(torch.utils.data.Dataset): def __init__(self, *datasets): self.datasets = datasets self.lens = [l...
constantinpape/affogato
src/python/module/affogato/interactive/napari/train_utils.py
train_utils.py
py
5,323
python
en
code
9
github-code
6
33618120495
import tensorflow as tf import numpy as np import time # from dataset.train import * import convert import neural import test class NeuralNetwork: def __init__(self): test_success = 0 start = time.time() target = 0.01 print('desfrdgthygju', len(data_input)) [to_train, to_t...
obernardovieira/recognize-the-number
src/nn/__init__.py
__init__.py
py
819
python
en
code
1
github-code
6
20538092339
""" Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: The subarray [4,-1,2,1] has the largest sum 6. """ """ Time Complexity:- O(n) Space Complexity:- O(1) """ class Solution: def maxSubArray(self...
Amit258012/100daysofcode
Day2/max_Subarray_sum.py
max_Subarray_sum.py
py
951
python
en
code
0
github-code
6
12959913039
import inspect from .namespace import Namespace _matches_cache = {} def matches(caller_parameters, callee_parameters): cache_key = ';'.join((caller_parameters, callee_parameters)) # pragma: no mutate cached_value = _matches_cache.get(cache_key, None) # pragma: no mutate (mutation changes this to cached_va...
jlubcke/tri.declarative
lib/tri_declarative/evaluate.py
evaluate.py
py
4,864
python
en
code
17
github-code
6
6166850776
# -*- coding: utf-8 -*- """ Created on Tue Jun 6 16:06:45 2017 @author: Francesco """ import threading import sys import serial import numpy as np import time import matplotlib.pyplot as plt global PORT global BAUD global NUM_CHANNELS global END_BUNDLE_BYTE global BYTE_PER_CHANNEL global BUNDLE...
FrancesoM/UnlimitedHand-Learning
python_side/multithread.py
multithread.py
py
5,210
python
en
code
1
github-code
6
10291438492
import numpy as np import subprocess import pandas as pd import os import sys def prompt_savefig(figure, filename): """ Take a filename for a figure, and prompt the user to overwrite an already existing file with that name if needed """ if os.path.exists(filename): prompt = input(f"{filenam...
johfst/streaminginstability
plotutils.py
plotutils.py
py
11,060
python
en
code
0
github-code
6
2088974749
"""@namespace IMP.pmi.restraints.proteomics Restraints for handling various kinds of proteomics data. """ from __future__ import print_function import IMP import IMP.core import IMP.algebra import IMP.atom import IMP.container import IMP.pmi import IMP.pmi.tools import IMP.pmi.output import numpy import math import sy...
salilab/pmi
pyext/src/restraints/proteomics.py
proteomics.py
py
23,746
python
en
code
12
github-code
6