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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38729573666 | import tensorflow as tf
# Reading data and set variables
# MNIST Dataset
from tensorflow.examples.tutorials.mnist import input_data
# Check out https://www.tensorflow.org/get_started/mnist/beginners for
# more information about the mnist dataset
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
# prin... | The-G/PYTHON_study | Tensorflow study/Lecture07-Learning rate, Evaluation, MNIST/Lab7-2.py | Lab7-2.py | py | 11,779 | python | ko | code | 0 | github-code | 1 |
27962348329 | from google.appengine.api import taskqueue
from google.appengine.api import background_thread
import json
import random
from util import *
import sys
import urllib2
def transpose(ind1, ind2):
"""
Adds a subroute to the best location of the other individual
"""
rfrom = random.randint(0, len(ind1) - 1)
... | domjullier/gae_tsp | worker.py | worker.py | py | 3,848 | python | en | code | 0 | github-code | 1 |
41381149885 | import json
filename = "File-System/json/favourite_num.json"
# number = input("What's your favourite number? ")
# with open(filename, "w") as f_object:
# json.dump(number, f_object)
# print("Thanks! I'll remember that.")
with open(filename, "r") as f:
content = json.load(f)
print("I know your favourite... | meenphilip/Python-Basics | File-System/json/favourite_number.py | favourite_number.py | py | 344 | python | en | code | 0 | github-code | 1 |
11207175018 | """
Tests for data obfuscation tasks.
"""
import errno
import json
import logging
import os
import shutil
import tarfile
import tempfile
import xml.etree.ElementTree as ET
from unittest import TestCase
from luigi import LocalTarget
from mock import MagicMock, sentinel
import edx.analytics.tasks.export.data_obfuscati... | openedx/edx-analytics-pipeline | edx/analytics/tasks/export/tests/test_data_obfuscation.py | test_data_obfuscation.py | py | 31,225 | python | en | code | 90 | github-code | 1 |
43901190306 | import tkinter as tk
import random
from names import name_list
from traits import trait_list
from appearence import appearence_list
from inventory import inventory_list
# tkinter shit
root = tk.Tk()
root.configure(bg = 'grey')
# functions
def save():
with open("Saved NPCs.txt", "a") as file:
... | bonsaipropaganda/NPC-Generator | main.py | main.py | py | 4,049 | python | en | code | 0 | github-code | 1 |
19686894291 | #Author: Gentry Atkinson
#Organization: Texas University
#Data:11 May, 2021
#Create segmentations of the raw data file using 3 methds
#Method 1: regular breaks every 150 samples
#Method 2: 150 samples centered on a PIP
#Method 3: Divide segments at PIPs, resample each segment to 150
from scipy.signal import resample
... | gentry-atkinson/pip_test | create_segmentations_rw.py | create_segmentations_rw.py | py | 2,615 | python | en | code | 0 | github-code | 1 |
7740117405 | import pandas as pd
import numpy as np
import os
path, dirs, files = next(os.walk("./input/Dataset/GlobalDataset/Splitted/"))
file_count = len(files)
data1 = pd.DataFrame()
for nb_files in range(file_count):
datag = pd.read_csv(f'{path}{files[nb_files]}', encoding="ISO-8859โ1", dtype = str)
data1 = pd.concat(... | EagleEye1107/E-GNNExplainer | src/dataset_analysis/select_k_best.py | select_k_best.py | py | 3,500 | python | en | code | 0 | github-code | 1 |
21473481999 | from pattern.text.en import singularize
from PySide6.QtWidgets import QMainWindow
from translatepy.translators.google import GoogleTranslate
from hitori_srs.text import clear_sentence, clear_word
from hitori_srs.views.definitions_dialog import DefinitionsDialog
from hitori_srs.views.ui.main_window import Ui_MainWindow... | nikohonu/hitori-srs | hitori_srs/views/main_window.py | main_window.py | py | 2,040 | python | en | code | 0 | github-code | 1 |
7004649881 | def bmi_calc():
height = input('What is your height (in)?')
height= int(height)
weight = input('What is your weight (lbs)?')
weight = int(weight)
bmi = 703*(weight/(height**2))
print('Your bmi is {:.1f}'.format(int(bmi)))
if bmi>=30:
print("You fat shit, you're obese")
elif bmi>=... | apiispanen/MIS3640 | Session 6/BMI_Calc.py | BMI_Calc.py | py | 488 | python | en | code | 0 | github-code | 1 |
41378387257 | from django import urls
from django.conf.urls import url
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^allVehicles/(?P<otype>[\w]+)/$',
views.filterVehicle_view, name='VehicleFilter'),
url(r'^editPers... | WWalusiak/Fleetmanager | FleetManager/manager/urls.py | urls.py | py | 3,185 | python | en | code | 0 | github-code | 1 |
37084052346 | #!/usr/bin/python3
# _*_ coding: utf-8 _*_
import os
import pandas as pd
from mirsnp.utils import check_outputf
from mirsnp.parse_gtf import parse_gtf
def get_trans_info(gtf):
info = parse_gtf(gtf)
res = {}
for trans, data in info.items():
gene = data[0]
strand = data[2]
exons = ... | ghkly/miRsnp | mirsnp/trans_input.py | trans_input.py | py | 2,316 | python | en | code | 0 | github-code | 1 |
30721629451 | import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler
import sklearn as sk
#from rouge_score import rouge_scorer
from transformers import T5Tokenizer, T5ForConditionalGeneration
import os
import torch
if t... | vksoniya/fakenewsdetectionframework | Utils/T5Summarizer.py | T5Summarizer.py | py | 5,261 | python | en | code | 1 | github-code | 1 |
5873286899 | from credentials import aws_key, aws_id, aws_region, sqs_name, arn
from time import sleep
import json
import boto.sqs
import boto.sns
from boto.sqs.message import Message
import ast
from alchemyapi import AlchemyAPI
from elasticsearch import Elasticsearch, RequestsHttpConnection
from requests_aws4auth import AWS4Auth
i... | litesaber15/elastictweetmap | Worker/worker.py | worker.py | py | 2,465 | python | en | code | 1 | github-code | 1 |
25463176927 | import bz2
import csv
import argparse
import os
import numpy as np
import tensorflow as tf
from sklearn.naive_bayes import GaussianNB
def parse_argument():
parser = argparse.ArgumentParser(description='arg parser')
parser.add_argument('--input_dir', default='cp_loss_count_per_game')
parser.add_argument('-... | CSSLab/maia-individual | 4-cp_loss_stylo_baseline/train_cploss_per_game.py | train_cploss_per_game.py | py | 5,449 | python | en | code | 18 | github-code | 1 |
41210654822 | from pymongo import MongoClient
client= MongoClient('localhost:27017')
db = client.train
def read():
try:
trainCol=db.traincsv.find()
print("All data From database")
for train in trainCol:
print(train)
except Exception as e:
print(str(e))
read()
| kaif3120/manuals | BIG DATA PRACTICALS/PRAC 8 MONGO FIND.py | PRAC 8 MONGO FIND.py | py | 303 | python | en | code | 0 | github-code | 1 |
72495902115 | import argparse
from functools import partial
import json
import logging
from multiprocessing import Pool
import os
import sys
sys.path.append(".") # an innocent hack to get this to run from the top level
from tqdm import tqdm
from openfold.data.mmcif_parsing import parse
from openfold.np import protein, residue_co... | aqlaboratory/openfold | scripts/generate_chain_data_cache.py | generate_chain_data_cache.py | py | 4,124 | python | en | code | 2,165 | github-code | 1 |
70373548833 | #!/usr/bin/env Python
# coding=utf-8
from numpy import *
def sigmoid(inX):
return 1.0/(1+exp(-inX))
def stocGradAscent1(dataMatrix, classLabels, numIter=150):
m,n = shape(dataMatrix)
weights = ones(n) #initialize to all ones
for j in range(numIter):
dataIndex = range(m)
f... | crazycatcat/messy-data | mainsite/log.py | log.py | py | 2,096 | python | en | code | 0 | github-code | 1 |
70122758435 | from typing import Any, Dict
from django.forms.models import BaseModelForm
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.contrib import messages
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import reverse_lazy
from django.views.generic ... | Lifanna/geology_proj | geology_proj/main/views.py | views.py | py | 19,256 | python | en | code | 0 | github-code | 1 |
40903031893 | '''
In this project, you will visualize the feelings and language used in a set of
Tweets. This starter code loads the appropriate libraries and the Twitter data you'll
need!
'''
import json
from textblob import TextBlob
import matplotlib.pyplot as plt
from wordcloud import WordCloud
#Get the JSON data
tweetFile = o... | RachelA314/Aboutme | DataVisualizationProject/Data_vis_project_pt1.py | Data_vis_project_pt1.py | py | 2,883 | python | en | code | 0 | github-code | 1 |
2879811950 | import tensorflow as tf
import numpy as np
from sklearn.metrics import mean_squared_error, mean_absolute_error
from tensorflow.keras import optimizers
from datetime import datetime as dt
from load_data import load_wph_train, inverse_transform, load_wph_test
from EnvConfounderIRM import EnvAware
path = '/data/u... | RoeyW/ood-for-smart-cities | Model/PIRM_wph.py | PIRM_wph.py | py | 7,828 | python | en | code | 0 | github-code | 1 |
32434406258 | from contextlib import ExitStack, contextmanager
from fnmatch import fnmatch
from glob import glob
from params_proto import ParamsProto, Proto, Flag
class UploadArgs(ParamsProto):
""" ML-Logger upload command
Example:
ml-upload --list # to see all files in the current directory for upload
m... | geyang/ml_logger | ml_logger/cli/upload.py | upload.py | py | 4,894 | python | en | code | 176 | github-code | 1 |
30768822737 | import tkinter as tk
from PIL import ImageTk, Image
import io
class PlantWidget(tk.Frame): # tk.Frame
def delete_widget_and_data(self):
self.my_plant_service.delete_user_plant(self.values["_id"])
self.destroy()
def add_plant_to_pot(self):
self.my_plant_service.handle_user_plant(self.... | JuleZg/pyfloraapp | model/plant_widget.py | plant_widget.py | py | 2,925 | python | en | code | 0 | github-code | 1 |
35672480130 | import os
import json
import csv
class dirSummary:
def __init__(self, dirName):
self.dirName = dirName
self.file = open(os.path.join(self.dirName, self.dirName+"_map.csv"), "w")
fieldnames = ["ID", "Title", "Acitvity Type", "Date", "Time", "Distance","Moving Time"]
self.writer = csv.DictWriter(self.file, fiel... | Abhiram98/strava-scraper | scraper/dirSummary.py | dirSummary.py | py | 1,381 | python | en | code | 0 | github-code | 1 |
39090265105 | import addressbook_pb2
import sys
def PromptForAddress(person):
person.id = int(raw_input("Enter person ID number: "))
person.name = raw_input("Enter name: ")
email = raw_input("Enter email address (blank for none): ")
if email != "":
person.email = email
while True:
number = raw_input("Enter a pho... | ruifengli-cs/protobuf-python | python/add_person.py | add_person.py | py | 1,528 | python | en | code | 0 | github-code | 1 |
5972679709 | # Uses python3
import sys
import numpy as np
def lcm(a, b):
#write your code here
gcd = gcd_fast(b, a % b)
# print(gcd)
gcd = b // gcd
# print(gcd)
gcd = a * gcd
# print(gcd)
return gcd
def gcd_fast(a, b):
if b == 0:
return a
return gcd_fast(b, a % b)
if __name__ == '__main__':
input = sys.stdin.read... | vpodshiv/alg_uc | wk2/01_introduction_starter_files/lcm/lcm.py | lcm.py | py | 389 | python | en | code | 0 | github-code | 1 |
22406694020 | # -*- coding: utf-8 -*-
import sys, os
#input_dir = 'logs/nginx/'
#log_file = 'uwsgi_wx.log.20200418'
#output_dir = 'logs/nginx/'
#output_file = 'uwsgi_wx2.log'
#with open(os.path.join(input_dir, log_file), 'r') as f1, \
# open(os.path.join(output_dir, output_file), 'w') as f2:
# line = f1.readline()
... | jack139/mlog | train/filter.py | filter.py | py | 1,886 | python | en | code | 0 | github-code | 1 |
29598589421 |
# coding: utf-8
# In[2]:
#!pip install --upgrade pip
#!pip install casadi
# In[3]:
# Import casadi
from casadi import *
# Import Numpy
import numpy as np
# Import matplotlib
import matplotlib.pyplot as plt
# Import Scipy to load .mat file
import scipy.io as sio
import pdb
# In[4]:
def simulate_MPC(d_full, S... | ell-hol/mpc-DL-controller | data_generator.py | data_generator.py | py | 11,272 | python | en | code | 61 | github-code | 1 |
34002926250 | from urllib2 import Request, urlopen
import xml.etree.ElementTree as ET
import json
url_request = Request('http://inciweb.nwcg.gov/feeds/rss/incidents/state/3')
try:
url_response = urlopen(url_request)
rss_content = url_response.read()
except Exception as e:
print(str(e))
xml_root = ET.fromstring(rss_con... | anshulankush/CronkitePython | PhpToPython/wildfire_python_parser.py | wildfire_python_parser.py | py | 1,518 | python | en | code | 0 | github-code | 1 |
25431171399 | import sys
input = sys.stdin.readline
n,t = map(int,input().split())
gazy = [[0,0]]+[list(map(int,input().split())) for _ in range(n)]
dp = [[0]*(t+1) for _ in range(n+1)]
for i in range(1, n+1):
for j in range(1, t+1):
if j - gazy[i][0] >= 0:
dp[i][j] = max(dp[i-1][j], dp[i-1][j-g... | reddevilmidzy/baekjoonsolve | ๋ฐฑ์ค/Gold/14728.โ
๋ฒผ๋ฝ์น๊ธฐ/๋ฒผ๋ฝ์น๊ธฐ.py | ๋ฒผ๋ฝ์น๊ธฐ.py | py | 409 | python | en | code | 3 | github-code | 1 |
22386637474 | import serial
import time
import binascii
ser = serial.Serial("COM8", 9600)
t = (0x1F00FFFF).to_bytes(4, byteorder="big")
print(t)
while True:
time.sleep(0.1)
ser.write(t)
result = ser.read_all()
if result != b'':
print(result) | yato-Neco/Tukuba_Challenge | main_program/rust/Robot/sw.py | sw.py | py | 254 | python | en | code | 2 | github-code | 1 |
23228107132 | import cv2
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
import subprocess
import kakao_MES_api
facenet = cv2.dnn.readNet('face_detector/deploy.prototxt', 'face_dete... | parksj0923/KORartilleryman | 5corps_artillery/makerthon/final/raspberry/main.py | main.py | py | 2,810 | python | en | code | 1 | github-code | 1 |
4614264680 | import pygame
import os
pygame.init()
FONTS = [
pygame.font.Font(pygame.font.get_default_font(), font_size) for font_size in [48, 36, 16, 12]
]
DEFAULT_FONT = 2
COLORS = {
"bg": (200, 200, 200), # ่ๆฏ้ข่ฒ
"select": (0, 139, 139),
"current": (255, 192, 203),
"line": (175, 175, 175),
"wall": (50... | BigShuang/Pathfinding-algorithm-display | square block grid/basic_animation.py | basic_animation.py | py | 11,175 | python | en | code | 4 | github-code | 1 |
4166191559 | # Exercise 9
def convertToRoman(input):
if type(input) is not int:
return "invalid"
if (input > 5000 or input < 1):
return "invalid"
ints = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
nums = ('M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I')
result =... | mcc-sw-eng-course/python-programs-maximussage1 | L4/roman_converter.py | roman_converter.py | py | 491 | python | en | code | 0 | github-code | 1 |
72528231395 | num_rows = int(input())
num_cols = int(input())
# Note 1: You will need to declare more variables
# Note 2: Place end=' ' at the end of your print statement to separate seats by spaces
letter1 = '1'
letter2 = 'A'
for row in range(num_rows): # sets maximum changes to letter1.
letter2 = 'A' # makes sure letter2 sta... | kylereddoch/IT140-Python | Challenge Activities/CA_4.8.2.py | CA_4.8.2.py | py | 766 | python | en | code | 5 | github-code | 1 |
25541238216 | import traceback
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import redirect
import json
from . import ibood_db
from .ibood_scraper import POSSIBLE_FILTERS
def home(request):
if request.method == 'POST':
data = req... | wardgeronimussmets/Aviato | master/aviato/iBOOD/views.py | views.py | py | 3,913 | python | en | code | 0 | github-code | 1 |
35939540734 | '''
Created on Nov 28, 2012
@author: cosmin
'''
from google.appengine.ext import webapp, db
import jinja2
import os
import logging as log
jinja_environment = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
class ClustersP(webapp.RequestHandler):
def get(self):
'''... | cosminstefanxp/freely-stats | remote-code/ClustersP.py | ClustersP.py | py | 1,456 | python | en | code | 0 | github-code | 1 |
22147146770 | import json
import os
import time
from flask import Flask, jsonify, make_response
from flask import request
from flask_cors import CORS
import logging
import requests
from models.reqdb import Request, Base
from models.model import Model
from models.container import Container
from models.configurations import RequestsS... | NicholasRasi/ROMA2 | components/requests_store/main.py | main.py | py | 13,696 | python | en | code | 0 | github-code | 1 |
39713067351 | '''
Mainly for performace analysis
link_usage_avg, link_usage_most, swicth_usage_avg, switch_usage_most under different flow numbers with a given topo
'''
class Evaluator:
def __init__(self, topo):
self.network = topo
# self.avg_link_usage, self.avg_switch_usage = self.computeAvgUsage(self.network)... | Meditator-hkx/Algorithm_graduate | Algorithm_graduate/Python_Test/com/ruleplacement/evaluator.py | evaluator.py | py | 1,026 | python | en | code | 1 | github-code | 1 |
24667162983 | from src.parser import Detector
import src.parser as parser
CONTRACTS = ["SafeMath", "Ownable","Pausable", "ERC20Basic", "ERC20","BasicToken","StandardToken","UpgradedStandardToken","TetherToken"]
TETHER_FUNCTIONS = ["TetherToken", "transfer", "transferFrom", "balanceOf", "approve", "allowance", "deprecate", "totalSup... | Sapo-Dorado/FortaKnight | test/parser_test.py | parser_test.py | py | 2,546 | python | en | code | 2 | github-code | 1 |
31298542819 |
'''
Read COVID-19 case data from HDX and store as a set of json files.
This can be used to provide a no-backend API if the files are saved
in the DocumentRoot of a server. For example:
http://some.host/all.json # global data, plus manifest of other countries
http://some.host/CAN.json # a specific country
Usage:
... | hkashiwase/decdg-covid19 | python/cvapi.py | cvapi.py | py | 4,710 | python | en | code | null | github-code | 1 |
8324770078 | from .selection import Selection
class Tournament(Selection):
def __init__(self, target, gen):
super().__init__()
self.selection = self.__selection(target, gen)
def __selection(self, target, gen):
ext = self.extremum_value.value(gen, target)
fitness_result = {}
result ... | EvolutionaryAlgorithms/extremums | app/entities/selection/tournament.py | tournament.py | py | 656 | python | en | code | 0 | github-code | 1 |
14311122883 | from turtle import Turtle
import time
import random
COLORS = ["red", "orange", "yellow", "green", "blue", "purple"]
STARTING_MOVE_DISTANCE = 5
MOVE_INCREMENT = 5
CAR_START_X = 350
class CarManager(Turtle):
def __init__(self):
super().__init__()
self.speed = STARTING_MOVE_DISTANCE
self.car... | ShivamPatel-24/Python-Projects | turtle-crossing-start/car_manager.py | car_manager.py | py | 1,179 | python | en | code | 0 | github-code | 1 |
14661828942 | from fastapi import FastAPI, Depends
from app.routers import security, users, images, services
# < Development:
from fastapi.middleware.cors import CORSMiddleware
# >
from app.data.database import database
from app.data.io_files import create_folders
from app.security.methods import (
create_admin, create_sample... | sonarom-org/ariavt-backend | app/main.py | main.py | py | 1,298 | python | en | code | 0 | github-code | 1 |
73033968673 | # -*- coding: utf-8 -*-
'''
Management of MySQL databases (schemas)
=======================================
:depends: - MySQLdb Python module
:configuration: See :py:mod:`salt.modules.mysql` for setup instructions.
The mysql_database module is used to create and manage MySQL databases.
Databases can be set as eithe... | shineforever/ops | salt/salt/states/mysql_database.py | mysql_database.py | py | 3,430 | python | en | code | 9 | github-code | 1 |
7227613227 | from time import sleep
class Wolfram():
def __init__(self, arg=0):
arg = bin(arg)[2:][-1::-1] + '0' * 7
self.rules = {}
p = 0
for i in range(2):
for j in range(2):
for k in range(2):
self.rules[i, j, k] = int(arg[p])
... | andrewsonin/turing_machine_and_automatons | wolfram.py | wolfram.py | py | 825 | python | en | code | 0 | github-code | 1 |
40253031132 |
# 1.ๅไธพๆไธชๆไปถๅคนๅ
ๆๆ็ๆไปถๅ๏ผๅๅ
ฅๅฐa.txtๆไปถ
import os
# def show_file(dir_path,file): #ไผ ้ไธไธช็ฎๅฝ "E:\python0421\day12\python0421็ญday12ไฝไธ20200511e"
# file_lst = os.listdir(dir_path)
# for f in file_lst: #้ๅ็ฎๅฝๅ่กจ
# path = dir_path+'/'+f #ๆผๆฅๅฎๆด่ทฏๅพ
# if os.path.isfile(path): #ๅคๆญๆฏๅฆๆฏๆไปถ๏ผๆฏๅฐฑ็ดๆฅๆๅฐ
# file.write... | liujiang9/python0421 | dmeo/day14/code/demo_01homework.py | demo_01homework.py | py | 2,829 | python | zh | code | 1 | github-code | 1 |
43472299216 | from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import Group
from django.db import transaction
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exemp... | chrisstianandres/pagos | apps/cliente/views.py | views.py | py | 8,331 | python | en | code | 0 | github-code | 1 |
25581773651 | from app.async_handler import run_in_executor
from app.aws import SQSClient
from app.constants import EVENT_TYPE
from app.reading import Reading
class ReadingsLogger:
def __init__(
self,
init_window_size: int = 200,
log_window_size: int = 10,
skip_window_size: int = 500,
lo... | bartoszadamczyk/weather-station-rpi | app/consumer.py | consumer.py | py | 1,564 | python | en | code | 1 | github-code | 1 |
22745763236 | # Lab 6 Softmax Classifier
import tensorflow as tf
import numpy as np
x_raw = [[1, 2, 1, 1], #4๊ฐ์ feature
[2, 1, 3, 2],
[3, 1, 3, 4],
[4, 1, 5, 5],
[1, 7, 5, 5],
[1, 2, 5, 6],
[1, 6, 6, 6],
[1, 7, 7, 7]]
y_raw = [[0, 0, 1], #one-hot-encoding
... | jo9392/tf_learn | SungKim_deeplearning/Softmax_classification/softmax_classifier.py | softmax_classifier.py | py | 1,938 | python | en | code | 0 | github-code | 1 |
72861963873 | import os
from read_configure import ReadConfigure
import requests
rc = ReadConfigure()
class InterfaceTest:
global rc
def __init__(self):
self.__protocol = rc.getmethod('protocol')
self.__method = rc.getmethod('method')
self.__url = rc.geturl('url')
pidict = rc.getparameters... | cwk0099/PythonProject | request_test/test.py | test.py | py | 758 | python | en | code | 0 | github-code | 1 |
44302804442 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 21 08:43:08 2016
@author: RDCHLMTR
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as opt
x = np.array([41,79,82,85,87,89,90,92,93,94,95,96,97,98,99,100,101,102,103,106])
y = np.array([4,11,14,16,17,18,21,23,25,27,30,32,34,37,40,... | passaloutre/kitchensink | python/exp_fit_example.py | exp_fit_example.py | py | 641 | python | en | code | 0 | github-code | 1 |
41654504996 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# read in the datasets
movies = pd.read_csv("/home/wasi/ML_FOLDER/Udacity-DSND-master/Experimental Design & Recommandations/Recommendations/"
"1_Intro_to_Recommendations/movies_clean.csv")
reviews = pd.read_csv("/home/wasi/ML... | wasi-9274/DL_Directory | DL_Projects/dummy_data_storage/recommendations_script_2.py | recommendations_script_2.py | py | 4,468 | python | en | code | 0 | github-code | 1 |
73619854753 | from bs4 import BeautifulSoup
import time
from openpyxl import Workbook
import pandas as pd
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager... | Debraj-Das/Search_Engine | Web_Scripting/LeetCodeTemp.py | LeetCodeTemp.py | py | 5,020 | python | en | code | 0 | github-code | 1 |
5053673486 | from application.Models.models import User
from flask import escape
from base64 import b64decode, b64encode
import json
from datetime import datetime
from application import app
import os
from geopy.distance import geodesic
notLoggedIn = dict({
"isLoggedIn": False,
'message': 'Your are not logged in'
})
found ... | theirfanirfi/flask-book-exchange-apis | application/API/utils.py | utils.py | py | 2,536 | python | en | code | 0 | github-code | 1 |
21181509403 | from mpl_toolkits.mplot3d import axes3d
import numpy as np
import matplotlib.pyplot as plt
def read(filename, delimiter=','):
return np.genfromtxt(filename, delimiter=delimiter)
def plot(array):
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d') # 111 means "1x1 grid, first subplot"
p = ... | CIFASIS/wganvo | vgg_trainable/test/plot_traj.py | plot_traj.py | py | 1,301 | python | en | code | 9 | github-code | 1 |
11974747768 | class Config():
# General configuration
general = {"project_path": "/media/saket/fire/github_project/highlighter",
}
# Training data preparation
data_preparation = {"processed_data_path": general['project_path'] + "/data/processed_data",
"dataset_name": "t... | saketkumar448/highlighter | src/config/config.py | config.py | py | 1,496 | python | en | code | 0 | github-code | 1 |
30662780326 | s = 0
n = int(input('Digite um nรบmero: '))
for d in range(1, n + 1):
if n % d == 0:
print(f'\033[36m', end=' ')
s += 1
else:
print(f'\033[33m', end=' ')
print(f'{d} ', end=' ')
if s == 2:
print('\nร um nรบmero primo')
else:
print('Nรฃo รฉ um nรบmero primo')
| EsojMelo/Python_programs | desafio 52.py | desafio 52.py | py | 317 | python | pt | code | 0 | github-code | 1 |
72963427555 | from __future__ import division
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
def load_dataset():
CLASS_NUM = 3
FILE_NUM = 1000
dataset = list()
for itr_class in range(CLASS_NUM):
file_dir = "./data/Data_Train/Class{:d}/".format(itr_class + 1)
for idx in... | wu0607/2018-Spring-ML-Graduate | HW3/Machine Learning hw3/src/util.py | util.py | py | 2,458 | python | en | code | 2 | github-code | 1 |
71074785634 | # Quadratic Model (in x) from the UQ4K paper
#
# Author : Mike Stanley
# Created : Sep 30, 2021
# Last Modified : Sep 30, 2021
from collections.abc import Iterable
import numpy as np
from uq4k.models.base_model import BaseModel, Modelparameter
class QuadraticModel(BaseModel):
"""
Implementatio... | JPLMLIA/UQ4K | uq4k/models/quadratic_model.py | quadratic_model.py | py | 1,603 | python | en | code | 2 | github-code | 1 |
3567125783 | import mysql.connector
from mysql.connector import errorcode
uname = "kolisett"
pwd = "A46610134"
hname = "mysql-user.cse.msu.edu"
try:
cnx = mysql.connector.connect(user=uname, password=pwd, host=hname,database=uname)
cursor = cnx.cursor()
with open('NMFFinal.txt', 'r') as f:
for line in f:
l = line.split(... | xiazhuol/BookReco | Script Files/NMFToSQL.py | NMFToSQL.py | py | 605 | python | en | code | 0 | github-code | 1 |
27184588727 | from animales import *
select=0
while(True):
select=input("Selecciona una opcion: \n 1: Agregar, 2: Buscar, 3: Eliminar, 4: Mostrar todo, 5: Cerrar Programa \n")
if select == "1":
add(input("Escribe el nombre: "),
input("Escribe la especie: "),
input("Escribe el tipo de alimento:... | LordHikarin/Zoologico | main.py | main.py | py | 737 | python | es | code | 1 | github-code | 1 |
28228061323 | import openai
import os
import random
import json
def get_json(path):
with open(path, 'r') as f:
d = f.read()
try:
return eval(d)
except:
return json.loads(d.replace("\\\\", "\\"))
def json_to_prompt(question_json):
# chatgpt can handle parsing the json
return f"Here is a json of a question, choose the... | kennethgoodman/llm_take_tests | lsat/chat_gpt_takes_lsat.py | chat_gpt_takes_lsat.py | py | 3,382 | python | en | code | 0 | github-code | 1 |
7333464803 | # custom_action.py
from datahub_actions.action.action import Action
from datahub_actions.event.event_envelope import EventEnvelope
from datahub_actions.pipeline.pipeline_context import PipelineContext
import smtplib
class CustomAction(Action):
@classmethod
def create(cls, config_dict: dict, ctx: PipelineCont... | AsteraDP/astera-dp-datahub | templates/notification/custom_action.py | custom_action.py | py | 4,157 | python | ru | code | 0 | github-code | 1 |
9430898078 | t=int(input())
while t!=0:
[l,r,x] = list(map(int, input().split(" ")))
[a,b] = list(map(int, input().split(" ")))
found = False
value = 0
if a == b:
value = 0
print(value)
t-=1
continue
# if both even
found = False
if b > 0:
if a + x > r:
... | NicholasTing/Competitive_Programming | CodeForces_830-835/CodeForces_834/c.py | c.py | py | 540 | python | en | code | 1 | github-code | 1 |
491554714 | import os
from gtts import gTTS
text='Welcome to PriyankMusic!'
#LANGUAGE IN WHICH YOU WANT TO CONVERT
lang='en'
myobj=gTTS(text=text, lang=lang, slow=False)
myobj.save("audio.mp3")
# PLAY THE CONVERTED FILE
os.system("audio.mp3")
| priyankp0212/Python-Projects | Audio.py | Audio.py | py | 244 | python | en | code | 0 | github-code | 1 |
36937078898 | import bpy
import os
import logging
from pathlib import Path
log = logging.getLogger(__name__)
# in future remove_prefix should be renamed to rename prefix and a target prefix should be specifiable via ui
def fixBones(remove_prefix=False, name_prefix="mixamorig:"):
bpy.ops.object.mode_set(mode = 'OBJECT')
... | RichardPerry/Mixamo-Root | mixamoroot.py | mixamoroot.py | py | 15,617 | python | en | code | 11 | github-code | 1 |
39428750577 | class Range:
def __init__(self, a, b=None, step=1):
"""
Define a range according to a starting value, an end value and a step.
If only one argument is provided, it's taken to be the end value. If
two arguments are passed in, the first becomes a start value, while the
second is the end value. An optional ste... | Pilip88/ProPython | CommonProtocols/sequences2.py | sequences2.py | py | 912 | python | en | code | 1 | github-code | 1 |
6086114417 | import torch.nn as nn
import torch.distributed as dist
def initialize_weights(model):
for m in model.modules():
if isinstance(m, nn.Linear):
nn.init.xavier_normal_(m.weight)
# m.bias.data.zero_()
elif isinstance(m, nn.BatchNorm1d):
nn.init.constant_(m.weight, 1... | jinxixiang/low_rank_wsi | mil/models/model_utils.py | model_utils.py | py | 515 | python | en | code | 7 | github-code | 1 |
71552736995 | import numpy as np
import cv2
import tqdm
import argparse
import os
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--image_path", help="path to the image", required=True)
parser.add_argument("--patch_size", default="15", help="patch size")
args = parser.parse_args()
retur... | ErmiasBahru/wave-art | main.py | main.py | py | 1,440 | python | en | code | 13 | github-code | 1 |
26979634933 | import math
import numpy
from numpy.typing import ArrayLike
from search import embedding
from sklearn.cluster import KMeans
from tenseal.tensors.ckksvector import CKKSVector
class Index:
"""
Index class for efficient searching in a corpus using clustering and matrix representation.
Parameters:
- mod... | fpiedrah/private-search | search/index.py | index.py | py | 3,120 | python | en | code | 0 | github-code | 1 |
35914507591 | #! /usr/bin/env python3
# (re)construit les fichiers README.md de description des challenges
import json
import glob
import os
import io
from collections import namedtuple
import yaml
# tuple
Slug = namedtuple('Slug', ['order', # numรฉro pour maintenir l'ordre
'link', # lie... | rene-d/hackerrank | hr_table.py | hr_table.py | py | 9,670 | python | en | code | 72 | github-code | 1 |
11514219682 | # Released under the MIT License. See LICENSE for details.
#
"""Tools related to ios development."""
from __future__ import annotations
import pathlib
import subprocess
import sys
from dataclasses import dataclass
from efrotools import getprojectconfig, getlocalconfig
MODES = {
'debug': {'configuration': 'Debug... | efroemling/ballistica | tools/efrotools/ios.py | ios.py | py | 6,959 | python | en | code | 468 | github-code | 1 |
34660018103 | from odoo.tests.common import TransactionCase
class TestVatReportsCommon(TransactionCase):
def _create_test_data(self, invoice_tax):
chart = self.env.ref("l10n_be.l10nbe_chart_template")
chart.try_loading_for_current_company()
company = self.env.user.company_id
company.partner_id.w... | NeatNerdPrime/l10n-belgium | l10n_be_vat_reports/tests/common.py | common.py | py | 1,853 | python | en | code | null | github-code | 1 |
11830090242 | """
Title: Echo Stream Server Program
Authors: Alex Higgins, Matt Haneburger, Steven King, Tony Raubenheimer
Description: Listens on assigned TCP port, 22600, for an input connection. The server echoes each _line_ of
input from the client, until it gets the line "exit" or "quit".
""... | mreinerh/ComputerNetworks | echoStreamServer.py | echoStreamServer.py | py | 1,653 | python | en | code | 0 | github-code | 1 |
73546122274 | #!python
import json
import argparse
import sys
from datetime import datetime
class Hypothesis:
'''
this class represents a guess
'''
def __init__(self, name, hypothesis, confidence, notes, dtime):
self.name = name
self.hypothesis = hypothesis
self.confidence = confidence
... | josh-mcq/hypothesis | guess.py | guess.py | py | 2,813 | python | en | code | 0 | github-code | 1 |
43250051415 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import \
print_function, unicode_literals, absolute_import, division
import unittest
import roboptim.core
import numpy, numpy.testing
import pickle
import os
from concurrent.futures import ProcessPoolExecutor, as_completed
class Square (roboptim.core.P... | roboptim/roboptim-core-python | tests/function.py | function.py | py | 7,764 | python | en | code | 6 | github-code | 1 |
17270736196 | #!/usr/bin/env python3
import os
import re
def get_file_list():
files = [file for file in os.listdir() if re.findall('.[AaMm][KkPpVv][4IiVv]$', file)]
return files
def rename_files(files):
for file in files:
file_name, file_ext = os.path.splitext(file)
try:
mod_name = re.sp... | thaengineer/ffmpeg-scripts | rename-movies.py | rename-movies.py | py | 1,075 | python | en | code | 0 | github-code | 1 |
20176565752 | #!/usr/bin/env python
# -----------------------
# Supplementary Material for Deith and Brodie 2020; โPredicting defaunation โ accurately mapping bushmeat hunting pressure over large areasโ
# doi: 10.1098/rspb.2019-2677
#------------------------
# Code to iterate through GFLOW results files, modify the outputs based ... | mairindeith/DeithBrodie2020_PredictingDefaunationBorneo | Circuit-theory simulations/GFLOWOutput_Summation.py | GFLOWOutput_Summation.py | py | 9,286 | python | en | code | 0 | github-code | 1 |
29861647037 | import streamlit as st
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import AdaBoostCla... | yaswanth2802/machine-learning-web-app | app.py | app.py | py | 3,258 | python | en | code | 0 | github-code | 1 |
8027377031 | # -*- coding: utf-8 -*-
'''
'''
#############
## LOGGING ##
#############
import logging
from fitsbits import log_sub, log_fmt, log_date_fmt
DEBUG = False
if DEBUG:
level = logging.DEBUG
else:
level = logging.INFO
LOGGER = logging.getLogger(__name__)
logging.basicConfig(
level=level,
style=log_sub,... | waqasbhatti/fitsbits | fitsbits/_modtemplate.py | _modtemplate.py | py | 544 | python | en | code | 1 | github-code | 1 |
22401763253 | """This program is a basic warehouse inventory tracking software."""
from tkinter import *
from tkinter import messagebox
class Style:
"""Style class holds constants used for colors and fonts in the GUI."""
def __init__(self):
"""Create Fonts used in GUI creation."""
self.default_font = ("Ari... | Nuddley/Warehouse-software | main.py | main.py | py | 13,269 | python | en | code | 0 | github-code | 1 |
29990285621 | ## The wext merged datafile
import sys
input_file = sys.argv[1]
data_file = sys.argv[2]
output_file = sys.argv[3]
cutoff = float(sys.argv[4])
#cutoff = 5
import pandas as pd
from sklearn.metrics import precision_recall_curve
from random import random
import math
from scipy.stats import chi2
import numpy as np
import ... | raphael-group/SC-hap | scripts/create_hapcut_input_fishers.py | create_hapcut_input_fishers.py | py | 3,765 | python | en | code | 2 | github-code | 1 |
9539722024 | from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from nltk.tokenize import word_tokenize
from gensim import corpora
import gensim
import gensim.downloader as api
from gensim.matutils import softcossim
#from gensim import fasttext_model300
from gensim import *
import fasttext
import gensim.downloader as api
#im... | kungfumas/similaritas-dokumen | Doc2Vec/train.py | train.py | py | 2,421 | python | en | code | 0 | github-code | 1 |
32195310986 | from django.conf.urls.defaults import *
from django.contrib.syndication.views import feed as feed_view
from django.views.generic import date_based, list_detail
from django.contrib import admin
from ebblog.blog.models import Entry
from ebblog.blog import feeds
admin.autodiscover()
info_dict = {
'queryset': Entry.o... | brosner/everyblock_code | ebblog/ebblog/urls.py | urls.py | py | 1,167 | python | en | code | 130 | github-code | 1 |
15133768093 | """
Benjamin Granat
ITP 449
Assginment 9
Trains and tests a logistic regression based on diabetes classification data
Produces confusion matrix visualization
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusi... | bengranat/ITP449 | Diabetes Classification.py | Diabetes Classification.py | py | 2,658 | python | en | code | 0 | github-code | 1 |
21246327721 | '''
Escreva um programa que leia um nรบmero inteiro positivo n e em seguida imprima n linhas do chamado
Triรขngulo de Floyd.
'''
num = int(input("Insira um valor n: "))
cont = 0
for i in range(1, num+1):
for j in range(1, 1+i):
cont += 1
print(cont, end = ' ')
print("\n")
| higor-gomes93/curso_programacao_python_udemy | Sessรฃo 6 - Exercรญcios/ex53.py | ex53.py | py | 299 | python | pt | code | 0 | github-code | 1 |
3153110654 | '''
class employee:
def getempval(self):pass
def dispemp(self):pass
e1=employee()
e1.getempval() # we dont need to call this method explcitly since in constructors
we canuse it implicitly
'''
class employee:
def __init__(self):
self.eno=int(input("enter the eno: "))
self.e... | sanjay7709/python | oops/constructors/con2.py | con2.py | py | 792 | python | en | code | 0 | github-code | 1 |
19074849435 | import logging
from odoo.addons.base_rest import restapi
from odoo.addons.base_rest.components.service import to_int
from odoo.addons.base_rest_datamodel.restapi import Datamodel
from odoo.addons.component.core import Component
_logger = logging.getLogger(__name__)
class CyclosService(Component):
_inherit = "bas... | Lokavaluto/lokavaluto-addons | lcc_cyclos_base/services/cyclos_services.py | cyclos_services.py | py | 2,113 | python | en | code | 5 | github-code | 1 |
29147395643 | import matplotlib.image as mpimg
from tensorflow.keras.utils import img_to_array, load_img
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from keras.models import load_model
# Load the model
model = load_model('model12.h5')
# Convert the model to a quantized model
converter = tf... | maazjamshaid123/early_detection_pneumonia | detect.py | detect.py | py | 1,337 | python | en | code | 0 | github-code | 1 |
74480044513 | import main
import alg_cluster
import random
import matplotlib.pyplot as plt
import time
def get_random_clusters(num_clusters):
result_list = []
for num in range(num_clusters):
result_list.append(alg_cluster.Cluster(set([num]), random.random()*2 - 1, random.random()*2 - 1,0,0))
return result_list
... | pakzaban/Clustering_Algorithmic_Thinking_Project_3 | myPlots.py | myPlots.py | py | 1,189 | python | en | code | 0 | github-code | 1 |
833867895 | #coding:utf-8
import requests
import threading
from bs4 import BeautifulSoup
import re
import os
import time
import sys
content_url = "http://www.biquge.com.tw/12_12603/"
kv = {'user_agent': 'Mozilla/5.0'} # ่กจ็คบๆฏไธไธชๆต่งๅจ
try:
r = requests.get(content_url, headers=kv)
r.raise_for_status()
r.encoding = r.appare... | smilepasta/PythonDemo | basic/note.py | note.py | py | 1,893 | python | en | code | 0 | github-code | 1 |
25093423154 | from __future__ import print_function
import argparse
import codecs
import numpy as np
import json
import requests
"""
This file is part of the computer assignments for the course DD1418/DD2418 Language engineering at KTH.
Created 2017 by Johan Boye and Patrik Jonell.
"""
"""
This module computes the... | aljica/spraktek | assignment-1/Aligner/Aligner.py | Aligner.py | py | 8,035 | python | en | code | 0 | github-code | 1 |
73550094432 | import numpy as np
from sympy import symbols, pi, sin, cos, atan2, sqrt, simplify
from sympy.matrices import Matrix
import tf
"""
Test file for building the Kuka 6 DoF manipulator's forward and inverse
kinematic code.
FK(thetas) -> pose
IK(pose) -> thetas
"""
def build_mod_dh_matrix(s, theta, alpha, d, a):
"""B... | camisatx/RoboticsND | projects/kinematics/kuka_kr210/kuka_ik.py | kuka_ik.py | py | 7,730 | python | en | code | 57 | github-code | 1 |
24486211974 | # https://www.codingame.com/ide/puzzle/the-helpdesk
import sys,math
def getWert(zwDict):
ausgabe=""
for nr in sorted(zwDict):
wert = zwDict[nr]
ausgabe+=str(wert)+" "
return ausgabe
#3 1 1 1 21 1 1 1 1 0 0 0 2 0 0 0 0
worktime=40
eList=[0.5, 0.5, 0.5, 2.0, 0.5, 0.5, 0.5, 0.5]
hList=[... | mw197hub/codingame | easy/The helpdesk/mainZweiter.py | mainZweiter.py | py | 2,572 | python | en | code | 0 | github-code | 1 |
27287239205 | """
Summary => will control the pen plotter.
Description => will control the pen plotter and print off the x and y
coordinates given to it at run time. This object when run will go
through a drawing out all the coordinates and making connections
between each point. Then draw those lines out.
... | souleater42/MMP-Robotic-Artist | code_v2/plotter_controller.py | plotter_controller.py | py | 11,513 | python | en | code | 1 | github-code | 1 |
44587785731 | """Sensor device."""
from __future__ import annotations
from flowchem.components.flowchem_component import FlowchemComponent
from flowchem.devices.flowchem_device import FlowchemDevice
class Sensor(FlowchemComponent):
"""A generic sensor."""
def __init__(self, name: str, hw_device: FlowchemDevice) -> None:
... | cambiegroup/flowchem | src/flowchem/components/sensors/sensor.py | sensor.py | py | 770 | python | en | code | 11 | github-code | 1 |
37900967768 | import random
import sosbet
import datetime
import math
import sosfish_constants
def SellerText(data, user):
fish = FishOfTheDay(data)
output = f"You hear a local merchant offering to buy three {fish} for a {sosbet.CURRENCY}."
if fish in data[user]["catchlog"].keys():
if fish not in data[user]["sell_log"].key... | Aster-Iris/menatbot | sosfish_market.py | sosfish_market.py | py | 2,169 | python | en | code | 0 | github-code | 1 |
29376346831 | from django.urls import path
from .views import solicitar_turno, turnos_cliente, turnos_veterinario, VerTurnoVeterinario, ver_turno_cliente
urlpatterns = [
path('solicitar_turno', solicitar_turno, name='solicitar_turno'),
path('turnos_cliente', turnos_cliente, name='turnos_cliente'), # No me gusta el nombre, ... | bautimercado/oh-my-dog | ohmydog/turnos/urls.py | urls.py | py | 624 | python | es | code | 0 | github-code | 1 |
19988760710 | ssize = 0
n = 0
k = 0
result = 0
nth = 0
n = int(input())
stos = [0] * n
for i in range(n):
nth, k = [int(x) for x in input().split()]
while ssize > 0 and stos[ssize-1] > k: ssize = ssize - 1
if ssize == 0 or stos[ssize-1] < k:
result = result + 1
stos[ssize] = k
ssize = ssize + 1
p... | dorian-gabIer/2AG_PY | pla.py | pla.py | py | 333 | python | en | code | 1 | github-code | 1 |
24892353550 | import numpy as np
def InsertionSort(vetor):
size = len(vetor)
for i in range(size):
marcado = vetor[i]
j = i - 1
while j >= 0 and marcado < vetor[j]:
vetor[j+1] = vetor[j]
j -= 1
vetor[j+1] = marcado
return vetor
print(InsertionSort(np.array([10, 9, 8, 7, 2, 0, 3])))
print(Insertion... | LucasNithael/Estrutura-de-dados-Python | Section9/insertionSort.py | insertionSort.py | py | 359 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.