seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
74798420027
import matplotlib.pyplot as plt import pandas as pd from matplotlib.cm import get_cmap data = pd.read_csv("./output_geo.csv") df = pd.DataFrame(data) fig, ax = plt.subplots() # get a color map cmap = get_cmap("tab20", 28) # type: matplotlib.colors.ListedColormap colors = cmap.colors # type: list ips = df['ip'] me...
LisandroDiMeo/tp_traceroute
create_graph_rtt.py
create_graph_rtt.py
py
499
python
en
code
0
github-code
6
14405820391
# coding=utf-8 from django.contrib.admin import ModelAdmin, site from models import News class NewsAdmin(ModelAdmin): list_display = ('id', 'match_type', 'game_start_time', 'end_score', 'middle_score', 'status', 'team1', 'score', 'team2', 'yapan','yapanSB', 'daxiaopan','daxiaopanSB', 'findex'...
xiaoqiu206/football
spider/admin.py
admin.py
py
507
python
en
code
36
github-code
6
25911864922
import math from Solution import Solution class P003(Solution): def is_prime(self, number): if number % 2 == 0: return False upper_limit = math.floor(math.sqrt(number)) if upper_limit % 2 == 0: upper_limit -= 1 for i in range(upper_limit, 1, -2): ...
TalaatHarb/project-euler-100
python-project-euler-100/p003.py
p003.py
py
947
python
en
code
2
github-code
6
26349073306
import functools from enum import Enum import json import re class SCJDEntry: def __init__(self): self.data = {} def set_title(self, title): self.data['title'] = title def set_id(self, idx): self.data['idx'] = idx def glue_pronounce(self, prn): if 'prn' in self.data: self.data['prn'] += prn else: ...
Leundo/apple-dictionary-extractor
ADParser/scjd_controller.py
scjd_controller.py
py
17,976
python
en
code
0
github-code
6
73266752189
import cv2 import numpy as np from scipy import signal import math import matplotlib.pyplot as plt if __name__ == "__main__": gauss_blur_filter = [[0 for x in range(3)] for y in range(3)] gauss_blur_filter[0][0] = 1/16 gauss_blur_filter[0][1] = 1/8 gauss_blur_filter[0][2] = 1/...
Srivenkat1995/Image-Segmentation-and-Point-Detection
task2.py
task2.py
py
2,305
python
en
code
0
github-code
6
72784253307
# https://www.codewars.com/kata/58558673b6b0e5a16b000028 def fight_resolve(defender, attacker): if (defender.lower() == defender) == (attacker.lower() == attacker): return -1 defender_win = { 'a': 's', 'k':'a', 'p': 'k', 's': 'p'} a = attacker.lower() d = defender.lower() if defender_win[d...
blzzua/codewars
7-kyu/boardgame_fight_resolve.py
boardgame_fight_resolve.py
py
386
python
en
code
0
github-code
6
37681820103
import pygame from configs import ColorConfig class Button(object): def __init__(self, x_coordinate: int, y_coordinate: int, button_width: int, button_height: int, text_font: str, text_size: str, button_name: str, onclick_function=None): self.x = x_coordinate se...
pavst23/project_game
elements/button.py
button.py
py
1,452
python
en
code
0
github-code
6
19773909067
# -*- coding: utf-8 -*- """ IBEIS CORE Defines the core dependency cache supported by the image analysis api Extracts annotation chips from imaages and applies optional image normalizations. TODO: * interactive callback functions * detection interface * identification interface NOTES: HOW TO DESI...
smenon8/ibeis
ibeis/core_annots.py
core_annots.py
py
57,012
python
en
code
null
github-code
6
70952123708
def func(file): with open(file) as d: text = d.readlines() for line in text: words = line.split() print(words.replace('172','192')) file1='running-config.cfg' func(file1) dict={}
inwk6312fall2017/programming-task-final-lavneeshj
task3.py
task3.py
py
201
python
en
code
0
github-code
6
40197352017
from django.urls import path from . import views app_name = "Employees" urlpatterns = [ path('profile', views.profile, name="profile"), path('edit_profile', views.editprofile, name="edit_profile"), path('check_employee', views.checkemployee, name="check_employee"), path('employee_position', views.emp...
jakubbm/employees-management
Employees/urls.py
urls.py
py
615
python
en
code
0
github-code
6
2772837306
# Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. # Note: For the purpose of this problem, we define empty string as valid palindrome. # Example 1: # Input: "A man, a plan, a canal: Panama" # Output: true # Example 2: # Input: "race a car" # Output: fals...
queryor/algorithms
leetcode/125. Valid Palindrome.py
125. Valid Palindrome.py
py
1,300
python
en
code
0
github-code
6
28521286035
"""Added instructions html to make instructions dynamic Revision ID: 6a1ef6fabfaf Revises: 1c8b21137307 Create Date: 2017-08-12 01:36:17.185403 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '6a1ef6fabfaf' down_revision = '...
harveyslash/backend-cleaned
beatest/migrations/versions/0005_6a1ef6fabfaf_added_instructions_html_to_make_.py
0005_6a1ef6fabfaf_added_instructions_html_to_make_.py
py
748
python
en
code
0
github-code
6
73823047227
def climb(n): a = 0 b = 1 c = 0 if n == 1: return 1 for i in range(n): c = a + b a = b b = c return c print(climb(5)) # time complexity: o(n) # space complexity: o(1)
jateen67/leetcode
1d dynamic programming/easy/70_climbing_stairs.py
70_climbing_stairs.py
py
229
python
en
code
0
github-code
6
29639554051
# -*- coding: utf-8 -*- from odoo import api, fields, models class CrmLead(models.Model): _name = 'crm.lead' _inherit = ['crm.lead', 'l10n_cl.counties.mixin'] city_id = fields.Many2one( "res.city", string="Commune", help="Commune of the lead") @api.onchange('city_id') def _oncha...
OdooJC/Scientech-YVes
Custom/crm_counties/models/crm_lead.py
crm_lead.py
py
833
python
en
code
0
github-code
6
73726701627
from django.shortcuts import render from .models import Post, Categories # Create your views here. def blog(request): post = Post.objects.all() cat = [i.categories.all()[0] for i in post] cat = list(set(cat)) return render(request, 'blog/blog.html', {'posts': post, 'categories': cat}...
rebecalvarezc/django_clases
firstWeb/blogApp/views.py
views.py
py
596
python
en
code
0
github-code
6
28684800381
num=int(input("Enter the number of terms for the Fizz_buzz: ")) for i in range(1,num+1): if i % 3 == 0 and i % 5 == 0: print("Fizz_Buzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i)
Heinrich-Swart/FizzBuzz
Fizzbuzz.py
Fizzbuzz.py
py
266
python
en
code
0
github-code
6
21763637442
# Approach 3: Hash Map # Time: O(n*log(n)) # Space: O(n) class Solution: def findWinners(self, matches: List[List[int]]) -> List[List[int]]: losses_count = {} for winner, loser in matches: losses_count[winner] = losses_count.get(winner, 0) losses_count[loser] =...
jimit105/leetcode-submissions
problems/find_players_with_zero_or_one_losses/solution.py
solution.py
py
668
python
en
code
0
github-code
6
34825925053
# todo: add hash sum to judge solution file name on web-app side cuz it can break everything import os import shutil import subprocess from typing import List import source.models from .service import sequence_to_dict from .static import * from .config import BUILD_SOURCE_MAX_TIME, SQL_GET_TASK_ATTRIBUTE, SQL_GET_C...
TolimanStaR/AtomicJudge
source/task_manager.py
task_manager.py
py
24,126
python
en
code
0
github-code
6
4641112247
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function, absolute_import __author__ = 'Andres' import re # Matches tags tagRE = re.compile(r'(.*?)<(/?\w+)[^>]*>(?:([^<]*)(<.*?>)?)?') # Matches bold/italic bold_italic = re.compile(r"'''''(.*?)'''''") bold = re.compile(r"'''(.*?)'''") italic_q...
keeleleek/estnltk
estnltk/wiki/cleaner.py
cleaner.py
py
6,425
python
en
code
null
github-code
6
36153558414
import unittest import datetime import json from app.textsapi.models.submission import Submission from app.textsapi.models.text import Text from app.tests.base import BaseTestCase def register_ok_submission(self, token): return self.client.post( '/submission/', headers=dict( Authorizat...
jkausti/flask-textsapi
app/tests/_test_submission_controller.py
_test_submission_controller.py
py
3,468
python
en
code
1
github-code
6
19876190982
#!/usr/bin/python3 import os import argparse from subprocess import call if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('basedir', type=str, help='The base directory to walk from') args = parser.parse_args() print('The base dir is: {}'.format(args.basedir)) for d...
ruizhang84/B565-Data-Mining
src/preprocess/scripts/decompress.py
decompress.py
py
688
python
en
code
0
github-code
6
36525273442
"""Parser object that performs coarse-to-fine and postprocessing. Additionally, a simple command line interface similar to bitpar.""" from __future__ import print_function import io import os import re import sys import time import gzip import codecs import logging import tempfile import traceback import string # pyl...
pombredanne/disco-dop
discodop/parser.py
parser.py
py
27,717
python
en
code
null
github-code
6
25636796283
#!/usr/bin/env python # coding: utf-8 # In[2]: colorList = ["blue", "purple", "pink", "yellow", "green"] for color in colorList: print(color) # In[2]: n = 0 numbers = list(range(10)) for num in numbers: print (num) # In[1]: n = 0 while n<10: print(n) n = n+1 # In[1]: n = 0 while n <= 10:...
madelinedq/HW1_deQuillacq_Madeline
HW2_deQuillacq_Madeline.py
HW2_deQuillacq_Madeline.py
py
503
python
en
code
0
github-code
6
36397304694
""" Table of Contents 1. drop_null_columns: Drop columns that exceed a threshold of null values. """ from pyspark.sql import functions as F, DataFrame from ..parsing.melting import melt def drop_null_columns(df: DataFrame, threshold: float = 1.0, subset: list = None) -> DataFrame: """ Drop columns that exc...
phil-trinh/pyspark_utilities_sample
transformations/calculations/null_funcs.py
null_funcs.py
py
2,241
python
en
code
0
github-code
6
9633424069
# W.A.P in Python to count the total no. of words in a string. # str = input("Enter the string :- ") total = 1 for i in range(len(str)) : # len() function returns the length of the string. if(str[i]==" ") : total+=1 print("The total number of words in the string is ",total) ...
sunny-ghosh/Python-projects
count_string.py
count_string.py
py
615
python
en
code
0
github-code
6
12110709697
import numpy as np from tqdm import tqdm flip_inst = {} flip_inst['e'] = [1, 0] flip_inst['w'] = [-1, 0] flip_inst['se'] = [0, -1] flip_inst['sw'] = [-1, -1] flip_inst['ne'] = [1, 1] flip_inst['nw'] = [0, 1] def flip_tile(instr, tiles): tile = np.array([0, 0]) while instr: for fi, dir in flip_inst.it...
scjohnson/aoc_2020
solution_24.py
solution_24.py
py
2,048
python
en
code
0
github-code
6
39188602086
from django.urls import path, include from rest_framework.routers import DefaultRouter from blog import apiviews router = DefaultRouter() router.register('posts', apiviews.PostViewSet) router.register('comments', apiviews.CommentViewSet) router.register('replies', apiviews.ReplyViewSet) router.register('users', apivie...
MahfuzKhandaker/blogapi
blog/urls.py
urls.py
py
736
python
en
code
0
github-code
6
74436640828
import glob import numpy as np import pandas as pd import nibabel as nib import torch from torch.utils.data import Dataset # dataset class for the GenericObjectDecoding dataset class GODData(Dataset): FEATURES_PATH = "data/ds001246/derivatives/preproc-spm/output" TARGETS_PATH = "data/ds001246" TRAIN_CATEG...
v15hv4/ViT-fMRI
dataOLD.py
dataOLD.py
py
2,614
python
en
code
0
github-code
6
29543052882
""" Difficulty: Easy Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Example 1: Input: x = 123 Ou...
ali-izhar/daily-commit-challenge
int/reverse.py
reverse.py
py
1,186
python
en
code
2
github-code
6
14504710213
import os import numpy as np import pandas as pd from PIL import Image from collections import Counter import torch from torch.utils.data import Dataset from torch.nn.utils.rnn import pad_sequence import torchvision.transforms as T import spacy spacy_eng = spacy.load("en_core_web_sm") # defining the transform to be...
danarip/ImageCaptionGenerator
source/data_preprocessing.py
data_preprocessing.py
py
5,555
python
en
code
0
github-code
6
73154395388
import os import pickle import argparse import torch import torch.optim as optim from torch.utils.data import DataLoader from Model.INPLIM import Doctor from data_utils import CodeLevelDataset from utils import train_eval def args(): parser = argparse.ArgumentParser() parser.add_argument('--data_root', type=s...
xlbryantx/INPLIM
main.py
main.py
py
4,064
python
en
code
3
github-code
6
21489679841
# -*- coding: utf-8 -*- """ Created on Thu Oct 14 14:19:49 2021 @author: 姜高晓 """ import numpy as np from scipy.fftpack import fft,ifft from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures from sklearn import svm from skl...
GazerJ/Math_2021_HW
math/4.2╖╓└α╞≈╫╘╢¿╥σ╖╓└α╞≈.py
4.2╖╓└α╞≈╫╘╢¿╥σ╖╓└α╞≈.py
py
3,803
python
en
code
3
github-code
6
1584185561
# This is mostly lifted from django-storages' sftp backend: Their license: # # SFTP storage backend for Django. # Author: Brent Tubbs <brent.tubbs@gmail.com> # License: MIT # # Modeled on the FTP storage by Rafal Jonca <jonca.rafal@gmail.com> from __future__ import print_function try: import ssh except ImportError:...
beniwohli/django-localdevstorage
localdevstorage/sftp.py
sftp.py
py
3,964
python
en
code
50
github-code
6
38586292194
import cv2 import numpy as np img = cv2.imread('images/saitama.jpg') hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # convert it to hsv width = img.shape[1] height = img.shape[0] channel = img.shape[2] increase_v = 40 decrease_s = 10 step = 2 # bien doi hinh anh print("chon huong di cua animation: ") print("1.Left ->...
19522515/CS231.L21-Computer-Vision-Project
Source code/pptanimation_swipe.py
pptanimation_swipe.py
py
2,089
python
en
code
0
github-code
6
40467024636
# 해시 import sys input = sys.stdin.readline n,m = map(int, input().split()) graph = {} for _ in range(n): address, num = input().rstrip().split() graph[address] = num for _ in range(m): temp = input().rstrip() print(graph[temp])
Cho-El/coding-test-practice
백준 문제/해시/비밀번호 찾기.py
비밀번호 찾기.py
py
248
python
en
code
0
github-code
6
72599581948
import unittest import bioschemas from bioschemas.extractors import ExtractorFromHtml config = bioschemas.DEFAULT_CONFIG class TestExtractors(unittest.TestCase): def test_jsonld_extraction_from_html(self): html = '''<script type="application/ld+json"> { "@context": "http://bioschemas.o...
buzzbangorg/bsbang-crawler
bioschemas/test_extractors.py
test_extractors.py
py
1,197
python
en
code
4
github-code
6
25907426422
whiskyPriceInBgn = float(input()) beerLiters = float(input()) wineLiters = float(input()) rakiaLiters = float(input()) whiskyLiters = float(input()) rakiaPrice = whiskyPriceInBgn / 2 winePrice = rakiaPrice - (0.4 * rakiaPrice) beerPrice = rakiaPrice - (0.8 * rakiaPrice) totalSum = (whiskyPriceInBgn * whiskyLiters) + ...
skipter/Programming-Basics-Python
Python Basics October 2018/Python-Simple-Operations-and-Calculations-Exercise/AlcoholMarket.py
AlcoholMarket.py
py
425
python
en
code
0
github-code
6
74514085946
#!/usr/bin/env python3 from __future__ import print_function from __future__ import division # System level imports import sys import os import argparse import logging import time import math import numpy as np import matplotlib.pyplot as plt from numpy.core.defchararray import index import controller2d #import contro...
AlfonsoCom/AVD_BP
main.py
main.py
py
80,582
python
en
code
0
github-code
6
32796024261
from gevent import monkey monkey.patch_all() import gevent import socket import re import dns import log LOG = log.get_logger('dns-proxy') class DNSServer(object): def __init__(self, host='0.0.0.0', port=53, nameserver='114.114.114.114'): self.sock = None self.host = host self.port = port...
PeerXu/death-star
death_star/dns_proxy.py
dns_proxy.py
py
3,334
python
en
code
8
github-code
6
13876656972
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.encoders import jsonable_encoder from pydantic import BaseModel import boto3 import json app = FastAPI() origins = [ "https://ai.galaxychain.zone", "https://galaxychain.zone", "http://localhost:3000", "https://...
galaxynetwork/story-ai-supporter
app.py
app.py
py
2,629
python
en
code
1
github-code
6
21101364933
import os import tempfile from shutil import rmtree import pytest import responses from faker import Faker from flask import Response, Flask from flask.testing import FlaskClient from statuspage2slack.statuspage_constants import ComponentStatus, \ IncidentStatus, IncidentImpact fake = Faker() STATUSPAGE_DATETIM...
Cobliteam/statuspage2slack
tests/test_webhook.py
test_webhook.py
py
7,087
python
en
code
0
github-code
6
26433388736
import pandas as pd import numpy as np import json import os from pydub import AudioSegment from scipy.io.wavfile import read import stft from sklearn.pipeline import Pipeline from sklearn.preprocessing import normalize from sklearn.decomposition import PCA import random import signal import cPickle as pickle from func...
jonathanwoodard/Melospiza
source/transform_audio.py
transform_audio.py
py
4,665
python
en
code
0
github-code
6
5114460856
import numpy as np from scipy import ndimage import matplotlib.pyplot as plt from matplotlib.colors import LogNorm as LogNorm def compare_fields(delta_F, delta_DM, R_sm, pc_meta): # from Metin 2019 ''' A function for comparing the fields of delta_F and delta_DM with hist2d. ''' fig = plt.figure(f...
pointeee/preheat2022_public
misc_func.py
misc_func.py
py
2,753
python
en
code
0
github-code
6
33195061509
import numpy as np import cv2 import copy from time import sleep import datetime # from progress.bar import Bar def Rodar(cam): capture = cv2.VideoCapture(cam) background_subtractor = cv2.bgsegm.createBackgroundSubtractorMOG() #length = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) # bar = Bar('Processi...
rnanc/MOBYDATA
services/motion_heatmap.py
motion_heatmap.py
py
2,177
python
en
code
0
github-code
6
19686502833
import sys import time from datetime import datetime from textwrap import dedent import requests import telegram from environs import Env from loguru import logger from telegram import ParseMode def send_telegram_message(chat_id: int, bot: telegram.Bot, telegram_message: str) -> None: bot.send_message(chat_id=ch...
wepeqoor1/check_success_request
check_request.py
check_request.py
py
3,916
python
en
code
0
github-code
6
19154810876
from numpy import * from time import sleep import json import urllib2 # 数据导入函数 def loadDataSet(fileName): # 打开一个含有分隔符的文本文件 numFeat = len(open(fileName).readline().split('\t')) - 1 # 获得特征数,减1是因为最后一列是因变量 dataMat = [] labelMat = [] fr = open(fileName) for line in fr.readlines(): lineArr = [...
yhshu/Machine-Learning-in-Action
Ch08-LinearRegression/regression.py
regression.py
py
9,114
python
zh
code
0
github-code
6
32726100359
from collections import deque from pathlib import Path import random from PIL import Image, ImageTk from tkinter import Tk, Label from typing import Callable, Optional, Sequence from abc import ABC, abstractmethod import numpy as np import torch import gym from collections import namedtuple from ..game.play import (P...
wecacuee/floyd-warshal-rl
fwrl/prob/gym.py
gym.py
py
6,947
python
en
code
0
github-code
6
37460236670
import tkinter as tk import pandas as pd import os from PathManager import locationManager as lm def error_popup(msg): """Super simple pop-up to indicate an error has occured.""" popup = tk.Tk() popup.wm_title("!") label = tk.Label(popup, text=msg) label.pack(side="top", fill="x", pady=10) B1 ...
Hamza-crypto/QuickBooks-importer-script-python
ErrorLogging.py
ErrorLogging.py
py
902
python
en
code
0
github-code
6
19626071979
# coding: utf-8 from sqlalchemy import Column, DateTime, Integer, String, text from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from base import db_url Base = declarative_base() metadata = Base.metadata db = create_engine(db_url) ses...
natsuforyou/troubledmonkey
models.py
models.py
py
4,401
python
en
code
3
github-code
6
43535916514
import argparse import sys import logging from mutagene.profiles.profile import calc_profile logger = logging.getLogger(__name__) genome_error_message = """requires genome name argument -g hg19, hg38, mm10, see http://hgdownload.cse.ucsc.edu/downloads.html for more Use mutagene fetch to down...
neksa/mutagene
mutagene/cli/profile_menu.py
profile_menu.py
py
1,614
python
en
code
3
github-code
6
2533690932
from typing import List, Optional import filters as f from iota import Address from iota.commands import FilterCommand, RequestFilter from iota.commands.core.find_transactions import FindTransactionsCommand from iota.commands.core.were_addresses_spent_from import \ WereAddressesSpentFromCommand from iota.crypto.a...
iotaledger/iota.py
iota/commands/extended/get_new_addresses.py
get_new_addresses.py
py
3,422
python
en
code
344
github-code
6
70270071869
from sqlalchemy import Column from sqlalchemy import Integer, String from sqlalchemy.orm import relationship from app.models.base import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String, nullable=False) email = Column(String, nullable=Fal...
cyber-chuvash/todolist-API
app/models/user.py
user.py
py
678
python
en
code
0
github-code
6
32506800793
#!/usr/bin/env python3 """ Read API data directly via internet and output to pipe """ import json import logging import time import requests from .. import defs from . import net from .order import ApiOrder, API_CHANNEL_SSE_NAME from .pkt import BlocksatPkt, BlocksatPktHandler logger = logging.getLogger(__name__) M...
Blockstream/satellite
blocksatcli/api/demorx.py
demorx.py
py
11,171
python
en
code
949
github-code
6
72298298427
import pickle from flask import Flask, request, jsonify import numpy as np # Load model and dv with open("dv.pkl", "rb") as f_in: dv = pickle.load(f_in) with open("rf_model.pkl", "rb") as f_in: model = pickle.load(f_in) # instantiate app = Flask('atx_housing_prediction') # set path: /predict @app.ro...
michaelfronda/ATXHousePrice
predict.py
predict.py
py
733
python
en
code
0
github-code
6
21091581358
import sys import time import yaml from watchdog.observers import Observer from watchdog.events import * import ftplib config_file = "client.yml" def get_config(index): with open(config_file) as f: return yaml.load(f, Loader=yaml.FullLoader)[index] class MyHandler(FileSystemEventHandler): def on_modi...
yifan-ivan/FileSynchronizer
client.py
client.py
py
1,061
python
en
code
0
github-code
6
10793618381
"""Code to interface with the SMA inverters and return the results.""" # Robust initialization and shutdown code courtesy of # https://github.com/wbenny/python-graceful-shutdown.git import logging import sys import os import asyncio import aiohttp from delayedints import DelayedKeyboardInterrupt from pvsite import S...
sillygoose/sbhistory
sbhistory/sbhistory.py
sbhistory.py
py
2,975
python
en
code
2
github-code
6
28462595619
import os import sys from distutils.core import setup from distutils.core import Extension # detect python version version = [] if hasattr(sys.version_info, 'major'): version.append(sys.version_info.major) version.append(sys.version_info.minor) else: version = sys.version_info[0:2] # detect boost_python l...
seznam/mcache-client
python/setup.py
setup.py
py
2,009
python
en
code
4
github-code
6
10865376818
import logging import json import datetime import numpy as np from sklearn.base import BaseEstimator from sklearn.gaussian_process import GaussianProcessRegressor from aggregating.utils import flatten_X, generate_train_set, memory_efficient_predict from stochastic_models import MaxCallStochasticModel ### general MPI...
tlpss/ML-Project2
mpi/utils.py
utils.py
py
6,471
python
en
code
0
github-code
6
37824702150
#do slice # %% L = list(range(100)) n = L[0:10] print(n) # %% n = L[:10:2] print(n) # %% n = L[::5] print(n) # %% def trim(s): if s == '': return s while s[0] == ' ': s = s[1:] if s == '': return s while s[-1] == ' ': s = s[:-1] return s # 测试: if trim('hell...
AlaiaS/Python-Learning
Features.py
Features.py
py
2,610
python
en
code
0
github-code
6
72532105789
import json from http import HTTPStatus from typing import Any, Literal import httpx from pydantic import BaseModel, Field from simcore_service_api_server.utils.http_calls_capture_processing import ( PathDescription, enhance_from_openapi_spec, ) class HttpApiCallCaptureModel(BaseModel): """ Captures ...
ITISFoundation/osparc-simcore
services/api-server/src/simcore_service_api_server/utils/http_calls_capture.py
http_calls_capture.py
py
2,202
python
en
code
35
github-code
6
232662350
import os import sys import glob import subprocess import glob from pefile import PE name = "ReBarDxe" version = "1.0" GUID = "a8ee1777-a4f5-4345-9da4-13742084d31e" shell = sys.platform == "win32" buildtype = "RELEASE" def filesub(filep, f, r): # Read in the file with open(filep, 'r') as file : filed...
xCuri0/ReBarUEFI
ReBarDxe/buildffs.py
buildffs.py
py
2,663
python
en
code
562
github-code
6
36935275213
# this is focused on speed # it may not run everything import pathlib import numpy as np from tinygrad.ops import MovementOps, ProcessingOps from tinygrad.llops.ops_gpu import require_init_gpu, clbuild, get_cl_queue, get_cl_ctx from tinygrad.llops.ops_gpu import contiguous from tinygrad.llops.ops_gpu import unary_op a...
henrylao/tinygrad
accel/opencl/ops_opencl.py
ops_opencl.py
py
5,655
python
en
code
null
github-code
6
26530831301
import json from oneview_redfish_toolkit.api.composition_service import CompositionService from oneview_redfish_toolkit.tests.base_test import BaseTest class TestCompositionService(BaseTest): """Tests for CompositionService class""" def setUp(self): """Tests preparation""" # Loading Composi...
HewlettPackard/oneview-redfish-toolkit
oneview_redfish_toolkit/tests/api/test_composition_service.py
test_composition_service.py
py
1,507
python
en
code
16
github-code
6
17972375760
import dash from dash import Dash, html, Output, Input, dcc, callback import dash_bootstrap_components as dbc import pandas as pd import plotly.express as px import dash_ag_grid as dag app = dash.Dash(__name__, external_stylesheets=[dbc.themes.LUX], suppress_callback_exceptions=True, meta_tags=[{'name': 'viewport',...
Natcha-Phonkamhaeng/nobel-viz
src/app.py
app.py
py
6,264
python
en
code
1
github-code
6
73118020027
import os import torch import matplotlib.pyplot as plt from config.config import cfg def get_supports(m): """ Returns the number of samples and the percentage of support for each activity in the ground truth data of a given dataset. Args: - m (str): the name of the dataset Returns: - support...
Vito-Scaraggi/mpgnnap
data_info.py
data_info.py
py
3,704
python
en
code
1
github-code
6
2519404412
''' Library for data importation and feature selection''' ############################################################################### # Author: Zane Markel # Created: 6 MAR 2014 # # Name: mldata # Description : Library for importing/exporting data and feature selection # #########################...
zanemarkel/trident
learn/spr14mldata.py
spr14mldata.py
py
5,881
python
en
code
2
github-code
6
27773611300
import requests import os from telepyrobot.setclient import TelePyroBot from pyrogram import filters from pyrogram.types import Message from telepyrobot import COMMAND_HAND_LER __PLUGIN__ = os.path.basename(__file__.replace(".py", "")) __help__ = f""" Url Shortner Plugin for https://da.gd **Usage:** `{COMMAND_HAND_L...
Divkix/TelePyroBot
telepyrobot/plugins/url_shortner.py
url_shortner.py
py
1,615
python
en
code
40
github-code
6
41745621937
import os import sqlite3 from bs4 import BeautifulSoup def scan_folder(parentfile, diff): for file_name in os.listdir(parentfile): if "_" in file_name: diff = eachfile(file_name, parentfile, diff) else: current_path = "".join((parentfile, "/", file_na...
22650684/Webscraping-Project
testing/dbMatchFile.py
dbMatchFile.py
py
3,089
python
en
code
0
github-code
6
19314688451
# -*- coding: utf-8 -*- ''' A module for startup settings ''' from __future__ import absolute_import import logging import os.path import sys from requests.structures import CaseInsensitiveDict # pylint: disable=import-error,3rd-party-local-module-not-gated # Import local libs # This file may be loaded out of ...
BKnight760/ubuntu-systemlink-salt-minion
var/lib/salt/minion/extmods/modules/startup_settings.py
startup_settings.py
py
6,757
python
en
code
1
github-code
6
5975605110
from . import sql, chunk, rarity_info, BASE_PATH, Page from datetime import datetime as dt, timedelta as td from io import BytesIO from pandas import DataFrame from PIL import Image from random import choice, choices, random import json import logging import requests as r log = logging.getLogger(__name__) log.setLevel...
austinmh12/DiscordBots
TestBot/test_cogs/pokerouletteFunctions/pokemon.py
pokemon.py
py
20,054
python
en
code
0
github-code
6
23740308683
people = ["Domey K", "Oscarrr", "Jakee", "Crumbs", "Davers", "Jebewok", "Conrr"] searchName = input("Searched name ") foundName = False currentRecordNum = 0 while foundName == False and currentRecordNum < len(people): if searchName == people[currentRecordNum]: foundName = True print(f"Name: {searc...
Zoobdude/Computer-science-tasks
searching/linearSearchWithWhile.py
linearSearchWithWhile.py
py
486
python
en
code
0
github-code
6
73471512828
from gtts import gTTS #Tratamento de ádio import os import time def text_in_audio(text): ''' Converte texto em áudio, salva em audio.mp3 e reproduz esse. ''' try: # Converte o conteúdo de text em áudio. tts = gTTS(text=text, lang='pt-br') # Salva o coteúdo do áudio em ...
arturj9/chatgpt-python
utils.py
utils.py
py
976
python
pt
code
0
github-code
6
25693208335
# -*- coding:utf-8 -*- # 10.1 文件和异常 # 10.1 练习 # part_1 Python 学习笔记 # 读取整个文件 使用方法read() filename = 'Python学习.txt' with open(filename) as file_object: contents = file_object.read() print(contents.rstrip()) print("\n") # 打印时遍历文件 with open(filename) as file_object_1: contents_1 = file_object_1.readlines() ...
Troysps/learn_python
80/10.1从文件中读取数据.py
10.1从文件中读取数据.py
py
1,196
python
en
code
0
github-code
6
37256463861
import torch import torch.nn as nn from torch.utils import data from torch.optim import Adam, SGD from tensorboardX import SummaryWriter from tqdm import trange from datetime import datetime import argparse from dataset import LoadADHD200 from model import SpatialActivation def train(lr=0.001, device='cuda', epochs=1...
WhatAboutMyStar/SCAAE
train.py
train.py
py
3,360
python
en
code
4
github-code
6
41554384385
import sys import nimfa import numpy as np import scipy.sparse as sp import pandas as pd import gc import os import math import mysql.connector import random import collections from scipy.sparse.linalg import svds from sklearn.model_selection import KFold from multiprocessing import Pool # import module import machine...
Saito2982/CrossDomain
plot_domain.py
plot_domain.py
py
22,614
python
en
code
0
github-code
6
34344103076
from random import randint as rand import math def MenuSelection(array): while True: listPrint(array) print("\n>>") choice = input() try: choice = int(choice) if(type(array) == dict): choice = list(array.keys())[choice] else: choice = array[choice] except: print("Bad stuff") print...
LordMagusar/Python-RPG
main.py
main.py
py
3,831
python
en
code
0
github-code
6
1433290010
import pytest import stk from .case_data import CaseData @pytest.fixture( scope="session", params=( lambda name: CaseData( molecule=stk.BuildingBlock("C1=CC=CC=C1"), sub_group_data={ "c6_planarity": [2.7518147481201438e-06], "c5n1_planarity": []...
JelfsMaterialsGroup/stko
tests/molecular/subgroup/conftest.py
conftest.py
py
1,311
python
en
code
18
github-code
6
43344955993
''' This application service return tracks data to visualisation. ''' import time import math from collections import defaultdict from twisted.application.service import Service from twisted.internet import defer from twisted.python import log import simplejson as json __author__ = 'Boris Tsema' # Select track data...
DmitryLoki/gorynych
gorynych/processor/services/visualization.py
visualization.py
py
10,219
python
en
code
3
github-code
6
7897642460
import pygsheets def init(secret_path, sheet_name): # Получение нужной таблицы gc = pygsheets.authorize(client_secret=secret_path) sh = gc.open(sheet_name) wks = sh.sheet1 return wks def get_all_table_data(wks): # Получение всех данных с таблицы data_list = [] for row in wks.get_al...
FMaslina/gsheets
gsheets_integration.py
gsheets_integration.py
py
1,302
python
ru
code
0
github-code
6
7794747310
from flask import Flask, render_template, request import mushroom_data as md import random app = Flask(__name__) @app.route('/', methods=['POST', 'GET']) def main(): if request.method != 'POST': return render_template('index.html', cap_shape=md.cap_shape, ...
sharmas1ddharth/Mushroom_Classification
app.py
app.py
py
4,515
python
en
code
2
github-code
6
2052216012
from fastai import vision, metrics from fastai.callback import hooks from fastai.utils import mem import numpy as np from os import path import torch vision.defaults.device = vision.defaults.device if torch.cuda.is_available() else torch.device('cpu') # Download data and get path fastai_path = vision.untar_data(visio...
lykhahaha/Mine
Fastai_Tutorial/lesson3-camvid.py
lesson3-camvid.py
py
3,776
python
en
code
0
github-code
6
32576643958
from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login from django.views.generic import View from django.http import HttpResponse from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import log...
S4ADO/ADW_Django_A1
TaskManager/tasks/views.py
views.py
py
5,269
python
en
code
0
github-code
6
38254642090
from django.test import TestCase from hknweb.candidate.tests.models.utils import ModelFactory class DuePaymentRequirementModelTests(TestCase): def setUp(self): semester = ModelFactory.create_semester( semester="Spring", year=0, ) duepayment = ModelFactory.create_du...
Gabe-Mitnick/hknweb
hknweb/candidate/tests/models/requirements/payment/test_due_payment.py
test_due_payment.py
py
649
python
en
code
null
github-code
6
73814975546
from abc import ABCMeta, abstractmethod from asyncio.queues import Queue as AioQueue from queue import Queue from bonobo.constants import BEGIN, END from bonobo.errors import AbstractError, InactiveReadableError, InactiveWritableError from bonobo.nodes import noop BUFFER_SIZE = 8192 class Readable(metaclass=ABCMeta...
python-bonobo/bonobo
bonobo/structs/inputs.py
inputs.py
py
2,922
python
en
code
1,564
github-code
6
38760730621
import dictionary print(dictionary.d) text = "I drive a red car in the city with a friend to go to the cinema" translate = "" words = text.split() for w in words: translate = translate + dictionary.d[w] translate = translate + " " print(translate)
marnace/Homework9thMarch
Homework9thMarch.py
Homework9thMarch.py
py
262
python
en
code
0
github-code
6
20880620842
#@title Установка модуля УИИ from PIL import Image from pathlib import Path from tensorflow.keras.preprocessing import image from tensorflow.keras.layers import Input, Dense, Conv2D, Flatten from tensorflow.keras.models import Model from tensorflow.keras.optimizers import Adam from IPython import disp...
alexfeklin1234/neural_network
yandex_milk_data/yandex_milk.py
yandex_milk.py
py
26,223
python
uk
code
0
github-code
6
75188737786
import sys sys.setrecursionlimit(250000) # 이 문제는 이전에 학습한 스킬이 얼마나 많이 필요한지를 파악해야 하는 그래프 이론 문제 # T: 해당 인덱스의 스킬을 배우기 위해 우선적으로 배워야 하는 스킬 # A: 배워야 하는 스킬 모음 # 스킬 트리 T의 배열 A에서 모든 스킬을 습득하기 위해 배워야 하는 최소 스킬 수 반환 # 1 # 역순으로 배워야 하는 곳까지 DFS def solution(T, A): N = len(T) learned = [False] * N # 각 스킬을 배웠는지 여부 (방문 처리) ...
zacinthepark/Problem-Solving-Notes
programmers/스킬트리.py
스킬트리.py
py
1,378
python
ko
code
0
github-code
6
30265323373
import arcade SPACING = 20 MARGIN = 110 arcade.open_window(400, 400, "Square of diamonds") arcade.set_background_color(arcade.color.AMARANTH_PINK) arcade.start_render() for row in range(10): for column in range(10): if (row%2==0 and column%2==0) or (row%2==1 and column%2==1): x = column * S...
maryamsaeedi17/PyLearningWorks1
assignment13/drawsquare.py
drawsquare.py
py
723
python
en
code
6
github-code
6
39593057083
import sys infile = sys.argv[1] date = sys.argv[2] time = sys.argv[3] ping = "null" server = "null" download = "null" upload = "null" with open(infile, 'r') as f: for line in f: if "Hosted by " in line: server = line.replace("Hosted by ","") server = server.split...
rajdor/speedtest
speedtest_parser.py
speedtest_parser.py
py
1,437
python
en
code
0
github-code
6
10377701341
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 24 12:15:41 2018 @author: yannis """ #Write a program to calculate the credit card balance after one year if a person only pays #the minimum monthly payment required by the credit card company each month. #The following variables contain values a...
2057536a/Programming_Python_MIT_EdX
week2/problemSet2/problem1.py
problem1.py
py
1,790
python
en
code
0
github-code
6
8019970208
import json from server.nordic import COMMANDS import static.app.instructions.translations as tr # from static.app.instructions.translations import _yes from static.app.instructions.helpers import TXT, NumberedText class NextPrevious: def __init__(self, button_text, goto, active): self.caption = button...
sander76/nordic
static/app/instructions/components.py
components.py
py
8,161
python
en
code
0
github-code
6
618459417
from typing import List import numpy as np from hakaton.prediction.model import SkyhacksModel from hakaton.util import model_util class WagonDetectorSkyhacksModel(SkyhacksModel): MODEL_STRUCTURE_FILE = "storedmodel/model-next-wagon-structure.json" MODEL_WEIGHTS_FILE = "storedmodel/model-next-wagon-weights.h...
karynabierz/hakaton
hakaton/prediction/wagondetector_skyhacks_model.py
wagondetector_skyhacks_model.py
py
1,623
python
en
code
0
github-code
6
26498728774
import sys from typing import Set, TextIO, Any, Tuple from collections import * from functools import * from itertools import * Data = Tuple[Set[Tuple[int, int]], Set[Tuple[int, int]], int, int] Result = int def parse_input(buffer: TextIO) -> Data: east = set() south = set() lines = [line.strip() for lin...
arjandepooter/advent-of-code-2021
python/25/solution.py
solution.py
py
1,697
python
en
code
0
github-code
6
10251263267
import collections import random import sys from os import path as osp import json import pandas as pd from fol import beta_query_v2 from fol.foq_v2 import parse_formula from utils.util import read_indexing, load_graph, load_data_with_indexing sys.path.append(osp.dirname(osp.dirname(__file__))) stanford_data_path = 'da...
HKUST-KnowComp/EFO-1-QA-benchmark
fol/test_foq_v2.py
test_foq_v2.py
py
6,319
python
en
code
17
github-code
6
13109904746
import pandas as pd import yfinance as yf import json #csv_list = pd.read_csv('japan_all_stock.csv') success_list = [] for num in range(1301, 10000): try: stock_data = yf.download(f'{num}.T', period = '1d', interval='1d') success_list.append(f'{num}.T') except: continue with open('jap...
39xdgy/Playground_py
japan_stock_data.py
japan_stock_data.py
py
404
python
en
code
0
github-code
6
45308723306
import csv import tqdm import zoomeye.sdk as zoomeye import json import os # 第一步读取文件 # 获得IP地址 # 使用SDK查询信息 # 保存信息 # 过滤信息 INPUT_FILE_NAME = '../csv/firewall_ip.csv' # OUTPUT_FILE_NAME = 'csv/result.csv' def read_csv(ip_list, csv_name): with open(csv_name) as f: f_csv = csv.reader(f) # 获取header ...
Judgegao/bitcoin_data
code/Cyberspace search engine/main.py
main.py
py
2,283
python
en
code
0
github-code
6
36781902171
#!/usr/bin/env python3 # -*- coding:utf-8 -*- __author__ = 'ktulhy' # TODO: убрать дублирование кода ERROR = "\x1b[31m[---ERROR--] \x1b[0m" SYSTEM = "\x1b[34m[--SYSTEM--] \x1b[0m" INFO = "[---INFO---] " WARNING = "\x1b[33m[--WARNING-] \x1b[0m" test_types = [] from lxml import etree de...
AzaubaevViktor/c_tested
lib_tested.py
lib_tested.py
py
6,966
python
en
code
1
github-code
6
42807499367
""""""""""""""""""""""""""""""""""""""" Lab 5 - Find Similarity 04/1/2019 - Ken M. Amamori CS2302 MW 10:30 - 11:50 Professor: Olac Fuentes TA: Anindita Nath, Maliheh Zargaran """"""""""""""""""""""""""""""""""""""" import numpy as np import time import math """""""""""" class HashTableC(object): # Builds a...
kmamamori/CS2302
lab5.py
lab5.py
py
5,992
python
en
code
0
github-code
6
71522207867
from django.db import models class Home(models.Model): title = models.CharField(max_length = 100) body = models.TextField() decriptions = models.TextField(blank=True) author = models.CharField(max_length = 200,blank=True) img = models.ImageField(upload_to='posts',blank=True) created = models.D...
linux-coffee/web
home/models.py
models.py
py
1,075
python
en
code
0
github-code
6
12894651014
#!/usr/bin/env python # coding: utf-8 # # # Task 1- Prediction using Supervised ML # # ### Task: Predict the percentage of a student based on the no. of study hours. # ## The Sparks Foundation(GRIP), July 2021 # #### By: Rishi Raj Dhar # In[11]: #importing the required libraries import pandas as pd import num...
Rishirajdhar/griptask1
GRIP_TASK_1_Student_Scores.py
GRIP_TASK_1_Student_Scores.py
py
4,112
python
en
code
0
github-code
6