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
15651178657
# -*- coding: utf-8 -*- import multiprocessing import os def do_this(what): whoami(what) def whoami(what): print("进程 %s 说: %s" % (os.getpid(), what)) if __name__ == '__main__': whoami('我是主程序') for n in range(4): p = multiprocessing.Process(target=do_this, args=("我是 #%s 进程" % n,)) ...
ivix-me/note-introducing-python
ch10/1003/100302/mp.py
mp.py
py
357
python
en
code
0
github-code
1
33764436406
''' using :keyword:`with` statement ''' from easyprocess import EasyProcess from pyvirtualdisplay.smartdisplay import SmartDisplay if __name__ == "__main__": with SmartDisplay(visible=0, bgcolor='black') as disp: with EasyProcess('xmessage hello'): img = disp.waitgrab() img.show()...
tawfiqul-islam/RM_DeepRL
venv/lib/python3.6/site-packages/pyvirtualdisplay/examples/screenshot3.py
screenshot3.py
py
321
python
en
code
12
github-code
1
21530386266
#!/usr/local/bin/python3 import RPi.GPIO as GPIO import time import os #Limit of the measurement that indicates the line between dark and bright LIMIT = 26000 HYSTERESIS = 2000 GPIO.setmode(GPIO.BOARD) #define the pins pin_ldr = 7 # input for light detecting resistor pin_out_small = 3 # output for small li...
benoitjoh/ircamera
source/lightcontrol.py
lightcontrol.py
py
2,319
python
en
code
0
github-code
1
23030254845
from django.db import models from django.contrib.auth.models import AbstractUser from django.utils.translation import gettext_lazy as _ # Create your models here. def user_avatar_path(user, filename: str): return 'avatar/user_{0}/{1}'.format(user.username, filename) def user_thumbnail_path(user, filename: str):...
blueglasses1995/VideoRecomApp
users/models.py
models.py
py
1,341
python
en
code
0
github-code
1
27406648223
#By Kaushal Patil from tkinter import * from tkinter import messagebox root = Tk() root.title("Resitration") root.geometry("500x500") text_input = StringVar() def onclick(): messagebox.showinfo("Hello", "You have successful registered.") username = Label(root, text="New Username", height=1).place(x=160, y=100) ...
kaushal1014/Registration
main.py
main.py
py
1,745
python
en
code
0
github-code
1
36041039816
# A table composed of N x M bags, each having a certain quantity of apples, # is given. You start from the upper-left corner. At each step you can go # down or right one cell. Find the maximum number of apples you can collect. def solve(table): M = len(table[0]) if M == 0: return 0 solutions = [ ...
DrDougPhD/algorithms
dynamic-programming/table-of-apple-bags.py
table-of-apple-bags.py
py
1,026
python
en
code
0
github-code
1
29498997380
def solve(input): result = '' instructionLine = input removing = False index = 0 cancel = False count = 0 while index < len(instructionLine): currentChar = instructionLine[index] if removing == True: instructionLine = instructionLine[:index] + instructionLine[inde...
phyzical/advent-of-code
2017/9.2.py
9.2.py
py
1,790
python
en
code
0
github-code
1
9919923837
import logging import json from flask import request, jsonify; from codeitsuisse import app; logger = logging.getLogger(__name__) @app.route('/encryption', methods=['POST']) def encrypt(): data = request.get_json(); logging.info("data sent for evaluation {}".format(data)) result = [] f...
hlx1024/pythondemo25th
codeitsuisse/routes/secret_message.py
secret_message.py
py
1,023
python
en
code
0
github-code
1
25735539519
import sys sys.stdin = open('sample_input.txt') tests = int(input()) def escape(here_point, end): queue = [] # 큐 생성 # 현재 위치 큐에 저장 queue.append(here_point) # here_point: [r, c] # 델타 방식의 탐색 # 시계방향 # 위, 오, 아래, 왼 dr = [-1, 0, 1, 0] dc = [0, 1, 0, -1] visited = [[0] * N for _ i...
KSoonYo/SW_Expert_Arcademy_problem
5105_미로의거리/s1.py
s1.py
py
3,876
python
ko
code
0
github-code
1
413332120
from pathlib import Path from copy import deepcopy from typing import Callable, Optional, Any, \ Union, Generator, TextIO import numpy as np from dae.utils.variant_utils import get_interval_locus_ploidy from dae.variants_loaders.raw.flexible_variant_loader import \ flexible_variant_loader from dae.variants....
iossifovlab/gpf
dae/dae/variants_loaders/cnv/flexible_cnv_loader.py
flexible_cnv_loader.py
py
13,075
python
en
code
1
github-code
1
29710262008
from datetime import datetime from db import db class BookCopieModel(db.Model): __tablename__ = 'book_copie' id = db.Column(db.Integer, primary_key=True) contribution_date = db.Column( db.DateTime(timezone=True), default=datetime.utcnow) book_id = contributor_user_id = db.Column(db.Integer,...
rezid/api-rest
models/book_copie.py
book_copie.py
py
1,339
python
en
code
0
github-code
1
73799501155
#Data analaysis using Instagram from IPython.display import Image from IPython.display import display from InstagramAPI import InstagramAPI username="krisha_mehta" InstagramAPI = InstagramAPI(username,"prideandprejudice") InstagramAPI.login() InstagramAPI.getProfileData() result = InstagramAPI.LastJson #print(result)...
krishamehta/InstagramAnalysis
instagram.py
instagram.py
py
1,145
python
en
code
0
github-code
1
72919674913
from django.urls import path, include from . import views urlpatterns = [ path('', views.IndexView.as_view()), path('alumno/', views.AlumnoView.as_view(),name='alumnos'), path('alumno/<int:alumno_id>', views.AlumnoDetailView.as_view()), path('alumno_horario/', views.Alumno_HorarioView.as_view()), # Co...
aaronbarra040998/avanve-proy03
Avance API ALumnos/lab13/api/urls.py
urls.py
py
434
python
en
code
0
github-code
1
22926907740
#!/usr/bin/env python3 import csv products_list = [] prices_dict = {} def calculate_prices(products): my_list = [] for p in products: my_list.append(float(products_dict.get(int(p)))) return sum(tuple(my_list)) with open('products.csv') as products: reader = csv.reader(products, delimiter=',') next(pro...
tuxpower/interview-josegaspar
task1.py
task1.py
py
792
python
en
code
0
github-code
1
26465804587
##### Sales Prediction with Linear Regression import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns pd.set_option("display.float_format", lambda x: "%.2f" % x) from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_absolute_error, mean_squared_error ...
seymagkts/machine_learning
Module_4/linear_reg_exercises.py
linear_reg_exercises.py
py
5,376
python
tr
code
0
github-code
1
70708474275
def get_formatted_name(first_name,last_name,middle_name=''): """Возращает аккуратно отформатированное поле имя.""" if middle_name: full_name=first_name+' ' +middle_name+' '+last_name else: full_name=first_name+' ' + last_name return full_name.title() musician=get_formatted_name('jimi','hendrix') print...
Glava205/Learning-Python.-Game-programming-data-visualization-web-applications
formatted_name.py
formatted_name.py
py
445
python
en
code
1
github-code
1
16386366514
import informe_funciones def costo_camion(nombre_archivo): ''' calcula el costo total del camion y lo devuelve como punto flotante ''' costo = 0.0 camion = informe_funciones.leer_camion(nombre_archivo) for row in camion: costo += int(row['cajones'])*float(row['precio']) return co...
MarcosMartilotta/Curso_Python_UNSAM
Entrega_clase_6/costo_camion.py
costo_camion.py
py
323
python
es
code
0
github-code
1
8077731236
import json def get_historique_user(user): # Load existing user data from the file (if any) try: with open('users.json', 'r') as f: users = json.load(f) except FileNotFoundError: users = [] # Search for the user in the list for u in users: if u['user...
RadouaneElarfaoui/BankSystem
get_history.py
get_history.py
py
724
python
en
code
0
github-code
1
9348809940
from flask import Flask, request, jsonify, make_response from functools import lru_cache import json app = Flask(__name__) """ comma_separtaed_params_to_list splits string when comma occurs and append splitted tokens to a list input_str: input string Returns: a list of tokens separated by commas """ def comma_separ...
johnlgtmchung/flask_api_practice
app.py
app.py
py
3,142
python
en
code
0
github-code
1
6055001780
import glob import os import json import re import tqdm import pickle import pandas as pd import arguments as args files = glob.glob(os.path.join(args.scopes_dir, '*.scopes.json')) os.makedirs(args.cooc_dir, exist_ok=True) def str_normalize(value): return re.sub(r'\s+', ' ', value).lower() def get_item_string_by...
ewoij/cooccurrences-graph
02_build_cooccurrences.py
02_build_cooccurrences.py
py
2,271
python
en
code
0
github-code
1
12826388315
import numpy as np import h5py as hp import sys first = sys.argv[1] second = sys.argv[2] third= sys.argv[3] fourth = sys.argv[4] process = sys.argv[5] grid = (2048,2048,2048) def get_mass(path): try: f=hp.File(path,'r') except IOError: print('files not found') return ...
calvinosinga/HIColor
previous_versions/combine_fields.py
combine_fields.py
py
1,200
python
en
code
0
github-code
1
40057309346
from __future__ import print_function import os,sys,inspect from termcolor import colored currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) import models as Models import global_vars as Global from utils.args imp...
ashafaei/OD-test
setup/model_setup.py
model_setup.py
py
3,061
python
en
code
61
github-code
1
2228606076
from file_reader import get_file class Template: def __init__(self, template): self.template = get_file(template) def compile(self, variables=None): variables = variables or [] template = self.template for key in variables: value = variables[key] templa...
michaelmcmillan/michaelmcmillan.github.io
src/template.py
template.py
py
391
python
en
code
0
github-code
1
27662133565
# coding: utf-8 import os import hashlib from .filters import auto_markup __all__ = [ 'MediaManager', ] class MediaManager(object): def __init__(self, app=None, **options): self.css = [] self.xcss = [] self.js = [] self.xjs = [] self.jsfooter = [] self.xjsfooter = [] self.ie8js = ['ie8.min.js'] se...
endsh/haoku-open
kread/read/dash/media.py
media.py
py
3,285
python
en
code
6
github-code
1
36270372978
# -*- coding: utf-8 -*- '''从自己选出的优质股中,读取excel值,查看每个股票的K图,和证券公司的研报,筛选出好的股票存入excel''' import time import pandas as pd from selenium import webdriver from openpyxl import load_workbook class ShowK: def __init__(self): self.share_list0 = [] self.share_list1 = [] def read_from_excel(self): ...
zhouxiongaaa/myproject
my_stock/check_k.py
check_k.py
py
2,757
python
en
code
0
github-code
1
2957910804
#!/usr/bin/python3 import sys from q import run, run_text if len(sys.argv) == 1: while True: text = input('> ') if text == 'exit': break print(run_text(text)) elif len(sys.argv) == 2: run(sys.argv[1]) else: print('Usage: q [file]')
nirvanasupermind/qlang
build/lib/cli.py
cli.py
py
277
python
en
code
0
github-code
1
33288349359
import sys,os from familiapy.topictable import TopicTable from familiapy.api import InferenceEngineWrapper from familiapy.api import TopicalWordEmbeddingsWrapper if __name__ == '__main__': model_dir = os.path.join( os.path.dirname(__file__),'Familia/model/weibo') conf_file = "slda.conf" emb_file = "weibo_...
bung87/familiapy
demo.py
demo.py
py
1,991
python
en
code
5
github-code
1
10856186589
from collections import Counter def MostPopularNumbers(array, size): c = Counter(array) values = c.most_common(size) return min(values) a = [1, 1, 2, 2, 3, 4, 5, 6] MostPopularNumbers(a, a.count)
luizvictorPa/intro-to-computer-science-with-python
testes_extras/ex3.py
ex3.py
py
213
python
en
code
0
github-code
1
15894233613
# Takes ciecc job file and edits the file for other datafiles/models import sys dfile = sys.argv[1] model = sys.argv[2] # Open file with open("ciecc", "r") as f: lines = f.readlines() splitted = lines[-1].split(" ") splitted[5] = dfile splitted[7] = model joined = " ".join(splitted) lines[-1]...
nicochunger/RV_NestedSampling
src/nathan/scripts/jobs/edit_job.py
edit_job.py
py
389
python
en
code
1
github-code
1
4200238882
import itertools import json import math import random import statistics from collections import defaultdict from html.parser import HTMLParser import boto3 import requests from rating import RatingSystem, ContestType old_sponsored_contests = { "code-festival-2014-exhibition", "code-festival-2014-final", ...
kenkoooo/AtCoderProblems
lambda-functions/time-estimator/function.py
function.py
py
20,781
python
en
code
1,291
github-code
1
10783529687
""" High level functions that implement the genetic algorithm. These functions will perform the tasks of creating the initial randomized population, selecting the mating pool for consecutive generations, breeding a generation from a mating pool, and mutating a new generation. """ import random import route ##Solver va...
MissWhittlebury/multiple_tsp
solver.py
solver.py
py
8,274
python
en
code
0
github-code
1
9333482415
#!/usr/bin/env python3 """ Tests for the `pre_commit.git` submodule. """ from os import path from tempfile import TemporaryDirectory from unittest import ( main, TestCase ) from pre_commit.git import ( ForbiddenCharacterError, GitHandle, RepositoryError ) from tests.util import BasicRepo class T...
spreemohealth/style
tests/test_git.py
test_git.py
py
5,403
python
en
code
2
github-code
1
36279239216
import os import time import threading from dotenv import load_dotenv import pyttsx3 import data_handler from datetime import datetime from datetime import timedelta from task import Task class AssistantApp: def __init__(self): # Initialize text to speech self.engine = pyttsx3.init() # Ini...
johku/Assistant
assistant.py
assistant.py
py
5,966
python
en
code
0
github-code
1
38206554377
from flask_app import app from flask import render_template, redirect, request, session from flask_app.models.dojo import Dojo from flask_app.models.ninja import Ninja @app.route('/create_dojo', methods=['POST']) def create_user(): data={ 'name':request.form['name'], } Dojo.create_dojo(data) ...
megikapo18/dojo_ninjas
flask_app/controllers/dojos.py
dojos.py
py
620
python
en
code
0
github-code
1
22388472051
from flask import Flask, jsonify, request app = Flask(__name__) accounts = [ {"name":"Billy", 'balance':457.74}, {"name":"Renesmee", 'balance':-150.0}, {"name":"Edward", 'balance':4156.9}, {"name":"Marla", 'balance':321.31}, {"name":"Andrew", 'balance':-120.1}, {"name":"Roxane", 'balance':-10....
Kroha1999/3KURS
Univer/REST +/lab 2/get.py
get.py
py
2,190
python
en
code
0
github-code
1
31383412316
from lingpy import * from collections import defaultdict from sinopy import sinopy import re csv1 = csv2list('2017-02-18-Behr-1-197-draft-2-western.csv', strip_lines=False) csv2 = csv2list('2017-02-18-Behr-1-197-draft-2-eastern.csv', strip_lines=False) chars = defaultdict(list) for i, line in enumerate(csv2[1:]+csv1...
digling/rhymes
datasets/Behr2008/raw/helper-2017-01-03.py
helper-2017-01-03.py
py
1,929
python
en
code
2
github-code
1
5959079168
DETECTION = { "VIOLA_JONES": { "METHOD": 0, "CASCADE_FILE": "models/haarcascade_frontalface_default.xml" }, "DLIB_HOG": { "METHOD": 1, }, "DLIB_CNN": { "METHOD": 2, "MODE_FILE": "models/mmod_human_face_detector.dat" }, "CAFFE": { "METHOD": 3, ...
lifelonglearner127/face-detector
settings.py
settings.py
py
554
python
en
code
0
github-code
1
21259546205
import numpy as np def type2idx(Data_c,Type_c): n_samples=len(Data_c) target = np.empty((n_samples,), dtype=np.int) for idx in range(n_samples): if Data_c[idx] in Type_c: target[idx]=Type_c.index(Data_c[idx]) else: target[idx] = -1 return target
yylonly/ServeNet
Utils/utils.py
utils.py
py
303
python
en
code
34
github-code
1
15662447246
import json import os from flask import ( Flask, jsonify, render_template, request, send_from_directory, redirect, session, url_for, ) import oci from oci.ai_anomaly_detection.models import DetectAnomaliesDetails import postgrest from supabase import create_client, Client from io import...
Salomon-mtz/oxxogas.github.io
app.py
app.py
py
24,643
python
en
code
0
github-code
1
24869329840
from textwrap import indent import numpy as np def summarize( obj, arr_size_thresh=10, precision=4, ): """Construct a string summary of an object. If the object is an array and the array is small enough, print the full array and type. Otherwise, just print the size and type. If the passed ...
acerbilab/pyvbmc
pyvbmc/formatting/formatting.py
formatting.py
py
6,202
python
en
code
99
github-code
1
3203865574
import fire,os,sys import numpy as np from tqdm import tqdm from skimage import io,morphology from keras.utils import to_categorical import cv2 from ulitities.base_functions import get_file,send_message_callback,load_label def post_process_segment(inf,outf,Flag_cv=True, minsize=10, area_threshold=1000): # pass ...
scrssys/SCRS_RS_AI
mask_process/remove_small_object.py
remove_small_object.py
py
2,935
python
en
code
1
github-code
1
27174702884
import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BOARD) alarm = False alarm_pin = 31 alarm_set = True GPIO.setup(alarm_pin, GPIO.OUT) def start_alarm(): global alarm_set alarm_set = True def stop_alarm(): global alarm_set global alarm_pin alarm_set = False GPIO.output(alarm_pin, alarm_set) '''...
MomchilAngelov/Home_Automation_Project
distance_measure.py
distance_measure.py
py
2,417
python
en
code
0
github-code
1
26631971168
class Solution: def majorityElement(self, nums: [int]) -> int: if len(nums) == 1: return nums temp = dict() for val in nums: if val not in temp.keys(): temp[val] = 1 else: temp[val] += 1 return max(temp, key=lambda ...
RafaelHuang87/Leet-Code-Practice
169.py
169.py
py
390
python
en
code
0
github-code
1
27587876211
from typing import Dict,List,Tuple,Union,NamedTuple,Optional from typing_extensions import Literal import json,re import daa_luigi from common_functions import ExecutionFolder,raise_exception,as_inputs from copy import copy import pandas as pd from pathlib import Path import sissopp from sissopp.py_interface import get...
MilenaOehlers/cluster-based-SISSO
cluster_based_sisso/__init__.py
__init__.py
py
21,087
python
en
code
5
github-code
1
32374029032
import os import signal import time def sigint_handler(signum, frame): print('Has presionado Ctrl+C. Saliendo...') os._exit(0) signal.signal(signal.SIGINT, sigint_handler) def child_process(): print('El proceso hijo ha comenzado.') while True: print('El proceso hijo está en ejecución.') ...
td3-frm/practica
04-señales/sig_02.py
sig_02.py
py
634
python
es
code
7
github-code
1
38736890564
import numpy as np from matplotlib import pyplot as plt import matplotlib.colors import random as rand class Board: def __init__(self,dim,targetTerrain): #set default values for a board self.board = np.zeros((dim,dim), dtype= float) self.target = (rand.randint(0,dim-1),rand.randint(0,dim-1)) ...
akaashp/ProbabilisticHunting
Board.py
Board.py
py
1,315
python
en
code
0
github-code
1
38777068404
""" Aprenda a manipular datas Realizar conversao de texto para data e vice-versa realizar soma e subtracao em datas - Como recuperar a data atual(DATE) - Como trabalhar com a data, alterando sua formatação - Como gerar um horário(TIME) - Retornar data e hora atual(DATETIME) - Alterar formação do DATETIME - Realizar som...
Ademilson12/Aulas_Digital
Basico/aula10.py
aula10.py
py
1,756
python
pt
code
0
github-code
1
15868334293
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ reverse_prices = prices[::-1] profit = 0 sell_price = 0 for price in reverse_prices: if price > sell_price: sell_price = price...
quyennguyen2201/Leetcode
BestTimeToBuyStock.py
BestTimeToBuyStock.py
py
511
python
en
code
0
github-code
1
21024956783
import os from music21 import humdrum from music21 import converter import chant21 class MultipleSpinesException(Exception): """An exception raised when encountering multiple spines while expecting only 1""" pass def extract_phrases_from_spine(spine): """Enxtract the phrases as music21 streams from k...
bacor/cosine-contours
src/phrases.py
phrases.py
py
2,919
python
en
code
4
github-code
1
209241735
""" Vector construction and manipulation functions for MCRoute networks. This module contains methods that enable the constructing of vectors needed as initial conditions for traversal and probability evolution through the network. Typically, these methods require a defined :class:`mcroute.StateSpace` object which is ...
wklumpen/mcroute
mcroute/vector.py
vector.py
py
1,893
python
en
code
2
github-code
1
18022219984
import cv2 import numpy as np import os os.environ["OPENCV_IO_ENABLE_OPENEXR"]="1" from PIL import Image from utils.metrics_nocs import align, prepare_data_posefitting, draw_detections from datasets.datasets import exr_loader,load_meta syn_depth_path = '/data/sensor/data/real_data/test_0/0000_gt_depth.exr' nocs_path =...
PKU-EPIC/DREDS
CatePoseEstimation/align.py
align.py
py
3,904
python
en
code
89
github-code
1
36853075578
from client import Client import values from lib import * from class_user import user SQL = values.sql_connect() cursor = SQL.cursor() class defs: def __init__ (self , bot_token): self.bot_token = bot_token self.client = Client(bot_token) def get_message (self): messages = self.client...
Ezky-2/VSCode
mafia/bot/class_bot.py
class_bot.py
py
8,139
python
fa
code
0
github-code
1
11040292875
from common.FrontendTexts import FrontendTexts view_texts = FrontendTexts('quotes') labels = view_texts.getComponent()['selector']['choices'] ACTION_CHOICES = ( (1, labels['edit']), (2, labels['edit_materials']) ) PROVIDER_CHOICES = ( (1, "MP100001 - Conpancol Ingenieros"), (2, "MP100002 - Maasteel U...
Conpancol/PyHeroku
CPFrontend/quotes/choices.py
choices.py
py
328
python
en
code
0
github-code
1
39926577938
from datetime import datetime import requests from flask import Flask, render_template app = Flask(__name__) year = datetime.now().year # print(year) response = requests.get('https://api.npoint.io/362a61befce3d173e925') blog_posts = response.json() # print(blog_posts) @app.route('/') def home(): ...
vytautasmatukynas/Python-Random-Learning-Testing
WEB_DEV/flask/flask_1st_templates_forms/flask_project_3_blog_sample/server.py
server.py
py
714
python
en
code
0
github-code
1
27838963413
#Prime, Composite, Even Odd def list1(n): l1=[] even=[] odd=[] prime=[] comp=[] for i in range(n): e=int(input("Enter The Element:")) l1.append(e) for j in l1: if j%2==0: even.append(j) if j%2!=0: odd.append(j) for k in l1:...
PranaliRaorane02/Python
Functions_List.py
Functions_List.py
py
775
python
en
code
0
github-code
1
32509486669
from ftplib import FTP import ftplib import os import xml.etree.ElementTree as EleTree import VAPublishUtil as VAUtil import shutil import EchoItemXML __author__ = 'Jiao Zhongxiao' # 选择的功能分支 FEATURE_BRANCH = None # 确认的版本号 VERSION_NUM = None ASSET_EXT = ".json,.jpg,.png,.swf,.xml,.mp3,.wdp,.xcom" IGNORE_EXT = ".xc...
jiaox99/publishTools
pythonScripts/VACommonPublishTool.py
VACommonPublishTool.py
py
8,536
python
en
code
3
github-code
1
38317304274
# Importing Required Libraries import cv2 # define a class called ImageReader class ImageReader: def __init__(self, filename): self.filename = filename def read_image(self): try: img = cv2.imread(self.filename) if img is None: raise Exception("Err...
dsvijayvenkat/Computer_Vision_-_OpenCV
1.Reading_an_Image.py
1.Reading_an_Image.py
py
1,890
python
en
code
0
github-code
1
74246591074
import tweepy import json import time import datetime import ConfigParser import tweepy from tweepy.streaming import StreamListener ''' Get API keys from Configurations document ''' config = ConfigParser.ConfigParser() config.readfp(open(r'./configurations.txt')) consumerKey=config.get('API Keys', 'consumerKey') con...
kevinjye/EverTweet
tweet_listener.py
tweet_listener.py
py
1,336
python
en
code
1
github-code
1
7087899911
from utils.terminal import clear from utils.Database import Database import requests from utils.OpenApi import OpenApi class Dialogue: def __init__(self): self.database = Database() self.main_menu() self.open_api = OpenApi() def main_menu(self) -> None: """ This funct...
adrien914/P5_Utilisez_les_donnees_publiques_de_OpenFoodFacts
utils/Dialogue.py
Dialogue.py
py
11,416
python
en
code
0
github-code
1
72061896673
alien_o = {'color' : 'green', 'points' : 5} print (alien_o) alien_o['x_position'] = 0 alien_o['y_position'] = 25 print (alien_o) # change the value of dictionary print ("The alien color is " + alien_o['color'] + ".") alien_o['color'] = 'yellow' print ("The alien is now " + alien_o['color'] + ".") # move the alien t...
DefaultStudent/python_work
alien.py
alien.py
py
988
python
en
code
0
github-code
1
12237251241
import sys import threading def main(): t = int(input()) count = 0 def beautify(nums): nonlocal count if len(nums) == 1: return nums mid = len(nums) // 2 left = beautify(nums[:mid]) right = beautify(nums[mid:]) if left[0] > right[0]: ...
amanyih/Competitive-Programming
masha_and_beautiful_tree.py
masha_and_beautiful_tree.py
py
932
python
en
code
2
github-code
1
37519501474
# -*- coding: utf-8 -*- from ucloud.core.typesystem import schema, fields from ucloud.services.udb.schemas import models """ UDB API Schema """ """ API: DescribeUDBInstanceUpgradePrice 获取UDB实例升降级价格信息 """ class DescribeUDBInstanceUpgradePriceRequestSchema(schema.RequestSchema): """ DescribeUDBIns...
yufeiminds/ucloud-sdk-python2
ucloud/services/udb/schemas/apis.py
apis.py
py
47,057
python
en
code
null
github-code
1
3260640635
from collections import deque import sys input = lambda: sys.stdin.readline().rstrip() def bfs(x, y): q = deque() q.append((x, y)) field[x][y] = 0 while (q): a, b = q.popleft() for i in range(8): nx = a + dx[i] ny = b + dy[i] if 0 <= nx <...
zinnnn37/BaekJoon
백준/Silver/4963. 섬의 개수/섬의 개수.py
섬의 개수.py
py
913
python
en
code
0
github-code
1
42167996230
def solution(X, A): #My plan is to create a new array of 1-X and delete elements #in that array that pop up while iterating thru the original array. #Time complexity is O(n^2) I believe, for this attempt I will keep #time complexity to this value. tempArray = [] for r in range(X): tem...
duncanrout/Codility-Puzzles
FrogRiverOne/solution.py
solution.py
py
566
python
en
code
0
github-code
1
31281558255
import torch import pandas as pd import numpy as np import torch.nn as nn import statistics from DLDUlib import device, train, optimize_ols, center, normalize, r_squared, cross_validate_train import copy names = ['SalePrice','1st_Flr_SF','2nd_Flr_SF','Lot_Area','Overall_Qual', 'Overall_Cond','Year_Built','Year_Rem...
cpsiff/DLDU-Projects
2_nonlinear/my_imp_nonlinear_crossv_train.py
my_imp_nonlinear_crossv_train.py
py
2,166
python
en
code
0
github-code
1
72107723554
import json import time import datetime import os.path import GlobalConstants import GlobalEnums import Tools from os import path class ChatManager: """ Chat Manager """ def __init__(self): #self.chatChannelGlobal = {} self.createChannel(GlobalEnums.ChatChannel.CHAT_CHANNEL_GLOBAL) def createChannel(self, ...
RottenVisions/ouroboros-prototyping
prototyping/Chat.py
Chat.py
py
2,536
python
en
code
0
github-code
1
13953011427
## Code to make a PCR reaction using a pre-mixed master-mix, distribute it between wells ## of a 96-well plate, add primers and add a given number of template samples. ###INPUT### PCR variables num_replicates = 8 num_templates = 4 total_PCR_volume = 20 master_mix_volume = 8 template_volume = 1 primer_volume = 2.5 #...
Arne444/PCR_premixedMM
PCR_premixedMM.py
PCR_premixedMM.py
py
3,516
python
en
code
0
github-code
1
1323528673
import pathlib import tarfile import datetime import argparse import json class ConfigParser(): """Configuration file parser.""" def __init__(self, config_file_name: str): """Intialization.""" self._config_file = config_file_name self._config = dict() def parse(self) -> bool: ...
sandeepbhat/home-made-backup
hmb.py
hmb.py
py
3,031
python
en
code
0
github-code
1
35730064961
# -*- coding: utf-8 -*- """ Created on Tue Mar 2 09:47:56 2021 @author: ebbek """ import pandas as pd import numpy as np from inflhist import inflhist import scipy.stats as sp from infl_concat import infl_concat from inflhist import inflhist from figure_formatting import figure_formatting from AUcolor import AUcolor ...
ebbekyhl/Future-operation-of-hydropower-in-Europe
scripts/model_evaluation.py
model_evaluation.py
py
13,813
python
en
code
0
github-code
1
71015617315
# Title: 소인수분해 # Link: https://www.acmicpc.net/problem/11653 import sys import math sys.setrecursionlimit(10 ** 6) read_single_int = lambda: int(sys.stdin.readline().strip()) def solution(n: int): ans = [] p = 2 while p*p <= n: while True: d, r = divmod(n, p) if r == 0...
yskang/AlgorithmPractice
baekjoon/python/prime_factorization_11653.py
prime_factorization_11653.py
py
616
python
en
code
1
github-code
1
31584008482
""" Class for weather data. """ from json import loads from requests import get from .location import Location class Weather: """Class for weather data.""" def __init__(self, measure, location: Location, apikey=None): self.apikey = apikey self.measure = measure self.location = locatio...
PiSmartTV/PiTV
PiTV/weather.py
weather.py
py
1,454
python
en
code
14
github-code
1
2256436734
# -*- coding: utf-8 -*- """ Created on Sat Oct 26 15:00:05 2019 @author: ASUS """ #r=[] with open('C:/Users/ASUS/Desktop/reviews.txt','r') as f: for line in f: r.append(line) print(r[0])
Timothy12christ/Tim10-26.py
Tim10-26.py
Tim10-26.py
py
199
python
en
code
0
github-code
1
42292075170
import logging from typing import Any, Dict, Hashable, TypeVar, Union logger = logging.getLogger(__name__) D = TypeVar("D") def get_by_path(d: Dict, *path: Hashable, default: D = None) -> Union[Any, D]: """ Given a nested dict of dicts, traverse a given path and return the result or the default if it is not...
abn/cafeteria
cafeteria/patterns/dict.py
dict.py
py
878
python
en
code
5
github-code
1
38309035208
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 15 17:33:57 2020 @author: chris """ import numpy as np from . import ta def mmul_ta_signature(arg, mxdim): """Given a TablArray or np.ndarray, return a TablArray""" if hasattr(arg, 'ts') and hasattr(arg, 'base'): # arg is TablArr...
chriscannon9001/tablarray
tablarray/mmul_sig.py
mmul_sig.py
py
853
python
en
code
0
github-code
1
15685183129
import csv from selenium import webdriver import pandas from pandas import DataFrame import requests test_url = "https://downtowndallas.com/experience/stay/" chrome_driver_path = "E:\softwares/chromedriver.exe" driver = webdriver.Chrome(executable_path=chrome_driver_path) driver.get(test_url) driver....
PRANJALI1901/assesment
main.py
main.py
py
1,349
python
en
code
0
github-code
1
472864418
''' Task You are given two classes, Person and Student, where Person is the base class and Student is the derived class. Completed code for Person and a declaration for Student are provided for you in the editor. Observe that Student inherits all the properties of Person. Complete the Student class by writing the foll...
176deepak/HackerRank-30-days-of-code-Python
Day-12.py
Day-12.py
py
3,017
python
en
code
0
github-code
1
72536613153
#ben isenberg 10/23/2016 #returns negated int def negate(b): neg_b = 0 increment = -1 if (b < 0): increment = 1 for i in range(b): neg_b = neg_b + increment return neg_b #subtract using only + operator def subtract(a,b): b = negate(b) a = a + b return a #multiply using only + operator def multiply(a,...
bji6/Practice_Problems
Cracking_Coding_Interview/Moderate/addOnly.py
addOnly.py
py
768
python
en
code
0
github-code
1
2144866290
import requests import re from bs4 import BeautifulSoup from headers import HEADERS from csvImporter import CsvImporter class InfoFinder: def __init__(self, url_tuple_set, file_name): self.url_tuple = url_tuple_set self.has_contact_set = set() self.no_contact_set = set() self.impor...
redvox27/innovatiespotter
omleidingsSites/infoFinderController.py
infoFinderController.py
py
4,517
python
en
code
0
github-code
1
20521636348
from turtle import Turtle from paddle import Paddle from scoreboard import Scoreboard from random import randint from time import sleep BALL_RADIUS = 12 # supposedly 10 BALL_SPEED = 9 WINDOW_WIDTH = 960 WINDOW_HEIGHT = 640 class Ball(Turtle): def __init__(self) -> None: super().__init__() ...
LetSleepingFoxesLie/100DaysOfCode_py
22_Pong/ball.py
ball.py
py
2,597
python
en
code
0
github-code
1
16692902771
#!/usr/bin/env python import cv2 from lib import tracker BLUE = (255, 50, 50) GREEN = (50, 255, 50) RED = (50, 50, 255) WHITE = (255, 255, 255) def main(): markers = tracker.find_markers(img) for m_id, marker in markers.iteritems(): cv2.drawContours(img, [marker.contour], -1, GREEN, 2) cv2....
antoneri/rover-follow-target
examples/track_all_markers.py
track_all_markers.py
py
1,174
python
en
code
13
github-code
1
30989959642
# from locale import setlocale, LC_ALL from calendar import month_name, mdays from functools import reduce # setlocale(LC_ALL, 'pt_BR') Lista_meses = filter(lambda x: mdays[x] == 31, range(1, 13)) nome_meses = map(lambda x: month_name[x], Lista_meses) juntar = reduce(lambda todos, nome_mes: f'{todos}\n {nome_mes}', ...
higorsantana-omega/Programacao_funcional_Python
imutabilidade_v1.py
imutabilidade_v1.py
py
381
python
pt
code
0
github-code
1
2090654629
import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import urllib.request import os def to_image_name(user_info): return f'{user_info["name"]}_({user_info["updatedAt"]}).jpg' def get_local_user_from_image_name(image_name): image_name_without_ext = os.path.spli...
huuquyen2606/FID
fast_api.py
fast_api.py
py
1,610
python
en
code
0
github-code
1
18082080648
import torch import pandas as pd import numpy as np import tensorflow as tf from tensorflow import keras import zipfile import math import geopandas from shapely import geometry import os import torch import sys from sklearn.preprocessing import MinMaxScaler # load some default Python modules import numpy as np import...
ipmLessing/Taxi-Demand-and-Fare-Prediction
demand_prediction/Model_M=40_n1=100_n2=100sigmoid.py
Model_M=40_n1=100_n2=100sigmoid.py
py
17,686
python
en
code
0
github-code
1
71984897634
#!/usr/bin/python3 import sys import heapq class BiDij: def __init__(self, n): self.n = n # Number of nodes self.inf = n*10**6 # All distances in the graph are smaller # Initialize distances for forward and backward searches # visited[v] == True iff v was visited by forward or ...
akashvshroff/DSA_Coursera_Specialisation
Algorithms_on_Graphs/advanced_shortest_paths/bi_dijkstra.py3
bi_dijkstra.py3
py3
3,497
python
en
code
0
github-code
1
22653141239
# uses htmldiff and jsTransforms functions to run this repo's transforms and diff outputs # against known-good files # see README in this dir for more info import sys, os import subprocess import inspect import time import shutil import jsTransforms as jst import htmldiff as hdiff # key dirs transform_testfiles_dir...
macmillanpublishers/htmlmaker_js_rsuite
test/run_TransformTests.py
run_TransformTests.py
py
4,846
python
en
code
0
github-code
1
33272214825
import math import numpy as np """ Distance Between Functions ------------------------------------------------------------------------------------------------------------ - Find Specific Counter - Distance between all Neighbours - Distance between closer neighbours - Closest neighbour...
LukeSylvander/Physics-Honours-Code
DistanceBetweenFunctions.py
DistanceBetweenFunctions.py
py
12,695
python
en
code
0
github-code
1
23107127159
from encode.common import ( ALPHANUMERIC_CHARS, CORRECTION_LEVELS ) from encode.data_encoder import ( AlphanumericEncoder, BytesEncoder, NumericEncoder, QREncoder ) def select_encoding(msg: str) -> str: """ Determines which type of text encoding will be used for the message. If ms...
PrimeIdeal/qr-encoder
encode/preliminary.py
preliminary.py
py
2,228
python
en
code
0
github-code
1
38730450704
# raw_to_evoked # simple utility to plot_joint from file name import sys raw_file=sys.argv[1] event_id=1 import mne Raw=mne.io.read_raw_fif(raw_file) Events=mne.find_events(Raw) reject = dict(grad=4e-10, mag=4e-12, eog=150e-6) Epochs=mne.Epochs(Raw, Events, event_id=event_id, tmin=-0.1, tmax=0.8, baseline=(...
smonto/cibr-meg
raw2plot_joint.py
raw2plot_joint.py
py
400
python
en
code
0
github-code
1
29883414696
import math from tensorflow import keras from morphzero.ai.algorithms.hash_policy import HashPolicy from morphzero.ai.base import Evaluator from morphzero.common import board_to_string from morphzero.games.genericgomoku.ai.tic_tac_toe import TicTacToeKeras, TicTacToeKerasConfig from morphzero.games.genericgomoku.game...
morph-dev/self-learning-ai
morphzero/compare_to_min_max_main.py
compare_to_min_max_main.py
py
2,638
python
en
code
0
github-code
1
15279566011
# def bfs(graph, start, end): # queue = [] # queue.append([start]) # while queue: # path = queue.pop(0) # # print(path) # node = path[-1] # if node == end: # print(path) # if node in graph: # for adj in graph[node]: # ...
onyxolu/DSA
Tunmise/all_path_from_source_to_target.py
all_path_from_source_to_target.py
py
3,314
python
en
code
0
github-code
1
42014569567
import config from datetime import timedelta, datetime import covid_data import plot import spain_data AGE_GROUPS = { "0-9": ["0-9"], "10-19": ["10-19"], "20-39": ["20-29", "30-39"], "40-59": ["40-49", "50-59"], "60-69": ["60-69"], "70+": ["70-79", "80+"], } AGE_GROUP_COLORS = { "0-9": "...
JoseBlanca/covid_situation_spain
src/plot_evolution_per_age_group.py
plot_evolution_per_age_group.py
py
4,899
python
en
code
0
github-code
1
9682006969
from odoo import api, models, fields, _ class StockPicking(models.Model): _inherit = 'stock.picking' @api.one def _count_tds(self): self.delivery_count = len(self.ddt_ids) delivery_count = fields.Integer("Deliveries", compute=_count_tds) def show_transport_documents(self): """ ...
LibrERP/custom-addons
enhance_picking/models/stock_picking.py
stock_picking.py
py
2,312
python
en
code
2
github-code
1
38252418779
# 리스트에 값을 반복문을 활용하여 대입할 수 있다. => 내포 a = [2, 4, 5, 3, 1] b = a * 2 print("요소의 수가 두 배 확장", b) c = [i * 2 for i in a] # 요소의 값이 두배로 print("요소의 값이 두 배로 : ", c) l = [] for k in a : l.append(k*2) print("요소의 값이 두 배로 : ", l) even = [i for i in range(0, 11) if i % 2 == 0] print("0~10 에서의 짝수 리스트 : ", even)
star-min/Home_Test
Python/study/ex25.py
ex25.py
py
433
python
ko
code
0
github-code
1
45326757
from TAMO.MotifTools import Motif, print_motifs,save_motifs import sys,os,re inp=sys.argv[1] os.system("rm %s.tm" % inp) class MyWriter: def __init__(self, stdout, filename): self.stdout = stdout self.logfile = file(filename, 'a') def write(self, text): self.stdout.write(text) ...
ShiuLab/CRE-Pipeline
1.2_MEME2tamo.py
1.2_MEME2tamo.py
py
3,153
python
en
code
0
github-code
1
25959933939
#-*- coding: utf-8 -*- from datetime import date, timedelta from django.db import connection, models from django.utils.translation import ugettext_lazy as _ from twa.utils import DEFAULT_MAX_LENGTH, AbstractModel class RequestManager( models.Manager ): def get_query_set( self ): return super( RequestManag...
marcusti/mti-twa
requests/models.py
models.py
py
1,769
python
en
code
0
github-code
1
39899914837
from UI.editEmployeeWin import Ui_Dialog from PyQt5.QtWidgets import QDialog, QLineEdit from PyQt5.QtGui import QRegExpValidator from PyQt5.QtCore import QRegExp class EditEmployeeWin(QDialog, Ui_Dialog): def __init__(self, parent, roles, empData = None) -> None: super().__init__(parent) Ui_D...
Vittallya/MlApp
Views/editEmpWin.py
editEmpWin.py
py
3,278
python
en
code
0
github-code
1
32886110882
from nltk.corpus import stopwords from settings.common import word_tf_df from preprocessing_pipeline.NextGen import NextGen from preprocessing_pipeline import (Preprocess, RemovePunctuation, Capitalization, RemoveStopWords, RemoveShortWords, TwitterCleaner, RemoveUrls) def load_fl...
GU-DataLab/topic-modeling-textPrep
process_dataset.py
process_dataset.py
py
2,946
python
en
code
5
github-code
1
3689179156
"""feedback URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-base...
da5tan93/feedback
feedback/urls.py
urls.py
py
1,866
python
en
code
0
github-code
1
23999851895
""" Written by: Jonas Vander Vennet on: 2019/12/02 Answer: xpysnnkqrbuhefmcajodplyzw """ def neighbouring_words(wordlist): for word1 in wordlist: for word2 in wordlist: if len(word1) == len(word2): diff = 0 for i in range(len(word1)): if word...
jonasvandervennet/adventofcode
2018/02/part 2/main.py
main.py
py
1,314
python
en
code
0
github-code
1
33841644613
# coding: utf-8 """ This file implements all notions of fitness. """ import numpy as np from matador.utils.cursor_utils import get_array_from_cursor from matador.utils.chem_utils import get_concentration, get_formation_energy class FitnessCalculator: """ This class calculates the fitnesses of generations, by ...
ml-evs/ilustrado
ilustrado/fitness.py
fitness.py
py
7,191
python
en
code
2
github-code
1