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
23090428642
# Created by Louis LAC 2019 from lxml.etree import Element, SubElement, tostring from datetime import date from pathlib import Path class XMLTree: def __init__(self, image_path, width, height, user_name="bipbip", date=date.today()): self.plant_count = 0 self.image_path = Path(image_path) ...
laclouis5/darknet2
my_xml_toolbox.py
my_xml_toolbox.py
py
1,254
python
en
code
1
github-code
50
15078139825
from setuptools import setup, find_packages name = 'omark' __version__ = None with open('{:s}/__init__.py'.format(name), 'rt') as fp: for line in fp: if line.startswith('__version__'): exec(line.rstrip()) with open("README.md", "rt") as fh: readme = fh.read() requirements = ['biopython',...
DessimozLab/OMArk
setup.py
setup.py
py
901
python
en
code
18
github-code
50
17836444378
## # @file 002.py # @brief Finds sum of even Fibonacci numbers # @author Deeno Burgan # @version 1 # @date 2016-06-28 def sumEvenFibonacci(aLimit): lLast = 1 lCurrent = 1 lSum = 0 while lCurrent <= aLimit: lTemp = lLast lLast = lCurrent lCurrent += lTemp if( (lCurrent...
DrakeThane/misc-challenge-solutions
ProjectEuler/Python/002.py
002.py
py
511
python
en
code
0
github-code
50
71936543835
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Dec 31 00:02:50 2017 @author: apple """ """ Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self...
cgxabc/Online-Judge-Programming-Exercise
Leetcode/PalindromeLinkedList.py
PalindromeLinkedList.py
py
1,393
python
en
code
0
github-code
50
10297880784
#!/usr/local/bin/python3 # Python Challenge - 19 # http://www.pythonchallenge.com/pc/hex/bin.html # Username: butter; Password: fly # Keyword: sorry, idiot import base64 import wave import audioop def main(): ''' Hint: please! Photo is a map of India <!-- From: leopold.moz@pythonchallenge.com Su...
HKuz/PythonChallenge
Challenges/chall_19.py
chall_19.py
py
2,447
python
en
code
0
github-code
50
6566014115
from typing import Any, Dict from django.db.models.query import QuerySet from django.shortcuts import render, redirect from django.views.generic import UpdateView, DetailView, CreateView, DeleteView, ListView from django.views.generic.edit import UpdateView, DeleteView from rest_framework.views import APIView from djan...
Abylai-Yessim/decodeblog
decode_blog/views.py
views.py
py
8,507
python
en
code
1
github-code
50
22923828907
# !/usr/bin/python3 # coding:utf-8 # author:panli import xlutils import xlrd import os from xlutils.copy import copy def base_dir(filename=None): return os.path.join(os.path.dirname(__file__), filename) work = xlrd.open_workbook(base_dir('api.xls')) sheet = work.sheet_by_index(0) print(sheet.nrows) print(sheet.ce...
17621606077pl/Test_Api
script/Excel表格的数据读取/Test_Red_excel.py
Test_Red_excel.py
py
464
python
en
code
0
github-code
50
34655029164
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/split-a-string-in-balanced-strings/ # Balanced strings are those who have equal quantity of 'L' and 'R' characters. # Given a balanced string s split it in the maximum amount of balanced strings. # Return the maximum amount of splitted balanced s...
jakehoare/leetcode
python_1001_to_2000/1221_Split_a_String_in_Balanced_Strings.py
1221_Split_a_String_in_Balanced_Strings.py
py
786
python
en
code
49
github-code
50
38390782722
# function to print alternate uppaer and lowercase letters def myfunc(a): b = '' c = len(a) for x in range(0, c): if x % 2 == 0: b += a[x].upper() else: b += a[x].lower() return b print(myfunc("shivank")) # map & filter functions def checkeven(n): if n %...
shivankgoyal790/DailyTasks
practice/prac2.py
prac2.py
py
581
python
en
code
0
github-code
50
31040661772
import dgl import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from functools import partial from rdkit import Chem from torch.distributions import Categorical __all__ = ['DGMG'] class MoleculeEnv(object): """MDP environment for generating molecules. Parameters ...
awslabs/dgl-lifesci
python/dgllife/model/model_zoo/dgmg.py
dgmg.py
py
28,034
python
en
code
641
github-code
50
13210120428
def _all_(): import os import time import sys from colorama import Fore from baner import baner os.system("clear") baner() time.sleep(0.3) print(Fore.YELLOW + "\t\t\t [" + Fore.GREEN + "1" + Fore.YELLOW + "]" + Fore.BLACK + " ~ "+Fore.CYAN + "Obtain Target Programming Plugins And ...
trabit373/info
web_tools.py
web_tools.py
py
1,164
python
en
code
0
github-code
50
28832846886
from pathlib import Path from pyshacl import validate import httpx from config import * def main(): # get the validator r = httpx.get( "https://raw.githubusercontent.com/surroundaustralia/ogcldapi-profile/master/validator.shacl.ttl", follow_redirects=True, ) assert r.status_code == ...
surroundaustralia/surround-prez-features
scripts/validate.py
validate.py
py
2,078
python
en
code
0
github-code
50
39871151590
from __future__ import print_function # Communication to TensorFlow server via gRPC from grpc.beta import implementations import tensorflow as tf # TensorFlow serving stuff to send messages from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis import prediction_service_pb2 from utils import Twe...
si-m/fproject_serv
only_client.py
only_client.py
py
1,175
python
en
code
0
github-code
50
1889731564
import os from Outlier import * NUM_station = 164 NUM_peroid = 24 NUM_peroid_time = 24*60*60 / NUM_peroid TravelingMatrix = list() for O in range(0,NUM_station): O_List = list() for D in range(0,NUM_station): D_List = list() O_List.append(D_List) TravelingMatrix.append(O_List) Normal_Day_List = list() i...
shengwei-ClassNotes/YoubikeProject
Traveling_Time_Average.py
Traveling_Time_Average.py
py
2,201
python
en
code
0
github-code
50
72617590236
from tkinter import * import tkinter.ttk as ttk """ This module holds only varibles needed for styling the main application and does not contain any code beyond varibles colors are in Hex red = "#cf2823" light_grey="#f8f9fa" mid_grey = "#3b3d3d" dark_grey = "#292b2c" green = "#19b019" blue = "#0275d8" ...
DaveTanton/TheProject
SWACG_stylesheet.py
SWACG_stylesheet.py
py
1,277
python
en
code
0
github-code
50
42717220130
from transformers import AutoProcessor, FlaxWav2Vec2Model from datasets import load_dataset import soundfile as sf processor = AutoProcessor.from_pretrained("facebook/wav2vec2-large-lv60") model = FlaxWav2Vec2Model.from_pretrained("facebook/wav2vec2-large-lv60") def map_to_array(batch): speech, _ = sf.read(batch...
nepyope/Stable-Giffusion
tests/test_wav2vec2.py
test_wav2vec2.py
py
692
python
en
code
0
github-code
50
38731500890
'Getting Information from IMDb library ' import imdb ia = imdb.IMDb() name = 'the mummy' search = ia.search_movie(name) # print(search) # for i in search: # print(i) the_mummy = ia.get_movie('0120616') # for director in the_mummy['directors']: # print(director['name']) # print('Genre:') # for genre in the_mu...
BekBrace/IMDB-LIBRARY-FOR-MOVIES---PYTHON
main.py
main.py
py
460
python
en
code
3
github-code
50
37061971259
#May 23 2020 #Python Basics CourseWork University of Miuchigan #7.6. The Accumulator Pattern #1.1 Write code to create a list of integers from 0 through 52 and assign that list to the variable numbers. #You should use a special Python function – do not type out the whole list yourself. HINT: You can do this in one li...
CoralieHelm/Introduction-To-Python-Basics-Course-University-of-Michigan
7_6_Accumulator_Pattern.py
7_6_Accumulator_Pattern.py
py
1,710
python
en
code
1
github-code
50
9000778955
import csv import re from bs4 import BeautifulSoup import requests url = 'http://anglicismdictionary.ru/Slovar' headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "User-Agent": "Mozilla/5.0 (Windows N...
TimurSuvorov/YandexAliceSkill
WebScrapingForProject/SiteScraper.py
SiteScraper.py
py
2,775
python
en
code
0
github-code
50
21799016133
# _____ _ _____ # | __ \ | | / ____| # | | | | ___ _ __ __ _ ___ ___ | | __ | (___ ___ _ __ # | | | |/ _ \| '_ \ / _` |/ _ \ / _ \| |/ / \___ \ / _ \| '_ \ # | |__| | (_) | | | | (_| | (_) | (_) | < ____) | (_) | | | | # |_____/ \__...
donny-son/multivariate-data
MultivarFunctions.py
MultivarFunctions.py
py
9,199
python
en
code
0
github-code
50
30280139586
""" Project: AdaBoost Implementation Authors: przewnic Date: 01.2021 """ # Implementation of class helping reading and manipulating # and checking data import csv from Person import Person import re class MalformedData(Exception): def __init__(self, msg, row=None): super().__init__(msg) ...
przewnic/AdaBoost
Database.py
Database.py
py
3,477
python
en
code
0
github-code
50
30968179718
import os, sqlite3 import discord from discord.ext import commands bot = commands.Bot(command_prefix='!', intents=discord.Intents.all()) @bot.event async def on_ready(): pass # print("Бот готов к работе") # # global base, cur # base = sqlite3.connect('Бот.db') # cur = base.cursor() # if base: # print("Databa...
AlexeyOskilko/discord_bot
bot/botrun.py
botrun.py
py
1,242
python
ru
code
0
github-code
50
36635598069
#!env python -*- python-indent:4 -*- import cgi import datetime import feedgenerator import json import os import re import twitter CONFIG = os.path.join(os.path.dirname(__file__), 'config.json') def main(): with open(CONFIG, 'r') as f: config = json.loads(f.read()) with open(config['user_file'], 'r...
Packetslave/twitter_to_rss
t2r.py
t2r.py
py
2,147
python
en
code
0
github-code
50
14487757563
def selection_sort_comparisons(arr: list): comparisons = 0 for i in range(len(arr)): min = i for j in range(i+1, len(arr)): comparisons += 1 if arr[j] < arr[min]: min = j arr[min], arr[i] = arr[i], arr[min] return comparisons def insertion_so...
YuraBD/sorting_algs_compare
sort_comparisons_count.py
sort_comparisons_count.py
py
1,854
python
en
code
0
github-code
50
72056399516
from __future__ import division, print_function import os import argparse import configparser import logging definitions = [ # model type default help ('model', (str, 'unet', "Model: unet, dilated-unet, dilated-densenet")), ('features', (int, 64, "Number of featu...
chuckyee/cardiac-segmentation
rvseg/opts.py
opts.py
py
6,752
python
en
code
274
github-code
50
14402608190
import config from db import Database from flask_cors import CORS from flask import Flask, request, jsonify import sentry_sdk from sentry_sdk.integrations.flask import FlaskIntegration sentry_sdk.init( dsn=config.SENTRY_DSN, integrations=[FlaskIntegration()], # Set traces_sample_rate to 1.0 to capture 100...
frnsys/half_earth
logserver/main.py
main.py
py
1,122
python
en
code
16
github-code
50
27600870040
from collections import deque a = list(input().split()) S = 0; T = 123456789 for i in range(9): if a[i] == "x": S = S * 10 + 9 else: S = S * 10 + ord(a[i]) - ord('0') d = {0: [1, 3], 1: [0, 2, 4], 2: [1, 5], 3: [0, 4, 6], 4: [1, 3, 5, 7], 5: [2, 4, 8], 6: [3, 7], 7: [4, 6, 8], 8...
Nickel-Angel/ACM-and-OI
AcWing/845.py
845.py
py
978
python
en
code
0
github-code
50
38021515778
""" *packageName : * fileName : 2789.블랙잭(2) * author : ipeac * date : 2022-09-29 * description : * =========================================================== * DATE AUTHOR NOTE * ----------------------------------------------------------- * 2022-09-29 ...
guqtls14/python-algorism-study
박상준/완전탐색&백트래킹/2789.블랙잭(2).py
2789.블랙잭(2).py
py
731
python
en
code
0
github-code
50
29302273478
from datetime import datetime, timedelta def round_time(dt=None, date_delta=timedelta(minutes=1), to="average"): """ Round a datetime object to a multiple of a timedelta dt : datetime.datetime object, default now. dateDelta : timedelta object, we round to a multiple of this, default 1 minute. from...
theresnotime/wm-revert-counter
SOTime.py
SOTime.py
py
1,159
python
en
code
0
github-code
50
73415623836
import pandas as pd import psycopg2 as pg import numpy as np import os from urllib.parse import quote from sqlalchemy import create_engine import json import requests USERNAME = "ckan" PASSWORD = "ckan" DB = "datastore" IPADDR = "192.168.10.47" engine = create_engine(f"postgresql://{USERNAME}:%s@{IPADDR}/{DB}" % quote...
ezynook/open-data
data dict/data_dict_db.py
data_dict_db.py
py
1,969
python
en
code
0
github-code
50
9122095153
from allennlp.common.checks import ConfigurationError from allennlp.modules.seq2vec_encoders.seq2vec_encoder import Seq2VecEncoder from overrides import overrides import torch class PytorchSeq2VecWrapper(Seq2VecEncoder): """Copy of ``allennlp.modules.seq2vec_encoders.PytorchSeq2VecWrapper`` that adds support to r...
mmazab/LifeQA
lqa_framework/modules/pytorch_seq2vec_wrapper.py
pytorch_seq2vec_wrapper.py
py
7,917
python
en
code
10
github-code
50
33540866164
from models.Spread.SpreadNet import train_test, SpreadNet from models.Spread.DenseSpreadNet import DenseSpreadNet import matplotlib.pyplot as plt import numpy as np import pickle import os import torch path = '/media/rico/Data/TU/thesis' file = '{}/data/ASCAD_0.h5'.format(path) ranks_x = [] ranks_y = [] # Parameters ...
klikooo/thesis-src
old/runner.py
runner.py
py
2,794
python
en
code
0
github-code
50
8042202796
# Rather than compute all possible permutations of the string, we instead opt to do a frequency analysis # Simply check the frequency of a given string, and see if its frequency matches with any other string in the dictionary import sys def setup(): if len(sys.argv) > 1: f = sys.argv[1] else: ...
HaarisKhan/interesting
anagram.py
anagram.py
py
2,313
python
en
code
0
github-code
50
23230876266
#!/usr/bin/python27/bin/python #--*-- coding: utf-8 --*-- # Liszt 2014-3-4 import rsa import os import stat from Crypto.Cipher import AES from Crypto import Random import base64 def create_rsa_file(pubfile, prifile): pubkey, prikey = rsa.newkeys(1024) pub = pubkey.save_pkcs1() publicfile = open(pubfile,...
amwuqd/whisper
server/encoder.py
encoder.py
py
2,266
python
en
code
0
github-code
50
6072183993
from celery import shared_task from webapp.models import PDFOperationOrder, ImageOperationOrder, MultipleFile from PIL import Image import pytesseract import sys from django.utils import timezone from pdf2image import convert_from_bytes import os, shutil import cv2 import numpy as np from PyPDF2 import PdfFileMerger...
dodziraynard/digitaleye
webapp/tasks.py
tasks.py
py
7,285
python
en
code
0
github-code
50
73086980316
def week_day_name(index): names = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") return names[index] print(week_day_name(5)) def is_leap_year(year): if(year%100 !=0 and year%4 ==0) or year%400 ==0: return 29 def days_in_month(month,year): if month == 2: ...
Medhavi1101/python-training
programs/A1_P4.py
A1_P4.py
py
1,092
python
en
code
0
github-code
50
73384431516
from bnp_assembly.simulation.contig_simulation import simulate_contigs_from_genome import pytest from bionumpy.datatypes import SequenceEntry import numpy as np @pytest.fixture def genome(): return SequenceEntry.from_entry_tuples([ ["chr1", "ACTGACTGACTG"], ["chr2", "GGGGGGGGGGGGGGGGGGG"] ]) ...
knutdrand/bnp_assembly
tests/test_contig_simulation.py
test_contig_simulation.py
py
761
python
en
code
0
github-code
50
74363412314
""" Ball in a Cup environment for policy search experiments. Builds off code written with Johannes Silberbauer and Michael Lutter. Also builds of experiment design of Pascal Klink. """ import multiprocessing from dataclasses import asdict, dataclass from enum import Enum from pathlib import Path import mujoco_py imp...
JoeMWatson/monte-carlo-posterior-policy-iteration
policy_search/ball_in_a_cup.py
ball_in_a_cup.py
py
25,185
python
en
code
4
github-code
50
8108110408
from termcolor import colored import json import torch from utils import * import matplotlib.pyplot as plt # load the data from interaction_history.json def load_json(json_file : str) -> dict: with open(json_file, "r") as f: data = json.load(f) return data def get_colored_word(guessed_word : str, feed...
Tickloop/word-game
visualize.py
visualize.py
py
12,670
python
en
code
0
github-code
50
34208284759
import csv import yaml import matplotlib.pyplot as plt from matplotlib.patches import Rectangle from xlsxwriter import Workbook from rectpack import newPacker, PackingBin # Possible optimizing algorithims: # https://github.com/secnot/rectpack/blob/master/rectpack/maxrects.py # - MaxRects # - MaxRectsBl # - MaxRects...
feede7/MonchoCut
monchocut.py
monchocut.py
py
10,697
python
en
code
0
github-code
50
10142310011
from django.urls import path from .views import * urlpatterns = [ path('', index, name="home"), # главному маршруту присвоили имя home path('about/', about, name="about"), path('post/<int:post_id>/', show_post, name="post"), # post_id прилетает из get_absolute_url # при...
IvanWeis/models.py
coolsite/women/urls.py
urls.py
py
476
python
ru
code
0
github-code
50
20745423829
import sys import os import Tkinter import tkMessageBox top=Tkinter.Tk() def register(): os.system('python dataSetGenerator.py') os.system('python extract_embeddings.py --dataset dataset --embeddings output/embeddings.pickle --detector face_detection_model --embedding-model openface_nn4.small2.v1.t7') os.system('p...
madamsetty-pavan/Attendance-Managagement-System-Using-Facial-Recognition
face_tkinter.py
face_tkinter.py
py
817
python
en
code
0
github-code
50
38322166284
from helpers import * d = get_aoc_data(day=21) swap_pos = Parser('swap position <int> with position <int>') swap_let = Parser('swap letter <str> with letter <str>') reverse_pos = Parser('reverse positions <int> through <int>') rotate_left = Parser('rotate left <int> step<>') rotate_right = Parser('rotate right <int> ...
ztane/adventofcode
days/day21.py
day21.py
py
2,230
python
en
code
1
github-code
50
18134125157
import ops1d as ops #hyperparameter processing from operator import itemgetter import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, output_size, hyperparameters): super(Model,self).__init__() self.hyperparameters = hyperparameters self.channels = hyperparameters["channels"] ...
Snaags/NAS
model_constructor.py
model_constructor.py
py
5,819
python
en
code
0
github-code
50
74784975195
#!/usr/bin/python from json import dumps from time import sleep from requests import get, post, exceptions from .base import get_num_pages class RundeckApi(object): ''' This class provides multiple functions to manage projects, jobs or executions from Rundeck. To do it so, it uses Rundeck API endpoi...
hugomcfonseca/rundeck-executions-management
app/modules/rundeck.py
rundeck.py
py
15,908
python
en
code
6
github-code
50
23232587106
import glob import pdb import os from scipy.misc import imread import matplotlib.pyplot as plt import numpy as np from huMoments import huMoments from computeMHI import computeMHI def normalized_euclidean(testMoments, trainMoments, variance, i): multiply = np.power(np.reshape(trainMoments[i, :], (-1, 1)) - testMo...
HUILIHUANG413/CS6476-HM5
showNearestMHIs.py
showNearestMHIs.py
py
4,488
python
en
code
0
github-code
50
32122092802
def addtition(*args): result = 0 for x in args: result += x print(result) addtition(10, 20, 30) addtition(1, 2, 3, 4, 5) def myFun(*argv): for arg in argv: print(arg) myFun('Hello', 'Welcome', 'to', 'Python course') def myFun(arg1, *argv): print("First argument :", arg1) ...
fnabiyevuz/Advanced-Foundations-of-Python-Programming-2022-Training
Module 3 : Args and Kwargs/args.py
args.py
py
440
python
en
code
0
github-code
50
13034576408
#Chris Kopacz #Python Exercises from Github #Level 2, question 6 #created: 24 June 2017 """ Question 6 Level 2 Question: Write a program that calculates and printes the value according to the given formula: Q = sqrt[(2*C*D)/H] Following are the fixed values of C and H: C=50 H=30 D is the variable whose values chould b...
chriskopacz/python_practice
Problems/lev2/lev2_q6.py
lev2_q6.py
py
984
python
en
code
0
github-code
50
8520915239
# GCode Speed conversion # Adjusts for the gantry speed decrease on the curves # #F10 (10mm/s) is the standard line speed LinSpeed = "F10\n" #F75 (75mm/s) is the standard Arc speed ArcSpeed = "F75\n" # Reading File INPUT GCODE FILE HERE file1 = open('sketch_w_offset_3_DXF_Relativepos.gcode', 'r') Lines = file1.readli...
strombolini/gcodespeedadj
Gcode_Speed_Adj.py
Gcode_Speed_Adj.py
py
850
python
en
code
0
github-code
50
877648767
# coding: utf-8 # more examples: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from assistant.assistant import Assistant TG_TOKEN = "569776209:AAGlS4OT7jFw3oMtQ9781anRKwLtgCKKbNA" assistant = None ...
MelnikovAlmaz/bank_assistant
telegram_bot/telegram_bot.py
telegram_bot.py
py
1,352
python
en
code
0
github-code
50
41371964573
import xml.dom.minidom def ParseNode(node): if node.firstChild == node.lastChild: return node.firstChild.nodeValue else: dct2 = dict() for child in node.childNodes: keyName = child.localName if keyName is None: continue dct2[keyName] =...
nxp-mcuxpresso/FineDataset
xmltest.py
xmltest.py
py
767
python
en
code
0
github-code
50
28116330407
""" To do random stuff @author José Antonio García-Díaz <joseantonio.garcia8@um.es> @author Rafael Valencia-Garcia <valencia@um.es> """ import os import sys import config import argparse import pandas as pd import numpy as np import pickle import re from pathlib import Path import tr...
Smolky/LREV-Hope-Speech-Detection-in-Spanish-2022
code/stuff.py
stuff.py
py
7,635
python
en
code
2
github-code
50
5499351098
from __future__ import print_function import os import re import shutil import sys import ec2rlcore.constants try: import requests except ImportError as ie: # pragma: no cover print("ERROR:\tMissing Python module 'requests'.") print("\tPlease install this module and rerun ec2rl") sys.exit(1) def ge...
awslabs/aws-ec2rescue-linux
ec2rlcore/prediag.py
prediag.py
py
23,046
python
en
code
164
github-code
50
72138032796
""" This program 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. This program is distributed in the hope that it will be use...
IEK-5/aiana
aiana/anti_bug_testing/testing_of_sim_and_view_settings.py
testing_of_sim_and_view_settings.py
py
3,982
python
en
code
5
github-code
50
26283692708
import os import secrets import string from datetime import timezone, timedelta, datetime import openai import requests import sshtunnel from cryptography.fernet import Fernet from flask import abort, session from app import config def verify_session(session): if "tokens" not in session: abort(400) re...
kpister/prompt-linter
data/scraping/repos/rawcsav~SpotifyFlask/app~util~session_utils.py
app~util~session_utils.py
py
3,375
python
en
code
0
github-code
50
19364547340
# -*-coding:utf-8 -*- """ @project: self @author: Administrator @file: 1_first_steps.py @time: 2020-04-09 14:04:02 # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ...
shuqian2017/FastApi
FastApi_demo/1_first_steps.py
1_first_steps.py
py
865
python
en
code
0
github-code
50
22199212732
import unittest import capnp try: from capnp import _capnp_test except ImportError: _capnp_test = None # pylint: disable=c-extension-no-member @unittest.skipUnless(_capnp_test, '_capnp_test unavailable') class VoidTest(unittest.TestCase): def test_void_type(self): # ``VoidType`` is not declare...
clchiou/garage
python/g1/third-party/capnp/tests/test_capnp_void.py
test_capnp_void.py
py
695
python
en
code
3
github-code
50
43000751473
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: carry = 0 newHead = None newH...
pragyagautam02/DSA_StandardProblems
addTwoNoLinkedList.py
addTwoNoLinkedList.py
py
887
python
en
code
3
github-code
50
12390160014
import sys assert sys.version_info >= (3, 5) # make sure we have Python 3.5+ import os from pyspark.sql import SparkSession, functions, types ''' Get trip count of every year ''' def yearly_trip_count(trip): trip0 = trip.groupBy(trip['year']).count() trip0 = trip0.orderBy('year') trip0.write.mode('overwri...
wangyimosquito/SFU-cmpt732-NYC-Taxi-Analysis
time_yga111/query_time.py
query_time.py
py
2,057
python
en
code
0
github-code
50
41897910651
from bs4 import BeautifulSoup import requests import re import gspread from oauth2client.service_account import ServiceAccountCredentials scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/dri...
vineetdsat/Banglore_Mirror_Clone
News_scrapper.py
News_scrapper.py
py
1,812
python
en
code
0
github-code
50
8123074878
from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView, FormView from .models import * from django.urls import reverse_lazy, reverse from .forms import * from web.users.auth import auth_test from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib import messages...
tickHub/omslagroute
app/web/cases/views.py
views.py
py
6,633
python
en
code
0
github-code
50
16139686534
# not sure why one symbol has one cdf # optimized for cnn not our case # 2021.09.23 # x import torchac import numpy as np import torch class Arithmetic(): def __init__(self): self.prob = None self.cdf = [0, ] def fit(self, idx): self.prob = np.zeros((len(np.unique(idx)))) ...
yifan-fanyi/Func-Pool
ArithmaticTorch.py
ArithmaticTorch.py
py
1,884
python
en
code
2
github-code
50
9376405140
from obgraph import Graph as OBGraph from graph_kmer_index.kmer_finder import DenseKmerFinder from graph_kmer_index import kmer_hash_to_sequence from kivs import Graph, KmerFinder, hash_kmer from os.path import exists import pytest def hash_all(arr): if len(arr) == 0: return [] k = len(arr[0]) retu...
ZinderAsh/python-kivs
tests/test_kivs.py
test_kivs.py
py
9,505
python
en
code
0
github-code
50
27801632767
from string import punctuation from collections import Counter from nltk.corpus import stopwords from pandas import read_csv # load doc into memory def load_doc(filename, classes=2): # read all text data = read_csv(filename, delimiter='\t', header=None, names=["id1", "id2", "sentiment", "tweet"]) data = d...
aiir-team/code_TSA_SVC_luxembourg
models/create_vocab.py
create_vocab.py
py
2,347
python
en
code
0
github-code
50
7964192802
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from api.llm import router as llm from api.recipes import router as recipes import os os.environ['http_proxy'] = "http://proxy.mei.co.jp:8080" os.environ['https_proxy'] = "http://proxy.mei.co.jp:8080" def create_app() -> FastAPI: app ...
harukary/gpt_recipe_app
server/api/main.py
main.py
py
645
python
en
code
0
github-code
50
1687857896
import os import re from xml.dom.minidom import parse from urllib import request import codecs import markdown import argparse def parse_args(): """ parse input args """ parser = argparse.ArgumentParser() parser.add_argument("--changed_files", type=str, default="./changed_files.txt", ...
PaddlePaddle/continuous_integration
inference/inference_test_utils/check_deadlink.py
check_deadlink.py
py
4,957
python
en
code
16
github-code
50
39208801038
#prompt for a string containing ints separated by spaces user = input("Enter Values Separated by Spaces: ") #load values into a list values = user.split() count = 0 #find and print elements that appear in list only once (elements must be printed in order in which they occur in original list) #don't use list or string f...
izzyward02/IFSC1202
08.10 Number of Unique Elements.py
08.10 Number of Unique Elements.py
py
771
python
en
code
0
github-code
50
37237450679
""" Adapted OpenFlow 1.0 L2 learning switch implementation. Original SimpleSwitch class from: https://github.com/faucetsdn/ryu/blob/master/ryu/app/simple_switch.py Was customised to allow RYU controller to classify flows with PCNN Original copyright notice: # Copyright (C) 2011 Nippon Telegraph and Te...
Khalido2/DL-on-Network-Classification
Source Files/custom_controller.py
custom_controller.py
py
11,023
python
en
code
0
github-code
50
27209996783
# -*- coding: UTF-8 -*- # @Time : 2022/11/12 20:22 # @Author : Ranshi # @File : main.py # @Doc : 剑指 Offer II 071. 按权重生成随机数 import bisect from random import random class Solution: def __init__(self, w: list[int]): self.check_table = [] sum = 0 for v in w: sum += v...
Zranshi/leetcode
sword-means-offer-2/071/main.py
main.py
py
571
python
en
code
0
github-code
50
23951895685
def example(Simulator): import csdl from csdl import Model, GraphRepresentation import numpy as np class ErrorScalarIncorrectOrder(Model): def define(self): scalar = self.declare_variable('scalar', val=1.) expanded_scalar = csdl.expand((2, 3), scalar) ...
LSDOlab/csdl
csdl/examples/invalid/ex_expand_scalar_incorrect_order.py
ex_expand_scalar_incorrect_order.py
py
491
python
en
code
5
github-code
50
2557158298
try: from .apic_access_module.dnaapicem import * except: from apic_access_module.dnaapicem import * import pprint def apic_get_device_config(networkDeviceId): try: config = get(api='api/v1/network-device/' + networkDeviceId + '/config', ver='v1') except (BaseException, Timeout) as e: ...
oborys/DNAC-Monitoring-App
api/api_requests/get_device_config.py
get_device_config.py
py
747
python
en
code
6
github-code
50
33968605753
import os import argparse import yaml from files.configured_attributes_60 import ConfiguredAttributes60 from files.site_security_59 import SiteSecurity59 from files.simple_98 import Simple98 from files.condor_mapfile import CondorMapfile from files.pc_config_50 import PCConfig50 from files.simple_condor_98 import Simp...
simple-framework/simple_htcondor_ce
sh/pre_config/main.py
main.py
py
4,006
python
en
code
3
github-code
50
22034033280
import chellow.scenario from chellow.models import Session, Contract sess = None try: sess = Session() db_id = Contract.get_non_core_by_name(sess, 'aahedc').id finally: if sess is not None: sess.close() create_future_func = chellow.scenario.make_create_future_func_simple( 'aahedc', ['aahedc_g...
JuviAndaya/chellow
chellow/aahedc.py
aahedc.py
py
1,218
python
en
code
null
github-code
50
105546141
#!python3.8 cases = int(input()) inform, total, rabbits, rats, flogs = (), 0, 0, 0, 0 while cases: inform = (input().split()) if inform[1] == 'C': rabbits += int(inform[0]) elif inform[1] == 'R': rats += int(inform[0]) elif inform[1] == 'S': flogs += int(inform[0]) ...
certainlyWrong/Solu-Questions
beecrowd/1094.py
1094.py
py
615
python
en
code
0
github-code
50
7382485717
import qml from glob import glob import pdb from xyz2mol import * from qml.utils import alchemy import pandas as pd from rdkit import Chem import ast from drfp import DrfpEncoder from gzip_regressor import regress, cross_val_and_fit_kernel_ridge, predict_kernel_ridge_regression from smiles_tokenizer import tokenize fro...
daenuprobst/molzip
drafts/molzip_react/react.py
react.py
py
7,082
python
en
code
49
github-code
50
71741632796
import json from datetime import datetime from typing import Dict, Optional import requests def get_data(url: str, headers: Dict[str, str]) -> Optional[str]: """GET HTTP Request to URL using custom Headers. Args: url (str): API URL. headers (Dict[str, str]): API Headers. Returns: ...
avcaliani/esports-analytics
web-crawlers/brawl-stars/utils/http.py
http.py
py
760
python
en
code
0
github-code
50
17085988097
plates = {"4A2 3000": "František Novák", "6P5 4747": "Jana Pilná", "3B7 3652": "Jaroslav Sečkár", "1P5 5269": "Marta Nováková", "37E 1252": "Martina Matušková", "2A5 2241": "Jan Král" } print("SPZtku z plzenskeho kraje maji: ") for key, value in plates.items...
petrazborilova1/intenzivnikurzpython
bonus.py
bonus.py
py
376
python
en
code
0
github-code
50
70420427035
#reciprocle of no try: lst=input("enter the elements of list:").split() out=[] for i in range(len(lst)): out.append(1/i) print(out) except ZeroDivisionError: print("error occured !!") except EOFError: print("error ocured !!") except KeyboardInterrupt: print("error occured !!"...
FlowerbeanAnsh/python_problems_2
exceptions_reciprocle.py
exceptions_reciprocle.py
py
388
python
en
code
0
github-code
50
4603204578
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker import os from dotenv import load_dotenv # Replace these values with your actual PostgreSQL credentials POSTGRES_USERNAME = "postgres" POSTGRES_PASSWORD = "jnjdeploy1" POSTGRES_...
JacobSima/trello-backend-fastapi
db/db_setup.py
db_setup.py
py
941
python
en
code
0
github-code
50
22832549140
from PIL import Image import os def CaptchaParse(img): captcha="" dirs=os.listdir("Chars") img=img.convert('L') pix=img.load() for y in range(1,44): for x in range(1,179): if pix[x,y-1]==255 and pix[x,y]==0 and pix[x,y+1]==255: pix[x,y]=255 if pix[x-1,...
shubhodeep9/go-MyVIT
api/login/CaptchaVtopBeta/parser.py
parser.py
py
1,713
python
en
code
3
github-code
50
20913164162
# Birthday Json # https://www.practicepython.org/exercise/2017/02/06/34-birthday-json.html import json; # ~ birthdates = {"Britney Spears": "02.12.81", "Selena Gomez":"22.07.87", "Arnold Schwarzenegger":"30.07.47"}; # ~ with open("exercise 34 info.json", "r") as f: # ~ info = json.load(f) # ~ print(info);...
kristaps-m/practicepython.org-solutions
solutions_and_used_files/34.py
34.py
py
2,731
python
en
code
0
github-code
50
27759558518
import numpy as np import pandas as pd import pyodbc as pyodbc import face_recognition as face_recognition from PIL import Image #Python Imaging Library import io import cv2 from matplotlib import pyplot as plt import imutils import easyocr import pytesseract pytesseract.pytesseract.tesseract_cmd = 'C:\\Program File...
DAB103-2021/dab_capstone
user_authentication/vehicle_number.py
vehicle_number.py
py
2,912
python
en
code
0
github-code
50
34203590673
from __future__ import print_function from abc import abstractmethod import math import random import copy from matplotlib import pyplot class ComputationalNode(object): @abstractmethod def forward(self, x): # x is an array of scalars pass @abstractmethod def backward(sel...
ftn-ai-lab/ori-2022-e2
06-ann-comp-graph/src/solutions/ann_comp_graph.py
ann_comp_graph.py
py
7,942
python
en
code
4
github-code
50
40560485609
class Produto: def __init__(self, id, cod_barra, descricao, fornecedor, valor_venda, valor_custo): self.id = id self.cod_barra = cod_barra self.descricao = descricao self.fornecedor = fornecedor self.valor_venda = valor_venda self.valor_custo = valor_custo ...
rafael2044/projeto_sistema_gest-o_estoque_venda
Projeto/Geral/Classes/Produto.py
Produto.py
py
463
python
pt
code
0
github-code
50
25681455505
from modules.agents import REGISTRY as agent_REGISTRY from components.action_selectors import REGISTRY as action_REGISTRY import torch as th from modules.agents.thgc_agent import THGCAgent group = 2 # This multi-agent controller shares parameters between agents class BasicMAC: def __init__(self, scheme, groups, a...
AYUSH-ISHAN/Type-Based_Heirarchial_MARL_SC2
controllers/basic_controller.py
basic_controller.py
py
6,986
python
en
code
2
github-code
50
28976019445
from state import State from decode import decodeInstruction, decodeToIntList, decodeAll from encode import encodeInstructionMap, encodeList, encodeListPowerForm from instruction import AddI, SubI, HaltI from program import Program encodeInput = [SubI(1, 1, 2), AddI(0, 0), SubI(2, 3, 4), ...
Unevilicorn/register_machine
main.py
main.py
py
1,782
python
en
code
1
github-code
50
28673897588
# Rearrange an array such that arr[i] = i # Given an array of elements of length N, ranging from 0 to N – 1. All elements may not be present in the array. If the element is not present then there will be -1 present in the array. Rearrange the array such that A[i] = i and if i is not present, display -1 at that place. ...
rowince/Programme
tut73.py
tut73.py
py
712
python
en
code
0
github-code
50
14611570193
__doc__ = """Monitor Java Management eXtension (JMX) mbeans Dispatches calls to a java server process to collect JMX values for a device. """ import logging import sys import os import socket import Globals import zope from twisted.internet.defer import Deferred from twisted.web import xmlrpc from twisted.internet.pr...
krull/docker-zenoss4
init_fs/usr/local/zenoss/ZenPacks/ZenPacks.zenoss.ZenJMX-3.12.1.egg/ZenPacks/zenoss/ZenJMX/zenjmx.py
zenjmx.py
py
24,888
python
en
code
4
github-code
50
22624281149
import os import pytest from ansys.materials.manager.util.matml import MatmlReader, convert_matml_materials DIR_PATH = os.path.dirname(os.path.realpath(__file__)) class TestMatmlToMaterial: def test_conversion_to_material_object(self): """read a xml file with steel and e-glass UD""" xml_file_pa...
ansys/pymaterials-manager
tests/matml/test_matmal_to_material.py
test_matmal_to_material.py
py
4,238
python
en
code
0
github-code
50
34655217464
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/deepest-leaves-sum/ # Given a binary tree, return the sum of values of its deepest leaves. # Breadth-first search. # For each layer, sum all the node values and find all nodes in the next layer. # Repeat until the layer is empty and return the s...
jakehoare/leetcode
python_1001_to_2000/1302_Deepest_Leaves_Sum.py
1302_Deepest_Leaves_Sum.py
py
903
python
en
code
49
github-code
50
25125529236
#!/usr/bin/env python3 import torch import torch.nn.functional as F from ai_old.util.etc import print_ from ai_old.trainer.base import BaseTrainer from external.sg2.misc import print_module_summary from ai_old.util.factory import build_model, build_model_from_exp import external.sg2.misc as misc from random import rand...
calvinpelletier/ai_old
trainer/enc_lerp.py
enc_lerp.py
py
11,978
python
en
code
0
github-code
50
25039519174
from host.models import getHost from host.models import HostinfoCommand, HostinfoException, Links ############################################################################### class Command(HostinfoCommand): description = "Delete a link to a host" ###########################################################...
dwagon/Hostinfo
hostinfo/host/commands/cmd_hostinfo_deletelink.py
cmd_hostinfo_deletelink.py
py
1,155
python
en
code
10
github-code
50
19455619980
#!/usr/bin/python ############################################################## # Program name: NCAA Basketball Stats Scraper (Settings file) # Version: 1.0 # By: Rodrigo Zamith # License: MPL 2.0 (see LICENSE file in root folder) # Additional thanks: # Refer to http://stats.ncaa.org/team/inst_team_list?sport_code=MB...
rodzam/ncaab-stats-scraper
scrapersettings.py
scrapersettings.py
py
3,570
python
en
code
37
github-code
50
39723995259
class Class: def method(self): print("ihav") def function(): print("I'm not") instance = Class() instance.method() instance.method = function class bird: song = "fuck" def sing(self): print(self.song) Bird = bird() Bird.sing() c.name
kingflyfly/python_study
第7章-抽象/7.2.3.py
7.2.3.py
py
266
python
en
code
0
github-code
50
37705212126
import pygame class StartButton: def __init__(self, msg, x, y, w, h, color, font, screen, action): self.msg = msg self.x = x self.y = y self.w = w self.h = h self.color = color self.font = font self.screen = screen self.action = action # But...
SSM-and-etc/Uno_SE
Script/Lobby/button.py
button.py
py
1,054
python
en
code
4
github-code
50
7185144510
""" PyTorch implementation for meta-learning plasticity rules (v1.0) Author: Navid Shervani-Tabar Date : March 5, 2023, 18:44:17 """ import os import torch import warnings import argparse import datetime from torch import nn, optim from random import randrange from torch.nn.utils import _stateless from torch.utils.d...
NeuralDynamicsAndComputing/MetaLearning-Plasticity
main.py
main.py
py
16,265
python
en
code
5
github-code
50
7182134406
import io import sys import pickle import numpy as np import rdkit from rdkit import Chem from rdkit.Chem import rdDistGeom np.set_printoptions(precision=4) print(rdkit.__version__) suppl = Chem.SDMolSupplier(sys.argv[1]) fragment_list = {} for mol in suppl: if mol is None: continue # Cut input molecul...
n-yoshikawa/gsoc2019
playground/fragment-rdkit.py
fragment-rdkit.py
py
2,011
python
en
code
0
github-code
50
70895063514
import argparse from typing import Sequence from pypi_search import __version__ def parse_args(argv: Sequence[str]) -> argparse.Namespace: parser = argparse.ArgumentParser(description='Search for PyPi packages') parser.add_argument('search', help='Package to show information on') parser.add_argument( ...
asadmoosvi/pypi-search
pypi_search/arg_parser.py
arg_parser.py
py
701
python
en
code
12
github-code
50
16139837174
# 2021.01.27 # @yifan & zhanxuan # PCA transformation # # 2D PCA modified from https://blog.csdn.net/w450468524/article/details/54895477 # import numpy as np class myPCA2D(): def __init__(self, n_components, H=None, W=None): self.H = H self.W = W self.K1 = [...
yifan-fanyi/Func-Pool
myPCA2D.py
myPCA2D.py
py
2,327
python
en
code
2
github-code
50
13435916339
import collections import os.path from . import training work_path = '_workspace' """str: Path to parent directory containing program output.""" extraction_path = os.path.join(work_path, 'features') """str: Path to the directory containing extracted feature vectors.""" scaler_path = os.path.join(extraction_path, '...
tqbl/gccaps
gccaps/config/paths.py
paths.py
py
2,735
python
en
code
15
github-code
50