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
19815836754
# -*- coding: utf-8 -*- from django.conf import settings from django.utils.encoding import force_text from django.utils.timezone import get_current_timezone_name from cms.cache import _get_cache_version, _set_cache_version, _clean_key, _get_cache_key from cms.utils import get_cms_setting def _placeholder_cache_key(pl...
farhan711/DjangoCMS
cms/cache/placeholder.py
placeholder.py
py
2,388
python
en
code
7
github-code
1
21844217883
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverse_nodes(self, head, count): prev, curr = None, head while curr and count > 0: next_ = curr.next ...
uditmanav17/leetcode
25-reverse-nodes-in-k-group/25-reverse-nodes-in-k-group.py
25-reverse-nodes-in-k-group.py
py
1,081
python
en
code
0
github-code
1
19471220856
""" @file @brief Data aggregation for timeseries. """ import datetime import pandas from pandas.tseries.frequencies import to_offset def _get_column_name(df, name='agg'): """ Returns a unique column name not in the existing dataframe. @param df dataframe @param name prefix @retu...
sdpython/mlinsights
mlinsights/timeseries/agg.py
agg.py
py
3,224
python
en
code
65
github-code
1
21141530709
""" Player for solitaire. Created on 19.10.2018 @author: Ruslan Dolovanyuk """ import enum import checker from constants import Colors import pygame Actions = enum.Enum('Actions', 'ChangeZoneUp ChangeZoneDown ChangeRowUp ChangeRowDown ChangeCardUp ChangeCardDown Take Drop') class Player: """Player class ...
DollaR84/solitaire
player.py
player.py
py
10,168
python
en
code
0
github-code
1
761243358
import allure import pytest from pages.cart_page import CartPage from pages.home_page import HomePage from pages.login_page import LoginPage from utils.locators import LoginPageLocators, CartPageLocators, HomePageLocators from utils.logger import _step @pytest.mark.usefixtures('setup', 'website_setup') cl...
BoxingP/selenium-auto-test
lambda/test_website/tests/test_scenarios_with_login.py
test_scenarios_with_login.py
py
4,013
python
en
code
0
github-code
1
14934683882
""" - BERT_base (L=12, H=768, A=12, #Para=110M) and BERT_large (L=24, H=1024, A=16, #Para=340M) - FNet hyper L=2, H=128, A=2; L=2, H=256, A=4; L=4 , H=256, A=4; L=4 , H=512, A= 8; L=8, H=256, A=4; L=8, H=512, A=8; L=12, H=512, A=8; L=12, H=768, A=12; - batch size: 16, 32; Learning rate (Adam): 5e-5...
lxr-tech/FEPE-deepspeed
ver/v0_0/pretrain_en_config.py
pretrain_en_config.py
py
823
python
en
code
0
github-code
1
640941004
import json import pytz import datetime def lambda_handler(event, context): tempvar2=[] timezones = pytz.common_timezones #timezones = pytz.all_timezones for timezone in timezones: tempvar = timezone[0:2] if tempvar == 'US': tempvar2.append(timezone) return { 'st...
yogeshturerao/deploymentsapis
timezone/timezone.py
timezone.py
py
382
python
fa
code
0
github-code
1
38776541163
def load_and_display(file_index,mode='both'): filename = get_image_filename(file_index) import pickle import numpy as np image = pickle.load( open( filename, "rb" ) ) if mode == 'both': display_image(image) else: # Reconstruct the original rgb and depth images from the merged v...
andrew-houghton/self-driving-donkey-car
Utility code/utilities.py
utilities.py
py
4,122
python
en
code
7
github-code
1
24965986916
import io import pandas as pd import requests from mage_ai.data_preparation.shared.secrets import get_secret_value if 'data_loader' not in globals(): from mage_ai.data_preparation.decorators import data_loader if 'test' not in globals(): from mage_ai.data_preparation.decorators import test @data_loader def lo...
WillowyBoat2388/football-analytics
data_loaders/teams_id.py
teams_id.py
py
1,368
python
en
code
0
github-code
1
26725677323
from typing import List import random from . import aiplayer, game_config, move, randomai, ship, player class SearchDestroyAi(aiplayer.AIPlayer): def __init__(self, player_num: int, config: game_config.GameConfig, other_players: List["Player"], type): super().__init__(player_num, config, other_players, ty...
ChoBro1/BattleShip
BattleShip/src/searchdestroyai.py
searchdestroyai.py
py
5,246
python
en
code
0
github-code
1
22385044991
###################################################################### # Author: IK3D -- Issanou Kamardine # License: GPL v3 ###################################################################### bl_info = { "na...
IIK3D/Blender-Scriptes-management
Scripts_Management.py
Scripts_Management.py
py
15,086
python
en
code
6
github-code
1
7117030015
class Solution: def longestConsecutive(self, nums: List[int]) -> int: numsSet = set(nums) longest = 0 for n in numsSet: if (n-1) not in numsSet: length = 0 while (n+length) in numsSet: length+=1 longest = max(len...
Theeyecode/python_alg
LeeC/easy/longest_consecutive_sequence.py
longest_consecutive_sequence.py
py
708
python
en
code
0
github-code
1
26645526251
import htmlPy import os from Handler import backend BASE_DIR = os.path.abspath(os.path.dirname(__file__)) app = htmlPy.AppGUI(title=u"Sample application", developer_mode=True) app.maximized = False app.static_path = os.path.join(BASE_DIR, "UI/static/") app.template_path = os.path.join(BASE_DIR, "UI/template/") app....
SufferProgrammer/desktop-porto
main.py
main.py
py
422
python
en
code
0
github-code
1
7214790078
import sys sys.stdin = open('불_input.txt') from collections import deque dx = [-1,1,0,0] dy = [0,0,-1,1] def bfs() : while q2 : x,y = q2.popleft() for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 <= nx < h and 0 <= ny < w and fire[nx][ny] == 0 : ...
HyunSeok0328/Algo
불.py
불.py
py
1,398
python
en
code
0
github-code
1
24657826075
from enum import IntEnum from .graph import Edge, Graph, Node from .heap import EdgeHeap class Color(IntEnum): WHITE = 0 GRAY = 1 BLACK = 2 class KruskalsAlgorithm: # get all the edges of a graph # sort them # check if they do not make a cycle # def __init__(self, G: Graph, s: int, t:...
Hemal-Mamtora/CSCE629_algo_project
src/kruskals.py
kruskals.py
py
3,570
python
en
code
0
github-code
1
12888400882
import asyncio import websockets import soundfile as sf import numpy as np # Initialize a counter for file naming file_counter = 0 connected_clients = set() async def register_client(websocket): connected_clients.add(websocket) async def unregister_client(websocket): connected_clients.remove(websocket) asyn...
Tuzteno/Ozzu
ws/ws.py
ws.py
py
2,072
python
en
code
0
github-code
1
17414099922
from PySide2.QtWidgets import QAction, QApplication, QMessageBox, QInputDialog from PySide2.QtCore import Qt from PySide2.QtGui import QIcon from PySide2.QtWidgets import QWidget, QMainWindow, QLabel, QApplication, QFileDialog from model.Workspace import Workspace from model.Chapter import Chapter from model.Book impor...
dovvla/multimedia-book
MuMijA/actions/NewBookAction.py
NewBookAction.py
py
2,130
python
en
code
0
github-code
1
13829989656
import collections import itertools import time import random from typing import Optional import streamlit as st import numpy as np import pyaudio from pydub import AudioSegment, silence from audio_io import AudioIO from audioplots import * from containers import * from layout import * ctx = { # names match py...
phoneticsushi/muesli
streamlit_app.py
streamlit_app.py
py
4,603
python
en
code
0
github-code
1
72116070115
""" Class for computing various metrics on a data set with a BayesNet Node object. """ import logging import numpy as np from .cpd.ogive import OgiveCPD EPSILON = 1e-16 MAP_ACCURACY_KEY = 'map_accuracy' AUC_KEY = 'auc' LOGLI_KEY = 'logli' D_PRIME_KEY = 'd_prime' NAIVE_KEY = 'naive' METRICS_KEYS = {NAIVE_KEY, LOGLI_...
Knewton/edm2016
rnn_prof/irt/metrics.py
metrics.py
py
11,126
python
en
code
58
github-code
1
42599399772
#!/usr/bin/env python # encoding: utf-8 import os """ @author: wenjiaGuo @version: ?? @contact: 601152819@qq.com @software: PyCharm @file: 8.收集整个网站数据.py @time: 2017/10/5 20:50 """ # 如何创建一个爬虫来收集页面标题、正文的第一个段落, # 以及编辑页面的链接(如果有的话)这些信息。 from urllib.request import urlopen from bs4 import BeautifulSoup import re page = set(...
guowenjia/scrapingAndClear
8.收集整个网站数据.py
8.收集整个网站数据.py
py
1,153
python
zh
code
0
github-code
1
41179644496
from binance.client import Client from yaspin import yaspin import os.path from datetime import datetime import pickle import pandas as pd import backtrader as bt class databutler(): def __init__(self,directory): #binance client without keys for data acquisition self.binanceClient = Client("", "")...
webclinic017/coni_standard_backtest
Databutler.py
Databutler.py
py
3,689
python
en
code
1
github-code
1
31525145901
# -*- coding:utf-8 -*- import pandas as pd # for data handling import numpy as np # for random selections, mainly import matplotlib.pyplot as plt # for plotting import matplotlib from sklearn.datasets.samples_generator import make_blobs from sklearn.tree import DecisionTree...
Batman001/pu-learning-demo
PU-Learning-Test-Blob.py
PU-Learning-Test-Blob.py
py
11,230
python
zh
code
2
github-code
1
25229432069
file = "bigboy" def read(): with open(f"{file}.txt", "r") as f: data = [datum.strip() for datum in f.readlines()] return data stamp, bus_id = read() stamp = int(stamp) bus_id = filter(lambda x: x != "x", [i for i in bus_id.split(",")]) bus_id = map(int, bus_id) d = {} def main1(): for i i...
XZETGEXI/AOC
2020/d13.py
d13.py
py
1,647
python
en
code
0
github-code
1
15461259378
""" Debug GAN, generator and discriminator and save the models """ import os import sys import logging import matplotlib.pyplot as plt from constants import default_list # Logger import from dataset import logData from make_models import logMod from class_GAN import logGAN # Debug import from unbiased_metrics impo...
Dario-Maglio/EM-shower-simulator-with-NN
em_shower_simulator/debug.py
debug.py
py
4,726
python
en
code
0
github-code
1
22088012589
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name='BraketLab', version='1.8.0', author="Audun Skau Hansen", author_email="audunsh4@gmail.com", description="Educational tool for learning quantum theory with Jupyter Notebooks", ...
audunsh/braketlab
setup.py
setup.py
py
742
python
en
code
4
github-code
1
71912287073
import argparse import subprocess import decode import os import sys def full_executable_path(invoked): # From https://bugs.python.org/issue8557 # https://bugs.python.org/issue8557 # with subprocess.open, c:\windows\system32\curl.exe has precedence on the PATH environment variable for Windows 10 ...
CAST-Extend/com.castsoftware.aip.datamart
utilities/curl.py
curl.py
py
2,519
python
en
code
1
github-code
1
73710667555
#!/usr/bin/env python # Run as: # python plot_TC_vmax.py $TC_name/ID/year # python plot_TC_vmax.py FlorenceAL062018 # import numpy as np import os, sys, datetime, time, subprocess import re, csv, glob import multiprocessing, itertools, collections import scipy, ncepy import matplotlib import matplotlib.image as imag...
LoganDawson-NOAA/MEG
TC_plotting/plot_TC_vmax.py
plot_TC_vmax.py
py
8,760
python
en
code
0
github-code
1
23353872700
# -*-coding:utf-8 -*- """ Created on 2016-7-5 @author: Danny DannyWork Project """ import socket import threading import time import logging import argparse from utils import close_socket, parse_ping_data, reply_ping_data, get_python_version, start_data_transfer, \ PING_SENDING_START, TRANSFER_PREPARE, TRANSFER_...
manyunkai/dreverse
slave.py
slave.py
py
7,337
python
en
code
7
github-code
1
6403461688
from traceback import print_tb import telebot from telebot import types import MySQLdb from datetime import datetime from telebot.types import ReplyKeyboardRemove # DB & Bot connection db = MySQLdb.connect("localhost", "root", "1", "db_bikes") or die( "could not connect to database") bot = telebot.TeleBot('530455...
oneku16/Digital_Campus
bot/bot.py
bot.py
py
3,542
python
en
code
0
github-code
1
132504097
import random import sys import threading import time from multiprocessing import Process import zmq import requests from Crypto.Hash import SHA3_256 from Crypto.PublicKey import ECC from Crypto.Signature import DSS from Pyro4.util import json n = int(sys.argv[2]) t = int(sys.argv[4]) endpoint = "htt...
Arda-Yurdakul/CS403-Term-Project
peers2.py
peers2.py
py
2,651
python
en
code
0
github-code
1
23808525747
import sys import json import urllib.error import argparse from datetime import datetime as dt from urllib.request import urlopen, urlretrieve from threading import Thread from cuter import * sys.path.append('..') from Database import * class DownloadImage: def __init__(self, image_info): self.id = ima...
sandbenders/ProphecyApparatus
scrap_reddit/scrap_reddit.py
scrap_reddit.py
py
4,101
python
en
code
0
github-code
1
14819430832
# myapp/test_app.py import unittest from fillmore.test import SentryTestHelper from myapp.app import kick_up_exception class TestApp(unittest.TestCase): def test_scrubber(self): # Reuse the existing Sentry configuration and set up the helper # to capture Sentry events sentry_test_helper ...
willkg/fillmore
examples/myapp/myapp/test_app.py
test_app.py
py
779
python
en
code
6
github-code
1
26575927806
import sys from sqlalchemy import create_engine import pandas as pd import numpy as np import pickle from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.multioutput import MultiOutputClassi...
atomopa/udacity_data_scientist_project2
models/train_classifier.py
train_classifier.py
py
4,960
python
en
code
0
github-code
1
43032086095
""" The Python script to test if the web page displays "Hello World" """ import urllib3 from bs4 import BeautifulSoup def test_hello_world(): http = urllib3.PoolManager() response = http.request("GET", "http://localhost") soup = BeautifulSoup(response.data, "html.parser") assert soup.h1.text.strip() ...
CSEC380-Group16/csec380-project
tests/test_act2.py
test_act2.py
py
388
python
en
code
0
github-code
1
28915980403
#!/usr/bin/python import math; import numpy as np from linmach import linmach from confus import confus from perceptron import perceptron #Cargar los datos data=np.loadtxt('./datos/OCR_14x14'); #Preparar variables N,L=data.shape; D=L-1; labs=np.unique(data[:,L-1]) C=labs.size; #Preparar los datos. Primero se baraja...
YdavPacat/ETSINF3
SIN/pract2/test_estimacion_error.py
test_estimacion_error.py
py
1,250
python
es
code
10
github-code
1
6472826034
""" Hello world! """ DOMAIN = "z2m_light_admin" async def async_setup(hass, config): """Set up this integration using yaml.""" url = f'/api/panel_custom/{DOMAIN}/main.js' location = hass.config.path(f'custom_components/{DOMAIN}/main.js') hass.http.register_static_path(url, location) hass.component...
Vityushka/myconfig
custom_components/z2m_light_admin/__init__.py
__init__.py
py
768
python
en
code
null
github-code
1
6781968903
dr=[0,-1] dc=[-1,0] t=int(input()) for tc in range(1,t+1): n=int(input()) arr = [] for ii in range(n): _list=list(map(int,input().split())) arr.append(_list) for r in range(n): for c in range(n): value=[] for i in range(2): nr=r+dr[i] ...
Hyunjong1461/python
200506/5188.최소합.py
5188.최소합.py
py
538
python
en
code
0
github-code
1
25889695431
# Custom module to assess performance of ML model # Author: Rupinder Singh (Oct. 25, 2016) from __future__ import division import matplotlib.pyplot as plt from sklearn.metrics import auc,r2_score import numpy as np import pandas as pd from scipy.stats import sem from mpl_toolkits.axes_grid1 import make_axes_locatable ...
rupndrsingh/predictions-mvc
pLib/rs_model_metrics.py
rs_model_metrics.py
py
22,722
python
en
code
0
github-code
1
29166855011
import numpy as np import pyqtgraph from pyqtgraph.Qt import QtGui from app.misc._miss_plot import MissPlotItem from osu_analysis import StdScoreData class HitOffsetGraph(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # Main graph self.__graph = p...
abraker-osu/osu_aim_tool
app/views/_offset_graph.py
_offset_graph.py
py
7,745
python
en
code
7
github-code
1
71377869154
import wx from wx.lib.newevent import NewCommandEvent import wx.lib.agw.cubecolourdialog as colordialog from .constants import TEXT_COLOR from .icons import ICON_BRUSH_CHECKERBOARD button_cmd_event, EVT_COLORPICKER_BUTTON = NewCommandEvent() class ColorPickerButton(wx.Control): """ Color picker widget for ...
GimelStudio/gswidgetkit
gswidgetkit/color_picker.py
color_picker.py
py
4,863
python
en
code
9
github-code
1
72383077154
import torch import torch.nn as nn import torch.nn.functional as F # Parts of these codes are from: https://github.com/Linfeng-Tang/SeAFusion class Sobelxy(nn.Module): def __init__(self): super(Sobelxy, self).__init__() kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0...
GeoVectorMatrix/Dif-Fusion
models/fs_loss.py
fs_loss.py
py
2,182
python
en
code
33
github-code
1
26890413015
# Import the modules import numpy as np import matplotlib.pyplot as plt import pickle from DDPG import DDPG from sklearn.ensemble import GradientBoostingRegressor from env import Environment import numpy as np import scipy.stats as stats # Define the parameters MAX_EPISODES = 1000 # The maximum number of ep...
CodeAlpha7/8803-SMR
Distillation/newGBDT.py
newGBDT.py
py
6,457
python
en
code
0
github-code
1
36629600964
X = dataset.drop(['class'], axis=1) y = dataset['class'] print(f'X shape: {X.shape} | y shape: {y.shape} ') X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=1) models = [] models.append(('SVC', SVC(gamma='auto'))) # evaluate each model in turn results = [] model_names = [] for name...
satwik12234/Iris-Flower-Classification
ModelBuilding1.py
ModelBuilding1.py
py
619
python
en
code
0
github-code
1
9274154374
class Solution: def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int: if (len(s) <= 2): return len(s) i = maxLength = 0 j = 1 seen = [s[0]] while (j < len(s)): if (len(seen) == 1 and s[j] not in seen): seen.insert(0, s[j]) ...
FlashWolfDragon/leetcode-submissions
problems/159.longest-2-substring.py
159.longest-2-substring.py
py
567
python
en
code
0
github-code
1
13140445812
#!/usr/bin/env python3 import scapy.all as scapy import time import sys import argparse def get_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-t', '-target', dest='target_ip', help='Target IP') parser.add_argument('-s', '-spoof', dest='spoof_ip', help='Spoof IP') opti...
userbarbu/hk4ing-tools
arp_spoof.py
arp_spoof.py
py
1,851
python
en
code
0
github-code
1
5059822920
from __future__ import annotations from dataclasses import dataclass, field from math import ceil from pathlib import Path from typing import TYPE_CHECKING, Any, overload from vstools import ( MISSING, CustomRuntimeError, FileWasNotFoundError, MissingT, core, expect_bits, get_user_data_dir, get_video_format, ...
jiaolovekt/HPCENC
deps/vs-plugins/vsscale/shaders.py
shaders.py
py
6,240
python
en
code
11
github-code
1
36365558628
import os import logging """ 读取文件函数 """ # ------------------------------ logging.basicConfig( level=logging.DEBUG, format="\033[37m[%(asctime)s] [%(pathname)s] (%(levelname)s-第%(lineno)d行) \n%(message)s\033[0m") # ------------------------------ def open(self, all): # 读取文件夹内文件 # 输入路径 """ :param se...
ramchan1988/HUMEI1
os_file.py
os_file.py
py
1,512
python
en
code
0
github-code
1
10556332205
""" History AUTHOR: JOE ROCCA """ from __future__ import print_function import httplib import json from random import randint from datetime import datetime import calendar # --------------- MAIN FUNCTIONS ---------------------- def lambda_handler(event, context): """ Route the incoming request based on type (Lau...
joerocca/AmazonEchoHistorySkill
HistoryAlexaSkill.py
HistoryAlexaSkill.py
py
8,308
python
en
code
1
github-code
1
69902924513
import os file = open("textoprueba1.txt") print(file.read()) file.close() file = open("textoprueba1.txt") for line in file: print(line) file.close() file2 = open("textoprueba2.txt",'w') file3 = open("textoprueba3.txt", 'a') file2.writelines('hola mundo') file3.writelines('hola mundo 3') file3.write('\nPrue...
jarosemena/pythonCurso
archivos.py
archivos.py
py
796
python
es
code
0
github-code
1
19533480982
def nearest_value(values: set, one: int) -> int: # method one l = list(values) output = None #if one is in list then output one if(one in l): output = one #else find closest neighbour else: #add value and sort list ascending l.append(one) l.sort() i = ...
PeterCassell92/Check.io-Python
Elementary/Elementary_ex13.py
Elementary_ex13.py
py
1,546
python
en
code
0
github-code
1
72860061154
from bs4 import BeautifulSoup from django.test import TestCase, Client from django.contrib.auth.models import User from .models import Post, Category, Tag # <6. 테스트 주도 개발> # pip install beautifulsoup4 로 beautifulsoup4 설치하고 사용 # 1. python manage.py test 테스트 하는 명령어 # 2. blog/test.py에 TestCase를 상속받고 이름이 'Test'로 시ㅔㅛ작하는 ...
devMooon/internet-programming
과제/10주차/컴퓨터공학전공20200675문서연_tests.py
컴퓨터공학전공20200675문서연_tests.py
py
11,826
python
ko
code
0
github-code
1
19466941066
# -*- coding: utf-8 -*- """ @file @brief Module *code_beatrix*. .. faqref:: :title: Pourquoi Python? `Python <https://www.python.org/>`_ est un langage de programmation très répandu aujourd'hui qui fut choisi à l'`ENSAE <http://www.ensae.fr/ensae/fr/>`_ en 2005 pour remplacer le `C++ <https://fr.w...
sdpython/code_beatrix
src/code_beatrix/__init__.py
__init__.py
py
3,006
python
fr
code
1
github-code
1
21143693469
""" Watch global hotkeys. Created on 15.01.2017 @author: Ruslan Dolovanyuk """ import logging import keyboard class Hotkeys: """Class watch globals hotkeys.""" def __init__(self, config, generals): """Initialize class Hotkeys.""" self.log = logging.getLogger() self.log.info('init...
DollaR84/SARA
hotkeys.py
hotkeys.py
py
936
python
en
code
2
github-code
1
20522260254
import pytest def test_ctypes_cdll_unknown_dll(pyi_builder, capfd): with pytest.raises(pytest.fail.Exception, match="Running exe .* failed"): pyi_builder.test_source( """ import ctypes ctypes.cdll.LoadLibrary('non-existing-2017') """ ) out, err =...
pyinstaller/pyinstaller
tests/functional/test_runtime.py
test_runtime.py
py
386
python
en
code
10,769
github-code
1
32805233512
# *** coding: utf-8 *** #@Time : 2020/11/28 10:03 #@Author : xueqing.wu #@Email : wuxueqing@126.com #@File : apiOrder.py import settings from settings import IP,HEADERS from tools.logger import GetLogger logger = GetLogger().get_logger() class ApiOrder(): def __init__(self): logger.info('开始获取下单接口的U...
aadorable/mtx1212
api/apiOrder.py
apiOrder.py
py
1,153
python
en
code
0
github-code
1
21521899393
from typing import List class Solution: def containsDuplicate(self, nums: List[int]) -> bool: number_set = set() for n in nums: if n not in number_set: number_set.add(n) else: return True return False solution = Solution() answer =...
yihsuanhung/leetcode
217. Contains Duplicate/main.py
main.py
py
373
python
en
code
0
github-code
1
21003159623
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('organizations', '0008_address_timezone'), ] operations = [ migrations.AddField( model_name='organization', ...
getcircle/services
organizations/migrations/0009_organization_image_url.py
0009_organization_image_url.py
py
424
python
en
code
0
github-code
1
40133363615
from collections import deque dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def nextspots(board, pos, n): nextspots = [] pos = list(pos) x1, y1, x2, y2 = pos[0][0], pos[0][1], pos[1][0], pos[1][1] for i in range(4): # 상하좌우 nx1, ny1 = x1 + dx[i], y1 + dy[i] nx2, ny2 = x2 + dx[i], y2 + dy[i] ...
Woojung0618/algorithmSolve
Programmers/Lv3/블록이동하기.py
블록이동하기.py
py
1,594
python
en
code
0
github-code
1
16778808004
inversores = [ "1,Veriee,vvasilkov0@qq.com,Female,Besançon", "2,Lizbeth,locklin1@tiny.cc,Female,Jawand", "3,Tymon,thillum2@diigo.com,Male,Rîbniţa", "4,Teddie,tschofield3@ehow.com,Male,Tlogoagung", "5,Dom,dantonin4@squarespace.com,Male,Tonjongsari", "6,Armstrong,acreegan5@reverbnation.com,M...
pablokan/23prog1
parciales/A/parcial_Alvarez.py
parcial_Alvarez.py
py
3,868
python
es
code
0
github-code
1
17599914288
import json useDebugPrint = False class Bets(): def __init__(self, bot, chatpointsObj, chateventsObj, jsonpath): self.bot = bot self.chatpointsObj = chatpointsObj self.chateventsObj = chateventsObj self.jsonpath = jsonpath self.bets = {} try: with open(...
Petricpwnz/NyAI
modules/bet.py
bet.py
py
9,192
python
en
code
1
github-code
1
21619963342
import threading import time import urllib from collections import deque import discord import cogs.voice_lib.mkvparse as mkvparse import logging # dumb buffer stuff import io, queue, subprocess class Handler(mkvparse.MatroskaHandler): def __init__(self, packet_buffer): self.packet_buffer = packet_buf...
biglizards/butty
cogs/voice_lib/parser.py
parser.py
py
4,677
python
en
code
2
github-code
1
25515562168
import pyautogui, time print("A simple text spam bot that types a massage and presses enter") print("word mode =w copy and paste mode =c self enter mode =t") mode = input("word or copy and paste mode? ") def modet(): text = input("Entere a text to spam: ") num = int(input("Enter a num:")) time.slee...
Kn0spi/Spam_Bot
spam_bot.py
spam_bot.py
py
1,084
python
en
code
0
github-code
1
14592252085
from rest_framework import viewsets, mixins from rest_framework.response import Response from .models import AssignmentGroup, Assignment, StudentAssignment from .serializers import (AssignmentGroupSerializer, AssignmentSerializer, StudentAssignmentSerializer) from .policies import (AssignmentG...
benhchoi/coursemanager
coursemanager/assignments/api.py
api.py
py
2,830
python
en
code
0
github-code
1
12485774958
from itertools import product from space import Space def knapsack(items, limit): """Find the most valuable combination of items given the limit. >>> items = set([('green', 12, 4), ('grey', 1, 2), ('blue', 2, 2), ('orange', 1, 1), ('yellow', 4, 10)]) >>> knapsack(items, 15) [('grey', 1, 2), ('yellow', 4, 10...
Ceasar/gadgets
knapsack.py
knapsack.py
py
2,006
python
en
code
0
github-code
1
1374574117
import torch from tqdm import tqdm from tabulate import tabulate from collections import OrderedDict from torch.nn import functional as F from HDG.engine.trainer import GenericNet from HDG.utils import count_num_parameters, evaluator, TripletLoss from HDG.engine import TRAINER_REGISTRY, GenericTrainer from HDG.optim im...
VirtueZhao/HDGC
HDG/engine/baseline/CrossGrad.py
CrossGrad.py
py
5,587
python
en
code
0
github-code
1
26358226185
import os, time import component, util, startup comp = "postgrest" this_dir = os.path.dirname(os.path.realpath(__file__)) bin_file = this_dir + os.sep + comp os.system("sudo cp " + bin_file + " /usr/local/bin/.") svc_file = this_dir + os.sep + 'postgrest.service' util.replace('USER', util.get_user(), svc_file, Tru...
pgEdge/nodectl
src/postgrest/init-postgrest.py
init-postgrest.py
py
811
python
en
code
7
github-code
1
17977945273
from models.Project import Project from main import db from flask import Blueprint, request, render_template, redirect, url_for, flash from flask_login import login_required, current_user projects = Blueprint('projects', __name__, url_prefix='/projects') @projects.route('/', methods=['GET']) def project_index(): ...
eric-chew/T4A2-B
src/controllers/projects_controller.py
projects_controller.py
py
3,040
python
en
code
0
github-code
1
26398264145
from copy import deepcopy from utils import * from test import test_all from c45 import max_gain import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, precision_recall_curve def build_tree(T): """ An entry point in C45 algorithm. _T_ - a two-dimensional array represen...
buffer404/university
year3/Artificial intelligence systems/lab3/main.py
main.py
py
2,684
python
en
code
1
github-code
1
74246117472
def couple(string_in): alpha_set = set(string_in) alpha_dict = {} for alpha in list(alpha_set): alpha_dict[alpha] = string_in.count(alpha) result = [] for key in alpha_dict: if alpha_dict[key] % 2 == 1: result.append(key) if not result: return 'Good' els...
jinyoong/SWEA
problem/D3/10912. 외로운 문자.py
10912. 외로운 문자.py
py
488
python
en
code
0
github-code
1
10604830299
from datetime import datetime def compare_dateprices(dp_a, dp_b, initial=True): date_a, date_b = dp_a[0], dp_b[0] if initial: best_dp = dp_a if date_a <= date_b else dp_b else: best_dp = dp_a if date_a > date_b else dp_b return best_dp if __name__ == "__main__": date1 = datetim...
sullyD64/bigdata-2019
project1/src/spark/misc/tests.py
tests.py
py
552
python
en
code
0
github-code
1
35990658808
""" This module is used to store the methods for setting up the NSX-T XUI """ import json import os from os import path from packaging import version from cbhooks.models import CloudBoltHook from servicecatalog.models import ServiceBlueprint from resourcehandlers.models import ResourceHandler from xui.nsxt....
mbomb67/cloudbolt_samples
cloudbolt_content/ui-extension-packages/nsxt/config.py
config.py
py
6,538
python
en
code
2
github-code
1
34575920634
import os import sys import warnings import numpy as np from manim import * from .bubbles import ThoughtBubble from .bubbles import SpeechBubble from .creature import Creature from sound.constants import CREATURE_DIR class QuarterCreature(Creature): LEFT_EYE_INDEX = 0 RIGHT_EYE_INDEX = 1 L...
NewMarketYT/essentials_of_music
sound/assets/creatures/quarter_creature.py
quarter_creature.py
py
3,102
python
en
code
2
github-code
1
20920399171
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Plotting utils """ import math import os from copy import copy from pathlib import Path import cv2 import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sn import torch from PIL import Image, ImageDraw, ImageFont impo...
ziyan0302/Yolov5_DeepSort_Pytorch_ros
Yolov5_DeepSort_Pytorch/yolov5/utils/plots.py
plots.py
py
29,223
python
en
code
5
github-code
1
23463756424
#!/usr/bin/python3 """Advanced API. ***This is an advanced task*** For this task, we'll recursively call the Reddit API, parse the titles of all hot articles and return a sorted count of given keywords(case-sensitive, delimited by spaces). Note: 1. No iteration! 2. If `word_list` contains duplicates, then the...
brian-ikiara/alx-system_engineering-devops
0x16-api_advanced/100-count.py
100-count.py
py
2,452
python
en
code
0
github-code
1
9448345498
from random import randrange def column(grid: list, disc: str) -> int: grid_check = grid.copy() grid_check.pop(6) if grid[6] == [5, 5, 5, 5, 5, 5, 5, 5, 5]: print("DEBUG: TABLERO VACIO") return randrange(0, 9, 1) else: y_pos = 0 for y in grid_check: x_pos = 0 for x in y: if x != ...
sandra1036/DIN
Excercices/C4/C4_Me/ruben.py
ruben.py
py
1,159
python
en
code
0
github-code
1
4836908083
########################################## # @subject : Person segmentation # # @author : perryxin # # @date : 2018.12.27 # ########################################## import torch.utils.data as Data from read_data import * from config import * from models.unet_plusplus im...
hellopipu/person_seg
test.py
test.py
py
2,579
python
en
code
15
github-code
1
23164192729
import geopandas as gp import shapely def intersection(left, right, grid_size=0): """Intersect the geometries from the left with the right. New, intersected geometries are stored in "geometry_right". Uses spatial index operations for faster operations. Wholly contained geometries from right are cop...
astutespruce/secas-blueprint
analysis/lib/geometry/intersection.py
intersection.py
py
1,867
python
en
code
0
github-code
1
32308460282
import os from flask import jsonify, request import requests def getWeather(): try: API_KEY = os.getenv("API_KEY") args = request.args lon = str(args.get('lon')) lat = str(args.get('lat')) url = f'https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&a...
HarshxiT/Krishi-Network
apps/weather/controller.py
controller.py
py
492
python
en
code
0
github-code
1
71291623714
import gensim from sklearn import svm from sklearn import datasets from sklearn.feature_extraction.text import TfidfVectorizer from joblib import dump, load import flask from flask_restful import Resource, Api, reqparse from flask import request from functools import partial from flask import request, jsonify ...
themorlock/SearchMart
RestAPI/api.py
api.py
py
2,142
python
en
code
1
github-code
1
39424860660
import cv2 import io import os from google.cloud import vision os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = ".." #put your google API credintials here # Instantiates a client client = vision.ImageAnnotatorClient() #folder = "/uploads/" class Image(): def __init__(self): self.labels = [] self...
yahyaakli/spring2021hackathon
src/Image.py
Image.py
py
2,347
python
en
code
0
github-code
1
70028298274
#!/bin/python import argparse import numpy as np import pandas as pd import time import json from datetime import datetime, timedelta from confluent_kafka.avro import AvroProducer def parse_args(): parser = argparse.ArgumentParser(description='Publish CSV records to a Kafka topic.') parser.add_argument('--de...
brunoribeiro2k/movielens-events
src/main/python/publish-ratings.py
publish-ratings.py
py
3,929
python
en
code
0
github-code
1
75138812834
import numpy as np from matplotlib import pyplot as plt from matplotlib import animation import module_utils import simulation_utils as sim_utils import recorder as rec import copy def eligibilityNavigation(symbols, start, goal, distance, nscales = 1, ms_per_frame = 1, f = 3, min_base_delay ...
Playmojs/tss_eligibility_traces
navigation/nav_eligibility5.py
nav_eligibility5.py
py
8,464
python
en
code
0
github-code
1
36170482691
import time from typing import List, Tuple, Iterable from volatility3.framework import constants, interfaces, layers, symbols from volatility3.framework.configuration import requirements from volatility3.framework.interfaces import plugins from volatility3.framework.renderers import TreeGrid from volatility3.framework...
volatilityfoundation/volatility3
volatility3/framework/plugins/windows/info.py
info.py
py
9,625
python
en
code
1,879
github-code
1
26597485464
import pdb, argparse import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torchvision as thv from torchvision import transforms from torch.utils.data import Dataset, DataLoader from CarlaDataset import CarlaDataset from CVAE import CVAE from siameseC...
klaywittler/latent-map-planning
model/train_siamese.py
train_siamese.py
py
1,675
python
en
code
1
github-code
1
22352762214
""" @function: choose the attacked flights @author: Tengyao Li @date: 2018/09/12 @status: developing """ import numpy as np class attacked_flight: """ @function: get the attacked icao set @author: Tengyao Li @date: 2018/09/12 """ def __init__(self, origin_df): """ @function: ...
litengyao/adsb-attack-data-generator
attack_choice/attacked_flight.py
attacked_flight.py
py
3,060
python
en
code
4
github-code
1
15201921852
from argparse import ArgumentParser, HelpFormatter import itertools import sys from pathlib import Path # ============================================================================================================ # === DTN ARGUMENT PARSER CLASSES # ====================================================================...
msancheznet/dtnsim
simulator/utils/DtnArgumentParser.py
DtnArgumentParser.py
py
3,255
python
en
code
9
github-code
1
12855623235
from turtle import Turtle import random class Food(Turtle): def __init__(self): """ default constructor that initialize the "food" turtle, it inherits the Turtle class """ super().__init__() self.penup() self.shape("circle") self.shapesize(stretc...
Mqondisi-Mavuso/Online_Courses
Udemy/100_days_python_bootcamp/Day20/food.py
food.py
py
712
python
en
code
0
github-code
1
32100442579
from ase import Atoms import numpy as np atoms = Atoms(['O', 'H', 'H'], positions=[[0., 0., 0.119262], [0., 0.763239, -0.477047], [0., -0.763239, -0.477047]]) # Angle no pbc assert abs(atoms.get_angle(1, 0, 2) - 104) < 1e-3 atoms.set...
joliesla/Material-modelling
venv/Lib/site-packages/ase/test/atoms_angle.py
atoms_angle.py
py
1,046
python
en
code
1
github-code
1
4851164907
# -*- coding: utf-8 -*- import itertools from flask import url_for from flask_mail import Message import query_phenomizer from scout.constants import (CASE_STATUSES, PHENOTYPE_GROUPS, COHORT_TAGS) from scout.models.event import VERBS_MAP from scout.server.utils import institute_and_case STATUS_MAP = {'solved': 'bg-s...
gitter-badger/scout
scout/server/blueprints/cases/controllers.py
controllers.py
py
6,194
python
en
code
null
github-code
1
46241357
import logging import os import click import pandas as pd import tqdm from mol_dyn.pipeline import pipeline from mol_dyn.utils import load_smiles_csv @click.command() @click.option("--smiles_csv", required=True, help="Smiles csv") @click.option("--output_folder", required=True, help="Output folder") @click.option("-...
rxn4chemistry/rxn-ir-to-structure
scripts/run_md_pipeline.py
run_md_pipeline.py
py
3,122
python
en
code
4
github-code
1
73578519393
import re import numpy as np from p1_DICT import * import time dictory={} #制作词典 def get_dict(dict_path): with open(dict_path,'r',encoding='utf-8') as f: for line in f: dictory[line[:len(line)-1]]=0 def isword(word): return word in dictory def fmm(max_len,txt_path='../io_file/train_test/tes...
kokolerk/HIT-NLP-notes_lab
nlplab1/lab1code/p3FMM_BMM.py
p3FMM_BMM.py
py
2,474
python
en
code
3
github-code
1
12046323109
import sklearn import joblib import cv2 import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import albumentations from torch.utils.data import Dataset, DataLoader from PIL import Image import time import firebase_admin from firebase_admin import credentials from firebase_admin import f...
Abdelazizmuhmd/drowning-detection
projectjetson/jetson.py
jetson.py
py
3,581
python
en
code
2
github-code
1
20667232591
# 숨바꼭질 1차원 bfs로 next x 값을 x-1,x+1,x*2 비교해주면서 다음값에 +1씩 from collections import deque import sys input=sys.stdin.readline n,k=map(int,input().split()) graph=[0]*100001 def bfs(n): queue=deque() queue.append(n) while queue: x=queue.popleft() if x==k: return graph[x] for nx in (x-1,x+1,x*2): ...
jeongkwangkyun/algorithm
BFS/1697.py
1697.py
py
465
python
en
code
0
github-code
1
31900102139
# -*- coding: utf-8 -*- """ @File : pathSum.py @Author : wenhao @Time : 2023/2/1 11:58 @LC : """ from Tree import TreeNode from typing import List class Solution: def pathSum(self, root: TreeNode, target: int) -> List[List[int]]: ans = [] if root is None: return ans ...
callmewenhao/leetcode
offer/二叉树/pathSum.py
pathSum.py
py
840
python
en
code
0
github-code
1
15362469033
import click import numpy as np from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer def get_wiki_vocab(file): """ Build a vocabulary from Wikipedia articles. Parameters ---------- file : str File path to Wikipedia article text Returns ----...
bllguo/KSI
vectorize_data.py
vectorize_data.py
py
6,602
python
en
code
0
github-code
1
29262433576
def best_time_to_buy_and_sell_stock(stocks): if not stocks: return 0 ans = 0 mini = stocks[0] for i in range(1,len(stocks)): if stocks[i] < mini: mini = stocks[i] else: ans = max(ans, stocks[i] - mini) return ans nums = list(map(int,input("enter the n...
Mayankjha997/Neetcode_python_solution
sliding window/Best_time_to_buy_and_sell_stock.py
Best_time_to_buy_and_sell_stock.py
py
404
python
en
code
0
github-code
1
11435870647
# TEORIA: ''' # importa o pygame import pygame # inicializa o modulo do pygame pygame.init() # definindo o tamanho da tela para o Pygame dis_width = 600 # largura dis_height = 400 # altura dis = pygame.display.set_mode((dis_width,dis_height)) red = (219, 31, 31) green = (44, 219, 31) squareSize = 20 circleRadius =...
fabiodm7/stuPy
intro/game.py
game.py
py
7,319
python
pt
code
0
github-code
1
12254940680
""" Functions to facilitate reading csv files """ import sys import os import re class CsvReadError(Exception): """Error class for reporting errors related to reading CSV files""" def __init__(self, value, info=""): self.value = value self.info = info def choose_file_in_dir(directory): ...
BenLatham/CSV-reader
csvReader/csvReader.py
csvReader.py
py
12,649
python
en
code
0
github-code
1
23574301968
#estrutura de decisão #simples #encadeadas idade = int(input('digite sua idade')) if(idade >= 18): tempo = idade - 18 print('pode vender bebida') print(f'ele(a) ja pode comprar bebida ha {tempo} ano(s)') else: tempo = 18 - idade print(f'NAO pode vender bebida e deve esperar {tempo} ano(s)')
renegadelhaedu/alg20231
code13.py
code13.py
py
321
python
pt
code
1
github-code
1
2738595022
from django.http import HttpResponse, HttpResponseForbidden from django.shortcuts import render, redirect, get_object_or_404 from django.db.transaction import atomic, non_atomic_requests from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from ipaddress import ip_a...
Wizard-Fingerz/GreenPurseBackend
payment/views.py
views.py
py
10,164
python
en
code
0
github-code
1