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
23406486493
# Libraries import numpy import scipy import sklearn import pandas import matplotlib # Visualization from pandas.tools.plotting import scatter_matrix import matplotlib.pyplot as plt # Metrics from sklearn import model_selection from sklearn.metrics import classification_report from sklearn.metrics import confusion_matr...
thesamchris/ml-mastery
iris-dataset.py
iris-dataset.py
py
2,771
python
en
code
0
github-code
1
700764088
# Keys are unique in a Dictionary and can not be duplicated inside a Dictionary. # So I used it to write telephone numbers. tele_dir = { 1111111111: "John", 2222222222: "Sara", 3333333333: "Amal", 4444444444: "Ahmed" } while True: # As we know that Python’s built-in input() function always returns ...
albasry/telephone_directory
phon_dirctory.py
phon_dirctory.py
py
986
python
en
code
0
github-code
1
29019620725
import pytorch3d.loss import pytorch3d.utils import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from einops import rearrange import numpy as np from Utils.LossCatSim_keyPtsDefor_utils.cages import deform_with_MVC from Utils.LossCatSim_keyPtsDefor_utils.utils import normalize_to_box, ...
Orgnizzz/CLPE
CLPE/Utils/LossCatSim_KeyPtsDefor.py
LossCatSim_KeyPtsDefor.py
py
8,418
python
en
code
0
github-code
1
18130955332
#!/usr/bin/env python3 import ev3dev.ev3 as ev3 import library btn = ev3.Button() us = ev3.UltrasonicSensor() assert us.connected, "Connect a single US sensor to any sensor port" # Put the US sensor into distance mode. us.mode='US-DIST-CM' units = us.units # reports 'cm' even though the sensor measur...
tagboto/legoEv3-python
Ultrasonic.py
Ultrasonic.py
py
607
python
en
code
0
github-code
1
38329543772
import torch from PIL import Image import torchvision.transforms.functional as TF import torch import torch.nn as nn # image management MEAN = (0.485, 0.456, 0.406) STD = (0.229, 0.224, 0.225) def prep_img(imagename: str, size=None, mean=MEAN, std=STD): """Preprocess image. 1) load as PIl 2) resize ...
arthur-cahu/ranvgg
utils.py
utils.py
py
4,458
python
en
code
0
github-code
1
15873614763
import os import shutil import argparse def move_to_processed(file_path): destination = "C:/Users/craig/Google Drive/CaptainsLog/Processed" shutil.move(file_path, destination) if __name__ == '__main__': parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDe...
craig3050/CaptainsLog
Test Modules/move_to_processed.py
move_to_processed.py
py
482
python
en
code
0
github-code
1
35806321081
import pandas as pd import os import cv2 import numpy as np from keras.models import load_model import keras_metrics import keras # path = os.getcwd() # parent = os.path.dirname(path) # Base_path = os.path.join(parent , 'Mobilaty\\project\\public') execution_path = os.getcwd() Base_path=os.path.join(execu...
amrfahmy5/Mobilaty-gp-backEnd
project/models/MobileClassfication.py
MobileClassfication.py
py
8,121
python
en
code
0
github-code
1
22612869246
""" Computational domain for isogeometric analysis. """ import os.path as op import numpy as nm from sfepy.base.base import Struct from sfepy.discrete.common.domain import Domain import sfepy.discrete.iga as iga import sfepy.discrete.iga.io as io from sfepy.discrete.iga.extmods.igac import eval_in_tp_coors class Nur...
leawoliu/sfepy
sfepy/discrete/iga/domain.py
domain.py
py
4,521
python
en
code
null
github-code
1
26181183663
#!/usr/bin/env python ''' Process file produced by: https://cdcvs.fnal.gov/redmine/projects/dunetpc/wiki/_ProtoDUNE-SP_Wire_Dumps_ Columns: 0) channel :: [0-15359] 1) cryostat :: 0 2) tpc :: [0,11] 3) plane :: [0,2] 4) wire :: [0,1147] 5) wire beg x 6) wire beg y 7) wire beg z 8) wire end x 9) wire end y 10) wire en...
DUNE/protodune-numbers
python/larsoftwires.py
larsoftwires.py
py
5,498
python
en
code
0
github-code
1
73747256675
from flask import request from flask_restplus import Resource, Namespace, abort, reqparse from rest import api from rest.entities.templates.models import entity_template, entity_template_request from rest.entities.templates.service import EntityTemplateService from rest.common.base_models import response from rest.com...
samshinde/Flask-MVC
entity_mgmt_app/rest/entities/templates/views.py
views.py
py
4,478
python
en
code
0
github-code
1
21808031829
import hashlib import csv def hash_password_hack(input_file_name, output_file_name): with open(input_file_name) as f: reader=csv.reader(f) a=dict() hash_d=dict() for row in reader: name=row[0] text=row[1] ...
Shahmohammadi-M/Ml-PythonProjects
Rainbow_hack_project.py
Rainbow_hack_project.py
py
1,062
python
en
code
0
github-code
1
10232332366
#!/usr/bin/env python3 from useful.mstring import s # http://www.talentbuddy.co/challenge/51ce446a4af0110af3826346 def myrange(stop): return range(stop+1) def count(a,b,c, cap): result = 0 for i in myrange(a): for j in myrange(b): for k in myrange(c): if i+j+k == cap: result += 1 retu...
kopchik/itasks
prio.py
prio.py
py
750
python
en
code
0
github-code
1
1720308881
# 작성 날짜: 23.02.15 # 문제 설명 # 자연수 n이 매개변수로 주어집니다. n을 3진법 상에서 앞뒤로 뒤집은 후, 이를 다시 10진법으로 표현한 수를 return 하도록 solution 함수를 완성해주세요. # 제한사항 # n은 1 이상 100,000,000 이하인 자연수입니다. def solution(n): answer='' while n: answer+=str(n%3) n=n//3 return int(answer,3) print(solution(45)) # 7 print(solution(125)...
0126kjw/CodingTest
Python/programmers/Lv1/Lv1_3진법뒤집기.py
Lv1_3진법뒤집기.py
py
564
python
ko
code
1
github-code
1
12569108562
import tensorflow as tf def conv2d(x, input_filters, output_filters, kernel, strides, mode='REFLECT'): with tf.variable_scope('conv'): shape = [kernel, kernel, input_filters, output_filters] weight = tf.Variable(tf.truncated_normal(shape, stddev=0.1), name='weight') x_padded = tf.pad(x, [[...
sweetweet/StyleTransferFCU
Python/hzy46-fast-neural-style-tensorflow-master/model.py
model.py
py
7,809
python
en
code
0
github-code
1
72377937634
import socket with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client: try: client.connect(("127.0.0.1", 1337)) while True: datas = client.recv(2048).decode() print(f"Servidor: {datas}") dat = input("Enviar: ") if dat == "sair": ...
lvluanvinicius/ITSafe-Python-Scripts
Orientacao-a-objetos/Exercicios/Ex02/client.py
client.py
py
459
python
en
code
0
github-code
1
4433340756
#modcom.co.ke/datascience #modcom.co.ke/flask #modcom.co.ke/flask/datascience/banks #modcom.co.ke/bank import pandas as pd df = pd.read_csv("school.csv") #df is the dataframe # print(df) # print(df["StudyTime"]) print(df[["StudyTime", "Gender"]]) #narrow down subset = df[["StudyTime", "Gender"]] #example of...
Manyanky/ML-MODELS
graphs.py
graphs.py
py
3,853
python
en
code
0
github-code
1
13485505567
from django.db import models # Create your models here. class StatusCrm(models.Model): Status_name = models.CharField(max_length=200, verbose_name='Название статуса') def __str__(self): return self.Status_name class Meta: verbose_name = 'статус' verbose_name_plural = 'статусы' c...
syrovezhko/platform
crm/models.py
models.py
py
1,753
python
en
code
0
github-code
1
24573682795
from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect from meals.models import Meals from order.models import orderDetail # Create your views here. @login_required def add_user_order(request): count_product = int(request.POST.get("count")) product_ID = req...
moeinparvizi/resturan
order/views.py
views.py
py
834
python
en
code
1
github-code
1
12095883666
from django.conf.urls import url from rotations import views api_urls = ( (r'rotations', views.RotationViewSet), (r'requested_departments', views.RequestedDepartmentViewSet), (r'rotation_requests', views.RotationRequestViewSet), (r'rotation_requests/(?P<department_id>\d+)/(?P<month_id>\d+)', views.Rot...
msarabi95/easy-internship
rotations/urls.py
urls.py
py
609
python
en
code
1
github-code
1
35509955713
from deploystream import app from deploystream.apps.feature.lib import get_feature_info, get_all_features from deploystream.lib.transforms import as_json from deploystream.decorators import needs_providers @app.route('/features', methods=['GET']) @needs_providers @as_json def list_features(providers): features = ...
pretenders/deploystream
deploystream/apps/feature/views.py
views.py
py
564
python
en
code
5
github-code
1
22554324082
# var.py # # Read the var files. # NB: the f array returned is C-ordered: f[nvar, nz, ny, nx] # NOT Fortran as in Pencil (& IDL): f[nx, ny, nz, nvar] # # Authors: # J. Oishi (joishi@amnh.org) # T. Gastine (tgastine@ast.obs-mip.fr) # S. Candelaresi (iomsn1@gmail.com). """ Contains the read class for the VAR file re...
JosephMouallem/pencil_code
python/pencilnew/read/var.py
var.py
py
17,478
python
en
code
1
github-code
1
36656035684
import sys def lengthen(line): c = 0 esc = '' for c in line: if c == '"': esc += '\\"' elif c == '\\': esc += '\\\\' else: esc += c return '"%s"' % (esc, ) def main(): with open(sys.argv[1]) as f: lines = [x.strip() for x in f.re...
gerrowadat/adventofcode
2015/8/8-2.py
8-2.py
py
712
python
en
code
1
github-code
1
22950138673
#!/usr/bin/python3 ######################################################################## # This file is part of the Honeyris project made by the Astar Company: # # https://github.com/astar-security/Honeyris # # The project is published under GPLv3 license # # Author...
astar-security/Honeyris
honeyris.py
honeyris.py
py
7,702
python
en
code
3
github-code
1
1630936495
count = 1 while(count <= 100): if(count % 15 == 0): print("FizzBuzz") elif(count % 3 == 0): print("Fizz") elif(count % 5 == 0): print("Buzz") elif(count % 7 == 0): print("GitHub") else: print(count) count += 1
camellia26/FizzBuzzTest
FizzBuzz.py
FizzBuzz.py
py
275
python
en
code
0
github-code
1
42262730136
#!/usr/bin/python3 # -*- coding: utf-8 -*- # import argparse, subprocess, Bio, os, sys, shutil, re, time, datetime, socket, random, requests, xmltodict, json, csv, sqlite3, types from Bio import SeqIO from Bio import Phylo from Bio import Entrez from Bio import AlignIO from Bio.Blast import NCBIWWW from Bio.Blast impor...
mjeltsch/VEGFphylo
2_analysis.py
2_analysis.py
py
72,342
python
en
code
0
github-code
1
5167662236
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from scipy.stats import norm import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as mpatches import math #Esta funcion representa la matriz de confusion de un modelo mediante la TDS def plot(Pa, Pfa, returnP = False, show = T...
manu-torres/portfolio
projects/tdsPlot.py
tdsPlot.py
py
3,819
python
en
code
0
github-code
1
27260484292
cortej = ('1','2','3','4','5','6','7','8','9','10') dictionary = {} def add(i): dictionary[i] = i ** 2 for i in range(1, 50): if i % 2 == 0: add(i) print(cortej) print(dictionary)
Chobotov/MyPython
Lab1/file.py
file.py
py
201
python
en
code
0
github-code
1
25272716860
# import torch # import torchvision #import knockoff.datasets.GTSRB as GTSRB #import knockoff.datasets as datasets # import torch.nn as nn # import pretrainedmodels import caffe import numpy as np import pickle import imageio from PIL import Image from torchvision import transforms transform_gtsrb = transforms.Comp...
chenyanjiao-zju/Defense-Resistant-Backdoor
backdoor/gtsrb/ASR.py
ASR.py
py
3,245
python
en
code
0
github-code
1
41202240590
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 15 20:03:52 2017 @author: jonbaird Sum square difference Problem 6 The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 ...
jontrabai/project_euler
project_euler6.py
project_euler6.py
py
1,138
python
en
code
0
github-code
1
13439713692
import pandas as pd import sqlalchemy as sa import psycopg2 import config from tweet_analysis_functions import prefilter_tweet engine = sa.create_engine(config.engine ,connect_args={"connect_timeout": 60}) def create_postgres_database(tweet_data_frame_list, tweet_users_frame_list, data_table, users_table): data_...
bdawton/twitter_scraping_labelling
postgres_connection.py
postgres_connection.py
py
1,123
python
en
code
0
github-code
1
12735237586
# Euler 26 # Aug 26 2018 # Reciprical cycles # What is the largest recurring cycle in its decimal fraction part for 1/d? # in the range d < 1000 ''' I could use the brent cycle finding algorithm on each of the numbers less than 1000, however, that would be hard. I'd rather use the tortise and hare approach. ''' # We ...
Nellak2017/Project-Euler-Solutions-Python
Solution-Code/p26.py
p26.py
py
1,713
python
en
code
0
github-code
1
26052410847
from jbi100_app.main import app from jbi100_app.data import Data from jbi100_app.visualizations.map import Map_Visualization from jbi100_app.visualizations.heatmap import HeatMap from jbi100_app.visualizations.stackedareachart import StackedAreaChart from jbi100_app.visualizations.barchart2 import BarChart from jbi10...
dharmsen/jbi100-g35
dashframework-main/app.py
app.py
py
12,701
python
en
code
0
github-code
1
42455767228
import cv2 import pytesseract from PIL import Image import sys import os import pyocr import pyocr.builders import datetime import argparse import unidecode import codecs ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="Path to the image") args = vars(ap.parse_args()) ...
vkit/KYC
img_ocr.py
img_ocr.py
py
1,722
python
en
code
0
github-code
1
17775036057
import sys sys.path.insert(0, './src') # import os # os.getcwd() # os.chdir('./DriverActionEstimators') from importlib import reload import numpy as np np.set_printoptions(suppress=True) import pickle import os def pickle_this(item, data_files_dir, item_name): data_files_dir += '/'+item_name+'.pickle' ...
saArbabi/DriverActionEstimators
src/data/latent_mlp/data_collection.py
data_collection.py
py
3,189
python
en
code
4
github-code
1
40543739437
import math, json import bpy, mathutils # ExportHelper is a helper class, defines filename and # invoke() function which calls the file selector. from bpy_extras.io_utils import ExportHelper from bpy.props import StringProperty, BoolProperty, EnumProperty class TransverseMercator: radius = 6378137 def __ini...
vvoovv/prokitektura-studio
export/geojson.py
geojson.py
py
3,496
python
en
code
2
github-code
1
40892979265
import numpy as np def load_detections(det_file, num_frames): det_boxes = [] det_scores = [] raw_data = np.genfromtxt(det_file, delimiter=',') for frame_idx in range(num_frames): idx = np.where(raw_data[:, 0] == frame_idx+1) if idx[0].size: det_boxes.append(np.stack(raw_dat...
LukasBommes/mvmed-tracker
mvt/loaders.py
loaders.py
py
566
python
en
code
16
github-code
1
36598916219
import asyncio import aioconsole import json from abc import abstractmethod from prompt_toolkit import print_formatted_text from prompt_toolkit.formatted_text import FormattedText from monstr.event.event import Event from monstr.encrypt import Keys from monstr.inbox import Inbox from monstr.client.client import Client...
monty888/monstr_terminal
cmd_line/util.py
util.py
py
20,593
python
en
code
14
github-code
1
74180888674
from os import listdir #Problem importer #------------------------------------------------------------------------------ def importInst(fileName): file = open(fileName, 'r') inst = [] for line in file: if not line.startswith("c") \ and not line.startswith("p") \ and not li...
Jamesohare1/Optimization-Algorithms
SatChecker.py
SatChecker.py
py
2,333
python
en
code
0
github-code
1
72353339233
#--------------------------JoyBot - Python Branch-------------------------# import os,random,discord,pickle,json,io,contextlib,itertools from discord.ext.tasks import asyncio from discord.ext import commands from discord.utils import find from datetime import datetime from decimal import Decimal from shutil import cop...
Joyte/Misc
notsortedatall/old_bot.py
old_bot.py
py
36,443
python
en
code
0
github-code
1
15416613529
from __future__ import print_function import os, math from pyspark.sql import SparkSession # Map 1: extract words from a file # input: file_name # output: (term, doc_name), 1 def map1(doc_name): file = open(doc_name) while True: line = file.readline() if line == '': break ...
dungcao/bigdata
tfidf_spark.py
tfidf_spark.py
py
3,109
python
en
code
1
github-code
1
29744161462
import jwt from rest_framework import authentication, exceptions from django.conf import settings from django.contrib.auth.models import User from jwt.algorithms import get_default_algorithms class JWTAuthentication(authentication.BaseAuthentication): def authenticate(self, request): auth_data = authenti...
Kigbu/contactListApp
authentication/backends.py
backends.py
py
1,297
python
en
code
0
github-code
1
40152045665
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Thu Feb 5 13:08:27 2015 @author: dominic """ from __future__ import print_function import sys,os sys.path.append(os.path.abspath('../utils/')) import allele_sim as sim import build_panel as build #import matplotlib.pyplot as plt eprint = lambda *args, **kwar...
DomNelson/ISGen
scripts/drop/allele_sim_run.py
allele_sim_run.py
py
4,104
python
en
code
0
github-code
1
7762360924
""" URL configuration for SANSKARSET project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.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='h...
expertsdrives/sanskarsat
SANSKARSET/urls.py
urls.py
py
1,469
python
en
code
0
github-code
1
20246487008
import sys from collections import deque N,M= map(int,sys.stdin.readline().split()) #row,col maps=[] for _ in range(N): a=list(sys.stdin.readline().strip()) maps.append(list(map(int,a))) state=deque() state.append((1,0,0))#cnt,row,col dx=[0,0,1,-1] dy=[1,-1,0,0] while state: d,x,y=state.popleft() fo...
jhan-04/Test
baekjoon/no.2178.py
no.2178.py
py
1,849
python
en
code
0
github-code
1
34744941405
from typing import * class Solution: def __init__(self) -> None: self.paths = [] self.path = [] def partition(self, s: str) -> List[List[str]]: # 边界情况 # 如果为空 if not s: return [] # 如果只有一个值 if len(s) == 1: return [[s]] self....
PorterZhang2021/LeetCode
8.回溯算法/一刷归档/6. 131.分割回文串.py
6. 131.分割回文串.py
py
2,034
python
zh
code
0
github-code
1
8671312099
import pandas as pd import time import requests from pyquery import PyQuery as pq # 定义一个字母列表 Fam_List = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] # 定义基础网站地址 base_url = 'https://commons.wikimedia.org' # 定义...
SongKunUPC/Art_Image_Spider
Art_Spider.py
Art_Spider.py
py
2,452
python
en
code
0
github-code
1
13043280148
import pytest import struct import json import os.path from iotile.core.hw.hwmanager import HardwareManager from iotile.core.dev.registry import ComponentRegistry from iotile.core.hw.exceptions import RPCNotFoundError, RPCInvalidArgumentsError from typedargs.exceptions import KeyValueException from iotile.core.hw.virtu...
iotile/coretools
iotilecore/test/test_rpc/test_rpc.py
test_rpc.py
py
2,455
python
en
code
14
github-code
1
4603843624
import math import numpy as np class Point: def __init__(self, x, y): self.x = round(x) self.y = round(y) def get_x(self): return self.x def get_y(self): return self.y def get(self): return self.x, self.y def set(self, x, y): self.x = x s...
march-o/neat-car-ai
help.py
help.py
py
6,839
python
en
code
0
github-code
1
18898595251
from libqtile.config import Group, Key from libqtile.command import lazy from keys import keys, mod0, mod2 from settings import workspaces, rooms # Workspaces and rooms # The basic idea behind Workspaces and Rooms is to control # DIFFERENT subsets of groups with the SAME hotkeys. # So we can have multiple 'qwerasdf' r...
EdenQwQ/qtile
workspaces.py
workspaces.py
py
3,702
python
en
code
3
github-code
1
28237156137
cases = int(input().strip()) for case in range(cases): length, n = [int(i) for i in input().strip().split(" ")] places = [int(i) for i in input().strip().split(" ")] places.sort() result = [0, 0] shortest = [min(item, length - item) for item in places] result[0] = str(max(shortest)) longest ...
FangXzhong/cs2021
20211202MockExam/蚂蚁.py
蚂蚁.py
py
430
python
en
code
0
github-code
1
1156692101
from inspect import signature as sig from functools import wraps def typeassert(*ty_args, **ty_kwargs): def decorate(func): if not __debug__: return func fun_sig = sig(func) # 将签名与参数字典绑定 bound_types = fun_sig.bind_partial(*ty_args, **ty_kwargs).arguments @wrap...
wotulong/python-cookbook-note
9_7_typeassert.py
9_7_typeassert.py
py
1,017
python
en
code
0
github-code
1
2425949677
from odoo import fields, models, api class StockMove(models.Model): _inherit = "stock.move" action_reassign_visible = fields.Boolean( string="Shows button to reassign", compute='_compute_action_reassign_visible', readonly=True, ) is_cancellable = fields.Boolean( compu...
decgroupe/odoo-addons-dec
stock_actions/models/stock_move.py
stock_move.py
py
4,692
python
en
code
2
github-code
1
74122169952
import numpy as np from sklearn.metrics import roc_curve, auc from scipy.interpolate import interp1d from scipy.optimize import brentq def calculate_accuracy(threshold, dist, actual_issame): predict_issame = np.less(1-dist, 1-threshold) tp = np.sum(np.logical_and(predict_issame, actual_issame)) fp = np.su...
ChenqiKONG/Detect_and_Locate
utils/metrics_intra.py
metrics_intra.py
py
1,092
python
en
code
6
github-code
1
27170667969
from django.db import models class TgUser(models.Model): tg_id = models.IntegerField() first_name = models.CharField(max_length=64, blank=True, null=True) username = models.CharField(max_length=64, blank=True, null=True) admin = models.BooleanField(blank=True) tz_info = models.CharField(max_length=...
HolidayMan/reminder_bot
bot/models.py
models.py
py
1,416
python
en
code
0
github-code
1
27765862663
def is_prime(num): i = 2 while i < num: if num % i == 0: return False i += 1 return True def prime_generator(): i = 2 while True: if is_prime(i): yield i i += 1 for i in prime_generator(): if i > 1000: break print(i)
m-gunes/python_examples
iterator_generator/prime_generator.py
prime_generator.py
py
315
python
en
code
0
github-code
1
19776629913
from numpy import * def loadData(path): datalist=[] fr=open(path) for line in fr.readlines(): curline=line.strip().split('\t') fitline=list(map(float,curline)) datalist.append(fitline) return datalist def randCent(dataSet,k): n=dataSet.shape[1] centids=mat(zeros((k,n))) ...
leonsharp2015/untitled
venv/kmeans/kmean2.py
kmean2.py
py
2,145
python
en
code
0
github-code
1
16845175684
import cv2 import numpy as np original = cv2.imread("C:/Users/gkami/Documents/GitHub/ImageComparissonDualCam/test_files/1.jpg") duplicate = cv2.imread("images/duplicate.jpg") def testShow(): cv2.imshow("1", original) cv2.waitKey(0)
Pagos3DGit/ImageComparissonDualCam
Source/ImgComp.py
ImgComp.py
py
245
python
en
code
1
github-code
1
7904683532
from Code.Scripts.popularity_calculator import calculate_popularity,freq_of_popularity import xlrd import matplotlib.pyplot as plt file_name = 'D:\\Users\\yashk\\Campaign-Assistant\\Data\\Annotated\\graph_month_input.xls' workbook = xlrd.open_workbook(file_name) sheet = workbook.sheet_by_index(0) rows = sheet.nrows pr...
vr97/finalyearproject2018-19
Code/Scripts/plot_for_month.py
plot_for_month.py
py
1,107
python
en
code
1
github-code
1
9967286767
#pico y placa ''' Realizar un programa para saber que día tiene pico y placa su vehículo ''' ''' lunes: 3 - 4 martes: 5 - 6 miercoles: 7 - 8 jueves: 9 - 0 viernes: 1 - 2 ''' pico = input("\nIngrese su placa (Ejm: abc123): ") numero = ['3','4','5','6','7','8','9','0','1','2'] dias = ["lunes","martes","miercoles","jue...
BENC2024/ejerciciosdeclase
Ejercicio_2/placa.py
placa.py
py
1,134
python
es
code
0
github-code
1
12000961818
# -*- coding: utf-8 -*- """Classes for extinction calculation""" from addict import Dict from copy import deepcopy from ELDAmwl.bases.factory import BaseOperation from ELDAmwl.bases.factory import BaseOperationFactory from ELDAmwl.component.interface import IExtOp from ELDAmwl.component.interface import IMonteCarlo fro...
actris-scc/ELDAmwl
ELDAmwl/extinction/operation.py
operation.py
py
9,736
python
en
code
3
github-code
1
71082237155
from django.views.decorators.csrf import ensure_csrf_cookie import time from urllib import request from django.http import JsonResponse from django.shortcuts import render from django.views.generic import ListView, CreateView, TemplateView, View from django.utils.translation import gettext_lazy as _ from .models impor...
Evgen2209/tolgobol
TolgobolVillage/MainService/views.py
views.py
py
19,643
python
en
code
0
github-code
1
4490764262
# 실습 # outlier1 을 행렬형태로 적용할 수 있도록 수정 import numpy as np aaa = np.array([[1,2,3,4,10000,6,7,5000,90,100], [10,20,3,40,50,60,70,8,90,100]]) aaa = aaa.transpose() print(aaa.shape) # (10, 2) def outliers(data_out): data = data_out.transpose() outlier = [] for i in range(data.shape[0]): ...
Taerimmm/ML
ml/m46_2_outliers2.py
m46_2_outliers2.py
py
1,028
python
en
code
3
github-code
1
28929683261
import physicsSim import physicsObject import forces from tkinter import * import time import math ti = 0.0 tf = 10.0 dt = 0.02 k=20 objects = [] simforces = [] images = [] sim = physicsSim.PhysicsSim(ti,tf,dt) object_image_mapping = {} def init_objects(): ball1 = physicsObject.PhysicsObject() ball1.set_veloc...
ashwin-narkar/physicsSim
springSimulation.py
springSimulation.py
py
2,537
python
en
code
0
github-code
1
32105292748
num = int(input()) k = int(input()) number = num is_factor = False count = 0 for each in range(1,num+1): if not is_factor: if (num % number) == 0: count = count + 1 if count == k: print(number) is_factor = True number = number - 1
bhupathiraju1998/python-intensive
KthLargestFactor.py
KthLargestFactor.py
py
291
python
en
code
0
github-code
1
3511448246
import os import tensorflow as tf import xlsxwriter from tflite import Model from tflite.BuiltinOperator import BuiltinOperator ignore = { # TF "Placeholder", "Const", "Identity", "Shape", "FIFOQueueV2", "QueueDequeueManyV2", "TensorArrayV3", "Enter", "Merge", "Range", "...
gomida/ParseModels
parse_all.py
parse_all.py
py
3,740
python
en
code
0
github-code
1
23911415558
from subfind_provider_subscene import get_short_lang __author__ = 'hiepsimu' import logging import unittest logging.basicConfig(level=logging.DEBUG) class LangTestCase(unittest.TestCase): def test_01(self): self.assertEqual('vi', get_short_lang('vietnamese')) self.assertEqual('vi', get_short_lan...
thongdong7/subfind
tests/TestLang.py
TestLang.py
py
506
python
en
code
4
github-code
1
20910669439
# -*- coding: utf-8 -*- # this file contains all variables that are set by the user and other configuration options # import libraries import nltk import shutil from pathlib import Path from dataclasses import dataclass from fasttext.util import download_model # Define directories DATA_DIR = Path(__file__).parent.p...
andreeaiana/geneg_benchmarking
src/config.py
config.py
py
4,066
python
en
code
2
github-code
1
26940624558
from math import factorial as fact import common as c ''' main block that uses is_strong() to check if its strong number ''' def main() : num = c.read('Enter the number.\n') if is_strong(num) : print(f'{num} is a strong number.') else : print(f'{num} isn\'t a strong number.') # is_strong...
Vi5iON/Cumulation
strong.py
strong.py
py
758
python
en
code
0
github-code
1
26191588756
import http.client # Create a large sample HTTP request with a size larger than 1024 bytes large_request = "GET /example HTTP/1.1\r\n" + ("X" * 1500) # Total size exceeds 1024 bytes # Set up the HTTP connection to your server conn = http.client.HTTPConnection("localhost", 6789) # Replace with your server's host and...
smartlocus/Distributed-Banksystem-Communication
networking/httpclient.py
httpclient.py
py
552
python
en
code
0
github-code
1
3797849770
import schedule import vars import time import win32com.client import logging from datetime import datetime from os import environ def run_job(url, start_time, end_time): logging.info('Start job: %s', url) if start_time: t_now = datetime.now() t_start = datetime.strptime(start_time, '%H:%M') ...
Nefritful/HDESKbot
cron.py
cron.py
py
2,305
python
en
code
0
github-code
1
9891154469
import pandas as pd import numpy as np df = pd.read_excel('redcap_data.xlsx') df_t = df.pivot_table(index=['project_id', 'event_id'], columns='field_name', values='value', aggfunc=np.sum) df_t_new = df_t.reset_index() df_t_new['UniqueID'] = df_t_new['project_id'].map(str) + '-' + df_t_new['event_id'].map(str) df_t_ne...
6chengshu/Prosper_Canada
OFEC_ETL.py
OFEC_ETL.py
py
5,150
python
en
code
0
github-code
1
28560625854
import random def rock_paper_scissor(): if user == computer: print("Tie") elif user == "Rock": if computer == "scissors": print("Rock Smashes Scissors, You Win..!") else: print("Paper Covers Rock, You lose..!") elif user == "paper": if computer == "Rock": print("Paper covers ro...
sharashandra/Rock_paper_scissors-game
rock_paper_scissors.py
rock_paper_scissors.py
py
729
python
en
code
0
github-code
1
70508727393
import tensorflow as tf (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train = x_train.reshape(x_train.shape[0], 28, 28, 1) x_test = x_test.reshape(x_test.shape[0], 28, 28, 1) input_shape = (28, 28, 1) x_train = x_train.astype('float32') x_test = x_test.astype('float32') x_train /= 255 ...
akhil-here/DigitRecognizer
digit_recognition.py
digit_recognition.py
py
1,175
python
en
code
0
github-code
1
6537004052
from node import * def preOrderFind8LetterNames(node): print(f"Visiting node {node}...") if len(str(node)) == 8: print(f'Found {node}') if node.left is not None: preOrderFind8LetterNames(node.left) if node.right is not None: preOrderFind8LetterNames(node.right) def postOrde...
SBrman/as-recursion
chapter_4/dfs.py
dfs.py
py
1,127
python
en
code
0
github-code
1
31749480967
# Author: Sergey Chaban <sergey.chaban@gmail.com> import sys import hou import os import imp import re import struct import inspect from math import * import xcore import xhou try: xrange except: xrange = range class ColBVHNode: def __init__(self, bvh): self.bvh = bvh self.ipols = [] sel...
schaban/crosscore_dev
exp/hou_xcol.py
hou_xcol.py
py
7,622
python
en
code
11
github-code
1
19645785620
""" Ass1 Task1 Q3 - GregL 83186557 - T1Q3.py """ from sys import argv # setup above tax table into arrays supporting the calculation TabLow = [0, 18200, 37000, 87000, 180000] TaxBase = [0, 0, 3572, 19822, 54532] TaxRate = [0, 0.19, 0.325, 0.37, 0.45] # first parm should be gross income, otherwise pr...
gvlawrence/MQ-ACST890
A1T1/T1Q3.py
T1Q3.py
py
1,022
python
en
code
0
github-code
1
4835320806
#!/usr/bin/env python import scapy.all as scapy import time def get_mac(ip): """ Get the mac address of the given IP """ arp_request = scapy.ARP(pdst=ip) broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff") arp_request_broadcast = broadcast_arp_request answered_list = scapy.srp(arp_request...
wi-r-es/arp_spoofer
arp_spoofer_3.py
arp_spoofer_3.py
py
1,966
python
en
code
0
github-code
1
10785703127
class Solution: # count the occurences of an element in an array def countOccurrences(self, arr, n, x): res = 0 for i in range(n): if x == arr[i]: res += 1 return res # count the zeroes in the list/array def moveZeroes(self, arr): value = i...
codebee25/basicalgorithprograms
basicprograms/OccurenceElements.py
OccurenceElements.py
py
1,166
python
en
code
0
github-code
1
40419934704
from pathlib import Path import numpy as np import re from collections import defaultdict import re from collections import deque reg = re.compile( r"p=< *(-?\d+), *(-?\d+), *(-?\d+)>, v=< *(-?\d+), *(-?\d+), *(-?\d+)>, a=< *(-?\d+), *(-?\d+), *(-?\d+)>" ) def man_dist(v): return np.sum(np.abs(v)) def vel_cr...
eirikhoe/advent-of-code
2017/20/sol.py
sol.py
py
3,665
python
en
code
0
github-code
1
10459298523
"""website URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
darkus007/DjangoAPIBlog
website/website/urls.py
urls.py
py
2,013
python
en
code
0
github-code
1
33519016942
from robotide.lib.robot.utils import seq2str from robotide.lib.robot.errors import DataError from .visitor import SuiteVisitor class SuiteConfigurer(SuiteVisitor): def __init__(self, name=None, doc=None, metadata=None, set_tags=None, include_tags=None, exclude_tags=None, include_suites=None, ...
robotframework/RIDE
src/robotide/lib/robot/model/configurer.py
configurer.py
py
2,782
python
en
code
910
github-code
1
25283111198
import requests import os import subprocess def download_file(url, local_fname=None, force_write=False): if local_fname is None: local_fname = url.split('/')[-1] if not force_write and os.path.exists(local_fname): return local_fname r = requests.get(url, stream=True) assert r.status_co...
houqi/mxnet
example/image-classification/common/util.py
util.py
py
816
python
en
code
null
github-code
1
30689763711
import argparse import numpy as np import torch from torchtext.data import Iterator as BatchIter import torch.nn.functional as F from Beam import Beam import causalchains.utils.data_utils as du from causalchains.utils.data_utils import EOS_TOK, SOS_TOK, PAD_TOK from causalchains.train.masked_cross_entropy import maske...
weberna/causalchains
causalchains/train/lm_generate.py
lm_generate.py
py
24,410
python
en
code
6
github-code
1
37290512441
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from Grid import Grid class GraphicGrid(object): colours = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] colours_redundant = [el + '--' for el in colours] def __init__(self, grid=None, union_find = None, **kwargs): self.grid = grid ...
dj8yfo/union_find_matplotlib
erdesh_renie/graphic_sample.py
graphic_sample.py
py
3,931
python
en
code
0
github-code
1
31654246997
import os from nlplingo.oregon.event_models.uoregon.tools.global_constants import * def get_rsync_files(path): ignore_list = [ 'python/clever/event_models/uoregon/tools/stanford_resources', 'python/clever/event_models/uoregon/tools/bert_resources', 'python/clever/event_models/uoregon/datas...
BBN-E/nlplingo
nlplingo/oregon/event_models/uoregon/tools/create_rsync_list.py
create_rsync_list.py
py
1,229
python
en
code
4
github-code
1
32472496571
# string_adv_review.py # unique_english_letters takes a word as a parameter # and returns the total number of unique characters, # uppercase and lowercase characters should be counted # indivually letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" def unique_english_letters(word): counter = 0 f...
jon-xo/python-practice
lesson-intro/string_adv_review.py
string_adv_review.py
py
1,868
python
en
code
0
github-code
1
12045470381
import pwd import subprocess from datetime import datetime, timedelta import iso8601 # https://bitbucket.org/micktwomey/pyiso8601 from enum import Enum # https://pypi.python.org/pypi/enum34 QuotaType = Enum('block', 'inode') QuotaState = Enum('no_quota', 'under_quota', 'soft_limit', 'hard_limit', 'grace_expired') ...
asciiphil/quotanotify
model.py
model.py
py
10,553
python
en
code
1
github-code
1
20333424939
import serial import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib import style import datetime as dt fig=plt.figure() axl=fig.add_subplot(1,1,1) ser=serial.Serial("COM4",115200) beat=[] avg_beat=[] xs=[] ys=[] y_range=[30,150] def mov_avg (mylist): N = 3 ...
Uzama/Smart-Driver-Drowsiness-Detection
pulse.py
pulse.py
py
2,300
python
en
code
1
github-code
1
11000881684
import requests from random import randint class Person: def __init__(self,imya="", falimia="", login="", parol=""): self.__data = requests.get("https://api.randomdatatools.ru/").json() self.__lorem="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor dictum quam, ut tincidunt p...
Viktor228989/python
lesson_26/instclone/klass.py
klass.py
py
1,276
python
en
code
0
github-code
1
26346503086
import fcsparser import numpy as np from numpy import genfromtxt from auto_encoder_updated import file_io as io import os.path import sklearn.preprocessing as prep from sklearn.model_selection import train_test_split class Sample: x = None y = None def __init__(self, x, y=None): self.x = x ...
lthp/2019_SingleCell
legacy/auto_encoder_updated/data_hander.py
data_hander.py
py
2,961
python
en
code
1
github-code
1
1317252826
import random import time summa_hum = 0 # ход игрока print("Your turn") for i in range(3): k1 = random.randint(1, 6) print("Выпало", k1) summa_hum += k1 time.sleep(0.5) print("Total score", summa_hum) summa_comp = 0 # ход компа print("Comp turn") for i in range(3): k2 = random.randint(1, 6) ...
Igor-Chernykh/Python_example_and_exercises
Exercises/Игра в кости с компом.py
Игра в кости с компом.py
py
641
python
en
code
0
github-code
1
3044117056
import math area = float(input('Insira a área a ser pintada (m²): ')) # 1L de tinta pinta 3m², portanto, 18L (1 lata de tinta) cobre 54m². volume_tinta = area / 54 quantidade_latas = math.ceil(volume_tinta) custo = quantidade_latas * 80 print(f'Serão necessárias {quantidade_latas} latas de tinta no valor de R$ 80.0...
gabisiqueira/LearningPython
Volume de Tinta.py
Volume de Tinta.py
py
388
python
pt
code
0
github-code
1
26781815105
import datetime import json import os import pandas as pd import twitter def create_twitter_api(): """Check environment and return appropriate twitter API""" # API CREDENTIALS path = "twitter-credentials.json" # if running from local machine if os.path.exists(path): with open(path, "r"...
SamEdwardes/sentiment-cdn-election
src/twitter_data.py
twitter_data.py
py
4,061
python
en
code
0
github-code
1
38902720903
import os import sys import time import json import threading class GitManager: def __init__(self, __dir_path=os.path.dirname(os.path.realpath(__file__))): self.__dir_path = __dir_path self.__folder_list = os.listdir(self.__dir_path) self.__repositories_list_name = "repositoriy_list.txt" ...
qinbatista/Tool-PythonHelper
GitUploadAllProjects.py
GitUploadAllProjects.py
py
3,488
python
en
code
0
github-code
1
8996178012
class ColoringProblem: def __init__(self, adj, N, C): self.adj = adj # Adjecency matrix self.N = N # nodes self.C = C # colors # Colors assigned to each node self.colors = [None for x in range(N)] def solveProblem(self): # First node is colored 0 self...
tuncatunc/algorithms
Algorithims/Backtracking/ColoringProblem.py
ColoringProblem.py
py
2,203
python
en
code
0
github-code
1
10457254206
def calculate_average(list_of_numbers): sum_of_numbers=0 length_of_list=len(list_of_numbers) for r in range(length_of_list): sum_of_numbers=sum_of_numbers+list_of_numbers[r] mean_of_list=sum_of_numbers/length_of_list print('The average is {}.'.format(mean_of_list)) def concatenate_s...
dmatekenya/AIMS2019-Dakar-BigDataCourse
exercise-submission/day1/Djabarou_Issotina.py
Djabarou_Issotina.py
py
644
python
en
code
1
github-code
1
3017881666
from utils import * def read_data(filename): with open(filename, 'r') as f: data = f.read() return [ (cmd, int(value)) for cmd, value in map(str.split, data.strip().splitlines()) ] def task1(filename): depth = 0 x = 0 commands = read_data(filename) for cmd, value...
Evgenus/advent-of-code
2021/02/main.py
main.py
py
1,026
python
en
code
2
github-code
1
25035819316
#!/usr/bin/env python2.7 import sys import os from CParser import CParser LIBNAME = 'example' # Correlation table for direct types cor = { 'bool': 'ctypes.c_bool', 'char': 'ctypes.c_char', 'byte': 'ctypes.c_byte', 'unsigned byte': 'ctypes.c_ubyte', 'short': 'ctypes.c_short', 'unsigned shor...
gquere/htopy
htopy.py
htopy.py
py
3,627
python
en
code
0
github-code
1
3247018559
from numba import jit from jit_talib import jit_ma import numpy as np from datetime import datetime @jit(nopython=True) def jit_ttm_strategy(tick, chart, position, global_data): now_pos = global_data['chart_pos'] open_volume = 0.05 open_array, high_array, low_array, close_array = chart[1][: ...
dajinforjustice/bitcoin
strategy/JitTTMStrategy.py
JitTTMStrategy.py
py
6,541
python
en
code
0
github-code
1
25038963926
from os import system def get_menus(title, menus): res = -1 while res == -1: # if clear_: # clear() print("\n" + title) for i, menu in enumerate(menus): row = str(i + 1) + " - " + menu['name'] if 'value' in menu: row += " => " + str(m...
gquesnot/Ez_Automation
util/InputHandler.py
InputHandler.py
py
1,750
python
en
code
0
github-code
1