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
72361816355
import json import re def is_empty_line(line): pattern = r'^\s*$' # 匹配只包含空白字符的行 return re.match(pattern, line) is not None def is_digit_line(line): pattern = r'^\s*\d+\s*$' # 匹配只包含空白字符的行 return re.match(pattern, line) is not None if __name__ == '__main__': items = [] with open('./openssl...
zhougy0717/utools_errno
util/parse_openssl_tls_errno.py
parse_openssl_tls_errno.py
py
1,081
python
en
code
0
github-code
1
34102830162
T = int(input()) lengths = [] strings = [] charCounts = {'_':0} for i in range(65,91): #print(chr(i)) charCounts[str(chr(i))] = 0 for i in range(T): lengths.append(int(input())) strings.append(input()) for each in strings: unhappy = False if('_' in each): for i in range(len(each)): charCounts[each[i]] += ...
anikasetia/hackerrank
algorithms/implementation/happyLadyBugs.py
happyLadyBugs.py
py
1,027
python
en
code
0
github-code
1
72185227553
from flask import Flask;from flask_ipban import IpBan;from flask_limiter import Limiter;from flask_limiter.util import get_remote_address from blueprint.main import main from socket import gethostname from os import getcwd, path from yaml import safe_load import logging, secrets def loadConfig(): PATH = (g...
JawadPy/flask-tokyo
app.py
app.py
py
1,348
python
en
code
0
github-code
1
10880342788
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.http import HttpResponse from django.template import loader from django.template.loader import get_template from polls.models import Food_Place_ID_Yelp,Food_Place_ID_Zomato, Recipe, User_Detail from django....
aquddus95/API-Integration
API-Integration/finalproject/polls/views.py
views.py
py
8,599
python
en
code
1
github-code
1
72861968355
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import sys import re import codecs import chardet def convert(filename, target_encoding="UTF-8"): try: content = codecs.open(filename, 'r').read() source_encoding = chardet.detect(content)['encoding'] if content is not '' and source_...
xin0111/PythonTools
change_encoding.py
change_encoding.py
py
1,319
python
en
code
1
github-code
1
69827179554
import pandas as pd from tqdm import tqdm labels = ["Prevention", "Treatment", "Diagnosis", "Mechanism", "Case Report", "Transmission", "Forecasting", "General"] df1 = pd.read_csv("org_proc.csv") df2 = pd.read_csv("covid_dataset_shuffled.csv") df2 = df2.sample(frac=1).reset_index(drop=True) print(len(df2)) print(df1["p...
ujeong1/SBP22_DiscourseNet_experiment
creator/matched_csv.py
matched_csv.py
py
955
python
en
code
0
github-code
1
23207730387
import dgl import unittest import backend as F from dgl.dataloading import AsyncTransferer @unittest.skipIf(F._default_context_str == 'cpu', reason="CPU transfer not allowed") def test_async_transferer_to_other(): cpu_ones = F.ones([100,75,25], dtype=F.int32, ctx=F.cpu()) tran = AsyncTransfer...
taotianli/gin_model.py
tests/compute/_test_async_transferer.py
_test_async_transferer.py
py
975
python
en
code
5
github-code
1
30478138727
#!/usr/bin/env python from __future__ import division __author__ = "Sam Way" __copyright__ = "Copyright 2014, The Clauset Lab" __license__ = "BSD" __maintainer__ = "Sam Way" __email__ = "samfway@gmail.com" __status__ = "Development" import warnings from numpy import array, asarray, unique, bincount, min, floor, zero...
samfway/biotm
misc/util.py
util.py
py
2,307
python
en
code
0
github-code
1
2136965668
import pygame import time pygame.mixer.init() pygame.init() pygame.mixer.music.set_volume(1) window = pygame.display.set_mode((1800, 450)) pygame.display.set_caption('Guitar -> Piano Visualizer') #### Maybe use this later for adding text to pygame screen ##### font = pygame.font.Font('freesansbold.ttf', 30) eText = f...
wjudy/ForFunProjects
music/GUITARPIANO/guitarpiano.py
guitarpiano.py
py
9,652
python
en
code
0
github-code
1
41329394287
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 11 09:27:36 2022 @author: luisgerardosanchezsoto This script defines the Drunk class used in the Planning for Drunks model (pfdmodel.py) and its functionality. """ # imports import random # definition of class "Drunk" class Drunk(): def __i...
sanluige/sanluige.github.io
drunksframework.py
drunksframework.py
py
13,547
python
en
code
0
github-code
1
24363636738
import unittest import uuid from collections import namedtuple from mock import Mock, patch from spoppy import menus, responses from . import utils MockLoader = namedtuple('Loader', ('results', )) class TestOptions(unittest.TestCase): def setUp(self): self.dct = { '1': menus.MenuValue('A', ...
sindrig/spoppy
tests/test_menus.py
test_menus.py
py
32,502
python
en
code
12
github-code
1
3422422615
class YOLACTLoss(object): def __init__(self, loss_weight_cls=1, loss_weight_box=1.5, loss_weight_mask=6.125, loss_weight_seg=1, neg_pos_ratio=3, max_masks_for_train=100): self._loss_weight_cls = loss_weight_cls self._loss_weight_box ...
bihanli/YPgru_YB
loss_yolact.py
loss_yolact.py
py
13,399
python
en
code
0
github-code
1
4703069650
import requests import json from dotenv import load_dotenv import os import ipdb import traceback from datetime import datetime import pandas as pd import matplotlib.pyplot as plt load_dotenv() notion_token = os.environ.get("NOTION_TOKEN") database_id = os.environ.get("NOTION_DB_ID") headers = { "Authorization": ...
Retro-Devils-Media/coleco
main.py
main.py
py
3,544
python
en
code
0
github-code
1
28929513715
from SelfModule import MsSql import time import sqlite3 import LIB.ModuleDictionary mssql = MsSql() Conn_ERP = LIB.ModuleDictionary.DataBase_Dict.get('COMFORT') def Main(): startdate = time.ctime() pinhao = ['10710101'] for p in pinhao: STR = [] r = Select(pinhao=p, List=STR) print('共有' + str(len(STR)) + '...
porcupineyhairs/Python
TEST/BOMCOPTR.py
BOMCOPTR.py
py
3,016
python
en
code
0
github-code
1
25504175395
import logging import sys from telemetry.value import histogram from telemetry.value import histogram_util from telemetry.value import scalar from metrics import Metric _HISTOGRAMS = [ { 'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent', 'display_name': 'V8_MemoryExternalFragment...
hanpfei/chromium-net
tools/perf/metrics/memory.py
memory.py
py
10,223
python
en
code
289
github-code
1
15918005232
from .MetadataEnhancer import MetadataEnhancer from utils import _try_for_key class VariableEnhancer(MetadataEnhancer): def __init__(self, metadata: dict, enrichment_table: dict): super().__init__(metadata, enrichment_table) def enhance_metadata(self): """ enhance_metadata implementation for...
odissei-data/metadata-enhancer
src/enhancers/VariableEnhancer.py
VariableEnhancer.py
py
1,895
python
en
code
0
github-code
1
32774847100
# -*- coding: utf-8 -*- """ Created on Sun Nov 25 12:08:01 2018 @author: Jim """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import linear_model """ read file """ csvfile = "Concrete_Data.csv" data = pd.read_csv(csvfile) (row,column)=data.shape X_train=data['Age...
startearjimmy/4.Machine-learning
MLHW3/HW3_1.py
HW3_1.py
py
1,090
python
en
code
0
github-code
1
25772535003
#!/usr/bin/python from __future__ import print_function import atexit from bcc import BPF import os from datetime import datetime # load BPF program b= BPF(src_file="kwtracer.c") b.attach_kprobe(event="iov_iter_copy_from_user_atomic",fn_name="trace_do_user_space_write") b.attach_kprobe(event="submit_bio", fn_name="t...
BoKyoungHan/kworker_tracer
kwtracer.py
kwtracer.py
py
884
python
en
code
0
github-code
1
15279961441
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: if len(intervals) == 2: if (intervals[0][1] >= intervals[1][0]): if (intervals[0][1] >= intervals[1][0]): sleft = sorted([intervals[0][0] , intervals[1][0]]) ...
onyxolu/DSA
interview/mergeIntervals.py
mergeIntervals.py
py
1,178
python
en
code
0
github-code
1
41054306636
import boto3 from botocore.exceptions import ClientError import pytest from framework_from_conformance_pack import ConformancePack @pytest.mark.parametrize( "in_name, error_code", [("test-name", None), ("garbage", None), ("test-name", "TestException")], ) def test_get_conformance_pack(make_stubber, monkeypat...
awsdocs/aws-doc-sdk-examples
python/example_code/auditmanager/test/test_framework_from_conformance_pack.py
test_framework_from_conformance_pack.py
py
3,065
python
en
code
8,378
github-code
1
6744621112
from threading import * def display(): for i in range(10): print('Python Thread Executed by:', current_thread().getName()) def display1(): for i in range(10): print('PHP Thread Executed by:', current_thread().getName()) def display2(): for i in range(10): print('Java Thr...
oladiiposaheed/myproject
Multi_Threading/threading2.py
threading2.py
py
581
python
en
code
0
github-code
1
2673451372
# This file is executed on every boot (including wake-boot from deepsleep) import esp esp.osdebug(None) #import webrepl # webrepl.start() from lib.wifiManager.wifiManager import WifiManager wifiM = WifiManager() if wifiM.connect(): print("********WIFI is Connected**********") else: wifiM.createAP() print...
juanpc13/uPython-WebServer
boot.py
boot.py
py
360
python
en
code
0
github-code
1
25723956292
''' Comparing single layer MLP with deep MLP (using TensorFlow) ''' import numpy as np import pickle from math import sqrt from scipy.optimize import minimize # Do not change this def initializeWeights(n_in,n_out): """ # initializeWeights return the random weights for Neural Network given the # number of ...
neeradsomanchi/HandWrittenDigitsClassification
facennScript.py
facennScript.py
py
6,487
python
en
code
0
github-code
1
43565072112
# encoding: utf-8 from collections import OrderedDict import smtplib import logging from django import http from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse from django.core.excepti...
colab/colab
colab/accounts/views.py
views.py
py
11,704
python
en
code
23
github-code
1
30908823689
import numpy as np #创建数组 #a = np.array([1,2,3,4,5]) #b = np.array(range(1,6)) #c = np.arange(1,6) #指定数据类型 #e = np.array([1,2,3,4,5])#后面加一个dtype= #改变数据类型 #d = a.astype('int8') #print(d.dtype) #numpy中的小数 #t = np.array([np.random.random() for x in range(10)]) #print(t) #取好多位数 #t1 = np.round(t,2)#数字为要...
OPUS-Lightphenexx/Python-Data-analysis-and-Mining
Numpy/numpy计算笔记.py
numpy计算笔记.py
py
4,233
python
en
code
1
github-code
1
10110647533
import hashlib import imp import tarfile from typing import Iterable import warnings import zipfile from pathlib import Path import shutil from urllib.parse import urlparse from urllib.request import Request, urlopen import warnings import openmc.data _BLOCK_SIZE = 16384 def state_download_size(download_size, uncom...
openmc-data-storage/openmc_data
src/openmc_data/utils.py
utils.py
py
6,546
python
en
code
null
github-code
1
44186623516
import tensorflow as tf import pickle from metrics import PSNRMean, SSIMMean from losses import ltm_loss import utils from models.tone_curve_net import ToneCurveNetConv from models.residual_net import LTMNetResConv import os os.environ['TFHUB_MODEL_LOAD_FORMAT'] = 'COMPRESSED' def vgg_layers(layer_names): """ Cre...
Atakhan2000/ltmnet
train.py
train.py
py
3,206
python
en
code
0
github-code
1
17956866528
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait from urllib.parse import quote import sys from pyquery import PyQu...
jtyao/jtyao_python
match.py
match.py
py
4,416
python
en
code
0
github-code
1
21358137398
import neo4j.exceptions from reporting import user_watcher def test_watch_users(mocker): runner = user_watcher.app.test_cli_runner() mocker.patch( "reporting.user_watcher._is_shutdown", side_effect=[False, False, True, True], ) bootstrap_mock = mocker.patch("reporting.user_watcher._bo...
paypay/seizu
tests/unit/reporting/user_watcher_test.py
user_watcher_test.py
py
707
python
en
code
6
github-code
1
14448286153
#coding:utf8 ''' Created on 2014-1-17 @author: CC ''' from app.share.dbopear import dbuser,dbShieldWord,dbclub INITTOWN=1000 class User: '''用户类''' def __init__(self,name=0,password=0,dynamicId=-1,uid=0): ''' @param id:int 用户的id @param name:str 用户的名称 @param password:str 用户的密码 @param pid:int 邀请者的id @par...
chekwind/Soccer
app/gate/core/User.py
User.py
py
2,950
python
en
code
0
github-code
1
73205831714
import sys import copy input = sys.stdin.readline # sys.stdin = open('B_19236_input.txt') dx = [-1, -1, 0, 1, 1, 1, 0, -1] dy = [0, -1, -1, -1, 0, 1, 1, 1] def dfs(x, y, cnt, arr): global result cnt += arr[x][y][0] arr[x][y][0] = 0 result = max(cnt, result) # 1 ~ 16 물고기 위치 찾기 for f in range(...
eunjng5474/Study
week11/B_19236.py
B_19236.py
py
1,845
python
ko
code
2
github-code
1
29851347028
from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options import argparse from msedge.selenium_tools import Edge, EdgeOptions import pandas as pd import platform import datetime import pandas as pd import multiprocessing as mp from functools import partial import sys fr...
alexZajac/airlines_performance
explanations_professors/tweeter_data.py
tweeter_data.py
py
11,622
python
en
code
1
github-code
1
31654634357
# +1 class EventPairFeature(object): def __init__(self, features): """ :type features: list[str] """ self.feature_strings = features self.c_trigger_window_vector1 = 'trigger_window_vector1' self.c_trigger_window_vector2 = 'trigger_window_vector2' self.trig...
BBN-E/nlplingo
nlplingo/tasks/eventpair/feature.py
feature.py
py
970
python
en
code
4
github-code
1
32232435595
#!/usr/bin/env python # coding: utf-8 # # Raster data analysis # # Raster data represent a matrix of cells (or pixels) organized into rows and columns (or a grid). Grid cells can represent data that changes **continuously** across a landscape (surface) such as elevation, air temperature, or . reflectance data from sa...
owel-lab/programming-for-sds-site
book/_build/jupyter_execute/demos/09a-demo.py
09a-demo.py
py
12,182
python
en
code
0
github-code
1
6307151716
import torch import numpy as np import torch.nn as nn from itertools import product, permutations try: from clarity.enhancer.compressor import CompressorTorch from clarity.enhancer.nalr import NALRTorch LIB_CLARITY = True except ModuleNotFoundError: print("There's no clarity library") LIB_CLARITY =...
ooshyun/Speech-Enhancement-Pytorch
src/loss.py
loss.py
py
4,227
python
en
code
9
github-code
1
599630674
from __future__ import print_function import pysb.bng import numpy import sympy import re import ctypes import csv import scipy.interpolate import sys from pysundials import cvode # Thee set of functions set up the system for annealing runs # and provide the runner function as input to annealing def spinner(i): ...
pysb/pysb
pysb/deprecated/varsens_sundials.py
varsens_sundials.py
py
20,542
python
en
code
152
github-code
1
71420523233
from django.urls import path from . import views app_name = 'blog' urlpatterns = [ path('', views.MainListView.as_view(), name='index'), path('about/', views.AboutUsView.as_view(), name='about'), path('feedback/', views.FeedBackFormView.as_view(), name='feedback'), path('feedback/success/', views.Feed...
axkiss/FirstBlog
blog_app/urls.py
urls.py
py
829
python
en
code
0
github-code
1
34007380981
from django.urls import path from . import views urlpatterns = [ path('',views.index,name='home'), path('submit',views.submit,name='submit'), path('retrieve/',views.retrieve,name='retrieve'), path('register',views.register,name="register"), path('login',views.login,name='login'), path('update...
satyampathakk/SIHPROJECT
SIHP/project/urls.py
urls.py
py
682
python
en
code
0
github-code
1
41028200186
from fastapi import status, FastAPI, Request from fastapi.exceptions import RequestValidationError import os from common.enum import MessageEnum from common.constant import const import logging from .response_wrapper import resp_err import traceback logger = logging.getLogger(const.LOGGER_API) def biz_exception(app...
awslabs/stable-diffusion-aws-extension
middleware_api/lambda/inference/common/exception_handler.py
exception_handler.py
py
1,722
python
en
code
111
github-code
1
12119550382
#!/usr/bin/env python3 import fileinput if __name__ == "__main__": file = fileinput.input() n = 0 p = [] for i, line in enumerate(file): line = line.strip() if i == 0: n = int(line) else: p = line.split(sep=" ") p = [int(i) for i in p] c...
i2tsuki/competition
atcoder/abc268/abc268.py
abc268.py
py
462
python
en
code
0
github-code
1
29341417351
import numpy as np import cv2 from matplotlib import pyplot as plt I = cv2.imread('/home/kanish/Desktop/image.png', cv2.IMREAD_GRAYSCALE) _, It = cv2.threshold(I, 0., 255, cv2.THRESH_OTSU) It = cv2.bitwise_not(It) _, labels = cv2.connectedComponents(I) result = np.zeros((I.shape[0], I.shape[1], 3), np.uint8) for i ...
kanishmathew777/image_processing
backend/image_processing_backend/pathfinder/join.py
join.py
py
591
python
en
code
0
github-code
1
70748069793
# -*- coding: utf-8 -*- """ Created on Sat Jul 17 22:46:20 2021 @author: Furcas """ from threading import Thread from time import sleep class Myclass: def __init__(self, text): self.text = text def __call__(self, count, time): for k in range(count): sleep(time) ...
tenatarika/PythonTasks
Thread1.py
Thread1.py
py
1,169
python
en
code
1
github-code
1
74246691234
# https://leetcode.com/problems/best-time-to-buy-and-sell-stock/submissions/ def maxProfit(prices: List[int]): if len(prices) < 2: return 0 max_profit = 0 l, r = 0, 1 while(r < len(prices)): if prices[l] > prices[r]: l = r r +=1 else: ...
kevinjunge/leetcode_problems
maxProfit.py
maxProfit.py
py
459
python
en
code
0
github-code
1
74141349153
# -*- coding: utf-8 -*- from urllib import parse def add_get_parameters(url, parameters, percent_encode=True): """Utility function to add GET parameters to an existing URL. Args: parameters A dictionary of the parameters that should be added. percent_encode Whether th...
keegan/ion
intranet/utils/urls.py
urls.py
py
737
python
en
code
1
github-code
1
16165826774
# coding: utf-8 from mock import mock from django.contrib.auth.models import User from django.conf import settings from rest_framework import status class AuthHelperMixin(object): def setUp(self): super(AuthHelperMixin, self).setUp() self.requests_patcher = mock.patch('sw_rest_auth.permissions.r...
telminov/sw-django-rest-auth
sw_rest_auth/tests/helpers.py
helpers.py
py
3,698
python
en
code
3
github-code
1
41012383162
import json import time import pymongo import threading from .TwitchWebsocket.TwitchWebsocket import TwitchWebsocket from .FlushPrint import ptf ws = None statsDict = {} statsLock = None statsThread = None colRewards = None # True if user is a mod or the broadcaster def CheckPrivMod(tags): return (tags["mod"] ==...
ThomasCulotta/PureBot
Utilities/TwitchUtils.py
TwitchUtils.py
py
4,299
python
en
code
0
github-code
1
14284120751
# yourapp/views.py from django.shortcuts import render, redirect from django.http import HttpResponse from .scripts import main as script from .scripts import validate from .scripts.visualization import visualize import os import pandas as pd data_processed = False image_directory = os.path.join(os.getcwd(), 'yourapp...
SartajBhuvaji/Data-Science-Research-FlaskApp
djangoapp/yourapp/views.py
views.py
py
5,774
python
en
code
0
github-code
1
33195953151
import unittest from mock import ANY, Mock, patch from captainhook import pre_commit class TestMain(unittest.TestCase): def setUp(self): self.get_files_patch = patch('captainhook.pre_commit.get_files') get_files = self.get_files_patch.start() get_files.return_value = ['file_one'] ...
alexcouper/captainhook
test/test_pre_commit.py
test_pre_commit.py
py
2,423
python
en
code
54
github-code
1
28211746299
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Aug 27 21:40:34 2018 @author: deanng """ import pandas as pd from security_3rd_property import DATA_PATH, DATA_TYPE, ROWS import time from contextlib import contextmanager from security_3rd_model import tfidfModelTrain, nblrTrain import scipy # FEATURE...
DeanNg/3rd_security_competition
final_code/security_3rd_feature.py
security_3rd_feature.py
py
9,978
python
en
code
53
github-code
1
25043375529
import cv2 import numpy as np import os import time import pickle from face_detection import RetinaFace path = '../data/29--Students_Schoolkids/' # model = 'resnet50' model = 'mobilenet0.25' scale = '1' name = 'retinaFace' count = 0 CONFIDENCE = 0.1 if __name__ == "__main__": for fn in os.listdir(path): fi...
thisKK/Real-time-multi-face-recognition-base-on-Retinaface
faceDetection/WRILD_FACE.py
WRILD_FACE.py
py
1,545
python
en
code
1
github-code
1
32411124306
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns class DataVisualization(object): def __init__(self, data_frame) : self.data_frame = data_frame def view_histogram_by_column(self, column, title): try: sns.set(style='whitegrid') f, ax = plt.subplots(1,1, figsize=(...
jaznamezahidalgo/Libreria-EDA
Visualization.py
Visualization.py
py
1,526
python
es
code
0
github-code
1
8682854808
import numpy as np import matplotlib.pyplot as plt def f(x, y): return x - y def euler_method(f, x0, y0, h, num_steps): x_values = [x0] y_values = [y0] for _ in range(num_steps): x_next = x_values[-1] + h y_next = y_values[-1] + h * f(x_values[-1], y_values[-1]) ...
danielkatz19/ODE-s-Runge-Kutta
Correct_Math 312_Group Delta/Commented Code/example_code 2_commented .py
example_code 2_commented .py
py
711
python
en
code
0
github-code
1
9715965524
def epana(biggernode,j,count,niw): leksiko={} leksiko.setdefault(niw,[]) xik=biggernode[j].keys() for nodeid in xik: xlow=[] xhigh=[] ylow=[] yhigh=[] lis=[] for i in range (len(biggernode[j][nodeid])): xlow.append(biggernode[j][node...
EmBachlitzanakis/ComplexData
Topk_and_Rtree/Sort_Tile_Rtree.py
Sort_Tile_Rtree.py
py
3,497
python
en
code
0
github-code
1
37441147060
""" the simulation, simulates the motors and work in the same coordinate system. """ import pygame import numpy as np import time import math import matplotlib.pyplot as plt import ArduinoCommunication as Ac import Algorithmics as Algo # ---------- CONSTANTS ------------- # COLORS WHITE = (255, 255, 255) BLACK = (0, ...
tomerpeled1/Projecton
Simulation.py
Simulation.py
py
14,618
python
en
code
0
github-code
1
36972627167
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import browser import argparse import sys from mutagen import File from mutagen.mp3 import HeaderNotFoundError import os DEFAULT_FOLDER = './' def update_progress(progress, total): percent = int(progress / total * 100) sys.stdout.w...
alexandre-p/music-audit
lib/tags_clean_up.py
tags_clean_up.py
py
2,007
python
en
code
0
github-code
1
13008619672
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from web_news.misc.spiderredis import SpiderRedis from web_news.items import SpiderItem from scrapy.loader import ItemLoader class BjdSpider(SpiderRedis): name = 'bjd' al...
qiangber/web_news
web_news/spiders/bjd.py
bjd.py
py
1,814
python
en
code
0
github-code
1
22123114317
import unittest from typing import List ''' build on top of leetcode 84 cite from https://leetcode.com/problems/maximal-rectangle/discuss/122456/Easiest-solution-build-on-top-of-leetcode84 ''' class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: if(len(matrix) == 0 or len(matrix[0]) ...
AllieChen02/LeetcodeExercise
Stack/P85MaximalRectangle/Maximal Rectangle.py
Maximal Rectangle.py
py
1,302
python
en
code
0
github-code
1
36170445031
import logging from typing import List from volatility3.framework import constants, exceptions, renderers, interfaces from volatility3.framework.configuration import requirements from volatility3.framework.objects import utility from volatility3.plugins.windows import pslist vollog = logging.getLogger(__name__) cla...
volatilityfoundation/volatility3
volatility3/framework/plugins/windows/cmdline.py
cmdline.py
py
3,700
python
en
code
1,879
github-code
1
7667261447
import pandas as pd import numpy as np import pickle from sklearn.base import TransformerMixin from sklearn.feature_extraction.text import CountVectorizer from sklearn.pipeline import Pipeline from sklearn.metrics import f1_score, cohen_kappa_score, accuracy_score, recall_score, precision_score, roc_auc_score, confusi...
Nicolas-Ferreira/ml-helper-functions
src/models/train_models.py
train_models.py
py
6,420
python
en
code
1
github-code
1
18187534019
import pytest from unittest.mock import sentinel, Mock import bokeh.palettes import pandas as pd import pandas.testing as pdt import datetime as dt import numpy as np import glob import forest.drivers from forest.drivers import earth_networks LINES = [ "1,20190417T000001.440,+02.7514400,+031.9206400,-000001778,00...
MetOffice/forest
test/test_earth_networks.py
test_earth_networks.py
py
4,847
python
en
code
38
github-code
1
839019245
class Node: def __init__(self, data): self.data = data self.next = None class Stack: def __init__(self): self.head = None def isempty(self): if self.head == None: return True else: return False def push(self, data): if self.isemp...
smileostrich/algorithm-practice
interview/daily_practice/210608.py
210608.py
py
3,010
python
en
code
0
github-code
1
34529138843
from pprint import pprint from azdev.operations.regex import ( get_all_tested_commands_from_regex, search_argument, search_argument_context, search_command, search_command_group) # pylint: disable=line-too-long # one line test def test_one_line_regex(): lines = [ # start with self.cmd....
Azure/azure-cli-dev-tools
azdev/operations/tests/test_cmdcov.py
test_cmdcov.py
py
19,031
python
en
code
71
github-code
1
29028858099
from datetime import datetime from classes.field import Field class Birthday(Field): @Field.value.setter def value(self, value=None): if value and type(value) == str: value = value.replace('.', '-') try: value = datetime.strptime(value, '%d-%m-%Y').date() ...
IrinaShushkevych/classes_bot_helper
classes/birthday.py
birthday.py
py
653
python
en
code
0
github-code
1
21680265073
import torch import numpy as np ''' 목표 MobileNet v2에 빠르게 QIL 적용 1. alexnet training <- success 2. apply QIL to alexnet (= reproduce) - know How to quantize ex ) aware quantization - > pytorch source - know How to apply QIL on alexnet - conduct training 3. Apply QIL to MobileNet v2 ''' class ...
su9262/2020
QIL.py
QIL.py
py
2,120
python
en
code
0
github-code
1
3687742693
import torch def nanminmax(tensor, operation='min', dim=None, keepdim=False): if operation not in ['min','max']: raise ValueError("Operation must be 'min' or 'max'.") mask = torch.isnan(tensor) replacement = float('-inf') if operation == 'max' else float('inf') replacement = torch.ten...
zzy99/torch_preprocessing
torch_preprocessing.py
torch_preprocessing.py
py
2,744
python
en
code
1
github-code
1
24296607499
### stats.nba.com scraping ### #region Imports import pandas as pd import numpy as np from bs4 import BeautifulSoup import requests import datetime as dt import os import json import time from datetime import timedelta, date #selenium imports import selenium from selenium import webdriver from selenium.webdriver.chr...
HyunTruth/CSE6242-S20-PRJ-NBA-frontend
NBAPlayerDefensiveComparisons/Code/Scraping/nba_scraper.py
nba_scraper.py
py
12,336
python
en
code
0
github-code
1
72696688033
# Advent of code 2021 : Day 2 | Part 1 # Author = Abhinav # Date = 2nd of December 2021 # Source = [Advent Of Code](https://adventofcode.com/2021/day/2) # Solution : inputs = open("input.txt", "rt") inputs = inputs.read().splitlines() forward, depth = 0, 0 for _ in inputs: x = int(_[-1]) if "forward" in _...
Brodevil/Advent-of-Code
aoc/2021/Day 2/part_1.py
part_1.py
py
467
python
en
code
0
github-code
1
72765977315
#!/usr/bin/env python # list of packages that should be imported for this code to work import cobra.mit.access import cobra.mit.session import cobra.mit.request import cobra.mit.naming import yaml import argparse import warnings warnings.filterwarnings("ignore") def get_args(): parser = argparse.ArgumentParser(de...
camrossi/aci-scripts
contractLookup.py
contractLookup.py
py
3,057
python
en
code
0
github-code
1
25527933398
#------------------------------------------------ # Syjer Asuncion # Classes # April 14, 2021 #------------------------------------------------ class student: num_of_stud = 0 def __init__(self, first, last, grade): self.first = first self.last = last self.grade = grade def...
SyjermelAsuncion/Computer-science-formative
FP4-F01.py
FP4-F01.py
py
2,165
python
en
code
0
github-code
1
7117180655
def longestPalindromicSubstring(string): currentLongest = [0,1] for i in range(1, len(string)): odd = helperPalindrome(string, i-1, i+1) even = helperPalindrome(string, i, i+1) longest = max(odd, even, key= lambda x:x[1] - x[0]) currentLongest = max(currentLongest, longest, key= ...
Theeyecode/python_alg
Medium/longest palindrome.py
longest palindrome.py
py
694
python
en
code
0
github-code
1
37954775751
class Solution: def findUnsortedSubarray(self, nums: List[int]) -> int: # with sorted sortedNums = sorted(nums) if nums == sortedNums: return 0 res = 0 errStart = 0 errEnd = 0 for i in range(len(nums)): if nums[i] != sortedNums[i]: ...
SamTang2004/ProjectRepo
python 练习册/Shortest unsorted continuous subarray.py
Shortest unsorted continuous subarray.py
py
547
python
en
code
0
github-code
1
13669375054
from Products.DataCollector.plugins.CollectorPlugin import ( SnmpPlugin, GetTableMap, ) class HAProxyBackends(SnmpPlugin): relname = 'haproxy_backends' modname = 'ZenPacks.community.HAProxy.HAProxyBackend' snmpGetTableMaps = ( GetTableMap( 'haBackendTable', '.1.3.6.1.4.1.29385...
linkslice/ZenPacks.community.HAProxy
ZenPacks/community/HAProxy/modeler/plugins/community/snmp/HAProxyBackends.py
HAProxyBackends.py
py
1,317
python
en
code
0
github-code
1
28784194437
''' Author: Ding Pang ''' import os import io, csv from re import S from sqlalchemy import * from sqlalchemy.pool import NullPool from flask import Flask, request, render_template, g, redirect, make_response, flash, session, Response, url_for from DBHelpers import * from datetime import date tmpl_dir = os.path.join(os...
DingPang/Shopify-Summer-2022-Challenge
server.py
server.py
py
11,474
python
en
code
0
github-code
1
73618867233
import sys from some_useful_functions import add_postfix_to_path_string class TooSmallTextError(Exception): def __init__(self, msg): self.message = msg def parade(file_name, batch_size, cut_off_first_batch): with open(file_name, 'r') as f: text = f.read() new_text = '' length = len(t...
deeppavlovteam/learning-to-learn-deepmind
parade.py
parade.py
py
1,466
python
en
code
0
github-code
1
36902412685
"""For each root element in a XML file, count how many lines in the element. The print out a list of the elements and the number of lines they have. Optionally pass a flag to sort the elements by length """ from lxml import etree import argparse import re import os from pathlib import Path from lxml.etree import XML...
marsfan/Farming-Simulator-Mod-Doc
utils/rootSizeCount.py
rootSizeCount.py
py
2,187
python
en
code
7
github-code
1
15127656412
from collections import Counter # O(n*log(n)) time | O(n) space class Solution: def findOriginalArray(self, changed: List[int]) -> List[int]: # if list is not of even length, original cannot exist if len(changed) % 2 != 0: return [] changed.sort() count = Counte...
mmichalak-swe/Algo_Expert_Python
LeetCode/2007_Find_Original_Array_From_Doubled/attempt_1.py
attempt_1.py
py
682
python
en
code
3
github-code
1
17213821352
#!/usr/bin/env python # -*- coding: utf-8 -*- """Test testing.generator module.""" import unittest from wetest.testing.generator import TestsGenerator, TestsSequence, get_key from wetest.testing.reader import ScenarioReader class TestTestsGenerator(unittest.TestCase): """Module's Unit Tests.""" def test_g...
epics-extensions/WeTest
wetest/tests/test_testing_generator.py
test_testing_generator.py
py
1,680
python
en
code
7
github-code
1
6213017763
from functools import lru_cache import csv @lru_cache def read(path): data = [] with open(path) as file: jobs_reader = csv.DictReader(file, delimiter=",", quotechar='"') for row in jobs_reader: data.append(row) return data
oelithon/estudo-projeto-job-insights
src/jobs.py
jobs.py
py
265
python
en
code
0
github-code
1
44344510292
import os import zipfile if not os.path.isdir("dist"): os.mkdir("dist") zf = zipfile.ZipFile("dist/gcp-dumper-function.zip", "w") for dirname, subdirs, files in os.walk("libs"): if not dirname.endswith("__pycache__"): zf.write(dirname) for filename in files: zf.write(os.path.join(d...
dhering/stock-scoring
gcp_dumper_build.py
gcp_dumper_build.py
py
465
python
en
code
4
github-code
1
72827305955
import sys sys.setrecursionlimit(10**6) node = int(sys.stdin.readline()) trie = [[] for t in range(node+1)] for t in range(node-1): a,b,c = map(int,sys.stdin.readline().split()) trie[a].append([b,c]) trie[b].append([a,c]) def dfs(x,val): global res,ix ch = 0 for t in trie[x]: if visi...
clapans/Algorithm_Study
박수근/all_code/1967.py
1967.py
py
727
python
en
code
0
github-code
1
29380433113
# Complete the almostSorted function below. def almostSorted(arr): swap_index_start = -1 swap_index_end = -1 i = 0 j = len(arr)-1 while(i<j and (swap_index_start<0 or swap_index_end <0)): if arr[i] > arr[i+1]: swap_index_start=i if arr[j-1]>arr[j]: swap_index...
mathiasarens/python-test
AlmostSorted.py
AlmostSorted.py
py
1,872
python
en
code
1
github-code
1
32232085798
import sys sys.path.append("..") import util.image_processing as impro from util import mosaic from util import data import torch def run_unet(img,net,size = 128,use_gpu = True): img=impro.image2folat(img,3) img=img.reshape(1,3,size,size) img = torch.from_numpy(img) if use_gpu: img=img.cuda() ...
Synchronized2/DeepMosaics
models/runmodel.py
runmodel.py
py
1,626
python
en
code
83
github-code
1
18111245702
#!/usr/bin/env python import sys, random if len(sys.argv) > 1: MAXDELAY = int(sys.argv[1]) else: MAXDELAY = 50 # interpose.c template strings header = "" libraries = "#define _GNU_SOURCE\n" \ "#include <dlfcn.h>\n" \ "#include <time.h>\n" \ "#include <wchar.h>\n" \ ...
tagatac/libsafe-CVE-2005-1125
gen_interpose.py
gen_interpose.py
py
6,759
python
en
code
3
github-code
1
29055069542
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib import messages from django.forms.formsets import formset_factory from django.forms import modelformset_factory from django.core import serializers from django.http import HttpResponse from .models import Portfolio, PortfolioProduct, ...
cristianalecu/Django
monolith_alt/portfolios/views.py
views.py
py
7,829
python
en
code
0
github-code
1
69850894114
import os import numpy as np import tensorflow as tf from tensorflow import keras from sacred import Experiment from sacred.observers import MongoObserver ex = Experiment('fashion_mnist') ex.observers.append(MongoObserver.create(url='localhost:27017', db_name='sacred_omniboard...
eunguru/Sacred_Omniboard
fashion_mnist_sacred.py
fashion_mnist_sacred.py
py
2,952
python
en
code
1
github-code
1
70285110114
from math import pi import gym import numpy as np from math import pi, floor from cmath import rect, phase from gym import spaces def wrap_to_pi(a): """ Wrap angle to [-pi pi] :param a: angle to convert :return: new angle in the [-pi pi] """ return a - (2 * pi * floor((a + pi) / (2 * pi))...
dam-grassman/Drone-Interception-Env
acas_wrappers.py
acas_wrappers.py
py
4,342
python
en
code
3
github-code
1
15702625085
veta = "mama ma misu".split() print(veta) test = "hello, world!".split() print(test) zaznamy = "3A,8B,2E,9D".split(',') print(zaznamy) slova = " ".join(veta) print(slova) veta = "mama ma misu!" print(veta[-5:-1]) slova = veta.split() print(slova[2]) # funkce, která vybere jen ty správně zadané záznamy, které maj...
zabojnikp/study
Python_Projects/python2_pyladies/retezce_seznamy.py
retezce_seznamy.py
py
1,821
python
en
code
0
github-code
1
22504357339
import sys from heapq import heappop, heappush input = sys.stdin.readline # 문제 수 N, 정보 개수 M N, M = map(int, input().split()) graph = [[] for _ in range(N+1)] inDegree = [0 for _ in range(N+1)] ans = [] for _ in range(M): A, B = map(int, input().split()) graph[A].append(B) inDegree[B] += 1 ...
Kminwo-o/BaekJoon-Algorithm
백준/Gold/1766. 문제집/문제집.py
문제집.py
py
629
python
en
code
0
github-code
1
28537185288
# -*- coding: utf-8 -*- import sys sys.dont_write_bytecode = True import os import torch from core.config import Config from core import Test PATH = "/.../.../...-bgl_time-tcniniNet-2-5-Feb-27-2023-18-07-28" VAR_DICT = { "test_epoch": 5, "device_ids": "0", "inner_train_iter": 100, "n_gpu": 1, "test...
Aquariuaa/FSLog
Fine_Tuning_Test.py
Fine_Tuning_Test.py
py
852
python
en
code
0
github-code
1
18732404186
from motor.motor_asyncio import AsyncIOMotorCollection, AsyncIOMotorClientSession from pydantic import Field import infrastructure from models.base import EntityModel class Organization(EntityModel): name: str = Field() class OrgCollectionRepository(infrastructure.LoggedCollectionRepository[Organization]): ...
paukstelom/sponsorbook
contexts/organization.py
organization.py
py
542
python
en
code
0
github-code
1
42969215509
from image_processing import * def linear(img): img_edges = edges(img) vertices = np.array([[(180,520),(450,300),(520,300),(850,520)]]) img_roi = ROI(img_edges, vertices) img_line = houghlines(img_roi, img) return img_line def circular(img): img_bin = binarize(img) vertices = np.array([[(4...
AutoMecUA/VisionAndRosWorkshop
first_session/main.py
main.py
py
615
python
en
code
1
github-code
1
25651035868
# # 在____________上补充代码 # import turtle as t color = ['red','green','blue'] rs = [10,30,60] for i in range(3): t.penup() t.goto(0, -rs[i]) t.pendown() t.pencolor(color[i]) t.circle(rs[i]) t.done()
tgeuuy/Crawler
study/base_learning/计算机二级/13套/简单应用/PY201.py
PY201.py
py
231
python
en
code
0
github-code
1
33246447140
from vmwarelib.actions import BaseAction class GetTagsFromObjects(BaseAction): def get_tags(self, object_id, object_type): obj_tags = self.tagging.tag_association_list_attached_tags(object_type, object_id) tags = {} for obj in obj_tags: tag = self.tagging.tag_get(obj) ...
StackStorm-Exchange/stackstorm-vsphere
actions/get_tags_from_objects.py
get_tags_from_objects.py
py
1,455
python
en
code
11
github-code
1
38505477934
from nose.tools import * from ex47.game import Room from ex47.game import Weapons def test_room(): gold = Room("GoldRoom", """This room has gold in it you can grab. There's a door to the north.""") assert_equal(gold.name, "GoldRoom") assert_equal(gold.paths, {}) def test_...
darthlukan/ex47
tests/ex47_tests.py
ex47_tests.py
py
1,620
python
en
code
5
github-code
1
35072126027
import argparse from datetime import datetime from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.chrome.service import Service from selenium.webdriver.remote.webdriver import WebDriver import issuehandler.config as config from issuehandler.pages import (Home...
Vernalhav/github-issue-tracker
issuehandler/issuehandler.py
issuehandler.py
py
4,968
python
en
code
0
github-code
1
75149850592
'''Task You are given two integer arrays of size N X P and M X P (N & M are rows, and P is the column). Your task is to concatenate the arrays along axis 0. Input Format The first line contains space separated integers N, M and P. The next N lines contains the space separated elements of the P columns. After that, t...
karinabk/Python
NumPy/concatenate.py
concatenate.py
py
761
python
en
code
1
github-code
1
73469043234
import sys try: import fsnav except ImportError: fsnav = None # Build information __author__ = 'Kevin Wurster' __version__ = '0.1' __email__ = 'wursterk@gmail.com' __source__ = 'https://github.com/geowurster/FS_Nav' # Define help functions def print_usage(): print(""" Usage: %s --help-info dir|file|wild...
jstillw/FS_Nav
bin/count.py
count.py
py
2,599
python
en
code
0
github-code
1
16121140583
# -*- coding: utf-8 -*- # Flag status: # 1 - Correct flag # 0 - Old flag # 2 - Not a flag # -1 - Server is down or another error correct = 1 old = 0 not_flag = 2 error = -1
singulared/honeypot.ctf
flags/flagstatus.py
flagstatus.py
py
186
python
en
code
0
github-code
1
27591844046
import sys input = sys.stdin.readline n = int(input()) board = [[' ' for x in range(2 * n - 1)] for y in range(n)] def star(n, x, y): if n == 3: for i in range(5): board[2 + x][i + y] = '*' for i in range(1, 4, 2): board[1 + x][i + y] = '*' board[0 + x][2 + y] = '*'...
ChoHon/Algorithm
week 01/2448.py
2448.py
py
484
python
en
code
0
github-code
1
25894141826
import datetime import pytz from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools from secrets import CALENDARS_TO_CHECK # If modifying these scopes, delete the file token.json. SCOPES = 'https://www.googleapis.com/auth/calendar.readonly' def get_calendar...
jchorl/waker
server/gcalendar.py
gcalendar.py
py
2,565
python
en
code
0
github-code
1