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
34463042679
def primality(n): rn = n**(1/2) i = 2 found = False while i <= rn and not found: if n % i == 0: found = True else: i += 1 if found or n == 1: return 'Not prime' else: return 'Prime'
Kakurouta/Python_Problem_Solving
TimeComplexity_Primality.py
TimeComplexity_Primality.py
py
273
python
en
code
0
github-code
1
32472340551
# class.py # template for a a data type, python style guide recommends # capatalizing name of class class FirstClass: pass # ------------- # Instantiate a class # One method could be creating an object and assigning it to a variable class XmenReboot: pass x_reboot = XmenReboot() # The type method reverse...
jon-xo/python-practice
lesson-intro/classes/class.py
class.py
py
4,585
python
en
code
0
github-code
1
22026922508
#coding:utf-8 import logging import time from Config.conf import * def Logger(testlog): #测试的名称 #1、创建log logg = logging.getLogger(testlog) logg.setLevel(logging.INFO)#log等级的总开关 # 获取本地时间,转换成日志需要的格式 curTime = time.strftime("%Y%m%d%H%M", time.localtime(time.time())) # 设置日志的文件名称 LogFileName = log...
joanguo123456/Python-selenium
Methods/log.py
log.py
py
1,074
python
en
code
0
github-code
1
70477488033
# -*- coding: utf-8 -*- from .conversion import check_type from .filesystem import json_exporter, get_appdirs_path, sha256, json_importer from .maps import Map from .intersections import intersection_dispatcher from .geometry import get_remaining from .projection import project from .rasters import gen_zonal_stats from...
cmutel/pandarus
pandarus/calculate.py
calculate.py
py
17,723
python
en
code
8
github-code
1
40614540059
import sys import os from ROOT import * import numpy as np from sys import exit from numpy.random import uniform, normal from random import choice from pprint import pprint import copy # Check out git clone https://github.com/mdj/NexDet.git and point sys.path to that place sys.path.append("/home/philip/Documents/bac...
skaersoe/TrackingPositrons
Python/Prototype/simulation_reconstruction.py
simulation_reconstruction.py
py
51,432
python
en
code
1
github-code
1
6493867382
from msrest.service_client import ServiceClient from msrest import Configuration, Serializer, Deserializer from .version import VERSION from .operations.dictionary_operations import DictionaryOperations from . import models class AutoRestSwaggerBATdictionaryServiceConfiguration(Configuration): """Configuration fo...
testormoo/autorest.ansible
test/vanilla/Expected/AcceptanceTests/BodyDictionary/fixtures/acceptancetestsbodydictionary/auto_rest_swagger_ba_tdictionary_service.py
auto_rest_swagger_ba_tdictionary_service.py
py
1,754
python
en
code
0
github-code
1
17141535673
import trends_data import matplotlib.pyplot as plt region = 'US' n_hits = 4 keywords = trends_data.get_trending_keywords(n_hits) hist_df_list = [trends_data.get_historical_data(keyword, region) for keyword in keywords] scores_df = trends_data.compute_total_score(hist_df_list, keywords) ax = scores_df.plot.pi...
kochlisGit/Data-Science-Algorithms
visualizations/pie_plot.py
pie_plot.py
py
409
python
en
code
2
github-code
1
28928854742
import tkinter import random x_max, y_max = 1000, 600 c = tkinter.Canvas(width = x_max, height = y_max) c.pack() def farba(r,g,b): return f"#{r:02x}{g:02x}{b:02x}" r = random.randrange(256) g = random.randrange(256) b = random.randrange(256) zvacsenie_r = 3 zvacsenie_g = 3 zvacsenie_b = 3 ...
AnonymnyNikto/PythonProgramovanie
Podmienky/Program_001.py
Program_001.py
py
1,413
python
es
code
1
github-code
1
72858504034
import os from flask import Flask, render_template, redirect, url_for, request, flash from flask_bootstrap import Bootstrap5 from flask_sqlalchemy import SQLAlchemy from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired import requests app = Flask(__nam...
Developer122436/MyScrips
My Projects on Data Science, Web and more/Section 64 - My top 10 movies website with SQLite, API, Flask and Jinja/main.py
main.py
py
4,112
python
en
code
0
github-code
1
28640282219
from django.db import models from users.models import BakeryUser from django.utils import timezone # Create your models here. DISCOUNT_RULE = [ ('based_on_order', 'Based On Order Amount'), ('based_on_quantity', 'Based On Quantity') ] DISCOUNT_TYPE = [ ('fixed_price', 'Fixed Price'), ('percentage', 'P...
deepvikas/bakery_management
bakery/models.py
models.py
py
1,342
python
en
code
0
github-code
1
39661298304
# import itertools # # # l = [] # for i in range(8): # l.append([0,1,2,3,4,5]) # # print(l) # # l = [[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5]] # combi = list(itertools.product(*l)) # # print(len(combi)) def readInput(fn,mode=0): """ :param fn: input filname :param mode: 0 normal worki...
Rapid1898-code/Advent-Of-Code
Advent2020/Advent20_1.py
Advent20_1.py
py
4,872
python
en
code
0
github-code
1
36995726099
import random import vector def clear(): """clearing for python interpreter""" for i in range(30): print() def main(): time = 4 #time in seconds res = 30 #resolution (points per second) t = [t/(res*time) for t in range(res*time)] acc = Vector(3,4,5) vel = Vector(0.5, 0...
quiksand/toolbox
misc.py
misc.py
py
441
python
en
code
0
github-code
1
19402859793
class1 = input('Is there class today?') if class1 == 'y': wake1 = input('Did you wake up on time?') if wake1 == 'y': getWeather = input("What is the temperature outside?: ") weather1 = input('Is it nice out?') if weather1 == 'y': trans1 = input('Do you have transportation?') if trans1 == 'y...
JamMasterJess/Training-python
attendClass.py
attendClass.py
py
995
python
en
code
0
github-code
1
6386216098
# Bismillah from sys import stdin, stdout # import threading # import queue # from collections import Counter # from math import inf, gcd # import heapq # import itertools # str_stdin = lambda: stdin.readline()[:-1] # strs_stdin = lambda: list(map(str, stdin.readline().split())) int_stdin = lambda: int(stdin.readline(...
oneku16/CompetitiveProgramming
ICPC/ICPC2022/Preparation/2021b.py
2021b.py
py
1,057
python
en
code
0
github-code
1
37440654962
from copy import deepcopy import functools from iceberg.api import DataOperations from iceberg.api.expressions import Expressions, Literal, Operation, UnboundPredicate from iceberg.api.types import TimestampType from .manifest_group import ManifestGroup from .util import str_as_bool TIMESTAMP_RANGE_MAP = {Operation....
wujiapei/alldata
oneLake/iceberg-versions/iceberg-0.13/python_legacy/iceberg/core/scan_summary.py
scan_summary.py
py
15,929
python
en
code
3
github-code
1
29675356473
from dataclasses import dataclass from datetime import datetime from .. import db @dataclass class StockTimeline(db.Model): __tablename__ = "stock_timeline" id: int = db.Column(db.Integer, primary_key=True, autoincrement=True) product_id: int = db.Column(db.Integer, db.ForeignKey("product.id"), nullable=...
CodePan1/VendingMachineFlask
src/models/stock_timeline.py
stock_timeline.py
py
820
python
en
code
0
github-code
1
26064585699
import argparse import os import random import shutil import time import warnings from tqdm import tqdm from typing import Callable, Optional import faiss import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data from torch.utils.data im...
UCDvision/low-budget-al
trainer_DP.py
trainer_DP.py
py
14,246
python
en
code
13
github-code
1
11705085942
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os import sys import psycopg2 from psycopg2.extensions import AsIs from datetime import timedelta sys.path.append('/home/mike/dsi/capstones/climbing_gym_checkins_eda') def parse_datetime(df, col='index', hour=True, dow=True, date=True, w...
bakera81/weather_and_climbing_gym_checkins
src/funcs.py
funcs.py
py
6,470
python
en
code
0
github-code
1
5974516977
#!/usr/bin/env python # Designed for use with boofuzz v0.0.8 import sys from boofuzz import * if len(sys.argv) < 3: sys.exit(-1) s_initialize("query") if s_block_start("header"): s_word(123, name="id") s_byte(1) s_byte(0) s_byte(0) s_byte(1) s_word(0, name="AnCount", endian=">") s_wor...
zhaomanzhou/Sdns
src/fuzzer/tcptest_test.py
tcptest_test.py
py
816
python
en
code
0
github-code
1
11130967395
# 병합정렬 def merge_sort(list1): # 종료조건 if len(list1) <= 1: return list1 # 분해작업 mid = len(list1) // 2 # 중간 값 구하기 g1 = list1[:mid] # 재귀호출로 첫 번째 그룹 g1 = [6, 8, 3, 9, 10] => g1[6, 8] & g2[3, 9, 10] g2 = list1[mid:] merge_sort(g1) merge_sort(g2) # 병합 i1, i2, ia = 0, 0, 0 ...
hayeong25/Python_Soldesk
algorithm/17_병합정렬2.py
17_병합정렬2.py
py
935
python
ko
code
0
github-code
1
9162161598
""" Flask Documentation: http://flask.pocoo.org/docs/ Jinja2 Documentation: http://jinja.pocoo.org/2/documentation/ Werkzeug Documentation: http://werkzeug.pocoo.org/documentation/ This file creates your application. """ import os from werkzeug.utils import secure_filename from app import app, db from flask im...
kimkcharles/info3180-project1
app/views.py
views.py
py
3,783
python
en
code
0
github-code
1
17414175242
from PySide2.QtCore import Qt from PySide2.QtWidgets import QWidget, QMainWindow, QLabel, QApplication, QDockWidget, QPushButton, QGridLayout, \ QVBoxLayout, QTabWidget, QInputDialog from PySide2.QtGui import QIcon from gui.EditMenu import EditMenu from gui.HelpMenu import HelpMenu from gui.ViewMenu import ViewMenu...
dovvla/multimedia-book
MuMijA/gui/MainWindow.py
MainWindow.py
py
4,723
python
en
code
0
github-code
1
8993383106
from flask import Blueprint, session, render_template, flash, make_response, \ url_for from werkzeug.utils import redirect from flask import request from dataengine.common.log import logger from dataengine.server.routes.annotations import requires_auth from dataengine.server.routes.validator.user_metric import ( ...
apmaros/dataengine
dataengine/server/routes/user_metric.py
user_metric.py
py
1,289
python
en
code
1
github-code
1
6781869373
# 중복된 결과 값을 stack에 저장해서 실행속도를 줄이는 방법 # 피보나치 실행시간을 줄이기가 목적 def fibo(n): if n<=2: return 1 return fibo(n-1)+fibo(n-2) print(fibo(35)) memo =[0,1,1]+[0]*100 def fibo_memo(n): if n<=2: return 1 if memo[n]:return memo[n] memo[n]= fibo_memo(n-1)+fibo_memo(n-2) return memo[n] print(fibo(35))
Hyunjong1461/python
200406/메모이제이션.py
메모이제이션.py
py
387
python
ko
code
0
github-code
1
73747256355
from bson import ObjectId from flask_restplus import abort, marshal from rest.entities.templates.models import entity_template_response from rest.entities.models import set_bson_object from rest.common.constants import ENTITY_TEMPLATE_COLLECTION, ID from rest.common.constants import META, IS_DELETED, UPDATED, INTERNAL...
samshinde/Flask-MVC
entity_mgmt_app/rest/entities/templates/service.py
service.py
py
6,977
python
en
code
0
github-code
1
6652507274
# coding=utf-8 """ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under ...
oceanbase/sql-lifecycle-management
src/common/logger.py
logger.py
py
2,813
python
en
code
56
github-code
1
30024117659
#----ANIMAL FAVORITO---# class Animal (): def __init__(self,caracteristica1,tamaño,caracteristica2): self.raza = 'pastor aleman' self.caracteristica= caracteristica1 self.estaturaa= tamaño self.otracaracteristica= caracteristica2 def atributos (self): print(f'''hola m...
Santi-ago222/programacion3semestre
clases y objetos/ejercicio.py
ejercicio.py
py
1,170
python
es
code
0
github-code
1
8490942134
import pyposeidon.meteo as pmeteo import pytest import pandas as pd import xarray as xr import os import numpy as np import shutil from . import DATA_DIR METEO_NC = DATA_DIR / "meteo.nc" ERA5_GRIB = DATA_DIR / "era5.grib" DATASET = xr.Dataset(data_vars=dict(lat=(("node", [1, 2, 3])))) def test_dispatch_meteo_sourc...
ec-jrc/pyPoseidon
tests/test_meteo.py
test_meteo.py
py
3,426
python
en
code
17
github-code
1
11434781298
import random import math from sympy import isprime, mod_inverse from flask import Flask, request, jsonify from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app, support_credentials=True, resources={r'/make_key': {'origins': '*'}}) @app.route("/make_key", methods=['GET']) @cross_origin() def make...
mazinal-ani/message-encryption-system
encryption.py
encryption.py
py
3,454
python
en
code
0
github-code
1
19686765177
import matplotlib import re import os import sys import shutil # get config file path config_file = matplotlib.matplotlib_fname() # move wenquanyi open source TTF font file in if sys.platform == 'win32': ttf_font_path = config_file.replace('\\matplotlibrc', '\\fonts\\ttf') else: ttf_font_path = config_fil...
wshuyi/demo-python-chinese-word-embedding
handle_matplotlib_chinese.py
handle_matplotlib_chinese.py
py
819
python
en
code
34
github-code
1
35431203364
import sys sys.stdin = open('input_7562.txt', 'r') def BFS(row, col): queue = [] dx = [-2, -1, +1, +2, +2, +1, -1, -2] dy = [+1, +2, +2, +1, -1, -2, -2, -1] queue.append([row, col]) visited[row][col] = True move_cnt = 0 while True: temp_list = [] move_cnt += 1 while ...
wally-wally/TIL
02_algorithm/baekjoon/problem/1000~9999/7562.나이트의이동/7562.py
7562.py
py
1,199
python
en
code
32
github-code
1
29540033424
######################################################### # Holds value and weights for types of recycling # value: represents the value of each 1 unit of recycling # amount:_weighted is a value that can be used as a # multiplying to the amount donated to weigh # it as needed ######...
andrewcolepinkham/recycler
recyclemanager/submissions/calculate_scores.py
calculate_scores.py
py
1,627
python
en
code
3
github-code
1
146107604
# coding: utf-8 # This is the deepseg_gm model definition for the # Spinal Cord Gray Matter Segmentation. # # Reference paper: # Perone, C. S., Calabrese, E., & Cohen-Adad, J. (2017). # Spinal cord gray matter segmentation using deep dilated convolutions. # URL: https://arxiv.org/abs/1710.01269 import kera...
jem0101/BigSwag-SQA2022-AUBURN
TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/neuropoly@spinalcordtoolbox/spinalcordtoolbox/deepseg_gm/model.py
model.py
py
6,230
python
en
code
2
github-code
1
21843265623
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pathSum(self, root: TreeNode, total: int) -> List[List[int]]: if not root: return [...
uditmanav17/leetcode
113-path-sum-ii/113-path-sum-ii.py
113-path-sum-ii.py
py
999
python
en
code
0
github-code
1
20524415029
#!/usr/bin/python3 # -*- coding: utf-8 -*- import tkinter as tk from tkinter import ttk from .Labeler import Labeler from .LabeledMultiWidget import LabeledMultiWidgetMixin from .SuperWidget import SuperWidgetMixin from typing import Callable class ActiveOptionMenu(ttk.OptionMenu, SuperWidgetMixin): """ttk.Optio...
AndrewSpangler/py_simple_ttk
src/py_simple_ttk/widgets/OptionMenuWidgets.py
OptionMenuWidgets.py
py
3,012
python
en
code
2
github-code
1
41806562449
# This file contains an attempt at actually putting the network trained in EncDec.py to practice import keras import numpy as np import matplotlib.pyplot as plt from keras.models import Model, load_model import pandas as pd import pandas_ml as pdml from matplotlib.widgets import Slider def decode(onehot): return n...
walterian/VLC-CAE
Implementation.py
Implementation.py
py
3,348
python
en
code
0
github-code
1
14993729383
# -*- coding: utf-8 -*- """metrics module Define our metrics module that encapsulates attributes and methods related to the metrics we use for our lunar anomalies project. """ import matplotlib.pyplot as plt import numpy as np from inspect import signature from sklearn.metrics import average_precision_score, auc from s...
lesnikow/lunar-anomalies
lam/metrics.py
metrics.py
py
9,530
python
en
code
2
github-code
1
23255146922
from flask import Flask, render_template, jsonify, request from flask_pymongo import PyMongo from flask_cors import CORS, cross_origin import json import copy import warnings import re import random import math import pandas as pd pd.set_option('use_inf_as_na', True) import numpy as np import multiprocessing from o...
angeloschatzimparmpas/VisRuler
run.py
run.py
py
44,623
python
en
code
1
github-code
1
39447744666
#PYTHON 3 import urllib,json, time from bs4 import BeautifulSoup exec(open('/home/fbbot/cfb/sload.py').read()) confs_site=BeautifulSoup(urllib.urlopen('http://espn.go.com/college-football/standings?t='+str(time.time())),"html5lib") conferences=confs_site.findAll('div',{'class':'responsive-table-wrap'}) confs={} for ...
rankinr/FootballBot
updaters/confs.py
confs.py
py
1,301
python
en
code
4
github-code
1
35802081641
from tkinter import * from tkinter import messagebox root=Tk() def veiw1(): if(e1.get()=="HOPE"): import user else: messagebox.showinfo("VEIW",("Sorry,Wrong input")) canvas = Canvas(root,width = 500, height = 200, bg = 'blue') canvas.pack() img = PhotoImage(file = 'c3.png') canvas.cre...
amritachaudri/Text-Based-Captcha
page1.py
page1.py
py
554
python
en
code
0
github-code
1
14839016648
import numpy as np from scipy.stats import multivariate_normal from sklearn.cluster import KMeans import cv2 np.random.seed(0) def EM_Segmentation(data, parameters, epsilon): mean_1 = parameters['mean_1'] mean_2 = parameters['mean_2'] covariance_1 = parameters['covariance_1'] covariance_2 = parameters[...
chenhuaizhen/Image_denoising_segmentation
EM-Segmentation.py
EM-Segmentation.py
py
5,432
python
en
code
4
github-code
1
27787721598
import tweepy import configparser from datetime import datetime import json config = configparser.ConfigParser() config.read('./twitter.ini') ACCESS_TOKEN = config.get('twitter', 'ACCESS_TOKEN') ACCESS_TOKEN_SECRET = config.get('twitter', 'ACCESS_TOKEN_SECRET') API_KEY = config.get('twitter', 'API_KEY') AP...
clairtonm/kafka-spark-course
kafka/twitter_batch.py
twitter_batch.py
py
1,287
python
en
code
0
github-code
1
22607295569
import cv2 import os import glob import numpy as np image_path=np.array(sorted(glob.glob(r"C:\Data\img\*.png"))) save_path=r"C:\Data\result" def load_t(x): img = cv2.imread(x,-1) basename=os.path.basename(x) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) grad = grade(gray) savepath=os...
liaochengcsu/jlcs-building-extracion
test_c4_vis.py
test_c4_vis.py
py
748
python
en
code
2
github-code
1
40135381216
# Accessing an element in an array array = [9,4,5,7,0] print (array[3]) # output = 7 # print (array[9])---> This will print "list index out of range" since the index at 9 is not available. # Insertion operation in an array # One can add one or more element in an array at the end, beginning or any given index #...
BethMwangi/DataStructuresAndAlgorithms
Arrays/operations.py
operations.py
py
1,693
python
en
code
0
github-code
1
36524344047
from datetime import datetime from consulta.models import Agendamento from consulta.ext.database import db class AgendamentoService: @staticmethod def agendar_consulta(dados): dados['data'] = datetime.strptime(dados['data'], '%Y-%m-%d %H:%M:%S') agendamento = Agendamento(**dados) db.s...
sabrinaa0408/agendamento-backend
consulta/blueprints/services/agendamento.py
agendamento.py
py
617
python
pt
code
0
github-code
1
33969656326
from scipy.interpolate import interp1d import numpy as np import pyglet from board_colors import board_colors from board_graphics import BoardBackground, BoardForeground class ProbabilityDisplay: def __init__(self, window_size, board_size, initial_probabilities): self.window_size = window_size self.board_siz...
lihmds/govis
probability_display.py
probability_display.py
py
1,706
python
en
code
0
github-code
1
1145283895
import sys input = sys.stdin.readline def BOJ_1992(x,y,size): if size == 0 : return cnt = 0 for i in range(x,x+size): cnt += sum(lst[i][y:y+size]) if cnt == 0: print(0,end="") elif cnt == size*size: print(1,end="") else: print('(',end="") ...
seoljeongwoo/learn
algorithm/BOJ_.1992.py
BOJ_.1992.py
py
613
python
en
code
0
github-code
1
33880536633
from collections import defaultdict from utils import timeit @timeit def get_data(): data = [] with open('input.txt') as input_file: for line in input_file: value = line.strip().split() data.append(value) return data def execute(program, default_registers=None): # Do...
bdaene/advent-of-code
2016/day23/solve.py
solve.py
py
3,142
python
en
code
1
github-code
1
19816918134
# -*- coding: utf-8 -*- from django.contrib.sites.models import Site from django.db import models from django.db.models import Q from django.utils import six from cms.cache.permissions import get_permission_cache, set_permission_cache from cms.exceptions import NoPermissionsException from cms.models.query import PageQ...
farhan711/DjangoCMS
cms/models/managers.py
managers.py
py
19,053
python
en
code
7
github-code
1
21413137316
import numpy import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from PIL import Image import PIL.ImageOps X= numpy.load("image.numpyz")['arr_0'] y = pd.read_csv("labels.csv")["labels"] classes = ['A','B','C','D','E','F','G','H'...
SaanviSinha/Project-125
program.py
program.py
py
1,275
python
en
code
0
github-code
1
27801631687
from reverse_linked_list_iterative import reverse_linked_list from test_framework import generic_test def is_linked_list_a_palindrome(L): data_list = [] orig = L while L: data_list.append(L.data) L = L.next end = len(data_list)-1 for start in range(len(data_list)//2): if da...
garciamilord/Elements-of-Programming-Interviews
epi_judge_python_solutions/is_list_palindromic.py
is_list_palindromic.py
py
651
python
en
code
null
github-code
1
2537939936
#!/usr/bin/env python # coding: utf-8 import pyqrcode import pandas as pd import os # set variable(s) QR_folder = "test_data/QRs" student_CSV = "test_data/sj_sample.csv" last_name_row = "Last name" first_name_row = "First name" student_id_row = "Student ID" def createQR(student): qr = pyqrcode.create(stude...
RoloTammasi/portraitAssistant
qr_create.py
qr_create.py
py
647
python
en
code
0
github-code
1
70524176993
import rclpy from rclpy.node import Node import serial import sys import threading import glob from std_msgs.msg import String class SerialRelay(Node): def __init__(self): # Initalize node with name super().__init__("serial_publisher") # Create a publisher to publish any output the pico ...
shorewind/shc-twomonth-rover
ros_ws/src/pico_relay/pico_relay/pico_relay.py
pico_relay.py
py
2,749
python
en
code
2
github-code
1
18202915443
from .utilities.navigable import make_navigable __converters = {} def conversion(output_type, *mime_types): """Decorator: registers the decorated function as the converter of each of the specified MIME types to the specified OutputType.""" def _conversion(f): def _register_converter(output_type,...
os2datascanner/os2datascanner
src/os2datascanner/engine2/conversions/registry.py
registry.py
py
1,661
python
en
code
8
github-code
1
28176883992
import csv content_pages = {} count = 0 # with open('resources/Dummy Data_final_310123 - with full content samples.xlsx - Full Content Samples.csv' # , newline='') as csvfile: with open('resources/MA Database 220523.xlsx - topics.csv' , newline='') as csvfile: reader = csv.reader(csvfile, delimit...
DCotterill/halixia-hugo
validate-topics.py
validate-topics.py
py
1,294
python
en
code
0
github-code
1
41695589361
import os import torch from typing import Dict, List, Tuple, Optional from dataclasses import dataclass from src.dataType import State, Action from src.animator.animator import Animator from src.const import VNF_SELECTION_IN_DIM, VNF_PLACEMENT_IN_DIM @dataclass class DebugInfo: timestamp: str episode: int ...
euidong/sdn-lullaby
src/utils.py
utils.py
py
6,070
python
en
code
0
github-code
1
72410596835
import cv2 as cv import numpy as np import os def dummy_resize(img, size): _sz = np.shape(img)[:-1] field = np.zeros((max(_sz), max(_sz), 3), dtype=np.uint8) if _sz[0] > _sz[1]: field[:, (_sz[0]-_sz[1])//2:(_sz[0]+_sz[1])//2+(_sz[1] % 2), :] = img else: field[(_sz[1]-_sz[0])...
onion-nikolay/cf-dataset-preprocessing
image_processing.py
image_processing.py
py
3,981
python
en
code
0
github-code
1
25728142019
import unittest.mock as mock from tensortrade.oms.instruments import ExchangePair, BTC, USD @mock.patch('tensortrade.exchanges.Exchange') def test_valid_init(mock_exchange): exchange = mock_exchange.return_value exchange.name = "bitfinex" exchange_pair = ExchangePair(exchange, USD/BTC) assert excha...
tensortrade-org/tensortrade
tests/tensortrade/unit/oms/instruments/test_exchange_pair.py
test_exchange_pair.py
py
670
python
en
code
4,270
github-code
1
7117312465
def zigzagTraverse(array): # Write your code here. height = len(array) -1 width = len(array[0]) -1 goingDown = True row, col = 0,0 result = [] while not outOfBound(row, col, height, width): result.append(array[row][col]) print(goingDown) print(row,col) if goi...
Theeyecode/python_alg
hard/zigzag_conversion.py
zigzag_conversion.py
py
1,075
python
en
code
0
github-code
1
31944164515
from Ferramentas_Producao.modules.dsgTools.processingLaunchers.processing import Processing from qgis import core, gui import processing class AssingFilterToLayers(Processing): def __init__(self, controller): super(AssingFilterToLayers, self).__init__() self.processingId = 'dsgtools:assignfilt...
dsgoficial/Ferramentas_Producao
modules/dsgTools/processingLaunchers/assingFilterToLayers.py
assingFilterToLayers.py
py
1,059
python
en
code
2
github-code
1
6257876376
# with open("weather_data.csv", mode="r") as weather_data: # weather = weather_data.readlines() # print(weather) # import csv # # with open("weather_data.csv", mode="r") as weather_data: # weather = csv.reader(weather_data) # temperatures = [] # print(weather) # for row in weather: # if row...
wintermute111/100DaysOfPython
Day025/pandas/main.py
main.py
py
1,665
python
en
code
0
github-code
1
21263148292
import time import os from copy import deepcopy from random import shuffle # Rouge = '\033[1;31;40m' # Rouge_2 = '\033[0;31;47m' # Bleu_2 = '\033[0;34;47m' # Jaune = '\033[1;33;40m' # Bleu = '\033[1;34;40m' # Magenta = '\033[1;35;40m' # Noir = '\033[0;30;40m' largeur = 12 hauteur = 6 ia = '...
SeYouri99/IA-Puissance-4
Puissance-4-Joueur-IA-TRAN-VAN-SIGAUD-SEMAAN-SERRO-1.py
Puissance-4-Joueur-IA-TRAN-VAN-SIGAUD-SEMAAN-SERRO-1.py
py
19,367
python
fr
code
0
github-code
1
15249763407
import os import numpy as np from typing import Tuple, Dict from nuscenes.utils.data_classes import Box, PointCloud, RadarPointCloud from nuscenes.utils.geometry_utils import view_points, transform_matrix from functools import reduce from pyquaternion import Quaternion # Taken from mrnabati/CenterFusion class Radar...
robot-learning-freiburg/Batch3DMOT
batch_3dmot/utils/radar.py
radar.py
py
6,959
python
en
code
28
github-code
1
14755303847
S=list(set(input().split(" "))) S.sort() print(" ".join(S)) '''S=input() c=[] L=list(S.split(' ')) L.sort() for i in L: if(i not in c): c.append(i) print(' '.join(c))'''
Simo0o08/Python-Assignment
Python assignment/Module 4/Sortword.py
Sortword.py
py
189
python
en
code
0
github-code
1
3156968114
import requests from bs4 import BeautifulSoup import sys import re def get_bullet_points_from_url(url, tag): response = requests.get(url) response.raise_for_status() soup = BeautifulSoup(response.text, 'html.parser') # Use regular expression to match the tag, regardless of surrounding whitespace ...
SamTheSapiel/BrowserPi
soup.py
soup.py
py
1,493
python
en
code
1
github-code
1
72202901155
import requests from bs4 import BeautifulSoup import csv import json class RokomaryBooks: __url = "" __data = "" __wlog = None __soup = None def __init__(self, url,wlog): self.__url = url self.__wlog = wlog def retrieve_webpage(self,x): try: ...
ahasanhamza/rokomaryScrapping
wapscrap/wscrap.py
wscrap.py
py
6,337
python
en
code
0
github-code
1
881795625
from django.shortcuts import render, get_object_or_404, redirect from .models import Usuario from .forms import UsuarioForm def inicio(request) : usuarios = Usuario.objects.all() context = { 'usuarios' : usuarios } return render(request, 'usuarios/inicio.html', context) def detail(request, id...
HugoMarquesz/cadastro_python
cadastro_python/usuarios/views.py
views.py
py
1,443
python
es
code
1
github-code
1
28141443246
# -*- coding: utf-8 -*- import os import math import pickle import numpy as np from tensorflow.python.keras.models import load_model from tensorflow.python.keras.models import Model from tensorflow.python.keras.layers import Input, Conv2D, MaxPooling2D, Dropout, Flatten, Dense from tensorflow.python.keras.prepr...
iwatake2222/CNN_NumberDetector
01_Keras/ConvMnist_from_image_files.py
ConvMnist_from_image_files.py
py
4,542
python
en
code
6
github-code
1
32192978673
from Component_py.stubs import require, __pragma__, document # __:skip from Component_py.component import destruct from store import users_store from containers.users import UsersContainer from containers.user_profile import UserProfileContainer from components.app import App from components.home import Home React =...
metamarcdw/react-redux-transcrypt
src/index.py
index.py
py
1,037
python
en
code
5
github-code
1
72603396195
# дескриптор хранит только числа, если нужно было не число import sys class Num: def __get__(self, obj, cls): try: return obj._value except: return 0 def __set__(self, obj, val): if hasattr(val, "__int__"): obj._value = val.conjugate() elif ...
hakenlaken/pythonprac
20201119_2/task2.py
task2.py
py
492
python
ru
code
1
github-code
1
34865004001
import numpy as np import torch import torch.nn as nn # mix up def mixup_data(x, y, alpha=0.4, device='cuda'): ''' Compute the mixup data. Return mixed inputs, pairs of targets, and lambda ''' if alpha > 0.: lam = np.random.beta(alpha, alpha) else: lam = 1. batch_size = x...
travisergodic/T-brain_STAS_Segmentation
utils.py
utils.py
py
2,220
python
en
code
6
github-code
1
7486708725
import sys,os from os import scandir, getcwd from os.path import abspath import cv2 import numpy as np import boto3 from botocore.client import Config def ls(ruta = getcwd()): return [abspath(arch.path) for arch in scandir(ruta) if arch.is_file()] #from google.colab.patches import cv2_imshow def draw_matches(img1...
geoinca/miniok
dockerimg/02warp2img.py
02warp2img.py
py
5,734
python
en
code
1
github-code
1
30341126186
import os """ Set up the repository to be found by the Python interpreter. Opens `.bashrc` and appends the repository's root directory to PYTHONPATH. """ print('setup...') repository_path = os.path.dirname(os.path.realpath(__file__)) bashrc_path = os.environ['HOME'] + '/.bashrc' print('appending {} to ~/.bashrc ......
lemcke/md_extraction_analysis
setup.py
setup.py
py
574
python
en
code
0
github-code
1
18534619427
import numpy as np import scipy.linalg as la import matplotlib.pyplot as plt import math as math L = 1 E_I = 1 nes = [5, 10, 100] nro_grupo = 18 def SOR(K, f, Imax, eps, u, omega): D = np.diag(np.diag(K)) M = np.dot((1 / omega), D) + np.tril(K, -1) N = M - K r = np.dot(K, u) - f x = u i = 0 ...
santiagoaso/numerico2018
tp1.py
tp1.py
py
3,328
python
en
code
0
github-code
1
15882561796
import csv headers = ['Symbol','Price','Date','Time','Change','Volume'] rows = [('AA', 39.48, '6/11/2007', '9:36am', -0.18, 181800), ('AIG', 71.38, '6/11/2007', '9:36am', -0.15, 195500), ('AXP', 62.58, '6/11/2007', '9:36am', -0.46, 935000), ] with open('she.csv', 'w') as f: f_csv = csv.w...
yutongytli/otree-test
likert/testing.py
testing.py
py
642
python
en
code
0
github-code
1
34543761509
def Assign(i, f, s, b): # Write your code here w=int(i) x=float(f) y=str(s) if(b=="True"): z=True else: z=False print(w,x,y,z,dir(),sep="\n")
ivansaji/TCS_Learning
python/Python/namespace.py
namespace.py
py
191
python
en
code
0
github-code
1
70342944994
import json import logging import os from .threads import terminating from .queueprocessor import QueueProcessor logger = logging.getLogger(__name__) BB_COVERAGE = 0 TB_COVERAGE = 1 class Coverage(QueueProcessor): def __init__(self): QueueProcessor.__init__(self) # Split Bb and Tb coverage for...
S2E/s2e-env
s2e_env/server/coverage.py
coverage.py
py
4,680
python
en
code
89
github-code
1
149190344
import unittest from nupic.research.frameworks.dendrites import AbsoluteMaxGatingDendriticLayer from nupic.research.frameworks.dendrites.routing import get_gating_context_weights from nupic.research.frameworks.dendrites.routing.hardcoded import ( run_hardcoded_routing_test, ) class HardcodedErrorTest(unittest.Te...
jem0101/BigSwag-SQA2022-AUBURN
TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/numenta@nupic.research/tests/unit/frameworks/dendrites/hardcoded_test.py
hardcoded_test.py
py
1,760
python
en
code
2
github-code
1
15247291297
# Abstract class defining the methods that any command or command group which # whishes to participate in a _composition_ must support class Composer(): def _optimizeCmdList(self, first,second, outType): from AutoSequencerV2.command import Command # pylint: disable=import-outside-toplevel cycli...
RobotCasserole1736/firstRoboPy
AutoSequencerV2/composer.py
composer.py
py
1,826
python
en
code
1
github-code
1
33844011901
import csp import time def easy_map(): variablelist = [] variablelist.append(((0,0),(1,0))) variablelist.append(((0,1),(0,2))) variablelist.append(((1,1),)) variablelist.append(((2,0),(2,1))) variablelist.append(((1,2),(2,2))) variabledict = {} variabledict[variablelist[0]] = (6,"*") ...
DimitrisMilonopoulos/KenkenCSP
kenken.py
kenken.py
py
9,652
python
en
code
0
github-code
1
25324472633
import asyncio as asy class asyncIter: def __init__(self): self.item = None self.itemSet = False self.cond = asy.Condition() self.stop = None def __aiter__(self): return self async def __anext__(self): cond = self.cond async with cond: while not self.itemSet: await cond.wait() if self.s...
8080509/GENERAL-PY
AsyncUtils.py
AsyncUtils.py
py
1,830
python
en
code
0
github-code
1
30040919497
import time import os import re import traceback import sys import getopt from os.path import exists from htmldocx import HtmlToDocx import random from xhtml2pdf import pisa from gazpacho import Soup from Md import Md from Cd import Cd class Main: RET_ERROR_INVALID_ARGS = 1 RET_ERROR_PARSING_ARGS = 2 RET_...
AndersonPaschoalon/MdConv
Main.py
Main.py
py
11,607
python
en
code
0
github-code
1
30742433737
participants = ['Alvin', 'Arno', 'Azula', 'Betty', 'Edgar', 'Martin', 'Melanie', 'Omari', 'Richard', 'Samuel'] # OK to include folks from last year not in this year last_years_pairs = [('Alvin', 'Richard'), ('Arno', 'Melanie'), ('Azula', 'Arno'), ('Betty', 'Samuel'), ('Edgar', 'Alvin'), ('Martin', 'Betty...
meonkeys/gift-exchange
data.py
data.py
py
566
python
en
code
0
github-code
1
38791965526
#!/usr/bin/env python # -*- coding: utf-8 -*- # ====================================================================================== # # ██╗ ███████╗███╗ ███╗ ██████╗ ███╗ ██╗███████╗ # ██║ ██╔════╝████╗ ████║██╔═══██╗████╗ ██║██╔════╝ # ██║ █████╗ ██╔████╔██║██║ ██║██╔██╗ ██║███████╗ # ██║ ...
benthevining/Lemons
util/doxygen/scripts/cmake/cmake_api.py
cmake_api.py
py
4,109
python
en
code
41
github-code
1
22504134069
import sys import heapq input = sys.stdin.readline def Prim(): mst = set() weight = 0 heap_q = [] heapq.heappush(heap_q, (0, 1)) while heap_q: cur = heapq.heappop(heap_q) if cur[1] in mst: continue mst.add(cur[1]) weight += cur[0] ...
Kminwo-o/BaekJoon-Algorithm
백준/Gold/1197. 최소 스패닝 트리/최소 스패닝 트리.py
최소 스패닝 트리.py
py
671
python
en
code
0
github-code
1
31420316602
from matplotlib import pyplot as plt from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn import metrics import numpy as np def best_forest(train_data, train_target, test_data, test_target): """ ...
DavidLee233/randomforest
randomforest2.py
randomforest2.py
py
3,091
python
en
code
0
github-code
1
4224515958
from personajesub import * class personaje: def __init__(self,numPersonaje): # para recibir el numero de personaje que vamos a llamar self.url= "https://swapi.co/api/people/" self.numPersonaje=numPersonaje url = "https://swapi.co/api/people/" + str(self.numPersonaje) response = reque...
odiazgon/ejercicioclases
personaje.py
personaje.py
py
1,063
python
es
code
0
github-code
1
2423327022
import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("survey_responses.csv") # index refers to number of people getting correct for (question-1) num_correct = [] for q_num in range(1,7): correct_q = 0 for person_num in range(len(df)): if df['PDDL Experience'][person_n...
reeceshuttle/966finalproject
analyze_survey_responses.py
analyze_survey_responses.py
py
1,655
python
en
code
0
github-code
1
8002736803
# -*- coding: utf-8 -*- """ @author: jungwonchang """ #intent_correct 자세히 보기 first_inferred_intent_final[i], intents[i] from readers.goo_format_reader import Reader from vectorizers.bert_vectorizer import BERTVectorizer from models.joint_bert import JointBertModel from utils import flatten from vectorizers.tags_vectori...
brudenell/capstonedesign
eval_joint_bert_allsents.py
eval_joint_bert_allsents.py
py
11,607
python
en
code
0
github-code
1
12647807283
def calculate_day_of_year(year, month, day): """ 计算给定日期 (年、月、日) 是这一年的第几天。 参数: year: 给定的年份,例如 2023。 month: 给定的月份,例如 1 或 2。 day: 给定的日期,例如 1 或 28。 返回值: 这一年的第几天,例如 1 表示第一天,31 表示最后一天。 """ # 将日期转换为 0 表示公元前,1 表示公元 year = int(year) month = int(mo...
EricaCarrie/my-project
calculate_day_of_year.py
calculate_day_of_year.py
py
1,045
python
zh
code
0
github-code
1
21483496951
import pandas as pd import csv import numpy as np class dataset: mobile = None steam = None def __init__(self): ''' load raw data from csv files ''' self.mobile = pd.read_csv('../data/appstore_games.csv') self.steam = pd.read_csv('../data/steam.csv') def process(self): ''' process raw data and sa...
stupidT/ECE143-WI2020-Group7
src/datafile.py
datafile.py
py
3,718
python
en
code
0
github-code
1
27957425720
import numpy as np from itertools import product import random class TicTacToe(): def __init__(self, N): self.coords_list = [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]] self.alpha = 0.1 self.initialize_V() self.eps = 0.1 self.games_won = 0 ...
mjauza/AI_reinforcement_learning
tic-tac-toe.py
tic-tac-toe.py
py
9,383
python
en
code
0
github-code
1
40162630815
# -*- coding: utf8 -*- #------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: glycine # # Created: 13/01/2013 # Copyright: (c) glycine 2013 # Licence: <your licence> #--------------------------------------------------------...
glycine/autoEncode
src/splitTs.py
splitTs.py
py
10,355
python
en
code
1
github-code
1
39515075186
from synapse_pay_rest.models.nodes import * from synapse_pay_rest import User from synapse_pay_rest import Client from synapse_pay_rest import Node from synapse_pay_rest import Transaction from lib.wyre import wyre import logging, graypy import os, json import threading from requests import get from pymongo import Mong...
todinhtan/vba_creator
create_transfer_queue.py
create_transfer_queue.py
py
5,797
python
en
code
0
github-code
1
22296950181
from xml.etree.ElementTree import Element, SubElement, tostring import os mapLocal = Element('mapLocal') toolEnabled = SubElement(mapLocal, 'toolEnabled') toolEnabled.text = 'true' mappings = SubElement(mapLocal, 'mappings') webuiPath = '/Users/Ethan/QAD/src/service/webui/erp-service-webui' resourceRelativePath = '/s...
putin266/worktools
localMapGen/gen.py
gen.py
py
1,530
python
en
code
0
github-code
1
34856065220
import seaborn as sns import os import pandas as pd from IPython.display import Image import json import numpy as np import natsort from google.colab.patches import cv2_imshow import cv2 import warnings warnings.filterwarnings("ignore") import matplotlib.pyplot as plt from mtcnn import MTCNN def get_video_Path(video...
khoatran02/Liveness_detection
crop_face.py
crop_face.py
py
5,738
python
en
code
0
github-code
1
15971175771
from base import BasicCalculation, Input from aiida.orm import DataFactory class NscfCalculation(BasicCalculation): ''' Runs VASP with precalculated (from scf run) wave functions and charge densities. Used to obtain bandstructures, DOS and wannier90 input files. ''' charge_density = Input(types='v...
greschd/aiida-vasp
aiida/orm.calc.job.vasp/nscf.py
nscf.py
py
5,256
python
en
code
null
github-code
1
19025286012
from pprint import pprint import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.metrics import roc_auc_score, r2_score, f1_score, recall_score, precision_score from sklearn.model_selection import TimeSeriesSplit from imblearn.over_sampling import...
vcerqueira/actionable_forecasting
experiments/forecasting_extremes.py
forecasting_extremes.py
py
5,070
python
en
code
0
github-code
1
73948947872
# -*- coding: utf-8 -*- """ Created on Fri Nov 6 16:45:52 2020 @author: gumcbrid """ import os import numpy as np import matplotlib.pyplot as plt import time import sys import logging sys.path.append(r'C:\Program Files (x86)\Keysight\SD1\Libraries\Python') import keysightSD1 as key import pulses as pulseLab impor...
GuyMcBride/KeysightQuadLO
QuadLO.py
QuadLO.py
py
19,243
python
en
code
0
github-code
1
31348168038
import pandas as pd import numpy as np import tensorflow as tf import random import keras from keras.callbacks import EarlyStopping from keras import optimizers import matplotlib.pyplot as plt # read training data print("Reading data...") trainingData_RAW = pd.read_csv("optdigits/optdigits.tra",dtype = np.int32, hea...
jhtrzcinski/NN_Sandbox
Lab2_convoluted.py
Lab2_convoluted.py
py
4,477
python
en
code
1
github-code
1