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
18801922589
from flask import request, json, Response, Blueprint, g, jsonify, make_response from ..models.UserModel import UserModel, UserSchema from ..shared.Authentication import Auth from marshmallow import ValidationError user_api = Blueprint('users', __name__) user_schema = UserSchema() @user_api.after_request # blueprint c...
AnthonyClausing/movie-night-api
src/views/UserView.py
UserView.py
py
3,721
python
en
code
0
github-code
36
29567698176
import requests KIND_SELL = "f3b277728b3fee749481eb3e0b3b48980dbbab78658fc419025cb16eee346775" BALANCE_ERC20 = "5a28e9363bb942b639270062aa6bb295f434bcdfc42c97267bf003f272060dc9" def api_get_sell_fee(sell_token, buy_token, sell_amount, network="mainnet"): fee_url = f"https://api.cow.fi/{network}/api/v1/feeAndQuot...
lidofinance/lido-otc-seller
utils/cow.py
cow.py
py
3,245
python
en
code
1
github-code
36
30129375464
import cv2 face_cascade=cv2.CascadeClassifier(r"C:\Users\KIIT\AppData\Roaming\Python\Python310\site-packages\cv2\data\haarcascade_frontalface_default.xml") cap=cv2.VideoCapture(0) while 1: ret,img=cap.read() color=cv2.cvtColor(img,cv2.COLOR_BGR2RGBA) faces=face_cascade.detectMultiScale(color,1.3,5) fo...
rimo10/object-detection
face.py
face.py
py
520
python
en
code
0
github-code
36
10873690970
#!/usr/bin/env python import ctags import sys import traceback def main(tags_file, search_expression): # read tags file tags = ctags.CTags(tags_file) status = tags.setSortType(ctags.TAG_SORTED) # search entry = ctags.TagEntry() found = tags.find(entry, search_expression, ctags.TAG_PARTIALMATC...
llynch/vim-config
autoload/ctrlp/search-tags.py
search-tags.py
py
1,281
python
en
code
1
github-code
36
7755827639
import asyncio import io import logging from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, Union from urllib.parse import urlsplit import aiohttp import mercantile from funclib.models import RenderOptions from funclib.raster impor...
microsoft/planetary-computer-apis
pcfuncs/funclib/tiles.py
tiles.py
py
7,469
python
en
code
88
github-code
36
28520992117
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.variables.variable import Variable from urbansim.functions import attribute_label from variable_functions import my_attribute_label f...
psrc/urbansim
urbansim/gridcell/number_of_jobs.py
number_of_jobs.py
py
1,881
python
en
code
4
github-code
36
16155659298
import json import logging import os import re from pathlib import Path from cdi_forms.forms import BackgroundForm, BackpageBackgroundForm from cdi_forms.models import BackgroundInfo, Instrument_Forms, Zipcode from django.conf import settings from django.http import Http404 from django.utils import translation from re...
langcog/web-cdi
webcdi/cdi_forms/views/utils.py
utils.py
py
13,035
python
en
code
7
github-code
36
70954832424
#!/usr/bin/env python # -*- coding: utf-8 -*- """Contains an interpreter class that takes raw grayscale data from the picarx grayscale module and maps it to a direction value between -1 and 1. The direction value is determined with a psuedo PD controller.""" import picarx_improved import logging import time import nu...
EverardoG/RobotSystems
lib/line_following_interpreter.py
line_following_interpreter.py
py
6,327
python
en
code
0
github-code
36
43622302488
from WebScrapping import WebScrapper from AppSettings import AppSettings from DataAnalyzer import DataAnalyzer from Utils import Utils from MongoDbContext import DBContext import _thread import matplotlib.pyplot as plot def execute_program(product1: str, product2: str, sample_size: int): # 0 clear db DBContex...
kgalaszewski/Python_Big_Data_webscrapping_mongodb_visualizing
Big_Data_Project_UG/app.py
app.py
py
1,837
python
en
code
0
github-code
36
25371860228
from plugins.search_engine_scraping_plugin import SearchEngineScrapingPlugin import requests import re from bs4 import BeautifulSoup class DuckDuckGoPlugin(SearchEngineScrapingPlugin): """ This plugin implements a screen scraping for Duck Duck Go search engine""" _url = None def get_results(self, query)...
willsimoes/projeto-final
plugins/duck_duck_go_plugin.py
duck_duck_go_plugin.py
py
1,675
python
en
code
0
github-code
36
33109766349
import ctypes import re import os import sys from codegen import clear def extract(): extracts = 0 clear() ctypes.windll.kernel32.SetConsoleTitleW("Loveless.codes | Google Mini Extractor") if not os.path.exists("extracting.txt"): open("extracting.txt", mode='x').close() input(...
pepsi/LovelessGen
modules/extractor.py
extractor.py
py
975
python
en
code
0
github-code
36
18069578323
codon = { 'UUU': 'Phe', 'UUC': 'Phe', 'uua': 'Leu', 'UUG': 'Leu', 'CUU': 'Leu', 'CUC': 'Leu', 'CUA': 'Leu', 'CUG': 'Leu', 'AUU': 'Ile', 'AUC': 'Ile', 'AUA': 'Ile', 'AUG': 'Met', 'GUU': 'Val', 'GUC': 'Val', 'GUA': 'Val', 'GUG': 'Val', 'UCU': 'Ser', ...
omniakhaled123/Genetics_mutation
main.py
main.py
py
3,277
python
en
code
0
github-code
36
27520193757
from nltk.util import ngrams import nltk f1=open('wsw.txt', 'r') f2=open('posonly.txt', 'w') f3=open('negonly.txt', 'w') for line in f1: if line.split(None, 1)[0] == '+': s=line.split(' ',1)[1] f2.write(s) f1.close() f1=open('wsw.txt', 'r') for line in f1: if line.split(None, 1)[0] == '-': s=line.split(...
koder951/NLP_Project
6/bigram.py
bigram.py
py
1,026
python
en
code
0
github-code
36
955722902
pkgname = "python-pyasn1_modules" pkgver = "0.3.0" pkgrel = 0 build_style = "python_module" hostmakedepends = ["python-setuptools"] depends = ["python-pyasn1"] checkdepends = ["python-pyasn1"] pkgdesc = "Python ASN.1 protocol modules" maintainer = "q66 <q66@chimera-linux.org>" license = "BSD-2-Clause" url = "https://py...
chimera-linux/cports
main/python-pyasn1_modules/template.py
template.py
py
580
python
en
code
119
github-code
36
44431954825
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Try Vasicek Model """ from __future__ import print_function, division import seaborn as sns from diffusions import Vasicek, VasicekParam from diffusions.helper_functions import (plot_trajectories, plot_final_distr, plot_realiz...
khrapovs/diffusions
examples/try_vasicek.py
try_vasicek.py
py
1,849
python
en
code
1
github-code
36
2871941645
## Conditional statements num=3 if num > 0: print(num,' is positive') num=-1 if num > 0 : print(num,' is positive') ## Program checks if the numbers is positive or negative # and displays an appropreate message num=5 if num >= 0 : print(num,' is positive') else: print(num,' is neg...
amolmahajan8055/Python-Flies-
L7_Conditional statements.py
L7_Conditional statements.py
py
3,145
python
en
code
0
github-code
36
7165456030
def count_primes(number: int) -> int: if number < 2: return 0 primes = [True] * number primes[0] = primes[1] = False for i in range(2, int(number ** 0.5) + 1): if primes[i]: for j in range(i*i, number, i): primes[j] = False return sum(primes) print(co...
SafonovVladimir/mornings
03 march/07/1.py
1.py
py
484
python
en
code
0
github-code
36
36384158019
""" Author: Kevin Owens Date: 11 May 2014 Class: ArgParser Problem description summary (from TopCoder Tournament Inv 2001 Semi C+D 500): Implement a class ArgParser with a method parse(string) that splits a single string of arguments into a list of string arguments; e.g., '{a, b, c}' -> ['a', 'b', 'c']. The input st...
knaught/TopCoder
ArgParser.py
ArgParser.py
py
1,726
python
en
code
0
github-code
36
30292556243
from mesa import Agent from src.agents import Environment, Food from src.utils import calculate_distance, get_item, random_move FORAGING = 'PROCURANDO' HOMING = 'VOLTANDO' class ForagingAnt(Agent): def __init__(self, current_id, model, pos, color): super().__init__(current_id, model) self....
UnBParadigmas2022-1/2022.1_G3_SMA_Formigueiro
src/agents/foragingAgent.py
foragingAgent.py
py
5,369
python
pt
code
6
github-code
36
22517487941
from datetime import timedelta from django.utils import timezone from django.contrib.auth.models import User import pytest from typing import List from .. import models EVENT_NAME = "football with friends" MAX_PART = 20 IS_PRIVATE = False DATETIME = timezone.now() + timedelta(days=2) POLL_END_TIME = timezone.now() PO...
redhat-beyond/FitMeet
event/tests/conftest.py
conftest.py
py
6,663
python
en
code
0
github-code
36
42544034746
#!/usr/bin/env python3 import argparse import csv import os import pickle import shutil import time from concurrent import futures import grpc from pysrbup.backup_system_pb2 import (Block, DeleteBackupResponse, GetBackupResponse, GetBlocksResponse, ...
dorchul/pysrbup
pysrbup/server.py
server.py
py
5,900
python
en
code
0
github-code
36
26910125965
#!/usr/bin/python3 import sys import re import string import xml.etree.ElementTree as ET import getopt import math import codecs import time import png # global variables inputFile = "" outputFile = "" parseAll = True timeFrom = "" timeTo = "" objectNames = "" eventTypes = "" actionNames = "" objectClasses = "" pathS...
SindenDev/3dimviewer
applications/3DimViewer/tools/activity_logging/logProcessing.py
logProcessing.py
py
11,807
python
en
code
9
github-code
36
13247548723
#1. Cree una lista idéntica a partir de la primera # lista utilizando la comprensión de listas. lst1=[1,2,3,4,5] #Escriba su respuesta aquí. lst2=[n for n in lst1] print(lst2) #2. Crear una lista a partir de los elementos de un # rango de 1200 a 2000 con pasos de 130, utilizando # la comprensión de listas. rng ...
amaiasanchis/EOI-IntroProgramacionPython
listcomprehensionejerc.py
listcomprehensionejerc.py
py
2,505
python
es
code
0
github-code
36
13097952438
# !/usr/bin/env python # -*- coding: utf-8 -*- """ @author: lishuang @description: 绘制 sigmoid 函数 """ import numpy as np import matplotlib.pyplot as plt def sigmoid(x): """ sigmoid 函数 :param x: :return: """ y = 1 / (1 + np.exp(-x)) return y def derivative_sigmoid(x): """ sigmoi...
TatenLee/machine-learning
bi/core/l7/activation_function/sigmoid.py
sigmoid.py
py
733
python
en
code
1
github-code
36
40357282801
#!/usr/bin/python3 import socket import subprocess def client_program(): host = socket.gethostname() # as both code is running on same pc port = 5000 # socket server port number client_socket = socket.socket() # instantiate client_socket.connect((host, port)) # connect to the server messag...
Sachin880699/Ethical-Hacking-Course
5 ) python for hacking/server_client/client.py.py
client.py.py
py
735
python
en
code
0
github-code
36
35447618383
import pandas as pd import numpy as np import re from openpyxl import * import copy import ast # Common Units for Volume unwanted = {'FLXBN', 'ALSCN', 'FXBPN', 'PLBTN', 'GLBTN', 'ALCNN', 'ALSCN'} # Path to Excel FILEPATH = '/Users/jiehan/Desktop/HiMart/Data Cleaning Code/Masterlist160520 - Joel.xlsx' SHEET = 'vegetab...
joeljhanster/productnamecleaning
fixnaming.py
fixnaming.py
py
10,159
python
en
code
0
github-code
36
27888263770
from django.db import models from django.core.exceptions import ValidationError def validate_thumbnail_size(field_file_obj): file_size = field_file_obj.file.size kilobyte_limit = 256 if file_size >= kilobyte_limit * 1024: raise ValidationError(f"This image is {file_size / 1024}kb. Please make sure it i...
theorangeyakco/sarpanch
content/utils.py
utils.py
py
700
python
en
code
2
github-code
36
5314308477
import plotly.express as px import pandas as pd import numpy as np import plotly.graph_objs as go from numpy.core.fromnumeric import shape def bar_chart(df): df2 = df[(df['homelessness'] == 'Overall Homeless') & (df['state'] == 'Total')] barchart = px.bar(df2, x = 'year' , y = 'number' , title = 'Year wise count of...
MSidda/Plotly-Dashboard
utilities/vis.py
vis.py
py
13,487
python
en
code
0
github-code
36
7659517632
# # Test of keyword Extraction based on Graph-of-Words # # Test examples come from the following paper: # A Graph Degeneracy-based Approach to Keyword Extraction. Tixier, Antoine, Malliaros, Fragkiskos, and # Vazirgiannis, Michalis. Proceedings of the 2016 Conference on Empirical Methods in Natural Language # Processin...
GuillaumeDD/gowpy
tests/test_keyword_extraction.py
test_keyword_extraction.py
py
4,387
python
en
code
11
github-code
36
74486753063
def DecimalToBinary(num): if num > 1: DecimalToBinary(num // 2) print(num % 2,end='') #since a print() statement ends in new line by default so by using end = '' #we are giving the command to print in same line in continuation # decimal number number = int(input("Enter any positive number: ")...
Charut24/Programming-Paradigms-
Lab Assignment 3_2.py
Lab Assignment 3_2.py
py
354
python
en
code
0
github-code
36
7813076216
from datetime import datetime from typing import Dict, List import pytest import sqlalchemy as sa from httpx import AsyncClient from sqlalchemy.ext.asyncio import AsyncSession from aspen.api.views.tests.data.auth0_mock_responses import DEFAULT_AUTH0_USER from aspen.auth.auth0_management import Auth0Client from aspen....
chanzuckerberg/czgenepi
src/backend/aspen/api/views/tests/test_users.py
test_users.py
py
3,879
python
en
code
11
github-code
36
1500291881
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from openapi_server.models.base_model_ import Model from openapi_server import util class BundleDataProp(Model): """NOTE: This class is auto generated by OpenAPI ...
shinesolutions/swagger-aem
clients/python-flask/generated/openapi_server/models/bundle_data_prop.py
bundle_data_prop.py
py
2,253
python
en
code
35
github-code
36
2022880805
import logging as log import math import torch import torch.nn as nn from pytorch_lightning.core.lightning import LightningModule import nltocode.decoder as custom_decoder import nltocode.encoder as custom_encoder class Transformer(LightningModule): def __init__(self, d_model, ...
SmartDataAnalytics/codeCAI
nl2codemodel/src/nltocode/transformerinf.py
transformerinf.py
py
11,778
python
en
code
4
github-code
36
70010914665
import urllib.request import ssl import json ssl._create_default_https_context = ssl._create_unverified_context def search(keyword): client_id = "BoqP7ttLY0wDhxvLzawS" client_secret = "ztLCPvpLyO" encText = urllib.parse.quote(keyword) url = "https://openapi.naver.com/v1/search/blog?query=" + encTex...
Kyeongrok/python_yla
com/week7/am/naver_openapi8.py
naver_openapi8.py
py
862
python
en
code
1
github-code
36
31527895703
import sys sys.stdin = open('6.txt', 'r') def btk(n, s): global result if s >= result: return if n >= 12: result = min(result, s) return # 일 이용권 btk(n+1, s+(plan[n]*d1)) if plan[n]: # 월 이용권 btk(n+1, s+m1) # 3개월 이용권 btk(n+3, s+m3) Test_c...
Ikthegreat/TIL
Algorithm/0331/Backtrack/6.py
6.py
py
543
python
ko
code
0
github-code
36
25285589404
''' Find out the relationship between Liquor Sales and Vehicle Accidents ''' import sys import math import uuid from schema import liquor_schema from matplotlib import pyplot as plt import pandas as pd from pyspark.sql import SparkSession, types from pyspark.sql import functions as F assert sys.version_info >= (3, 5)...
libou/Liquor-Sale-Analysis
liquor_vehicle.py
liquor_vehicle.py
py
3,441
python
en
code
0
github-code
36
2496560289
#!/usr/bin/env python """ photomongo - read and process all tweets possible Usage: photomongo [options] CONFIGFILE Options: -h --help Show this screen. --pickle-to=<picklefile> file to save tweets. --pickle-from=<picklefile> file to read tweets. --max=<number> maximum num...
anielsen001/photomongo
photomongo.py
photomongo.py
py
6,387
python
en
code
1
github-code
36
4617186912
# File: ExpressionTree.py # Description: demonstrates knowledge on binary trees # Student's Name: Jerry Che # Student's UT EID: jc78222 # Partner's Name: # Partner's UT EID: # Course Name: CS 313E # Unique Number: 86235 # Date Created: 08/02/18 # Date Last Modified: 08/06/18 o...
jerry-che/Data_Structures_with_Python
ExpressionTree.py
ExpressionTree.py
py
3,558
python
en
code
0
github-code
36
28691721043
from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication, QThreadPool from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtWidgets import QAction # Initialize Qt resources from file resources.py from .resources import * # Import the code for the dialog #from .ui.upload import UploadDialog from .module.works...
sandynagara/Palapa
Palapa.py
Palapa.py
py
5,460
python
en
code
5
github-code
36
43751035063
from __future__ import unicode_literals import os from collections import OrderedDict, namedtuple from operator import itemgetter from pathlib import Path import six if six.PY2: from collections import MutableSequence, Sized elif six.PY3: from collections.abc import MutableSequence, Sized class Table(Mutab...
turicas/rows
rows/table.py
table.py
py
9,338
python
en
code
851
github-code
36
3723310513
import random class Solution: def __init__(self, N, blacklist): blacklist = set(blacklist) self.length = N - len(blacklist) self.remap = {} remap_list = [] for num in blacklist: if num < self.length: remap_list.append(num) j = 0 ...
sokazaki/leetcode_solutions
problems/0710_random_pick_with_blacklist.py
0710_random_pick_with_blacklist.py
py
718
python
en
code
1
github-code
36
18011299310
activ# wrapping into a class. from isolation import Board from plotter import plotgrid class movestore(): ''' Reverse Moves : ''' def __init__(self, moveloc, level=6): self.depthcheck = level self.vectorlist = self.seeker(moveloc) def dist(self, x, y): ''' returns...
learningwithmachines/knights-isolation-tree-search
extras/territory_eval.py
territory_eval.py
py
3,995
python
en
code
0
github-code
36
15576814335
from collections import deque T = int(input()) for _ in range(T): N, M = map(int, input().split()) queue = deque(map(int, input().split())) queue = deque([(i, idx) for idx, i in enumerate(queue)]) count = 0 while True: if queue[0][0] == max(queue, key=lambda x: x[0])[0]: ...
HelloWook/AlgorithmStudy
백준/Silver/1966. 프린터 큐/프린터 큐.py
프린터 큐.py
py
532
python
en
code
0
github-code
36
5063097451
from intervaltree import Interval as interval, IntervalTree class OutputExporter(object): def __init__( self, mz_prec ): self.mz_prec = mz_prec self.BG = None def iBG(self, node_type): '''Iterate over all nodes of a given type in the whole big graph **BG** of solved subproblems. ...
MatteoLacki/MassTodonPy
MassTodonPy/Outputting/export_outputs.py
export_outputs.py
py
3,880
python
en
code
1
github-code
36
6765175956
def soma(n): d = 1 h = 0 while d <= n: x = 1 / d h += x d += 1 return h def main(): num = int(input()) resultado = soma(num) print(resultado) if __name__ == "__main__": main()
Larissapy/aula-remota-7
t2_q3.py
t2_q3.py
py
236
python
pt
code
0
github-code
36
14644417459
from fastapi import FastAPI, Response from starlette.middleware.cors import CORSMiddleware from routes import jobs from logger.log_info import logger app = FastAPI() @app.middleware('http') async def log_request(request, call_next): logger.info(f'{request.method} {request.url}') response = await call_next(r...
Baktybek0312/Log_BloG
main.py
main.py
py
831
python
en
code
0
github-code
36
5897947024
def turnOver(number): ''' Returns a list of all digits of this number in reverse order :return: list of digits NOTE: output 0 if the number is not a natural number ''' if number < 1 or type(number) is not int: return 0 digits = [] remainder = number while remainder > 0: ...
Shvoeva/Exercise9
1.ListFromAmong/main.py
main.py
py
555
python
en
code
0
github-code
36
3585569128
import pandas as pd import numpy as np import matplotlib.pyplot as plt master_list = list() with open("../Data_sets/corpus_2_unigram_sorted.txt") as fileobj: for line in fileobj: if line == "" or line == " " or line == "\n": continue l = line.strip(' ') l = l.strip('\n') ...
tarun0409/nlp-assignment-3-4
zipfs.py
zipfs.py
py
705
python
en
code
0
github-code
36
71050589225
import streamlit as st from langchain.llms import OpenAI from langchain.prompts import PromptTemplate st.title("💬 Prompt Critic") openai_api_key = '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' def prompt_critic(prompts): # Instantiate LLM model llm = OpenAI(model_name="gpt-4", openai_api_key=open...
shihwesley/CMPE297
Prompt Engineering assignment/pages/1_Prompt Critic.py
1_Prompt Critic.py
py
990
python
en
code
0
github-code
36
16127616120
import os import json from keras.models import load_model import pandas as pd import pickle import numpy as np import shutil from keras.preprocessing import image from tqdm.notebook import tqdm from PIL import ImageFile BASE_MODEL_PATH = os.path.join(os.getcwd(),"model") ...
Abhinav1004/Distracted-Driver-Detection
demo_on_video/driver_prediction.py
driver_prediction.py
py
2,607
python
en
code
37
github-code
36
2847508443
# Qus:https://leetcode.com/problems/combination-sum/ def solve(candidates,target,result,start=0,out=[]): #if target becomes less then 0 means we can't add more number /can't add new number to creat a new #combination if(target<0): return #if target==0 means this is a valid combination ...
mohitsinghnegi1/CodingQuestions
leetcoding qus/Combination_sum.py
Combination_sum.py
py
1,290
python
en
code
2
github-code
36
25376871762
from sklearn.model_selection import cross_val_score from sklearn.model_selection import cross_val_predict from sklearn.metrics import classification_report import numpy as np def get_cv_metrics(text_clf, train_data, train_class, k_split): accuracy_scores = cross_val_score(text_clf, # steps to convert raw messages...
abelsaug/EmpathyPrediction
CV_metrics.py
CV_metrics.py
py
1,078
python
en
code
0
github-code
36
14719000244
from multiprocessing.sharedctypes import Value from xmlrpc.client import Boolean from source.dataloaders.data_loaders_factory import DataLoaderFactory import torch import torchaudio import os import numpy as np import csv from source.dataloaders.project_2_dataset import Project_2_Dataset from source.utils.config_manage...
Shaveek23/cifar10-computer_vision
source/dataloaders/onevsall_dataloadersfactory.py
onevsall_dataloadersfactory.py
py
4,491
python
en
code
0
github-code
36
30490693575
# encoding: utf-8 from paddlelite.lite import * import cv2 as cv import numpy as np from matplotlib import pyplot as plt from time import time from PIL import Image from PIL import ImageFont from PIL import ImageDraw from PIL import ImageEnhance class PPYOLO_Detector(object): def __init__(self, nb_path=None, #...
Feng1909/PPYOLO-Tiny
Tiny.py
Tiny.py
py
10,384
python
en
code
2
github-code
36
29986560679
#!/usr/bin/env python import glob import os def main(): paths = glob.glob("./data/mags/*.fa") all_mags = "" for p in paths: filename = os.path.basename(p) header = ">" + os.path.splitext(filename)[0] print(filename, header) with open(p, "r") as f: sequence = "...
LuiggiTenorioK/minhash-benchmark
src/concat_mags.py
concat_mags.py
py
715
python
en
code
0
github-code
36
14267295600
from typing import Any from data_structures.stacks.stack import Stack, PopEmpty class StackWithBottom(Stack): def __init__(self): self._bottom = None super(StackWithBottom, self).__init__() def push(self, value: Any): super(StackWithBottom, self).push(value) if not self._bot...
goncalossantos/CtCI
chapter_3/stack_of_stacks.py
stack_of_stacks.py
py
2,062
python
en
code
0
github-code
36
20456498612
import discum import json import os.path import random import time from rich import print def load_from_data_else_ask(field, message): global data if data is not None and field in data.keys(): return data[field] return input(message) data = None if os.path.exists("data.json"): ...
Apophis52/Python-Mass-DM-Selfbot
index.py
index.py
py
2,499
python
en
code
21
github-code
36
7435604725
with open("prog.txt", "r") as file: lines = file.readlines() file.close def Syntaxe(): return print("SYNTAXE INVALIDE") def variable(name, value): mavar = value return mavar #print("variable " + name + " = " + value) def direPrint(value): return print(value) d...
Program132/Python
BeyProg/main.py
main.py
py
956
python
en
code
1
github-code
36
24997436439
"""empty message Revision ID: 60ec815b1cea Revises: e20eb33302a2 Create Date: 2023-01-28 01:32:26.058698 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '60ec815b1cea' down_revision = 'e20eb33302a2' branch_labels = None depends_on = None def upgrade(): # ...
gaelzarco/aihub
flask/migrations/versions/60ec815b1cea_.py
60ec815b1cea_.py
py
1,371
python
en
code
1
github-code
36
10837308716
#!/bin/python3 # https://www.hackerrank.com/challenges/30-scope/problem?isFullScreen=true class Difference: def __init__(self, a): self.__elements = a def computeDifference(self): _ = list(map(int, self.__elements)) self.maximumDifference = abs(max(_) - min(_)) # End of Difference ...
sidorkinandrew/python-coding
hackerrank/30-days-of-code/day-14-scope.py
day-14-scope.py
py
449
python
en
code
0
github-code
36
5862498200
#!/usr/bin/env python3 """ DropOut Regularization """ import tensorflow as tf def dropout_create_layer(prev, n, activation, keep_prob): """ Creates a tensorflow layer that includes dropout regularization. """ dropout = tf.layers.Dropout(keep_prob) init = tf.contrib.layers.variance_scaling_initial...
ZakariaALLA/mundiapolis-ml
0x05-regularization/6-dropout_create_layer.py
6-dropout_create_layer.py
py
561
python
en
code
0
github-code
36
70295411304
import torch.utils.data from torch.utils.data import DataLoader from torchvision import datasets import torchvision.transforms as T def load_cifar10(): train_data = datasets.CIFAR10( root='../data', train=True, download=True, transform=T.Compose([ T.ToTensor(), ...
simogiovannini/DLA-lab1
utils/data_loader.py
data_loader.py
py
1,311
python
en
code
0
github-code
36
31641438007
import requests from bs4 import BeautifulSoup import category site_url = 'https://books.toscrape.com/index.html' # global var def save_all_categories(site_url): """ Save all data of the books of the entire category (it handles pagination) and for each site's category """ global links # reut...
o0nekov0o/OpenClassrooms_P2
main.py
main.py
py
1,351
python
en
code
1
github-code
36
40517176305
import sys # Printing with topological location def topo_loc(line,lineno,colno,msg=False): buff = "" buff += "{}| {}\n".format(lineno,line) pad = len(str(lineno))+colno+2 buff += "^\n".rjust(pad) if msg: buff += msg + "\n" buff += "colno {}, lineno {}\n".format(colno,lineno) return ...
archanpatkar/Bhaskara
src/core/error.py
error.py
py
460
python
it
code
1
github-code
36
75310096425
import random import re import socket import uuid from scapy.all import IP, TCP, wrpcap, Raw, Ether from sys import version_info if version_info.major == 2: from BaseHTTPServer import BaseHTTPRequestHandler from StringIO import StringIO else: from http.server import BaseHTTPRequestHandler from io imp...
b40yd/security
http_text_to_pcap.py
http_text_to_pcap.py
py
3,848
python
en
code
96
github-code
36
27053053809
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseList(self, head: ListNode) -> ListNode: prev = None while head: current = head head = head.next current.next = prev prev = current ...
ikedaosushi/leetcode
problems/python/reverseList.py
reverseList.py
py
1,172
python
en
code
1
github-code
36
5184467463
def reverseStringIterative(wod): # return word[::-1] word = list(wod) for i in range(len(word) // 2): temp = word[i] word[i] = word[len(word) - 1 - i] word[len(word) - 1 - i] = temp return "".join(word) def reverseRecursive(strr): size = len(strr) if size == 0: ...
fortyung/Data-Structures-Algorithms
Algorithms/Recursion/reverse.py
reverse.py
py
461
python
en
code
0
github-code
36
12567632552
import torch from torch.utils.data import DataLoader from torchvision import transforms, datasets from torch import nn, optim from ae import AE import visdom from vae import VAE from torchvision import models def main(): vis = visdom.Visdom() tf = transforms.Compose([ transforms.ToTensor(), # 转换成ten...
wy171205/DeepLearning
AutoEncoder/main.py
main.py
py
2,114
python
en
code
0
github-code
36
71899611623
# 2018.10.10 Parse the 9G file to get all of the Movie ID Text = b'product/productId' movieID = set() with open('movies.txt', 'rb') as file: for line in file: if Text == line[0:17]: movieID.add(line[19:29]) with open('movieID.txt', 'w') as f: for movie in movieID: f.write(str(mov...
haoranpb/DWAssignments
Assignment1/file_parser.py
file_parser.py
py
349
python
en
code
4
github-code
36
40264765469
flowers = input() count = int(input()) budget = int(input()) price = 0 if flowers == "Roses": price = 5 if count > 80: price = price * 0.9 elif flowers == "Dahlias": price = 3.8 if count > 90: price = price * 0.85 elif flowers == "Tulips": price = 2.8 if count > 80: pric...
ivoivanov0830006/1.1.Python_BASIC
3.Nested_conditional_statements/*03.New_house.py
*03.New_house.py
py
761
python
en
code
1
github-code
36
16128708255
__goal__ = "Note for 前端组件" """ span中可以通过添加class展示各种图标,当需要增加文本时,务必在图标和文本之间添加一个空格 <span class="glyphicon"> Star 就像这里一样,前面需要加空格 弹窗里面可以加图标 【下拉菜单】 下拉菜单触发器和下拉菜单都包裹早dropdown里面 按钮那一块使用class="dropdown",而具体的下拉内容我们应该使用class="dropdown-menu"属性 整个模块都可以扔到<div>里面去,整个下拉就是一个div模块 菜单的内容默认是左对齐的,通过<ul class="dropdown-menu dropdown-menu-...
czasg/ScrapyLearning
czaSpider/dump/bootstrap_test/组件_note.py
组件_note.py
py
4,680
python
zh
code
1
github-code
36
34338203362
from p111 import Solution from common.tree import buildTreeFromList test_cases = [ ([3,9,20,None,None,15,7], 2), ([2,None,3,None,4,None,5,None,6], 5), ([], 0), ] def test_minDepth(): s = Solution() for case in test_cases: assert s.minDepth(buildTreeFromList(case[0])) == case[1], case
0x0400/LeetCode
p111_test.py
p111_test.py
py
315
python
en
code
0
github-code
36
21477829683
# 사용횟수가 많으면 많을 수록 멀티탭에 그대로 둔다. # 플로그 빼는 횟수 # 빈도수 별 import sys n, k = map(int, sys.stdin.readline().split()) a = list(map(int, sys.stdin.readline().split())) cnt = 0 multi = [] for i in range(k): # 물품이 이미 꽂혀있으면 멀티탭이 비는지 확인할 필요가 없다. # but, 멀티탭이 비는지 확인해도 물품이 이미 포함되어있는지는 확인해야하기 때문에 따로 앞으로 빼는게 유리 if a[i] in ...
Minsoo-Shin/jungle
week04/1700_멀티탭스케쥴링.py
1700_멀티탭스케쥴링.py
py
1,337
python
ko
code
0
github-code
36
12171161356
# 하키 import sys w, h, x, y, p = map(int, sys.stdin.readline().split()) # p는 좌표 수 hockey = [] for i in range(p): # 하키 선수들의 좌표 이중List a, b = map(int, sys.stdin.readline().split()) hockey.append([a, b]) cnt = 0 r = int(h / 2) # 원의 반지름 for i in range(p): if x <= hockey[i][0] <= x+w and y <= hockey[i][1] <=...
hi-rev/TIL
Baekjoon/기하1/hockey.py
hockey.py
py
714
python
ko
code
0
github-code
36
4134355956
import pygame import sys import time from RobotLib.Math import * import math import argparse from RobotLib.FrontEnd import * from RobotLib.IO import * import numpy as np class MyFrontEnd(FrontEnd): """ Custom sub-class of FrontEnd You can write custom sub-routines here to respond to UI events and calculat...
jeffherbst/sparki
template.py
template.py
py
6,840
python
en
code
0
github-code
36
24843377512
' Script to for association analysis of clusters. Created by S Brueningk 2023 ' import pandas as pd import numpy as np from IPython.core.display import display, Markdown import os.path from pathlib import Path from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt import statsmodels.api as sm...
BorgwardtLab/LongCOVID
associationClusters.py
associationClusters.py
py
9,990
python
en
code
0
github-code
36
37974620586
from vpython import * import numpy as np def check_wall_collision(ball): if ball.pos.x > side - thick/2 - ball.radius: ball.vel.x *= -1 ball.color = color.green elif ball.pos.x < -side + thick/2 + ball.radius: ball.vel.x *= -1 ball.color = color.red elif ball.pos.y > side - ...
Fadikk367/WFiIS-VPython
LAB08/ZAD3.py
ZAD3.py
py
2,473
python
en
code
0
github-code
36
30981112855
#!/usr/bin/python # <bitbar.title>Stock Ticker</bitbar.title> # <bitbar.version>1.0</bitbar.version> # <bitbar.author>Robert Kanter</bitbar.author> # <bitbar.author.github>rkanter</bitbar.author.github> # <bitbar.desc>Provides a rotating stock ticker in your menu bar, with color and percentage changes</bitbar.desc> # <...
damncabbage/dotfiles
macOS/BitBar/Plugins/Finance/stock-ticker.30s.py
stock-ticker.30s.py
py
1,981
python
en
code
3
github-code
36
17849581957
from .config import np, Vector, Keyword, ParameterName, ZOrderConfig, TextConfig, HorizontalAlignment, \ VerticalAlignment, ColorConfig from .config import BentChevronArrow, ChevronArrow, CompositeFigure, Rectangle, TextBox, RoundRectangle from .config import MIDDiagram, NetworkDiagram, CulturedCell, Mice, Human, C...
LocasaleLab/Automated-MFA-2023
figures/figure_plotting/figure_elements/diagrams/diagrams/noisy_data_diagram.py
noisy_data_diagram.py
py
10,532
python
en
code
0
github-code
36
33718174339
# 기다리는 시간을 줄이려면, 작업 시간이 짧은 작업부터 하는 것이 이득 # 그렇지만, 먼저 들어온 것을 빠르게 처리하는 것도 중요 # 하드디스크가 작업을 수행하고 있지 않을 때에는 먼저 요청이 들어온 작업부터 처리! -> 처음에 들어온 작업은 무조건 시작된다는 뜻! # 힙에 값을 넣어주면, 자동으로 값이 작은 순서대로 정렬됨 # 테케 19번 안되는 문제 해결! from heapq import heappush, heappop def solution(jobs): times = 0 # 각 작업들의 요청~종료 시간의 합 now = 0 ...
ayocado/algorithm-study
bokkuembab/heap/PGS level3 42627 디스크 컨트롤러.py
PGS level3 42627 디스크 컨트롤러.py
py
1,938
python
ko
code
0
github-code
36
1938568135
import os import glob import pathlib from io import StringIO from typing import List, Dict, Optional from dataclasses import dataclass import kclvm.compiler.parser.parser as parser import kclvm.compiler.vfs as vfs import kclvm.compiler.extension.plugin.plugin_model as plugin import kclvm.compiler.extension.builtin.bui...
kcl-lang/kcl-py
kclvm/tools/list_attribute/utils.py
utils.py
py
9,943
python
en
code
8
github-code
36
14152007415
import requests import json import sys from .ui import print_success from requests.auth import HTTPBasicAuth def find_github_emails(organization,organization_domain,github_api,github_username,github_token): github_emails = [] print_success("[+] Searching GitHub") page_number = 1 while page_number < 2: orgquery ...
highmeh/lure
resources/github.py
github.py
py
1,007
python
en
code
148
github-code
36
43297240194
from pypy.interpreter.error import oefmt from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.typedef import TypeDef, GetSetProperty from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rtyper.tool import rffi_platform from rpyt...
mozillazg/pypy
pypy/module/_demo/demo.py
demo.py
py
2,385
python
en
code
430
github-code
36
41180522167
fib = [0 for x in range(111)] fib[1] = 1 fib[2] = 2 for i in range(3, 111): fib[i] = fib[i-1] + fib[i-2]; case = 1 while True: try: A = input() B = input() if case != 1: print("") case += 1 except: break la = len(A) lb = len(B) total = 0 for i in range(la): if A[i] == '1': total += fib[l...
tuananhcnt55vmu/Online-Judge
uva_763.py
uva_763.py
py
692
python
en
code
0
github-code
36
18573856316
import numpy as np import matplotlib.pyplot as plt N = 50 # Nb of steps dt = 0.01 kv = 0.1 tau = 0.05 lamb = 0 ns = 6 ############################### ## Complete the code below #### ############################### A = np.array([[1,0,dt,0,0,0],[0,1,0,dt,0,0],[0,0,1-kv*dt,0,dt,0],[0,0,0,1-kv*dt,0,dt],...
decomiteA/ReachRLToolbox
OFC_2D/OFC2D_Reaching.py
OFC2D_Reaching.py
py
3,838
python
en
code
0
github-code
36
20350466819
try: import json except ImportError: import simplejson as json import requests import pandas import datetime import time # Please enter the file's path of the URLs to be checked file_path = str(input('Please Enter The File Path: ')) input_CSV = pandas.read_csv(file_path) Urls = input_CSV['Domain']....
dorintu/VirusTotal
VirusTotal_Assignment.py
VirusTotal_Assignment.py
py
3,484
python
en
code
0
github-code
36
2725915163
from os import scandir, rename from os.path import splitext, exists from shutil import move from time import sleep import logging from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler src_path = "" #local path to folder source_dir = src_path + "Downloads" dest_dir_docs = src_path +...
zastasja/automate_stuff
moving_from_download.py
moving_from_download.py
py
2,787
python
en
code
0
github-code
36
19989138110
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import gallery.models class Migration(migrations.Migration): dependencies = [ ('gallery', '0004_exhibit'), ] operations = [ migrations.AlterField( model_name='exhibit', ...
andrewhead/Gallery-Paths
server/gallery/migrations/0005_auto_20141206_2124.py
0005_auto_20141206_2124.py
py
499
python
en
code
0
github-code
36
23563599190
# -*- coding: utf-8 -*- """ Created on Tue Jun 20 07:39:26 2017 @author: mnshr """ from statsmodels.stats.outliers_influence import variance_inflation_factor """ VIF = 1 (Not correlated) 1 < VIF < 5 (Moderately correlated) VIF > 5 to 10 (Highly correlated) VIF is one way to understand whether any two independent va...
mnshr/kgl
stats.py
stats.py
py
2,925
python
en
code
0
github-code
36
15668895730
import random import varibles import math now_state = { 'blist':[], 'weight':0, 'value':0 } # Now:「現在」的狀態 best_state = { 'blist':[], 'weight':0, 'value':0 } # (for SA) Best:「全域最佳」的狀態 #---------更新Now狀態--------- def UpdateNowState(blist, w, v): now_state['blist'] = blist now_state['weight'] = w now_state['v...
lanac0911/deepLearning
Knapsack/compoents.py
compoents.py
py
5,624
python
en
code
0
github-code
36
10489171606
# -*- coding: utf-8 -*- from flask import Blueprint, Response, g blueprint = Blueprint('property-tax-assessments-broken-model-scatterplots', __name__) @blueprint.app_template_filter('get_length') def get_length(thing): return len(thing) """ Tarbell project configuration """ # Google spreadsheet key SPREADSHEET...
ryanbmarx/cook-county-property-tax-broken-model
tarbell_config.py
tarbell_config.py
py
1,937
python
en
code
0
github-code
36
3954152863
from PIL import Image img = Image.open("PDI/folha.png").convert('L') adj = 8 # 4 para adj-8, 8 para adj-m visited = [[False for col in range(img.height)] for row in range(img.width)] dx = [0, 0, 1, -1, 1, 1, -1, -1] dy = [1, -1, 0, 0, 1, -1, 1, -1] def isEdge(x, y): for i in range(adj): if(img....
Pedroffda/Digital-Image-Processing
Pratica-01/code/adj_border.py
adj_border.py
py
1,417
python
en
code
0
github-code
36
18521700070
import pandas as pd import pickle import numpy as np from tqdm import tqdm import os, sys, inspect from collections import defaultdict from processing_utils import make_aggregate_df, make_yearly_df, make_class_df, make_df_by_decade, make_parent_df MIN_FREQ = 20 # folders for reading and writing data raw_data_folder = ...
benpry/gender-associations-child-language
code/bootstrap/bootstrap_aggregate_yearly.py
bootstrap_aggregate_yearly.py
py
3,396
python
en
code
0
github-code
36
74436148265
# osandvold # 5 Jul 2022 # Adapted script from checkData_UPENN.m script from Heiner (Philips) # for validating and reading log data from DMS of CT Benchtop import numpy as np import pandas as pd import glob import os.path import matplotlib.pyplot as plt from matplotlib.pyplot import figure from matplotlib.widgets impo...
chan-andrew/LACTI
check_data.py
check_data.py
py
14,721
python
en
code
0
github-code
36
39268497138
# coding:utf-8 ''' @Copyright:LintCode @Author: cong liu @Problem: http://www.lintcode.com/problem/add-two-numbers @Language: Python @Datetime: 16-12-16 23:40 ''' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Soluti...
JessCL/LintCode
167_add-two-numbers/add-two-numbers.py
add-two-numbers.py
py
1,325
python
en
code
0
github-code
36
25107350000
from OpenGL.GL import * from Masks import * from ObjectLoader import ObjectLoader from Model import Model from Shaders.ColoredObjectShader import ColoredObjectShader import pyrr class MazeCore: def __init__(self, shader : ColoredObjectShader): # self.transparentShader = TransparentShader() # ...
VolodymyrVakhniuk/Pacman
src/Core/MazeCore.py
MazeCore.py
py
1,878
python
en
code
1
github-code
36
41636547175
def twoSum(nums, target): # pivot = 0 # while pivot < len(nums): # for x in range(pivot + 1, len(nums)): # if nums[pivot] + nums[x] == target: # return [pivot, x] # pivot += 1 seen = {} for i, value in enumerate(nums): remaining = target - nums[i] ...
mrdaiking/leetcode_challenge
main.py
main.py
py
4,854
python
vi
code
0
github-code
36
2358896940
"""empty message Revision ID: bc7b1dd477a1 Revises: d7ad318a76d9 Create Date: 2021-08-24 19:22:40.497985 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'bc7b1dd477a1' down_revision = 'd7ad318a76d9' branch_labels = None depends_on = None def upgrade(): # ...
nickcao123456/blog
migrations/versions/bc7b1dd477a1_.py
bc7b1dd477a1_.py
py
788
python
en
code
0
github-code
36
14032964317
from django.http import JsonResponse, HttpResponse from .models import Template, Field import re from .utils import check_db def post(request): check_db() form = type_form(request.GET) name = "" for name_f, val in form.items(): res = Field.objects.filter(name_field=name_f, type_field=val).valu...
krlns/forms_template
test_task/app/views.py
views.py
py
924
python
en
code
0
github-code
36
20543243144
import jax import numpy as np from jax import lax from jax import numpy as jnp def gaussian(x, sigma): return 1 / (sigma * np.sqrt(2 * np.pi)) * np.exp(x**2 / (-2 * sigma**2)) def make_gaussian_kernel(n, sigma, dx=0.001): assert n % 2 == 1 # Make sure n is odd # Compute gaussian on a symmetric grid ...
cshallue/recon-cnn
recon/smoothing.py
smoothing.py
py
2,316
python
en
code
1
github-code
36