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
10058551191
import numpy as np from scipy.integrate import solve_ivp class VanDerPolOscillator: def __init__(self, epsilon): self.epsilon = epsilon def coupledEquation(self, t, x): x1 = x[0] x2 = x[1] fx1 = x2 fx2 = -x1 - (self.epsilon * ((x1 ** 2) - 1) * x2) return np.arr...
MFournierQC/PhysiqueNumerique
TP3/VanDerPolOscillator.py
VanDerPolOscillator.py
py
685
python
en
code
0
github-code
36
1900770945
# -*- coding: utf-8 -*- """ Created on Tue Dec 5 21:43:03 2017 @author: ly """ import numpy as np import pandas as pd import os import seaborn as sns # data visualization library import matplotlib.pyplot as plt import xgboost as xgb import math from sklearn import metrics from sklearn.model_selection import KFold f...
LiuyangJLU/Dementia
1205test.py
1205test.py
py
7,023
python
en
code
0
github-code
36
2894349509
from typing import Dict from src.property.PropertyFactory import PropertyFactory from src.storage.common.entity.Entity import Entity from src.template.entity.EntityTemplate import EntityTemplate class EntityFactory: def __init__(self, entity_template: EntityTemplate): self.entity_template = entity_templ...
andreyzaytsev21/MasterDAPv2
src/storage/common/entity/EntityFactory.py
EntityFactory.py
py
714
python
en
code
0
github-code
36
24212631697
tc = int(input()) for _ in range(tc): # 금광 행렬 정보 입력 받음 n, m = map(int, input().split()) # 매장된 금의 개수 정보 입력 받음 data = list(map(int, input().split())) # matrix, arr 초기화 => tc for문 2번째 돌 때 초기화 상태여야함 dp = [] arr = [] # 매장된 금의 개수 정보를 matrix로 표현 for i in range(n*m): ...
031wnstjd/Algorithm
이것이 취업을 위한 코딩 테스트다 with 파이썬/다이나믹프로그래밍/금광 문제.py
금광 문제.py
py
1,382
python
ko
code
0
github-code
36
73037033705
import pathlib import sys import typing import flash import flash.image import pytorch_lightning import torch import torchmetrics import torchvision import enpheeph import enpheeph.injections.plugins.indexing.indexingplugin CURRENT_DIR = pathlib.Path(__file__).absolute().parent RESULTS_DIRECTORY = CURRENT_DIR / "re...
Alexei95/enpheeph
papers/iros2022/comparisons/tensorfi2/alexnet-cifar10.py
alexnet-cifar10.py
py
13,471
python
en
code
1
github-code
36
27884844846
import sys, os, string, random, psycopg2, sqlite3 from sqlalchemy import Column, ForeignKey, Integer, String, DateTime, Float, Boolean, Text from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker, backref, scoped_session from sqlalchemy import create_engine from s...
ryanwaite28/cmsc-495-project-backend
models.py
models.py
py
10,173
python
en
code
0
github-code
36
70192147944
t = xr.open_dataset('C:/Users/rober/Downloads/hawaii_soest_794e_6df2_6381_6464_6c66_07de.nc') # global netcdf file # split up around -180 dsEast = t.sel(longitude=slice(-180,-150)) dsWest = t.sel(longitude=slice(150,180)) # revise longitude labels dsWest['longitude2'] = dsWest.longitude-360 dsWest = dsWest.swap_dims({...
leviner/rltools
akMaps/subsetEtopo.py
subsetEtopo.py
py
785
python
en
code
2
github-code
36
5798683173
import pygame from SupportFuncs import load_image class URadioButtons(pygame.sprite.Sprite): def __init__(self, screen, coords, group): super(URadioButtons, self).__init__(group) self.coords = coords self.buttons = [] self.checked_button = 0 self.font = pygame.font.Font('fo...
musaewullubiy/BigTaskMapAPI
UTINGAME.py
UTINGAME.py
py
6,461
python
en
code
0
github-code
36
7573547861
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ import math MSS = 1440 INIT_CWND = 10 QSIZE = 20 #In packets DEF_RTT = 20 #In ms DEF_RATE = 12 #Mbps def get_log_fct(rtt, rate, flow_sz): #Get FCT estimation using log-based calculations dict_fct = {} initcwnd = INIT_CWND*MSS dict_...
eweyulu/tcp-fct
log.py
log.py
py
1,123
python
en
code
1
github-code
36
74574329062
# -*- coding: utf-8 -*- # # Author: Ingelrest François (Francois.Ingelrest@gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any...
gabrielmcf/biel-audio-player
src/modules/StatusIcon.py
StatusIcon.py
py
8,708
python
en
code
0
github-code
36
1065889096
import numpy as np import matplotlib.pyplot as plt import sys def h(X, theta): return 1 / (1 + np.e ** -(X.dot(theta.T))) def J(X, y, theta): m = X.shape[0] y_hat = h(X, theta) erro = (-y * np.log(y_hat) - (1-y) * np.log(1-y_hat)).sum(0) return erro / m def GD(X, y, theta, alpha, niters): m = X.shape[0] cos...
brunoprograma/machine_learning
aula_03/LRegression.py
LRegression.py
py
1,934
python
en
code
0
github-code
36
788517980
import os, gtts, PIL, praw, PIL.Image, PIL.ImageDraw, PIL.ImageFont, moviepy.editor, shutil class program: #the main class class output: #the class for controlled stdout within the program outputEnabled = True #controls whether or not to print controlled output lines def print(string) -> None:...
renamedquery/automatic-askreddit-video-maker
video-maker.py
video-maker.py
py
10,898
python
en
code
1
github-code
36
3647124333
import commands import sys sys.path.append('../../') import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") import django django.setup() path = os.getcwd() pangu_info = "/".join([path,"mysite/config/ecs_pangu.txt"]) def parse_srv_status(): oss_srv_stat = {} ret = [] pangu_srv_...
luvensin/privateCloudMonitor
mysite/mysite/config/parse_data_ecs_pangu.py
parse_data_ecs_pangu.py
py
689
python
en
code
0
github-code
36
39156539433
import re import sys from collections import namedtuple, Counter, OrderedDict from operator import itemgetter from math import log from Bio import SeqIO from RecBlast import print, merge_ranges from RecBlast.Search import id_search from itertools import chain, islice import mygene from pathlib import Path from RecBlast...
docmanny/RecSearch
RecBlast/Auxilliary.py
Auxilliary.py
py
40,401
python
en
code
4
github-code
36
3585805775
''' Created on Dec 26, 2016 @author: Anuj ''' import scramblingModule import sys ip_file_name = input("Enter File name(Specify full path of file if it is not in current directory) : ") try : print("Output File : ",scramblingModule.WordScrambling().scrambleFile(ip_file_name)) except : print(sys.exc_i...
anujpatel2809/Word-Scrambling
wordscrambling/wordscrambling.py
wordscrambling.py
py
340
python
en
code
0
github-code
36
37711710841
def cekPalindrom(mystr): newstr=mystr[::-1] if mystr == newstr: return newstr,True else: return newstr,False def main(): mywords=input('Masukkan kata: ') newwords,palindrom=cekPalindrom(mywords) print('\ninput:',mywords,'\noutput:',newwords,'\nPalindrom:',palindrom,'\n') if __name__ == '__main__':...
adnanhf/Basic-Programming-Algorithm
Modul-5-Sequence Data Type/Number-4.py
Number-4.py
py
330
python
en
code
1
github-code
36
21477469223
num = input() length = len(num) ans = 0 if num[:2] == '0x': for i in range(2, length): digit = num[i] if digit.isalpha(): digit = ord(num[i]) - 87 ans += int(digit) * (16 ** (length-i-1)) print(ans) elif num[0] == '0': for i in range(1, length): ans += int(num[i...
Minsoo-Shin/jungle
ps_after/boj_11816.py
boj_11816.py
py
388
python
en
code
0
github-code
36
14918571499
from pyspark import SparkConf, SparkContext from pyspark.streaming import StreamingContext from pyspark.streaming.kafka import KafkaUtils from cassandra.cluster import Cluster import signal # if (contents.length > 0 && !contents[0].equalsIgnoreCase("year") && !contents[18].equalsIgnoreCase("1")) { # String origin ...
karthikBG/AviationAnalytics
SparkStreaming/2.1.TopAirlinesByAirport.py
2.1.TopAirlinesByAirport.py
py
3,139
python
en
code
0
github-code
36
73583266345
import phunspell import inspect import unittest class TestSqAL(unittest.TestCase): pspell = phunspell.Phunspell('sq_AL') def test_word_found(self): self.assertTrue(self.pspell.lookup("katërpalëshe")) def test_word_not_found(self): self.assertFalse(self.pspell.lookup("phunspell")) de...
dvwright/phunspell
phunspell/tests/test__sq_AL.py
test__sq_AL.py
py
615
python
en
code
4
github-code
36
5075129662
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = "wu zhi bin" # Email: wuzhibin05@163.com # Date: 2021/8/26 """ 3.用map来处理字符串列表,把列表中所有人都变成sb,比方alex_sb name=['alex','wupeiqi','yuanhao','nezha'] """ # 方法一 # name = ['alex', 'wupeiqi', 'yuanhao', 'nezha'] # # def add_str(x): # return x + "_sb" # ret = map(...
Wuzhibin05/python-course
Course/Section-1/day16/code/pratice.py
pratice.py
py
2,270
python
zh
code
0
github-code
36
19154199672
import os import unittest import numpy as np from total_scattering.file_handling.load import load from total_scattering.file_handling.save import save_banks, save_file from tests import EXAMPLE_DIR, TEST_DATA_DIR from mantid.simpleapi import mtd, \ LoadNexusProcessed, LoadAscii, ConvertToHistogram class TestSav...
ckendrick/mantid_total_scattering
tests/file_handling/test_save.py
test_save.py
py
4,281
python
en
code
null
github-code
36
14355032478
import re f= open('payload3.js').read() g = open('payload4.js', 'w') v = open('payload4_vars.js', 'w') vars = {} def cb(m): name=m.group(1).strip() x = m.group(2).strip() vars[name] = x return '_'+name+'_' for x in range(0x100): reg = r'\bn%d\b'%x f = re.sub(reg, str(x), f) f = re.sub(r'EXPR...
niklasb/34c3ctf-sols
fuckbox/solve2.py
solve2.py
py
693
python
en
code
22
github-code
36
11294428652
import tkinter as tk from tkinter import ttk # def createTreeView(frame, columns, height=15): # tree = ttk.Treeview(frame, columns=columns, show='headings', height=height) # tree.tag_configure('odd', background='gainsboro') # tree.heading('#1', text='武将名') # tree.heading('#2', text='部队属性') # tree....
WeiCaoMelbourne/keyboard
modules/tv_funcs.py
tv_funcs.py
py
774
python
en
code
0
github-code
36
42242964730
import numpy as np import bead_util as bu import matplotlib.pyplot as plt import os import scipy.signal as sig import scipy import glob from scipy.optimize import curve_fit import cant_util as cu data_dir1 = "/data/20170831/image_calibration2/align_profs" data_dir2 = "/data/20170831/image_calibration2/align_profs"...
charlesblakemore/opt_lev_analysis
scripts/camera_analysis/align_image.py
align_image.py
py
3,689
python
en
code
1
github-code
36
28224798976
""" Given a list of numbers, calculate another list in which i_th element is the product of all numbers in the list except the original i_th element. """ from functools import reduce from typing import List def solution_1(input_nums: List[int]) -> List[int]: """Calculate the result list via the first solution.""...
HomayoonAlimohammadi/Training
DailyProblem/19_6_2022.py
19_6_2022.py
py
1,176
python
en
code
2
github-code
36
11238933952
# authomatic Nudget Elastic Band Method (NEB) for vacancy migration energy barrier with LAMMPS # Stefano Segantin # Politecnico di Torino # ---------- DISCUSSION ------------------------------------------------------------------------------------------------ # this routine relies on the assumption that the positi...
shortlab/2022-PEL-Heterogeneity-VCr-TaW
MEB/NEB_Vacancy.py
NEB_Vacancy.py
py
3,924
python
en
code
0
github-code
36
31012134032
from django.db import connection def ingredient_name_and_amount_query(receipt_id): with connection.cursor() as cursor: cursor.execute(f"SELECT ingredient_calories.ingredient_name, receipt_ingredient.amount, receipt_ingredient.amount_type \ FROM receipt_ingredient \ ...
ravityeho/recipes
recipes_and_more_app/custom_queries.py
custom_queries.py
py
2,179
python
en
code
0
github-code
36
18045957332
import numpy as np from random import randrange from backend.rl_base_classes.mp_base_classes import FPATrimsAndTurns, MovingTargetFPATrimsAndTurns from backend.rl_environments import DiscreteEnv from backend.base_aircraft_classes.target_classes import MovingTarget def run_actions(_initial_state, _env, _actions, plot...
hmdmia/HighSpeedRL
model_testing/test_mp_base_classes.py
test_mp_base_classes.py
py
1,291
python
en
code
0
github-code
36
70786900903
import copy, re from django.core import validators from django.core.exceptions import ImproperlyConfigured, ValidationError from django.utils.deconstruct import deconstructible from django.utils.translation import gettext_lazy as _ __all__ = ['EmptyValidator', 'KeysValidator', 'MD5ChecksumValidator'] class EmptyVal...
davidfischer-ch/pytoolbox
pytoolbox/django/core/validators.py
validators.py
py
2,541
python
en
code
38
github-code
36
75006697064
from .models import TodoModel from django import forms class TodoForm(forms.ModelForm): class Meta: model = TodoModel fields = '__all__' labels ={ 'subject':'', 'details':'', } widgets = { 'subject': forms.TextInput(attrs={...
SalmanMirSharin/Django-ToDo-App
todo/forms.py
forms.py
py
611
python
en
code
0
github-code
36
27971059344
from bs4 import BeautifulSoup from urllib.request import urlopen,Request,urlretrieve,build_opener,install_opener import os import random from main.models import Post,Images from django.core.files import File from django.contrib.auth.models import User from main.categories import user_agent_list class ScrapeFunction: ...
itfidele/Bhano-Blog
operations/scrape.py
scrape.py
py
6,352
python
en
code
1
github-code
36
74140233385
s=input() s=' '+s n=int(input()) for k in range(n): query=list(map(int,input().split())) i=query[0] j=query[1] count=0 for t in range(i+1,j+1): if s[t]==s[t-1]: count+=1 print(count)
fahadnayyar/Codeforces
cf/313btry.py
313btry.py
py
195
python
en
code
0
github-code
36
16159941777
import asyncio import atexit import logging import os import signal import subprocess import time import supriya.exceptions logger = logging.getLogger("supriya.server") class ProcessProtocol: def __init__(self): self.is_running = False atexit.register(self.quit) def boot(self, options, scsy...
MusicAsCode/supriya
supriya/realtime/protocols.py
protocols.py
py
4,257
python
en
code
null
github-code
36
43418734139
import findspark findspark.init() from operator import add from pyspark import SparkContext from pyspark.sql import SparkSession from pyspark.sql.types import IntegerType from pyspark.sql import * if __name__ == "__main__": spark = SparkSession \ .builder \ .appName("q4") \ .g...
saitejapeddi/pyspark
q4.py
q4.py
py
1,671
python
en
code
0
github-code
36
27218739066
num = int(input("임의의 자연수를 입력하시오. ")) is_prime = True if num > 0 : for i in range(2,num) : if num % i == 0 : is_prime = False else : print("자연수가 아닙니다.") if is_prime : print("소수입니다.") else : print("소수가 아닙니다.") num = int(input("어디까지 소수를 출력할까요? ")) for i in range(4,num...
pithecuse527/python-practice
Ch.4/is_prime.py
is_prime.py
py
561
python
ko
code
0
github-code
36
2153719879
#!/usr/bin/env python # coding: utf-8 """ https://leetcode.com/submissions/detail/86181181/ """ def longest_common_prefix(strs): """ :type strs: List[str] :rtype: str """ if len(strs) == 0: return '' if len(strs) == 1: return strs[0] p = strs[0][:] for i in xrange(1,...
lizzz0523/algorithm
python/longest_common_prefix/main.py
main.py
py
598
python
en
code
4
github-code
36
27452373548
import json import os import re import sys class Request(object): def __init__(self, getenv=os.getenv): self.getenv_ = getenv self.populate_options_() self.populate_args_() if sys.stdin.isatty() == False: self.input = json.load(sys.stdin) else: self.i...
operable/pycog3
cog/request.py
request.py
py
1,830
python
en
code
3
github-code
36
1098849667
import logging import traceback import psycopg2 from django.db import IntegrityError from apps.fyle_expense.models import Expense, ExpenseGroup from apps.task_log.exceptions import MissingMappingsError from apps.task_log.models import TaskLog from apps.xero_workspace.models import EmployeeMapping, CategoryMapping, Pr...
akshay-codemonk/fyle-xero
apps/task_log/tasks.py
tasks.py
py
10,343
python
en
code
0
github-code
36
30503083715
#!/usr/bin/env python # _*_ coding: utf-8 _*_ import os import shutil import argparse """ for i in `find . -maxdepth 1 | awk -F '/' '{ print $2 }' | grep -v "\ "`; do echo "-----------------------------------------$i---------------------------------"; python gen_dao.py --dir=$i ; done 可自动生成dao文件,并移动到pu...
feng1o/python_1
tx_add/gen_dao.py
gen_dao.py
py
3,263
python
en
code
1
github-code
36
6347327566
import numpy as np import torch from homan.utils.nmr_renderer import OrthographicRenderer, PerspectiveRenderer import neural_renderer as nr def visualize_perspective(image, predictions, K=None): perspect_renderer = PerspectiveRenderer(image_size=max(image.shape)) new_image = image.copy() # 2 * factor to ...
hassony2/homan
homan/visualize.py
visualize.py
py
5,329
python
en
code
85
github-code
36
9322300717
# fit a second degree polynomial to the economic data from numpy import arange,sin,log,tan from pandas import read_csv from scipy.optimize import curve_fit from matplotlib import pyplot # define the true objective function def objective(x): return 0.01006304431397636*sin(0.009997006528342673*x+0.010000006129223197)+0...
atul1503/curve-fitting
Custom_Function_Graph_Plotter_without_curve_fit.py
Custom_Function_Graph_Plotter_without_curve_fit.py
py
907
python
en
code
0
github-code
36
41260980135
from geometry_msgs.msg import Twist import pyzbar.pyzbar as pyzbar from datetime import datetime import pyrealsense2 as rs import numpy as np import schedule import rospy import time import cv2 frame_crop_x1 = 0 frame_crop_y1 = 120 frame_crop_x2 = 639 frame_crop_y2 = 479 minLineLength = 30 maxLineGap = 15 speed = 0 ...
LEEJUNHO95/ROS_project
line_detect.py
line_detect.py
py
8,101
python
en
code
5
github-code
36
70153811305
# -*- coding: utf-8 -*- from django.http import HttpResponse, JsonResponse from django.views.decorators.csrf import csrf_exempt from rest_framework.renderers import JSONRenderer from rest_framework.parsers import JSONParser from employee.models import Employee from employee.serializers import employee_serializer # Cre...
borgessouza/DjangoLabs
employee/views.py
views.py
py
2,429
python
en
code
0
github-code
36
41237480224
from fastapi import FastAPI, APIRouter, HTTPException, status from pydantic import BaseModel,json from api.settings import base_url import pandas as pd import requests import json from typing import List, Optional from routers.users import user_login import datetime vehicle_router = APIRouter(tags=["Veh...
deryacortuk/FastAPI-Pandas
routers/vehicles.py
vehicles.py
py
4,489
python
en
code
0
github-code
36
3459125677
class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead. """ length1 = len(nums1) - 1 i = m - ...
pi408637535/Algorithm
com/study/algorithm/other/Merge Sorted Array.py
Merge Sorted Array.py
py
1,039
python
en
code
1
github-code
36
72663792744
# mypy: ignore-errors import streamlit as st from bokeh.models import CustomJS from bokeh.models.widgets import Button from streamlit_bokeh_events import streamlit_bokeh_events REC_GIF = "ai_talks/assets/icons/rec_on.gif" def get_js_code(lang: str) -> str: return """ var value = ""; var rand = 0...
dKosarevsky/AI-Talks
ai_talks/src/utils/stt.py
stt.py
py
3,457
python
en
code
243
github-code
36
20157817247
from database import * class invitados(object): idInvitado = None nombre_invitado = None apellido_invitado = None descripcion = None url_imagen = None @staticmethod def cargar(id): info = Database().run("Select * FROM invitados WHERE idInvitado = '%s'" %(id)) invitado = i...
politecnicomodelopoo2018/ProyectoWeb-Albisetti
class_invitados.py
class_invitados.py
py
1,644
python
es
code
0
github-code
36
1806212132
from __future__ import annotations import asyncio import concurrent.futures import dataclasses import functools import logging import os import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import formatdate, make_msgid import jinja2 from .. import scra...
janLo/punkow
punkow/service/mailer.py
mailer.py
py
4,021
python
en
code
0
github-code
36
21367017821
''' Link: https://www.lintcode.com/problem/722 ''' # Slightly modified from the solution from jiuzhang.com. Uses trie. Has O(n) time complexity, where n is the length of the array. # It makes use of trie data structure, which makes string retrieval and comparison efficient. Otherwise it would be O(n^2). class TrieNo...
simonfqy/SimonfqyGitHub
lintcode/super/722_maximum_subarray_vi.py
722_maximum_subarray_vi.py
py
1,936
python
en
code
2
github-code
36
9055011719
from mysql.connector.errors import DatabaseError, ProgrammingError from addData.add_data import add_user_data from create_connection import get_cursor from viewStatsClient.ask_batter_stats import ask_batter from viewStatsClient.ask_game_queries import ask_game from viewStatsClient.ask_pitcher_stats import ask_pitcher ...
SidhaantAnand/MLB-Analysis
MLB.py
MLB.py
py
2,609
python
en
code
0
github-code
36
3201757332
from flask import * from Graph import * from AStar import * app = Flask(__name__) ''' Routers ''' # Route to index @app.route('/') def index(): return render_template('index.html') @app.route('/compute',methods=['POST']) def compute(): data = request.data dataDict = json.loads(data) # Dokumentasi P...
wildansupernova/AStar-Algorithm-with-Google-Maps-API
src/app.py
app.py
py
4,062
python
id
code
0
github-code
36
6771451793
# 1072 import sys import decimal input = sys.stdin.readline def get_victory_percent(x, y): # return int(y/x * 100) return y * 100 // x # 부동소수점 오차로 인해 해당 return 문에 대해서만 정답 처리가 됨. # int( / ) 와 // 의 차이를 이해해야 할듯 하다. # python float 다룰 때 주의! # 1. 게임 횟수 x, 이긴 게임 수 y, 승률 z x, y = map(int, input().spli...
chajuhui123/algorithm-solving
BOJ/이진탐색/230113_게임.py
230113_게임.py
py
1,691
python
ko
code
0
github-code
36
3310605398
import torch import torch.nn as nn import torch.nn.functional as F class Block(nn.Sequential): def __init__(self, in_planes, out_planes, args): super(Block, self).__init__() self.x5_block = nn.Sequential( nn.Conv2d(in_channels=64, out_channels=64, kernel_size=(3, 3), padding=1, bias=Fa...
uday96/EVA4-TSAI
S15/models/quiz_dense.py
quiz_dense.py
py
4,240
python
en
code
1
github-code
36
6911964039
from os.path import dirname, realpath, join import time from datetime import datetime from rich import box from rich.table import Table from rich.console import Console SCRIPT_PATH = dirname(realpath(__file__)) class Results: RESULTS_PATH = "results" def __init__(self, results_name: str): self.metho...
huridocs/pdf_metadata_extraction
src/performance/Results.py
Results.py
py
2,170
python
en
code
2
github-code
36
70606645225
import os import sys # 在linux会识别不了包 所以要加临时搜索目录 curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) import execjs import time from datetime import datetime import pandas as pd import requests import json import akshare as ak def get_var(): ''' 获取js...
cgyPension/pythonstudy_space
05_quantitative_trading_hive/util/同花顺自选股.py
同花顺自选股.py
py
5,988
python
en
code
7
github-code
36
25717509151
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator from datapipelines import ( DataSource, PipelineContext, Query, NotFoundError, validate_query, ) from .common import KernelSource, APINotFoundError from ...data import Platform from ...dto.thirdpartycode import VerificationS...
meraki-analytics/cassiopeia
cassiopeia/datastores/kernel/thirdpartycode.py
thirdpartycode.py
py
3,374
python
en
code
522
github-code
36
3849164917
# bottom-up solution def coin_change_bottomup(coins, value): min_coins = [0] + [None] * (value - 1) for v in range(1, value): if v < min(coins): pass else: options = [] for i in range(len(coins)): if v >= coins[i]: ...
theRealAndyYang/FIT2004-Algorithm-and-Data-Structure
Week 5/tute5code/problem1.py
problem1.py
py
1,244
python
en
code
5
github-code
36
16182812319
import boto3 class S3: def __init__(self, aws_access_key_id, aws_secret_access_key): self.s3_client = boto3.client( 's3', aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) self.s3 = boto3.resource( 's3', aw...
satishvis/s3test
s3_demo.py
s3_demo.py
py
1,544
python
en
code
0
github-code
36
17991705417
import pandas as pd import numpy as np from prediction2 import create_model, evaluate_model from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier from sklearn.grid_search import GridSearchCV def get_data(): df = pd.read_csv("data/cl...
dbluiett/more_than_gut
project/customer_preds.py
customer_preds.py
py
3,594
python
en
code
4
github-code
36
26350089653
import libtcodpy as libtcod import math import globals as g class Item: def __init__(self, use_function=None): self.use_function = use_function # an item that can be picked up and used. def pick_up(self, objects): # add to the player's inventory and remove from the map if len(g.i...
DenSev/snakes-in-dungeon
objects.py
objects.py
py
13,268
python
en
code
0
github-code
36
74965781222
#!/usr/bin/env python3 class Class: def __init__(self,classId,name,teacherId): if id is None: self.id = 0 else: self.id = id self.classId = classId self.name = name self.teacherId = teacherId @staticmethod def createClass(obj): list =...
isibol98/Python---MySQL
school-app/class1.py
class1.py
py
417
python
en
code
0
github-code
36
3156914931
import math vezes = int(input()) cont = 0 while cont < vezes: entrada = int(input()) contaDivisores = 0 raiz = int(math.sqrt(entrada)+1) for i in range(1, raiz): if entrada % i == 0: contaDivisores += 1 if contaDivisores > 1: print("Not Prime") else: print("Prime") cont += 1
MarceloBritoWD/URI-online-judge-responses
Matemática/1221.py
1221.py
py
300
python
pt
code
2
github-code
36
36515561991
# -*- coding: utf-8 -*- """ Created on Mon Nov 11 10:11:41 2019 @author: Mohammed """ from sklearn import datasets from sklearn import metrics from sklearn import linear_model from sklearn import svm from sklearn import model_selection import matplotlib.pyplot as plt def main(): digits = datasets.load_digits() ...
mjachowdhury/MachineLearning-4thYear-CIT
Lab6/lab6.py
lab6.py
py
1,564
python
en
code
0
github-code
36
7989155548
import numpy as np import cv2 import time import math from visual import * import visual as vs # for 3D panel import wx # for widgets capture = cv2.VideoCapture(1) def nothing(x): pass ####### TRACKBAR ######### #cv2.namedWindow('bar') #cv2.createTrackbar('R','bar',0,255,nothing) #cv2.createT...
samuelamico/PingPongOpenCV
ball_detect.py
ball_detect.py
py
4,564
python
en
code
0
github-code
36
70173864105
import os import re from typing import Any, Iterable, List from flask import Flask, request from werkzeug.exceptions import HTTPException app = Flask(__name__) BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DATA_DIR = os.path.join(BASE_DIR, "data") class CustomBadRequest(HTTPException): status_code = 40...
IgorVolokho99/LESSON_24_HomeWork
app.py
app.py
py
1,798
python
en
code
0
github-code
36
11230963388
import torch import torch.nn as nn import torch.optim as optim import torchvision.models as models import torchvision.datasets as datasets import torchvision.transforms as transforms # 加载数据集 transform = transforms.Compose([transforms.Resize(256), transforms.CenterCrop(224), ...
rainy2k/deep-learning
transfer_learning.py
transfer_learning.py
py
2,427
python
en
code
0
github-code
36
1429692832
import sys import math def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True x = int(input()) if x == 2: print(x) sys.exit() for i in range(x, 10**5+4): if i % 2 == 1 and is_prime(i): print(i) ...
nawta/atcoder_archive
atcoder.jp/abc149/abc149_c/Main.py
Main.py
py
338
python
en
code
0
github-code
36
1963001410
from django.conf.urls import include, url from django.urls import reverse from django.utils.html import format_html from django.utils.translation import ugettext from wagtail.admin.rich_text.editors.draftail import features as draftail_features from wagtail.core import hooks from . import urls from .richtext import (...
cividi/wagtail-draftail-snippet
wagtail_draftail_snippet/wagtail_hooks.py
wagtail_hooks.py
py
2,730
python
en
code
null
github-code
36
27193939959
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys import gzip import logging import argparse from collections import OrderedDict LOG = logging.getLogger(__name__) __version__ = "1.0.1" __author__ = ("Xingguo Zhang",) __email__ = "invicoun@foxmail.com" __all__ = [] def read_tsv(file, sep...
zxgsy520/metavirus
scripts/stat_mpa_tax.py
stat_mpa_tax.py
py
2,401
python
en
code
1
github-code
36
71054390185
import data_pipeline as dp import glob import numpy as np import pandas as pd import os import shutil import matplotlib.pyplot as plt from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array, array_to_img ## Global Parameters IMG_WIDTH=300 IMG_HEIGHT=300 IMG_DIM = (IMG_WIDTH, IMG_HEIGHT) def...
luke-truitt/learn-together-model
data_preprocessing.py
data_preprocessing.py
py
3,735
python
en
code
0
github-code
36
18699363715
#encoding=utf-8 from __future__ import unicode_literals import sys sys.path.append("../") import Terry_toolkit as tkit # data=tkit.Json(file_path="/mnt/data/dev/tdata/知识提取/chinese/test.json").auto_load() # for it in data: # print(it) import json # json.load()函数的使用,将读取json信息 file = open('/mnt/data/dev/tdata/知识提...
napoler/Terry-toolkit
test/ttjson.py
ttjson.py
py
851
python
en
code
0
github-code
36
41681015503
# -*- coding: utf-8 -*- """ Created on Mon Dec 7 21:06:54 2020 @author: ASTRA """ f = open("address.txt","w") n = 10000 n_2 = 0 n_1 = 1 current = 1 for x in range(2, n+1): current = n_2 + n_1 n_2 = n_1 n_1 = current print(str(id(current)),file=f)
sysu18364125/os-assignment2
trace.py
trace.py
py
275
python
en
code
0
github-code
36
14919631267
#!/usr/bin/env python # This file is part of fdsgeogen. # # fdsgeogen is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # fdsgeogen is...
FireDynamics/fdsgeogen
scripts/fgg_run_jureca.py
fgg_run_jureca.py
py
3,900
python
en
code
11
github-code
36
35386786784
#!/usr/bin/python3 #import TAlight dove collocare le funzioni scritte una volta per tutte a bagaglio comune dei problemi. import sys import yaml import argparse from colorama import init init() #from termcolor import cprint parser = argparse.ArgumentParser(description="evaluate one single submission file (the stream ...
romeorizzi/TALight
example_problems/tutorial/tiling_mxn-boards_with_1x2-boards/services/eval_submission.py
eval_submission.py
py
10,376
python
en
code
11
github-code
36
31114009708
import os import fnmatch def coroutine(func): def start(*args,**kwargs): g = func(*args,**kwargs) g.next() return g return start @coroutine def find_files(target): while True: topdir,pattern = (yield) for path,dirname,filelist in os.walk(topdir): for name in filelist: if fnmatch.fnmatch(name.patte...
saisai/python_tutorial
python/coroutine_stream.py
coroutine_stream.py
py
995
python
en
code
0
github-code
36
2410926756
from django.contrib import admin from db_file_storage.form_widgets import DBAdminClearableFileInput from django import forms from .models import Kid, Photo, PhotoFile admin.site.site_header = "Administración del sitio" admin.site.site_title = admin.site.site_header class PhotoForm(forms.ModelForm): class Meta: ...
kiddybigmoments/kiddybigmoments-server
webapp/admin.py
admin.py
py
553
python
en
code
0
github-code
36
74712490663
#!/usr/bin/env python3 from aoc2021.util import print_solutions, import_strs import timeit Mark = "M" def part_1(inputs): called, boards = inputs for target in called: for board in boards: if mark_board(board, target) and check_board(board): return score_board(board) * t...
chao-mu/aoc2021
src/day4.py
day4.py
py
2,206
python
en
code
0
github-code
36
1922678376
from problem_000 import * from sequences import triangle_number, triangle_number_inverse, is_triangle_number, is_pentagonal_number, is_hexagonal_number class Problem_045(Problem): def __init__(self): self.problem_nr = 45 self.input_format = (InputType.NUMBER_INT, 1, None) self.default_inpu...
Kwasniok/ProjectEuler-Solver
src/problem_045.py
problem_045.py
py
1,216
python
en
code
1
github-code
36
27863085436
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from time import sleep import os driver = webdriver.Chrome() driver.get("ht...
mmangon/10fastfingers
main.py
main.py
py
1,196
python
en
code
0
github-code
36
8365190714
# abstract types from .expr import Expr # basic types from .leafexpr import LeafExpr from .addr import Addr from .bytes import Bytes from .int import Int, EnumInt from .methodsig import MethodSignature # properties from .arg import Arg from .txn import TxnType, TxnField, TxnExpr, TxnaExpr, TxnArray, TxnObject, Txn fr...
gconnect/voting-dapp-pyteal-react
venv/lib/python3.8/site-packages/pyteal/ast/__init__.py
__init__.py
py
4,490
python
en
code
6
github-code
36
70521717223
import datetime import json import os import time import random import requests from Crypto.Cipher import AES from django.db.models import Q from django.http import JsonResponse,HttpResponseRedirect from django.views.decorators.cache import cache_page from activety.models import Usercoupon from news.view...
zhoujialefanjiayuan/liu-lian
xiaochengxu/shopping/views.py
views.py
py
27,704
python
en
code
0
github-code
36
28821282358
#!/usr/bin/env python3 import sys import rwpy.code as code from rwpy.errors import IniSyntaxError def log(message: str): print('rwcheck:' + message) def isensured(text: str): return text.isspace() or text == '' or text.startswith('#') if __name__ == '__main__': errors = [] if len(sys.argv) == 2: ...
zerodegress/rwtools
rwcheck.py
rwcheck.py
py
2,120
python
en
code
2
github-code
36
34742768602
from random import randint, choice class Moves: def __init__(self, nom="Missing Move", typ=choice(["Water", "Flying", "Normal", "Fire", "Electric", "Ghost", "Poison", "Dragon", "Bug", "Ice", "Psychic"]), category=choice(["Physical", "Special"]), ...
Redrock18/pokemon
MoveClass.py
MoveClass.py
py
3,491
python
en
code
1
github-code
36
28587679911
# -*- coding: utf-8 -*- from odoo import models, fields, api import pika import json import time class rabbitmq(models.Model): _name = 'res.partner' _description = 'Processing of Contact Records' _inherit = "res.partner" def sequential_contacts(self): records = self.env['res.partner'].search...
FirstClassComputerConsulting/odoo_insurance_app
rabbitmq/models/models.py
models.py
py
2,625
python
en
code
0
github-code
36
26054870224
import sys import socket header_size = 8 class MessageHeader(object): def __init__(self): self.type = 0 self.size = 0 def send_packet(conn, textdata): sbytes = bytearray(map(ord, textdata)) type = 0 size = len(sbytes) typebytes = type.to_bytes(4, byteorder="little") sizebytes ...
insooneelife/PythonExamples
server_example.py
server_example.py
py
1,705
python
en
code
0
github-code
36
30148735325
from modules.symboltable import Symbol_table import socket import struct import datetime try: import yara except: pass symbol_table = Symbol_table() class Node: def __init__(self, value, children:list) -> None: self.value = value self.children:list = children def evaluate(self): ...
matheus-1618/GuardScript
Interpreted/modules/node.py
node.py
py
9,480
python
en
code
0
github-code
36
27275984958
"""Glue all the CLIs together into one interface.""" # First Party Library from wepy.orchestration.cli import cli as orch_cli cli = orch_cli # SNIPPET: I was intending to aggregate multiple command lines other # than the orchestration, but this never materialized or was # needed. In the future though this can be th...
ADicksonLab/wepy
src/wepy/__main__.py
__main__.py
py
617
python
en
code
44
github-code
36
34338413182
from p154 import Solution test_cases = [ ([1,3,5], 1), ([2,2,2,0,1], 0), ] def test_findMin(): for case in test_cases: s = Solution() assert s.findMin(case[0]) == case[1], case
0x0400/LeetCode
p154_test.py
p154_test.py
py
207
python
en
code
0
github-code
36
43906506457
""" Methods for pyspectrumscale.Api that deal with filesets """ from typing import Union import json def get_fileset( self, filesystem: Union[str, None], fileset: Union[str, None]=None, allfields: Union[bool, None]=None ): """ @brief List all filesets or return a specific ...
Aethylred/pyspectrumscale
pyspectrumscale/Api/_fileset.py
_fileset.py
py
7,753
python
en
code
0
github-code
36
7628041943
from django.test import TestCase from api import models from django.urls import reverse from django.contrib.auth import get_user_model from rest_framework import status from rest_framework.test import APIClient from exercise.serializers import TagSerializer TAGS_URL = reverse('exercise:tag-list') #help funcs # def c...
Mgalazyn/gym_api-drf
app/tests/test_tag_api.py
test_tag_api.py
py
2,264
python
en
code
0
github-code
36
73947669542
''' Desarrollado por: Ferney Vanegas Hernández Misión TIC 2022 Versión : 1.0.2 Título: Reto 4 ''' import modules.rows as r import modules.columns as c import modules.widhts as w import modules.longs as l import modules.walls as wall def main(): dim = int(input('Ingresa un número para dimensionar e...
ferneyvanegas/WorldCraft-ASCII-Listas
main.py
main.py
py
1,468
python
es
code
1
github-code
36
11467704901
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo from torch.nn.functional import pad device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class ConvBNLayer(nn.Module): def __init__(self,in_channels...
milely/SRN.Pytorch
backbone/resnet_fpn.py
resnet_fpn.py
py
6,634
python
en
code
27
github-code
36
19956688482
""" Given a list of different students' scores, write a function that returns the average of each student's top five scores. You should return the averages in ascending order of the students' id numbers. Each entry (scores[i]) has the student's id number (scores[i][0]) and the student's score (scores[i][1]). The avera...
scottmm374/coding_challenges
codesignal/other_school_codesignal/time_space_complexity/average_of_top_five.py
average_of_top_five.py
py
1,319
python
en
code
1
github-code
36
18913786240
#! /usr/bin/env python # -*- coding:utf-8 -*- """ @author : MG @Time : 2018/6/12 20:38 @File : run.py @contact : mmmaaaggg@163.com @desc : """ import time import logging from ibats_bitmex_feeder.backend.orm import init from ibats_bitmex_feeder.feeder import start_feeder logger = logging.getLogger() if __na...
IBATS/IBATS_BitMexFeeder
run.py
run.py
py
731
python
en
code
5
github-code
36
12772839204
import os import base64 import json import logging from aws_kinesis_agg.deaggregator import deaggregate_records from src.consumers.mysql_consumer import MySQLConsumer from src.utils import get_secret logger = logging.getLogger() logger.setLevel(os.environ.get("LOG_LEVEL", "INFO")) def handle_event(event, context): ...
troybESM/maxwell-kinesis-consumer
src/handlers/maxwell_kinesis_mysql.py
maxwell_kinesis_mysql.py
py
1,216
python
en
code
0
github-code
36
32560269380
# coding: utf-8 import sys import os from Public.Decorator import * import uiautomator2 as u2 from Public.common import common from tenacity import * cm = common() #获取resourceID condition = os.path.exists(cm.mapping_gp_path) mapping_path = (cm.mapping_vid_path,cm.mapping_gp_path)[condition] res = cm.parse_mapping_fi...
taylortaurus/android-ui-runner
Public/appBase.py
appBase.py
py
9,249
python
en
code
0
github-code
36
27756843887
import socket import json def main(): TYPE_OF_NETWORK_ADRESS = socket.AF_INET THE_PROTOCOL = socket.SOCK_STREAM # TCP THE_LEVEL = socket.SOL_SOCKET THE_OPTION = socket.SO_REUSEADDR THE_VALUE = 1 with socket.socket(TYPE_OF_NETWORK_ADRESS, THE_PROTOCOL) as the_socket: the_socket.se...
ibrahimhalilbayat/data_engineering_diary
Sockets/tcp_server.py
tcp_server.py
py
1,496
python
en
code
0
github-code
36
14983002282
#!/usr/bin/python # encoding=utf8 from flask import Flask, render_template, request, flash, redirect, session, abort from tinydb import TinyDB,Query import os import json import cPickle as cp import sys reload(sys) sys.setdefaultencoding('utf8') app = Flask(__name__) app.secret_key = os.urandom(12) usersAnnot={"admin...
ankitvad/AnnotationSite
hello.py
hello.py
py
2,037
python
en
code
0
github-code
36
29392684092
# 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 findTarget(self, root: Optional[TreeNode], k: int) -> bool: s = set() def inord...
AnotherPianist/LeetCode
653-two-sum-iv-input-is-a-bst/653-two-sum-iv-input-is-a-bst.py
653-two-sum-iv-input-is-a-bst.py
py
744
python
en
code
1
github-code
36
6298326622
import pyttsx3 import speech_recognition as sr import PyPDF2 from gtts import gTTS from googletrans import Translator from playsound import playsound import os assistant=pyttsx3.init("sapi5") #creation object for speak voices=assistant.getProperty('voices') #check voices assistant.setProperty('voice', vo...
Kabir2099/Desktop-Assistant
Book_Reader.py
Book_Reader.py
py
2,948
python
en
code
0
github-code
36