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
33008270053
# load the example image and convert it to grayscale import os import cv2 import pytesseract image = "example_01.jpg" preprocess = "thresh" image = cv2.imread(image) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # check to see if we should apply thresholding to preprocess the # image if preprocess == "thresh": ...
Marius-Juston/SonnetGeneratorCombination
ocr.py
ocr.py
py
1,062
python
en
code
0
github-code
36
29412113956
import cv2 import numpy as np import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('-v','--video', type=str) parser.add_argument('-o','--output', type=str, default=None) args = parser.parse_args() vid = cv2.VideoCapture(args.video) width = int(vid.get(...
flexinai/flexin-ipod-ad
exclusion.py
exclusion.py
py
2,097
python
en
code
0
github-code
36
17729946892
import argparse import glob import logging import os import random import timeit import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler from torch.utils.data.distributed import DistributedSampler from tqdm import tqdm, trange from transformers import ( WEIGHTS_NA...
nict-wisdom/bertac
src/examples.openqa/run_openqa_preprocess.py
run_openqa_preprocess.py
py
18,692
python
en
code
7
github-code
36
43507170482
#!/usr/bin/env python3 """this module contains a function for task 2""" import numpy as np def nparser(sentence, n): """nparser - parses sentence in to n partitions""" uniq_words = [] for i in range(len(sentence)): if i + n <= len(sentence): uniq_words.append(str(sentence[i:i+n])) ...
chriswill88/holbertonschool-machine_learning
supervised_learning/0x10-nlp_metrics/2-cumulative_bleu.py
2-cumulative_bleu.py
py
1,937
python
en
code
0
github-code
36
43734774169
""" @创建日期 :2022/4/25 @修改日期 :2022/4/26 @作者 :jzj @功能 :模型库,输出统一以字典格式 dqn 输出 value a2c 输出 policy value fixme: 可能会抽象为参数构建的模式,不确定 """ from typing import List import tensorflow as tf import tensorflow.keras.layers as layers import tensorflow.keras.models as models def make_model(id, args): if id =...
baichii/inspire
rookie/models.py
models.py
py
6,872
python
en
code
0
github-code
36
18590413266
import pytest from sqlalchemy import create_engine from rebrickable.data.database import Session from rebrickable.data.models import * models = [Color, Inventory, InventorySet, InventoryPart, Part, PartCategory, Set, Theme] @pytest.fixture(scope='module') def session(): engine = create_engine('sqlite:...
rienafairefr/pyrebrickable
tests/data/test_data.py
test_data.py
py
1,369
python
en
code
4
github-code
36
9294959555
#!/usr/bin/env python # -*- coding: utf-8 -*- """-------------------------------------------------------------------- GENETIC ALGORITHMS EXPERIMENTS Started on the 2018/01/03 theo.alves.da.costa@gmail.com https://github.com/theolvs ------------------------------------------------------------------------ """ from sci...
TheoLvs/reinforcement-learning
4. Chrome Dino/experiments.py
experiments.py
py
10,024
python
en
code
94
github-code
36
6367637162
# Look for #IMPLEMENT tags in this file. ''' All models need to return a CSP object, and a list of lists of Variable objects representing the board. The returned list of lists is used to access the solution. For example, after these three lines of code csp, var_array = caged_csp_model(board) solve...
eliasvolonakis/CSC384CourseWork
Constraint Satisfaction Assignment/puzzle_csp.py
puzzle_csp.py
py
8,422
python
en
code
0
github-code
36
10916034260
import abc import sys from importlib import import_module from typing import TypeVar import pytest from sphinx.ext.autodoc.mock import _MockModule, _MockObject, mock def test_MockModule(): mock = _MockModule('mocked_module') assert isinstance(mock.some_attr, _MockObject) assert isinstance(mock.some_meth...
borntocodeRaj/sphinx_configuration
tests/test_ext_autodoc_mock.py
test_ext_autodoc_mock.py
py
3,242
python
en
code
1
github-code
36
73952795302
from scipy.special import comb """ This file contains a set of functions to practice your probabilities skills. It needs to be completed with "vanilla" Python, without help from any library -- except for the bin_dist function. """ def head_tails(p, n): """ Given a coin that have probability p of ...
ashokpanigrahi88/ashokpython
Exercises/Pre-Maths/probabilities.py
probabilities.py
py
2,880
python
en
code
0
github-code
36
43297568374
from _rawffi import alt class MetaStructure(type): def __new__(cls, name, bases, dic): cls._compute_shape(name, dic) return type.__new__(cls, name, bases, dic) @classmethod def _compute_shape(cls, name, dic): fields = dic.get('_fields_') if fields is None: retu...
mozillazg/pypy
pypy/module/_rawffi/alt/app_struct.py
app_struct.py
py
542
python
en
code
430
github-code
36
6997263842
class ListNode: def __init__(self, val=0, next=None): """ :type val: int :type next: ListNode """ self.val = val self.next = next def mergeTwoLists(list1 ,list2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ result = ListNode...
joseluisvr93/leetcode
mergeTwoList.py
mergeTwoList.py
py
800
python
en
code
0
github-code
36
40056650925
from decouple import config import os class HTML_file: def __init__(self, group_name: str, measure: str) -> None: self.group_name = group_name self.measure = measure self.png_dir = os.path.join(config('root'), 'work/visual_graphs') def save_directory(self) -> str: return os.pa...
WMDA/SCN
SCN/visualization/create_html_view.py
create_html_view.py
py
3,593
python
en
code
0
github-code
36
34287760383
import random from xml.dom.minidom import parseString file=open('/home/med/Desktop/bioInfo.xml', 'r') data= file.read() dom=parseString(data) f = open('/home/med/Desktop/seedpopulation.txt', "w") PS=dom.getElementsByTagName('problemSize')[0].toxml() PopS=dom.getElementsByTagName('populationSize')[0].toxml() Probl...
dogatuncay/GA_Twister_Hadoop
docs/seedpopulation.py
seedpopulation.py
py
671
python
en
code
4
github-code
36
74647027303
import logging from igraph import Graph as iGraph from parvusdb import GraphDatabase from parvusdb.utils.code_container import DummyCodeContainer from parvusdb.utils.match import Match, MatchException from .node_matcher import VectorNodeMatcher _logger = logging.getLogger() class GraphMatcher: def __init__(sel...
fractalego/dgt
dgt/graph/graph_matcher.py
graph_matcher.py
py
1,990
python
en
code
2
github-code
36
44034009675
import sys from collections import deque n, k = map(int, sys.stdin.readline().split()) m = 100001 visited = [-1] * m check = [0] * m q = deque() visited[n] = 0 q.append(n) def path(x): move = [] temp = x for _ in range(visited[x] + 1): move.append(temp) temp = check[temp] ...
GluteusStrength/Algorithm
백준/Gold/13913. 숨바꼭질 4/숨바꼭질 4.py
숨바꼭질 4.py
py
675
python
en
code
0
github-code
36
26030329346
import os import sys #モジュール探索パス追加 p = ['../','../../'] for e in p: sys.path.append(os.path.join(os.path.dirname(__file__),e)) import discord from discord.ext import commands from discord import app_commands from cmmod.json_module import open_json from cmmod.time_module import get_currenttime from cmmod.discord_module...
rich-bread/bmdb_bot
menu/usermenu/apply_team.py
apply_team.py
py
5,802
python
ja
code
0
github-code
36
37225738128
import nilearn from nilearn.plotting import plot_carpet, plot_glass_brain, plot_anat, plot_stat_map, plot_design_matrix, plot_epi, plot_contrast_matrix from nilearn import image, masking, input_data import pandas as pd import numpy as np import matplotlib.pyplot as plt from nilearn.glm.first_level import make_first_lev...
tejas-savalia/fmri_project
util.py
util.py
py
4,890
python
en
code
0
github-code
36
16385745917
from torch.utils.data import Dataset import torch from PIL import Image from pathlib import Path import numpy as np from dataclasses import dataclass import random @dataclass class imageset: t1: Path t2: Path cm: Path @dataclass class patch: imset: imageset x: tuple y: tuple class CDDatase...
fzimmermann89/ml4rs
cd/ds.py
ds.py
py
6,007
python
en
code
0
github-code
36
6027026572
#Uppgift 3 """ Primtalsfaktorerna av 13195 är 5, 7, 13 och 29. Vilken är den största primtalsfaktorn av 600851475143? """ #Svar: 6857 num = 600851475143 factors = [] while num > 1: for i in range(2,num+1): if num % i == 0: num = int(num/i) factors.append(i) break print(factors)
WastPow/Sommarmatte-l-sningsf-rslag
Uppgift 3.py
Uppgift 3.py
py
310
python
sv
code
0
github-code
36
8755321415
# -*- coding: utf-8 -*- from odoo import fields, models, api line_sizes = [ ('medium', 'Moyen'), ('small', 'Petit'), ('smaller', 'Plus petit'), ('x-small', u'Très petit') ] class ResCompany(models.Model): _inherit = "res.company" use_of_custom_footer = fields.Boolean( string=u'U...
odof/openfire
of_external/models/of_company.py
of_company.py
py
3,872
python
en
code
3
github-code
36
18915198493
import pytest from src.maximum_twin_sum_of_a_linked_list import Solution from src.utils.linked_list import to_linked_list @pytest.mark.parametrize( "in_list,expected", ( ([5, 4, 2, 1], 6), ([4, 2, 2, 3], 7), ([1, 100_000], 100_001), ), ) def test_solution(in_list, expected): h...
lancelote/leetcode
tests/test_maximum_twin_sum_of_a_linked_list.py
test_maximum_twin_sum_of_a_linked_list.py
py
398
python
en
code
3
github-code
36
23425927839
import os from discord.ext import commands, tasks import motor.motor_asyncio import util.util from util.help import HelpCommand from util.setup import load_text, load_data, mod_data, get_files import discord import itertools bot = commands.Bot( command_prefix="!", # Change to desired prefix case_insensitive=T...
gritor111/bhv-bot
bot.py
bot.py
py
1,424
python
en
code
0
github-code
36
40843782656
from apivk.function_vk import vkinder from datetime import date from database.script_bd import check_users_vk, check_search_results, save_users_vk, save_search_results from botvk.function_botvk import write_msg, send_photo # определение статуса отношений def find_relation(search_user_id): res = vkinder.about_user...
beloglazovpl/VKinder
function_find/func.py
func.py
py
4,050
python
en
code
0
github-code
36
36407109164
""" This script is used for 'writing' songs in musical notation form, with recording of key downs and ups being used to define the time durations and delays of notes. Notes are shown line by line and a single key on your keyboard can be used to set the timing for each note in a song - of course, you'll need to know th...
cwylycode/dumptruck
python/musical_timing_recorder.py
musical_timing_recorder.py
py
4,076
python
en
code
4
github-code
36
42926082156
import tempfile import unittest import numpy as np import pandas as pd import pysam from hmnfusion import mmej_deletion from tests.main_test import Main_test class TestMmejDeletionMain(Main_test): @classmethod def load_records(cls, path: str): vcf_in = pysam.VariantFile(path) return [x for x ...
guillaume-gricourt/HmnFusion
tests/unit/test_mmej_deletion.py
test_mmej_deletion.py
py
9,961
python
en
code
0
github-code
36
39914551744
from fastapi import APIRouter, HTTPException, Request from utils.model import * from services.camera_service import camera_service from services.server_service import server_service import requests import threading router = APIRouter(prefix="/camera") @router.get("/{server_name}") async def get_camera(server_name: st...
ngocthien2306/be-cctv
src/router/camera_router.py
camera_router.py
py
4,936
python
en
code
0
github-code
36
43303341114
import py import random from collections import OrderedDict from hypothesis import settings, given, strategies from hypothesis.stateful import run_state_machine_as_test from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.lltypesystem import rordereddict, rstr from rpython.rlib.rarithmetic import ...
mozillazg/pypy
rpython/rtyper/test/test_rordereddict.py
test_rordereddict.py
py
22,081
python
en
code
430
github-code
36
1284010441
import socket import webbrowser s = socket.socket() host = 'localhost' # server address port = 9010 s.connect((host, port)) url = s.recv(1024) s.close webbrowser.open_new(url) s = socket.socket() host = 'localhost' port = 9010 s.bind((host, port)) s.listen(1) c, addr = s.accept() # Establish connecti...
hackandcode/sniffnlearn
OAuth/client.py
client.py
py
418
python
en
code
0
github-code
36
19909078329
def corpus_file_transform(src_file,dst_file): import os assert os.path.isfile(src_file),'Src File Not Exists.' with open(src_file,'r',encoding = 'utf-8') as text_corpus_src: with open(dst_file,'w',encoding = 'utf-8') as text_corpus_dst: from tqdm.notebook import tqdm text_co...
JackieChenssh/TC_VFDT_CRF
CRF.py
CRF.py
py
9,036
python
en
code
0
github-code
36
17134892000
# Packages import pandas as pd import os import json from gensim.utils import simple_preprocess from gensim.summarization.textcleaner import split_sentences from functools import reduce from fuzzywuzzy import fuzz ## Functions ## Returns marked html from iucn notes def find_country(text, country): '''Function to id...
ConMine/ConMine
Development/Code/sentence_tagging.py
sentence_tagging.py
py
4,876
python
en
code
0
github-code
36
22703377702
from __future__ import print_function import sys import xml.etree.ElementTree as ET import os sys.path.extend(['.', '..', './pycparser/']) from pycparser import c_parser, c_ast filehandle = open('dummy3.c', 'r') #filehandle = open('reverse_noinclude.c', 'r') #filehandle = open('reverse.c', 'r') text = ''.join(fileha...
lashgar/ipmacc
src/auxilaries/generate_oacc_ast.py
generate_oacc_ast.py
py
2,204
python
en
code
13
github-code
36
4480093655
import tkinter.messagebox import pandas as pd from tkinter import * from random import choice BACKGROUND_COLOR = "#B1DDC6" try: data = pd.read_csv("data/words_to_learn.csv").to_dict('records') except FileNotFoundError: data = pd.read_csv("data/english_russian_words.csv").to_dict('records') except pd.errors.E...
montekrist0/PythonBootCamp
day31/main.py
main.py
py
2,873
python
en
code
0
github-code
36
40727926981
import requests STEAMDB_SALE_URL = "https://steamdb.info/sales/?merged=true&cc=cn" class SaleRequester: def __init__(self): self.fake_header = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset': 'UTF-8,*;q=0.5', 'Accept-Enco...
KIDJourney/sbeamhub
crawler/requester.py
requester.py
py
779
python
en
code
0
github-code
36
1327922070
#!/usr/bin/env python # """ Name: Jesus Hernandez Partner: Zechariah Neak Email: jherna83@ucsc.edu Email: zneak@ucsc.edu ID: 1420330 Course: CMPM146 Game AI Professor: Daniel G Shapiro \\\\\\\ Program 4 ///...
JjayaitchH/BehaviorTrees
behavior_tree_bot/bt_bot.py
bt_bot.py
py
3,634
python
en
code
2
github-code
36
74574880744
def process(fileName): # Print data to console print("") print("-----------------------") print(fileName) print("-----------------------") # Read the open file by name inputFile = open(inputFilesDirectory + fileName + ".in", "rt") # Read file firstLine = inputFile.readline() ...
jaswanth001/Hashcode2020
filehandling.py
filehandling.py
py
1,517
python
en
code
0
github-code
36
29858374038
''' Created on 9 Apr 2019 @author: qubix ''' from typing import Tuple import numpy as np from sklearn.base import BaseEstimator from modAL.utils.data import modALinput from math import floor from asreview.query_strategies.max_sampling import max_sampling from asreview.query_strategies.random_sampling import rando...
syuanuvt/automated-systematic-review
asreview/query_strategies/rand_max.py
rand_max.py
py
3,622
python
en
code
null
github-code
36
27688294553
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('main', '0001_initial'), ] operations = [ migrations.AlterField( model_name='ima...
seanlinxs/content-console
main/migrations/0002_auto_20151201_1309.py
0002_auto_20151201_1309.py
py
681
python
en
code
0
github-code
36
31691135600
""" Module: libfmp.c8.c8s1_hps Author: Meinard Müller, Frank Zalkow License: The MIT license, https://opensource.org/licenses/MIT This file is part of the FMP Notebooks (https://www.audiolabs-erlangen.de/FMP) """ from collections import OrderedDict import numpy as np from scipy import signal import librosa...
christofw/pitchclass_mctc
libfmp/c8/c8s1_hps.py
c8s1_hps.py
py
8,127
python
en
code
20
github-code
36
26771069266
from pyowm import OWM from pyowm.utils import config from pyowm.utils import timestamps from config import owm_key owm = OWM(owm_key) mgr = owm.weather_manager() # info on looking up cities. #To make it more precise put the city's name, comma, 2-letter country code (ISO3166). You will get all proper cities in chosen ...
shelmus/owm_weather
weather_dictionary.py
weather_dictionary.py
py
1,164
python
en
code
0
github-code
36
483095221
import requests from time import sleep #听写单词扣词验证PRE环境 header={"Authorization":"Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIxNTYyNjI5MDYwMDc1MTAyMjA5Iiwic3ViIjoie1wiaWRcIjoxNTYyNjI5MDYwMDc1MTAyMjA5LFwibW9iaWxlXCI6XCIrODYxODM4NDI1MzUwNlwifSIsImV4cCI6MTcwMTY3NzU1M30.ByAdhAfbxwS5tTbkbSJIPJXN6bIrzoOjeWMwn6JA8pimm2v1fMTXVJfdX...
wengyuanpei/pandaInterfaceTest
testCase/TingXieWordsCheck.py
TingXieWordsCheck.py
py
4,624
python
en
code
0
github-code
36
73627488425
''' Dependencies: gettext, playsound installing $ pip install gTTS pyttsx3 playsound soundfile transformers datasets sentencepiece $ pip install playsound (may need to use "$ pip install --upgrade wheel" if install fails) ''' import gtts from playsound import playsound with open("sample.ini") as fileDescriptor: d...
vvMaxwell/U5L2
audio.py
audio.py
py
428
python
en
code
0
github-code
36
30568657844
import matplotlib.pyplot as plt import numpy as np plt.rcParams["text.usetex"] = True LEGEND_FONTSIZE = 20 TICK_LABEL_FONTSIZE = 20 AXIS_LABEL_FONTSIZE = 20 TITLE_FONTSIZE = 20 CHART_SIZE = [10, 6] LONG_CHART_SIZE = [10, 10] def do_nothing_Rt_plot(Rt_dict, fname=None, ps=True): fig, ax = plt.subplots(1, 1, figs...
jvanyperen/exploring-interventions-manuscript
plotting_scripts/do_nothing_plots.py
do_nothing_plots.py
py
3,549
python
en
code
0
github-code
36
6241790730
""" PRL 115, 114801 (2015) Please keep the Python style guide of PEP8: pep8.org. """ # %% import numpy as np from scipy.special import jv # %% # Constants C = 299792458 EV = 1.60217662e-19 # Machine parameters, to be checked from logbook C1 = 1 C2 = 0.87 lambdaFEL = 50.52e-9 + 0.07e-9 # Other parameters E0 = 1.1686...
DaehyunPY/FERMI_20149100
Scripts/phase_locked.py
phase_locked.py
py
2,821
python
en
code
0
github-code
36
2698417886
from django.shortcuts import render from markdown import markdown from .models import * from django.http import HttpResponseRedirect def forbid_zhihu(request): return render(request, 'forbidden_zhihu.html') def index_redirect(request): return HttpResponseRedirect('http://blog.alphamj.cn/') def index(reque...
w-mj/cloud-server
blog/views.py
views.py
py
2,222
python
en
code
0
github-code
36
70809120103
#!/usr/bin/python3 """ Started a Flask web application with these scripts the web apps was listed on 0.0.0.0, port 5000 declare @app.teardown_appcontext and storage.close() with routes /cities_by_states: display a HTML page: in my route def option strict_slashes=False was used """ from flask import ...
Realyoung1/AirBnB_clone_v2
web_flask/8-cities_by_states.py
8-cities_by_states.py
py
1,054
python
en
code
0
github-code
36
27193127483
from collections import namedtuple import re import string import logging import pickle class Files: dictionary = "dataset/nettalk.data" top1000words = "dataset/nettalk.list" continuous = "dataset/data" Word = namedtuple('Word', ['letters', 'phonemes', 'structure', 'correspondance']) all_letters = strin...
dtingley/netwhisperer
corpus.py
corpus.py
py
5,330
python
en
code
1
github-code
36
25314732697
def solution(a): min_val = min(a) left, right = 0, len(a)-1 left_min, right_min = float('inf'), float('inf') cnt = 0 while left < right: if a[left] < left_min: left_min = a[left] cnt += 1 if a[right] < right_min: right_min = a[right] cn...
soohi0/Algorithm_study
5월_4주/PRO_풍선터트리기/PRO_풍선터트리기_송영섭.py
PRO_풍선터트리기_송영섭.py
py
467
python
en
code
0
github-code
36
70806954663
import sys import heapq sys.stdin = open('input.txt') def sol(): h = [(0, A, C)] while h: weight, node, remain = heapq.heappop(h) if weights[node] <= weight: continue if node == B: return weight weights[node] = weight for next_weight, next_node...
unho-lee/TIL
CodeTest/Python/BaekJoon/20182.py
20182.py
py
852
python
en
code
0
github-code
36
9915784655
moves_number = int(input()) houses_str = input().split() houses = [int(house) for house in houses_str if 1 <= int(house) <= 500] current_position = 0 for move in range(moves_number): input_data = input().split() command = input_data[0] index = int(input_data[1]) if command == 'Forward': if (ind...
qceka88/Fundametals-Module
19 Exam Preparation - Mid Exam/02santas_gitfts.py
02santas_gitfts.py
py
4,492
python
en
code
8
github-code
36
2722149163
#! /usr/bin/env python """ Author: LiangLiang ZHENG Date: File Description """ from __future__ import print_function import sys import argparse class Solution(object): def combinationSum4(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ ...
ZhengLiangliang1996/Leetcode_ML_Daily
Search/377_CombinationSumIV.py
377_CombinationSumIV.py
py
762
python
en
code
1
github-code
36
70123923304
#! /usr/bin/env python from sortrobot.neural import Classifier, OrientationClassifier from PIL import Image import sys, os from optparse import OptionParser parser = OptionParser() parser.add_option("-o", "--outdir", dest="outdir", default=None, help="Directory to write sorted files. Default: same ...
AaronParsons/sortrobot
scripts/sr_sort_files.py
sr_sort_files.py
py
1,118
python
en
code
0
github-code
36
9862393543
import random from flask import Flask, render_template, request import tensorflow as tf import numpy as np from io import BytesIO from PIL import Image import base64 import os # initiates flask app app = Flask(__name__) tf.get_logger().setLevel('ERROR') model = None model = tf.keras.models.load_model("prod_model.h5...
joeschueren/SketchDetect
main.py
main.py
py
4,108
python
en
code
0
github-code
36
42528330524
import requests from bs4 import BeautifulSoup import re import json import sys import eventlet import concurrent.futures import Constants class Scraper: def __init__(self, url_to_check): self.BASE_URL = url_to_check self.dictionary = {} @staticmethod def get_html(url): try: ...
Hayk1997gh/Broken_Link_Checker
Scraper.py
Scraper.py
py
3,659
python
en
code
0
github-code
36
25983391444
#!/usr/bin/env python3 """Setup script.""" from setuptools import setup from setuptools.command.test import test as TestCommand import sys class PyTest(TestCommand): """Setup the py.test test runner.""" def finalize_options(self): """Set options for the command line.""" TestCommand.finalize_o...
schedutron/spaced-repetition
setup.py
setup.py
py
762
python
en
code
11
github-code
36
423347793
import numpy as np import yfinance as yf import ta import pandas as pd from ta.trend import ADXIndicator import pyxirr def get_clean_df(ticker): df = yf.Ticker(ticker).history( period="10y").reset_index()[["Date", "Close", "Dividends", 'High', "Low"]] df["Close"] = yf.download(tickers=ticker, period=...
victormorizon/stable-dividend-stock-trading-strategy
functions.py
functions.py
py
5,229
python
en
code
1
github-code
36
24669291411
import requests, json import pandas as pd import os from datetime import date #from mysql.connector import connect, Error from flatten_json import flatten from airflow.models import Variable ''' Connects to the edamam API and sends a request Return: The response object from the API query ''' def airflow_var_test( ti...
JoshusTenakhongva/Mentorship_Repo
food_at_home/dags/airflow_functions.py
airflow_functions.py
py
5,053
python
en
code
1
github-code
36
35217766012
from itertools import product import sys from bs4 import BeautifulSoup from selenium import webdriver import time import json import random sys.path.append('../..') from lib import excelUtils from lib import httpUtils from lib import textUtil from lib.htmlEleUtils import getNodeText from lib.htmlEleUtils import getInn...
Just-Doing/python-caiji
src/work/20230110/bio-fount.py
bio-fount.py
py
4,549
python
en
code
1
github-code
36
38097195752
import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt import numpy as np import pickle import time from os.path import exists from GaslightEnv import GaslightEnv from stable_baselines3 import PPO, TD3 from stable_baselines3.common.callbacks import CheckpointCallback from stable_baselines3.common.e...
RajatSethi2001/Gaslight
GaslightEngine.py
GaslightEngine.py
py
6,819
python
en
code
0
github-code
36
36728693283
s=input() s=list(s.split()) v='aeiouAEIOU' t='qwrtyplkjhgfdszxcvnm' c=0 for i in s: if(i[0] in v and i[len(i)-1] in t): c+=1 print(c)
21A91A05B8/codemind-python
count_words.py
count_words.py
py
150
python
en
code
0
github-code
36
2846510453
# Qus:https://practice.geeksforgeeks.org/problems/quick-sort/1 # User function Template for python3 class Solution: # Function to sort a list using quick sort algorithm. def quickSort(self, arr, low, high): # code here if(low >= high): return pi = self.partition(arr, low, ...
mohitsinghnegi1/CodingQuestions
Algorithms/Quick Sort .py
Quick Sort .py
py
1,677
python
en
code
2
github-code
36
8127811600
# Jogo de Craps. Faça um programa que implemente um jogo de Craps. O jogador lança # um par de dados, obtendo a soma entre 2 e 12. Se na primeira jogada você tirar 7 ou 11, # você ganhou. Se você tirar 2, 3 ou 12 na primeira jogada, isto é chamado de "craps" e # você perdeu. Se na primeira jogada você somou 4, 5, 6, 8,...
Galaxyvideok/SI-IFES
SI_IFES/python_PROG_I/P4ex09.py
P4ex09.py
py
2,014
python
pt
code
0
github-code
36
8676412955
# -*- coding: utf-8 -*- from odoo import fields, models class ProductTemplate(models.Model): _inherit = 'product.template' pr_active = fields.Boolean('Is Asset') asset_category_id = fields.Many2one( 'account.asset.category', string='Asset Category', company_dependent=True, ...
OpusVL/Odoo-Uk-Accounting
uk_account_asset/models/product.py
product.py
py
864
python
en
code
0
github-code
36
16515229074
import time from werkzeug.wrappers import Response import netmanthan import netmanthan.rate_limiter from netmanthan.rate_limiter import RateLimiter from netmanthan.tests.utils import netmanthanTestCase from netmanthan.utils import cint class TestRateLimiter(netmanthanTestCase): def test_apply_with_limit(self): n...
netmanthan/Netmanthan
netmanthan/tests/test_rate_limiter.py
test_rate_limiter.py
py
3,663
python
en
code
0
github-code
36
3784075084
############################################################################### # make park model ############################################################################### import cantera as ct import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import rmgpy from rmgpy.data.thermo im...
comocheng/meOH-analysis
External_data/park_et_al_model_reconstruction/make_park_model.py
make_park_model.py
py
14,690
python
en
code
0
github-code
36
32262924755
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('polls', '0011_response'), ] operations = [ migrations.RemoveField( model_name='question', name='weig...
mikelaughton/harold
polls/migrations/0012_auto_20160804_0005.py
0012_auto_20160804_0005.py
py
630
python
en
code
0
github-code
36
32846235212
#Goal of this project is to make a song that we like on youtube go directly to our spotify "liked youtube songs" playlist """ STEPS 1 - Log into youtube 2 - Grab our playlist 3 - Create a new playlist 4 - Search the song 5 - Add the song to the spotify playlist """ import json import os import google_auth_oauthlib.fl...
GiovaniCenta/YoutubetoSpotify
spotyoutube.py
spotyoutube.py
py
6,243
python
en
code
0
github-code
36
30176950739
from functools import cache def najcenejsa_pot(mat): m, n = len(mat), len(mat[0]) @cache def pomozna(i, j): if i == m - 1 and j == n - 1: return (mat[-1][-1], "o") else: moznosti = [] if i < m - 1: cena_dol, pot_dol = pomozna(i + 1, j) ...
matijapretnar/programiranje-1
13-memoizacija-v-pythonu/predavanja/pot.py
pot.py
py
772
python
en
code
6
github-code
36
27894781637
def search_kth_simple(a1, a2, k_req): i, j, k = 0, 0, 0 while i < len(a1) and j < len(a2) and k < k_req: if a1[i] < a2[j]: if k + 1 == k_req: return a1[i] i += 1 k += 1 else: if k + 1 == k_req: return a2[j] ...
stgleb/algorithms-and-datastructures
advanced/search_in_two_sorted.py
search_in_two_sorted.py
py
1,299
python
en
code
0
github-code
36
4014271672
# 문제 출처 : https://programmers.co.kr/learn/courses/30/lessons/12973 from collections import deque def solution(s): deq = deque(list(s)) # print(deq) stack = [] while deq: stack.append(deq.popleft()) if len(stack) > 1: if stack[-1] == stack[-2]: stack.pop() ...
ThreeFive85/Algorithm
Programmers/level2/removePair/remove_pair.py
remove_pair.py
py
442
python
en
code
1
github-code
36
40212915722
from chatbot import Chatbot messages=[ 'hi', 'i want to know something about the market', 'what about AAPL today', 'volume', 'the open price of TSLA and GOOG, please.', 'the interest of ABCDEF', 'MSFT', 'end' ] def static_test(interpreter): chatbot=Chatbot(interpreter) for msg ...
yuminhao107/chatbot4iexfinance
chatbot4iexfinance/static_test.py
static_test.py
py
361
python
en
code
0
github-code
36
2476057039
# 🚨 Don't change the code below 👇 print("Welcome to the Love Calculator!") name1 = input("What is your name? \n") name2 = input("What is their name? \n") # 🚨 Don't change the code above 👆 # Write your code below this line 👇 def true_count(name): true_count = 0 true_count += name.count("t") ...
devProMaleek/learning-python
day-3-conditional-statement/love-calculator.py
love-calculator.py
py
1,103
python
en
code
0
github-code
36
41844180206
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def oddEvenList(self, head): """ :type head: ListNode :rtype: ListNode """ if not head or not head.next or no...
zmxrice/leetcodetraining
328-Odd-Even-Linked-List/solution.py
solution.py
py
819
python
en
code
0
github-code
36
8754917915
# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, fields, api, _ from odoo.exceptions import UserError from odoo.osv.expression import NEGATIVE_TERM_OPERATORS, TERM_OPERATORS_NEGATION, TRUE_LEAF, FALSE_LEAF from odoo.tools.safe_eval import safe_eval impor...
odof/openfire
of_datastore_product/models/of_datastore_product.py
of_datastore_product.py
py
34,286
python
fr
code
3
github-code
36
35860587241
from fastapi import FastAPI, Depends from sqlalchemy.orm import Session from typing import List, Optional from database import SessionLocal, engine import models, schemas, crud # データベース作成 models.Base.metadata.create_all(bind=engine) app = FastAPI() def get_db(): db = SessionLocal() try: yield db ...
ishi23/fastapi-streamlit
conf_app_test/sql_app/main.py
main.py
py
3,816
python
en
code
0
github-code
36
27234809133
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys class Window(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle('Online whiteboard') self.setGeometry(100, 100, 800, 900) self.image = QImage(self.size(), QImage.Fo...
Azhar-ka29/whiteboard
main.py
main.py
py
6,169
python
en
code
0
github-code
36
19082484272
import cv2 import sys import numpy as np class Context: def __init__(self): self.sliders = {} self.toggles = {} self._redraw = False self.cur_buf_id = 0; self.buffers = [] self.buffers_by_name = {} self._once = [] self._store = {} cv2.namedWi...
Phaiax/sudoku
src/context.py
context.py
py
3,957
python
en
code
0
github-code
36
14054446569
import numpy as np import cv2 from .kalman import Kalman #https://github.com/uoip/monoVO-python def get_R(alpha): M = np.array([[np.cos(np.pi*alpha/180), np.sin(np.pi*alpha/180)], [-np.sin(np.pi*alpha/180), np.cos(np.pi*alpha/180)] ]) return M def show_direction(image, t, M): line_thic...
vvabi-sabi/drone_RK3588
addons/odometry/odometry.py
odometry.py
py
2,434
python
en
code
2
github-code
36
6172988761
from google.cloud import texttospeech from pydub import AudioSegment from pydub.playback import play google_credentials_file = "PATH_TO_YOUR_GOOGLE_CREDENTIALS_JSON" # Set the environment variable for Google Text-to-Speech API os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = google_credentials_file # Initialize Google...
qiusiyuan/gpt-live-stream
src/bilibiligptlive/tts.py
tts.py
py
1,133
python
en
code
0
github-code
36
23382530066
# -*- coding: utf-8 -*- import re import json import time import scrapy import requests import itertools from lxml import etree from hashlib import md5 from overseaSpider.items import ShopItem, SkuAttributesItem, SkuItem from overseaSpider.util.scriptdetection import detection_main from overseaSpider.util.utils import...
husky-happy/templatespider
overseaSpider/spiders/xg/samys.py
samys.py
py
6,903
python
en
code
0
github-code
36
30397052082
from os.path import join from typing import Optional from dagger.dag_creator.airflow.operator_creator import OperatorCreator from dagger.dag_creator.airflow.operators.redshift_sql_operator import ( RedshiftSQLOperator, ) class RedshiftLoadCreator(OperatorCreator): ref_name = "redshift_load" def __init__...
siklosid/dagger
dagger/dag_creator/airflow/operator_creators/redshift_load_creator.py
redshift_load_creator.py
py
6,239
python
en
code
7
github-code
36
71364721383
def qaq(): string = list(input()) n = len(string) count = 0 for i in range(0, n): for j in range(i+1, n): for k in range(j+1, n): if(string[i] == "Q" and string[j] == "A" and string[k] == "Q"): count += 1 print(count) if __name__...
humanolaranja/MC521
6/g/index.py
index.py
py
346
python
en
code
0
github-code
36
31524035648
import pandas as pd import numpy as np from typing import List from loguru import logger from meche_copilot.utils.num_tokens_from_string import num_tokens_from_string def combine_dataframe_chunks(dfs: List[pd.DataFrame]) -> pd.DataFrame: if all(df.shape[1] == dfs[0].shape[1] for df in dfs): return pd.conca...
fuzzy-tribble/meche-copilot
meche_copilot/utils/chunk_dataframe.py
chunk_dataframe.py
py
4,373
python
en
code
1
github-code
36
43777238511
import numpy as np import cv2 as cv import matplotlib.pyplot as plt import time MIN_MATCH_COUNT = 10 img_sample = cv.cvtColor(cv.imread("./img/dataset/9.png",cv.IMREAD_COLOR),cv.COLOR_BGR2GRAY) img_q = cv.cvtColor(cv.imread("./img/query/3.png",cv.IMREAD_COLOR),cv.COLOR_BGR2GRAY) sift = cv.SIFT_create() keypoints_1...
Laurie-xzh/AI-Practice
CV/Point_Feature_Match/test.py
test.py
py
2,845
python
en
code
0
github-code
36
2986533119
from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By import time from constants import URL def get_product_properties(browser): properties = {} search_result = browser.find_element(By.CLASS_NAME, "sooqrSearchResults") title = search_result.fin...
Felix-95/programming_challenge
src/scraper.py
scraper.py
py
3,238
python
en
code
0
github-code
36
72516592744
import time import datetime from timeit import default_timer as timer import settings from pymongo import MongoClient from faker import Faker from bson.decimal128 import Decimal128 import random fake = Faker() #### # Start script #### startTs = time.gmtime() start = timer() print("================================") p...
blainemincey/generate_sample_data
generate_transactions_data.py
generate_transactions_data.py
py
2,781
python
en
code
1
github-code
36
74643015143
from PyQt4.QtGui import QMainWindow,QListWidgetItem, QMessageBox, QTableWidgetItem, QInputDialog,QLineEdit, QFileDialog from Ui_MainWindow import Ui_MainWindow from Gramaticas.Producao import Producao from Gramaticas.Gramatica import Gramatica, ExcecaoConstruirGramatica from Automatos.Automato import Automato, ExcecaoM...
pdousseau/formal_language
src/Gui/MainWindow.py
MainWindow.py
py
37,282
python
pt
code
2
github-code
36
73325698663
from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn import tree import pydotplus iris = load_iris() iris_X = iris.data iris_Y = iris.target X_train, X_test, y_train, y_test = train_test_split( iris_X, iris_Y, test_size=0.3) clf = tree.DecisionTreeClassifier() c...
beancookie/sklearn
tree.py
tree.py
py
473
python
en
code
0
github-code
36
14029297694
import asyncio import datetime import os import discord from new_skyline2 import SKYLINE token = os.environ['token'] loop = asyncio.get_event_loop() client = SKYLINE(loop=loop, intents=discord.Intents.all()) async def main(): now = datetime.datetime.utcnow() endtime = now.replace(hour=17, minute=1, second=...
Kesigomon/Skyline_py
run.py
run.py
py
870
python
en
code
7
github-code
36
39157550873
#!/usr/bin/env python3 import click import sys from pathlib import Path from RecBlast.RecBlast import RecSearch import RecBlast.WarningsExceptions as RBWE def deduce_searchtype(query_type, db_type, search_algorithm): # a bit of cleaning query_type = query_type.lower() db_type = db_type.lower() search...
docmanny/smRecSearch
code/rbb.py
rbb.py
py
6,528
python
en
code
1
github-code
36
18394258634
class Solution: def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]: def matches_pattern(word, pattern): mapping1 = dict() mapping2 = dict() for i in range(len(word)): if word[i] not in mapping1: ma...
ileenf/Data-Structures-Algos
String/find_replace_pattern.py
find_replace_pattern.py
py
879
python
en
code
0
github-code
36
40376403155
import os, sys, re, string sys.path.append('../../framework') import bldutil progs = 'fftwave1dd cfftwave1dd cfftwave1in fftwave2p fftwave3p cfftwave2 cfftwave3 cfftexpmig2 fftexp0test fd2d cfftexp2 cfftexp2test fdtacc wcfftexp2 wcfftexp2adj cfftwave2nsps cfftwave2mix2 wavemixop lrosrtm2 lroslsrtm2 stack2d cstack2d ff...
gewala/mada
user/jsun/SConstruct
SConstruct
4,351
python
en
code
7
github-code
36
15826519032
import json import logging logging.basicConfig(level=logging.DEBUG) import argparse import uuid import emission.storage.decorations.user_queries as esdu import emission.net.ext_service.push.notify_usage as pnu import emission.net.ext_service.push.query.dispatch as pqd import emission.core.wrapper.user as ecwu import e...
e-mission/e-mission-server
bin/monitor/prompt_upgrade_to_latest.py
prompt_upgrade_to_latest.py
py
4,640
python
en
code
22
github-code
36
7813711056
"""clean up unused tables Create Date: 2022-05-02 17:19:09.910095 """ from alembic import op # revision identifiers, used by Alembic. revision = "20220502_171903" down_revision = "20220425_225456" branch_labels = None depends_on = None def upgrade(): op.drop_table("region_types", schema="aspen") op.drop_ta...
chanzuckerberg/czgenepi
src/backend/database_migrations/versions/20220502_171903_clean_up_unused_tables.py
20220502_171903_clean_up_unused_tables.py
py
1,530
python
en
code
11
github-code
36
36684803245
import pandas as pd import tekore as tk from config import CLIENT_ID, CLIENT_SECRET class SpotifyData: def get_one_song_data(self, query): token = tk.request_client_token(CLIENT_ID, CLIENT_SECRET) spotify = tk.Spotify(token) searched_track = spotify.search(query, types=('track',), market=...
SINEdowskY/spotify-songs-classification
spotify_data.py
spotify_data.py
py
3,351
python
en
code
1
github-code
36
23002903726
import sqlite3 connection = sqlite3.connect('databasePeças.db') c = connection.cursor() def CREATE(): # PEÇA # c.execute('CREATE TABLE IF NOT EXISTS PECA (\ `codigo` VARCHAR(5) NOT NULL,\ `nomeSingular` VARCHAR(25) NOT NULL,\ `nomePlural` VARCHAR(25) NOT NULL,\ `gene...
GilbertoMJ/Projeto-Andaimes
Scripts Banco de Dados/criar_database_Peça.py
criar_database_Peça.py
py
473
python
en
code
0
github-code
36
43110008124
from codecs import open from os import path import re from setuptools import setup, find_packages dot = path.abspath(path.dirname(__file__)) # get the dependencies and installs with open(path.join(dot, 'requirements.txt'), encoding='utf-8') as f: all_reqs = f.read().split('\n') install_requires = [x.strip() for ...
rarescosma/env.cloudy
setup.py
setup.py
py
1,466
python
en
code
0
github-code
36
2922309209
import numpy as np import json def dump_to_file(arrays, filename): arrays_for_dump = {} for key, array in arrays.items(): if isinstance(array, np.ndarray): arrays_for_dump[key] = array.tolist() else: arrays_for_dump[key] = array if isinstance(array, dict): try: for k,v i...
sdemyanov/tensorflow-worklab
classes/utils.py
utils.py
py
951
python
en
code
24
github-code
36
32637130659
from image import PGMImage import random from gaussian import convolve def apply_median_filter(image_pixels, filter_size): offset = filter_size // 2 output = [[0] * len(row) for row in image_pixels] for i in range(offset, len(image_pixels) - offset): for j in range(offset, len(image_pixels[0])...
charalampidi-gabriella/cs474-pa2
median.py
median.py
py
1,204
python
en
code
0
github-code
36
32259680615
# pylint: disable=W0613 from flask import request from injector import inject from app import app from app.regali_app.list.application.use_cases import ( get_gift_list, get_gift_lists, delete_gift_list, create_gift_list, delete_gift_list_element, create_gift_list_element ) from app.regali_app.s...
MikelDB/regali-app
api/app/regali_app/shared/infrastructure/routes/giftlist.py
giftlist.py
py
2,209
python
en
code
0
github-code
36