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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
39666743662 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 20:18:14 2017
@author: user
"""
import csv
import numpy as np
from gensim.models import word2vec
content_POS = list(np.load('all_content_POS.npy'))
"""取出n,a,d,v詞性的詞"""
sentiment_POS = []
sentiment_content = []
ADNV = [1,3,7,13]
for sentence in content... | Maomaomaoing/Sacasm-Detection | 2.word2vector_pre.py | 2.word2vector_pre.py | py | 2,254 | python | en | code | 0 | github-code | 36 |
5491251302 | import sys
import os
sys.path.append(os.path.abspath('.'))
import torch
import utils as ut
from train import *
from dataset import load_train_data, load_test_data
import constants
def main(config):
# Fixed random number seed
torch.manual_seed(config.seed)
torch.cuda.manual_seed_all(config.seed)
# Ini... | daoduyhungkaistgit/SRGAN | src/main.py | main.py | py | 3,641 | python | en | code | 3 | github-code | 36 |
38164677251 | import math
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import gridspec
from scipy.special import factorial
from plot.plot_data import plot_matrixImage
def normalize(X):
f_min, f_max = X.min(), X.max()
return (X - f_min) / (f_max - f_min)
def gabor_kernel_2(frequency, sigma_x, sigma... | franzigeiger/training_reductions | utils/gabors.py | gabors.py | py | 5,020 | python | en | code | 3 | github-code | 36 |
18550396896 | from django.http import HttpResponse
from django.shortcuts import render
def index(request):
#params = {'name':'Tarbi'}
return render(request,"index.html")
def analyze(request):
#Get the text
djtext = request.POST.get('text','default')
#Operations
removepunc = request.POST.get('removepunc','... | Bibhash7/Textlyzer | mysite/views.py | views.py | py | 2,508 | python | en | code | 0 | github-code | 36 |
17653061247 | import numpy as np
from inet.models.solvers.tf_lite import MultiTaskModel
from inet.models.tf_lite.tflite_methods import evaluate_interpreted_model
class TwoStageModel(MultiTaskModel):
"""
Object detection model using dependent/sequential methods to solve the localization and classification tasks.
A regr... | philsupertramp/inet | inet/models/solvers/two_stage.py | two_stage.py | py | 2,210 | python | en | code | 0 | github-code | 36 |
12678425581 | import csv
from dateutil.parser import parse
from decimal import *
import pandas as pd
import gc
import os
from multiprocessing import Process
def intersection(list1, list2):
res = []
idx1 = 0
while idx1 < len(list1):
if list1[idx1] in list2:
res.append(list1[idx1])
idx1 += 1
... | nghiahhnguyen/SWHGD | odoo_extract_metrics.py | odoo_extract_metrics.py | py | 4,481 | python | en | code | 1 | github-code | 36 |
39883705611 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
h, k_up1, k_up2 = np.loadtxt('./Reactions/Kup.dat',skiprows=3,usecols=(1,5799+1,5800+1),unpack=True)
h *= 1e-5
k_up = k_up1 + k_up2
plt.xscale('log')
plt.plot(k_up,h,'k-')
plt.savefig('./N2O-rates.pdf',bbox_inches='tight')
| aheays/spectr_examples | argo/data/early_earth/out/plot-k.py | plot-k.py | py | 320 | python | en | code | 0 | github-code | 36 |
18482571232 | import math
import torch.nn as nn
class HRNET_NECK(nn.Module):
def __init__(self, in_channels, feature_size=256):
super(HRNET_NECK, self).__init__()
C2_size, C3_size, C4_size, C5_size = in_channels
# P2
self.P2_1 = nn.Conv2d(C2_size, feature_size, kernel_size=1, stride=1, padding=... | TWSFar/FCOS | models/necks/hrnet_neck.py | hrnet_neck.py | py | 2,155 | python | en | code | 1 | github-code | 36 |
5675989650 | import sys
input = sys.stdin.readline
n = int(input())
graph = []
move = [[-1, 0], [1, 0], [0, -1], [0, 1]]
ans = []
number = 0
for _ in range(n):
graph.append([int(i) for i in (input().strip())])
def dfs(x, y, initial):
global cnt
cnt = initial
graph[x][y] = 0
for i in move:
n... | origin1508/algorithm | 백준/Silver/2667. 단지번호붙이기/단지번호붙이기.py | 단지번호붙이기.py | py | 707 | python | en | code | 0 | github-code | 36 |
70280734825 | """
String reversing. What could be simpler?
Usage:
python string_reverse.py <string_to_reverse>
"""
import sys
def string_reverse(input_string):
result = ''
for i in input_string:
result = i + result
return result
if __name__ == '__main__':
if len(sys.argv) < 2:
sys.stderr.write('T... | AlexDobrushskiy/testing | string_reverse.py | string_reverse.py | py | 699 | python | en | code | 0 | github-code | 36 |
8860920055 | from collections import defaultdict
import Policy as policy
import random
import numpy as np
import matplotlib.pyplot as plt
# import pytorch as torch
class Agent:
def __init__(self, env) -> None:
self.env = env
# replay_buffer = {(state, action) : (state_, reward)}
self.repla... | TheGoldenChicken/robust-rl | rl/agent.py | agent.py | py | 4,660 | python | en | code | 0 | github-code | 36 |
35938489743 | COUNT=0
count2=0
#history=[1,1,0,0]
def q1(history):
def perm(n,begin,end):
global COUNT
global count2
if begin>=end:
for i in range(0, end):
if n[i]==n[i-1]:
count2+=1
# print(n)
break#manage test statistic
... | Ca11me1ce/Funny-Programming | AI-Decision-Making/py_sand/pass_test_q1_1.py | pass_test_q1_1.py | py | 734 | python | en | code | 2 | github-code | 36 |
30569760677 | from typing import List, Tuple
def create_adjacent_list(edges):
adjacent_list = dict()
for edge in edges:
if adjacent_list.get(edge[0]):
adjacent_list[edge[0]].append(edge[1])
else:
adjacent_list[edge[0]] = [edge[1]]
return adjacent_list
def solution(n: int, m: in... | fenixguard/yandex_algorithms | sprint_6/B.exchange_edges_list_to_adjacent_list.py | B.exchange_edges_list_to_adjacent_list.py | py | 935 | python | en | code | 2 | github-code | 36 |
31418095220 | from Word2Vec.Word2VecGenerator import Word2VecGenerator
import glob
from JsonParse.JsonParser import JsonParser
import json as Json
class TrainingComponentGenerator:
__largest_n_words = 0
__astNode2Vec_size = 0
__number_of_vector_code2vec = 0
def __init__(self, astNode2Vec_size, number_of_vector_cod... | ZzillLongLee/TsGen | TrainingDataGenerator/TrainingComponentGenerator.py | TrainingComponentGenerator.py | py | 3,300 | python | en | code | 0 | github-code | 36 |
36403224897 | from project.Util.EMFAttributes import EMFAttributes
from project.Util.finalWrite import finalWrite
class FileInput:
filePath = ''
def readFile(self):
while True:
path = '/Users/shubhamjain/CS562/project/examples/example5'
# path += input('Input the File Name with its path\n')... | itshubhamjain/CS562 | project/src/FileInput.py | FileInput.py | py | 4,399 | python | en | code | 0 | github-code | 36 |
7341734490 | import sys
import os
import ctypes
from ctypes import (
c_double,
c_int,
c_float,
c_char_p,
c_int32,
c_uint32,
c_void_p,
c_bool,
POINTER,
_Pointer, # type: ignore
Structure,
Array,
c_uint8,
c_size_t,
)
import pathlib
from typing import List, Union
# Load the ... | mengbingrock/shepherd | shepherd/llama2c_py/llama2c_py.py | llama2c_py.py | py | 2,276 | python | en | code | 0 | github-code | 36 |
23497341801 | ################ Henri Lahousse ################
# voice assistant
# 05/31/2022
# libraries
import struct
import pyaudio
import pvporcupine # for wakeword
import pvrhino # for situations
porcupine = None
pa = None
audio_stream = None
rhino = None
# documentation picovoice... | lahousse/ONWARD | software/voice-assistant/voice-assis.py | voice-assis.py | py | 3,324 | python | en | code | 0 | github-code | 36 |
7305309200 | import serial
import serial
from time import sleep
import threading
import time
# sudo chmod 666 /dev/ttyACM0
device_port = "/dev/ttyACM0"
from multiprocessing.pool import ThreadPool
import settings
class uwb_data(threading.Thread):
def __init__(self,file_name,device_port):
threading.Thread.__init__(self)
... | CoRotProject/FOF-API | Agents/UWB_agent/uwb_data.py | uwb_data.py | py | 1,567 | python | en | code | 0 | github-code | 36 |
43914377308 | # 도시 분할 계획
import sys
input = sys.stdin.readline
def find_parent(parent, x):
if parent[x] != x:
parent[x] = find_parent(parent, parent[x])
return parent[x]
def union_parent(parent, a, b):
a = find_parent(parent, a)
b = find_parent(parent, b)
# 더 작은 노드를 루트 노드로 설정
if a < b:
pare... | yesjuhee/study-ps | Hi-Algorithm/week8/baekjoon_1647.py | baekjoon_1647.py | py | 1,375 | python | ko | code | 0 | github-code | 36 |
24547009552 | #!/usr/bin/python3
"""
function that prints a text with 2 new lines after each of\
these characters: ., ? and :
"""
def text_indentation(text):
"""
text_indentation -- print a text with 2 new lines after each of\
these characters
text -- recibe the Text
"""
if type(text) is not str:
r... | adebudev/holbertonschool-higher_level_programming | 0x07-python-test_driven_development/5-text_indentation.py | 5-text_indentation.py | py | 821 | python | en | code | 0 | github-code | 36 |
9399875003 | # To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%% [markdown]
#
# # HW06
# ## By: xxx
# ### Date: xxxxxxx
#
#%% [markdown]
# Let us improve our Stock exercise and grade conversion exercise with Pandas now.
#
#%%
import dm6103 as dm
import os
import numpy as np
import pandas as p... | rajkumarcm/Data-Mining | Assignments/HW_Pandas/HW_pandas_stock_solution.py | HW_pandas_stock_solution.py | py | 5,856 | python | en | code | 0 | github-code | 36 |
17883995055 | # -*- encoding: utf-8 -*-
import logging
import os
import time
import numpy as np
import openpyxl
import pandas as pd
import xlrd
# 导入PyQt5模块
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from dataImportModel import Ui_Form as dataImportFormEngine
from widgets import kwargs_to_str
from lib.comm import ... | pyminer/pyminer | pyminer/packages/dataio/sample.py | sample.py | py | 47,148 | python | zh | code | 77 | github-code | 36 |
31897243562 | from bs4 import BeautifulSoup
from collections import defaultdict, Counter
class Parser:
@staticmethod
def getWordsArticle(file):
words = []
with open(file, encoding='utf-8') as f:
for line in f:
line = line.split(" => ")
word = line[0].replace("#", "... | cenh/Wikipedia-Heavy-Hitters | Parser.py | Parser.py | py | 1,600 | python | en | code | 3 | github-code | 36 |
31329677612 | import requests
from requests import HTTPError
import yaml
import json
import os
def load_config():
config_path = 'api_config.yaml'
with open(os.path.join(os.getcwd(), config_path), mode='r') as yaml_file:
config = yaml.safe_load(yaml_file)
return config
def auth():
conf = load_config()['... | daniiche/DE | hmwrk4/airflow/dags/api_handle_airflow.py | api_handle_airflow.py | py | 1,987 | python | en | code | 0 | github-code | 36 |
34697431338 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 06:20:43 2022
@author: beauw
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import itertools
from pandas import to_datetime
from prophet import Prophet
from pandas import DataFrame
from matplotlib import... | SpeciesXBeer/BeerVolumeProphet | Entire Beer Volume Forecase .py | Entire Beer Volume Forecase .py | py | 22,300 | python | en | code | 0 | github-code | 36 |
6793257031 | from django.apps import apps
from django.db.models.signals import post_save
from .invitation_status_changed import when_invitation_registration_post_save
from .consultant_validation_status_changed import when_consultant_validation_status_update
def setup_signals():
Invitation = apps.get_model(
app_label=... | tomasgarzon/exo-services | service-exo-core/registration/signals/__init__.py | __init__.py | py | 736 | python | en | code | 0 | github-code | 36 |
74059453544 | from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils import dellemc_ansible_utils as utils
import logging
from datetime import datetime, timedelta
from uuid import UUID
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
... | avs6/ansible-powerstore | dellemc_ansible/powerstore/library/dellemc_powerstore_snapshot.py | dellemc_powerstore_snapshot.py | py | 39,907 | python | en | code | 0 | github-code | 36 |
35864084249 | from __future__ import print_function
import boto3
#This module creates a table with the table constraints as well
dynamodb = boto3.resource('dynamodb', region_name='us-west-2', endpoint_url='http://localhost:8000', aws_access_key_id='Secret', aws_secret_access_key='Secret')
table = dynamodb.create_table(
Ta... | Codexdrip/DynamoDB-Testing | MoviesCreateTable.py | MoviesCreateTable.py | py | 894 | python | en | code | 0 | github-code | 36 |
15672387350 | from clearpath_config.common.types.config import BaseConfig
from clearpath_config.common.types.list import OrderedListConfig
from clearpath_config.common.utils.dictionary import flip_dict
from clearpath_config.mounts.types.fath_pivot import FathPivot
from clearpath_config.mounts.types.flir_ptu import FlirPTU
from clear... | clearpathrobotics/clearpath_config | clearpath_config/mounts/mounts.py | mounts.py | py | 7,899 | python | en | code | 1 | github-code | 36 |
36094711488 | from merchant import Merchant
from enemy import Enemy
from monster import Monster
characters = {
"Gary": Merchant("Gary", None, 50, 12, 15000, 10, 3, "Here to buy and sell goods."),
"Rebecca": Merchant("Rebecca", None, 15, 7, 200, 1, 1, "Here to buy and sell goods"),
"Thug": Enemy("Thug", None, 180, 7, 5, ... | wildcard329/python_game | npc_roster.py | npc_roster.py | py | 2,643 | python | en | code | 0 | github-code | 36 |
5232319809 | from openpyxl import Workbook
wb = Workbook()
ws = wb.active
# [현재까지 작성된 최종 성적 데이터]
data = [["학번", "출석", "퀴즈1", "퀴즈2", "중간고사", "기말고사", "프로젝트"],
[1,10,8,5,14,26,12],
[2,7,3,7,15,24,18],
[3,9,5,8,8,12,4],
[4,7,8,7,17,21,18],
[5,7,8,7,16,25,15],
[6,3,5,8,8,17,0],
[7,4,9,10,16,27,18],
[8,6,6,6,15,19,17],
[... | OctoHoon/PythonStudy_rpa | rpa_basic/1_excel/17_quiz.py | 17_quiz.py | py | 1,382 | python | en | code | 0 | github-code | 36 |
33039113496 | from mc.net.minecraft.mob.ai.BasicAttackAI import BasicAttackAI
class JumpAttackAI(BasicAttackAI):
def __init__(self):
super().__init__()
self.runSpeed *= 8.0
def _jumpFromGround(self):
if not self.attackTarget:
super()._jumpFromGround()
else:
self.mob.... | pythonengineer/minecraft-python | mc/net/minecraft/mob/ai/JumpAttackAI.py | JumpAttackAI.py | py | 438 | python | en | code | 2 | github-code | 36 |
14198442268 | import os
from flask import Flask, render_template, request
import base64
from io import BytesIO
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import src.components.data_ingestion as DI
from src.components.model_trainer import modelTrain
from werkzeug.utils import secure_filename
app = Flask(... | al0nkr/style-transfer-nn | app.py | app.py | py | 3,973 | python | en | code | 0 | github-code | 36 |
11867021952 | # -----------------------------------------------------------------------------
# main.py
#
# Hung-Ruey Chen 109971346
# -----------------------------------------------------------------------------
import sys, os
import ply.lex as lex
import ply.yacc as yacc
from token_def import *
# Build the lexer
def main():
... | vbigmouse/CSE307 | HW5/main.py | main.py | py | 949 | python | en | code | 0 | github-code | 36 |
12177872909 | import requests
import urllib.parse
main_api = "https://www.mapquestapi.com/directions/v2/route?"
key = "p0Modq3JoAtVS6BXK5P5CinXWhJNUQwI"
while True:
orig = input("Starting Location: ")
dest = input("Destination: ")
url = main_api + urllib.parse.urlencode({
"key" : key,
"from" : orig,
... | JerickoDeGuzman/MapQuest-Feature-Enhancement | tempdir/referenceFiles/mapquest_parse-json_3.py | mapquest_parse-json_3.py | py | 561 | python | en | code | 0 | github-code | 36 |
8473901690 | #!/usr/bin/env python3
############
## https://gist.github.com/DevBOFH/7bd65dbcb945cdfce42d21b1b6bc0e1b
############
##
##
description = 'Terraform workspace tool. This tool can be used to perform CRUD operations on Terraform Cloud via their public API.'
version = "0.0.1"
import os
import re
import sys
import reques... | babywyrm/sysadmin | terraform/tf_workspace_.py | tf_workspace_.py | py | 5,404 | python | en | code | 10 | github-code | 36 |
44771319776 | def extract_info(book_list):
result = []
for book in book_list:
title = book.find("a", {"class" : "N=a:bta.title"}).string
image = book.find("img")["src"]
link = book.find("div", {"class" : "thumb_type thumb_type2"}).find("a")["href"]
author = book.find("a",{"class" : ... | sumins2/homework | session09_crawling/book.py | book.py | py | 959 | python | en | code | 0 | github-code | 36 |
16209163559 | import datetime
import os
import random
import string
from datetime import datetime
import requests
from boto3 import Session
from django.conf import settings
from django.conf.global_settings import MEDIA_ROOT
from market_backend.apps.accounts.models import Media
from market_backend.v0.accounts import serializers
c... | muthukumar4999/market-backend | market_backend/v0/accounts/utils.py | utils.py | py | 5,060 | python | en | code | 0 | github-code | 36 |
41924245365 | from .sentence_cutting import cutting_500_under
import requests, json
def cleaned_result(final_result):
result = []
tmp = final_result.split('<br>')
WRONG_SPELLING = "<span class='red_text'>"
WRONG_SPACING = "<span class='green_text'>"
AMBIGUOUS = "<span class='violet_text'>"
S... | SeongMyo/Spell_Checker_plus | utils/spell_checker.py | spell_checker.py | py | 2,669 | python | en | code | 0 | github-code | 36 |
75263396265 | import requests
from urllib.parse import urlparse
import concurrent.futures
# Extract domain from a URL
def extract_domain(url):
return urlparse(url).netloc
# Fetch subdomains from crt.sh
def get_subdomains_from_crtsh(domain):
try:
response = requests.get(f"https://crt.sh/?q=%.{domain}&output=json")
... | RepoRascal/test | run.py | run.py | py | 1,650 | python | en | code | 0 | github-code | 36 |
72753340263 | import json
import time
import os
import uuid
import argparse
from datetime import datetime, timedelta
from kafka import KafkaConsumer, SimpleConsumer
import os.path
import subprocess
def gzip_yesterday(yesterday):
#print "gzip_yesterday"
out = None
fname = args.target_folder+"/"+args.target_file+"_"+yesterday+"... | goliasz/kafka2bigquery | src/main/python/dump_topic.py | dump_topic.py | py | 1,687 | python | en | code | 0 | github-code | 36 |
35876191865 | import sqlite3
from sqlite3 import Error
class Key:
def __init__(self, key,content,info, database_path):
if database_path!="":
try:
self.key = key
self.database_path =database_path
if not self.check_key_exists():
if len(self.get_all__key(key))==0:
if key!="... | dahstar/xwx.ctflab | fldb.py | fldb.py | py | 2,775 | python | en | code | 0 | github-code | 36 |
39939114136 | from PyQt5.QtWidgets import QTableWidgetItem, QLabel, QFileDialog
from PyQt5.QtCore import Qt
from pandas.tests.io.excel.test_xlrd import xlwt
from UI.resultWinUI import *
from algorithm import *
from UI.mainWinUI import *
class BrokerWin(Ui_MainWindow, QtWidgets.QMainWindow):
def __init__(self, parent=None):
... | JuliaZimina/Remote-Banking-Brokers | UI/brokerUI.py | brokerUI.py | py | 8,392 | python | ru | code | 0 | github-code | 36 |
33733841060 | from unittest import TestCase
from A3.SUD import fight_or_run
from unittest.mock import patch
class TestFightOrRun(TestCase):
@patch('builtins.input', side_effect=[0])
def test_fight_or_run_zero(self, mock_input):
actual = fight_or_run()
expected = 0
self.assertEqual(actual, expected)
... | marlonrenzo/A01054879_1510_assignments | A3/test_fight_or_run.py | test_fight_or_run.py | py | 901 | python | en | code | 0 | github-code | 36 |
17498679617 | import logging
import numpy as np
import sys
import warnings
import affine6p
import geopandas
from typing import List, Optional
from shapely.geometry import Polygon
import geoCosiCorr3D.georoutines.geo_utils as geoRT
import geoCosiCorr3D.geoErrorsWarning.geoErrors as geoErrors
from geoCosiCorr3D.geoCore.core_RFM impor... | SaifAati/Geospatial-COSICorr3D | geoCosiCorr3D/geoRFM/RFM.py | RFM.py | py | 15,569 | python | en | code | 37 | github-code | 36 |
6411274184 | import json
from bitbnspy import bitbns
# from bitbnspy import bitbns
import config
key = config.apiKey
secretKey = config.secret
bitbnsObj = bitbns(key, secretKey)
# print('APIstatus: =', bitbnsObj.getApiUsageStatus)
# getPairTicker = bitbnsObj.getTickerApi('DOGE')
# print(' PairTicker : ', getPairTicker)
print(... | npenkar/botCode | BitbnsPy/botbns.py | botbns.py | py | 788 | python | en | code | 0 | github-code | 36 |
9659602575 | import numpy
from abstract_model import Model
from asc.core.time_series import TimeSeries
class BrownModel(Model):
r"""
Class representing Brown's exponential smoothing model.
NOTES:
Brown's model is described by moving average `\hat{m_t}` \ for
`t=1,\dots, n`, which we can count with r... | dexter2206/asc | source/asc-0.1/src/asc/models/brown_model.py | brown_model.py | py | 4,868 | python | en | code | 2 | github-code | 36 |
16389175671 | # -*- coding: utf-8 -*-
import os
import sys
import xbmcgui
import xbmcplugin
import xbmcaddon
from urllib.parse import parse_qsl
from libs.utils import get_url, check_settings
from libs.session import Session
from libs.channels import Channels, manage_channels, list_channels_edit, list_channels_list_back... | waladir/plugin.video.rebittv | main.py | main.py | py | 7,178 | python | en | code | 0 | github-code | 36 |
18041766413 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 9 11:35:21 2023
@author: akava
"""
import tkinter as tk
from tkinter import ttk
from PIL import Image, ImageTk
import customtkinter, tkinter
from retinaface import RetinaFace
import cv2
from gender_classification.gender_classifier_window import GenderClassifierWindow
c... | MartinVaro/Modular | detection/single_photo_detection_page.py | single_photo_detection_page.py | py | 10,890 | python | es | code | 0 | github-code | 36 |
38075605873 | # -*- coding: utf-8 -*-
from pathlib import Path
class Manager:
def create_readme():
root_path = Path(__file__).parent
info ="""## حل سوالات کوئرا
برای دیدن صفحه ی اصلی هر سوال در سایت کوئرا میتوانید روی نام هر سوال کلیک کنید و یا در قسمت توضیحات روی PDF کلیک کنید.
showmeyourcode.ir
"""
... | MohammadNPak/quera.ir | manage.py | manage.py | py | 2,594 | python | en | code | 40 | github-code | 36 |
8524473683 | # coding=gbk
import numpy as np
import pandas as pd
import re
from jieba import lcut
def clean_str(text):
text = text.lower()
# Clean the text
text = re.sub(r"[^A-Za-z0-9^,!.\/'+-=]", " ", text)
text = re.sub(r"what's", "what is ", text)
text = re.sub(r"that's", "that is ", text)
text = re.sub... | mrgulugulu/text_regression | data_helpers.py | data_helpers.py | py | 7,290 | python | en | code | 0 | github-code | 36 |
24744353166 | import pandas as pd
import os
path = "C:\\Users\\brunn\\Desktop\\SENAC\\topicos-avancados"
files = os.listdir(path)
extension = 'csv'
files_open = [path + '\\' + f for f in files if f[-len(extension):] == extension]
list_of_dataframes = []
for file in files_open:
list_of_dataframes.append(pd.read_csv(file, delimi... | brunnolorenzoni/scripts-topicos-avancados | loadfile.py | loadfile.py | py | 389 | python | en | code | 0 | github-code | 36 |
33738820247 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
db = SQLAlchemy()
def create_app():
app = Flask(__name__)
cors = CORS(app)
app.config["FLASK_DEBUG"] = True
app.config['SECRET_KEY'] = 'secret-key-goes-here'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:... | KariukiAntony/MMUST-HealthIT-TAT-App | app/__init__.py | __init__.py | py | 571 | python | en | code | 1 | github-code | 36 |
30352454411 | from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from starlette import status
from starlette.responses import RedirectResponse
from database import get_db
from domain.answer import answer_schema, answer_crud
from domain.question import question_crud, question_schema
from domain.... | dlawnsdk/study-fastapi-project | domain/answer/answer_router.py | answer_router.py | py | 2,709 | python | en | code | 1 | github-code | 36 |
21017557226 | """
The goal of this program is to optimize the movement to achieve a rudi out pike (803<) for left twisters.
"""
import os
import numpy as np
import biorbd_casadi as biorbd
from casadi import MX, Function
from bioptim import (
OptimalControlProgram,
DynamicsList,
DynamicsFcn,
... | EveCharbie/AnthropoImpactOnTech | Tech_opt_MultiStart.py | Tech_opt_MultiStart.py | py | 34,211 | python | en | code | 1 | github-code | 36 |
5081502268 | class PointV2:
"""Representation of a two-dimensional point coordinate."""
def __init__(self, x: float, y: float) -> None:
"""Initializes a PointV2 with the given coordinates."""
self.x = x
self.y = y
def distance_to(self, other: "PointV2") -> float:
"""Computes the distanc... | adonath/scipy-2023-pydantic-tutorial | notebooks/my-script.py | my-script.py | py | 497 | python | en | code | 10 | github-code | 36 |
12010296738 | #! /usr/bin/env python
import sys
import os
# A few module-level variables, because closures are an easy way to share
# state.
#
# Would be more modular to pass this to each of them. Oh well.
program = None
debug = False
instruction_index = 0
def get_param_value(param):
# I imagine there will eventually be modes... | NateEag/advent-of-code-solutions | 2019/day-5/solution.py | solution.py | py | 5,561 | python | en | code | 0 | github-code | 36 |
31920197231 | from google.cloud import vision
# with 開始から終了まで自動で実行してくれる
# rb read binaryモード バイナリーモードを読み込む
# テキスト以外のデータ 主に画像や動画
# road.jpgを開いて読み込む
with open('./road.jpg', 'rb') as image_file:
content = image_file.read()
# vision APIが扱える画像データに変換
image = vision.Image(content=content)
# annotation テキストや音声、画像などあらゆる形式のデータにタグ付けをする作... | yuuki-1227/vision-ai-test | index.py | index.py | py | 916 | python | ja | code | 0 | github-code | 36 |
32033427500 | # Example using PWM to fade an LED.
import time
from machine import Pin, PWM
A1 = PWM(Pin(0))
A2 = PWM(Pin(1))
B1 = PWM(Pin(2))
B2 = PWM(Pin(3))
steeringPin = Pin(7)
throttlePin = Pin(6)
# -255 to +255
def leftControl(speed):
speed = int(speed)
if(speed > 255):
speed = 255
if spe... | joeynovak/micropython-rc-car-esc-adapter | main.py | main.py | py | 1,808 | python | en | code | 0 | github-code | 36 |
25170664533 | import gspread
import pandas as pd
import numpy as np
from oauth2client.service_account import ServiceAccountCredentials
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion... | Big6Ent/Predict_Next_Day_SP500_Direction | sp500_confidence.py | sp500_confidence.py | py | 4,152 | python | en | code | 0 | github-code | 36 |
26490765888 | import base64
from rest_framework import serializers
from categories.models import Categories, Translations, Authorities
from categories.serializers import TranslationsSerializer
from users.models import User
from .models import Documents
def get_predicted_trees():
try:
return Categories.objects.filter(
... | JU4NP1X/teg-backend | documents/serializers.py | serializers.py | py | 3,796 | python | en | code | 1 | github-code | 36 |
35451201459 | import cv2
from pydarknet import Detector, Image
net = Detector(bytes("tank.cfg", encoding="utf-8"), bytes("tank.weights", encoding="utf-8"), 0, bytes("tank.data",encoding="utf-8"))
def Detect(path):
vidObj = cv2.VideoCapture(path)
count = 0
success = 1
while success:
success, ... | wisekrack/BattleTankDown | tankLocFromSurveillanceVideo.py | tankLocFromSurveillanceVideo.py | py | 958 | python | en | code | 1 | github-code | 36 |
29997839939 | from OpenGL.GL import *
from OpenGL.GLU import *
import sys
#from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QOpenGLWidget
from PyQt5.QtWidgets import QOpenGLWidget, QApplication, QMainWindow, QLabel, QLineEdit, QVBoxLayout, QWidget
from PyQt5.QtWidgets import QSlider
from PyQt5.QtCore import *
class... | dknife/2021Graphics | Source/01_Windowing/04_GLwQtWidgets.py | 04_GLwQtWidgets.py | py | 2,613 | python | en | code | 2 | github-code | 36 |
28886974693 | import os
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import img_to_array, load_img
from tqdm import tqdm
import json
def preprocess_image(image_path, target_size):
img = load_img(image_path, target_size=target_size)
img_arr... | Donike98/Assignment_Solaborate | model_inference/JSON.py | JSON.py | py | 1,701 | python | en | code | 0 | github-code | 36 |
31931640588 | import srt
from datetime import timedelta
INPUT = "You've Got Mail (si).srt"
OUTPUT = "out.srt"
START = 1411
END = -1
SHIFT = timedelta(milliseconds=1000)
with open(INPUT) as f:
subs = list(srt.parse(f.read()))
for sub in subs[START-1:END]:
sub.start += SHIFT
sub.end += SHIFT
with open(OUTPUT, 'w') as f... | aquiire/liyum-awith | sync.py | sync.py | py | 353 | python | en | code | 0 | github-code | 36 |
2030937421 | class avl:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
self.bal = 0
self.depth = 0
def rotateLeft(self):
print("tree before rotate: ", self.left, self.val, self.right)
top = self.right
self.right = top.left
t... | youngseok-seo/cs-fundamentals | Trees/avl.py | avl.py | py | 2,367 | python | en | code | 0 | github-code | 36 |
35205340902 | from RocketMilesClass import RocketMiles
import time
import logging.handlers
import datetime
import os
#Smoke test for basic functionality of the Search Results page for the Rocketmiles.com search app.
#This module contains an error logger, test preconditions, and TCIDs 9-10.
#Initializing class object.
RM = Rocket... | just-hugo/Test-Automation | Rocketmiles/SmokeTestSearchResultsModule.py | SmokeTestSearchResultsModule.py | py | 2,827 | python | en | code | 0 | github-code | 36 |
27621948392 | import time
import pandas as pd
import numpy as np
import random
from sklearn.metrics.pairwise import cosine_similarity, euclidean_distances,manhattan_distances
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
#CLASS ... | hrishivib/k-means-iris-MNIST-classification | k-means_MNIST.py | k-means_MNIST.py | py | 7,624 | python | en | code | 0 | github-code | 36 |
36376749917 | # Devin Fledermaus Class 1
import tkinter
from tkinter import *
from tkinter import messagebox
from playsound import playsound
import requests
from datetime import datetime
import re
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# Creating the window
root = Tk()
roo... | DevinFledermaus/Lotto_EOMP | main3.py | main3.py | py | 7,008 | python | en | code | 0 | github-code | 36 |
43302270494 | """
This is not used in a PyPy translation, but it can be used
in RPython code. It exports the same interface as the
Python 're' module. You can call the functions at the start
of the module (expect the ones with @not_rpython for now).
They must be called with a *constant* pattern string.
"""
import re, sys
from rpyt... | mozillazg/pypy | rpython/rlib/rsre/rsre_re.py | rsre_re.py | py | 10,856 | python | en | code | 430 | github-code | 36 |
15287706589 | ##encoding=UTF8
"""
This module provides high performance iterator recipes.
best time and memory complexity implementation applied.
compatible: python2 and python3
import:
from .iterable import (take, flatten, flatten_all, nth, shuffled, grouper, grouper_dict, grouper_list,
running_windows, cycle_running... | MacHu-GWU/Angora | angora/DATA/iterable.py | iterable.py | py | 12,109 | python | en | code | 0 | github-code | 36 |
27045433039 | import sys
import pysnooper
@pysnooper.snoop()
def lengthOfLongestSubstring(s: str) -> int:
a_ls = [x for x in s]
max_len = 0
substring = []
for a in a_ls:
if a in substring:
idx = substring.index(a)
substring = substring[idx + 1:]
substring.append(a)
if... | ikedaosushi/python-sandbox | pysnoozer/lengthOfLongestSubstring.py | lengthOfLongestSubstring.py | py | 504 | python | en | code | 11 | github-code | 36 |
31829434038 | """
Append module search paths for third-party packages to sys.path.
This is stripped down and customized for use in py2app applications
"""
import sys
# os is actually in the zip, so we need to do this here.
# we can't call it python24.zip because zlib is not a built-in module (!)
_libdir = '/lib/python' + sys.versi... | LettError/responsiveLettering | ResponsiveLettering.glyphsPlugin/Contents/Resources/site.py | site.py | py | 3,645 | python | en | code | 152 | github-code | 36 |
73269742825 | def checkCompletion(access_token,client_id):
import wunderpy2
import pygsheets
import datetime
x = 2
gc = pygsheets.authorize()
sh = gc.open('wunderlist_update')
wks = sh.sheet1
api = wunderpy2.WunderApi()
client = api.get_client(access_token, client_id)
current_rows = wks.get_a... | krishan147/wundersheet | wundersheet/check_task_completion.py | check_task_completion.py | py | 876 | python | en | code | 0 | github-code | 36 |
17884032715 | import logging
import os
import types
from typing import Optional
import core.algorithms as algorithms
from features.extensions.extensionlib import BaseExtension, BaseInterface
from packages.document_server.docserver import Server
logger = logging.getLogger(__name__)
class Extension(BaseExtension):
server = Ser... | pyminer/pyminer | pyminer/packages/document_server/main.py | main.py | py | 3,241 | python | en | code | 77 | github-code | 36 |
7426504454 | from maltego_trx.transform import DiscoverableTransform
from db import db
from utils import row_dict_to_conversation_email
class EmailAddressToRecievers(DiscoverableTransform):
"""
Given a maltego.EmailAddress Entity, return the set of Emails sent by that address from the Enron dataset.
"""
@classme... | crest42/enron | transforms/EmailAddressToRecievers.py | EmailAddressToRecievers.py | py | 752 | python | en | code | 0 | github-code | 36 |
12028607497 | # -*- coding: utf-8 -*-
from django.db import connections
from django.db.models.aggregates import Count
from django.utils.unittest import TestCase
from django_orm.postgresql.hstore.functions import HstoreKeys, HstoreSlice, HstorePeek
from django_orm.postgresql.hstore.expressions import HstoreExpression
from .models ... | cr8ivecodesmith/django-orm-extensions-save22 | tests/modeltests/pg_hstore/tests.py | tests.py | py | 12,065 | python | en | code | 0 | github-code | 36 |
22193923889 | try:
# heritage des propri�t�s du CoupledModel par domainStructure
import Core.DEVSKernel.DEVS as DEVS
except:
import sys, os
for spath in [os.pardir + os.sep + 'Lib']:
if not spath in sys.path: sys.path.append(spath)
import Core.DEVSKernel.DEVS as DEVS
#========================================================... | akamax/devsimpy | version_3.0/Core/DomainInterface/DomainStructure.py | DomainStructure.py | py | 609 | python | en | code | 0 | github-code | 36 |
22215949702 | import pytest
from hamcrest import assert_that, equal_to
from gairl.memory.prioritized_replay_buffer import _SumTree
def test_init_valid():
# When
tree = _SumTree(8)
# Then
assert_that(tree.total_priority, equal_to(0))
assert_that(tree.priorities_range, equal_to((1, 1)))
assert_that(tree._da... | K-Kielak/gairl | tests/memory/test_sum_tree.py | test_sum_tree.py | py | 6,504 | python | en | code | 0 | github-code | 36 |
30428285512 | # The following iterative sequence is defined for the set of positive integers:
# n → n/2 (n is even)
# n → 3n + 1 (n is odd)
# Which starting number, under one million, produces the longest chain?
from time import time
start = time()
def count_chain(start_num:int):
chain = 1
while start_num != 1:
if... | Kyudeci/EulerPythonPractice | Longest_Collatz_Sequence.py | Longest_Collatz_Sequence.py | py | 897 | python | en | code | 0 | github-code | 36 |
848235818 | from . import types
class Schema:
def __init__(self, type):
print(type(self))
self.type = type
self.type_name = types.get_type_name(type)
def assert_validation(self, value):
same_type = True
try:
if not isinstance(value, self.type):
same_typ... | rizwanmustafa/rizval | rizval/rizval.py | rizval.py | py | 1,143 | python | en | code | 0 | github-code | 36 |
26336618129 | import datetime
import smtplib
import time
import requests
import api_keys
MY_LAT = 51.53118881973776
MY_LONG = -0.08949588609011068
response = requests.get(url="http://api.open-notify.org/iss-now.json")
data = response.json()
longitude = data["iss_position"]["longitude"]
latitude = data["iss_position"]["la... | Zoom30/100-python | Day 33/Day 33.py | Day 33.py | py | 1,385 | python | en | code | 0 | github-code | 36 |
39553483739 | from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.exceptions import ParseError
from rest_framework.decorators import action, api_view
from core import models, serializers, utils
from rest_framework_simplejwt.tokens import RefreshToken
@api_view(['POST'])
def signup(... | mahziyar-es/movie-review | server/api/views/auth.py | auth.py | py | 824 | python | en | code | 0 | github-code | 36 |
23618738970 | def test(path):
from glob import glob
from os.path import join
from shutil import rmtree
from tempfile import mkdtemp
from numpy import all, abs
from quantities import kbar, eV, angstrom
from pylada.crystal import Structure
from pylada.vasp import Vasp
from pylada.vasp.relax import Relax
from pylada... | mdavezac/LaDa | vasp/tests/runrelax.py | runrelax.py | py | 1,932 | python | en | code | 5 | github-code | 36 |
1914874686 | import math
from distributed import Client
from tqdm import tqdm
import numpy as np
import pandas as pd
def calculate_distance_between_queries(data_df, queries, metric, dask_client: Client= None, n_blocks = None):
involved_instances = np.unique(queries, axis = None)
relevant_data = data_df.reset_index(drop=Tr... | jankrans/Conditional-Generative-Neural-Networks | repositories/profile-clustering/energyclustering/clustering/similarity/distmatrix.py | distmatrix.py | py | 4,922 | python | en | code | 0 | github-code | 36 |
22644746365 | import requests
import time
from bs4 import BeautifulSoup as bs
import re
import webbrowser
sizes = [7, 9.5, 11]
new_arrivals_page_url = 'https://www.theclosetinc.com/collections/new-arrivals'
base_url = 'https://www.theclosetinc.com'
post_url = 'https://www.theclosetinc.com/cart/add.js'
keywords = ['yeezy', 'inertia'... | athithianr/deadstock-bot | bots/theclosetinc_bot.py | theclosetinc_bot.py | py | 1,681 | python | en | code | 0 | github-code | 36 |
8824516219 | # -*- coding: utf-8 -*-
import argparse
import sys
import gym
from gym import wrappers, logger
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import numpy as np
import random
from random import choices
class RandomAgent(object):
def __init__(self, action_space):
"""Initialize an Agent... | ThibaudPerrin/tp2-bio-inspi | TP2_Cartpole.py | TP2_Cartpole.py | py | 5,135 | python | en | code | 0 | github-code | 36 |
3535750261 | import os
def get_mutations(gene, file):
"""
:param gene: For which gene is looked what different mutations are available in the maffiles.
:param file: Through which maffile the function will loop.
This function loops through a maffile to see which mutations of a specified gene are available. Those mu... | Chantal1501/Genetic-interactions-in-childhood-cancer | Testing the reliability/gene_mutations.py | gene_mutations.py | py | 2,573 | python | en | code | 0 | github-code | 36 |
71785754983 | #!/usr/bin/python3
import datetime
import flask
from . import client
from . import session
bp = flask.Blueprint("main", __name__)
def format_time(seconds):
return str(datetime.timedelta(seconds=seconds))
def format_size(size):
for unit in ["B","KB","MB","GB"]:
if abs(size) < 1024.0:
return "%3.1f%s" ... | jakub-vanik/youtube-ripper | http/ripper/main.py | main.py | py | 2,200 | python | en | code | 0 | github-code | 36 |
74108338023 | # first order fluid-flow model based on the theory of planned behavior
from pylab import array, linspace
from scipy import integrate #for integrate.odeint
# setup logging
import logging
logging.basicConfig(filename='src/__logs/firstOrderModel2.log',\
level=logging.DEBUG,\
forma... | PIELab/behaviorSim | behaviorSim/PECSagent/state/CSEL/OLD/model_firstOrder.py | model_firstOrder.py | py | 4,656 | python | en | code | 1 | github-code | 36 |
22783025748 | #
# @lc app=leetcode id=33 lang=python3
#
# [33] Search in Rotated Sorted Array
#
# https://leetcode.com/problems/search-in-rotated-sorted-array/description/
#
# algorithms
# Medium (35.70%)
# Likes: 6784
# Dislikes: 604
# Total Accepted: 902.2K
# Total Submissions: 2.5M
# Testcase Example: '[4,5,6,7,0,1,2]\n0'
... | Zhenye-Na/leetcode | python/33.search-in-rotated-sorted-array.py | 33.search-in-rotated-sorted-array.py | py | 1,926 | python | en | code | 17 | github-code | 36 |
75187049704 | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
with open('requirements.txt') as fin:
lines = fin.readlines()
lines = [o.strip() for o in lines]
lines = [o for o in lines if len(o) > 0]
req = [o for o in lines if not o.star... | nghiahuynh-ai/ResViT | setup.py | setup.py | py | 643 | python | en | code | 0 | github-code | 36 |
71782650344 | #!/usr/bin/env python
# -*- conding:utf-8 -*-
import requests
import argparse
import sys
import urllib3
import re
from prettytable import PrettyTable
urllib3.disable_warnings()
def title():
print("""
Dedecms_5.8.1 代码执行漏洞
Use:python3 dedecms_5.8.1_RC... | Henry4E36/dedecms_5.8.1_RCE | dedecms_5.8.1_RCE.py | dedecms_5.8.1_RCE.py | py | 3,462 | python | en | code | 5 | github-code | 36 |
17173794780 | # -*- coding: utf-8 -*-
# @Time : 2019/9/10 11:21
# @Author : bjsasc
import json
import logging
import os
import sys
import time
import DataUtil
from pyinotify import WatchManager, Notifier, ProcessEvent, IN_CLOSE_WRITE
# 设置日志输出两个handle,屏幕和文件
log = logging.getLogger('file watch ---')
fp = logging.FileHandler('a.lo... | xingyundeyangzhen/zxm | DataWatcher.py | DataWatcher.py | py | 2,812 | python | en | code | 0 | github-code | 36 |
495235347 | import glob
import os
import sqlite3
from collections import defaultdict
from contextlib import contextmanager
import six
import sqlalchemy as db
from sqlalchemy.pool import NullPool
from watchdog.events import PatternMatchingEventHandler
from watchdog.observers import Observer
from dagster import check
from dagster.... | helloworld/continuous-dagster | deploy/dagster_modules/dagster/dagster/core/storage/event_log/sqlite/sqlite_event_log.py | sqlite_event_log.py | py | 5,713 | python | en | code | 2 | github-code | 36 |
25852270022 | """Functions for dynamically loading modules and functions.
"""
import importlib
import os
__author__ = 'Hayden Metsky <hayden@mit.edu>'
def load_module_from_path(path):
"""Load Python module in the given path.
Args:
path: path to .py file
Returns:
Python module (before returning, this... | broadinstitute/catch | catch/utils/dynamic_load.py | dynamic_load.py | py | 1,312 | python | en | code | 63 | github-code | 36 |
30586804681 | from django.contrib.formtools.wizard.views import SessionWizardView
from django.core.urlresolvers import reverse
from django.forms import modelformset_factory
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
# Create your views here.
from recipe.forms import *
from r... | BrewRu/BrewRu | recipe/views.py | views.py | py | 2,193 | python | en | code | 0 | github-code | 36 |
1296887467 | from urllib.request import urlopen
edetabel = urlopen("https://ratings.fide.com/top.phtml?list=men")
baidid = edetabel.read()
tekst = baidid.decode()
eesnimi = str(input("Sisestage malemängja eesnimi: ")).lower()
perenimi = str(input("Sisestage malemängja perekonnanimi: ")).lower()
otsitav = perenimi.title() + ", " ... | Marbeez/ez4enceenceencepoopapoopabelt | hugi.py | hugi.py | py | 539 | python | et | code | 0 | github-code | 36 |
40281118137 | import os
import time
import math
import numpy as np
import torch
import copy
from skimage import img_as_float32
import im_utils
from unet3d import UNet3D
from file_utils import ls
from torch.nn.functional import softmax
import torch.nn.functional as F
cached_model = None
cached_model_path = None
use_fake_cnn = False
... | YZST/RootPainter3D | trainer/model_utils.py | model_utils.py | py | 8,983 | python | en | code | null | github-code | 36 |
35936630793 | #!/usr/bin/python3
i = 1 #zaczynamy od 1
while i < 40:
print(i)#wypisuje cyferki
if i % 5 == 0 and i % 7 == 0: #najpierw to, bo inaczej napisze tylko, zę jest podzielne przez 5
print("x is divided by 5 and 7")
elif i % 5 == 0: #czy reszta z dzielenia jest równa 0
print("x is divided by ... | AgaSuder/kurs_Python | homework3/zadanie3_2b.py | zadanie3_2b.py | py | 652 | python | pl | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.