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
39901615627
from django.http import HttpResponse, HttpResponseNotAllowed, \ HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.template import loader from django.contrib import messages from django.core.urlresolvers import reverse from django.core.exceptions import ValidationError from ...
brhoades/sweaters-but-with-peer-reviews
new/views.py
views.py
py
9,719
python
en
code
1
github-code
36
71335937383
class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: ans = [nums[:]] def next_perm(nums): size = len(nums) index = size - 2 while index >= 0 and nums[index] > nums[index + 1]: index -= 1 if index == -1: ...
architjee/solutions
Leetcode/permutations II.py
permutations II.py
py
1,155
python
en
code
0
github-code
36
17123809199
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # SPDX-License-Identifier: GPL-3.0 # ################################################## # GNU Radio Python Flow Graph # Title: Gr Baseband Async O # Generated: Tue Apr 16 11:20:50 2019 # GNU Radio version: 3.7.12.0 ################################################## from...
fmagno/dsp
dsp/transmission_gr38/gr_baseband_async_o.py
gr_baseband_async_o.py
py
3,933
python
en
code
1
github-code
36
71984366824
import pandas as pd from sklearn import metrics from sklearn import preprocessing from chapter5 import config from chapter5 import model_dispatcher from common import utils def run(fold): df = pd.read_csv(config.CENSUS_FILE_FOLDS) # 目的変数を変換 target_mapping = {"<=50K": 0, ">50K": 1} df.loc[:, "incom...
YasudaKaito/aaamlp_transcription
project/src/chapter5/census_lbl_xgb.py
census_lbl_xgb.py
py
1,606
python
en
code
0
github-code
36
38567827389
''' 542. 01 Matrix Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: [[0,0,0], [0,1,0], [0,0,0]] Output: [[0,0,0], [0,1,0], [0,0,0]] Example 2: Input: [[0,0,0], [0,1,0], [1,1,1]] Output: [[0,0,0], [0,1,0],...
archanakalburgi/Algorithms
Graphs/matrix01.py
matrix01.py
py
1,343
python
en
code
1
github-code
36
902272609
from multiprocessing import Process,Queue import os,time def write(q): print('启动写子进程%s' % os.getpid()) for chr in ["A","B","C","D"]: q.put(chr) time.sleep(1) print('结束写子进程%s' % os.getpid()) def read(q): print('启动读子进程%s'% os.getpid()) while True: value= q.get(True) ...
hughgo/Python3
基础代码/进程/10 进程间通信.py
10 进程间通信.py
py
805
python
en
code
10
github-code
36
10598156961
from openerp import SUPERUSER_ID from openerp.osv import fields, osv class service_config_settings(models.TransientModel): _name = 'service.config.settings' _inherit = ['sale.config.settings', 'fetchmail.config.settings'] _columns = { 'alias_prefix': fields.char('Default Alias Name for Notificati...
dtorresxp/deltatech
deltatech_service_maintenance/res_config.py
res_config.py
py
2,336
python
en
code
0
github-code
36
25451901336
from flask import Blueprint from marketplace import db, login_required from marketplace.models import Item, Tag tag_item = Blueprint('tag_item', __name__) @tag_item.route('/tag_item/<item_id>/<tag>') @login_required def tag_an_item(item_id, tag): # Get matching item matching_items = db.session.query(Item).fi...
adicu/marketplace
marketplace/routes/tag_item.py
tag_item.py
py
1,239
python
en
code
3
github-code
36
10665778183
import math import os from glumpy import glm from PIL import Image, ImageTk import numpy import tkinter import cv2 def load_image(file_name, size): image = Image.open(file_name) image = numpy.array(image) image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR) image = cv2.resize(image, size, interpolation=cv...
chahyon-ku/ImgToChunk
ImgToChunk.py
ImgToChunk.py
py
14,064
python
en
code
0
github-code
36
352049180
import os import sys import subprocess import shutil from args import launch_parse_args def main(): print("start", __file__) args = launch_parse_args() print(args) visible_devices = args.visible_devices.split(',') assert os.path.isfile(args.training_script) assert len(visible_devices) >= args.n...
kungfu-team/mindspore
model_zoo/official/cv/mobilenetv2/src/launch.py
launch.py
py
1,599
python
en
code
3
github-code
36
4035076126
def binary_search(array, target, start, end): while start <= end: mid = (start + end) // 2 if array[mid] == target: return mid elif array[mid] > target: end = mid - 1 else: start = mid + 1 return None def solution(N, items, R, r_items ): ...
kakaocloudschool/dangicodingtest
006_이진탐색/001_이코테/003_부품찾기_이진탐색.py
003_부품찾기_이진탐색.py
py
596
python
en
code
0
github-code
36
37634698673
from turtle import Turtle, Screen timmy = Turtle() print(timmy) timmy.shape("turtle") timmy.color("coral") timmy.forward(100) myScreen = Screen() print(myScreen.canvheight) # canvheight() is the height of the turtle screen print(myScreen.canvwidth) myScreen.exitonclick() # exitonclick() is used ...
anchalsinghrajput/python
turtle/01 forward.py
01 forward.py
py
375
python
en
code
0
github-code
36
35263829572
#!/usr/bin/env python # encoding: utf-8 from numpy.distutils.core import setup, Extension module1 = Extension('_floris', sources=['src/FLORISSE3D/floris.f90', 'src/FLORISSE3D/adStack.c', 'src/FLORISSE3D/adBuffer.f'], extra_compile_args=['-O2', '-c']) module2 = Extension('_florisDiscontinuous', sou...
byuflowlab/stanley2018-turbine-design
FLORISSE3D/setup.py
setup.py
py
1,172
python
en
code
1
github-code
36
25163452547
#!/usr/bin/env python import typer import logging import os # logging.basicConfig(level=logging.INFO, format="%(asctime)s %(filename)s: %(levelname)6s %(message)s") # # LOG = logging.getLogger(__name__) from easul.driver import MemoryDriver app = typer.Typer(help="EASUL tools to manage and extend the abilities of th...
rcfgroup/easul
manage.py
manage.py
py
1,926
python
en
code
1
github-code
36
9567324814
import logging import airflow from airflow.models import DAG from airflow.operators.python_operator import PythonOperator from airflow.operators.dummy_operator import DummyOperator from utils.slugify import slugify args = { 'owner': 'airflow', 'start_date': airflow.utils.dates.days_ago(2) } categorias = [ ...
erikriver/mixtli-etc
dags/03_siem_informacion_empresarial.py
03_siem_informacion_empresarial.py
py
2,866
python
es
code
2
github-code
36
35722574041
from tkinter import Tk, Frame, Button, Text from tkinter.ttk import Frame, Button from tkinter.filedialog import askopenfile class Application(): def __init__(self, root, title): self.root = root self.root.title(title) # Variable that stores file handle (may be unnecessary) self.fi...
Petetete/Consistent-CSS
consistent-css.py
consistent-css.py
py
3,060
python
en
code
0
github-code
36
12777874879
class Underscore: def map(self, iterable, callback): for i in range(len(iterable)): iterable[i] = callback(iterable[i]) return iterable def find(self, iterable, callback): for i in range(len(iterable)): if (callback(iterable[i]) == True): return i...
Salman-Khatib/All_coding_dojo
python_stack/_python/python_fundementals/UnderScore/Underscore.py
Underscore.py
py
1,681
python
en
code
0
github-code
36
39133833136
def solution(a): a.sort() if max(a) < 0: digit = 1 if len(a) == 1: if a[0] < 1: digit = 1 else: digit = a[0] + 1 else: if a[0] > 0: for x in range(a[0], a[-1] + 2): if x not in a: digit = x ...
briankiume/DemoCodility
DemoCodility.py
DemoCodility.py
py
647
python
en
code
0
github-code
36
3883658721
# ============================================================= # Imports # ============================================================= import logging import smtplib from server.utils import notification # ============================================================= # Constant # ==============================...
CaptFrank/EsxiController
server/utils/notification/notificationdispatch.py
notificationdispatch.py
py
2,687
python
en
code
0
github-code
36
1621435969
#!/usr/bin/env python # coding=utf-8 import string, random class LengthError(ValueError): def __init__(self, arg): self.args = arg def pad_zero_to_left(inputNumString, totalLength): """生成后四位主键, 主键数字从0开始递增, 需要保持4位,不足的位置补0""" lengthInputString = len(inputNumString) if lengthInputString > totalL...
nbmyt/pythonPractice
0001/0001v2.py
0001v2.py
py
1,187
python
en
code
0
github-code
36
40967939697
from django.db import models # null=True, blank=True это значит что данное поле может быть пустым, т.е. аватар не обязателен NULLABLE = {'blank': True, 'null': True} class Student(models.Model): first_name = models.CharField(max_length=150, verbose_name='имя') # обязательно last_name = models.CharField(max_...
DSulzhits/06_3_20_1_django_ORM
main/models.py
models.py
py
1,958
python
ru
code
0
github-code
36
448240955
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import numpy as np import keras from keras.models import Model from keras.layers import Dense,Activation,Input from keras.callbacks import ModelCheckpoint X = np.random.normal(0,1,(100,8)) Y = np.random.normal(0,1,(100,1)) ...
avilin66/Pyspark_codes
keras_basic_model.py
keras_basic_model.py
py
1,902
python
en
code
1
github-code
36
2940420975
import datetime # An object for representing a package to be delivered. class Package(): def __init__(self, package_id, address, city, state, zip, delivery_deadline, mass, special_notes, arrival_time="8:00 AM", required_truck=-1, deliver_with=[]): # an integer which is unique to each packag...
joshsizer/wgu_projects
wgu_data_structures_and_algorithms_2/package.py
package.py
py
2,855
python
en
code
0
github-code
36
3449169916
# -*- coding: utf-8 -*- """ Módulo ``PreProcWindow`` ======================== Implementa uma janela com funcionalidades de pré-processamento dos dados. .. raw:: html <hr> """ import inspect import numpy as np import pyqtgraph as pg from PyQt5 import QtCore from framework import file_m2k, file_civa, file_omni...
matheusfdario/role-finder
AUSPEX-smart_wedge/guiqt/Windows/PreProcWindow.py
PreProcWindow.py
py
10,993
python
pt
code
0
github-code
36
1593524531
import sqlite3 conn = sqlite3.connect('employee.db') c = conn.cursor() # c.execute("""CREATE TABLE employees ( # first text, # last text, # pay integer # )""") # c.execute("INSERT INTO employees VALUES ('Mary', 'oza', 70000)") conn.commit() c.execute("SELECT * FROM employees") print(c.fetchall()) c...
Parth-Ps/python
sqlite3_database/employees.py
employees.py
py
347
python
en
code
0
github-code
36
10924502441
""" 版本:2.0 作者:sky 作用:判断密码强度 日期:20181008 """ class PwdTool: def __init__(self, pwd): self.pwd_str = pwd self.pwdstrength = 0 def check_num(self): for c in self.pwd_str: if c.isnumeric(): return True return False def check_str(self): for c...
shenkeyu/panduanmima
trypwd2.0.py
trypwd2.0.py
py
1,473
python
en
code
0
github-code
36
73434601064
import pickle from tqdm import tqdm import os import pandas as pd import numpy as np from statsmodels.tsa.arima.model import ARIMA from pmdarima.arima import auto_arima def arima_model(test_codes, csv_filename, folder_path, n_output): df = pd.read_csv(csv_filename) n_output = n_output # output -> forecas...
stergioa/masterThesis4
src/forecasting_models/trash/test_ARIMA.py
test_ARIMA.py
py
1,313
python
en
code
0
github-code
36
11171979751
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt #Teht 1 df = pd.read_csv('emp-dep.csv') df.plot.scatter('age', 'salary') plt.title('Työntekijät ja palkat') plt.xlabel('Palkat') plt.show() count = df['dname'].value_counts() #kind barh flips to horizontal count.plot(kind="bar") plt.show...
emilsto/Data-analytics-and-machinelearning
week37/t1/t1.py
t1.py
py
1,019
python
en
code
0
github-code
36
28798444261
#I pledge my honor that I have abided by the Stevens Honor System. #Zachary Jones #HW6 Problem 2 import datetime def get_date(): date = str(input('Enter date M/D/YYYY: ')) return date def validate_date(date): format = '%m/%d/%Y' try: datetime.datetime.strptime(date, format) print('{...
Eric-Wonbin-Sang/CS110Manager
2020F_hw6_submissions/joneszachary/ZacharyJonesCH7P2.py
ZacharyJonesCH7P2.py
py
464
python
en
code
0
github-code
36
74318817382
try: from urlparse import urljoin except ImportError: # python3 compatibility from urllib.parse import urljoin from zope.dottedname.resolve import resolve def get_page_url(skin_name, page_mappings, page_id): """ Returns the page_url for the given page_id and skin_name """ fallback = '/' if pag...
davidemoro/pytest-pypom-navigation
pypom_navigation/util.py
util.py
py
1,916
python
en
code
2
github-code
36
5561659195
class Node: def __init__(self,value): self.value=value self.next=None class Queue: def __init__(self): self.head=None self.tail=None self.no_of_elements=0 def enqueue(self,value): if self.tail==None: self.tail=Node(value) self.head=self.tail self.no_of_elements=1 else: node=self.head whi...
sripriya-potnuru/implementations-of-algorithms-and-datastructures
python/queue/queue_using_linked_list.py
queue_using_linked_list.py
py
1,443
python
en
code
0
github-code
36
14151407552
import logging from datetime import datetime from pythonjsonlogger import jsonlogger from src.config import LOG_LEVEL import os path = os.path logger = logging.getLogger() logHandler = logging.StreamHandler() fileHandler = logging.FileHandler("logger/journals/log_file.log") class CustomJsonFormatter(jsonlogger.J...
Safonovdv91/web_gymkhana_bot_server
logger/logger.py
logger.py
py
1,168
python
en
code
1
github-code
36
22015297058
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 14 12:17:00 2021 @author: paradeisios """ import cv2 def get_video_secs(video): vidcap = cv2.VideoCapture(video) fps = vidcap.get(cv2.CAP_PROP_FPS) totalNoFrames = vidcap.get(cv2.CAP_PROP_FRAME_COUNT) vidcap.release() return in...
paradeisios/luminance
utils/get_video_secs.py
get_video_secs.py
py
358
python
en
code
0
github-code
36
25125476
n, m = map(int, input().split()) nums = sorted(list(map(int, input().split()))) visited = [False] * n temp = [] def dfs(): if len(temp) == m: print(*temp) return remember_me = 0 for i in range(n): if not visited[i] and remember_me != nums[i]: visited[i] = True ...
kmgyu/baekJoonPractice
bruteForce/N과M 시리즈/(9).py
(9).py
py
685
python
ko
code
0
github-code
36
22354196775
import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "64d90a1a69bc" down_revision = "e5594ed3ab53" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "background_tasks", ...
mlrun/mlrun
server/api/migrations_sqlite/versions/64d90a1a69bc_adding_background_tasks_table.py
64d90a1a69bc_adding_background_tasks_table.py
py
1,069
python
en
code
1,129
github-code
36
15361552534
from conans import ConanFile, CMake import os class StringIdConan(ConanFile): name = "string_id" version = "2.0-2" description = "A small C++ library to handle hashed strings serving as identifiers." license="Modified BSD License (3-Clause BSD license)" settings = "os", "compiler", "build_type", "arch" url...
pjohalloran/conan-stringid
conanfile.py
conanfile.py
py
1,343
python
en
code
0
github-code
36
22024978373
# Assignment: Draw Stars # Karen Clark # 2018-06-04 # Assignment: Stars # Write the following functions. # Part I # Create a function called draw_stars() that takes a list of numbers and # prints out *. from __future__ import print_function from colorama import init, Fore from termcolor import colored def draw_sta...
clarkkarenl/codingdojo_python_track
draw-stars.py
draw-stars.py
py
1,388
python
en
code
0
github-code
36
17102455910
# https://edabit.com/challenge/xG2KB9T7mHgycGCSz def valid(pin): if len(pin) == 4 or len(pin) == 6 and pin.isdigit(): return True else: return False '''print(valid("1234")) print(valid("45135")) print(valid("89abc1")) print(valid("900876")) print(valid(" 4983")) print(valid(" "))''' tests = ...
amrmabdelazeem/edabit
Python/Validate Pin.py
Validate Pin.py
py
631
python
en
code
0
github-code
36
39005966519
an = input() div_idx = len(n) // 2 sum1 = 0 sum2 = 0 for i in range(div_idx): sum1 += int(n[i]) sum2 += int(n[-(i+1)]) if sum1 == sum2: print("LUCKY") else: print("READY")
daeyoungshinme/algorithm
백준/구현/boj18406.py
boj18406.py
py
190
python
en
code
0
github-code
36
35609284688
from dataclasses import dataclass from queue import Empty import queue import cv2, time, os import numpy as np import torch.multiprocessing as mp from ..util.profiler import Profiler from .twitch_realtime_handler import ( TwitchAudioGrabber, TwitchImageGrabber ) from .youtube_recoder.image_recoder import Youtu...
gmlwns2000/sharkshark-4k
src/stream/recoder.py
recoder.py
py
7,577
python
en
code
14
github-code
36
32805043142
# henlo.py # created on November 13, 2018 # by Gull def hello(): fren = str(input("what is your name, friend? ")) #get a name for variable fren print("hello,", fren, ", and welcome to henlo.py!") #say hello to fren print("how you doing today?") hello() #hello!
gullwv/pyprojects
henlo.py
henlo.py
py
266
python
en
code
1
github-code
36
36570521283
import json import math import re import os import boto import tinys3 import random from django.shortcuts import render, redirect from django.http.response import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.conf import settings from django.utils import timez...
MicroPyramid/opensource-job-portal
pjob/views.py
views.py
py
117,784
python
en
code
336
github-code
36
19996296105
from django.shortcuts import render, redirect from django.http import Http404, HttpResponseRedirect from django.urls import reverse from .models import Article, Category, ArticleCategoryRelation from django.utils import timezone from .forms import UserRegistrationForm from django.core.paginator import Paginator, PageNo...
osinkel/articles-django
newnotes/views.py
views.py
py
9,576
python
en
code
0
github-code
36
10650749218
# This class defines the control data that we want to keep for debugging purposes class LogDataSet(): def __init__(self): # sensors' values self.sensors = LogSensorsData() # control values self.control = LogControlData() def setSensorsValues(self, axes, gyroscopeRate): # set sensors' values self.sensors...
antrew/yarapibabot
src/log_data_set.py
log_data_set.py
py
1,367
python
en
code
3
github-code
36
25124748823
import numpy as np class GradientDescentLinearRegression: def __init__(self, learning_rate=0.01, iterations=1000): self.learning_rate, self.iterations = learning_rate, iterations def fit(self, X, y): b = 0 m = 5 n = X.shape[0] for _ in range(self.iterations): ...
TanizzCoder/ANN
Gradient_Regression.py
Gradient_Regression.py
py
1,163
python
en
code
1
github-code
36
21676970380
#!/usr/bin/python3 # birds{id:{'pos':[x,y], 'ori':[x,y]}} pos = 'pos' ori = 'dir' X = 0 Y = 1 swarmSize = 1 swarm = {1:{pos:[0,0], ori:[0,0]}} def updatePos(target): target[pos] = [target[pos][X]+target[ori][X], target[pos][Y]+target[ori][Y]] for target in swarm: force = [0,0] for neighbor in repulsionZone(t...
jamie314159/swarm
swarm.py
swarm.py
py
745
python
en
code
0
github-code
36
12136530301
""" This file is meant to optimize the import speed. Import modules from YOLOv7 projects and Ultralytics take significant amount of time """ import glob import math import logging import numpy as np import os import re import time import urllib from pathlib import Path from PIL import Image, ImageDraw, ImageFont from ...
CMPUT-492-W2023-Capstone/cstc-backend-v7
app/src/module.py
module.py
py
28,870
python
en
code
0
github-code
36
32952196842
from django.shortcuts import render, redirect from kajaki_app.models import Route, Kayak, Order, OrderKayak from django.urls import reverse, reverse_lazy from datetime import date from django.views import View from kajaki_app.forms import AddKayakForm, AddRouteForm, ContactForm from django.views.generic import ListView...
KamilNurzynski/Kajaki
kajaki_app/views.py
views.py
py
4,243
python
en
code
0
github-code
36
2827309329
## Program name: sort_fruits.py ## UoPeople CS-1101 December 2015 ## Unit 7 ## Roger Stillick Jr. ## The purpose of this program is to read a file containing a list of ## fruits, then sort the list and write the sorted list to a new file. # Set the working directory of the path wd = '/home/roger/bin/' #courtesy prom...
RogerStilly/misc_py
sort_fruits.py
sort_fruits.py
py
1,147
python
en
code
0
github-code
36
34761383240
import sys, os import subprocess import datetime as dt from random import randint import argparse import web3 from web3 import Web3 from web3.middleware import geth_poa_middleware from eth_utils import decode_hex # Project modules import utils from TextColor.color import bcolors URL = "http://127.0.0.1:8545" ACCOUNT_...
acid9reen/bas
car.py
car.py
py
10,656
python
en
code
0
github-code
36
19892101650
#Why the fuck am i doing this shit t = int(input()) while(t > 0): n = int(input()) see = map(int,input().split(" ")) mods = [0,0,0] for i in see: mods[i%3] +=1 ans = min(mods[1],mods[2]) mods[1] -= ans mods[2] -= ans #print(mods[1]) #print(mods[2]) print(ans + mods[0] +mods[2]//3 + mods[1]//3) t-=1
af-orozcog/competitiveProgramming
CodeForces/div3/1176B.py
1176B.py
py
313
python
en
code
0
github-code
36
17582018412
import sys import typing as t import importlib from pathlib import Path import pkg_resources from starwhale.utils import console from starwhale.utils.venv import ( guess_current_py_env, get_user_python_sys_paths, check_python_interpreter_consistency, ) def import_object( workdir: t.Union[Path, str],...
star-whale/starwhale
client/starwhale/utils/load.py
load.py
py
1,988
python
en
code
171
github-code
36
38666222212
from __future__ import absolute_import import logging import string from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED import re # py2 vs py3 transition from ..six import text_type as unicode from ..six import string_types as basestring from ..six import ensure_binary from io import BytesIO ## XML isn't as forgivi...
JimmXinu/FanFicFare
fanficfare/writers/writer_epub.py
writer_epub.py
py
39,444
python
en
code
664
github-code
36
35564937510
# iseseisev harjutus 1 # Kristofer Andres # 08.03.2022 print("tere, maailm!") aasta = 2020 liblikas = "teelehemosaiikliblikas" lause_keskosa = ". aasta liblikas on " lause = str(aasta)+lause_keskosa+liblikas print(lause) kõrgus = float(input("sisesta pilve kõrgus kilomeetrites: ")) if kõrgus >= 6: ...
kristoferandres/iseseisvad_ylesanded
iseseisev 1.py
iseseisev 1.py
py
738
python
et
code
0
github-code
36
27688638873
"""Config file and logging related utility functions.""" import configparser import json import os import sys from pprint import pprint import yaml def read_cfg(location, verbose=True): """ Read config file at location using ConfigParser. Parameters ---------- location : str Where the con...
seankmartin/PythonUtils
skm_pyutils/config.py
config.py
py
5,936
python
en
code
1
github-code
36
7168853562
import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc import dash from app import app from app import server from apps.gas_monitoring import gas_app navBar = dbc.NavbarSimple( children=[ dbc.NavItem(dbc.NavLink("Home", href="/")), d...
muntakim1/gas-oil-plant-monitoring
index.py
index.py
py
2,435
python
en
code
0
github-code
36
20026440341
from . import utils import time from .monitor import PostgresMonitor __all__ = ['QuerySet', 'query', 'update', 'insert'] key = str(time.time()) async def query(sql): return await PostgresMonitor.fetch(sql) async def update(sql): return await PostgresMonitor.fetch(sql) async def insert(sql): return a...
RyanKung/jirachi
jirachi/io/postgres/queryset.py
queryset.py
py
11,228
python
en
code
3
github-code
36
4860489339
def chefWar(h,p): while not p <= 0 or not h <= 0: if p > 0 and h <= 0: return 1 if p <= 0 and h > 0: return 0 else: h -= p p /= 2 return h,p t = int(input()) for _ in range(t): h, p = map(int, input().split()) print(chefWar(h,p))
nitesh16s/DS-Algo-Problems
CodeChef/August-Cookoff/chefwars.py
chefwars.py
py
252
python
en
code
0
github-code
36
31246785423
import pandas as pd import scipy.stats as stats import operator import numpy as np from time import sleep as sl import argparse from sklearn.metrics import pairwise_distances,pairwise_distances_chunked from sklearn.cluster import AgglomerativeClustering,DBSCAN import time from datetime import timedelta import...
Adalijuanluo/MGTSEnT
MGTSEnT_MGT9_singlelinkagecluster.py
MGTSEnT_MGT9_singlelinkagecluster.py
py
24,576
python
en
code
0
github-code
36
37391277878
# Take a sample of ten phishing emails (or any text files) and find the most common words in them. # Using Shakespeare's Hamlet as a sample, find the most common words in the sample. text="" for i in range(10): with open("./Files/Hamlet/"+str(i)) as f: text += f.read() count = {} for word in text.split()...
IAteNoodles-Linux/CS_Term2
Common.py
Common.py
py
475
python
en
code
0
github-code
36
20890209940
import os import glob import pickle import logging import argparse from multiprocessing import Pool import numpy as np import pandas as pd from core.utils import timer, do_job # PATH DATA_PATH = os.getenv("DATA_PATH") PREPROCESSED_DATA_PATH = os.getenv("PREPROCESSED_DATA_PATH") TXT_DATA_NAME = os.getenv("TXT_DATA_NA...
GENZITSU/DynamicWordEmbedding
main.py
main.py
py
3,016
python
en
code
1
github-code
36
8444330611
from tokenize import TokenInfo, DEDENT from bones.bones_tree import BonesNode from bones.token_parser import parse from bones.tests.conftest import tokens_from_string from bones.suppressors.known_mutants import FUNCTION def test_module_tokens_are_put_in_root_node(): given = tokens_from_string('''\ from somewher...
dougroyal/bones-testing
bones/tests/test_token_parser_returned_tokens.py
test_token_parser_returned_tokens.py
py
4,464
python
en
code
1
github-code
36
3323022532
# -*- coding: utf-8 -*- import psycopg2 # the module that connects to the database """ The task is to create a reporting tool that prints out reports (in plain text) based on the data in the database. 1.What are the most popular three articles of all time? Which articles have been accessed the most? Present this in...
laurafang/-logs_ana
log_ana.py
log_ana.py
py
2,577
python
en
code
0
github-code
36
30934317618
#!/usr/bin/python3 # USE THIS WHEN IN NOTEBOOK -> %python # CHANGE ACCORDINGLY: the field XXX import sys import time from azure.identity import ClientSecretCredential from azure.storage.filedatalake import DataLakeServiceClient,FileSystemClient ACCOUNT_NAME = "XXX" FILE_SYSTEM = "XXX" TARGET_DIR = "XXX" def set_p...
eosantigen/devops-tools
apps/python/azure/azure_datalake_set_acl.py
azure_datalake_set_acl.py
py
2,087
python
en
code
0
github-code
36
8809253230
def main(): # Getting input from the user. (1-8 only) height = get_height_int() # Pyramid for row in range(height): # Left section of the pyramid. for col in range(height - row): print(" ", end="") for hash in range(height - col): print("#", e...
astimajo/CS50
mario.py
mario.py
py
745
python
en
code
1
github-code
36
74298299622
#!/usr/bin/env python #encoding=utf8 from json import dumps def get_node(tree, name): if tree.label == name: return True, [tree.label] if not tree.children: return False, None for child in tree.children: found, addr = get_node(child, name) if found: return True...
xiaket/exercism
python/pov/pov.py
pov.py
py
2,553
python
en
code
0
github-code
36
22226405639
import pandas as pd import argparse from gtfparse import read_gtf parser = argparse.ArgumentParser() parser.add_argument('--phenotype', type=str, required=True) # parser.add_argument('--ncRNA', type=str, required=True) if __name__ == '__main__': args = parser.parse_args() phenotype = args.phenotype ...
bfairkun/ChromatinSplicingQTLs
code/scripts/NonCodingRNA/GetNonCodingRNAFromFeatureCounts.py
GetNonCodingRNAFromFeatureCounts.py
py
1,685
python
en
code
0
github-code
36
20824479856
import dlib from imutils import face_utils dlib_path = "dlibb/shape_predictor_68_face_landmarks.dat" detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor(dlib_path) import argparse import pickle import cv2 import os import mpmath import numpy as np # face_classifier = cv2.CascadeClassifier('ha...
Hassan1175/MY_FYP_CODE
MY_CODE/videoframes.py
videoframes.py
py
3,060
python
en
code
0
github-code
36
4108037157
candies, multiple = [int(x) for x in input().split()] primes = [True for i in range(candies + 1)] primes[0] = False primes[1] = False combos = 0 for p in range(2, candies + 1): if primes[p]: combos += (candies - p) // multiple + 1 combos += (candies - p - 1) // multiple + 1 for i in range(p...
AAZZAZRON/DMOJ-Solutions
dmopc15c1p4.py
dmopc15c1p4.py
py
403
python
en
code
1
github-code
36
9911287046
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Custom filters for use in openshift_aws ''' from ansible import errors class FilterModule(object): ''' Custom ansible filters for use by openshift_aws role''' @staticmethod def scale_groups_serial(scale_group_info, upgrade=False): ''' This function w...
barkbay/openshift-ansible-gravitee
roles/lib_utils/filter_plugins/openshift_aws_filters.py
openshift_aws_filters.py
py
2,484
python
en
code
1
github-code
36
11605675003
PHANTOM_SYS_INFO_URL = "{url}rest/system_info" PHANTOM_ASSET_INFO_URL = "{url}rest/asset/{asset_id}" URL_GET_CODE = 'https://login.salesforce.com/services/oauth2/authorize' URL_GET_TOKEN = 'https://login.salesforce.com/services/oauth2/token' URL_GET_CODE_TEST = 'https://test.salesforce.com/services/oauth2/authorize'...
splunk-soar-connectors/salesforce
salesforce_consts.py
salesforce_consts.py
py
1,518
python
en
code
0
github-code
36
35866803773
import re from datetime import date from typing import Optional import docx # type: ignore from adaptive_hockey_federation.parser.user_card import BaseUserInfo NAME = '[И|и][М|м][Я|я]' SURNAME = '[Ф|ф][А|а][М|м][И|и][Л|л][И|и][Я|я]' PATRONYMIC = '[О|о][Т|т]?[Ч|ч][Е|е][С|с][Т|т][В|в][О|о]' DATE_OF_BIRTH = '[Д|д][А|а...
Studio-Yandex-Practicum/adaptive_hockey_federation
adaptive_hockey_federation/parser/docx_parser.py
docx_parser.py
py
12,958
python
ru
code
2
github-code
36
34696045892
import os import yaml import openai """ 使用openai API的方式访问ChatGPT/azure GPT """ def set_env(cfg_file): with open(cfg_file) as f: config_data = yaml.safe_load(f) azure = config_data["azure"] if azure is not None: for k, v in azure.items(): os.environ[k] = v os....
zzfengxia/python3-learn
dailytool/connect_openai_api.py
connect_openai_api.py
py
1,851
python
en
code
0
github-code
36
74249579945
"""" Controls EC2 Services """ import boto3 import logging import os """ Ec2 controller: finds ec2 instances that have a devday tag, has the ability to stop, start and to modify their shutdown behaviour - to avoid termination """ class ec2Controller: STOPBEHAVIOUR = 'stop' def __init__(self, region, searchT...
evoraglobal/SleepSaver
ec2Controller.py
ec2Controller.py
py
7,948
python
en
code
0
github-code
36
19665531020
from puzzle_input import get_puzzle_input strategy = get_puzzle_input(2) def play_rock_paper_scissor(strategy): points_one = 0 points_two = 0 elves_hands = {"A": 1, "B": 2, "C": 3} your_hands = {"X": 1, "Y": 2, "Z": 3} for game in strategy: play = game.strip().split(" ") elf, you ...
jonnaliesel/advent-of-code
2022/day_2.py
day_2.py
py
1,329
python
en
code
0
github-code
36
73387268903
''' 5) Desenvolver um programa que pergunte 4 notas escolares de um aluno e exiba mensagem informando que o aluno foi aprovado se a média escolar for maior ou igual a 5. Se o aluno não foi aprovado, indicar uma mensagem informando essa condição. Apresentar junto com a mensagem de aprovação ou reprovação o valor da médi...
nthancdc/progDecisao
lista041/questao5.py
questao5.py
py
843
python
pt
code
0
github-code
36
72549467305
#!/usr/bin/env python3 # Purpose: Scale the coordinates of the Aya in the Quran images with a factor. # Author: Abdallah Abdelazim # Features: # - Scale the coordinates of the Aya in the Quran images with a factor. # - The input CSV file 'data.csv' is expected to be in the same folder as this script. # - The output CSV...
QuranHub/quran-images-utils
csv_data_scale/scale_csv.py
scale_csv.py
py
1,493
python
en
code
3
github-code
36
14178436834
import time import random ''' Simple implementation of UUIDv8 with 60 bit Timestamp Usage Based on https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html first with some changes in clock secuence part. Later based on https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html...
ningauble/uuid8
uuid.py
uuid.py
py
1,413
python
en
code
0
github-code
36
23747778179
""" Khinshan Khan - cli.py. This module contains all command line interaction with user. """ import sys def prompt(message): """Print optional message and wait for user input.""" if message: print(message) return input(">> ").strip() def input_monad(message): """Listen for user events and a...
shan-memery/mcm-oss
mcm_oss/cli.py
cli.py
py
2,015
python
en
code
0
github-code
36
1540076990
''' Implementation of Sieve Of Eratosthenes: Time Complexity: O(N Log(Log N)) Space Complexity: O(N) ''' def sieve(n): if n <= 1: return None from math import sqrt numbers = [True for i in range(n+1)] primes = [] numbers[0] = False; numbers[1] = False # Since the numbers 0 and 1 are not considered as Prime. fo...
puneeth1999/progamming-dsa-with-python
Week-2/AdditionalResouces/#2_0_sieveOfEratosthenes.py
#2_0_sieveOfEratosthenes.py
py
771
python
en
code
2
github-code
36
37298965152
import time import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) import json from pymongo import MongoClient i = 0 client = MongoClient('localhost',27017) db=client.comment collection=db.comment collection2=db.after def sentiment_classify(data): access_token='' http=urllib3.PoolM...
LogicJake/data_analysis
classfy/label.py
label.py
py
1,396
python
en
code
2
github-code
36
17849746047
from .data_metabolite_to_standard_name_dict import data_metabolite_to_standard_name_dict from ..complete_dataset_class import CompleteDataset, natural_distribution_anti_correction, check_negative_data_array from scripts.src.common.config import DataType, Direct, Keywords as CommonKeywords from ..common_functions import...
LocasaleLab/Automated-MFA-2023
scripts/data/renal_carcinoma/specific_data_parameters.py
specific_data_parameters.py
py
5,412
python
en
code
0
github-code
36
28198353586
""" FLUX: OPTIMUM RANGE =================== """ from math import isclose from pathlib import Path from typing import Literal import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import pandas as pd from matplotlib.legend_handler import HandlerTuple from pandas import DataFrame fr...
holukas/diive
diive/pkgs/analyses/optimumrange.py
optimumrange.py
py
18,102
python
en
code
0
github-code
36
27239543439
# from django.shortcuts import render from django.views.generic import ListView, DetailView, UpdateView, CreateView, DeleteView # импортируем класс, который говорит нам о том, что в этом представлении мы будем выводить список объектов из БД from .models import Post from datetime import datetime from .filters import Po...
pvlrmv/newspaper
NewsPaper/news/views.py
views.py
py
4,311
python
ru
code
0
github-code
36
22355735455
import pytest import mlrun.common.schemas import mlrun.runtimes def test_enum_yaml_dump(): function = mlrun.new_function("function-name", kind="job") function.status.state = mlrun.common.schemas.FunctionState.ready print(function.to_yaml()) @pytest.mark.parametrize( "exclude_params,expected_result,...
mlrun/mlrun
tests/test_model.py
test_model.py
py
2,821
python
en
code
1,129
github-code
36
35146672008
import matplotlib.pyplot as plt import numpy as np fil = open("Breakout_step_RL") ret_RL = [] for line in fil: x = float(line) if(x==-10): x=0 ret_RL.append(x) fil.close() # fil = open("breakout_aveReturn") # ret_MT = [] # for line in fil: # ret_MT.append(float(line)) # fil.close() # fil = op...
sidistic/Atari-Breakout-Reinforcement-Learning
graph.py
graph.py
py
581
python
en
code
0
github-code
36
31025430607
import numpy as np import cv2 import faceTools import moodTools from PIL import Image emojis_data = { 'angry': cv2.imread("./data/emojis/Angry.png"), 'disgust': cv2.imread("./data/emojis/Poisoned.png"), 'fear': cv2.imread("./data/emojis/Fearful.png"), 'happy': cv2.imread("./data/emojis/Happy.png"), ...
CVandermies/Facelook
main.py
main.py
py
2,121
python
en
code
0
github-code
36
24752052108
import os from sqlalchemy import ( Column, MetaData, String, Integer, Float, Table, Text, ForeignKey, create_engine, select ) from domain.repositories import RepositoryInterface metadata = MetaData() users_table = Table( 'user', metadata, Column('userId', Integer, primary_key...
armyost/hexagonalSampleV2
src/app/infrastructure/adapters/mysql_adapter.py
mysql_adapter.py
py
2,513
python
en
code
0
github-code
36
36086044311
#1 for number in range (1,26): print(number**2) #2 y=() while(y!="haha"): y=input("Write 'It's a Loop: ") #3 positive=float(input()) while(positive>0): positive-=0.5 print(positive) #4 a=() while(a!="no"): a=input("Do you want to continue? ") print("This is the end") #Level 1 Loops #1 for i in range(3)...
chrblsm/CS1-Lab
lab 17Feb,19Feb.py
lab 17Feb,19Feb.py
py
907
python
en
code
3
github-code
36
18586892058
import numpy import scipy.interpolate import scipy.optimize import scipy.stats # Columns of csv input file incols = ['name','Vinoc','dilmin','dilfac','ntot','ninf','comments'] # Columns added to csv output file outcols = ['mode','68lb','68ub','95lb','95ub','RM','SK'] # label/header for assay parameters label = { #...
cbeauc/midSIN
src/__init__.py
__init__.py
py
6,705
python
en
code
4
github-code
36
24399113
import plotly.graph_objects as go from plotly.subplots import make_subplots import numpy as np import maths def mass_flow_funnel(mass_flows,moisture_content): fig = go.Figure(go.Funnelarea( # textinfo = [str(round(mass_flows[0],2))+" kg/h <br>Before Drying",str(round(mass_flows[1],2))+" kg/h <br>After Dry...
drpsantos/torr
210921/charts.py
charts.py
py
2,905
python
en
code
0
github-code
36
26469617014
from ....key import Address from ....hint import MBC_USER_STATISTICS, MBC_VOTING_CANDIDATE from ....common import Int, MitumFactor, _hint, concatBytes class Candidate(MitumFactor): def __init__(self, address, nickname, manifest, count): assert len(manifest) <= 100, 'manifest length is over 100! (len(manif...
ProtoconNet/mitum-py-util
src/mitumc/operation/document/blockcity/base.py
base.py
py
2,222
python
en
code
2
github-code
36
21626075739
from datetime import datetime import os def capture_pic(driver): pt = datetime.now().strftime('%Y%m%m%H%M%S') base_path = os.path.dirname(os.getcwd()) pic_name = os.path.join(base_path, 'picture', pt+'.png') driver.get_screenshot_as_file(pic_name)
litongtongx/test
common/picCapture.py
picCapture.py
py
268
python
en
code
0
github-code
36
19221455150
'''FINAL DRAFT OF CALC?''' from tkinter import * from tkinter import font as tkFont import math as m root = Tk() root.title("SIMPLE CALCULATOR") #rootlabel = Label(root, text="CALCULATOR", bg='gray3', fg = 'snow', font=("Times", 10, 'bold')) #rootlabel.grid(row = 0,column = 2) #root.geometry("538x540") root....
Adarsh-Liju/COOL-STUFF
python_progs/CALC_FINAL.py
CALC_FINAL.py
py
5,842
python
en
code
1
github-code
36
6842050847
import cv2 import numpy as np import re from tqdm import tqdm import os import random from PIL import Image, ImageEnhance def augment(image): def transform(): return random.choice([0,1,2]) # every image has to flip transform_seed = transform() if transform_seed == 0: i...
czkat/real-time-ship-classification-by-resnet-transfer-learning-with-original-dataset
augment.py
augment.py
py
2,111
python
en
code
0
github-code
36
10663868437
# -*- coding: utf-8 -*- """ Created on Fri Oct 14 10:36:34 2016 @author: Neo cp the figure ../plot/ into ../NLiu2016/ """ import os ## figure names in ../plot/ l1 = ['Observation_span.eps', \ 'Number_of_session.eps', \ 'Observation_history.eps', \ 'DEV_plot.eps', \ 'LinearDri...
Niu-Liu/thesis-materials
sou-selection/progs/FiguresCopy.py
FiguresCopy.py
py
1,918
python
en
code
0
github-code
36
10579079643
def open_file(filepath): with open(filepath) as fl: return fl.read() def count_words(contents): return len(contents.split()) def count_letters(contents): lower_content = contents.lower() letter_dict = {} for l in lower_content: if l in letter_dict: letter_dict[l] += 1...
winterbear2077/pythonLearn
main.py
main.py
py
1,052
python
en
code
0
github-code
36
30522922561
################################ # mission_five.py ################################ import math import time from pybricks.ev3devices import * from pybricks.parameters import * from pybricks.robotics import * from pybricks.iodevices import * from pybricks.tools import wait from pybricks.hubs import EV3Brick from robot_...
fll-18300/fall_2023
mission_five.py
mission_five.py
py
1,819
python
en
code
0
github-code
36
11162728846
# # Hardware: # A USB C / PIC32 Breakout Board connected to an SSD1306-based OLED display # (128x64 pixels) and an M5Stack joystick, both via I2C. # # Purpose: # Illustrates the I2C Master functionality to manipulate two I2C Slaves for # the purposes of the Kickstarter demo. # from usb_device import UsbDevice from ups...
lophtware/UsbCPic32Breakout
src/examples/pong/python/pong.py
pong.py
py
2,980
python
en
code
2
github-code
36
38844598957
import re f = open("customers.txt", "rt") customers = {} for line in f.readlines(): m_name = re.search('[A-Za-z ]+', line) if m_name is None: continue name = m_name.group(0).strip() if len(name) == 0: continue m_mobile = re.search(r'\d+', line) if m_mobile is None: co...
srikanthpragada/PYTHON_04_APR_2022
demo/libdemo/list_customers.py
list_customers.py
py
481
python
en
code
0
github-code
36