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
2807200688
# -*- coding: utf-8 -*- import sys sys.path.append('.') from src import * from joblib import Parallel, delayed from multiprocessing import cpu_count from multiprocessing import Pool from src.data import * from src.dataset.base import * from src.utils.util import * from src.utils.util_data import * from src.utils.u...
CGCL-codes/code_summarization_meta
src/dataset/unilang_dataloader.py
unilang_dataloader.py
py
4,080
python
en
code
0
github-code
1
17783054773
# -*- coding: utf-8 -*- """ v2.0 - 23-Feb-2017 Changes: (1) In perspective_transformation(): Corrected persective transformation source and destination points. (2) In edge_detect(): Corrected color conversion. (3) In detect_lanes() and opt_detect_lanes(): Corrected calculation of radii of curvature and vehicl...
gollaratti/advanced_lane_finding
advanced_lane_finding.py
advanced_lane_finding.py
py
26,579
python
en
code
0
github-code
1
32044848439
import requests, os import json import openpyxl import glob states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Mich...
nanites2000/lat_long_finder
lat_long_xls.py
lat_long_xls.py
py
2,455
python
en
code
0
github-code
1
14922024748
def mrw_url(debug=False): """ MRW URL connection :param debug: If set to true, use Envialia test URL """ if debug: return 'http://sagec-test.mrw.es/MRWEnvio.asmx' else: return 'https://sagec.mrw.es/MRWEnvio.asmx' def services(): services = { '0000': 'Urgente...
alexcano/acp
acp_mrw/mrw/utils.py
utils.py
py
1,030
python
en
code
3
github-code
1
36242862348
from django.shortcuts import render from django.views import View from django.urls import reverse_lazy from task_manager.tasks.models import Task from task_manager.tasks import forms from django.views.generic.edit import CreateView, UpdateView, DeleteView from task_manager.mixins import LoginRequiredMixin from django.u...
Labidahrom/task-manager
task_manager/tasks/views.py
views.py
py
2,134
python
en
code
1
github-code
1
16503325102
#!/usr/bin/env python import os import re import sys import bXML import stat import datetime import cStringIO import traceback try: import xattr kXattrAvailable= True except: kXattrAvailable= False def pathToList(path): elements= [] while True: (path, name)= os.path.split(path) elements.insert(0, name) if ...
marcpage/build
old/old/bManifest.py
bManifest.py
py
6,553
python
en
code
0
github-code
1
15644547901
# from datetime import datetime import httpx from django.http import JsonResponse API_BASE = "http://localhost:8080/api/v1" from django.views.decorators.http import require_GET @require_GET def pokemons_golang(request): with httpx.Client() as client: resp = client.get(API_BASE + "/pokemons/").json() ...
pliniomikael/django-go-performance
backend/pokemon/views/golang_api.py
golang_api.py
py
567
python
en
code
0
github-code
1
14006423986
#1- Girilen bir sayının 0-100 arasında olup oladdığını kontrol ediniz # x=int(input("Sayı: ")) # result=(0<x<100) # print(f"{x} sayısı o aralıkta mı : {result}") #2- Girilen bir sayının pozitif çift sayı olup olmadığını kontrol ediniz # x=int(input("Sayı: ")) # result=(x>0)and(x%2==0) # print(f"{x} sayısı pozi...
yasinkrc/SISTER_LAB_BTK
python-operatorleri/python-operatorleri-demo/logical-demo.py
logical-demo.py
py
2,770
python
tr
code
0
github-code
1
22743221263
from flask import Flask, Blueprint, render_template, request, send_file, redirect, url_for,session,json import os from jsot_to_csv import json_csv_conv app = Flask(__name__) json_csv = Blueprint('json-csv', __name__) app.config['UPLOAD_FOLDER'] = os.path.join(os.environ["USERPROFILE"], 'Desktop') @json_csv.route('/...
hsamvel/Flask_App
website/json_to_csv.py
json_to_csv.py
py
1,219
python
en
code
0
github-code
1
3178436922
import asyncio from dataclasses import dataclass from pathlib import Path from typing import Optional, Set, List, Tuple, Dict import aiosqlite from blspy import G1Element from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint32, uint64 from chia.util.lru_cache import LRUCache fro...
amuDev/Chia-Pooling
store.py
store.py
py
6,020
python
en
code
4
github-code
1
30674540922
dictt={} num=int(input("number")) for i in range(num): a=input("enter the name") b = input("enter the mark") dictt[a]=b lis=[] lis+=dictt.keys() lis.sort() for i in lis: print(i,":",dictt[i])
ABHINAND-OM/Python_programming
student.py
student.py
py
217
python
en
code
0
github-code
1
70352152674
import math import numpy as np from lii3ra.ordertype import OrderType from lii3ra.technical_indicator.average_true_range import AverageTrueRange from lii3ra.entry_strategy.entry_strategy import EntryStrategyFactory from lii3ra.entry_strategy.entry_strategy import EntryStrategy class AsymmetricAgainIntroSerialFactory(...
tranducquy/lii3ra
lii3ra/entry_strategy/asymmetric_again_introserial.py
asymmetric_again_introserial.py
py
7,989
python
en
code
0
github-code
1
13858043669
import logging import os from datetime import datetime from bson.objectid import ObjectId from celery import shared_task as task from celery.utils.log import get_task_logger from products.models import Product from utils.mongodb import mongo_db, mongo_update logger = get_task_logger(__name__) @task(name='jms_produ...
HASSINE-BENABDELAZIZ/ecommerce
products/tasks.py
tasks.py
py
2,738
python
en
code
0
github-code
1
15160318393
import os import subprocess from ssr.utility.logging_extension import logger from ssr.utility.os_extension import get_corresponding_files_in_directories from ssr.utility.os_extension import mkdir_safely def perform_pan_sharpening( pan_ifp, msi_ifp, ofp, resampling_algorithm="cubic" ): # https://gdal.org/progr...
SBCV/SatelliteSurfaceReconstruction
ssr/gdal_utility/pan_sharpening.py
pan_sharpening.py
py
2,660
python
en
code
75
github-code
1
19401162497
""" Write a Python program to calculate number of days between two dates. Note: try to import datetime module Sample dates : (2014, 7, 2), (2014, 7, 11) Expected output : 9 days """ from datetime import date d1 = date(2014, 7, 2) d2 = date(2014, 7, 11) nums = d2 - d1 print(nums.days)
kallykj/learnpython
FromW3resource/src/basic14.py
basic14.py
py
286
python
en
code
0
github-code
1
28106726008
################## # Author : Sooraj Bharadwaj # Date: 04/13/2022 ################# # IMPORTS import wikipedia as wk import json import tkinter as tk def randomPageGenerator(): """ This function generates a random page from the wikipedia. @param: None @return: json object with page and page.metadata ...
surajbharadwaj17/random-wiki
util.py
util.py
py
1,860
python
en
code
0
github-code
1
71405995554
#!/usr/bin/env python """ Table Docstring The Table class represents the control of the Turing Machine as the entire functional (edge) relation between some defined present state and the next target state. """ import math import copy from lib.State import State from typing import Set, List, Tuple from lib.controls...
dpozorski/TuringMachine
lib/controllers/table/Table.py
Table.py
py
8,791
python
en
code
0
github-code
1
12171467469
import torch import torch.nn as nn import numpy as np import math # Embeds each token in vocab into vector space. Simple lookup table. class TokenEmbedding(nn.Module): def __init__(self, vocab_size: int = 256, dim: int = 64) -> None: super(TokenEmbedding, self).__init__() self.dim = dim se...
VashishtMadhavan/transformers-scratch
embeddings.py
embeddings.py
py
1,363
python
en
code
1
github-code
1
10965292900
class BaseOp: def __init__(self, command, required_params, optional_params): self.command = command self.required_params = required_params self.optional_params = optional_params def check_parameters(self, parameters): # Check for required arguments required...
VisLab/hed-curation
curation/remodeling/operations/base_op.py
base_op.py
py
1,223
python
en
code
0
github-code
1
16557055085
# https://www.acmicpc.net/problem/17299 # Solving Date: 20.03.25. import sys read = sys.stdin.readline def solve(num_arr): # 1,000,000이 들어가기 위해서는 1이 포함되어야 한다. freq_arr = [0 for _ in range(1000001)] for index in num_arr: freq_arr[index] += 1 ans_arr = [-1 for _ in range(len(num_arr))] stac...
imn00133/algorithm
BaekJoonOnlineJudge/CodePlus/200DataStructure/Practice/baekjoon_17299.py
baekjoon_17299.py
py
1,069
python
en
code
0
github-code
1
72165751073
import os import numpy as np import cv2 import classifier from sklearn.model_selection import train_test_split from modelevaluation import load_rep_images import matplotlib.pyplot as plt # set constants args = { "images_per_category": 10000, "num_categories": 43, "testing_data_directory": "gtsrb-testin...
drwiggle/GTSRB-CNN
imgenhmodeltesting.py
imgenhmodeltesting.py
py
13,101
python
en
code
0
github-code
1
31563521269
#!/usr/bin/env python import time ''' import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) p = GPIO.PWM(12, 50) p.start(0) delay = 3 try: while True: p.ChangeDutyCycle(5) # turn left towards -90 degree p.stop() time.sleep(delay) # sleep 1 second p.ChangeDuty...
baojason/myPi
servo/basicMove.py
basicMove.py
py
1,913
python
en
code
0
github-code
1
4365606556
import logging import os import re import signal import sys from typing import Callable, List, TYPE_CHECKING, Union import dill as pickle from oletools.olevba import VBA_Parser from oletools.thirdparty.oledump.plugin_biff import cBIFF from symbexcel.excel_wrapper import ExcelWrapper, parse_excel_doc from .boundsheet ...
ucsb-seclab/symbexcel
symbexcel/simulation_manager.py
simulation_manager.py
py
10,078
python
en
code
13
github-code
1
32263332838
import numpy as np from arpym.tools.cpca_cov import cpca_cov from arpym.tools.pca_cov import pca_cov from arpym.tools.gram_schmidt import gram_schmidt def transpose_square_root(sigma2, method='Riccati', d=None, v=None): n_ = sigma2.shape[0] if np.ndim(sigma2) < 2: return np.squeeze(np.sqrt(sigm...
Akshaykurup97/Quantitative-Finance-Python
Tools/transpose_square_root.py
transpose_square_root.py
py
1,165
python
en
code
0
github-code
1
30036752761
# pylint: disable = missing-module-docstring from .feature_params import FeatureParams from .split_params import SplittingParams from .train_params import TrainingParams from .square_transformer_params import SquareTransformerParams from .train_pipeline_params import ( read_training_pipeline_params, TrainingPi...
made-mlops-2022/denis_shibitov
ml_project/entities/__init__.py
__init__.py
py
818
python
en
code
0
github-code
1
8559402635
import os from time import sleep import re command0 ='adb shell ime list -s' command1 ='adb shell settings get secure default_input_method' command2 ='adb shell ime set com.android.inputmethod.latin/.LatinIME' command3 ='adb shell ime set io.appium.android.ime/.UnicodeIME' def list_IME(): "列出系统现在所...
Eternity-ZYQ/airtest_demo
util/adb_common.py
adb_common.py
py
7,025
python
en
code
0
github-code
1
28394755159
""".vscode/settings.json file constants.""" # region .vscode/settings.json Constants from src.constants.pylintrc import PYLINTRC_FILENAME from src.constants.pyproject_toml import PYPROJECT_TOML_FILENAME from src.constants.shared import REPO_NAME VSCODE_SETTINGS_JSON_FILENAME = ".vscode/settings.json" REPO_IGNORE_PATTE...
mrlonis/utility-repo-scripts
src/constants/vscode_settings.py
vscode_settings.py
py
6,809
python
en
code
1
github-code
1
26632692086
class TreeNode: def __init__(self, data, leftChild = None, rightChild = None) -> None: self.data = data self.leftChild = leftChild self.rightChild = rightChild class BinarySearchTree: rootNode: TreeNode def __init__(self, node: TreeNode = None) -> None: self.rootNod...
codehub-kirans/dsa-python
BinarySearchTree.py
BinarySearchTree.py
py
2,016
python
en
code
1
github-code
1
13005074253
# This file is part of PAINTicle. # # PAINTicle is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # PAINTicle is distributed in the hop...
FrankFirsching/PAINTicle
painticle/sim/frictionstep.py
frictionstep.py
py
2,201
python
en
code
36
github-code
1
16165070884
import numpy as np from enum import Enum from udacidrone import Drone import time visdom_available= True try: import visdom except: visdom_available = False class PlaneMode(Enum): """ Constant which isn't defined in Mavlink but useful when dealing with the airplane simulation """ SUB_MODE_...
telmo-correa/FCND-FixedWing
plane_drone.py
plane_drone.py
py
5,420
python
en
code
4
github-code
1
41934364351
states = {} state = '.' checksum = 0 tape = {} def parseFile(content): global states, state, checksum content = content.split('\n\n') state = content[0][15] checksum = int(content[0].split()[9]) for s in content[1:]: part = s.split(':') instructionsZero = part[2].split('-') ...
Benbb96/adventofcode
python/2017/day25/day25.py
day25.py
py
1,846
python
en
code
0
github-code
1
12533484804
#!/usr/bin/env python3 """ Base64 encode an image and output the element based on the specified format. Usage: Base64_encode.py [options] [image] """ import argparse import base64 import sys import tempfile from urllib.parse import urlparse import requests parser = argparse.ArgumentParser(description=__doc__) p...
bblinder/home-brews
base64_encode.py
base64_encode.py
py
4,167
python
en
code
0
github-code
1
27006863196
class Solution(object): """docstring for Solution""" def isPalindrome(self, x): string = str(x) n = len(string) beginning = 0 ending = n - 1 while beginning < ending: if string[beginning] != string[ending]: return False beginning += 1 ending -= 1 return True solution = Solution() resu...
yiqin/HH-Coding-Interview-Prep
Use Python/PalindromeNumber.py
PalindromeNumber.py
py
371
python
en
code
3
github-code
1
4570861705
r = 1 while r == 1: cadena = input("Digite la cadena a reducir: ") lon = len(cadena) i = 0 if cadena.isalpha() and cadena.islower(): while True: lon1 = len(cadena) for i in range(len(cadena)): if i < (len(cadena)-1): if ca...
Daniel-HS3/Campus
códigos clases/mios/cadena de strings/reduccion_cadena.py
reduccion_cadena.py
py
980
python
en
code
0
github-code
1
36364918583
#!/usr/bin/env python __author__ = 'danielcarlin' import pandas import scipy.stats import numpy.random from optparse import OptionParser from theano_maskedRBM import makeMatricesAgree import operator from math import fabs def corr_matrices(data_in,rbm_out,spearman=True): """Take two matrices and return the correl...
decarlin/RIGGLE
scripts/post_rbm_analysis.py
post_rbm_analysis.py
py
3,800
python
en
code
0
github-code
1
43618923048
import asyncio import sys from room import ChatRoom def main(argv): name = argv[1] if len(argv) >= 2 else "AChat" port = int(argv[2]) if len(argv) >= 3 else 9999 loop = asyncio.get_event_loop() chat_room = ChatRoom(name, port, loop) server = chat_room.run() loop.run_forever() if __name__ ...
Nef1k/AsyncChat
main.py
main.py
py
354
python
en
code
1
github-code
1
9758744512
import sys import traceback import zipfile from array import * import re as regEx import random import socket import struct import ipaddress import subprocess import os from datetime import datetime import time import logging # Regex strings for all it should search for in the files ipv4Pattern = regEx.compile(r'(25[...
Cripyy/Random-scripts
washingscript.py
washingscript.py
py
32,410
python
en
code
0
github-code
1
32212352055
import purchase import utils.queries as queries #Function that will take user input on how to order our clothing articles (for print-out) #After it calls orderBy, this function will call purchase if input is valid. Input will be the clothing ID of the article of clothing you want to buy def viewAndPlace(connection, cu...
jcprice12/PythonDB
prompts/browse.py
browse.py
py
1,287
python
en
code
0
github-code
1
74872598754
"""SQLAlchemy one-to-many relationship with multiple foreign keys. https://avacariu.me/writing/2019/composite-foreign-keys-and-many-to-many-relationships-in-sqlalchemy """ from pathlib import Path from typing import List from sqlalchemy import ( Column, ForeignKey, ForeignKeyConstraint, Integer, ...
Pitrified/recipinator
backend/be/notebooks/relation/one_to_many_sa_dup.py
one_to_many_sa_dup.py
py
2,922
python
en
code
0
github-code
1
9152596133
import pytest from django.test import RequestFactory from mixer.backend.django import mixer from apps.core.views import ResubscribeView pytestmark = pytest.mark.django_db class TestResubscribe: def test_auth_resubscribe_with_payments(self): profile = mixer.blend('core.Profile') mixer.blend('core...
oadiazp/erpsomosmas
apps/core/tests/test_views/test_resubscribe.py
test_resubscribe.py
py
628
python
en
code
0
github-code
1
20681551463
""" Perform quick baseline benchmarck based on bag of words for sentiment analysis Author: Pham Quang Nhat Minh (FTRI) """ import os import sys import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn import metrics from sklearn import c...
minhpqn/sentiment_analysis_vlsp_2016
bow_baseline.py
bow_baseline.py
py
3,409
python
en
code
0
github-code
1
33352868921
# Services import logging from typing import List # Own from arq_server.base.ArqErrors import ArqError from arq_server.services.CoreService import Configuration,Base from arq_server.services.support.SecurityTools import Security class NormalizeSelector: # Services TIPS __logger: logging.Logger __config: Co...
RafaelGB/pythonScripts
Arquitectura/arq_server/services/protocols/logical/NormalizeSelector.py
NormalizeSelector.py
py
4,989
python
en
code
0
github-code
1
37240069738
import pathlib import sys module_dir = pathlib.Path(__file__).parent.resolve() root_dir = module_dir.parent model_dir = root_dir.joinpath("models") asvlite_wrapper_dir = root_dir.joinpath("dependency", "ASVLite", "wrapper", "cython") sys.path.insert(0, str(asvlite_wrapper_dir)) import os.path import math import multipr...
resilient-swarms/StormExplorers
source/rudder_controller.py
rudder_controller.py
py
11,698
python
en
code
0
github-code
1
29786504578
import cv2 import numpy as np import matplotlib.pyplot as plt import os import csv import pandas as pd from PIL import Image #root = '/home/miplab/data/Kaggle_Eyepacs/train/train_full' #save_path = '/home/miplab/data/Kaggle_Eyepacs/train/train_full_CLAHE' #annotations_path = '/home/miplab/data/Kaggle_Eyepacs/train/tra...
JustinZorig/fundus_anomoly_detection
clahe_preprocessing.py
clahe_preprocessing.py
py
1,778
python
en
code
0
github-code
1
3659734414
from abc import ABCMeta from nlpype.objects import cache from nlpype.objects.core_token import CoreToken class HasTokens(metaclass=ABCMeta): """ Module for CoreNLP objects that have tokens """ def __getitem__(self, index): """ Accesses a token by index :param index: The index...
adoxography/nlpype
nlpype/objects/has_tokens.py
has_tokens.py
py
1,569
python
en
code
0
github-code
1
21542111875
import os import time import torch from argparse import ArgumentParser from MemSE.nas import DataloadersHolder, ResNetArchEncoder from MemSE.training import RunManager, RunConfig from ofa.model_zoo import ofa_net from MemSE.nn import OFAxMemSE, FORWARD_MODE, MemSE from MemSE import ROOT parser = ArgumentParser() parse...
sebastienwood/MemSE
experiments/conference_2/ofa_early_tests/ofa_overhead.py
ofa_overhead.py
py
2,230
python
en
code
10
github-code
1
43312588716
import sys import requests from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.options import Options def get_all_ids_ujz(category="most-popular", page_number="1"): url = "https://www.youjizz.com/" + category + "/" + page_number + ".html" headers = { 'Cookie':...
naderjlyr/yt-downloader-back
downloads/view/adult/youjizz.py
youjizz.py
py
3,353
python
en
code
0
github-code
1
597656300
import os import time import cv2 import itertools import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt from tensorflow.keras.optimizers import Adam import tensorflow.keras.applications.inception_v3 as inception_v3 import tensorflow.keras.applications.inception_resnet_v2 as inception_resnet_v2 impo...
Otazz/KaggleOSIC
network.py
network.py
py
8,241
python
en
code
1
github-code
1
36831378034
MINUS_INFINITY = -10000000000 class Heap: def __init__(self, A): self.size = A[0] self.heap = [x for x in A] # copy def swap(self, x, y): t = self.heap[x] self.heap[x] = self.heap[y] self.heap[y] = t def left(self, i): return i * 2 def right(self, i):...
EvergreenHZ/See-Let-Pointer-Fly
py/Heap/heap.py
heap.py
py
1,505
python
en
code
0
github-code
1
22290561342
from typing import Any, Dict, Optional import httpx from ...client import Client from ...models.mediation_grant import MediationGrant from ...types import Response def _get_kwargs( mediation_id: str, *, client: Client, ) -> Dict[str, Any]: url = "{}/mediation/requests/{mediation_id}/grant".format(cl...
Indicio-tech/acapy-client
acapy_client/api/mediation/post_mediation_requests_mediation_id_grant.py
post_mediation_requests_mediation_id_grant.py
py
2,755
python
en
code
6
github-code
1
11645330285
# -*- coding: utf-8 -*- import scrapy import sqlite3 from ..items import HvgarticleItem class HvgarticlesSpider(scrapy.Spider): name = 'hvgarticles' allowed_domains = ['hvg.com'] conn = sqlite3.connect(r'C:\Users\Athan\OneDrive\Documents\Dissertation\Python\webscraperorigo\url.db') curr = conn.cursor()...
AJszabo/dissertation
hvgarticle/hvgarticle/spiders/hvgarticles.py
hvgarticles.py
py
2,330
python
en
code
0
github-code
1
29388029674
__author__ = 'piyush' k = int(input()) x = [] z = [] for i in range(k): x.append([int(i) for i in input().split()]) z.append(int(input())) for i in range(k): sum = 0 a = list(str(z[i])) total = 0 for j in range((x[i][0]-x[i][1])+1): temp = 1 for l in range(j,j+x[i][1]): ...
piyushmaurya23/computation
ProjectEuler/pe08.py
pe08.py
py
423
python
en
code
0
github-code
1
42292475980
import torch import torch.nn as nn # Import the skrl components to build the RL system from skrl.models.torch import Model, GaussianMixin, DeterministicMixin from skrl.memories.torch import RandomMemory from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG from skrl.resources.schedulers.torch import KLAdaptiveRL f...
abmoRobotics/isaac_rover_2.0
omniisaacgymenvs/train.py
train.py
py
7,235
python
en
code
13
github-code
1
8155749303
n = int(input()) matrix = [[int(i) for i in input().split()] for j in range(n)] k = int(input()) top, bottom = 0, 0 for i in range(n): for j in range(n): if j > n - i - 1: bottom += matrix[i][j] elif j < n - i - 1: top += matrix[i][j] balance = abs(top - bottom) print('YES' if balance <= k else 'N...
nhikiu/PYTHON-PTIT
PY02040_MA_TRAN_2.PY
PY02040_MA_TRAN_2.PY
py
344
python
en
code
0
github-code
1
24495933626
import matplotlib.pyplot as plt def visualize_data(title,ylabel,xlabel): plt.scatter(x_train, y_train, marker='x', c='r') # Set the title plt.title(title) # Set the y-axis label plt.ylabel(ylabel) # Set the x-axis label plt.xlabel(xlabel) plt.show()
JeremiahTheFirst/MachineLearningClasses
Python_Coursera/SecondWeek/visualize_data.py
visualize_data.py
py
287
python
en
code
0
github-code
1
74539482592
import errno from tempfile import TemporaryDirectory from unittest.mock import patch import escapism import pytest import docker from repo2docker.__main__ import make_r2d from repo2docker.app import Repo2Docker from repo2docker.utils import chdir def test_find_image(): images = [{"RepoTags": ["some-org/some-rep...
jupyterhub/repo2docker
tests/unit/test_app.py
test_app.py
py
4,565
python
en
code
1,542
github-code
1
31343094774
import math from django.shortcuts import render # Create your views here. from django.views import View from goods.models import * from django.core.paginator import Paginator from django.http.response import HttpResponseBase # 主页显示 class IndexView(View): def get(self, request, cid=1, num=1): # 所有通过url位置传...
yimin12/A_GeniusShopping
goods/views.py
views.py
py
3,228
python
en
code
0
github-code
1
16845073288
import threading import time import logging import serial import pynmea2 log = logging.getLogger('gnss') class GnssThread(threading.Thread): def __init__(self, q, NMEAPort): threading.Thread.__init__(self) self.q = q self.NMEAPort = NMEAPort self.live = True self.nmea = Non...
jcrawfordor/cellscan
cellscan/gnss.py
gnss.py
py
1,186
python
en
code
25
github-code
1
34707942970
"""Adds versioning `User.authorized` Revision ID: ee3c6c0702a6 Revises: 0fbbcf5eb614 Create Date: 2021-10-04 03:41:16.571947 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ee3c6c0702a6' down_revision = '0fbbcf5eb614' branch_labels = None depends_on = None d...
jshwi/jss
migrations/versions/ee3c6c0702a6_adds_versioning_user_authorized.py
ee3c6c0702a6_adds_versioning_user_authorized.py
py
676
python
en
code
4
github-code
1
40938897743
import os, shutil, random # preparing the folder structure full_data_path = 'data/obj/' extension_allowed = '.png' split_percentage = 80 # Create the directory for all the images images_path = 'data/images/' if os.path.exists(images_path): shutil.rmtree(images_path) os.mkdir(images_path) # Create the directory ...
agossouema2011/WCEBleedGenChallenge_Colorlab_Team
Detection/YOLO/split_data.py
split_data.py
py
2,302
python
en
code
0
github-code
1
20005255793
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isSameTree(self,p,q): if not p and not q: #如果两个都能最后取到没有数值的情况。 return True if p and q and p.val == q.val: x = self.isSameTree(p.left,q.left)#p和...
chenyingxue0124/pythonFiles
balanced binary tree.py
balanced binary tree.py
py
606
python
en
code
0
github-code
1
1579619363
import matplotlib.pyplot as plt import torch.nn.functional as F import argparse import torch import os def calc_accuracy(model, data_loader, device): correct_pred = 0 instance_count = 0 with torch.no_grad(): model.eval() for x, y in data_loader: x, y = x.to(device), y.to(devic...
shaynaor/AlexNet_PyTorch
utils.py
utils.py
py
4,336
python
en
code
1
github-code
1
12078882865
# All Submatrices Sum - From Top-Left # The program must accept an integer matrix of size R*C as the input. The program must find all possible submatrices starting from the top-left cell of the given matrix. Then the program must print the sum of each submatrix as shown in the Example Input/Output section. # Hint: Opt...
Logesh08/Programming-Daily-Tests
All Submatrices Sum - From Top-Left.py
All Submatrices Sum - From Top-Left.py
py
1,531
python
en
code
0
github-code
1
26385352063
from django.shortcuts import render from django.contrib import messages from .models import Contact def home(request): return render(request, 'home/home.html') def about(request): name = 'Foyez Ahammad' skill = ' Git & Github, Django, MySQL, Basic Front-End (HTML, CSS, JS, Bootstrap), Django REST Framew...
foyez-ahammad/django-practices
SHOP/home/views.py
views.py
py
1,233
python
en
code
1
github-code
1
71344922594
from django.core.paginator import Paginator, EmptyPage from django.core.serializers import serialize from django.shortcuts import render, redirect, reverse, get_object_or_404 from django.views import View from django.contrib.auth.mixins import LoginRequiredMixin from .forms import CreateOfferForm from companies.m...
cyber-tatarin/crossm
crossm/offers/views.py
views.py
py
11,407
python
en
code
0
github-code
1
36453941273
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param A : root node of tree # @param B : integer # @return an integer def hasPathSum(self, root, B): if root: if not root.left and not root.right and root.val == B: ...
SaiChandraCh/IB
src/week_7/day_29_trees_III/h_w/2_path_sum.py
2_path_sum.py
py
984
python
en
code
0
github-code
1
71793474913
#!/usr/bin/env python # GoodFET SPI and SPIFlash Client Library # # (C) 2009 Travis Goodspeed <travis at radiantmachines.com> # # This code is being rewritten and refactored. You've been warned! import sys, time, string, cStringIO, struct, glob, serial, os; from GoodFET import GoodFET; class GoodFETSPI(GoodFET): ...
pwnieexpress/raspberry_pwn
src/pentest/goodfet/GoodFETSPI.py
GoodFETSPI.py
py
4,193
python
en
code
1,000
github-code
1
43565136672
from django.conf import settings from django.utils.translation import ugettext_lazy as _ def robots(request): return {'ROBOTS_NOINDEX': getattr(settings, 'ROBOTS_NOINDEX', False)} def google_analytics(request): key = 'GOOGLE_ANALYTICS_TRACKING_ID' return {key: getattr(settings, key, False)} def ribbon...
colab/colab
colab/home/context_processors.py
context_processors.py
py
675
python
en
code
23
github-code
1
27563063563
"""The Number Guess Game: Randomly roll a pair of dice Add the values of the roll Ask the user to guess a number Compare the user's guess to the total value Decide a winner (the user or the program) Inform the user who the winner is""" from random import randint from time import sleep from sys import stdout ...
melamri/Python_Applications
04 Functions/Number_Guess.py
Number_Guess.py
py
4,498
python
en
code
1
github-code
1
5410461819
from datetime import datetime, timezone import json import logging from math import ceil from slugify import slugify from flask import Response, request from flask_camp import current_api, allow from sqlalchemy.sql.functions import func from werkzeug.exceptions import BadRequest from c2corg_api.search import Document...
c2corg/c2c_api-poc
c2corg_api/views/sitemap.py
sitemap.py
py
8,364
python
en
code
0
github-code
1
14467288238
import numpy as np from sklearn import metrics import matplotlib.pyplot as plt from kmeans import * from minibatchkmeans import * from gmm import * from Dense_AutoEncoder import * from CNN_AutoEncoder_TSNE import * # load the data data1 = np.load(r'kmnist-train-imgs.npz') data2 = np.load(r'kmnist-train-labels.npz') tr...
Mateguo1/KMNIST
cluster/main.py
main.py
py
3,316
python
en
code
0
github-code
1
31222889355
from chinese_reconstructions.baxter_sagart.reconstructions import reconstructions from chinese_reconstructions.cjk_punctuations import puncutation_dict def get_reconstruction(char): if char in puncutation_dict: converted = puncutation_dict[char] return converted, converted, converted, converted ...
SerenePity/ClassicsBot
chinese_reconstructions/baxter_sagart/parser.py
parser.py
py
620
python
en
code
0
github-code
1
12640380193
import xml.etree.ElementTree as ET from capas_proyecto.acceso_a_datos.comprobar_long_dict import contar_canciones_xml def crear_dicc_nombre_ruta(RUTA_XML): try: arbol = ET.parse(RUTA_XML) except FileNotFoundError: exit("El nombre del archivo XML no es correcto.") except ET.ParseError: ...
DanielFernandezR/vlc-random-playlist
capas_proyecto/acceso_a_datos/api.py
api.py
py
813
python
es
code
0
github-code
1
72243807394
from apple import Apple from board import Board from snake import Snake from algorthim import DFS import pygame from constants import GAME,SNAKE,APPLE,COLOR,SCALE import time import random from a import * #GAMELOOP class Game: def __init__(self, display): self.display = display #instance self.s...
adambenaceur/AutonomousSnake
run.py
run.py
py
2,793
python
en
code
0
github-code
1
18407056756
def two_sum_ii(nums, target): # since the array is sorted, our task is easier # 2 pointer approach left = 0 right = len(nums)-1 while left <= right: if nums[left] + nums[right] < target: left += 1 elif nums[left] + nums[right] > target: right -= 1 el...
danishakh/leet-code-practice
167-two-sum-ii/two-sum-ii.py
two-sum-ii.py
py
426
python
en
code
0
github-code
1
1411007300
#!/usr/bin/env python """ Using the spectrum graph to infer peptides. Given: a list L (of length at most 100) containing positive real numbers. Return: the longest protein string that matches the spectrum graph of L (if multiple solutions exist, you may output any one of them). Consult the mono...
savanto/bio
sgra.py
sgra.py
py
1,918
python
en
code
0
github-code
1
35196334080
from direct.gui.OnscreenImage import OnscreenImage from pandac.PandaModules import TransparencyAttrib from direct.gui.OnscreenText import OnscreenText from direct.showbase.DirectObject import DirectObject from pandac.PandaModules import TextNode from gui.GUIOrder import GUIOrder from event.InventoryEvent import AmmoCh...
czorn/Modifire
net/modifire/hud/HUDBottomRight.py
HUDBottomRight.py
py
2,563
python
en
code
0
github-code
1
36975188047
# -*- coding: cp1252 -*- import io import os import sys import time import misctools import stringtools class Apho: def __init__( self ): self.thous = [] # list of pair (sentence, author) self.aCountSaid = [] # for each sentence, number of said time self.aLastSaid = [] # time of last sai...
alexandre-mazel/electronoos
alex_pytools/apho.py
apho.py
py
13,380
python
fr
code
2
github-code
1
30881821467
from aws_cdk import core from aws_cdk import aws_ecs, aws_ec2 class LoadTestStack(core.Stack): def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None: super().__init__(scope, construct_id, **kwargs) vpc = aws_ec2.Vpc(self, "CDK_loadtester", max_azs=2) cluster = ...
edreinoso/terraform_infra_as_code
cdk/load-test/load_test/load_test_stack.py
load_test_stack.py
py
961
python
en
code
0
github-code
1
26219494731
import tvm import tvm.relay as relay import tvm.relay.testing as testing from graphviz import Digraph import os from collage.utils import get_backend_from_backend_pattern_annotation def _traverse_expr(node, node_dict): if node in node_dict: return if isinstance(node, tvm.ir.op.Op): return ...
mikepapadim/collage-non-tvm-fork
python/collage/analysis/visualize.py
visualize.py
py
4,763
python
en
code
1
github-code
1
7514762557
import numpy as np from pathlib import Path import numpy import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.layers import Dense, Activation, Bidirectional, Reshape, Conv2D, MaxPooling2D,TimeDistributed, LSTM class SelfAttention(tf.keras.layers.Layer): def...
ashwani-adu3839/Automatic-Speech-Recognition
Speech-Recognition-CTC-decoder/self_attention_encoder.py
self_attention_encoder.py
py
5,866
python
en
code
0
github-code
1
20256873011
try: import fraction except ImportError as exc: print(exc) def addFractions(): ''' addFractions()=adds two fractions together @param numerator, denmoinator, numerator2, denominator2=numerators and denominators of the fractions @param balor=object holding fractions @param added=sum of the two fractions print...
haoknowah/OldPythonAssignments
Gaston_Noah_NKN328_Hwk19/030_addFractions.py
030_addFractions.py
py
1,422
python
en
code
0
github-code
1
13210877907
import numpy as np import matplotlib.pyplot as plt class differential: """Solver of differential equations using RK4. diffEq should be a function with the differential equation that returns acceleration. All variables inside diffEq must be global""" def __init__(self, diffEq, plot_str, dt=0.01, T=2...
simehaa/University
fys2130/project.py
project.py
py
2,477
python
en
code
0
github-code
1
32278157428
import sqlite3 as sql import numpy as np import pandas as pd import pickle import os import joblib import onnx import onnxruntime as rt import torch filename = "./svm_iris.onnx" PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) rf_model_loaded = onnx.load(os.path.join(PROJECT_ROOT, "static/rf_...
AlexeyKlimov-git/Innopolis-ML-course
test_predict_model.py
test_predict_model.py
py
1,401
python
en
code
0
github-code
1
70144313955
# Objetivo: mostrar en pantalla los 20 primeros numeros enteros # #Algoritmo: # 1. Mostrar el num 1 # 2. Mostrar el num 2 # . ... # 3. Finalizar cuando los 20 numeros han sido mostrados # #Traduccion # print(1) # print(2) # ... # print(20) # Primera Variante: range(limSuperior) -> LimInferior: 0, Avance: 1 (por de...
gcarvajal-sjc/Ciclo1_LMEF
Clase8/ejemplosBasicosCiclos.py
ejemplosBasicosCiclos.py
py
786
python
es
code
0
github-code
1
71223851555
from pprint import pprint class Solution: def minDistance(self, word1: str, word2: str) -> int: x = len(word1) + 1 y = len(word2) + 1 memo = [[0]*y for i in range(x)] for i in range(x): for j in range(y): if i == 0: memo[i][j] = j ...
civilian/competitive_programing
leetcode/0/72/edit_distance.py
edit_distance.py
py
2,072
python
en
code
1
github-code
1
27783022168
import pandas as pd from pathlib import Path from configs import Config, configs from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.utils import to_categorical from typing import Unio...
ClementJu/kaggle-novozymes-enzyme-stability-prediction
src/data_preparation/dataset.py
dataset.py
py
5,745
python
en
code
1
github-code
1
71989716193
"""SimPhoNy-wrapper for celery-workflows""" import logging from typing import TYPE_CHECKING from osp.core.namespaces import emmo from osp.core.session import SimWrapperSession from .celery_workflow_engine import CeleryWorkflowEngine if TYPE_CHECKING: from typing import UUID, Any, Dict, List, Optional from ...
simphony/reaxpro-workflow-service
osp/wrappers/celery_workflow_wrapper/celery_workflow_wrapper.py
celery_workflow_wrapper.py
py
5,175
python
en
code
0
github-code
1
14538126773
#!/usr/bin/env python # encoding: utf-8 from rdflib.serializer import Serializer import configparser import corpus import csv import glob import json import rdflib import sys CONFIG = configparser.ConfigParser() CONFIG.read("rc.cfg") PREAMBLE = """ @base <https://github.com/Coleridge-Initiative/adrf-onto/wiki/Voca...
Coleridge-Initiative/RCHuman
rcc1/bin/gen_ttl.py
gen_ttl.py
py
3,528
python
en
code
3
github-code
1
5303883842
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def hasPathSum(self, root, targetSum): # exception if not root: return False ...
yutohub/leetcode
leetcode/0112_Path_Sum/0112_Path_Sum.py
0112_Path_Sum.py
py
808
python
en
code
0
github-code
1
2033422189
import numpy as np import pickle import os class OrnsteinUhlenbeckActionNoise: # from https://github.com/openai/baselines/blob/master/baselines/ddpg/noise.py def __init__(self, mu, sigma=0.3, theta=.15, dt=1e-2, x0=None): self.theta = theta self.mu = mu self.sigma = sigma self.dt =...
AirSimDroneSimulator/AirSim
3D_path_finding/DDPG/OUNoise.py
OUNoise.py
py
1,036
python
en
code
58
github-code
1
22098178009
import yfinance as yf import datetime import pandas as pd def get_dados(siglas, num_dias = 588, intervalo = '1wk', inicio = '', fim = ''): """ siglas -> [] Retorna uma lista de DataFrames com os valores de fechamento das siglas passadas """ if inicio == '': inic...
Nadyan/stock-analysis
dados/get_data.py
get_data.py
py
828
python
pt
code
0
github-code
1
17203669123
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('spirit_user', '0004_auto_20150731_2351'), ] operations = [ migrations.AddField( model_name='userprofile', ...
nacoss-biu/nacoss-biu
spirit/user/migrations/0005_auto_20151206_1214.py
0005_auto_20151206_1214.py
py
675
python
en
code
0
github-code
1
22409149985
# coding:utf8 # author:winton import logging import os import datetime import argparse from conf import Config from util import Util from ConsumerManager import ConsumerManager class Lams: ''' 控制数据收集的主要流程 ''' def init(self): ''' 读取配置并完成初始化 ''' loggerConfig = Config.l...
WintonLuo/Lams
lams.py
lams.py
py
3,982
python
en
code
0
github-code
1
70755553954
__all__ = [ "JobItem", ] import datetime import top class JobItem(top.Table): """job_item table ORM. """ _job = top.Job() _agent_stocktake = top.AgentStocktake() def __init__(self): """Toll Outlet Portal job_item table initialiser. """ super(JobItem, self).__init__('j...
loum/top
top/table/jobitem.py
jobitem.py
py
27,503
python
en
code
0
github-code
1
42497852272
inp = raw_input("Please enter a score [0.0 to 1.0]: ") try: score = float(inp) except: print("Error: We are expecting a number between 0.0 to 1.0.") quit() grade = "Unknown" if score < 0 or score > 1: print("Sorry, I can not grade the score, because it is out of range.") quit() elif score >= 0.9: grade = "A" el...
sunbaoshi1975/MyStudy
python_code/assn3_3.py
assn3_3.py
py
447
python
en
code
0
github-code
1
26844510858
# # Facebook "Likes" per account. # # MISSING: EA to enumerate FB accounts. # import reqs URL_ROOT = 'http://graph.facebook.com/' KEYS = ['name', 'username', 'likes'] def get_likes(username): resp = reqs.get_data(URL_ROOT + username, {}) return dict([(k, get_or_none(resp, k)) for k in KEYS]...
marklar/massiu
util/facebook.py
facebook.py
py
445
python
en
code
0
github-code
1
35528064793
import re from .trees import Hierarchy from .git_adapter import PythonGitAdapter class HierarchyHandler(object): def __init__(self, path, git_adapter=None): if not git_adapter: git_adapter = PythonGitAdapter self.git = git_adapter(path) def get_branch_hierarchy(self, feature_id...
pretenders/ployst
ployst/github/lib.py
lib.py
py
2,537
python
en
code
1
github-code
1
35878200565
# Read text from a file, and count the occurence of words in that text # Example: # count_words("The cake is done. It is a big cake!") # --> {"cake":2, "big":1, "is":2, "the":1, "a":1, "it":1} def read_file_content(filename): #opening the file with open("./story.txt", "r") as openingfile: read_file_...
AyBims/zuri_training
textfile.py
textfile.py
py
812
python
en
code
0
github-code
1
22919827757
# -*- coding: utf-8 -*- """ Created on Fri Jan 20 20:40:00 2023 @author: basti """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns opt = "" opt2 = "" #IMPORT DU FICHIER data = pd.read_csv("bdd/data/data_ml_"+str(opt)+"22-23.csv", sep= ";", index_col = 0) nb_top = pd.read...
BastienChicot/seria
services/indicateur_domination.py
indicateur_domination.py
py
5,446
python
en
code
0
github-code
1