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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
31429549398 | import pandas as pd
from controller.project_controller.projects.base.file_operations import file_methods
from controller.project_controller.projects.base.data_preprocessing import preprocessing
from controller.project_controller.projects.base.data_ingestion import data_loader_prediction
from controller.project_controll... | saisrinivas-samoju/ML_platform | controller/project_controller/projects/wafer_fault_detection/predictFromModel.py | predictFromModel.py | py | 6,497 | python | en | code | 0 | github-code | 36 |
74653324584 | def summations(value: int):
''' Calculates how many different ways can number be written
as a sum of at least two positive integers \n
Args:
value: integer to find number of summations for
Returns:
number of summations, int '''
ways = [1] + [0 for _ in range(value)]
for number in range(1, v... | EricRovell/project-euler | deprecated/076/python/076.py | 076.py | py | 491 | python | en | code | 0 | github-code | 36 |
12171110246 | T = int(input())
for i in range(T):
hotel = []
H, W, N = map(int, input().split())
for i in range(1, W+1):
for j in range(1, H+1):
if i < 10:
bang = f'{j}' + '0' + f'{i}'
hotel.append(bang)
else:
bang = f'{j}' + f'{i}'
... | hi-rev/TIL | Baekjoon/기본수학1/ACM_hotel.py | ACM_hotel.py | py | 370 | python | en | code | 0 | github-code | 36 |
74049983784 | import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
import torch.nn.functional as F
from parlai.utils.torch import neginf
from parlai.core.torch_generator_agent import TorchGeneratorModel
def _transpose_hidd... | facebookresearch/ParlAI | parlai/agents/seq2seq/modules.py | modules.py | py | 24,551 | python | en | code | 10,365 | github-code | 36 |
4917848214 | #Associate a lambda function and the mtg file's type name to each opf data type
OPF_TYPES = {
"Double":(lambda x: float(x),"REAL"),
"Metre_100":(lambda x: float(x),"REAL"),
"Integer":(lambda x: int(x),"INT"),
"Boolean":(lambda x: int(x.lower() == "true" or int(x) == 1) ,"INT"),
"String":(lambda x: ... | thomasarsouze/plantconvert | src/plantconvert/opf/const.py | const.py | py | 334 | python | en | code | 0 | github-code | 36 |
74024990185 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import NoReturn
import streamlit as st
def page_title_area(title: str) -> NoReturn:
"""
标题栏内容
:param title: 标题名称
:return: None
"""
col1, _, _, col4 = st.columns(4)
title_container = st.container()
with title_container:
w... | zhaoqianjie/imageAI-streamlit | streamlit_gallery/views/object_detection/header.py | header.py | py | 400 | python | en | code | 0 | github-code | 36 |
21544899518 | import pytest
from autots.models import NeuralCDE
from autots.tests import helpers
from autots.utils import make_time_series_problem
def setup_ncde_problem(static_dim=None, use_initial=True):
# Simple problem
input_dim = 4
output_dim = 1
data, labels = make_time_series_problem(
n_channels=inp... | jambo6/autots | autots/tests/models/test_ncde.py | test_ncde.py | py | 1,063 | python | en | code | 1 | github-code | 36 |
34088049341 | import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotes"
def start_requests(self):
#start_urls
urls = [
'https://quotes.toscrape.com/page/1/',
'https://quotes.toscrape.com/page/2/'
]
for url in urls:
yield scrapy.Request(url=url, c... | nikku179201/Scrapy_Project | MyScrapyProject/spiders/test.py | test.py | py | 1,154 | python | en | code | 0 | github-code | 36 |
2080694356 | import WMD.calWMD as WMD
import calculatePrecision
import os
import utils
rqPredictPath = utils.RelevancePath
WMDPath = utils.rootPath + r'\WMD.txt'
def getWMDPrecision(topK=5):
high_precision = 0.0
mid_precision = 0.0
low_precision = 0.0
sum_NDCG = 0.0
count = 0
for file in os.listdir(rqPr... | Ylizin/RWSim | ylSim/WMDResult.py | WMDResult.py | py | 2,324 | python | en | code | 2 | github-code | 36 |
11591654822 | import logging
import sys
import time
from contextlib import contextmanager
from loguru import logger
@contextmanager
def log(desc):
logger.info(f"Function running: {desc}")
start = time.time()
try:
yield
except Exception as e:
logger.exception(f"Error encountered on: {desc}", e)
... | NicoLivesey/zemmourify | zemmourify/logs.py | logs.py | py | 2,135 | python | en | code | 0 | github-code | 36 |
24099993323 | from . import CONFIG_FILE
from CleanEmonCore.CouchDBAdapter import CouchDBAdapter
from CleanEmonCore.models import EnergyData
class AutoBuffer:
def __init__(self, capacity):
self.db_adapter = CouchDBAdapter(CONFIG_FILE)
self.data = {}
self._capacity = capacity
self._count = 0
... | GeorgeVasiliadis/CleanEmon-Populator | CleanEmonPopulator/buffer.py | buffer.py | py | 1,123 | python | en | code | 0 | github-code | 36 |
30287512588 | #!/usr/bin/env python
def match_by_microsat(processed_row_dicts, markers, individual_key="Lab ID"):
match_set = set()
for indiv_1 in processed_row_dicts:
for indiv_2 in processed_row_dicts:
if indiv_1[individual_key] == indiv_2[individual_key]:
continue
full_coun... | TheCulliganMan/microsatellite_matcher | microsatellite_matcher/match_by_microsat.py | match_by_microsat.py | py | 1,775 | python | en | code | 0 | github-code | 36 |
28985800071 | import click
from aoc_2022_kws.cli import main
from aoc_2022_kws.config import config
from aocd import submit
snafu_chars = "=-012"
def snafu_val(value: str):
return snafu_chars.index(value) - 2
def snafu_to_base10(value: str):
return sum([snafu_val(c) * 5**i for i, c in enumerate(value[::-1])])
rsnafu_c... | SocialFinanceDigitalLabs/AdventOfCode | solutions/2022/kws/aoc_2022_kws/day_25.py | day_25.py | py | 1,557 | python | en | code | 2 | github-code | 36 |
32065532649 | # Реализуйте RLE алгоритм: реализуйте модуль сжатия и восстановления данных.
# Входные и выходные данные хранятся в отдельных текстовых файлах.
def encode(string: str):
encode_text = ''
prev_char = string[0]
count = 1
for char in string[count:]:
if char == prev_char:
count += 1
... | DanisYuma/Introduction-to-Python | Introdution/Homeworks/HW5/Task4.py | Task4.py | py | 1,047 | python | ru | code | 0 | github-code | 36 |
25628618035 | import matplotlib.pyplot as plt
def diagram(data, epsilon, beta):
plt.figure()
plt.fill_between(data.index, data - epsilon, data + epsilon, alpha = 0.3)
plt.plot(data.index, data, linewidth=0.5)
if beta is not None:
plt.plot([0, 199],[beta, beta], color = "r", linestyle = "--", linewidth = 0.5)... | tronyaginaa/math_statistics | lab4/diagram.py | diagram.py | py | 378 | python | en | code | 0 | github-code | 36 |
16103077867 | #! /usr/bin/env python
# process a node and assemble the info to build a program
class Program_Info(object):
def __init__(self, node):
self.node = node
self.valid = False
try:
self.id = node.attrib["id"]
self.name = node.find("name").text
self.folde... | mjcumming/ISY994v5 | isy994/items/programs/program_info.py | program_info.py | py | 929 | python | en | code | 4 | github-code | 36 |
72717951783 | import os.path
from PyQt4 import QtGui, QtWebKit
from PyQt4.uic import loadUi
class BrowserGUI(QtGui.QMainWindow):
"""
The Graphical user interface of the browser
"""
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = loadUi(os.path.join(os.getcwd(), "GUI/main.ui"))
... | jmg/simple-web-browser | GUI/main.py | main.py | py | 1,276 | python | en | code | 9 | github-code | 36 |
2579947688 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 3 22:49:31 2018
@author: zhenhao
"""
import face_recognition_api
import numpy as np
import pandas as pd
import os
import pickle
fname = 'classifier.pkl'
prediction_dir = './test-images'
encoding_file_path = './encoded-images-data.csv'
df = pd.re... | kod2nd/faceRecog | process.py | process.py | py | 1,530 | python | en | code | 0 | github-code | 36 |
24639257557 | from generic_text import GenericText
class Tags(GenericText):
Objects = []
def __init__(self, filename, tag):
super().__init__(filename)
self.tag = tag
def normalizeList(self):
super().normalizeList()
self.__class__.Objects.append(self)
if __name__ == '__main__':
lista_politica = Tags("politica.txt", "p... | ilfabiojava/text-classification | training.py | training.py | py | 616 | python | en | code | 0 | github-code | 36 |
41647102734 | rad = float(input("Radius : "))
ch = input("1. Area\n2. Perimeter ")
if(ch=='1'):
area=3.14*rad*rad
print("Area :",area)
elif(ch=='2'):
per=2*3.14*rad
print("Perimeter :",per)
else:
print("Invalid!") | arash-arora/Python | Circle.py | Circle.py | py | 228 | python | en | code | 0 | github-code | 36 |
33464590798 | # წაიკითხეთ data.xlsx ექსელის ფაილის „sheetOne“ ფურცლიდან მონაცემები იპოვეთ პირველ სვეტში ჩაწერილი
# სტრიქონებიდან რომელი შეიცავს სიმბოლო ‘a’-ის და გადაწერეთ datanew.xlsx ფაილის “sheet3” ფურცელში.
import pandas as pd
sheetOne = pd.read_excel('data.xlsx', sheet_name="sheetOne")
# substring to be searched
sub = 'a'
# c... | mariami01/machine-learning-gau | LAB-06/Task_4.py | Task_4.py | py | 832 | python | ka | code | 0 | github-code | 36 |
11062071669 | import pickle
class Record:
def __init__(self, name, time, date, temperature):
self.city=name # Creation and initialisation of the attribute "city"
self.time=time
self.date=date
self.temperature=temperature
def __str__(self):
return f"In {self.city} at {se... | Mohsen-Kalantar/Day1PMClasses | exerciseWithClasses2.py | exerciseWithClasses2.py | py | 2,690 | python | en | code | 0 | github-code | 36 |
14438215512 | import psycopg2
read_sql = "SELECT num, data FROM test"
conn = None
try:
# connect to the PostgreSQL database
conn = psycopg2.connect(
dbname='spacedys',
host='localhost',
user='spacedys',
password='password')
# create a new cursor
cur = conn.cursor()
# execute the S... | nicolacammillini/spacedys | docs/demos/db/read-pg.py | read-pg.py | py | 693 | python | en | code | 0 | github-code | 36 |
39903754177 | from player import Player
from table import Table
from deck import Deck
from sys import stderr, stdin, stdout
class GameInfoTracker(object):
def __init__(self):
self.settings = {}
self.game_state = {}
self.spentPerStage = {"pre_flop": 0, "flop": 0, "turn": 0, "river": 0}
self.amoun... | brhoades/holdem-bot | poker/gameinfotracker.py | gameinfotracker.py | py | 3,463 | python | en | code | 0 | github-code | 36 |
8473942040 | #!/usr/bin/env python
# https://gist.github.com/tigercosmos/a5af5359b81b99669ef59e82839aed60
##
##
##
# coding: utf-8
import numpy as np
import cv2
import os
import math
from cyvlfeat.kmeans import kmeans
from scipy import ndimage
from scipy.spatial import distance
from tqdm import tqdm
import pickle
from cyvlfeat.k... | babywyrm/sysadmin | vectorize/sift_wordbag_svm_.py | sift_wordbag_svm_.py | py | 4,666 | python | en | code | 10 | github-code | 36 |
21628424114 | """backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | AI4Bharat/Chitralekha-Backend | backend/backend/urls.py | urls.py | py | 2,939 | python | en | code | 18 | github-code | 36 |
3167976312 | from .constants import (ADVANCED_OPPONENT_STATS_URL,
ADVANCED_STATS_URL,
BASIC_OPPONENT_STATS_URL,
BASIC_STATS_URL,
PARSING_SCHEME)
from pyquery import PyQuery as pq
from sportsipy import utils
def _add_stats_data(teams_li... | roclark/sportsipy | sportsipy/ncaab/ncaab_utils.py | ncaab_utils.py | py | 4,201 | python | en | code | 447 | github-code | 36 |
26376483834 | #!/usr/bin/env python
# coding: utf-8
# In[22]:
# Question 1 d)
# Author: Ilyas Sharif
# Importing required packages
import numpy as np
from scipy.interpolate import RegularGridInterpolator
import matplotlib.pyplot as plt
from random import random
from matplotlib import cm
# Loading in the land data
loaded = np.lo... | SpencerKi/Computational-Methods | Monte Carlo Methods/Lab10_Q1.py | Lab10_Q1.py | py | 2,147 | python | en | code | 0 | github-code | 36 |
74979913065 | from django.urls import path, re_path
from . import views
urlpatterns= [
path("<int:id>", views.index, name="index"),
path("", views.home, name="home"),
path("upload/", views.upload, name="upload"),
re_path(
r'^delete-image/(?P<id>\d+)/(?P<loc>[a-zA-Z]+)/$',
views.delete_image,
... | kevqyzhu/imagerepo | main/urls.py | urls.py | py | 396 | python | en | code | 0 | github-code | 36 |
35414698228 | from app.server_process import ServerProcess
from flask import Flask, request
import os
app = Flask(__name__)
def main():
port = int(os.environ.get("PORT", 5000))
app.run(host="0.0.0.0", port=port)
@app.route("/", methods=["POST"])
def process_move():
request_data = request.get_json()
return Serve... | bmraubo/TicTacToe | server.py | server.py | py | 398 | python | en | code | 0 | github-code | 36 |
4253899624 | def get_is_square(matrix, row, col):
found = False
for i in range(1, min(len(matrix) - row, len(matrix) - col)):
found = True
for j in range(i + 1):
top = matrix[row][col + j]
left = matrix[row + j][col]
bottom = matrix[row + i][col + i - j]
right ... | blhwong/algos_py | algo_exp/square_of_zeroes/main.py | main.py | py | 2,186 | python | en | code | 0 | github-code | 36 |
74065450024 | import discord
from discord.ext import commands
import os
import errno
import datetime as dt
import time
import sys
import traceback
BOT_CHANNELS = [803372255777914911, 803375064816287814, 803380541230940161]
class Events(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog... | Abearican/Discord-Bot | cogs/events.py | events.py | py | 2,859 | python | en | code | 0 | github-code | 36 |
74100089063 | # dribbble_retrieve_shots
import dribbble_metadata
import pandas as pd
import time
import re
def _form_row_as_list(shot_dict):
'''
Returns the given project dict as a list
representing a row in dataframe
'''
return [shot_dict['shotId'], shot_dict['postedOn'], 0 if shot_dict['likesCount'... | pielab-uci/social-activity-platforms | native/dribbble/dribbble_retrieve_shots.py | dribbble_retrieve_shots.py | py | 2,775 | python | en | code | 0 | github-code | 36 |
1437566397 | from collections import OrderedDict
# create dummy _ fct (so that gettext can parse dict)
# language options
langOption = OrderedDict(en="English", fr="Français", de="Deutsch")
# summary
summary_info = {'en': ['filename', '# users', 'file size'], 'fr': ['nom de fichier', 'nb utilisateurs', 'taille du fichier'], 'de'... | thilaire/PLADIF | pladif/naming.py | naming.py | py | 5,236 | python | en | code | 0 | github-code | 36 |
28778815331 | """
0/1 knapsack
author: Manny egalli64@gmail.com
info: http://thisthread.blogspot.com/2018/02/other-dynamic-programming-problems.html
"""
def solution(knapsack, weights, values):
table = [[0] * (knapsack + 1) for _ in range(0, len(weights) + 1)]
for i in range(1, len(table)):
for j in range(1, len(... | egalli64/pythonesque | algs200x/w6/e_01_knapsack.py | e_01_knapsack.py | py | 546 | python | en | code | 17 | github-code | 36 |
13624054640 | import io
import os
import sys
from setuptools import setup
if sys.version_info < (3, 6):
sys.exit("Sorry, Python < 3.6.0 is not supported")
DESCRIPTION = "Simple Logger for MPI"
here = os.path.abspath(os.path.dirname(__file__))
try:
with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f:
... | serihiro/mpi_logger | setup.py | setup.py | py | 886 | python | en | code | 0 | github-code | 36 |
8615782978 | # reference code example from: https://github.com/martin-gorner/tensorflow-mnist-tutorial
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
import numpy as np
import datetime
class Visualization:
port = None
ispause = False
am = None
... | adminho/trading-stock-thailand | deep_q/animation.py | animation.py | py | 3,682 | python | en | code | 64 | github-code | 36 |
22489393422 | import pymongo
from pymongo import MongoClient, TEXT
import json
def inputJsonName():
'''
Prompts the user for a Json File name
Return: Json File Input (Str)
'''
jsonName = input("Input the json file name you would like to insert. \n")
return jsonName
def inputPortNum():
'''
... | JFong5/Mini-Project2 | load-json.py | load-json.py | py | 2,393 | python | en | code | 0 | github-code | 36 |
35535613818 | import os
import pickle
import pandas as pd
from flask import Flask, request
from flasgger import Swagger
app = Flask(__name__)
Swagger(app)
current_path = os.path.dirname(os.path.realpath(__file__))
pickle_in = open(f"{current_path}/model.pkl", "rb")
rf = pickle.load(pickle_in)
@app.route("/")
def index() -> str:... | calkikhunt/bank_note_authentication | app.py | app.py | py | 1,724 | python | en | code | 0 | github-code | 36 |
12451330399 | def main():
sides = input().split(" ")
a = []
for i in sides:
a.append(float(i))
a.sort(reverse=True)
A = float(a[0])
B = float(a[1])
C = float(a[2])
if A >= (B + C):
print("NAO FORMA TRIANGULO")
return
if A**2 == B**2 + C**2: print("TRIANGULO RETANGULO")
if A**2 > B**2 + C**2: print... | sergipe085/beecrowd-solutions | lista_2/triangle-types.py | triangle-types.py | py | 563 | python | en | code | 0 | github-code | 36 |
36810418270 | def minimum_path_weight(triangle):
if not triangle: return 0
prev_row = triangle[0]
for i in range(1, len(triangle)):
curr_row = triangle[i]
curr_row[0] += prev_row[0]
for j in range(1, len(triangle[i])-1):
curr_row[j] += min(prev_row[j-1], prev_row[j])
curr_row[... | oc0de/pyEPI | 16/8.py | 8.py | py | 474 | python | en | code | 0 | github-code | 36 |
25053350943 | import os
def Crc8(u8_data, leng):
u8_crc8 = (0xFF)
u8_poly = (0x1D)
for i in range(0,leng,1):
u8_crc8^=(u8_data[i])
for j in range(0,8,1):
if(u8_crc8&0x80):
u8_crc8 = ((u8_crc8 << 1) & 0xFF) ^ u8_poly
else:
u8_crc8 <<= 1
#u8_crc8 ^= 0xFF
return he... | jimindeshushu/Python | Crc8SAE_J1850/Crc8.py | Crc8.py | py | 472 | python | en | code | 0 | github-code | 36 |
15733676375 | __author__ = "evas"
__docformat__ = "reStructuredText"
import logging
import numpy as np
# http://stackoverflow.com/questions/12459811/how-to-embed-matplotib-in-pyqt-for-dummies
# see also: http://matplotlib.org/users/navigation_toolbar.html
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureC... | ssec/sift | uwsift/view/probes.py | probes.py | py | 34,849 | python | en | code | 45 | github-code | 36 |
26707445232 | from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Integer,
String,
Date,
DateTime,
UniqueConstraint,
)
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql import func
from app.db.base_class import Base
class Saving(Base):
id = Column(Integer, primary_key=True,... | boswellgathu/chama | backend/app/models/saving.py | saving.py | py | 1,033 | python | en | code | 0 | github-code | 36 |
22246405784 | import common.parse_util as cpu
from common.common_based import CommonBased
class AdaType(CommonBased):
RECORD_TYPE = "Record"
ENUM_TYPE = "Enum"
STR_TYPE = "String"
ARRAY_TYPE = "Array"
DERIVED_TYPE = "Derived"
SUBTYPE = "Subtype"
INT_TYPE = "Integer"
REAL_TYPE = "Real"
FIELD_TYP... | idealegg/AdaReader | common/ada_type.py | ada_type.py | py | 4,011 | python | en | code | 0 | github-code | 36 |
8561326624 | """
Create a function where will be needed as an argument string_a and number_b. With using assert - be sure, that user
input arguments of this types. After it concatenate string_a with number_b
"""
def special_function(string_a, number_b):
assert type(string_a) == str
assert type(number_b) == int
special_f... | EdyStan/homework_beetroot | classwork/22-09-27/types_assert.py | types_assert.py | py | 394 | python | en | code | 0 | github-code | 36 |
40857313291 | #!/usr/bin/env python
from __future__ import division, print_function
import argparse
import glob
from array import array
import numpy as np
import scipy as sp
import fitsio
from picca import constants
from picca.data import delta
from picca.Pk1D import (compute_cor_reso, compute_Pk_noise, compute_Pk_raw,
... | vserret/picca | bin/picca_Pk1D.py | picca_Pk1D.py | py | 13,158 | python | en | code | 0 | github-code | 36 |
38027952617 | from typing import Dict, List
from twin_runtime.twin_runtime_core import TwinRuntime
from twin_runtime.twin_runtime_core import LogLevel
class TwinBuilderSimulator():
def __init__(self, twin_model_file, state_variable_names: List,
action_variable_names: List,
number_of_warm_up_st... | microsoft/bonsai-twin-builder | TwinBuilderConnector/TwinBuilderSimulator.py | TwinBuilderSimulator.py | py | 3,207 | python | en | code | 6 | github-code | 36 |
9078460447 | ## Loading the required libraries
import os
import re
import pandas as pd
## Must have a text file folder
## Setting the directory which hold our pdf files that were converted to .txt files
leaflets_dir = 'dump_profissional/'
## Setting the keywords we want to check on the drug leaflets we scraped from ... | hihor22/Python | keyword_finder.py | keyword_finder.py | py | 2,237 | python | en | code | 0 | github-code | 36 |
29991596452 | """
Capstone Project. Code written by Evan Cochrane.
Fall term, 2018-2019.
"""
import rosebotics_new as rb
import time
def main():
""" Runs YOUR specific part of the project. Uncomment tests as needed. """
print('why not?')
# test_go_straight_inches_method()
test_spin_in_place_degrees_method()... | cochraef/rosebotics2 | src/EvanCochrane.py | EvanCochrane.py | py | 5,411 | python | en | code | null | github-code | 36 |
41357725920 | import sys
class MyGraph:
def __init__(self,n):
self.vertices = {}
for i in range(n):
self.vertices[i] = []
def addConnection(self, i,j):
if (i and i) in self.vertices.keys():
self.vertices[i].append(j)
self.vertices[j].append(i)
else:
... | J-H-C-037/Subject-EDA | EDA/finals/dijkstra.py | dijkstra.py | py | 3,019 | python | en | code | 0 | github-code | 36 |
33924516237 | import pandas as pd
import datetime
import gc
#selected_aircrafts = ['ERJ 170-200 LR', 'BOEING 737-8AS', 'A320 214', '172S', 'A320-214', '737-7H4', 'A320-232', 'A320 232', 'A321-231', 'CL-600-2D24', '737-823', 'A320 214SL', '737-8H4', 'PA-28-181', '737-924ER', 'A321 231SL', 'AIRBUS A319-111', '737-800', 'A319 112', 'A... | victormenuzzo/covid_airtraffic | prep_for_linreg.py | prep_for_linreg.py | py | 2,469 | python | en | code | 0 | github-code | 36 |
16080148307 | import blankly
from blankly import StrategyState
class Grid:
@staticmethod
def init(retry_timeout, base_order_size, grid_spacing_percent, num_grid_above_below):
def closure(symbol, state: StrategyState):
state.variables['retry_timeout'] = retry_timeout
state.variables['base_orde... | Minish144/python-crypto-trading-bot | strategies/grid.py | grid.py | py | 2,453 | python | en | code | 0 | github-code | 36 |
6270944947 | import os
import logging
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from .helpers import ROOT_DIR, DATA_DIR, RESULTS_DIR
from .helpers import GENRES, SUBSETS
from .helpers import start_experiment_log
from .helpers import relpath
from .classification import train_model
fro... | bacor/ISMIR2020 | src/profile_experiment.py | profile_experiment.py | py | 7,149 | python | en | code | 4 | github-code | 36 |
2791992228 | class Data():
def getDataList(filename):
"""
read the file and get the I and V values and return it
:param filename: complete path to the file
:return: list containing a list of the I values and a list of the V values
"""
with open(filename, 'r') as file:
... | masterproefpidpv/PythonDataProcessing | Data.py | Data.py | py | 2,185 | python | en | code | 0 | github-code | 36 |
19499646717 | # -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtGui import QApplication, QMainWindow, QWidget, QPushButton, QDialog, QMessageBox, QTableWidgetItem, QListWidgetItem
from PyQt4.QtCore import QString, QSettings
from config import user, password, host, db_name
import pymysql... | den4ik-kovalev/phone_book | phone_book/app.py | app.py | py | 21,771 | python | en | code | 0 | github-code | 36 |
14994784583 | from django.urls import path
from . import views
from django.conf import settings
from django.contrib.staticfiles.urls import static
urlpatterns = [
path('',views.inicio, name='inicio'),
path('nosotros_copy',views.nosotros_copy, name='nosotros_copy'),
path('nosotros',views.nosotros, name='nosotros'),
p... | LsuiValle/Proyecto | sub_proyecto/urls.py | urls.py | py | 1,335 | python | es | code | 0 | github-code | 36 |
18830355953 | """File Type Utility Class."""
import logging
from pathlib import Path
from hdash.synapse.file_type import FileType
class FileTypeUtil:
"""File Type Utility Class."""
LEGACY_META_FILE_NAME = "synapse_storage_manifest.csv"
META_FILE_PREFIX = "synapse_storage_manifest_"
def __init__(self):
"""... | ncihtan/hdash_air | hdash/synapse/file_type_util.py | file_type_util.py | py | 2,700 | python | en | code | 0 | github-code | 36 |
30835468279 | from youtube_dl import YoutubeDL
import sys
ydl_opts = {'format': 'bestaudio/best',
'postprocessors': [{'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}]}
if __name__ == "__main__":
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
filenames = sys.argvp[1:]
ydl.download... | jordankraude/Personal-Projects | Youtube Downloaders/youtube_to_mp3.py | youtube_to_mp3.py | py | 332 | python | en | code | 0 | github-code | 36 |
12551436059 | def KaprekarsConstant(number):
counter = 0
maths = 0
flag = True
while flag:
if len(str(number)) < 4:
number = str(number).zfill(4)
number = str(number)
my_list_dec = sorted(list(number), reverse=True)
my_list_asc = sorted(list(number), reverse=False)
str_dec = int(''.join(my_l... | iampaavan/CoderByte | KaprekarsConstant.py | KaprekarsConstant.py | py | 809 | python | en | code | 0 | github-code | 36 |
7659689792 | # Importing the OpenCV library.
import cv2
# Importing the numpy library.
import numpy as np
# Reading the image from the path and storing it in the variable img.
img = cv2.imread("../Resources/konferansebord.jpg")
# Setting the width and height of the output image.
width, height = 250, 350
# Creating a list of poi... | GurjotSinghAulakh/Python-openCV | 5. Wrap Perspective/chapter5.py | chapter5.py | py | 930 | python | en | code | 0 | github-code | 36 |
16039262995 | """Dessert classes."""
class Cupcake:
"""A cupcake."""
#Class attribute
cache = {} #Dictionary to store all cupcake instances by name
cls = "cupcake"
def __init__(self, name, flavor, price):
"""Initialize an instance of the class Cupcake"""
self.name = name
self.flavor =... | laniludwick/baking-workflow-using-class-methods | desserts.py | desserts.py | py | 2,793 | python | en | code | 0 | github-code | 36 |
36085086671 | import numpy as np
import time
from pipython import GCSDevice, pitools
from core.module import Base, Connector
from core.configoption import ConfigOption
from interface.confocal_scanner_interface import ConfocalScannerInterface
class ConfocalScannerPI_E727(Base, ConfocalScannerInterface):
""" Confocal scanner fo... | chrberrig/qudi_from_lab | hardware/confocal_scanner_PI_E-727.py | confocal_scanner_PI_E-727.py | py | 12,609 | python | en | code | 0 | github-code | 36 |
13963392850 | #!/usr/bin/python3
import cv2
import numpy as np
import imutils
import argparse
ap = argparse.ArgumentParser()
ap.add_argument("-v", "--video", help="path to the video file", default="video.mp4")
ap.add_argument("-t", "--template", help="template png file with the wanted output dimensions")
ap.add_argument("-o", "--o... | rickerp/video-page-scanner | main.py | main.py | py | 3,233 | python | en | code | 1 | github-code | 36 |
243273712 | import json
from flask import Flask, render_template, \
request, redirect, flash, \
url_for
def _initialize_clubs():
data = {'clubs': []}
with open('clubs.json' , 'w') as club_file:
json.dump(data, club_file, indent=4)
return []
def loadClubs():
with open(... | Arz4cordes/Projet11_OC | Python_Testing-master/server.py | server.py | py | 5,876 | python | en | code | 0 | github-code | 36 |
21672257496 | import os
from pathlib import Path
import secrets
import uuid
from PIL import Image
from flask import Flask, render_template, redirect, url_for, flash, request,send_file,send_from_directory
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed,FileField
from wtform... | johnny1304/Team9 | app.py | app.py | py | 123,592 | python | en | code | 2 | github-code | 36 |
74551933224 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
test module
'''
__author__ = 'lierl'
class Student(object):
def __init__(self, name, score):
self.__name = name#外部不能访问两个属性
self.__score = score
def get_name(self):
return self.__name
def get_score(self):
return self.__sc... | dream7319/djtest | demo/clazz.py | clazz.py | py | 1,633 | python | en | code | 0 | github-code | 36 |
36815278942 | from ckeditor_uploader.fields import RichTextUploadingField
from django.core.exceptions import ValidationError
from django.db import models
# Create your models here.
from django.utils.safestring import mark_safe
from extensions.utils import jalali_converter
class Setting(models.Model):
STATUS = (
('Tru... | amirmovafagh/ecommerce-project-django | home/models.py | models.py | py | 8,228 | python | fa | code | 0 | github-code | 36 |
34647062894 | import os
import socket
import threading
import time
import tkinter as tk
import tkinter.messagebox
from io import BytesIO
import customtkinter
import pafy
import pyperclip
import vlc
from PIL import ImageTk, Image
from pyngrok import ngrok
from pytube import Playlist
from pytube import YouTube
from requests import ge... | Salodo/Sallify.py | Sallify.py | Sallify.py | py | 15,965 | python | en | code | 1 | github-code | 1 |
8030433043 | import base64
import io
import os
from PIL import Image, ImageDraw, ImageFont
import requests
class WelcomeCard:
BASE_FONT = ImageFont.truetype(
os.path.abspath("ether/assets/fonts/Inter-Medium.ttf"), 16
)
WELCOME_FONT = ImageFont.truetype(
os.path.abspath("ether/assets/fonts/Inter-Bold.t... | Ether-DiscordBot/Ether-Bot | ether/cogs/event/welcomecard.py | welcomecard.py | py | 1,467 | python | en | code | 4 | github-code | 1 |
7293405146 | import requests
import urllib.parse as urlparse
import json,sys
from pprint import pprint
isErrorbased = ['"', "'", '--']
isJson = []
CYELL = '\033[1;93m'
CENDYELL = '\033[0m'
CGRE = '\033[1;92m'
CYAN = '\033[1;36m'
RED = '\033[1;31m'
class SimpleSqlCheck():
def __init__(self, isUrl, isLocation):
se... | wahyuhadi/AutoSecurity-Check | Controllers/SqlInjection/sql.py | sql.py | py | 3,251 | python | en | code | 7 | github-code | 1 |
28154078176 | import os, os.path
import string
import cherrypy
import datetime
import requests
import lxml
import cssselect
import lxml.html
import json
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#from email.MIMEBase import MIMEBase
from pprint import pprint
class Data(objec... | rudy-stephane/callfortender | webpython.py | webpython.py | py | 31,309 | python | en | code | 0 | github-code | 1 |
73574411873 | from django.shortcuts import render,get_object_or_404
from django.http import HttpResponse
# Create your views here.
from .serializer import CustomerSerializer, ProductSerializer, SubscriptionSerializer
from .models import Customer, Product, Subscription
from rest_framework import status
from rest_framework.decorators ... | Shulabh-968026/myproject | myapp/views.py | views.py | py | 3,349 | python | en | code | 0 | github-code | 1 |
72646957153 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from rest_framework.decorators import api_view
from django.shortcuts import get_object_or_404
from rest_framework import status
from rest_framework.views import APIView... | k-root/its_farm | app/views.py | views.py | py | 5,031 | python | en | code | 0 | github-code | 1 |
23248709753 |
"""env.py: Environment configuration for the maze simulation"""
__author__ = "Pablo Alvarado"
__copyright__ = "Copyright 2020, Pablo Alvarado"
__license__ = "BSD 3-Clause License (Revised)"
import math
import random
import maze
import agent
class Environment:
""""Environment class
The environment hold... | alonso9v9/AI_Maze_Solver | src/env.py | env.py | py | 4,641 | python | en | code | 0 | github-code | 1 |
4422298304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Common fixtures and utils for io tests."""
import copy
import os
import pytest
from orion.core.evc import conflicts
@pytest.fixture()
def config_file():
"""Open config file with new config"""
file_path = os.path.join(
os.path.dirname(os.path.abspath... | lebrice/orion | tests/unittests/core/io/conftest.py | conftest.py | py | 1,819 | python | en | code | null | github-code | 1 |
29180364279 | # DSC 510
# Week 11
# Programming Assignment Week 11
# Author: Reenie Christudass
# 05/23/2022
# Change#:1
# Change(s) Made: Cash register program
# Date of Change: 05/23/2022
# Author: Reenie Christudass
# Change Approved by: Michael Eller
# Date Moved to Production: 05/23/2022
import locale
from termcolor import co... | reeniecd/DSC510-T301 | Week 11 assignment.py | Week 11 assignment.py | py | 2,870 | python | en | code | 0 | github-code | 1 |
1287821530 | from matplotlib import pyplot as plt
def plot_forest_management(gamma_values, iterations, time_array, rewards, title):
plt.plot(gamma_values, rewards)
plt.ylabel('Rewards')
plt.xlabel('Discount')
plt.title('{} - Reward vs Discount'.format(title))
plt.grid()
plt.show()
plt.plot(gamma_value... | mishabuch/Assignment-4 | forest_plots.py | forest_plots.py | py | 694 | python | en | code | 0 | github-code | 1 |
42633194074 | import exp1
if __name__ == '__main__':
# test_classifier()
# name = ['LSTM', 'CNN']
name = ['bilstm']
cuda = False
# dga = ['khaos_original', 'kraken', 'gozi', 'suppobox', 'maskDGA', 'our']
dga_test = ['maskDGA']
for model in name:
exp1.classification(model, 1, ' ', dga_te... | abcdefdf/PKDGA | pkdga/exp2.py | exp2.py | py | 371 | python | en | code | 4 | github-code | 1 |
33578161896 |
import numpy as np
def _extend(M, sym):
"""Extend window by 1 sample if needed for DFT-even symmetry"""
if not sym:
return M + 1, True
else:
return M, False
def _len_guards(M):
"""Handle small or incorrect window lengths"""
if int(M) != M or M < 0:
raise ValueError('Window... | 11mhg/welch_dcp | welch/welch.py | welch.py | py | 18,063 | python | en | code | 0 | github-code | 1 |
72339392995 | from unittest import TestCase, main
import ssc2ce_cpp as m
class TestCoinbaseParser(TestCase):
def setUp(self):
self.parser = m.CexParser()
self.top_prices = {}
self.top_bid = 0
self.top_ask = 0
self.book_setup_count = 0
self.parser.set_on_book_setup(self.handle_bo... | olned/ssc2ce-cpp | tests/cex_test.py | cex_test.py | py | 2,684 | python | en | code | 0 | github-code | 1 |
22857365855 | from __future__ import division
from models.nade.nade_keras import RNade
import numpy as np
import unittest
__author__ = 'theopavlakou'
rng = np.random
np.set_printoptions(precision=4)
def sample(N):
"""
Returns a vector of dimension 2 which has been sampled from a mixture of Gaussians
with the followin... | theopavlakou/kerasmodels | test/test_rnade_keras.py | test_rnade_keras.py | py | 3,607 | python | en | code | 1 | github-code | 1 |
36938950956 | import os
import zipfile
from conftest import RESOURCES_DIR
def test_zip_file():
with zipfile.ZipFile(os.path.join(RESOURCES_DIR, 'file_hello.zip')) as zip_file:
zip_file.extract('file_hello.txt', path=RESOURCES_DIR)
name_list = zip_file.namelist()
print(name_list)
text = zip_file.... | BaykovAleksandr/qa_guru_7_files | tests/test_zip.py | test_zip.py | py | 583 | python | en | code | 0 | github-code | 1 |
38568773635 | import basf2 as b2
import modularAnalysis as ma
import variables.collections as vc
import sys
mode = sys.argv[1]
print("passed mode:", mode)
nfs_path = "/nfs/dust/belle2/user/axelheim/MC_studies/my6modes"
root_subdir = "wSim_wReco"
events_num_identifier = "_15000_events"
# create path
path = b2.create_path()
# loa... | axelHeim/MCstudies | my6modes/writeOutNTuples.py | writeOutNTuples.py | py | 2,685 | python | en | code | 0 | github-code | 1 |
637784 | """ Module for tables of the Auto Typing paper
"""
# Imports
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import glob, os, sys
import warnings
import pdb
from pkg_resources import resource_filename
from astropy import units as u
from astropy.table import Tabl... | pypeit/spit | papers/First/Tables/py/auto_type_tabs.py | auto_type_tabs.py | py | 6,524 | python | en | code | 2 | github-code | 1 |
897362652 | import os
from flask import Blueprint, jsonify
from ..decorators import required_login
from ..utilities import create_jwt
jwt_rest_bp = Blueprint('jwt_rest_bp', __name__)
@jwt_rest_bp.route('/api/v1/user', methods=['GET'])
@required_login
def jwt(user):
username = user.username
email = user.email
token... | CossackDex/ZPI_AuthServer | auth_server_application/rest_jwt/jwt_rest_routes.py | jwt_rest_routes.py | py | 556 | python | en | code | 1 | github-code | 1 |
19990022228 | #!/usr/bin/python3
import arcade
screen_width = 600
screen_height = 600
arcade.open_window(screen_width, screen_width, "drawing example")
arcade.set_background_color(arcade.color.WHITE)
arcade.start_render()
# draw the face
x = 300
y = 300
radius = 200
arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW)
# d... | alvo254/tutorial | game.py | game.py | py | 769 | python | en | code | 0 | github-code | 1 |
2022008519 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Yijia Zheng
# @email : yj.zheng@siat.ac.cn
# @Time : 2019/11/29 11:20:37
import rdkit
import rdkit.Chem as Chem
import copy
import sys
import argparse
from multiprocessing import Pool
from util.chemutils import get_clique_mol, tree_decomp, get_mol, get_smiles,... | aI-area/T-S-polish | scripts/gen_vocab.py | gen_vocab.py | py | 1,284 | python | en | code | 0 | github-code | 1 |
70983029473 | from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import inspect
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///portfolio.db'
db = SQLAlchemy(app)
class Portfolio(db.Model):
id = db.Column(db.Integer, primary_key=True)
title =... | TubolovArtem/Laba-9-by-Tubolov-Artem | task/app.py | app.py | py | 1,581 | python | en | code | 0 | github-code | 1 |
3517436182 | A=input()
B=input()
arr = [[0]*(len(B)+1) for _ in range(len(A)+1)]
for i in range(1, len(A)+1):
for j in range(1, len(B)+1):
if A[i-1] == B[j-1]:
arr[i][j] = arr[i-1][j-1] + 1
ans=0
for i in arr:
ans=max(max(i),ans)
print(ans) | leezzangmin/pythonBOJ | 파이썬/5582.py | 5582.py | py | 269 | python | en | code | 0 | github-code | 1 |
40325564295 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
student_data = pd.read_csv(
"data/HSLS_2016_v1_0_CSV_Datasets/hsls_16_student_v1_0.csv", na_values=[-9, -8, -5, -7, -4, -3])
student_data.head()
# -9 = No Unit Response
# -8 = Missing
# -5 = Supressed
# -7 = Skipped
# -4 ... | karthikvetrivel/HSLS-Predictive-Modellng | input_extract.py | input_extract.py | py | 1,327 | python | en | code | 0 | github-code | 1 |
1563191359 | class CNN():
def __init__(self, input_shape):
self.mInput_shape = input_shape
def buildModel(self):
model = Sequential()
model.add(Conv2D(14, kernel_size=3, padding='same', activation='relu', input_shape= self.mInput_shape))
model.add(MaxPool2D((2,2), padding='same'))
mo... | ravi230195/Fashion-MNIST-Classification-K-Means-and-GMM | AutoEncoder.py | AutoEncoder.py | py | 1,872 | python | en | code | 0 | github-code | 1 |
42524493858 | """Utilities for parsing isoformat strings into datetime types.
"""
from datetime import datetime, date, time
def datetimefromisoformat(s):
"""Parse an isoformat string into a datetime.datetime object.
"""
date, time = s.split()
year, month, day = _parsedate(date)
hour, minute, second, microsecond... | timparkin/timparkingallery | share/pollen/datetimeutil.py | datetimeutil.py | py | 2,671 | python | en | code | 2 | github-code | 1 |
5112939663 | import argparse
import importlib
from collections import namedtuple
from typing import Dict
CommandInfo = namedtuple("CommandInfo", "module_path, class_name")
commands_dict: Dict[str, CommandInfo] = {
"download": CommandInfo("gtd.cli.download", "DownloadCommand"),
"export": CommandInfo("gtd.cli.export", "Expo... | muse-research-lab/cloud-traces-comparison | gtd/cli/commands.py | commands.py | py | 898 | python | en | code | 1 | github-code | 1 |
23881066970 | #!/local/data/atorus1/dora/Compilers/epd-7.3-1-rh5-x86_64(1)/bin/python
##!/Library/Frameworks/Python.framework/Versions/Current/bin/python
##!/Users/dora/Library/Enthought/Canopy_32bit/User/bin/python
import scipy
from numpy import ndarray, zeros, array, size, sqrt, meshgrid, flipud, floor, where, amin, argmin,int
... | AntoXa1/T9 | transmission_properties2.py | transmission_properties2.py | py | 17,801 | python | en | code | 0 | github-code | 1 |
1023399821 | from aiogram import types, Dispatcher
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Text
from aiogram.dispatcher.filters.state import State, StatesGroup
from keyboards import admin_batton
from create_bot import bot, dp
from data_base import sqlite_db
from aiogram.types import InlineKe... | DmitriPrilucki/pizza-bot-this-python | handlers/admin.py | admin.py | py | 4,475 | python | en | code | 1 | github-code | 1 |
70888592035 | #!/usr/bin/env python
import abc
import re
import os
import sys
from etl.setup import ETLEnv
from etl.tools import MetadataWriter, get_current_metadata, RhizomeField, FIELDS_TO_DEDUPE, OUTPUT_COLS
# REVIEW: Add a step to ETL process to create 1 display date and 1 searchable date, which should be a year.
# REVIEW: ... | rhizomes-project/rhizomes-etl | etl/etl_process.py | etl_process.py | py | 11,730 | python | en | code | 1 | github-code | 1 |
11641058565 | import os
import pickle
import mediapipe as mp
import cv2
import matplotlib.pyplot as plt
mp_hands = mp.solutions.hands
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
hands = mp_hands.Hands(static_image_mode=True, min_detection_confidence=0.3)
DATA_DIR = './rawdata'
data =... | Ajyarra98/SPN_team12 | preprocessing.py | preprocessing.py | py | 1,531 | python | en | code | 0 | github-code | 1 |
12938434886 | # File: pain_job_estimator.py
# Project: Starting Out with Python
# Author: Matthew Forbes
# History: Version 1.1 February 9, 2022
def main():
sq_ft = float(input("Please enter the square feet of wall space to be painted: "))
paint_price_per_gallon = float(input("Please enter the paint price per gallon: ... | mcforma/Programs | paint_job_estimator.py | paint_job_estimator.py | py | 1,157 | python | en | code | 0 | github-code | 1 |
13671395149 | import sys
from loader import extract_words
if __name__ == '__main__':
list1 = sys.argv[1]
list2 = sys.argv[2]
with open(list1) as f:
l1_words = extract_words(f)
with open(list2) as f:
l2_words = extract_words(f)
print(f'Words in {list1} not in {list2}:')
print(l1_words - l2_... | domino14/word-history | compare_words.py | compare_words.py | py | 477 | python | en | code | 1 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.