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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
41244155673 | import streamlit as st
from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Taken from the model and evaluation notebook
"""
Regression performance on train and test sets
"""
def regression_performance(X_train, y_tra... | Shida18719/heritage-housing-issues | src/machine_learning/evaluate_regression.py | evaluate_regression.py | py | 1,919 | python | en | code | 0 | github-code | 90 |
36856429495 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys, os
curdir = os.path.abspath(os.path.dirname(__file__))
sys.path = [os.path.dirname(curdir)] + sys.path
import logging, time
from loghog import LoghogHandler
def setup_logging():
logger = logging.getLogger()
# ... | activefrequency/loghog-python | examples/message-signing.py | message-signing.py | py | 872 | python | en | code | 3 | github-code | 90 |
24207463160 | import io
import time
from picamera import PiCamera
import requests
server_url = 'https://46.0.1.2'
def sendDataToServer():
frame = get_image()
temp = get_temperature()
payload = {'image': frame, 'temp': temp}
# headers = {'content_type': 'image/jpeg'}
response = requests.post(url = server_url+'/p... | marcbenedi/CreatED2018 | r.py | r.py | py | 581 | python | en | code | 0 | github-code | 90 |
73250750377 | '''
Handle deployments from here.
'''
from lib.utils import git
from lib.utils.colorprinter import colorprint, print_with_spinner
from lib.anchor import Anchor
from lib.plugins.firebase import FirebasePlugin
from lib.services.builder_service import builder
from lib.services.firebase_service import Firebase
from lib.se... | ypradhan/Harbor-CLI | lib/services/deploy_service.py | deploy_service.py | py | 1,583 | python | en | code | 0 | github-code | 90 |
1367243359 | from block_cd_lasso import BlockCDLasso
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Lasso
from pandas import read_csv
print("Demo: Regression on simulated data")
cov_matrix = np.identity(50)
cov_matrix += 0.8
... | jacobw125/uw-data-558 | polished_code_release/demo.py | demo.py | py | 1,769 | python | en | code | 1 | github-code | 90 |
33464659689 | import re
from ..item_fetching.search_config import SUPPORTED_CURRENCIES
CURRENCY_NAMES = tuple([curr for (curr, _) in SUPPORTED_CURRENCIES])
CURRENCY_NAME = str
# CURRENCIES = Dict[CURRENCY_NAME, 'Currency']
# CI_INFO = Dict[CURRENCY_NAME, Dict[CURRENCY_NAME, float]]
# CI_INFO_DIR = r".\exchange_rates"
# CI_INFO_PATH... | ddrddrr/clothing_searcher | web_app/price_checker_web_app/main_app/backend/currency_processing/currency_proc_config.py | currency_proc_config.py | py | 898 | python | en | code | 0 | github-code | 90 |
39854768059 | class Pessoa:
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
class Aluno(Pessoa):
def __init__(self, nome, idade, matricula):
super().__init__(nome, idade)
self.matricula = matricula
pessoa = Pessoa("João", 30)
print(f"Nome: {pessoa.nome}, Idade: {pessoa.i... | JotaXDr/ExOrientadoObj2 | Ex1.py | Ex1.py | py | 451 | python | pt | code | 0 | github-code | 90 |
35501960625 | from time import sleep
import matplotlib.pyplot as plt
import numpy as np
def go_to_sleep(seconds=20):
print("The kernel is going to sleep...")
t = 0
try:
while t < seconds:
if t % 5 == 0:
print("zzz.", end="")
else:
print(".", end="")
... | marshrossney/percolation | p1b-experiment/utils.py | utils.py | py | 1,612 | python | en | code | 0 | github-code | 90 |
10252542007 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 14 01:55:47 2020
@author: janibasha
"""
import streamlit as st
import pickle
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
... | jani-excergy/Hotel_senti | app.py | app.py | py | 2,026 | python | en | code | 1 | github-code | 90 |
39533571225 |
import numpy
import pickle
extLabelData = "pkl"
ID_DONT_CARE = 'DontCare'
ID_DOUBLE_ROOT = 'DoubleRoot'
ID_COLUMN = "Column"
ID_ROW = "Row"
ID_MAP_PIXEL2REGIONID = "MapPixel2RegionId"
ID_LIST_REGION = "ListRegion"
'''
ROIData 紀錄某個 id 的 ROI 的屬性
'''
class ROIData:
def __init__(self, idROI, ... | moooonbird/PanopticFPN | LabelData.py | LabelData.py | py | 2,542 | python | en | code | 1 | github-code | 90 |
21806280307 | # import nocsmtranslator
# print(nocsmtranslator.translateForMe("en","th","chicken eat a huge cat"))
# print(nocsmtranslator.translateForMe("th","en","ไก่จิกเด็กตายบนปากโอ่ง"))
# -*- coding: utf-8 -*-
import http.client, urllib.parse, uuid, json
# **********************************************
# *** Update or verify... | umaruzamak/work | whatsup.py | whatsup.py | py | 1,618 | python | en | code | 0 | github-code | 90 |
12215720225 | #!/usr/bin/env python
#
# This script uses ffmpeg to extract frames from video files in a directory
#
import argparse
import os
import subprocess
import sys
parser = argparse.ArgumentParser()
parser.add_argument(
"--size_limit",
type=int,
default=1024 * 1024 * 32,
help="Ignore files above this size"... | alvarop/scripts | frame_extractor/frame_extractor.py | frame_extractor.py | py | 1,919 | python | en | code | 0 | github-code | 90 |
4068474104 | """
Imports driver and shipment data from the json formatted files drivers.json and
shipments.json and inserts the data into the driver and shipment tables in the
geospatial dataabase maship. The files live in ./data directory.
"""
import os
from json import loads as json_loads
import django
from django.con... | bartelby/maship | etl/import_data.py | import_data.py | py | 2,128 | python | en | code | 0 | github-code | 90 |
35449796140 | def solution(numbers, hand):
phone=[[1,2,3],[4,5,6],[7,8,9],[-1,0,-2]]
leftFlag = 0
curLeft = -1
curRight = -2
x= 0
y= 0
lx = 0
ly = 0
rx = 0
ry = 0
leftDistance = 0
rightDistance = 0
answer = ''
if hand == "left":
leftFlag=1
for i... | wseungjin/codingTest | kakao/2020_summer/20_summer_kakao_intern1.py | 20_summer_kakao_intern1.py | py | 2,057 | python | en | code | 0 | github-code | 90 |
18257328419 | def main():
N,A,B = map(int,input().split())
syo = N//(A+B)
amari = N%(A+B)
ans = syo*A
if amari < A:
ans += amari
else:
ans += A
return ans
print(main())
| Aasthaengg/IBMdataset | Python_codes/p02754/s273363319.py | s273363319.py | py | 201 | python | en | code | 0 | github-code | 90 |
18042841269 | N=int(input())
ans=0
reject=0
A=[]
for i in range(1,N+1):
ans+=i
if ans>=N:
reject=ans-N
for j in range(1,i+1):
if j!=reject:
print(j)
break | Aasthaengg/IBMdataset | Python_codes/p03910/s596461328.py | s596461328.py | py | 200 | python | en | code | 0 | github-code | 90 |
71716356777 | from socket import socket, AF_INET, SOCK_STREAM
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('',serverPort))
serverSocket.listen(1)
print ('Server ready')
connectionSocket, addr = serverSocket.accept()
print ("accepted connection")
sentence = connectionSocket.recv(1024).decode()
p... | asuradev99/Python_Labs | TCP_Server.py | TCP_Server.py | py | 533 | python | en | code | 0 | github-code | 90 |
18396638139 | #import operator
n = int(input())
l = set()
cnt = 1
d = {}
o = {}
for i in range(n):
s,p = input().split()
p = int(p)
d[(s, p)] = cnt
if s in o:
x = o[s]
x.append(p)
o[s] = x
else:
o[s] = [p]
l.add(s)
cnt = cnt+1
w = list(l)
w.sort()
k = []
#print(" ")
for... | Aasthaengg/IBMdataset | Python_codes/p03030/s880647599.py | s880647599.py | py | 466 | python | en | code | 0 | github-code | 90 |
32411551584 | from flask import Flask, render_template, request, redirect, url_for, flash, Response, make_response, json
from Psycopg2_functions import *
from Web_projects import geocode
from Web_projects import getgroup
from dashapp import create_dash_app
app = Flask(__name__)
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'
@ap... | Aendraes/Website-public | website/app.py | app.py | py | 8,242 | python | en | code | 0 | github-code | 90 |
9826623629 | import os
import sys
import json
import subprocess
playbook_path = 'main.yml'
do_verbose = False
def set_verbose(value):
do_verbose = value
def make_vars(host_pkg, state):
vars = {}
vars['input'] = {}
vars['input']['pkg_list'] = host_pkg
vars['input']['pkg_state'] = state
return vars
def... | SyncopatedLinux/cfgmgmt | plugins/modules/pkg_manager/library/runner.py | runner.py | py | 755 | python | en | code | null | github-code | 90 |
70031397097 | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(1):
_, frame = cap.read()
# It converts the BGR color space of image to HSV color space
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# Threshold of blue in HSV space
lower_blue = np.array([35, 140, 60])
upper_blue = np.ar... | EliStones/EatSleepCode | day14/noiseRemoval.py | noiseRemoval.py | py | 1,100 | python | en | code | 0 | github-code | 90 |
6319640957 | # Ultralytics YOLO 🚀, AGPL-3.0 license
import torch
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import ops
__all__ = ['NASValidator']
class NASValidator(DetectionValidator):
"""
Ultralytics YOLO NAS Validator for object detection.
Extends `DetectionValidator... | ultralytics/ultralytics | ultralytics/models/nas/val.py | val.py | py | 1,846 | python | en | code | 15,778 | github-code | 90 |
13064369496 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
import modelcluster.contrib.taggit
import modelcluster.fields
import wagtail.core.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '00... | rapidpro/rapidpro-community-portal | src/rapidpro_community_portal/apps/portal_pages/migrations/0031_auto_20150520_1419.py | 0031_auto_20150520_1419.py | py | 2,832 | python | en | code | 18 | github-code | 90 |
30942020727 | # Open the file in read mode
file = open("data.txt", "r")
# Read the entire contents of the file
content = file.read()
# Print the content
print(content)
# Close the file
file.close()
# Open the file in write mode
file = open("data.txt", "w")
# Write content to the file
file.write("Hello, World!")
# Close the fil... | AndriiVyshnevskyi/pythonProject | gitignore.py | gitignore.py | py | 334 | python | en | code | 0 | github-code | 90 |
73423663976 | # TO INCLUDE CHARACTERS THAT ALREADY
# HAVE A SPECIAL MEANING IN PYTHON
# THERE IS BACKSLASH '\'
# EASY CHECKING USING 'in'
# 'in' CHECKS IF ONE STRING IS PART OF ANOTHER
print("e" in "blueberry") # => True
print("blue" in "blueberry") # => True
print("blue" in "strawberry") # => False
def common_letters(string_one,... | Hyunu02/basic_py | strings/easyWayToIterate.py | easyWayToIterate.py | py | 534 | python | en | code | 0 | github-code | 90 |
17352490272 | from googleapiclient.discovery import build
from google.oauth2 import service_account
import datetime
from googleapiclient.errors import HttpError
class GoogleCalendar:
def __init__(self):
key_file = 'calendarprojectPrivKey.json'
# this now has to be defined as a single element in an array:
# scope = ("https:/... | zogspat/bedside | googleCalendar.py | googleCalendar.py | py | 1,860 | python | en | code | 0 | github-code | 90 |
34770885878 | #########################
#鉴于WeiYi的框架比较复杂,令我欲仙欲死两周时间,我决定重新搭一个框架
#这个框架基于先进的tensorflow2.0 舍弃了很多原来有的语法
#e.g. placeholder 等
#本文描述的是如何生成信道模型。
#我们这里采用y = Hx+n的经典模型
import numpy as np
import math
from scipy.linalg import toeplitz
from scipy.linalg import sqrtm
import scipy.io as scio
class Channel_generator():
def __init... | RetardHuang/MIMO_detection_CEP_Net | Channel_generator.py | Channel_generator.py | py | 6,450 | python | en | code | 0 | github-code | 90 |
16764940546 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 14:11:52 2023
@author: Jichu
"""
import pandas as pd
# Load your dataset into a Pandas DataFrame
df = pd.read_csv("Population.csv")
# Create a list of country codes for aggregation
country_codes_to_aggregate = ["ARM", "AZE", "BLR", "GEO", "KAZ", "KGZ", ... | jichuan-zhang/ESDA_Code | 0090_w1/Normalisation/USSR.py | USSR.py | py | 1,223 | python | en | code | 0 | github-code | 90 |
5387983590 | import numpy as np
from copy import deepcopy
from tkinter import *
from tkinter import messagebox
from sens import sensModel
# ИЗМЕНЕНИЕ СТРУКТУРЫ X и Y
def vectorStructureChanges(changes, changedX, changedY, n, k, X1, X2, Y1, Y2):
helper = 0
# подготавливаем вектор с изменениями
for i in ran... | KikinaA/exercise4.2 | leontief/combineSynthesisModel.py | combineSynthesisModel.py | py | 18,661 | python | ru | code | 0 | github-code | 90 |
18357582029 | import heapq
from collections import deque
def main():
N, M = list(map(int, input().split(' ')))
tasks = list()
for _ in range(N):
req_day, reward = list(map(int, input().split(' ')))
latest_start_day = M - req_day
tasks.append((-reward, latest_start_day))
# sort by desc order ... | Aasthaengg/IBMdataset | Python_codes/p02948/s519738686.py | s519738686.py | py | 817 | python | en | code | 0 | github-code | 90 |
70103864298 | import time
import uuid
import os.path
tokens = set()
def log(*args, **kwargs):
print(*args, **kwargs)
def get_local_time(time_seconds):
t = time.localtime(time_seconds)
return time.strftime("%Y-%m-%d %H:%M:%S", t)
def generate_token():
token = str(uuid.uuid4())
tokens.add(token)
return token
def encrypt... | Timuer/BBS | utils.py | utils.py | py | 724 | python | en | code | 0 | github-code | 90 |
29226682 | from django.shortcuts import render
from django.shortcuts import redirect
from .models import Post, Group, Follow
from django.shortcuts import get_object_or_404
from django.contrib.auth import get_user_model
from .forms import PostForm, CommentForm
from django.contrib.auth.decorators import login_required
from posts im... | maksimivanov1/hw05_final | yatube/posts/views.py | views.py | py | 4,143 | python | en | code | 0 | github-code | 90 |
21834315412 |
# coding: utf-8
# In[73]:
import itchat
import smtplib
import pickle
from email.mime.text import MIMEText
from itchat.content import TEXT
# function: send email
def send_email(email_type,email_content):
fromaddr = "me@senlyu.com"
subject = email_type
content = email_content
text_subtype = 'pla... | senlyu/wechatrobot | test_version/mailtest.py | mailtest.py | py | 974 | python | en | code | 1 | github-code | 90 |
72776114538 | # -*- coding: utf-8 -*-
"""
image_processing_with_kmeans.py
Landon Halloran
07.03.2019
www.ljsh.ca
Demonstration of kmeans using multi-band image data. Good intro to several powerful
python modules! And good example of a practical unsupervised discrete ML application
to remote sensing data.
Data is downsampled Se... | lhalloran/Remote_Sensing_MSc_Course-Google_Earth_Engine | python/image_processing_with_kmeans.py | image_processing_with_kmeans.py | py | 2,853 | python | en | code | 6 | github-code | 90 |
70974902697 | import random
import sys
import time
from copy import deepcopy
def neighbors_from_data(data):
neighbors = {}
for i, line in enumerate(data):
if i == 0:
continue
lst = list()
for j, cost in enumerate(line, 1):
if j == i:
continue
... | jsxgod/Python-coursework | amh/l1/z2/zad2.py | zad2.py | py | 3,311 | python | en | code | 0 | github-code | 90 |
18349052039 | # 頂点数がN(N-1)/2, 辺がN(N-2)本できる
from collections import deque
N = int(input())
matches = [[a-1 for a in map(int, input().split())] for line in range(N)]
q = deque(range(N))
depth = [0]*N
waiting = [-1]*N
while q:
a = q.popleft()
b = matches[a].pop()
if waiting[b] == a:
depth[a] = depth[b] = max(depth[a], depth... | Aasthaengg/IBMdataset | Python_codes/p02925/s926190235.py | s926190235.py | py | 509 | python | en | code | 0 | github-code | 90 |
8672834132 | import http.client
import hashlib
import urllib
import random
import json
import requests
def post_to_baidu(from_text, to_text, input_text):
'''
APP ID:20220212001080952
密钥:7hmzzpojDNLIdUD5MkUb
'''
appid = "20220212001080952"
secretKey = '7hmzzpojDNLIdUD5MkUb'
httpClient = None
myu... | muyuchenzi/PYref | ReviewCode/QA_for_InterView/Python_Advance/English_Chinese_trans.py | English_Chinese_trans.py | py | 2,462 | python | en | code | 0 | github-code | 90 |
39198661001 | import os
import sys
import shutil
def install_sublime_plugin(packages_path, rewrite=False):
"""Writes plugin files to appropriate destination. If rewrite is True existing files will be overwritten"""
not_copied = []
source_path = os.path.dirname(os.path.realpath(__file__))
for folder in os.listdir(sou... | yahor-filipchyk/sublime-text-2-jbehave | install.py | install.py | py | 2,426 | python | en | code | 0 | github-code | 90 |
44699474274 | from sklearn.datasets import load_iris
from sklearn import tree
from sklearn.metrics import classification_report
import graphviz
iris = load_iris()
x_data = iris.data
y_data = iris.target
model = tree.DecisionTreeClassifier()
model.fit(x_data, y_data)
dot_data = tree.export_graphviz(model,out_file='tree.dot',
... | PierreVon/Learning-python | Sklearn/7-2 CART.py | 7-2 CART.py | py | 738 | python | en | code | 0 | github-code | 90 |
44687285803 | #############################################################################################################
# Regresión POS Check | Apache License 2.0 #
# Software de generación automática de documentación para Test de Regresión en dispositivos POS #
# Javier Bernal | 2023 ... | WrathfulNico/RegresionPOS-Check | modulos/FileScript.py | FileScript.py | py | 2,789 | python | es | code | 0 | github-code | 90 |
21996240118 | import argparse
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import hashlib
import hmac
import traceback
config = {}
try:
with open("./config.json") as file:
config = json.load(file)
except:
print("Cannot find config.json!")
exit(1)
if (__name__ != "__main__"):
... | t0mm4rx/github-auto-pull | watcher.py | watcher.py | py | 1,998 | python | en | code | 7 | github-code | 90 |
3302254507 | #!/usr/bin/python3
"""
unit test file for base module and its Base class
"""
import unittest
from models.base import Base
class TestBaseClass(unittest.TestCase):
"""
class for testing Base class in base model
"""
def test_module_documentation(self):
"""
test checks for module document... | amiresaye6/alx-higher_level_programming | 0x0C-python-almost_a_circle/tests/test_base.py | test_base.py | py | 1,020 | python | en | code | 0 | github-code | 90 |
38044266250 | # from: https://timcera.bitbucket.io/swmmtoolbox/docsrc/index.html
# https://bitbucket.org/timcera/swmmtoolbox/src/master/swmmtoolbox/swmmtoolbox.py
# copied to reduce dependencies
# ORIGINAL Author Tim Cera with BSD License
# Rewritten for custom use
# SWMM Version > 5.10.10
# Python Version >= 3.7
import copy
from ... | michaeltryby/swmm_api | swmm_api/output_file/extract.py | extract.py | py | 12,685 | python | en | code | 1 | github-code | 90 |
1919780044 | class Solution:
def numUniqueEmails(self, emails: List[str]) -> int:
## create a hashset to store unique stringd
unique = set()
for e in emails:
## split the string before @ symbol as local and after @ symbol as domain
local,domain = e.split("@")
... | mohdabdulrahman297/Leetcode | 0929-unique-email-addresses/0929-unique-email-addresses.py | 0929-unique-email-addresses.py | py | 779 | python | en | code | 0 | github-code | 90 |
10548641067 | def even_odd(num):
if num%2==0:
return True
return False
if __name__ == '__main__':
num = int(input('Enter a number to check whether it is even or odd : '))
if even_odd(num):
print(f'{num} is Even')
else:
print(f'{num} is Odd')
| KumarSantosh22/Python-Programs | even_odd.py | even_odd.py | py | 275 | python | en | code | 0 | github-code | 90 |
41863485286 | #! /usr/bin/python
from tempfile import mkstemp
from shutil import move
from os import remove, close
import re
import sys
def replace(file, pattern, subst):
print (file)
#Create temp file
fh, abs_path = mkstemp()
new_file = open(abs_path,'w')
old_file = open(file)
for line in old_file:
new_fi... | 0xdabbad00/OpenHIPS | installer/setVersion.py | setVersion.py | py | 2,071 | python | en | code | 33 | github-code | 90 |
71105527657 | import argparse
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from src.sudoku.sudoku import SudokuSolver
from src.sudoku_translator import SudokuTranlator
from src.regional_proposal.regional_proposal import RpMser
from src.utils.utils import draw_bboxes, draw_digits,... | ZequnZ/CV-based-sudoku-solver | cv_sudoku_solver.py | cv_sudoku_solver.py | py | 2,364 | python | en | code | 0 | github-code | 90 |
18203003869 | N=int(input())
d_pre=input().split()
d=[int(s) for s in d_pre]
d.sort()
d_2=d[::-1]
ans=1
if 0 in d_2:
print(0)
else:
for i in range(N):
ans*=d_2[i]
if ans>10**18:
print(-1)
break
elif i==N-1:
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02658/s955953843.py | s955953843.py | py | 271 | python | en | code | 0 | github-code | 90 |
18214460579 | n,m,X=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
ans=float('inf')
from itertools import combinations as com
for l in range(1,n+1):
for i in com(list(range(n)),r=l):
cnt=[0]*m
p=0
for j in i:
p+=c[j][0]
for x in range(m):
... | Aasthaengg/IBMdataset | Python_codes/p02683/s151674991.py | s151674991.py | py | 418 | python | en | code | 0 | github-code | 90 |
9476148828 | from pyDatalog import pyDatalog
summ = ((0 + 999999) * 1000000) / 2
median = 100 / 2
pyDatalog.create_terms('Sum_n, Avg, Median, Prod_n')
pyDatalog.create_terms('factorial, N')
factorial[N] = N * factorial[N - 1]
factorial[1] = 1
print((Sum_n == summ)&(Avg == Sum_n/1000000)&(Median == median))
print()
print(Prod_n =... | bolotovmark/Labs_Python_PSTU | lab3/main.py | main.py | py | 338 | python | en | code | 1 | github-code | 90 |
69819815657 | #3.5 – Alterando a lista de convidados: Você acabou de saber que um de seus
# convidados não poderá comparecer ao jantar, portanto será necessário enviar um
# novo conjunto de convites. Você deverá pensar em outra pessoa para convidar.
# • Comece com seu programa do Exercício 3.4. Acrescente uma instrução print
# no fi... | CarolinaRodrigues/curso_intensivo_de_python_uma_eric_mat | Exercicos/03.Introdução_as_listas/3.5.py | 3.5.py | py | 1,094 | python | pt | code | 0 | github-code | 90 |
23005084113 | from pandas import read_csv
import numpy as np
from pandas import DataFrame as df
import pandas as pd
import os, csv
import matplotlib.pyplot as plt
csfont = {'fontname': 'Times New Roman'}
plt.rcParams["font.family"] = "Times New Roman"
SMALL_SIZE = 14
MEDIUM_SIZE = 16
BIGGER_SIZE = 18
TITLE_SIZE = 20
plt.rc('font', ... | VeselaCindy/Bitalino | results/graphs.py | graphs.py | py | 5,716 | python | cs | code | 0 | github-code | 90 |
7106899128 | # data preparation workflow
# use pdb files in NR_LH_Protein_Martin
# identify intearcting residues by a cutoff: 5 (or any other number)
# output a csv file.
# import stuff
from abdb import *
import sys
import os
from find_files import find_files
import numpy as np
# create outdir
outpath = 'abdb_outfiles_2019'
if os... | GreiffLab/manuscript_ab_epitope_interaction | src/abdb_prepdata_main_fig1.py | abdb_prepdata_main_fig1.py | py | 2,605 | python | en | code | 20 | github-code | 90 |
20359697916 | import unittest
from ttp_tools.ttp_util import allow_override, subclass, extend_class
# Copyright 2019 Richard Sanger, Wand Network Research Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licens... | wandsdn/ttp-tools | tests/test_extend_class.py | test_extend_class.py | py | 11,486 | python | en | code | 0 | github-code | 90 |
13449147020 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 27 19:23:05 2018
@author: SunWei
"""
import numpy
import os
from fnmatch import fnmatch
import cv2
class Dataset():
# 采集数据
#filedir:文件路径
#content: 'train'/'test'
#num:数据数量
#code_num:验证码数量
#feature_set: 1 提取局部特征 0 不提取局部特征
#feature_num: 特征数量
... | VARed/ANN | Code_Recognition_By_SunWei/Dataset.py | Dataset.py | py | 5,615 | python | en | code | 0 | github-code | 90 |
29460228697 | #!/usr/bin/python
# encoding=utf-8
import requests as requests
from urllib import quote
def buildQueryWithoutEncode(params):
return buildQuery(params, False)
def buildQueryWithEncode(params):
return buildQuery(params, True)
def buildQuery(params, needEncode):
'''
将params组合成key1=val... | gusibi/zmop | zmop/WebUtil.py | WebUtil.py | py | 1,561 | python | en | code | 1 | github-code | 90 |
21942262420 | # web qq protocol
import os, sys
import json, re
import enum
import time
from PyQt5.QtCore import *
from PyQt5.QtNetwork import *
from PyQt5.QtDBus import *
from .imrelayfactory import IMRelayFactory
from .qqcom import *
from .qqsession import *
from .unimessage import *
from .filestore import QiniuFileStore, VnFile... | kitech/wxagent | wxagent/qq2any.py | qq2any.py | py | 38,187 | python | en | code | 76 | github-code | 90 |
27173529704 | #coding=utf-8
#!/usr/bin/env python3
global flag
import socket, sys, os, threading, time, configparser, re
#下面两个是关闭额外开启的一个线程使用的第三方工具代码 _async_raise()和stop_thread()
import ctypes,inspect
def _async_raise(tid, exctype):
"""raises the exception, performs cleanup if needed"""
tid = ctypes.c_long(tid)
if not i... | qq12cvhj/ftp_manager | server/main.py | main.py | py | 23,016 | python | en | code | 1 | github-code | 90 |
43512049101 | import subprocess
import time
import gpiozero
import logging
STATSFILE = '/proc/diskstats'
FIELD = 12
INTERVAL = 0.05
GPIO = 21
ACTIVE_HIGH = True
led = gpiozero.LED(GPIO,
active_high=ACTIVE_HIGH,
)
while True:
try:
with open(STATSFILE,mode='r') as s:
s... | larryare/mr3000 | ssd_led.py | ssd_led.py | py | 756 | python | en | code | 17 | github-code | 90 |
7504895307 | from abc import abstractmethod
import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.signal import resample
from scipy.spatial.distance import euclidean
from tslearn.metrics import dtw_path
class SensorReadings:
def __init__(self, session_id=None, data=None, activity=N... | bulatkh/trdl-ai | src/dataset/sensor_readings.py | sensor_readings.py | py | 7,497 | python | en | code | 0 | github-code | 90 |
10214677652 | def checkPL(arr, n):
ans = 0
st = ""
for i in range(n):
c1 = i
k = 1
while ((c1 - k) >= 0 and (c1 + k) < n and arr[c1 - k] == arr[c1 + k]):
k += 1
if (2 * k - 1 > ans):
st = arr[c1 - k+1: c1 + k]
# print("first")
# print(st, c1 ... | SheetanshKumar/smart-interviews-problems | InterviewBit/Strings/Longest Palindromic Substring.py | Longest Palindromic Substring.py | py | 860 | python | en | code | 6 | github-code | 90 |
13455167320 | # Реализуйте алгоритм задания случайных чисел без использования встроенного генератора псевдослучайных чисел. БЕЗ КАКИХ ЛИБО РАНДОМОВ
from datetime import datetime
import time
def Random_number (min, max):
if abs(max) > abs (min):
check = min - 1
max_abs = max + 1
else:
check = max + 1
... | Sveta2311/Python | home18.py | home18.py | py | 1,077 | python | en | code | 0 | github-code | 90 |
17682617911 | from authapp import api
from flask import jsonify
from flask_restful import Resource, reqparse, marshal_with
from authapp import db, models
from view_common import default_rule_fields
class DefaultRule(Resource):
def __init__(self):
"""Constructeur: liste les champs attendus dans le corps HTML"""
... | ldurandadomia/Flask-Restful | authapp/view_single_def_rule.py | view_single_def_rule.py | py | 1,933 | python | en | code | 0 | github-code | 90 |
72821174057 | from odoo import fields, models
class CustomInfoOptionSet(models.Model):
_description = "Option Sets for Custom Information"
_name = "custom_info.option_set"
name = fields.Char(
index=True,
translate=True,
required=True,
)
code = fields.Char(
string="Code",
... | open-synergy/ssi-mixin | ssi_custom_information_mixin/models/custom_info_option_set.py | custom_info_option_set.py | py | 686 | python | en | code | 0 | github-code | 90 |
5488589594 | import numpy as np
import os
import pandas as pd
from astropy.io import fits
import tqdm
from cv2 import resize, INTER_CUBIC
import multiprocessing
from os.path import exists
ids = pd.read_csv("clf.csv").ID
zps = pd.read_csv("iDR4_zero-points.csv")
fits_folder = "/media/gjperin/SD-64GB-Gabriel/clf_fits"
bands = ["U",
... | gabjp/LTS2.0-data | data/clf/packer.py | packer.py | py | 1,636 | python | en | code | 0 | github-code | 90 |
18540437469 | N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0
for i in range(N):
x += A[i]
d[x] = d.get(x, 0) + 1
ans = d.get(0, 0)
for x in d.values():
ans += x * (x-1) // 2
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03363/s069936239.py | s069936239.py | py | 195 | python | en | code | 0 | github-code | 90 |
41813776697 | from tkinter import *
from mailmerge import MailMerge
import xlrd
import sys
import os
import codecs
from tkinter import filedialog
from tkinter.filedialog import askdirectory
current_row = 0
sheet_num = 0
data_list = []
window = Tk()
window.geometry('650x450')
def exit_label():
btn = Button(window,text="Exit",widt... | agilewitinternal/CONSEN | LoadUi.py | LoadUi.py | py | 3,651 | python | en | code | 0 | github-code | 90 |
28164797476 | def to_camel_case(s):
if s.find("-") < 0:
return s
temp = s.split("-")
res = temp[0] + "".join(ele.title() for ele in temp[1:])
return res
def process(data):
if isinstance(data, dict):
# return {(to_camel_case(k), process(v)) for (k,v) in data.items()}
data2 = {}
... | soyrochus/hog | Processnames.py | Processnames.py | py | 523 | python | en | code | 0 | github-code | 90 |
6694220849 | # USB_PORT = "/dev/ttyUSB0" # Arduino Uno R3 Compatible
USB_PORT = "/dev/ttyACM0" # Arduino Uno WiFi Rev2
# Imports
import serial
def sendMessage(message):
try:
usb = serial.Serial(USB_PORT, 9600, timeout=2)
except:
print("ERROR - Could not open USB serial port. Please check your port name... | nkuma23/BruinBotVoice | sendMessage.py | sendMessage.py | py | 432 | python | en | code | 0 | github-code | 90 |
21633552718 |
# Code to acquire data on road collisions, crime, postcodes, IMD amd population
# Wrangles and exports files
# Enables subsequent document creation (make_documents.py)
# Adam Bricknell, Feb 2021
from sodapy import Socrata
import pandas as pd
import requests
from zipfile import ZipFile
from io import BytesIO
import os... | adam-jb/camden_crime_data | process_data.py | process_data.py | py | 9,008 | python | en | code | 0 | github-code | 90 |
75025565416 | # -*- coding: utf-8 -*-
from odoo import fields, models, api
from datetime import date, timedelta
class IssueWizard(models.TransientModel):
_name = "issue.wizard"
_description = "Issue Wizard"
# Wizard to cofirm the issue.bok
def action_confirm(self):
issue_book_record = self.env["issue.book... | muchhalaamit/custom_addons_15 | library_management/wizards/issue_wizard.py | issue_wizard.py | py | 1,100 | python | en | code | 0 | github-code | 90 |
37627474879 | #pip install -U pyDataverse
#https://curlconverter.com/python/
from pyDataverse.api import NativeApi
import os, sys, requests, json
def connectDVN():
filen = "../.env"
if not os.path.isfile(filen):
print('Configuration file .env not fount, copy env to .env and configure it!')
sys.exit()
... | ReneFGJr/Brapci3.1 | python/dataverse/pydvn.py | pydvn.py | py | 1,325 | python | en | code | 0 | github-code | 90 |
20600703005 | import cv2
from mtcnn import FaceDetector
from PIL import Image
import numpy
detector = FaceDetector()
def camera_detect():
video = cv2.VideoCapture(0)
while True:
ret, frame = video.read()
# 将 OpenCV 格式的图片转换为 PIL.Image
pil_im = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))... | imkuang/MTCNN-PyTorch | camera_demo.py | camera_demo.py | py | 835 | python | en | code | 14 | github-code | 90 |
13328503203 | from tkinter import *
from random import randint
from time import sleep
root = Tk()
root.title("Sorting Algorithms Visualiser")
def go():
data = []
quantity = int(myEntryQuantity.get())
for i in range(quantity):
data.append(randint(int(myEntryRangeMin.get()),int(myEntryRangeMax.get())))
b... | jjdshrimpton/PythonJunk | Sorting Visualiser.py | Sorting Visualiser.py | py | 2,283 | python | en | code | 0 | github-code | 90 |
18106373689 | def swap(l, i, j):
tmp = l[i]
l[i] = l[j]
l[j] = tmp
return l
def selection_sort(l):
cnt = 0
for i in range(len(l)):
minj = i
for j in range(i + 1, len(l)):
if l[j] < l[minj]:
minj = j
if i != minj:
swap(l, i, minj)
cnt... | Aasthaengg/IBMdataset | Python_codes/p02260/s248452737.py | s248452737.py | py | 516 | python | en | code | 0 | github-code | 90 |
72435655018 | import json
import os
class CacheException(Exception):
pass
class FileBackedCache(object):
LOCAL_FILE_NAME = '.small-improvements-cache'
def is_setup(self):
return os.path.isfile(self.LOCAL_FILE)
@property
def LOCAL_FILE(self):
return os.environ['HOME'] + f'/{self.LOCAL_FILE_N... | bcooksey/small-improvements-cli | caches.py | caches.py | py | 1,714 | python | en | code | 1 | github-code | 90 |
35050309622 | import logging as log
import sys
from pathlib import Path
def load_data(words_file=None):
UPPER_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LETTERS_AND_SPACE = UPPER_LETTERS + UPPER_LETTERS.lower() + " \t\n"
SYMBOLS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?."
ETAOIN = "ETAOINSHRD... | srufle/cracking-codes | cc-py/detect_english.py | detect_english.py | py | 3,444 | python | en | code | 0 | github-code | 90 |
39128581039 | import cv2
import numpy as np
img = cv2.imread('../img/fish.jpg')
height, width = img.shape[:2]
dst1 = cv2.resize(img, (int(width*0.5), int(height*0.5)), interpolation=cv2.INTER_AREA)
dst2 = cv2.resize(img, None, None, 2, 2, cv2.INTER_CUBIC)
cv2.imshow("original", img)
cv2.imshow("small", dst1)
cv2.imshow("big", ... | YeonwooSung/ai_book | CV/OpenCV/geometric_transform/scale_resize.py | scale_resize.py | py | 365 | python | en | code | 17 | github-code | 90 |
18016842263 | import cv2
import os
# Load the cascades
# Load the cascades
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
mouth_cascade = cv2.CascadeClassifier('haarcascade_mcs_mouth.xml')
# Create directory to save mouth images
if not os.path.exists('mouths'):
os.makedirs('... | draaliyu/Partial-face-extraction | mouth.py | mouth.py | py | 1,260 | python | en | code | 0 | github-code | 90 |
18113069099 | a = {}
n = int(input())
for i in range(n):
cmd, val = input().split()
if cmd == 'insert':
a[val] = val
elif cmd == 'find':
print('yes' if val in a else 'no')
| Aasthaengg/IBMdataset | Python_codes/p02269/s549675563.py | s549675563.py | py | 174 | python | en | code | 0 | github-code | 90 |
36188023606 | import networkx as nx
from collections import defaultdict
from .utils.word_sets import WordSetCollection
def get_inheritance_tree(df, df_values, langs_of_interest = None):
""" Constructs a inheritance tree with all items from etymdb"""
def add_node(inher_tree, ix, df_values):
inher_tree.add_node(ix)
... | clefourrier/CopperMT | pipeline/data/management/from_etymdb/extract_data.py | extract_data.py | py | 3,814 | python | en | code | 9 | github-code | 90 |
7572441207 | from fastapi import FastAPI, Request
from transformers import AutoTokenizer, AutoModel
import uvicorn, json, datetime
import torch
import asyncio
DEVICE = "cuda"
DEVICE_ID = "0"
CUDA_DEVICE = f"{DEVICE}:{DEVICE_ID}" if DEVICE_ID else DEVICE
MAX_LENGTH = 4096
def torch_gc():
if torch.cuda.is_available():
... | toby911/learngit | models/chatglm_api.py | chatglm_api.py | py | 3,561 | python | en | code | 0 | github-code | 90 |
16718890517 | import pygame
import os
from functions import load_images_from_json, load_sounds_from_json
# FPS
FPS = 60
# game over
game_over = 0
# main menu
main_menu = True
level_menu = False
# level
level = 1
max_levels = 3
# score
score = 0
# tile size
TILE_SIZE = 50
# cols
COLS = 20
# screen size
SCREEN_WIDTH = TILE_SIZE * COLS... | nachoar12/utn-prog-lab | pirate-platformer/settings.py | settings.py | py | 3,230 | python | en | code | 0 | github-code | 90 |
72606475817 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
from keras.datasets import imdb
# In[6]:
(train_data, train_labels), (test_data, test_labels) = imdb.load_data(num_words=10000) #frequently used num_words words -> adequate data size
# In[7]:
train_data[0]
# In[9]:
train_labels[0]
# In[13]:
max([max(seq... | dajchoi/Deep_Learning | Movie Review.py | Movie Review.py | py | 3,149 | python | en | code | 0 | github-code | 90 |
18535283429 | X = int(input())
b = 2
p = 2
ans = 1
for b in range(1, X+1):
for p in range(2, X+1):
beki = b ** p
if beki <= X:
ans = max(ans, beki)
else:
break
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03352/s697232755.py | s697232755.py | py | 209 | python | en | code | 0 | github-code | 90 |
23083677840 | #Ex12
dn_dia = int(input("Quin es el teu dia de naixement? "))
dn_mes = int(input("Quin es el teu mes de naixement? "))
dn_any = int(input("Quin es el teu any de naixement? "))
da_dia = int(input("Quin dia es avui? "))
da_mes = int(input("En quin mes estem? "))
da_any = int(input("En quin any estem? "))
if da_any < ... | mgarcia003/Programacio | UF1/if/ex12.py | ex12.py | py | 564 | python | ca | code | 0 | github-code | 90 |
24439715068 | import math
n = input()
l = list(map(int,input().split()))
y = []
for i in l:
x = int(math.sqrt(i))
if x*x == i:
y.append(i)
print(sum(y))
| koradasandhyadevi/codemind-python | Program_to_find_the_sum_of_perfect_square_elements_in_an_array.py | Program_to_find_the_sum_of_perfect_square_elements_in_an_array.py | py | 159 | python | en | code | 0 | github-code | 90 |
33448656798 | import pythoncom
import openpyxl
from win32com.client import Dispatch, gencache
import sys
# Подключение к API7 программы Kompas 3D
def get_kompas_api7():
module = gencache.EnsureModule("{69AC2981-37C0-4379-84FD-5DD2F3C0A520}", 0, 1, 0)
api = module.IKompasAPIObject(
Dispatch("Kompas.Application.7")._... | nickiteks/Deployment-Star-CCM-work | geom.py | geom.py | py | 3,391 | python | ru | code | 0 | github-code | 90 |
37793934774 | """
Script to process the summary statistics
"""
import pandas as pd
from config.constants import PROCESSED_DATA_PATH
TVL_AGG_DICT = {
"Total": pd.DataFrame(),
"Ethereum": pd.DataFrame(),
"Binance": pd.DataFrame(),
"Tron": pd.DataFrame(),
}
for chain, df_tvl_agg in TVL_AGG_DICT.items():
TVL_AGG_... | lyc0603/tvl-measurement | environ/data_processing/defillama_chain_tvl_info.py | defillama_chain_tvl_info.py | py | 426 | python | en | code | 1 | github-code | 90 |
4939969477 | from binder.BoundAssignmentExpression import BoundAssignmentExpression
from binder.BoundBinaryExpression import BoundBinaryExpression
from binder.BoundBlockStatement import BoundBlockStatement
from binder.BoundDeclarationExpression import BoundDeclarationExpression
from binder.BoundFunctionCall import BoundFunctionCall... | Lutetium-Vanadium/compiler | src/Evaluator.py | Evaluator.py | py | 10,598 | python | en | code | 0 | github-code | 90 |
12693071486 | from utils import *
import numpy as np
# Define the Points of Interest in Unreal coordinates
baseballDiamond = np.array([[-18045, 24560, 320]]) # Baseball Diamond
lakeFountain = np.array([[3000, 5000, -430]]) # Lake
tennisCourt = np.array([[-9400, -38390, 90]]) # Tennis Courts
farField = np.array([[-84820, -15650, 10]... | rbasaam/AirSim-Tools | diagnostic.py | diagnostic.py | py | 1,057 | python | en | code | 0 | github-code | 90 |
26208311905 | from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext
import config_bot
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
# from telegram import ChatAction
# Обработчик команды /get_link
async def get_link(update: Update, cont... | chibiherbie/detective-assistant-in-tg | test_bot.py | test_bot.py | py | 1,575 | python | ru | code | 0 | github-code | 90 |
13896601702 | """
Reduce is a function that takes a function and a list as arguments, and returns a single value as result.
The function is called with a lambda function and a list and a new reduced result is returned.
This performs a repetitive operation over the pairs of the list.
Syntax:
reduce(function, sequence)
... | BalveerSinghYT/Python | Functions/reduce.py | reduce.py | py | 871 | python | en | code | 0 | github-code | 90 |
17963292589 | N=int(input())
A=list(map(int,input().split()))
A.sort()
i=N-1
ans=1
count=0
while i>=1:
if A[i-1]==A[i]:
ans*=A[i]
i-=2
count+=1
else:
i-=1
if count==2:
print(ans)
break
else:
print(0)
| Aasthaengg/IBMdataset | Python_codes/p03625/s079620105.py | s079620105.py | py | 251 | python | en | code | 0 | github-code | 90 |
14132436605 | from django.shortcuts import get_object_or_404
from rest_framework import viewsets
from rest_framework import mixins
from rest_framework import filters
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.permissions import (
IsAuthenticated,
IsAuthenticatedOrReadOnly,
)
from posts.... | gweicox/api_final_yatube | yatube_api/api/views.py | views.py | py | 2,150 | python | en | code | 0 | github-code | 90 |
6712017811 | # https://github.com/NVIDIA/TensorRT/blob/master/quickstart/SemanticSegmentation/tutorial-runtime.ipynb
# Import required modules
import numpy as np
import os
import pycuda.driver as cuda
import pycuda.autoinit
import tensorrt as trt
import matplotlib.pyplot as plt
from PIL import Image
TRT_LOGGER = trt.Logger()
#... | k9ele7en/tensorRT-exp | resnet101/infer_resnet101.py | infer_resnet101.py | py | 4,633 | python | en | code | 0 | github-code | 90 |
11215013329 | import numpy as numpy
import cv2
import matplotlib.pyplot as plt
NUM_COLUMNS = 4
ROWS_COUNT = len(fake_images) % NUM_COLUMNS
COLUMNS_COUNT = NUM_COLUMNS
subfig = []
fig = plt.figure(figsize=(12,9))
for i in range(1, len(fake_images) + 1):
subfig.append(fig.add_subplot(ROWS_COUNT, COLUMNS_COUNT, i))
img_b... | ossan0922/python_study | show_image.py | show_image.py | py | 515 | python | en | code | 0 | github-code | 90 |
16250693329 | import numpy as np
from flask import Flask
from flask import request
from flask import jsonify
app = Flask(__name__)
def GeoReadyFun(Temp, E, Tar):
def heating(t, on_off):
heating_power = 5
start_period = 0.5
if on_off == 1:
if t < start_period:
return t * heat... | n0m0r3pa1n/geoready-server | app.py | app.py | py | 1,136 | python | en | code | 0 | github-code | 90 |
24778975099 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ordertogo', '0009_auto_20151109_2207'),
]
operations = [
migrations.CreateModel(
name='generic_variable',
... | contrerasjlu/bullpen-arepas-prod | ordertogo/migrations/0010_generic_variable.py | 0010_generic_variable.py | py | 741 | python | en | code | 0 | github-code | 90 |
40133285205 |
import copy
order_list = [['iphone',1000],['ipad',500],['airpod',800],['book',80],['toy',120],['xiaomi',300]]
order_total = int(len(order_list))
#print(order_total)
total_cost =0
total_order = []
good = False
calc_list = copy.deepcopy(order_list)
salary = input("input your salary:")
if salary.isdigit():
salary... | lp55323/Python-exercise | Day2_Exercise1.py | Day2_Exercise1.py | py | 1,363 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.