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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
15151197802 | def sol(n, q):
answer = []
ip = [0] * n
temp = []
m = {}
for i in q:
temp.append(i.split())
for i in temp:
print()
print('ip : ', ip)
if i[1] == 'request':
if 0 in ip:
if i[0][7] not in m :
idx = ip.index(0)
... | denmark-dangnagui/programmers | ipipip.py | ipipip.py | py | 1,629 | python | en | code | 0 | github-code | 6 |
21792958512 | import cv2
import pytesseract
from wand.image import Image
from PyPDF2 import PdfFileReader
def ocr(image_path):
# Чтение изображения
image = cv2.imread(image_path)
# Преобразование изображения в оттенки серого
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Применение алгоритма бинаризаци... | Vlad-Goncharov/info_file_detection | main.py | main.py | py | 1,618 | python | ru | code | 0 | github-code | 6 |
27550279361 | import random
import urllib.request
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
res = openai.Image.create_variation(
image=open("838.png", "rb"), # kindly replace "838.png" with an image on your local computer
n=2, # no of variations to generate
size="1024x1024",
response_for... | Afeez1131/openAI-image-generation | image_variations.py | image_variations.py | py | 910 | python | en | code | 0 | github-code | 6 |
43243534987 | from taxi import Taxi
from silver_taxi import SilverTaxi
TAXIS= [Taxi("Prius",100),SilverTaxi("Limo",100,2),SilverTaxi("Hummer",200,4)]
def get_menu_option ():
option = input("q)uit, c)hoose taxi, d)rive\n>>>")
while option not in ['q','c','d']:
print ("ERROR - Invalid input")
option = input("... | StephenOhl/practicals | prac_07/taxi_simulator.py | taxi_simulator.py | py | 1,520 | python | en | code | 0 | github-code | 6 |
52757732 | from zohocrmsdk.src.com.zoho.api.authenticator import OAuthToken
from zohocrmsdk.src.com.zoho.crm.api import Initializer
from zohocrmsdk.src.com.zoho.crm.api.bulk_write import BulkWriteOperations, RequestWrapper, CallBack, Resource, \
FieldMapping, SuccessResponse, APIException
from zohocrmsdk.src.com.zoho.crm.api.... | zoho/zohocrm-python-sdk-5.0 | samples/bulk_write/CreateBulkWriteJob.py | CreateBulkWriteJob.py | py | 5,934 | python | en | code | 0 | github-code | 6 |
3864065470 | from collections import OrderedDict
""" https://www.scribbr.fr/elements-linguistiques/determinant/
Le déterminant permet de présenter le nom.
Il le précède et compose avec lui le groupe nominal.
Un adjectif ou un autre déterminant peuvent se placer entre le déterminant et le nom.
"""
déterminants = OrderedDict({
"... | Fushy/PythonLib | Francais.py | Francais.py | py | 1,495 | python | fr | code | 0 | github-code | 6 |
9180027330 | import argparse
import base64
try:
from http.server import BaseHTTPRequestHandler
except ImportError:
# Python 2.x compatibility hack.
from BaseHTTPServer import BaseHTTPRequestHandler
import os
import os.path
try:
from socketserver import TCPServer
if os.name != 'nt':
from socketserver import UnixStreamS... | bazelbuild/bazel | src/test/shell/bazel/testing_server.py | testing_server.py | py | 3,746 | python | en | code | 21,632 | github-code | 6 |
25228010428 | import numpy as np
import cv2 as cv
from tkinter import *
from tkinter.filedialog import *
#button1 = Button(window,text="Upload",fg="black",bg="gray",command=upload).pack()
img = []
class eye:
def __init__(self,master):
frame = Frame(master)
frame.pack()
button1 = Button(frame,text="Upload... | gods-mack/face-Detection_project | eye.py | eye.py | py | 1,816 | python | en | code | 5 | github-code | 6 |
38254722790 | from django.shortcuts import render
from django.contrib.auth.models import User
from hknweb.utils import login_and_permission
from hknweb.candidate.utils_candportal import CandidatePortalData
@login_and_permission("candidate.change_offchallenge")
def summary(request):
cands = User.objects.filter(groups__name="ca... | Gabe-Mitnick/hknweb | hknweb/candidate/views/summary.py | summary.py | py | 1,635 | python | en | code | null | github-code | 6 |
9259374186 | from pca import PCA
import numpy as np
import matplotlib.pyplot as plt
from skimage.transform import resize
import scipy.io as scio
from kmeans import KMeans
mat = scio.loadmat('./ExtYaleB10.mat')
Y_test = mat['test']
Y_train = mat['train']
def imageResizing(data):
resizedDatasET = []
for img in data:
... | nancyagrwal/Machine-Learning | Feed FOrward NN/testG.py | testG.py | py | 1,799 | python | en | code | 0 | github-code | 6 |
21992599596 | import collections
import numpy as np
from scipy.signal import butter
class ButterFilter(object):
""" Implements butterworth low-pass filter.
Based on https://github.com/google-research/motion_imitation/blob/master/motion_imitation/robots/action_filter.py
"""
def __init__(self, sampling_rate, action_... | bit-bots/deep_quintic | deep_quintic/butter_filter.py | butter_filter.py | py | 2,574 | python | en | code | 0 | github-code | 6 |
73706490427 | """Image tools interfaces."""
from nilearn.image import resample_to_img
import numpy as np
import nibabel as nb
from nipype.utils.filemanip import fname_presuffix
from nipype import logging
from nipype.interfaces.base import (traits, TraitedSpec,
BaseInterfaceInputSpec, SimpleInterfa... | jerdra/TIGR_PURR | bin/resample.py | resample.py | py | 2,104 | python | en | code | 0 | github-code | 6 |
14369080297 | from .models import lab_models
from .LocalData import DeviceNames, RecordNames
# PVs not connecting to real machine:
# ===================================
# LI-01:TI-EGun:Enbl-SP
# LI-01:TI-EGun:Enbl-RB
# LI-01:TI-EGun:Delay-SP
# LI-01:TI-EGun:Delay-RB
model = lab_models.li
_el_names = { # All these Family names mu... | lnls-fac/va | va/pvs/li.py | li.py | py | 2,849 | python | en | code | 3 | github-code | 6 |
38877350300 | import time
def set_timer():
hours = int(input('hours: '))
minutes = int(input('minutes: '))
seconds = int(input('seconds: '))
total = seconds + minutes*60 + hours*3600
for i in range(total, 0, -1):
print(f'{i//3600}:{i//60%60}:{i%60}')
time.sleep(1)
set_timer()
| GeorgeGalaxy/ML-Univ-2022-23 | Modules/Python/Practice 1/task 4.py | task 4.py | py | 304 | python | en | code | 0 | github-code | 6 |
17378765276 | import cv2
import numpy as np
import argparse
import os
from PIL import Image
import matplotlib.pyplot as plt
from scipy.ndimage.filters import gaussian_filter
# condition1dls pixel 검은색 확인
def pixel_is_black(arr,x,y):
if arr[x,y] ==1:
return True
return False
#condtion2 2개에서 6개의 검은 픽셀 가짐?
def pixe... | Leegunmin/RecognizeKorean | zaung_shen.py | zaung_shen.py | py | 5,571 | python | en | code | 0 | github-code | 6 |
30948435378 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Nomes: no. USP:
# Bruno Guilherme Ricci Lucas 4460596
# Lucas Hiroshi Hayashida 7557630
# Ricardo Mikio Morita 5412562
#
import sys
sys.path.append('lib/') #para poder ler as funcoes de ... | ricardomorita42/mac0322 | ep2/ep2.py | ep2.py | py | 5,015 | python | pt | code | 0 | github-code | 6 |
7168891866 | x = int(input('Birinci Sayı: '))
y = int(input('İkinci Sayı: '))
if x > y:
print('x y den büyük')
elif x == y:
print('x y eşit')
else:
print('y x den büyük')
num = int(input('sayı: '))
if num > 0:
print('sayı pozitif')
elif num < 0:
print('sayı negatif')
else:
print('sıfıra e... | Hayruun/Python-If-Statement | if-elif.py | if-elif.py | py | 339 | python | tr | code | 0 | github-code | 6 |
28672716901 | from trello import TrelloClient, util
from atlassian import Confluence
from os import listdir, path
import pystache
import datetime
import json
from traceback import print_exc
from time import sleep
from re import sub
try:
keys = {}
if path.exists('.keys'):
with open('.keys') as f:
... | iain-neirfeno/trello-to-confluence | create_confluence_page.py | create_confluence_page.py | py | 6,643 | python | en | code | 0 | github-code | 6 |
14162889179 | import pyaudio
import wave
import pydub
import numpy as np
import os
import threading
import random
import time
import sys
freq = 60 #60秒おきに集中力を計算
excert_range = 5 #その5倍の時間の姿勢データを計算に使う
global position
position = [4] * freq*excert_range #####集中力を計算するために姿勢を格納する配列(最初は非集中なので姿勢4を入れてる)
def get_position_seq():
global po... | agridrama/system-project-1 | volume_control.py | volume_control.py | py | 6,822 | python | ja | code | 0 | github-code | 6 |
73036280829 | import pandas as pd
from numpy.random import RandomState
from sklearn import preprocessing
# Read Data
data = pd.read_csv("/Users/yazen/Desktop/datasets/PimaDiabetes/pima.csv")
# Label columns
data.columns = ["pregnancy", "plasma/glucose concentration", "blood pressure","tricep skin fold thickness", "serum insulin", ... | yazsh/PimaDiabetesPrediction | PimaDataCleaning.py | PimaDataCleaning.py | py | 1,208 | python | en | code | 0 | github-code | 6 |
32402735389 | #!/usr/bin/env python
# coding: utf-8
#Project Information
# We will create a classifier that can distinguish spam (junk or commercial or bulk) emails from ham (non-spam) emails.
# Spam/Ham Classification
# EDA, Feature Engineering, Classifier
# Dataset Information
# In email classification, our goal is to classify e... | muskaangoyal/data-science-portfolio | spam-ham-master/proj.py | proj.py | py | 19,773 | python | en | code | 0 | github-code | 6 |
21251031112 | # cmd to run this script -> functions-framework --target hello_world
def hello_world(request):
"""
Purpose: request
"""
req_args = request.args
req_json = request.get_json(silent=True)
# name = req_args['name'] if req_args and 'name' in req_args else "world"
if req_args and 'name' in req_... | Manju2012/gcp-cloud-functions | 1. HelloWorld/main.py | main.py | py | 686 | python | en | code | 0 | github-code | 6 |
16376172760 | """ Basic commands and practice of Selenium library."""
import os
import time
from dotenv import load_dotenv
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
load_dotenv()
chrome_driver_path = os.environ.get("DRIVER_PATH")
driver = webdriver.Chrome(executable_path=chrome_driver_path)
#... | FstRms/selenium-basics | example_automation.py | example_automation.py | py | 1,316 | python | en | code | 1 | github-code | 6 |
29205882969 | import subprocess
import time
import os
import math
from PIL import Image
import psutil
import re
from skyfield.api import Star
import numpy as np
import threading
import select
from pathlib import Path
import fitsio
import Nexus
import Coordinates
import Display
home_path = str(Path.home())
version = "21_7"
#os.syste... | WimDeMeester/eFinder | eFinder.py | eFinder.py | py | 20,522 | python | en | code | 0 | github-code | 6 |
34407258832 | import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv3d(in_channels=1, out_channels=64,
kernel_size=(3, 5, 5), stride=(1, 1, 1), bias=False)
self.max1 = nn.Max... | kishanbala/BrainLesionSegmentation | cmb_3dcnn/build_screening_stage.py | build_screening_stage.py | py | 2,008 | python | en | code | 1 | github-code | 6 |
36740726228 | import unittest
from to_penetrate_armor import compute_to_penetrate_armor_probability
ARMOR_SAVES = {
'2+' : 1.0/6.0,
'3+' : 2.0/6.0,
'4+' : 3.0/6.0,
'5+' : 4.0/6.0,
'6+' : 5.0/6.0,
'7+' : 1.0
}
TEST_AP = [0, -1, -2, -3, -4]
def compute_save_difference(current_save, penetration):
save = i... | jmcq89/weapon_comparator | weapon_comparator/tests/test_to_penetrate_armor.py | test_to_penetrate_armor.py | py | 1,309 | python | en | code | 0 | github-code | 6 |
2235060581 | import xml.etree.ElementTree as ET
import subprocess
import os
import glob
import time
def clonerep(url):
name = url.split("/")[-1].split(".")[0]
os.system("git"+ " clone " + "https://github.com/" + url + " repos/" + name + "/" )
def insertIntoPom(repdir):
# ET.register_namespace("", "http://maven.apache... | tyheise/402-Course-Project | codecov.py | codecov.py | py | 6,907 | python | en | code | 0 | github-code | 6 |
37048825490 | #!/usr/bin/env python
# coding: utf-8
import itertools
import os
import re
from io import open
import yaml
from jinja2 import Template
HERE = os.path.abspath(os.path.dirname(__file__))
def read(fname):
with open(os.path.join(HERE, "..", fname), "r") as fd:
return fd.read()
def write(content, fname):
... | itsolutionsfactory/dbcut | scripts/generate-ci-pipelines.py | generate-ci-pipelines.py | py | 1,469 | python | en | code | 20 | github-code | 6 |
37126840757 | import matplotlib.pyplot as plt
import numpy as np
import time
def plot_voxel(voxels, filename):
start = time.time()
colors = np.where(voxels, "blue", "red")
fig = plt.figure()
ax = fig.gca(projection='3d')
template = np.ones(voxels.shape, dtype=object)
ax.voxels(template, facecolors=... | born9507/Prediction-of-E-using-CNN | src/data/plot.py | plot.py | py | 782 | python | en | code | 1 | github-code | 6 |
35616591437 | # https://adventofcode.com/2022/day/22
from collections import defaultdict
from aoctk.data import Graph, Unbound2DGrid
from aoctk.input import get_groups
def parse(data):
ps, (ins,) = get_groups(data)
m = Unbound2DGrid(
(
(complex(j, i), c)
for i, r in enumerate(ps)
... | P403n1x87/aoc | 2022/22/code.py | code.py | py | 3,157 | python | en | code | 2 | github-code | 6 |
10010702062 | import numpy as np
import pandas as pd
from flask import Flask, request, jsonify, render_template
import pickle
app = Flask(__name__)
from keras.models import load_model
model = load_model('customer-churn\saved_model (1).pb')
# Importing the dataset
dataset = pd.read_csv('customer_churn_large_dataset.csv')
# Extractin... | meyograj/churn1 | app.py | app.py | py | 2,806 | python | en | code | 0 | github-code | 6 |
8097009121 | """
Image utility functions.
"""
import PIL.Image
import PIL.ImageChops
import numpy
def equalize(image, levels=256, grayscale=False):
"""
Equalizes an image such that the darkest pixels become black, the lightest become white, and others are based on
their percentile. If a pixel is brighter than 25% of ... | dewiniaid/sigsolve | sigsolve/imageutil.py | imageutil.py | py | 3,598 | python | en | code | 3 | github-code | 6 |
43755872386 | '''
Measures the square area of colonies in several image files and exports data as an excel sheet.
Written by George Walters-Marrah
Last updated: 6/26/2019
'''
# import needed packages
import colSizeMeasurer as cm
import numpy as np
import pandas as pd
import os.path
from os import path
import imageio... | gwmarrah/colony-measurer | colSizeAnalyzer.py | colSizeAnalyzer.py | py | 10,361 | python | en | code | 1 | github-code | 6 |
36062246358 | from django.urls import path
from .views import addtask, mark_as_done, mark_as_undone, edit, delete_task
urlpatterns = [
# adding a task
path('addtask/', addtask, name='addtask'),
# mark as done task
path('mark_as_done/<int:pk>/', mark_as_done, name='mark_as_done'),
# mark as undone task
path(... | shaikmoinuddin/todo_django | todo_app/urls.py | urls.py | py | 530 | python | en | code | 0 | github-code | 6 |
40694907934 | # coding: utf-8
from fabric.api import local, sudo, lcd, put, cd
from fabric.context_managers import settings
from fabric.contrib.files import exists
from fabric.operations import local as lrun, run
from fabric.api import task
from fabric.state import env
import os
env.user = 'adminbuy'
proj_dir = '/home/user/www... | StasEvseev/adminbuy | fabfile.py | fabfile.py | py | 6,566 | python | en | code | 0 | github-code | 6 |
8998153672 | from math import ceil
from math import floor
from math import sqrt
from model.qp import QP
from model.rlt import RLT
from model.ip import IP
from model.feas import FEAS
from model.max import MAX
from experiments import files
class Solver:
def __init__(self, m: str, d: list, filename: str):
self.m = m
... | cleberoli/mdsp | experiments/solver.py | solver.py | py | 2,410 | python | en | code | 0 | github-code | 6 |
40428611431 | #!/usr/bin/env python3
"""
Name: cluster_create_update_all.py
Description: Create/update clusters defined in ``--yaml`
"""
import argparse
from netbox_tools.common import netbox, load_yaml
from netbox_tools.cluster import Cluster
OUR_VERSION = 101
def get_parser():
"""
return an argparse parser object
""... | allenrobel/netbox-tools | scripts/cluster_create_update_all.py | cluster_create_update_all.py | py | 1,091 | python | en | code | 6 | github-code | 6 |
21367680266 | import serial
import serial.tools.list_ports as lp
class serialPort():
def __init__(self) -> None:
self.ser = serial.Serial()
self.timeout = None # specify timeout when using readline()
self.ports = lp.comports()
def connectPort(self, port_name, baudrate=115200):
sel... | PhysiologicAILab/PhysioKit | utils/devices.py | devices.py | py | 1,003 | python | en | code | 5 | github-code | 6 |
16543455717 | import ast
import fnmatch
import os
from nuitka.__past__ import iter_modules
from nuitka.importing.Importing import locateModule
from nuitka.importing.Recursion import decideRecursion
from nuitka.plugins.PluginBase import NuitkaPluginBase
from nuitka.utils.ModuleNames import ModuleName
from nuitka.utils.Utils import i... | Nuitka/Nuitka | nuitka/plugins/standard/ImplicitImports.py | ImplicitImports.py | py | 23,781 | python | en | code | 10,019 | github-code | 6 |
34038250008 | import logging
from datetime import timedelta
from aio_proxy.request.search_type import SearchType
from aio_proxy.search.es_index import StructureMapping
from aio_proxy.search.geo_search import build_es_search_geo_query
from aio_proxy.search.helpers.helpers import (
execute_and_agg_total_results_by_identifiant,
... | etalab/annuaire-entreprises-search-api | aio/aio-proxy/aio_proxy/search/es_search_runner.py | es_search_runner.py | py | 5,014 | python | en | code | 13 | github-code | 6 |
71141847227 | """
column-wise storage
[
0 1
2 3
4 5
]
"""
mat_a = [0, 2, 4, 1, 3, 5] # 3, 2
"""
[
0 1 2
3 4 5
]
"""
mat_b = [0, 3, 1, 4, 2, 5] # 2, 3
def index_translate_2d_1d(i, j, m, n):
"""
i, j: mat[i][j]
m: n_rows
n: n_cols
"""
return i+j*m
def print_matrix(m, n, x):
"""
m: n_rows
n: ... | chongxiaoc/python_matrix_mul_playground | one_dimension_array_matmul_parallel.py | one_dimension_array_matmul_parallel.py | py | 1,452 | python | en | code | 0 | github-code | 6 |
23699044088 | from datetime import date, timedelta
from bs4 import BeautifulSoup
import pandas as pd
import requests
import os
import warnings
warnings.filterwarnings('ignore')
def is_workday(day: date) -> bool:
"""Функция определяет рабочий день или выходной согласно рабочему календарю.
True - рабочий
False - выходно... | garick161/penalty_calculator | functions.py | functions.py | py | 8,809 | python | ru | code | 1 | github-code | 6 |
5726435791 | # Variables
num = 17
print(num)
print(type(num))
num2 = 2.5
print(num2)
cadl = "UIP"
print(cadl)
cadl2 = 'Panama'
print(cadl2)
cadl3 = """"Este es un ejemplo
de una cadena de varias lineas..."""
print(cadl3)
s1 = True
s1 = False
# Introduccion de datos
# nombre = input("Nombre: ")
# edad = int... | JoselynRuiz/Programacion-III | Clase 3/app/__init__.py | __init__.py | py | 895 | python | es | code | 0 | github-code | 6 |
75269781308 | from sklearn.svm import SVC
import common as c
def run(num_folds, seed, test_size, dataset_url, delimiter, _c, gamma, kernel):
try:
model = SVC(C=_c, gamma=gamma, kernel=kernel)
c.run_with_classification_model(model, num_folds, seed, test_size, dataset_url, delimiter)
except Exception as e:
... | ingridcoda/serverless-machine-learning | algorithms/classification/svm.py | svm.py | py | 335 | python | en | code | 6 | github-code | 6 |
22762975242 | import cv2
import time
import PoseModule as pm
cap = cv2.VideoCapture('Videos/14.mp4')
ok_flag = False
if cap.isOpened():
ok_flag = cap.isOpened()
else:
print("Cannot open camera")
exit()
pTime = 0
detector = pm.poseDetector()
while ok_flag:
success, img = cap.read()
# if frame is read correctly re... | GabrielaVasileva/ComputerVision | pose_estimation/PoseProject.py | PoseProject.py | py | 1,538 | python | en | code | 0 | github-code | 6 |
6155638807 | class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
#idea: each pair represents neighbors in a graph
#each node will represent a class, with each neighbor being a prerequisite (yes)
#create a map that lists the prerequistes (neighbors)
preM... | lucastemb/leetcode-solutions | 0207-course-schedule/0207-course-schedule.py | 0207-course-schedule.py | py | 1,533 | python | en | code | 0 | github-code | 6 |
73746980669 | import warnings
import time
import os
import joblib
import json
import pandas as pd
from src.training import hyper_param_tuning, test_models
from src.utils import parse_terminal_arguments, get_repr_model, dict_cartesian_product
warnings.simplefilter(action='ignore', category=FutureWarning)
#%%
start = time.... | boun-tabi/chemboost | src/runner.py | runner.py | py | 2,510 | python | en | code | 7 | github-code | 6 |
8967390830 | #!/opt/anaconda3/envs/PECANS-env/bin/python
import argparse
import os
import numpy as np
from pecans.ensembles.api import EnsembleRunner
from pecans.utilities.config import load_config_file
_mydir = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
config_file = os.path.join(_mydir, 'pecans_config.cfg')
... | ChiLi90/PECANS-PMOx | run_pecans_sims.py | run_pecans_sims.py | py | 5,605 | python | en | code | 0 | github-code | 6 |
73338806587 | import gc
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Any, ContextManager, Iterator
import pytest
from typing_extensions import Protocol, runtime_checkable
from antidote._internal import enforce_subclass_if_possible, Singleton
from antidote._internal.utils import CachedM... | Finistere/antidote | tests/internal/test_utils.py | test_utils.py | py | 2,310 | python | en | code | 88 | github-code | 6 |
70281340028 | import argparse
from pathlib import Path
import pdb
from bert_score import BERTScorer
import numpy as np
from util import read_test_data, read_generations, match_data
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--pred-path", type=str, required=True)
parser.add_a... | esteng/ambiguous_vqa | models/eval/my_bert_score.py | my_bert_score.py | py | 932 | python | en | code | 5 | github-code | 6 |
14077713022 |
from pathlib2 import Path
from lk.config import app_config
from lk.definitions import LK_ROOT
class ConfigUtil(object):
def __init__(self):
pass
@property
def local_repos_dir(self):
local_repos_dir = Path(self.user_lk_data_dir).joinpath(app_config.local_repos_dir)
return loca... | eyalev/lk | lk/utils/config_util.py | config_util.py | py | 4,260 | python | en | code | 0 | github-code | 6 |
39660616383 | from crystalbase import AtomGroup
from .graph import Graph
def cell_to_graph(cell: AtomGroup):
"""晶胞类转图类"""
g = Graph(cell.name)
for k, v, in cell.shelxt_score.items():
g.info[k] = v
for k in cell.atom_dict:
# 将晶胞中所有原子作为图的节点
atom = cell.atom_dict[k]
g.add_node(atom, loc... | jingshenSN2/CrystalTool | crystalsearch/graph/convert.py | convert.py | py | 634 | python | en | code | 1 | github-code | 6 |
34487423583 | import serial
import time
import struct
import logging as trace
import threading
class Communication(object):
data_chars = [b'!', b'"', b'#', b'$', b'%', b'&', b"'", b'(']
response_timeout = 2 #second
_handle = serial.Serial()
_error_counter = 0
_done = False
_thread = None
def __init__(se... | ccucumber/verdeta-lockin | fotonowy/komunikacja.py | komunikacja.py | py | 8,765 | python | en | code | 0 | github-code | 6 |
39732132661 | from __future__ import absolute_import, division, print_function
import math
import csv
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
import random
rows=[]
id=[]
datadir = "../../data/"
with open(datadir+"colaus1.f... | arnaud456/deep-learning-RMN-UNIL | Phenotype_sex_marine.py | Phenotype_sex_marine.py | py | 4,016 | python | en | code | 0 | github-code | 6 |
30162915076 | from django import forms
from .models import publishing
class CreateAdForm(forms.ModelForm):
class Meta:
model = publishing
fields = (
'title',
'type',
'brand',
'model',
'category',
'year',
'transmission',
'milage',
'fuel',
... | DenukaSandeepa/Avehiz-Project | publishing/forms.py | forms.py | py | 556 | python | en | code | 0 | github-code | 6 |
38473764222 | from pathlib import Path
import pickle
import pandas as pd
import numpy as np
import json
import torch
import random
import torch
from util.tasksim_args import TaskSimArgs
BASE_RESULTS_PATH = './results'
def get_full_results_dir(args: TaskSimArgs):
run_id = args.get_run_id()
if args.results_dir == None:
... | salemohamedo/tasksim | util/utils.py | utils.py | py | 1,757 | python | en | code | 1 | github-code | 6 |
8731736072 | import numpy as np
import matplotlib.pyplot as plt
a = np.array([1, 2, 3])
print(a)
plt.plot([1, 2, 3], [2, 4, 6])
plt.show()
for num in [1, 2, 3, 4]:
print(num)
def sqaure(x):
return x**2
| SMaC-3/GitProject_test | hello.py | hello.py | py | 204 | python | en | code | 0 | github-code | 6 |
25175601159 | import random
import json
import numpy as np
import torch
# Custom imports
import data
from model_eval import evaluate
class LSTM(torch.nn.Module):
def __init__(self, embedding: torch.FloatTensor):
super().__init__()
# Embedding wrapper
self.__embedding = torch.nn.Embedding.from_pretrai... | ftodoric/fer-du | lab03/rnn.py | rnn.py | py | 5,265 | python | en | code | 1 | github-code | 6 |
86667723602 | import random,os,string,json,requests
from flask_mail import Message
from flask import render_template,url_for,session,request,flash,abort
from werkzeug.utils import redirect
from werkzeug.security import generate_password_hash,check_password_hash
from projectapp import app,db
from projectapp.mymodel import Guest, Lga,... | abrajoe/project | projectapp/myroutes/user.py | user.py | py | 11,939 | python | en | code | 0 | github-code | 6 |
3630659594 | # -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
# Name: fix_haiti_file_tests.py
#
# Purpose: Testing routines in fix_haiti_file.py
#
# Author: Takashi Toyooka
#
# Created: 19/01/2021
#-----------------------------------------------------------... | acgis-toyo0005/gis4207-week02 | TakashiT/fix_haiti_file_test.py | fix_haiti_file_test.py | py | 1,819 | python | en | code | 0 | github-code | 6 |
17748417007 | from django.test import TestCase
from .forms import MakeBooking
# Create a test class for the MakeBooking form
class MakeBookingFormTest(TestCase):
# Test when the form is valid
def test_make_booking_form_is_valid(self):
form = MakeBooking(data={
'date': '2022-10-25',
'time':... | JustinFourie1993/tables | website/test_forms.py | test_forms.py | py | 1,209 | python | en | code | 0 | github-code | 6 |
20216236462 | from model.flyweight import Flyweight
from model.static.database import database
class NPCCorporationResearchField(Flyweight):
def __init__(self,corporation_id):
#prevents reinitializing
if "_inited" in self.__dict__:
return
self._inited = None
#prevents reinitializing
... | Iconik/eve-suite | src/model/static/crp/npc_corporation_research_fields.py | npc_corporation_research_fields.py | py | 646 | python | en | code | 0 | github-code | 6 |
5356434475 | import numpy as np
from scipy.spatial import distance_matrix
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
def knn_dist(d_matrix, k):
D_knn = np.zeros(d_matrix.shape)
#get the indices of the k lowest values and set these indices in D_knn to the same values as in D
... | Tobi-r9/assignment1 | isomap.py | isomap.py | py | 2,055 | python | en | code | 0 | github-code | 6 |
3502830678 | """Retreive extracts wrt. previous lexicon update cycle.
Update extracts.json and output cycle extracts as extracts-{cycle}.txt for easy inspection
Example
$ python3 get_extracts.py 4 working_folder
$ python3 get_extracts.py 4 _aroma_NOUN+ADJ
Args:
n (int): number of (CPU Threads) processes to use
w... | ryanbrate/DS_thesis | 5_Process/get_extracts.py | get_extracts.py | py | 9,761 | python | en | code | 0 | github-code | 6 |
10688264601 | import pandas as pd
import sys
DELIMITER = '\t'
# Know your data: You must know in advance the number and data types of the
# incoming columns from the SQL Engine database!
# For this script, the input expected format is:
# 0: ObsID, 1: X coordinate, 2: Y coordinate, 3: ObsGroup
colNames = ['CompanyID', 'DepartmentID... | Teradata/r-python-sto-orangebook-scripts | scripts/ex4pLoc.py | ex4pLoc.py | py | 1,827 | python | en | code | 3 | github-code | 6 |
31615009355 | #Exercício Python 075: Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre:
#A) Quantas vezes apareceu o valor 9.
#B) Em que posição foi digitado o primeiro valor 3.
#C) Quais foram os números pares.
n1 = int(input('Insira o primeiro valor: '))
n2 = int(input('Insira... | GuilhermeRibSouza/Python-Curso-em-Video | Exercicios - Python/Ex75.py | Ex75.py | py | 750 | python | pt | code | 0 | github-code | 6 |
5693104002 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import requests
city = input("City name: ")
key = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=2e535070ac9219e3c58f19ac7227c197&q='.format(city)
res = requests.get(key)
data = res.json()
print(res)
print(data)
# In[ ]:
| tkeady/Software-Engineering | weather api.py | weather api.py | py | 293 | python | en | code | 0 | github-code | 6 |
8302132425 | class Rover:
def __init__(self,photo,name,date):
self.photo = photo
self.name = name
self.date = date
class Articles:
def __init__(self,author,title,description,url,poster,time):
self.author = author
self.title = title
self.description = description
... | Jeffmusa/Python-News-Highlights | app/main/models/rover.py | rover.py | py | 392 | python | en | code | 1 | github-code | 6 |
37816260863 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 1 12:38:00 2020
@author: Sohom Chatterjee_CSE1_T25
"""
# Write a python program to print pattern.
side=int(input("Please enter any side of the sqaure: "))
print("Hollow sqaure pattern: \n")
i=0
while(i<side):
j=0
while(j<side):
if(i==0 or i... | Sohom-chatterjee2002/Python-for-Begineers | Assignment 2 -Control statements in Python/Problem 5.py | Problem 5.py | py | 471 | python | en | code | 0 | github-code | 6 |
41854725692 | from absl.testing import parameterized
import dataclasses
import tensorflow as tf
from official.core import config_definitions as cfg
from official.core import input_reader
from official.modeling import hyperparams
from official.vision.beta.dataloaders import tfds_detection_decoders
from official.vision.beta.projects.... | sek788432/Waymo-2D-Object-Detection | input/models/official/vision/beta/projects/yolo/dataloaders/yolo_detection_input_test.py | yolo_detection_input_test.py | py | 3,074 | python | en | code | 79 | github-code | 6 |
70411254267 | import logging
import re
import subprocess
import operator
import time
import os
import shutil
import glob
import sys
import resource
import signal
from odoo import models, fields, api
from odoo.tools import config, appdirs, DEFAULT_SERVER_DATETIME_FORMAT
from .tools import dashes, dt2time, uniq_list, mkdirs, local_p... | JZ10UJS/extra-addons | runbot/models/runbot_build.py | runbot_build.py | py | 27,507 | python | en | code | 15 | github-code | 6 |
14522926850 | #!/usr/bin/python3
import sys
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines(datas)
self.stream.flush()
def __getattr__(self... | bemrdo/CTF-2019 | GKSK #4/Serial Code/reverse.py | reverse.py | py | 1,777 | python | en | code | 0 | github-code | 6 |
74920129787 | from bs4 import BeautifulSoup
import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
html = """
<html><body>
<ul>
<li><a href="http://www.naver.com">naver</a></li>
<li><a href="ht... | lcy8417/Python | download2-5-3.py | download2-5-3.py | py | 994 | python | en | code | 1 | github-code | 6 |
39181088853 | #!/usr/bin/python3
def magic_calculation(a, b):
# a function that calculates a and b and returns the result.
result = 0
for i in range(1, 3):
try:
if i > a:
raise Exception("Too far")
result += (a ** b) / i
except Exception as exps:
raise... | Abubacer/alx-higher_level_programming | 0x05-python-exceptions/102-magic_calculation.py | 102-magic_calculation.py | py | 344 | python | en | code | 0 | github-code | 6 |
37628453194 | #!/usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
class OdomSubscriber():
def __init__(self, *args):
topic_name = rospy.get_param(
"~topic_name", "odom") # private to this node
self.subscriber = rospy.Subscriber(
topic_name, Odometry, self.odom_callb... | NMBURobotics/TEL211_2023 | assignment_2_snippets/thorvald_odom_sub_pkg/src/odom_subscriber.py | odom_subscriber.py | py | 635 | python | en | code | 1 | github-code | 6 |
18194693461 | from rest_framework.routers import DefaultRouter
from messaging import api_view
router = DefaultRouter()
router.register('message', api_view.MessageVewSet, base_name='message')
router.register('chat', api_view.GroupBlogViewSet, base_name='chat')
urlpatterns = [
]
urlpatterns += router.urls
| SivakumarSkr/Movieclub | messaging/api_urls.py | api_urls.py | py | 293 | python | en | code | 0 | github-code | 6 |
73939813946 |
import mira
assert mira.__file__ == '/liulab/alynch/projects/multiomics/BatchEffect/MIRA/mira/__init__.py'
from scipy import sparse
import shutil
import frankencell as fc
import scanpy as sc
from .utils import read_and_process, plot_umaps
import os
import optuna
def run_mira(dynframe, out_h5, plot_file, threads = 1)... | AllenWLynch/CODA-reproduction | disentangler/frankencell/dimred_methods/disentangler.py | disentangler.py | py | 2,566 | python | en | code | 2 | github-code | 6 |
40466793180 | #!/home/gabriel/funcam/venv/bin/python3
# ONLY TESTED ON LINUX
# To run using ./run.py [args] on your terminal (without python3)
# point the first line to some python interpreter containing the requirements
# or create a venv inside this project.
# Or delete this to use another method.
from cam import Cam
from vcam im... | biguelito/funcam | funcam.py | funcam.py | py | 1,315 | python | en | code | 0 | github-code | 6 |
35951961808 | # -*- coding: utf-8 -*-
import logging
from path import Path
logger = logging.getLogger(__name__)
def get_mipname(fastq_file):
"""Takes a demux fastq file and returns a MIP compatible fastq file
Args:
fastq_file (str): a FQP to a fastq file.
Returns (str): A MIP compatible fastq file.
"""... | Clinical-Genomics/deliver | deliver/utils/files.py | files.py | py | 2,052 | python | en | code | 1 | github-code | 6 |
26225204193 | # Unedited
instructions = list(map(int, open('day5_1.txt')))
a = instructions
i = 0
c = 1
while i < len(a):
jump = a[i]
if jump >= 3:
a[i] -= 1
else:
a[i] += 1
i += jump
c += 1
c - 1 | pirsquared/Advent-of-Code | 2017/Day05.py | Day05.py | py | 222 | python | en | code | 1 | github-code | 6 |
19780951486 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import os
import argparse
import subprocess
from glob import glob
def translatefolder(src, trg, **kw):
python = kw.get("python", "python3")
translate = kw.get("translate", "./translate/translate.py")
port = int(kw.get("port", 3035))
host = kw.get("host"... | schultet/goa | scripts/translate.py | translate.py | py | 2,582 | python | en | code | 2 | github-code | 6 |
7144517775 | # Thomas Morrison
# September 3, 2015
# Lab 2
# Sales Tax Problem
saleTax = 1.0735 # sales tax multiplier
cost = float(input("What is the cost per item?"))
amount = int(input("How many items were purchased?"))
price = (cost * amount)
lastDigit = (price*100)%10
if price >= 5 or lastDigit == 0:
print ("The price i... | tmorriso/Computer_Science | Recitations/Lab2.py | Lab2.py | py | 390 | python | en | code | 0 | github-code | 6 |
71576276027 | import os
import numpy as np
import torch
from matplotlib import pyplot as plt
from ..experiments.attention.attention import AttentionHookModule, group_by_type, interpolate, low_mem, sum_over_dim, stack_attentions
from .. import util
from ..StableDiffuser import StableDiffuser
def edit_output(activation, name):
a... | JadenFiotto-Kaufman/thesis | thesis/final/cross_attention.py | cross_attention.py | py | 3,146 | python | en | code | 0 | github-code | 6 |
36040524676 | import statistics
from ParadoxTrading.Indicator.IndicatorAbstract import IndicatorAbstract
from ParadoxTrading.Utils import DataStruct
class AdaBBands(IndicatorAbstract):
def __init__(
self, _period: int, _use_key: str,
_init_n: int = 20, _min_n: int = 20, _max_n: int = 60,
_r... | ppaanngggg/ParadoxTrading | ParadoxTrading/Indicator/General/AdaBBands.py | AdaBBands.py | py | 1,870 | python | en | code | 51 | github-code | 6 |
41942395480 | import os
path = "" # Folder where sorted cloud images are stored
# map clouds
clouds = os.listdir(path)
cloud_map = {}
for cloud_type in clouds:
try:
cloud_files = os.listdir(os.path.join(path, cloud_type))
#print(cloud_type)
for photo in cloud_files:
# Add the photo name to ... | Team-Octans-AstroPi/climateCSVgenerator | getcloudinfo.py | getcloudinfo.py | py | 972 | python | en | code | 0 | github-code | 6 |
30807250723 | ##This is the homework for week 4, as created by Mark Burrell, and Everything Runs
import random ##imports the liabrary that allows use of random functions
import time
import sys
print("HW4_MRB_09_26_17")
Correct_Answers = 0
Incorrect_Answers = 0
questions = 0
def questionGen(info): ##A function for the creation of mul... | ORFMark/Misc_Projects_and_Programs | KP_MT1_Review.py | KP_MT1_Review.py | py | 2,715 | python | en | code | 0 | github-code | 6 |
1397488728 | from collections import defaultdict
def longestPalindrome(s):
maxlen, maxp, l, dit = 0, "", len(s), defaultdict(list)
for i in range(l):
dit[s[i]].append(i)
for j in dit[s[i][::-1]]:
if s[j:i+1] == s[j:i+1][::-1]:
if len(s[j:i+1]) > maxlen:
maxlen = len(s[j:i+1])
maxp = s[j:i+1]
break
retur... | anjaliugale31/placement_preparation | strongest_palindrome.py | strongest_palindrome.py | py | 368 | python | en | code | 0 | github-code | 6 |
3647213738 | import heapq
import numpy as np
import itertools
class PQueue:
def __init__(self):
self.pq = [] # list of entries arranged in a heap
self.entry_finder = {} # mapping of tasks to entries
self.REMOVED = '<removed-task>' # placeholder for a removed t... | joedlcolvin/Tugboats | p_queue.py | p_queue.py | py | 2,032 | python | en | code | 0 | github-code | 6 |
36346167787 | import os
sound_range = (10, 10, 150, 1600)
range_curves = ('{0,1},{10,1}','{0,1},{10,1}','{0,1},{10,1.1},{150,0.8}','{0,1},{10,0},{150,0.8},{1600,0.25}')
def listdirs():
dirlist = next(os.walk('.'))[1]
for i,j in enumerate(dirlist):
if j == '.git':
dirlist.pop(i)
return dirlist
def s... | MartynGorski/A3soundshaderexporter | soundshader.py | soundshader.py | py | 1,716 | python | en | code | 0 | github-code | 6 |
39937264053 | class Solution:
def myAtoi(self, s: str) -> int:
ready_s = s.strip()
start = 0
result = ""
if len(ready_s) == 0:
return 0
if ready_s[0] == "-":
start = 1
result = "-"
if ready_s[0] == "+":
start = 1
for i in ran... | eugder/LC | 8_String2Integer.py | 8_String2Integer.py | py | 794 | python | en | code | 0 | github-code | 6 |
12570928349 | from .strings import Strings
from .actions import Action
from dataclasses import dataclass, field
from telegram import User, InlineKeyboardButton, InlineKeyboardMarkup
import random
from datetime import datetime
REMOVE_ID_INDEX = 13 # в коллбеке для удаления человека передаём айди, начинается с 13 индекса
@datacla... | maxkupetskii/kurwabotV2 | kurwa_bot/tasting.py | tasting.py | py | 3,575 | python | en | code | 0 | github-code | 6 |
28521533515 | from sqlalchemy import Column, Float, ForeignKey, Integer, \
String, Text, and_
from sqlalchemy.orm import contains_eager, load_only, relationship
from sqlalchemy.orm.exc import NoResultFound
from Sugar import Dictifiable
from extensions import celery, db
class SixteenPReport(Dictifiable, db.Model):
__tablen... | harveyslash/backend-cleaned | beatest/models/SixteenPReport.py | SixteenPReport.py | py | 2,816 | python | en | code | 0 | github-code | 6 |
14637149631 | import os
import tkinter as tk
import tkinter.ttk as ttk
import time
import sys
import traceback
from functools import partial
from datetime import datetime
from mqttk.constants import CONNECT, COLOURS
class TopicBrowser(ttk.Frame):
def __init__(self, master, config_handler, log, root, *args, **kwargs):
... | matesh/mqttk | mqttk/widgets/topic_browser.py | topic_browser.py | py | 11,605 | python | en | code | 27 | github-code | 6 |
27462814126 | from app import app
from app import db
from app.models import booking
from flask import jsonify, request
@app.route('/get_booking', methods=['GET'])
def get_booking():
date = request.args.get('date')
idTable = request.args.get('idTable')
phone = ['','','','','','','','']
users = booking.query.all()
... | SevaSob/Na-rogah | routes.py | routes.py | py | 2,216 | python | en | code | 0 | github-code | 6 |
24229159742 | import copy
import sys, ast, os,random
code_dir = "/".join(os.path.abspath(__file__).split("/")[:-2]) + "/"
print("code_dir: ", code_dir)
sys.path.append(code_dir)
sys.path.append(code_dir + "extract_idiom_code_new/")
sys.path.append(code_dir + "transform_s_c/")
from extrac_idiom_var_unpack_for_target import get_idio... | anonymousdouble/Deidiom | code/extract_idiom_code_new/statistic_pair_idiom_nonidiom_for_multi_tar.py | statistic_pair_idiom_nonidiom_for_multi_tar.py | py | 9,849 | python | en | code | 0 | github-code | 6 |
32177006845 | import numpy as np
from sentinelhub import BBox, bbox_to_dimensions,CRS
class resolution_image:
def __init__(self,bbox,resolution):
self.bbox = bbox
self.resolution = resolution
self.size=None
def run(self):
our_bbox = list(np.round(self.bbox,2))
our_bbox = BB... | VaclavLamich/Cloud-Detection | resolution.py | resolution.py | py | 454 | python | en | code | 0 | github-code | 6 |
42542558690 | operation = input().upper().strip()
element_count = 0
line = []
correct_line = []
matrix = []
for i in range(144):
line.append(float(input().strip()))
element_count += 1
if element_count == 12:
matrix.append(line)
element_count = 0
line = []
line_sum = 0
column = 11
quantity = 0
for i in range... | Trypion/aula_OOP | modulo7/abaixo_diagonal.py | abaixo_diagonal.py | py | 517 | python | en | code | 1 | github-code | 6 |
22546077851 | import pygame as pg
import enum
import random
import numpy as np
import pprint
from collections import Counter
from sudokuBibli import list_sudokus
class Sudoku:
"""
class pour le sudoku
"""
def __init__ (self):
self.SOLUTIONS = []
self.grille_initiale = random.ch... | PsychoLeo/Club_Informatique | 4-Sudoku/graphicDisplay.py | graphicDisplay.py | py | 7,659 | python | en | code | 0 | github-code | 6 |
15430729148 | def maxSubArray( nums):
"""
:type nums: List[int]
:rtype: int
"""
### All negative and postive array
if all(num < 0 for num in nums):
return max(nums)
elif all(num > 0 for num in nums):
return sum(nums)
else:
curr_sum,max_sum = nums[0],nums[0]
for arr in nums[1:]:
... | dipalira/LeetCode | Arrays/53.py | 53.py | py | 550 | python | en | code | 0 | github-code | 6 |
19757814729 | # network.messenger.py
from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING
from typing import overload
import tinydb as tdb
from config.base import APP_USERDATA_DIR
from storage.tinyDao import TinyDao
if T... | dbyte/WebtomatorPublicEdition | webtomator/network/messenger.py | messenger.py | py | 8,076 | python | en | code | 0 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.