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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38313863819 | '''
Created on Oct 2, 2013
@author: lindahlm
'''
import nest
import pylab
t=1000.0
n=nest.Create('iaf_neuron')
mm=nest.Create('multimeter', params={'record_from':['V_m'], 'start':0.0})
pg=nest.Create('poisson_generator', params={'rate':10.0})
nest.Connect(pg,n,model='tsodyks_synapse')
#nest.Connect(mm,n)
nest.Connect(... | mickelindahl/bgmodel | python/misc_folder/test_poisson_generator_and_dep_syn.py | test_poisson_generator_and_dep_syn.py | py | 417 | python | en | code | 5 | github-code | 13 |
9722986305 | import socket,threading,sys,os,queue,json
MAX_BYTES = 65535
lock = threading.Lock() # 创建锁, 防止多个线程写入数据的顺序打乱
que = queue.Queue() # 用于存放客户端发送的信息的队列
users=[] #[(user,addr)]
def onlines():
online = []
for i in range(len(users)):
online.appen... | WhaleKlng/udp_chat_room | server.py | server.py | py | 3,604 | python | en | code | 1 | github-code | 13 |
7674182772 | from command import Command
def parse_range(range_str):
def set_range(s):
if s.isdigit():
return {int(s)}
else:
start, stop = [int(n) for n in s.split('-')]
return set(range(start, stop + 1))
ranges = set()
for s in range_str.split(','):
ranges ... | pamtdoh/orchestrion | component.py | component.py | py | 1,732 | python | en | code | 0 | github-code | 13 |
17159198092 | import json
import requests
from ratelimit import limits, sleep_and_retry
from .config import BASE_URL, X_AUTH_TOKEN
auth_key = 'Call reset_sim() to make this value valid'
# Max 10 calls per second.
@sleep_and_retry
@limits(calls=10, period=1)
def check_limit():
pass
def reset_sim(problem: int):
check_l... | jiyolla/study-for-coding-test | programmers/kakao2022/kakao2022/api.py | api.py | py | 2,074 | python | en | code | 0 | github-code | 13 |
17432300434 | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
# sliding window
longest, left, right = 1, 0, 1
if len(s) < 2:
return len(s)
# right poiner move forwards
while right < len(s):
if s[right] not in s[left: right]:
... | Jasondecode2020/LeetcodeFirst500 | leetcode500/3.py | 3.py | py | 489 | python | en | code | 0 | github-code | 13 |
6634500364 | """Crie um programa que leia o ano de nascimento de sete pessoas. No final, mostre quantas pessoas ainda não
atingiram a maioridade e quantas já são maiores."""
from datetime import date
atual = date.today().year
count = 0
count2 = 0
for c in range(1, 8):
nasc = int(input(f'Em que ano a {c}ª pessoa nasceu? '))
... | rafaelsantosmg/cev_python3 | cursoemvideo/ex054.py | ex054.py | py | 519 | python | pt | code | 1 | github-code | 13 |
2169441996 |
#리팩토링 -> 함수를 계속 개선하다.
def add(a,b):
result = a+b
return result
result = add(10,20)
print(result)
def add2(a,b,c=0):
result = a+b+c
return result
result = add2(10,20,30)
print(result)
def add3(nums):
result = 0
for num in nums:
result+=num
return result
r... | mokimoki191225/jbfc_220506 | pycharm/function/함수10리팩토링.py | 함수10리팩토링.py | py | 1,200 | python | en | code | 0 | github-code | 13 |
8125422210 | def get_attendance_records(file_path):
attendance_file = open(file_path,'r')
lines = attendance_file.readlines()
attendance_file.close()
header = lines[0]
attendance_records = lines[1:]
return attendance_records
def convert_attendance_record_to_bools(sessions):
sessions_bool = []
for... | pathespe/MarkerBot | tests/resources/session_6.py | session_6.py | py | 2,838 | python | en | code | 0 | github-code | 13 |
3426417222 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 16:50:17 2020
@author: Obed Junias
"""
import os
import sys
import time
import requests
def retrieve_page():
for year in range(2013,2019):
for month in range(1,13):
if month < 10:
url = "https://en.tutiempo.net/climate/0{}-{}/... | obedjunias/AQI-Prediction | Data-Collection.py | Data-Collection.py | py | 1,091 | python | en | code | 0 | github-code | 13 |
3318938175 | #!/usr/bin/env python
import sys
sys.path.append("/Users/gkirk/Dropbox/git/Library/")
sys.path.append(".")
import os
import csv
from Stream_SD import Stats_Stream
# File format is Time,SV,Elev,Az,SNR
def Compute_Stats (Signal):
Elev_Stats=list(range(91))
for elev in range (91):
Elev_Stats[elev]=Stats... | jcmb/TrackingPlot | cgi-bin/SNR_STATS.py | SNR_STATS.py | py | 2,018 | python | en | code | 0 | github-code | 13 |
71812250258 |
from common import *
class Quiz:
def __init__(self, gsheets, db):
self.gsheets = gsheets
self.db = db
def create(self, email):
try:
# S_1-1 連接模板
template_id = '1kFso7_L21vzRpeeHDgpl9HLAlP8SSVZ_vgpH_qQvS3I'
template_spreadsheet = self.gsheets.open_b... | yun-cheng/interviewer-quiz-backend | quiz.py | quiz.py | py | 15,577 | python | en | code | 0 | github-code | 13 |
72093832019 | import random
from enum import Enum
class ColoursPalete(object):
def __init__(self, amount, rgb_anchor):
#self.__colours = ['#7D3C98','#70C742','#C74278','#8CEE6D','#01DFD7','#FACC2E','#A9A9F5']
self.__colours = self.__generate_colours(amount, rgb_anchor)
self.__index = 0
class RGBAn... | JamesScanlan/graph_monkey | colours_palete.py | colours_palete.py | py | 4,230 | python | en | code | 0 | github-code | 13 |
34375585460 | """Example script, copy of the quickstart in the documentation."""
import nawrapper as nw
import numpy as np
import matplotlib.pyplot as plt
from pixell import enmap
# map information
shape, wcs = enmap.geometry(shape=(1024, 1024),
res=np.deg2rad(0.5/60.), pos=(0, 0))
# create power spect... | xzackli/nawrapper | examples/quickstart.py | quickstart.py | py | 1,832 | python | en | code | 1 | github-code | 13 |
39776174612 |
import stat
import textwrap
import pytest
import troika
from troika.config import Config
from troika.connections.local import LocalConnection
from troika.controllers.base import Controller
from troika.site import get_site
from troika.sites import pbs
@pytest.fixture
def dummy_pbs_conf(tmp_path):
return {
... | ecmwf/troika | tests/unit/sites/test_pbs.py | test_pbs.py | py | 6,372 | python | en | code | 11 | github-code | 13 |
39762138192 | from datetime import datetime
from typing import Dict, List
from .. import logger, user_config
from ..authentication.auth import Auth
from ..custom_exceptions import EventListenerException
from ..engine import engine_factory as ef
from . import event_listener_factory as elf
from .event_listener import EventListener
... | ecmwf/aviso | pyaviso/event_listeners/listener_manager.py | listener_manager.py | py | 5,714 | python | en | code | 9 | github-code | 13 |
34537660538 | from app import app
from app import q
from app.tasks import imageEmailAndCreate
from flask import render_template, request, redirect, url_for
import os
from werkzeug.utils import secure_filename
import random
import string
from rq import Retry
import pickle
import datetime
from PIL import Image
from app.imageto3dWrapp... | howard56k/ImageTo3d | app/views.py | views.py | py | 4,142 | python | en | code | 1 | github-code | 13 |
9071890720 | from collections import deque
import sys
sys.stdin = open("in_out/chapter6/in5.txt", "rt")
n, m = map(int, input().split())
patients = list(map(int, input().split()))
patients = deque([(i, idx) for idx, i in enumerate(patients)])
res = 0
while patients:
if patients[0] == max(patients, key=lambda x: x[0]):
... | mins1031/coding-test | section5/Chapter6.py | Chapter6.py | py | 474 | python | en | code | 0 | github-code | 13 |
17059781164 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ShopRating(object):
def __init__(self):
self._lower_bound = None
self._upper_bound = None
self._value = None
@property
def lower_bound(self):
return self.... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/ShopRating.py | ShopRating.py | py | 1,830 | python | en | code | 241 | github-code | 13 |
69975854098 | class user:
def __init__(self,seats,fuel):
print("new user being created...")
self.seat = seats
self.fuel = fuel
def race_mode(self):
self.seat = 2
return
user1 = user(3,"petrol")
#user1.user_name = 'loki'
print(user1.seat)
print(user1.race_mode()) | Kotravai/100-Days-of-Code | L17-Quiz/L17-Start.py | L17-Start.py | py | 301 | python | en | code | 0 | github-code | 13 |
73968235856 | # -*- coding: utf-8 -*-
"""
@author: robin
"""
import ML_module as ML
# Load data
import pandas as pd
train_df = pd.read_csv('asl_data/sign_mnist_train.csv')
valid_df = pd.read_csv('asl_data/sign_mnist_test.csv')
# Split between train and validation sets
y_train = train_df['label'].values
y_valid = valid_df['labe... | rsebastian91/CategoricalClassification | categorical_asl.py | categorical_asl.py | py | 1,834 | python | en | code | 0 | github-code | 13 |
3958090244 | import numpy as np
import grid
from Tkinter import *
from graphics import color_rgb
import setup
colors = { -1:[0,0,0], 0:[215,255,215] , 1:[135, 206, 235], 2:[0, 128, 0] , 3:[255, 0, 0], 4:[128, 0, 128],
5:[128, 0, 0], 6 :[64, 224, 208], 7:[255, 192, 203] , 8:[128, 128, 128], 9:[255,255,255]}
'''
n =10
di... | adarshgogineni/MineSweeper | matrixgui.py | matrixgui.py | py | 1,214 | python | en | code | 0 | github-code | 13 |
4002314037 | import os
import numpy as np
import tensorflow as tf
def save_model(model, save_dir):
# Buat direktori jika belum ada
os.makedirs(save_dir, exist_ok=True)
# Simpan model sebagai format SavedModel
tf.saved_model.save(model, save_dir)
if __name__ == "__main__":
# Contoh data latih dan label
X_t... | RendyAFS/Project-IOT-Udang | te.py | te.py | py | 889 | python | id | code | 0 | github-code | 13 |
2839467293 | #-*- coding: utf-8 -*-
from .constant import *
from .record import Record
from .fileio import FileIO
from .function import pformat, formatSize2
class PartMet:
def __init__(self, path):
self.version = 0
self.record = Record()
with FileIO(path, "rb") as file_:
self.__loadFromFile(... | gefranks/amuletools | partmet.py | partmet.py | py | 3,467 | python | en | code | 0 | github-code | 13 |
25203726383 | from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from sys import platform, maxsize, version_info
import os, sys
from Cython.Compiler.Main import default_options, CompilationOptions
default_options['emit_linenums'] = True
from subprocess import check_output, C... | deepin-community/pmix | bindings/python/setup.py | setup.py | py | 2,643 | python | en | code | 0 | github-code | 13 |
12221576567 | from operator import itemgetter
from multiprocessing.pool import Pool
from multiprocessing import cpu_count
import time
from functools import partial
from abc import ABC, abstractmethod
from itertools import repeat
class Algorithm(ABC):
"""
The Algorithm interface declares operations common to all ... | GaborWilk/FairTeamGenerator | python/team_generator.py | team_generator.py | py | 12,416 | python | en | code | 0 | github-code | 13 |
36261186772 | def alphafold_predict(session, sequence):
if not _is_alphafold_available(session):
return
ar = show_alphafold_run(session)
if ar.running:
from chimerax.core.errors import UserError
raise UserError('AlphaFold prediction currently running. Can only run one at a time.')
ar.start(se... | HamineOliveira/ChimeraX | src/bundles/alphafold/src/predict.py | predict.py | py | 7,715 | python | en | code | null | github-code | 13 |
24036401076 | from src import models, db
import datetime
def create_contacts(first_name, last_name, email, phone, birthday, address):
birth_format = datetime.datetime.strptime(birthday, '%Y-%m-%d')
contact = models.Contact(first_name=first_name, last_name=last_name, email=email, phone=phone,
bi... | Vishnyak13/PyWEB_HW-11_Flask | src/repository/contacts.py | contacts.py | py | 1,254 | python | en | code | 0 | github-code | 13 |
25213534118 | """
Module containing functions used to return the correct conformal predictor
class given the underlying model type.
"""
from functools import singledispatch
@singledispatch
def get_absolute_error_conformal_predictor(model):
"""Function to return the appropriate child class of
AbsoluteErrorConformalPredicto... | richardangell/pitci | pitci/dispatchers.py | dispatchers.py | py | 1,321 | python | en | code | 7 | github-code | 13 |
26763151855 | import numpy as np
import pandas as pandas
import streamlit as st
import pickle as pk
model = pk.load(open('model.sav','rb'))
st.title('University Admit Probability Predictor')
with st.form('StudentDetails',clear_on_submit=True):
gre_score = st.number_input(label='Enter Your GRE Score',min_value=260,max_value=3... | mkchaitanya03/University-Admit-Predictor | App.py | App.py | py | 1,410 | python | en | code | 0 | github-code | 13 |
17040991514 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.Participant import Participant
from alipay.aop.api.domain.TransOrderDetail import TransOrderDetail
class AlipayFundBatchUniTransferModel(object):
def __init__(self):
... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayFundBatchUniTransferModel.py | AlipayFundBatchUniTransferModel.py | py | 6,647 | python | en | code | 241 | github-code | 13 |
27236933397 | """
Adapted by dt10 from the following:
"""
"""
Matplotlib Animation Example
author: Jake Vanderplas
email: vanderplas@astro.washington.edu
website: http://jakevdp.github.com
license: BSD
Please feel free to use and modify this, but keep the above information. Thanks!
"""
xypos=[] # Vector of frame -> numpy particle... | joshjennings98/fyp | graph_schema-4.2.0/apps/nursery/particle/v3/scripts/plot_particles_v2.py | plot_particles_v2.py | py | 3,034 | python | en | code | 0 | github-code | 13 |
14933556555 | from transformers import GPT2LMHeadModel, GPT2Tokenizer
model_path = './output' # Path to the fine-tuned model directory
model = GPT2LMHeadModel.from_pretrained(model_path)
tokenizer = GPT2Tokenizer.from_pretrained(model_path)
# Define a function for generating responses
def generate_response(prompt, max_length=50):... | Jiffy-JM/Earthshot-ChatBot | gpt-2/gpt_chat.py | gpt_chat.py | py | 673 | python | en | code | 3 | github-code | 13 |
29881848997 | #!/usr/bin/env python
# This file converts a dictionary file (like amwgmaster.py or lmwgmaster.py) to a series of diags.py commands.
import sys, getopt, os, subprocess, logging, pdb
from time import sleep
from argparse import ArgumentParser
from functools import partial
from collections import OrderedDict
from metrics... | CDAT/uvcmetrics | src/python/frontend/metadiags.py | metadiags.py | py | 45,489 | python | en | code | 3 | github-code | 13 |
32827431359 | import logging
import sys
import numpy as np
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
try:
tf.compat.v1.enable_eager_execution()
except Exception:
pass
from deeplite.profiler import ComputeEvalMetric, Device
from deeplite.tf_profiler.tf_inference import get_accur... | Deeplite/deeplite-profiler | examples/tf_example.py | tf_example.py | py | 2,828 | python | en | code | 23 | github-code | 13 |
33566142828 | import streamlit as st
import pickle
import numpy as np
model=pickle.load(open('model.pkl','rb'))
def predict_forest(chlorides,alcohol):
input=np.array([[chlorides,alcohol]]).astype(np.float64)
prediction=model.predict_proba(input)
pred='{0:.{1}f}'.format(prediction[0][0],2)
return float(pred)
def ma... | data2450/wine-qulity-prediction-ML | app.py | app.py | py | 1,407 | python | en | code | 0 | github-code | 13 |
72829019219 | import torch
import torch.nn as nn
from torch.autograd import Variable
import copy
class ContentLoss(nn.Module):
def __init__(self, target, weight):
super(ContentLoss, self).__init__()
self.target = target.detach() * weight
self.weight = weight
self.criterion = nn.MSELoss()
... | tianjiu233/cv-models | simple_style_transfer/utils.py | utils.py | py | 3,823 | python | en | code | 12 | github-code | 13 |
7771722179 | """sistemacondominio URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/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')
C... | Fabiojoao02/sistemas-condominio-mysql | sistemacondominio/urls.py | urls.py | py | 3,570 | python | en | code | 0 | github-code | 13 |
27284088988 | # 以下代码为提示框架
# 请在...处使用一行或多行代码替换
# 请在______处使用一行代码替换
#
##import turtle as _____
##for i in range(______) :
## t.seth(i*120)
## t.fd(_______)
##########################答案######################################
data = input() #课程名考分
d = {}
while data :
data = data.split()
d[data[0]] = d... | DodgeV/learning-programming | 二级/真题/2018年9月第四套/PY202.py | PY202.py | py | 745 | python | en | code | 3 | github-code | 13 |
12723355812 | #美化圖片
import cv2
import numpy as np
# 1. 读取图像
image = cv2.imread('108390.jpg')
# 2. 调整亮度和对比度
alpha = 1.5 # 调整亮度
beta = 25 # 调整对比度
result = cv2.addWeighted(image, alpha, np.zeros(image.shape, image.dtype), 0, beta)
# 3. 锐化图像
kernel = np.array([[-1, -1, -1],
[-1, 9, -1],
[-1, -1, ... | ftbb100/opencv_example | bu.py | bu.py | py | 735 | python | en | code | 0 | github-code | 13 |
11068045571 | #!/usr/bin/env python
# coding: utf-8
# # TD4 - Deep Q-Network
# # Tutorial - Deep Q-Learning
#
# Deep Q-Learning uses a neural network to approximate $Q$ functions. Hence, we usually refer to this algorithm as DQN (for *deep Q network*).
#
# The parameters of the neural network are denoted by $\theta$.
# * As inpu... | tawlas/master_2_school_projects | reinforcement learning/TD4/TD4.py | TD4.py | py | 17,574 | python | en | code | 0 | github-code | 13 |
3410333806 | import xml.etree.ElementTree as ET
import json
root = ET.parse('./tagfinder_thesaurus.rdf.xmp').getroot()
namespaces = {
'foaf': "http://xmlns.com/foaf/0.1/",
'skos': "http://www.w3.org/2004/02/skos/core#",
'rdf': "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
'osm': "http://wiki.openstreetmap.org/wiki... | philipbelesky/Caribou | OSM Feature Data/tagfinder_parse.py | tagfinder_parse.py | py | 3,362 | python | en | code | 21 | github-code | 13 |
7828543046 | '''
==================================================================
-- Author: Hamid Doostmohammadi, Azadeh Nazemi
-- Create date: 29/10/2020
-- Description: This code obtains keypoints from an RGB image
and extracts descriptors based on keypoints.
========================================... | HamidDoost/basic-image-processing-concepts | keypointAndDescriptor.py | keypointAndDescriptor.py | py | 1,205 | python | en | code | 0 | github-code | 13 |
70333239378 | n = int(input())
a, b = input().split()
a, b = [int(a), int(b)]
array = input().split()
count = 0
for i in range(a, b+1):
if i == b:
break
else:
if array[i] == array[i+1]:
count += 1
print(count) | Emad-Salehi/Data-Structures-and-Algorithms-Course | HW#1/Q1.py | Q1.py | py | 246 | python | en | code | 0 | github-code | 13 |
14059540776 | import torch
import numpy as np
from scipy import io
import h5py
import torch_geometric as pyg
from torch_geometric.data import Data, InMemoryDataset
from torch_geometric.transforms import KNNGraph, RadiusGraph
import os
from tqdm import tqdm
class SHARPData(torch.utils.data.Dataset):
def __init__(self, list_IDs):... | apt-get-nat/graphPINN | graphPINN/data.py | data.py | py | 5,350 | python | en | code | 0 | github-code | 13 |
12058968757 | import sys
import tensorrt as trt
sys.path.append('../')
import common
'''
通过加载onnx文件,构建engine
'''
onnx_file_path = "yolox_s.onnx" #输入需要转换的onnx文件
G_LOGGER = trt.Logger(trt.Logger.WARNING)
# 1、动态输入第一点必须要写的
explicit_batch = 1 << (int)(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
batch_size = 1 # trt推理时最大支持的bat... | guojianyang/cv-detect-robot | CDR-docker_main_file/deepstream-yolox/onnx_to_trt.py | onnx_to_trt.py | py | 1,619 | python | en | code | 465 | github-code | 13 |
29110268311 |
import subprocess
from collections import defaultdict
import argparse
parser = argparse.ArgumentParser(description='Run LA analysis code automatically and determine the possible best model based on relative change in R squared between the last and current model.')
parser.add_argument('executable', metavar='executable... | bmhang/wireless-conference-guide | run_analysis.py | run_analysis.py | py | 4,600 | python | en | code | 0 | github-code | 13 |
25084591767 | #!/usr/bin/env python3
# This program converts temperature from/to Fahrenheit or Celsius
def print_options():
print("Options:")
print(" 'p' print options")
print(" 'c' convert from Celsius")
print(" 'f' convert from Fahrenheit")
print(" 'q' quit the program")
def celsius_to_fahrenheit(c_temp):
... | rhc-iv/Python-3-Lessons | Non-Programmer's Tutorial for Python 3/06 - Defining Functions/temperature2.py | temperature2.py | py | 988 | python | en | code | 1 | github-code | 13 |
3721596390 | import heapq # function for sort
def solution(scoville, K):
answer = 0
heapq.heapify(scoville) # conversion to heap structure
while scoville[0] < K: # repeat until scoville number
if len(scoville) < 2:
return -1
else:
newNum = heapq.heappop(scoville) + (heapq.hea... | JaeEon-Ryu/Coding_test | Programmers/Level_2/Lv2_더맵게.py | Lv2_더맵게.py | py | 427 | python | en | code | 1 | github-code | 13 |
29696061354 | class Solution:
def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
candidates.sort()
tree=[]
num2len=dict()
for e in candidates:
if e in num2len:
num2len[e]+=1
else:
tree.append(e)
... | xincheng-cao/loser_fruit | backtracking/剑指 Offer II 082. 含有重复元素集合的组合.py | 剑指 Offer II 082. 含有重复元素集合的组合.py | py | 1,202 | python | en | code | 0 | github-code | 13 |
16117143099 | from bs4 import BeautifulSoup
from selenium import webdriver
import time
import json
import unidecode
urls =[ "https://www.ted.com/talks/helen_czerski_the_fascinating_physics_of_everyday_life/transcript?language=pt-br#t-81674",
"https://www.ted.com/talks/kevin_kelly_how_ai_can_bring_on_a_second_industrial_revol... | RafaelBorges-code/Maratona_IBM-Desafio-3 | Desafio 3 FIAP/ted_scraping.py | ted_scraping.py | py | 2,337 | python | en | code | 0 | github-code | 13 |
13567937700 | import pandas as pd
import streamlit as st
import numpy as np
import plotly.express as px
st.title('Popular Names')
st.text('Popularity of a Name Over Time')
url = 'https://github.com/esnt/Data/raw/main/Names/popular_names.csv'
df = pd.read_csv(url)
selected_name = st.text_input('Enter a name', 'John') # default na... | dlesueur/my_names_app | inclass.py | inclass.py | py | 1,092 | python | en | code | 0 | github-code | 13 |
22090796516 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import rc
import sys
sys.path.append('/usr/bin/latex')
rc('text', usetex = True)
rc('font', family = 'serif', size = 16)
def deriv(x):
dx = np.zeros(len(x))
for i in range(0, len(x)):
... | kinchb/ptransx | plots/dLdr_disk_plot_pq.py | dLdr_disk_plot_pq.py | py | 1,433 | python | en | code | 4 | github-code | 13 |
19904759947 | class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
#mine
if not prices or len(prices)==1:
return 0
stack = []
stack.append(prices[0])
profit = 0
for price in prices[1:]:
... | littleliona/leetcode | easy/122.best_time_to_buy_and_sell_stock_II.py | 122.best_time_to_buy_and_sell_stock_II.py | py | 588 | python | en | code | 0 | github-code | 13 |
69897546579 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import textwrap
import weightedstats as ws
pd.set_option('display.max_columns', None)
desktop = "C:/Users/pc/Desktop/"
inicio = 2004
fin = 2021
fuente = {'fontname': "Times New Roman"}
gi = ["sin... | fabazan/indice-desarrollo | indicadores.py | indicadores.py | py | 23,577 | python | es | code | 0 | github-code | 13 |
4791153648 | def demo(data: list, target: int):
try:
result = data.index(target)
except ValueError:
result = -1
return result
if __name__ == '__main__':
result = demo([2, 3, 1, 3, 124], 0)
print(result) | LeroyK111/BasicAlgorithmSet | 代码实现算法/SearchinRotatedSortedArray.py | SearchinRotatedSortedArray.py | py | 245 | python | en | code | 1 | github-code | 13 |
32859280768 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .. import Unit
from ...lib.patterns import defanged, indicators
class defang(Unit):
"""
Defangs all domains and ipv4 addresses in the input data by replacing the
last dot in the expression by `[.]`. For example, `127.0.0.1` will be
replaced by `127.0... | chubbymaggie/refinery | refinery/units/pattern/defang.py | defang.py | py | 2,322 | python | en | code | null | github-code | 13 |
22845043027 | from django.shortcuts import render
from PIL import Image
from io import BytesIO
import base64
import os
from django.conf import settings
from django.utils.crypto import get_random_string
import datetime
# Create your views here.
class InsertImage():
def insert_image(self,location,image_string):
print(loc... | Noorzaiba/final-2-rest-api | crime_management/images_app/views.py | views.py | py | 1,280 | python | en | code | 0 | github-code | 13 |
24146723159 | import numpy as np
import time
"""
Too make things cleaner, there should probably be a separation of the two objects "room" and "problem instanse", where properties such as DT, time length etc are
properties of the problem instance and not the room, but too keep it simple the room class will contain everything
"""
... | robinfissum/Heat-Modelling-Using-Finite-Differences | room.py | room.py | py | 9,738 | python | en | code | 0 | github-code | 13 |
17343759081 | T = int(input())
for x in range(1, T+1):
w = input()
n = 1 # number of acceptable words
for i in range(len(w)):
m = 1
if i != 0 and w[i] != w[i-1]:
m += 1
if i != len(w)-1 and w[i] != w[i+1]:
m += 1
n *= m
print("Case #{}: {}".format(x, n % 10000... | mgoks/compete | google-kick-start/2015/Round E/A. Lazy Spelling Bee/a-sol.py | a-sol.py | py | 327 | python | en | code | 0 | github-code | 13 |
16359875252 | #coding=utf8
from ..common import crawlerTool as ct
from HTMLParser import HTMLParser#这个出来是unicode的格式,后面没法弄
import sys
import traceback
reload(sys)
sys.setdefaultencoding('utf-8')
#bing 没编码,xpath text()结果是\xe5\xe2\x80\x98\xb5\xe5\xe2\x80\x98\xb5 是要从字节码编成str xpath结果是unicode,需要先encode('unicode-escape')再处理
#百度是unicode编码... | MemoryAndDream/searchForAll | searchForAll/crawler/extractors/bing.py | bing.py | py | 1,997 | python | zh | code | 2 | github-code | 13 |
37002790179 | #!/usr/bin/python3
# -*- coding:utf-8
'Fibonacci series'
__author__ = 'tanhc'
def test ():
a, b = 0, 1
while b < 10:
print(b, end=',')
a, b = b, a + b
if __name__ == '__main__':
test()
| tanhuacheng/Documents | python/fib.py | fib.py | py | 217 | python | en | code | 2 | github-code | 13 |
6869111399 | # 백준 문제번호 - 11651
num = int(input()) # 점의 개수 입력받기
temp_list = []
for i in range(num):
[x, y] = map(int, input().split())
reversed = [y, x]
temp_list.append(reversed)
sorted_list = sorted(temp_list) # sorted라는 정렬함수는 시퀀스 자료형 뿐만 아니라 순서에 구애받지 않는 자료형에도 적용할 수 있고, 정렬된 결과는 list로 반환한다.
for i in range(num):
... | conagreen/TIL-hanghae99 | Chapter2/algorithm/chapter02/day04_02.py | day04_02.py | py | 568 | python | ko | code | 0 | github-code | 13 |
14694084871 | #!/usr/bin/python3
"""
Class square.
"""
from models.rectangle import Rectangle
class Square(Rectangle):
"""
The Square class represents a square
and inherits from the Rectangle class.
Attributes (inherited from Rectangle):
__width (int): The width of the square.
__h... | Ninolincy/alx-higher_level_programming | 0x0C-python-almost_a_circle/models/square.py | square.py | py | 4,054 | python | en | code | 1 | github-code | 13 |
21293905533 | import numpy as np
import pandas as pd
filepath1 = ""
filepath2 = ""
filepath3 =""
d = {'pctile': [1, 2, 3, 4], 'race': ['White', 'White', 'Black', 'White'],
'gender' : ["F", "M", "F", "F"], 's_family' : [0.370000, 0.5555, 0.666, 0.7777],
's_indv' : [0.888, 0.999, 0.111, 0.222]}
df = pd.DataFrame(data=d)
... | stavreva/stata_to_python | python_test.py | python_test.py | py | 748 | python | en | code | 0 | github-code | 13 |
7124623844 | from transformers import pipeline
import xml.dom.minidom
import os
# create initial BT according to parameter
def create_xml():
doc = xml.dom.minidom.Document()
root = doc.createElement('root')
doc.appendChild(root)
tree = doc.createElement('BehaviorTree')
root.appendChild(tree)
seq =... | henryhaotian/LLM-BT | Parser/parser.py | parser.py | py | 2,557 | python | en | code | 0 | github-code | 13 |
5163793969 | from django.shortcuts import render
from django.http import HttpResponse
from google.analytics.data_v1beta import BetaAnalyticsDataClient, RunRealtimeReportRequest
from google.analytics.data_v1beta.types import DateRange
from google.analytics.data_v1beta.types import Dimension
from google.analytics.data_v1beta.types i... | jgone6/3Team | Video/views - 복사본.py | views - 복사본.py | py | 3,799 | python | en | code | 0 | github-code | 13 |
33020592106 | import JackTokenizer as tk
KEYWORD_CONST = ['true', 'false', 'null', 'this']
PRIM_VAR_TYPES = ['int', 'char', 'boolean']
OP = ["+", "-", "*", "/", "&", "|", "<", ">", "="]
UNARY_OP = ["-", "~"]
STATMENT_STARTERS = ["let", "if", "while", "do", "return"]
SYMBOL = 'SYMBOL'
KEYWORD = 'KEYWORD'
STRING_... | damebrown/NAND_ex10 | NAND-ex10/CompilationEngine.py | CompilationEngine.py | py | 13,019 | python | en | code | 0 | github-code | 13 |
74564190738 | #!/usr/bin/env python
"""
_WMTweak_
Define extraction of a standard set of WM related PSet parameters
Note: This can be used within the CMSSW environment to act on a
process/config but does not depend on any CMSSW libraries. It needs to stay like this.
"""
from __future__ import print_function, division
from builtin... | dmwm/WMCore | src/python/PSetTweaks/WMTweak.py | WMTweak.py | py | 21,264 | python | en | code | 44 | github-code | 13 |
9466976214 | from smpp5.lib.constants import command_ids
from smpp5.lib.pdu.session_management import (
BindTransmitter,
BindTransmitterResp,
BindReceiver,
BindReceiverResp,
BindTransceiver,
BindTransceiverResp,
OutBind,
UnBind,
UnBindResp,
EnquireLink,
EnquireLinkResp,
AlertNotificat... | kashifpk/smpp5 | smpp5/smpp5/lib/pdu/__init__.py | __init__.py | py | 1,913 | python | en | code | 0 | github-code | 13 |
14857542635 | import pygame
import random
import time
from pygame.locals import *
from setup import *
pygame.init()
vec = pygame.math.Vector2
framesPerSec = pygame.time.Clock()
displaySurface = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Jumper")
class Platform(pygame.sprite.Sprite):
def __init__(sel... | ceeelineee/Platformer-Game | main.py | main.py | py | 5,946 | python | en | code | 0 | github-code | 13 |
28545997581 |
import strawberry
from strawberry.types import Info
import strawberry_django
from django.contrib.auth import authenticate
from strawberry_django_auth.settings import app_settings
from strawberry_django_auth.types import (
LoginInput,
TokenType
)
from strawberry_django_auth.access_token.methods import (
A... | owendyer/strawberry-django-auth | strawberry_django_auth/mutations.py | mutations.py | py | 1,584 | python | en | code | 0 | github-code | 13 |
21264213416 | #
# @lc app=leetcode id=34 lang=python3
#
# [34] Find First and Last Position of Element in Sorted Array
#
# @lc code=start
from typing import List
class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
if not nums or len(nums) == 0:
return [-1, -1]
first ... | sundaycat/Leetcode-Practice | solution/34. find-first-and-last-position-of-element-in-sorted-array.py | 34. find-first-and-last-position-of-element-in-sorted-array.py | py | 2,136 | python | en | code | 0 | github-code | 13 |
71863464338 | ## 클래스 선언 부분 ##
class Car :
color = ""
speed = 0
def upSpped(self, value) :
self.speed += value
def downSpeed(self, value) :
self.speed -= value
## 메인 코드 부분 ##
myCar1 = Car()
myCar1.color = "빨강"
myCar1.speed = 0
myCar2 = Car()
myCar2.color = "파랑"
myCar2.speed = 0
myCar3 = Car()
... | gurofinance/python_lecture | class/object_2.py | object_2.py | py | 705 | python | ko | code | 0 | github-code | 13 |
31321841054 | import bs4 as bs
import requests
import yaml
import jabberjaw.utils.mkt_classes as mkt_classes
import mkt_coord_defaults as mkt_coord_defaults
import dpath.util as dp
def load_sp500_tickers() -> list:
"""loads the list of the S&P500 tickers"""
resp = requests.get('http://en.wikipedia.org/wiki/List_of_S%26P_50... | imry-rosenbuam/jabberjaw | jabberjaw/tsdb_utils/equity_stock_cfg_update.py | equity_stock_cfg_update.py | py | 2,462 | python | en | code | 0 | github-code | 13 |
29278038046 | """
Programmer: Collin Michael Fields
Date: 11/1/2018
Purpose: Calculate the value of E out to a certain decimal place. (Currently only works to the 48th decimal place.
"""
import math
from decimal import *
#Setting the precision to a value that will not cause it to error out.
getcontext().prec = 999
print("Welcom... | CollinFields/ProjectsWIP | NumbersProjects/EToTheNthDigit.py | EToTheNthDigit.py | py | 688 | python | en | code | 0 | github-code | 13 |
31372060472 | from datetime import timedelta
from typing import Optional
from pendulum import Date, DateTime, Time, timezone
from airflow.plugins_manager import AirflowPlugin
from airflow.timetables.base import DagRunInfo, DataInterval, TimeRestriction, Timetable
UTC = timezone("UTC")
class UnevenIntervalsTimetable(Timetable):
... | astronomer/airflow-scheduling-tutorial | plugins/uneven_intervals.py | uneven_intervals.py | py | 3,441 | python | en | code | 9 | github-code | 13 |
35268224295 | from unity_build_pipeline.Support.logger import color_print, GREEN
from unity_build_pipeline.Support.shell import run
from unity_build_pipeline.Support.fileutils import replace_string_entries
class Fastlane:
def __init__(self, project):
self.project = project
def execute(self, args):
project_... | MadCoder39/UnityBuildPipelineiOS | unity_build_pipeline/Services/Fastlane.py | Fastlane.py | py | 2,614 | python | en | code | 2 | github-code | 13 |
10747101482 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import numpy as np
import matplotlib.pyplot as pl
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
from matplotlib.ticker import MaxNLocator, NullLocator
from matplotlib.ticker import ScalarFormatter
from matplotlib.colors import LinearSeg... | bd-j/forcepho | demo/demo_color/color_plot_together.py | color_plot_together.py | py | 4,838 | python | en | code | 13 | github-code | 13 |
1873531332 | # Testing of model:
from tensorflow.keras.models import load_model
model=load_model('audio_classification.hdf5')
filename="D:\\sound_recog\\music\\bhairavi\\Bhairavi01.wav"
audio, sample_rate = librosa.load(file_name)
mfccs_features = librosa.feature.mfcc(y=audio, sr=sample_rate, n_mfcc=40)
mfccs_scaled_feat... | Biancaa-R/Swarakreeda-classical-music-app- | sound_recog/try.py | try.py | py | 574 | python | en | code | 0 | github-code | 13 |
56877499 | #!/usr/bin/env python
# coding=utf-8
"""Test notarization_poller.config
"""
import json
import logging
import os
from copy import deepcopy
import pytest
from immutabledict import immutabledict
import notarization_poller.config as npconfig
from notarization_poller.constants import DEFAULT_CONFIG
from notarization_poll... | mozilla-releng/scriptworker-scripts | notarization_poller/tests/test_config.py | test_config.py | py | 3,679 | python | en | code | 13 | github-code | 13 |
28621877106 | class BuildStatusDetails:
def __init__(self, line):
line = line.replace ('\r', "")
line = line.replace ('\n', "")
data = line.split(" ")
self.server = data [0]
self.platform = data [1]
self.componentGroup = data [2]
self.component = data [3]
s... | pawan-darda/front-src | Magellan2/DjangoWebSite/portlets/PortletUtils/build_status.py | build_status.py | py | 710 | python | en | code | 0 | github-code | 13 |
632064052 | from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls.static import static
from haystack.views import FacetedSearchView
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
# Uncomment the next two lines to enable the admin:
from cm... | arpitprogressive/arpittest | pursuite/urls.py | urls.py | py | 3,865 | python | en | code | 0 | github-code | 13 |
17057179934 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.OpenApiSceneInstanceInfo import OpenApiSceneInstanceInfo
from alipay.aop.api.domain.OpenApiSkillGroupChannelInfo import OpenApiSkillGroupChannelInfo
from alipay.aop.api.domain.OpenA... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/OpenApiSkillGroupInfo.py | OpenApiSkillGroupInfo.py | py | 7,224 | python | en | code | 241 | github-code | 13 |
39776626532 | from queueos.expressions import functions
FUNCTIONS = {}
class UserFunction(functions.FunctionExpression):
def execute(self, context, *args):
func = self._func[0]
return func(context, *args)
class FunctionFactory:
"""This class instantiates objects that are sub-classes of the
FunctionEx... | ecmwf/queueos | queueos/expressions/FunctionFactory.py | FunctionFactory.py | py | 1,528 | python | en | code | 2 | github-code | 13 |
23025991341 | def solution(data, n):
if n < 1:
return []
if len(data) < n:
return data
dataCountDir = {}
for i in data:
count = dataCountDir.get(i)
if count is not None:
dataCountDir[i] = count + 1
else:
dataCountDir[i] = 1
result = []
for... | xuanchuong/google-foobar | minion-task/solution.py | solution.py | py | 470 | python | en | code | 0 | github-code | 13 |
32513933386 | import requests
from bs4 import BeautifulSoup
import json
from soupsieve import select
url2="https://just-scrape-it.com/"
l="collections/hoodie-sweat","collections/tshirt-t-shirt-tee-shirt","collections/maillots-ete","collections/stickers"
up=[]
for i in l:
links=url2+i
up.append(links)
print(up)
# enlever le... | yvesmarius/yvesmarius | ultimate_test.py | ultimate_test.py | py | 1,193 | python | en | code | 0 | github-code | 13 |
17086092054 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.OrderDataDistributeInfo import OrderDataDistributeInfo
from alipay.aop.api.domain.OrderDataSyncSuggestion import OrderDataSyncSuggestion
class AlipayMerchantOrderSync... | alipay/alipay-sdk-python-all | alipay/aop/api/response/AlipayMerchantOrderSyncResponse.py | AlipayMerchantOrderSyncResponse.py | py | 2,724 | python | en | code | 241 | github-code | 13 |
32294625665 | # encoding=utf8
import math
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
class MySlam:
dmax = 200
tmax = 5
rmax = 5000
rhothreshold = 5000
pcntthreshold = 50
pdisthreshold = 100
angper = 360.0/1024
errcontrl = [50, 5]
robotpos = [0, 0, 0]
... | rainbell/PySLAM | myslam.py | myslam.py | py | 17,460 | python | en | code | 0 | github-code | 13 |
37785324446 | import math
import random
from numpy import array
import numpy as np
import matplotlib.pyplot as plot
from scipy.interpolate import interp1d
x = array([0, 6, 0, -17, -31, -28, 0, 39, 63])
y = array([0, 6, 16, 17, 0, -28, -47, -39, 0])
time = np.arange(0,10,0.1)
plot.title('Espiral')
plot.xlabel('X')
plot.ylabel(... | pdelfino/numerical-analysis | lista-4/rascunho-5.py | rascunho-5.py | py | 633 | python | en | code | 0 | github-code | 13 |
16129579163 | #!/usr/bin/python
"""
Purpose: creating DOCX files
pip install python-docx
"""
from docx import Document
document = Document()
# Adding a paragraph
paragraph = document.add_paragraph("Lorem ipsum dolor sit amet.")
# It’s also possible to use one paragraph as a “cursor” and insert a new paragraph directly above i... | udhayprakash/PythonMaterial | python3/11_File_Operations/02_structured_files/09_docx/docx_files_ex.py | docx_files_ex.py | py | 1,214 | python | en | code | 7 | github-code | 13 |
34739805969 | # coding: utf-8
from my_linear_algebra import *
from test_statistics import *
from test_gradient_descent import *
from my_multiple_regression import *
from test_adjusted_data import *
from my_cluster import *
import math
import random, re
from collections import defaultdict
users = [
{ "id": 0, "name": "Hero" },
... | lucelujiaming/dataScienceFromSCratch | test_network_analyze.py | test_network_analyze.py | py | 7,765 | python | zh | code | 0 | github-code | 13 |
3249563263 | import random
width = 100 # the width of the board
height = 100 # the height of the board
# create a board with the given width and height
# we'll use a list of list to represent the board
board = [] # start with an empty list
for i in range(height): # loop over the rows
board.append([]) # append an empty ro... | PdxCodeGuild/class_sheep | Code/charlie/python/lab26.py | lab26.py | py | 2,989 | python | en | code | 1 | github-code | 13 |
70728824979 | """Day 10 puzzle solutions"""
import sys
import day10_lib
with open(sys.argv[1], 'r') as inputFile:
INPUT = inputFile.readlines()
print("Day10 --- Part One --- result is: ")
DURATION = day10_lib.getMessage(INPUT)
print("Day10 --- Part Two --- result is: {0}".format(DURATION)) | Elgolfin/adventofcode-2018 | day10.py | day10.py | py | 284 | python | en | code | 0 | github-code | 13 |
37995617882 | import logging
import numpy as np
import asyncio
import time
import math
import cv2
from PIL import Image
from PIL import ImageDraw
from pycoral.adapters import common
from pycoral.adapters import detect
from pycoral.utils.dataset import read_label_file
from pycoral.utils.edgetpu import make_interpreter
from numpy.l... | Dronesome-Archive/companion | landing.py | landing.py | py | 4,714 | python | en | code | 0 | github-code | 13 |
4044485077 | from django.db import models
from django.conf import settings
from candidate.models import Candidate
from company.models import Poc
class Client(models.Model):
name = models.CharField(
verbose_name = "Name of the company",
max_length = 100,
help_text = "Name of the company",
blank = False,
)
address = model... | innovoguetechnologies/jobified | client/models.py | models.py | py | 4,399 | python | en | code | 0 | github-code | 13 |
21629722545 | import numpy as np
import collections
import itertools
def pf(k):
i = 2
while i * i <= k:
if k % i == 0:
k /= i
yield i
else:
i += 1
if k > 1:
yield k
def product(s):
result = 1
for i in s:
result *= i
return result
def get_di... | adrian2208/msc_project | Simulation-Tools/partitioning_check.py | partitioning_check.py | py | 1,070 | python | en | code | 0 | github-code | 13 |
28109225160 | from util.request_util import RequestUtil
from spider.extractor.abc_extractor import AbsExtractor
from util.ip_proxy import IpProxy
class E_Ihuan(AbsExtractor):
""" 小幻代理 """
_SOURCE_DOMAIN = 'https://ip.ihuan.me/address/5Lit5Zu9.html'
_SOURCE_NAME = '小幻代理'
def __init__(self):
super().__init... | bigfat-will/ip_pool_free | spider/extractor/e_ihuan.py | e_ihuan.py | py | 1,404 | python | en | code | 0 | github-code | 13 |
16710261394 | def write_ply_point_normal(name, vertices, colors):
fout = open(name, 'w')
fout.write("ply\n")
fout.write("format ascii 1.0\n")
fout.write("element vertex "+str(len(vertices))+"\n")
fout.write("property float x\n")
fout.write("property float y\n")
fout.write("property float z\n")
fout.write("pro... | liuzhengzhe/One-Thing-One-Click | s3dis/data/vis.py | vis.py | py | 1,780 | python | en | code | 48 | github-code | 13 |
34278503251 | from django_restapi.resource import Resource
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from utilities.FormatExceptionInfo import formatExceptionInfo
from users.utilities import get_requestor
import simplejson as json
impo... | nrao/nell | scheduler/resources/NellResource.py | NellResource.py | py | 2,965 | python | en | code | 0 | github-code | 13 |
24564240749 | import airflow
import configparser
from airflow import DAG
from datetime import datetime, timedelta
from airflow.operators.dummy_operator import DummyOperator
from airflow.contrib.operators.emr_add_steps_operator import EmrAddStepsOperator
from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobF... | kehindetomiwa/covid_data_enginering | src/airflow/dag/etl.py | etl.py | py | 5,152 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.