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
73519498715
#################################################################################################################################### # Mocked Environmental Sensor # # Used for testing or when not all devices are available in hardware # # Create an instance of this class, and specify which of the three parameters you wa...
motley197/brian
uPython/polytunnel/MockedEnvSensor.py
MockedEnvSensor.py
py
5,418
python
en
code
1
github-code
50
41152371765
#Задание 1 #Случайная непрерывная величина A имеет равномерное распределение на промежутке (200, 800) #Найдите ее среднее значение и дисперсию. # промежуток a=200 b=800 # Мат ожидание и дисперсия для равномерного распределения M=(a+b)/2 D=(b-a)**2/12 print(f'Среднее значение: {M}\n\ Дисперсия: {D}')
eterity88/DZ_4_teover
1.py
1.py
py
497
python
ru
code
0
github-code
50
70624133596
import sys import os import SimPy.SimulationTrace as sim class Car(sim.Process): def __init__(self, name, cc): sim.Process.__init__(self, name=name) self.cc = cc def go(self): print("{0} {1} Starting".format(sim.now(), self.name)) yield sim.hold, self, 100.0 print("{0} {1} Arrived".format(sim.now(), sel...
kubkon/Phd-python
Simulation/sim1.py
sim1.py
py
572
python
en
code
1
github-code
50
28051108667
import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix # importer la data data=pd.read_csv('Produit_acheter.csv') print(da...
BENOUSSAIDarezkimalek/python_project
Regression_logistique.py
Regression_logistique.py
py
2,597
python
fr
code
0
github-code
50
23602634263
"""Tests for the UWS job manipulation handlers. These tests don't assume any given application, and therefore don't use the API to create a job, instead inserting it directly via the UWSService. """ from __future__ import annotations from datetime import timedelta import pytest from dramatiq import Worker from fast...
lsst-sqre/ivoa-cutout-poc
tests/uws/job_api_test.py
job_api_test.py
py
6,151
python
en
code
0
github-code
50
25903350879
from setuptools import setup from channelbindjs import VERSION import os with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='chann...
moaxey/ChannelBindJS
setup.py
setup.py
py
1,436
python
en
code
1
github-code
50
11626573921
import torch import torch.distributed as dist import torch.nn as nn from brt.runtime.benchmark import BenchmarkArgumentManager, ResultWriter from brt.runtime.placement import dump_decision from modeling_bert_generation import BertGenerationConfig, BertGenerationDecoder from transformers import BertGenerationTokenizer ...
Raphael-Hao/brainstorm
benchmark/task_moe/benchmark.py
benchmark.py
py
6,790
python
en
code
26
github-code
50
26563684006
from nipype.interfaces.base import BaseInterfaceInputSpec, BaseInterface, File, TraitedSpec, traits from nipype import Node from panpipelines.utils.util_functions import * from panpipelines.utils.transformer import * import os import glob import nibabel as nb from nipype import logging as nlogging IFLOGGER=nlogging.ge...
MRIresearch/PANpipelines
src/panpipelines/nodes/atlascreate.py
atlascreate.py
py
4,107
python
en
code
0
github-code
50
40239391145
"""This file performs PCA on the embeddings and plots the results. """ import os import numpy as np from sklearn.decomposition import PCA from sklearn.svm import LinearSVC from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt from tabulate import tabulate import pandas as pd from sklearn....
magnusgp/LLAR
yamnet/PCA.py
PCA.py
py
17,201
python
en
code
1
github-code
50
7285094270
import pickle import pykeen from pykeen.datasets.base import PathDataset import torch from torch.optim import Adam from pykeen.training import SLCWATrainingLoop,LCWATrainingLoop from pykeen.evaluation import RankBasedEvaluator import os import numpy as np from pykeen.models import ConvE,TransE,TransD,TransH,TransR,KG2E...
PKU-BDBA/HMKG-Progress
HMKG/hmkg/KGE/construct_triples.py
construct_triples.py
py
10,121
python
en
code
1
github-code
50
8462259752
import numpy as np np.random.seed(0) def create_data(points, classes): X = np.zeros((points*classes, 2)) y = np.zeros(points*classes, dtype='uint8') for class_number in range(classes): ix = range(points*class_number, points*(class_number+1)) r = np.linspace(0.0, 1, points) t = np....
CocolinoFan/Learning
NeuralNetwork/Neural_Networks_from_Scratch_P_5.py
Neural_Networks_from_Scratch_P_5.py
py
1,184
python
en
code
0
github-code
50
33306271149
""" Converter for dicom and nifti import. Convert dicom to nifti. Get the main modals using NiftiGetter, which is based on globbing. Inherite NiftiGetter to use with specific converted raw nifti data. """ import os import subprocess import fnmatch import logging import pydicom from mmdps import rootconfig from mmdp...
geyunxiang/mmdps
mmdps/dms/converter.py
converter.py
py
3,644
python
en
code
4
github-code
50
6597578574
# -*- coding: utf-8 -*- import uuid """ Classes for Route 53 domains. James Reed jdreed1954@hotmail.com Cell: 303-570-4927 Centennial Data Science """ class DomainManager: """Manage a Route 53 domain.""" def __init__(self, session): """Create DomainManager object.""...
reed54/route53
aState/domain.py
domain.py
py
3,937
python
en
code
0
github-code
50
42201942444
import numpy as np import datetime import itertools import pickle from collections import Counter import re """ Code adapted from https://github.com/dennybritz/cnn-text-classification-tf """ def clean_str(string): """ Tokenization/string cleaning for input. Originally taken from https://github.com/yoonkim/...
jimmec/tensorflow-demo
data_helper.py
data_helper.py
py
5,772
python
en
code
2
github-code
50
12900342798
#coding=utf-8 """Train DCGAN""" import glob import numpy as np from scipy import misc import tensorflow as tf from DCGAN import * #Hyperparameter EPOCH = 100 BATCH_SIZE = 128 LEARNING_RATE =0.0002 Beta_1 = 0.5 def train(): #获取训练数据 data = [] for image in glob.glob("image/*"): image_data =misc.imread...
Jumponthemoon/DeepLearning_GAN
train.py
train.py
py
2,567
python
en
code
0
github-code
50
1581667461
# -*- coding: utf-8 -*- from utils import fields from utils import validate from module.common import GetResource from module.common import field_inputs_wrap as _field_inputs_wrap from module.common import field_inputs_ref as _field_inputs_ref from module.common import field_inputs as _field_inputs from module.common...
arvin-chou/mc
module/customer/business_valid.py
business_valid.py
py
7,332
python
en
code
0
github-code
50
40091656390
from __future__ import print_function import ROOT ROOT.gROOT.SetBatch(True) from setTDRStyle import setTDRStyle from granularity import * import os try: base = os.environ['CMSSW_BASE'] except KeyError: base = "../../../../.." # 2016 is missing here lumiFiles = { 2016: "{base}/src/Alignment/APEEstimation/d...
cms-sw/cmssw
Alignment/APEEstimation/test/plottingTools/trendPlotter.py
trendPlotter.py
py
10,561
python
en
code
985
github-code
50
71090059675
# base class from Code.dataset.dataloader import Loader # data manipulation and tools import numpy as np from Code.dataset.DataModel import * import os # shifts libraries from ysdc_dataset_api.dataset import MotionPredictionDataset from ysdc_dataset_api.features import FeatureRenderer from ysdc_dataset_api.utils imp...
Juan-Baldelomar/Vehicle_Trajectory_Forecasting
Code/dataset/shifts_dataloader.py
shifts_dataloader.py
py
4,816
python
en
code
5
github-code
50
7521405350
import os import numpy as np import pandas as pd import re import tsaug from tsaug.visualization import plot ''' Segmentation of time series and addition of noise ''' old_path = './data_fMRI' save_path = 'data_augm' for root_dir, sub_dirs, _ in os.walk(old_path): for sub_dir in sub_dirs: ...
GraphW/LGSL
augmentation.py
augmentation.py
py
2,139
python
en
code
1
github-code
50
39754220100
import matplotlib.pyplot as plt from statistics import mean, stdev from sys import argv from glob import glob import csv __author__ = "Garance Gourdel, Pierre Peterlongo" __email__ = "pierre.peterlongo@inria.fr, garance.gourdel@inria.fr" def reorder(x, y_dict): sorted_y = dict() for k, y in y_dict.items(): ...
fnareoh/DTW
src/experiments/plot.py
plot.py
py
7,939
python
en
code
1
github-code
50
26440358305
import sys input = sys.stdin.readline n = int(input()) monkeys = list(map(int, input().split())) sum_monkeys = sum(monkeys) total = int(input()) if total >= sum_monkeys: print(max(monkeys)) else: x = total // n def over_check(total, monkeys, x): for i in monkeys: if i >= x: ...
mskyun721/algorithm_practice
aivle_coding_master/4271.py
4271.py
py
625
python
en
code
0
github-code
50
17438106411
import numpy as np coef = np.zeros((3,3)) rhs = np.zeros((3,1)) for i in range(3): for j in range(3): coef[i][j] = int(input(f"Input C{i*4+j+1}: ")) rhs[i][0] = int(input(f"Input C{(i+1)*4}: ")) print() try: ans = np.matmul(np.linalg.inv(coef),rhs) print("Solution:") print(f"x =...
HiMAIayas/SIIT_Lab
GTS123 (Intro To ComProg)/lab10 (np linalg)/lab10_2.py
lab10_2.py
py
456
python
en
code
0
github-code
50
35952217100
import numpy as np from .common import convert_orientation, compute_theta, angles_difference class MoveMPC(object): def __init__(self, frame, max_speed): self._frame = frame self._horizon = 10 self._dt = 0.1 speed_bounds = [(0, max_speed) for _ in range(self._horizon)] ...
kantengri/mown-project
planning/move_controller/src/move_controller/move_mpc.py
move_mpc.py
py
4,374
python
en
code
3
github-code
50
71023219997
#!/usr/bin/env python3 import requests from bs4 import BeautifulSoup import sys import string import random import argparse from termcolor import colored PROXS = {'http':'127.0.0.1:8080'} PROXS = {} def random_string(stringLength): letters = string.ascii_lowercase return ''.join(random.choice(lett...
DawnFlame/POChouse
Joomla/Joomla 3.4.6-RCE(CVE-2015-8562)/Joomla-3.4.6-RCE.py
Joomla-3.4.6-RCE.py
py
7,410
python
en
code
896
github-code
50
25329146087
from pages.CheckoutCompletePage import CheckoutCompletePage from pages.CheckoutInformationPage import CheckoutInformationPage from pages.CheckoutOverviewPage import CheckoutOverviewPage from pages.YourCart import YourCart class Test_5: def test_finalizar_compra(self, add_product_to_cart): products_page =...
WillamsPinto/ETA-TestesDeSistema
ETA2022.1/tests/test_5.py
test_5.py
py
1,948
python
pt
code
0
github-code
50
553600491
# Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children class Solution(object): def postorder(self, root): """ Given an n-ary tree, return the postorder traversal of its nodes' values. For example, given a...
ljia2/leetcode.py
solutions/tree/590.N-ary.Tree.Postorder.Traversal.py
590.N-ary.Tree.Postorder.Traversal.py
py
939
python
en
code
0
github-code
50
42217001137
from gurobi_inference import Relation_Inference from collections import Counter import copy def calculate_prob(class_counts, threshold=100): total_counts = sum(class_counts) if total_counts < threshold: return [0.0]*len(class_counts) else: return [x / total_counts for x in class_counts] def define_pri...
rujunhan/EMNLP-2020
code/tbd/LROptimization.py
LROptimization.py
py
5,906
python
en
code
6
github-code
50
16573502870
import copy from mindspore import Tensor import mindspore as ms import numpy as np from .epsilon_schedules import DecayThenFlatSchedule REGISTRY = {} class MultinomialActionSelector(): def __init__(self, args): self.args = args self.schedule = DecayThenFlatSchedule(args.epsilon_start, args.eps...
allyouneeds/QMIX-MindSpore
qmix/ascend_src/components/action_selectors.py
action_selectors.py
py
2,947
python
en
code
0
github-code
50
18553143692
import numpy as np import math import matplotlib.pyplot as plt def fun(x): return 1/(25*(x**2) + 1) ''' def myLagrange(xi: list, yi: list, data: list): wyn = [0]*len(data) for j in range(len(yi)): wzr = yi[j] for i in range(len(xi)): if xi[i] - xi[j] != 0: ...
WykwalifikowanyProgramista7000/Numerki
spyder/lab5.py
lab5.py
py
1,209
python
en
code
0
github-code
50
27670261237
import nlp import torch from numpy import mean from transformers import PreTrainedTokenizerBase from Code.Model.bert_embedder import TooManyTokens from Code.Utils.dataset_utils import get_wikipoints from Code.Utils.eval_utils import get_acc_and_f1 from Config.options import max_examples _test = None def get_test(to...
shaneacton/GraphPerceiver
Code/Training/eval.py
eval.py
py
1,252
python
en
code
0
github-code
50
75170123355
import logging from logging import config as logging_config from secrets import token_hex from typing import Optional from core.config import CONFIG class RequestIdFilter(logging.Filter): """A class for an additional log message filter to add request ID information to the log messages.""" def __init__(self,...
temirovazat/cinemax-async-api
backend/src/core/logger.py
logger.py
py
2,723
python
en
code
0
github-code
50
9108268634
import os import time """ Graphics in the console with Python. """ class ConsoleDisplay: def __init__(self, wt: int, ht: int, char='█'): self.wt = wt self.ht = ht self.char = char self.surfaceStr = char * wt self.draw_coords = [] def draw_surface(self): for i in range(self.ht): self.surfac...
SeanJxie/practice-programs
SingleFilePython/console_screen.py
console_screen.py
py
1,246
python
en
code
1
github-code
50
1706055791
from torch.utils.data import Dataset import os,sys sys.path.append('../') import settings import torch import pandas as pd import numpy as np import cv2 from PIL import Image from imgaug import augmenters as iaa from sklearn.model_selection import KFold config=settings.config np.random.seed(8) def ov...
espectre/kaggle_Human-Protein-Atlas-Image-Classification
pytorch/Data.py
Data.py
py
5,423
python
en
code
0
github-code
50
12091392547
fav1 = ['pizza', 'nuggets', 'hotdog', 'noodles', 'pasta', 'burger'] fav2 = ['burger', 'hotdog', 'noodles', 'pasta', 'nuggets', 'pizza'] # find the min sum of indices for corresponding food in fav1 and fav2 # for example, pizza is at index 0 in fav1 and at index 5 in fav2 # so the sum of indices for pizza is 5 index...
Altmerian/learn-python
lists/favourite_food.py
favourite_food.py
py
579
python
en
code
0
github-code
50
11661296522
"""Test suite for the management command sync_group_permissions.""" from django.core.management import call_command from django.test import TestCase, override_settings from machina.apps.forum_permission.shortcuts import assign_perm from machina.core.db.models import get_model from ashley.factories import ForumFactory...
openfun/ashley
tests/ashley/management/commands/test_sync_group_permissions.py
test_sync_group_permissions.py
py
5,009
python
en
code
11
github-code
50
10418957717
from datetime import datetime, timedelta import pandas as pd from binance.client import Client as BinanceClient from utils.secrets import get_binance_secret interval_mapping = { "1MINUTE": BinanceClient.KLINE_INTERVAL_1MINUTE, "3MINUTE": BinanceClient.KLINE_INTERVAL_3MINUTE, "5MINUTE": BinanceClient.KLINE...
c4road/wp-bot-cdk
wp-sns-lambda/services/binance.py
binance.py
py
7,189
python
en
code
0
github-code
50
74536154715
from scapy.all import Dot11, RadioTap, sendp from random import randint dot11 = Dot11(type=2, subtype={SUBTYPE}, FCfield={FCf}, addr1={DESTINATION_MAC}, addr2={SOURCE_MAC}, addr3={AP_MAC}, SC={SC}, addr4={SOURCE_MAC}) MAC_header = RadioTap()/dot11 payload = {SEED} frame = MAC_header / payload print('\n- - - - - - - ...
efchatz/WPAxFuzz
exploits/exploit_data.py
exploit_data.py
py
484
python
en
code
120
github-code
50
3144955621
#!/usr/bin/env python import rospy from blockChainPack_.msg import lastHash nodeList = ['NODE1', 'NODE2', 'NODE3'] nodeONOFF = [1,0,0] oldNodeONOFF = [0,0,0] def callback(data): if data.nodeName in nodeList: nodeONOFF[nodeList.index(data.nodeName)] = 1 print(nodeONOFF) def main(): rospy.Subscr...
willdavis576/BlockChainResearch
00blockChain_ws/src/blockChainPack_/src/scripts/Unused Currently/authentication1.py
authentication1.py
py
845
python
en
code
0
github-code
50
18741540647
# import spidevRead as sr import time import serial import dbConn as dC ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=1) while True: data = ser.readline().decode() # read the data from the serial port and decode it if "temperature:" in data: temperature = int(data.split...
CoreanAnt/iot_project
PyQT/etc/sensordb/ex11_sensorDB.py
ex11_sensorDB.py
py
1,268
python
en
code
0
github-code
50
33599419364
from django.shortcuts import render from .updateTables import updateTables from .models import parkingLot, parkingSpot import json from django.core.serializers.json import DjangoJSONEncoder from django.http import JsonResponse from datetime import datetime, timezone from django.views.decorators.cache import neve...
RamseyV/Parking
views.py
views.py
py
2,940
python
en
code
0
github-code
50
23792666625
class Solution: def maxProfit(self, prices: List[int]) -> int: min = 999999 max = 0 for i in range(len(prices)): if prices[i] <= min: min = prices[i] if prices[i] - min > max: max = prices[i] - min return max class Solution: ...
innjuun/Algorithm
LeetCode/easy/121.py
121.py
py
706
python
en
code
2
github-code
50
13885453082
# -*- coding: utf-8 -*- import scrapy from bookparser.items import BookparserItem class LabirintSpider(scrapy.Spider): name = 'labirint' allowed_domains = ['labirint.ru'] # Поисковый запрос - программирование start_urls = ['https://www.labirint.ru/search/%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B...
sokolenkomikhail/data_collection
lesson_06/bookparser/spiders/labirint.py
labirint.py
py
1,696
python
en
code
0
github-code
50
10965043853
from modulos.bd.servicios import Servicios_BD from modulos.base.modelo import ModeloBase from modulos.base.servicios import ServiciosBase #cli_services=CLIservices() #cliente_n1=cli_services.prompt_cliente() base_datos=Servicios_BD() conexion=base_datos.conexion_bd() Servicios_Base=ServiciosBase() """ -tenemos obj...
RocioDure12/Tienda_app
main.py
main.py
py
1,647
python
es
code
0
github-code
50
3436893210
import spacy nlp = spacy.load('en_core_web_md') description = """Will he save their world or destroy it? When the Hulk becomes too dangerous for the Earth, the Illuminati trick Hulk into a shuttle and launch him into space to a planet where the Hulk can live in peace. Unfortunately, Hulk land on the planet Saka...
Yelya8/Watch_next.py
watch_next.py
watch_next.py
py
1,689
python
en
code
0
github-code
50
74067656154
from typing import Dict, List, Union from multimodal_challenge.multimodal_object_init_data import MultiModalObjectInitData class DatasetTrial: """ Parameters for defining a trial for dataset generation. """ def __init__(self, target_object: MultiModalObjectInitData, force: Dict[str, float], ...
chuangg/find_fallen_objects
docker/multimodal_challenge/dataset/dataset_trial.py
dataset_trial.py
py
2,192
python
en
code
6
github-code
50
26148197365
from math import log,exp,ceil from sys import stdin r = stdin.readline n = r().strip() eps = 1e-6 while n!="": n = int(n) p = int(r().strip()) try: sol = exp(log(p)/n) csol = ceil(sol) if csol-sol<eps: print(csol) else: print(round(sol)) e...
michaelgy/PROBLEMS_PROGRAMMING
UVA/113.py
113.py
py
375
python
en
code
0
github-code
50
36537975361
from bottle import route, run, request, response, HTTPResponse from rembg import remove import io import json import tempfile import os @route('/detourer_image', method='POST') def detourer_image(): if 'image' not in request.files: error_response = {'error': 'Pas d\'image envoyée'} return HTTPRespo...
SCcagg5/remove_background
api.py
api.py
py
1,008
python
en
code
0
github-code
50
75165252956
from MachineLearning.DT_Model.CART import LeafNode from MachineLearning.DT_Model.CART import TreeNode from MachineLearning.DT_Model.CART import CART import random import matplotlib.pyplot as plt import numpy as np class Forest: def __init__(self, frame, col): self.set = [] self.frame = frame ...
Y-J-9/MachineLearning
RF_Model/random_forest.py
random_forest.py
py
6,350
python
en
code
0
github-code
50
9309106724
import io import discord from discord import app_commands from discord.ext import commands, tasks from discord.ui import Select, View from files import texts, goobers, lang_codes, quote_translation import requests import random from datetime import datetime import pytz from PIL import Image, ImageDraw import inflect im...
s00240122/Python-tings
YTTutorialDiscBot/slash_bot.py
slash_bot.py
py
11,903
python
en
code
0
github-code
50
11982603493
#Cryptographie appliquée #Projet n°2: PKI et Python #Auteur: Guillaume Paris #Date: 07-11-2022 #Description: Ce programme permet de créer une autorité racine, une autorité d'enregistrement et un certificat client signé par l'autorité racine et l'autorité d'enregistrement. import datetime import os from cryptography.h...
Tr0llope/PKI_Python
ProjetCryptoV1-0.py
ProjetCryptoV1-0.py
py
4,477
python
en
code
0
github-code
50
34884744439
# -*- coding: utf-8 -*- # @Time : 2021/9/12 11:03 # @Author : XDD # @File : 可呼唤矩形的组数.py from functools import reduce class Solution: def interchangeableRectangles(self, rectangles) -> int: # 哈希,依次遍历计算长宽比 dic = {} # key:为长宽比,value为个数,通过计算排列组合数得到最终的结果 n = len(rectangles) for i in ra...
Dong98-code/leetcode
codes/competition/可呼唤矩形的组数.py
可呼唤矩形的组数.py
py
1,047
python
en
code
0
github-code
50
1168399995
from molsysmt._private.digestion import digest @digest(form='openmm.Modeller') def to_openmm_System(item, atom_indices='all', structure_indices='all', forcefield=None, non_bonded_method='no_cutoff', non_bonded_cutoff='1.0 nm', constraints=None, rigid_water=True, remove_cm_moti...
uibcdf/MolSysMT
molsysmt/form/openmm_Modeller/to_openmm_System.py
to_openmm_System.py
py
1,268
python
en
code
11
github-code
50
16477507408
from gi.repository import Gtk import gettext import locale import os import logging import sys from gtkbasebox import GtkBaseBox # Useful vars for gettext (translations) APP_NAME = "thus" LOCALE_DIR = "/usr/share/locale" import misc.i18n as i18n class Language(GtkBaseBox): def __init__(self, params, prev_page=...
manjaro/thus
thus/language.py
language.py
py
5,536
python
en
code
24
github-code
50
21355271077
""" Author(s): Miguel Alex Cantu Date: 04/21/2020 Description: This function will return a dictionary of all the users in the tenant, indexed by userPrincipalName """ # Imports from make_request import paginate from test_cases import TestCases # Variables # This query fetches all of the users along with th...
alextricity25/AzurePythonScripts
list_all_users.py
list_all_users.py
py
1,224
python
en
code
1
github-code
50
23136949539
""" 使用selenium破解豆瓣滑块验证码 """ from selenium import webdriver # 导入鼠标事件类 from selenium.webdriver import ActionChains import time # 加速度函数 def get_tracks(distance): """ 拿到移动轨迹,模仿人的滑动行为,先匀加速后匀减速 匀变速运动基本公式: ①v=v0+at ②s=v0t+½at² """ # 初速度 v = 0 # 单位时间为0.3s来统计轨迹,轨迹即0.3内的位移 t = 0.3 # 位...
sjk052026/test2020
spider/day26/doubanSpiderSelenlum.py
doubanSpiderSelenlum.py
py
2,676
python
zh
code
0
github-code
50
15675857824
#!/usr/bin/env python import json import logging from gi.repository import WebKit from gi.repository import GObject class Browser(GObject.GObject): """Webkit browser wrapper to exchange messages with Gtk. :param uri: URI to the HTML file to be displayed. :type uri: str """ __gsignals__ = { ...
jcollado/pygtk-webui
browser.py
browser.py
py
1,769
python
en
code
4
github-code
50
13039300169
#Import tkinter for GUI libraries import tkinter as Tkinter from tkinter import * import string #Import tkMessageBox for information and help message box import tkinter.messagebox as tkMessageBox def helpMsg(): tkMessageBox.showinfo("About this Software", "This software is is intended to increase proper usage of en...
hmansoori002/GrammerUp
GrammerUp.py
GrammerUp.py
py
17,985
python
en
code
0
github-code
50
7369861512
## iterative approach class node: def __init__(self,data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def reverseiterative(self,head): if head == None or head.next == None: return prev = None ...
sanket1105/DSA-with-Python
DSA/LinkedLists/ReverseLinkedList.py
ReverseLinkedList.py
py
1,160
python
en
code
16
github-code
50
21167839945
from matplotlib import pyplot as plt plt.figure(figsize=(5, 2.5)) distance = 0 velocity = 50 a = -9.8 def integrate_dist (): max_height = 0 global distance global a global velocity for t in range (0,100,1): distance += velocity if (max_height < distance): max_height = distance if(dista...
smkim0508/Engineering_Applications_Prog
Ballistics_1_4.py
Ballistics_1_4.py
py
654
python
en
code
0
github-code
50
30485090726
''' 수강신청 실패를 만회하기 위해 제작하였습니다. 제작자: 박결 최종 업데이트: 2023-02-06 기능 1. 수강바구니에 담긴 과목들을 자동으로 새로고침하며 수강신청을 시도합니다. 기능 2. (선택) 수강신청이 성공할 경우 슬랙봇을 통해 사실을 알려줍니다. ''' from selenium import webdriver from selenium.webdriver.common.by import By import chromedriver_autoinstaller import requests import time import json import os from u...
kyeul611/Automation_repo
수강신청_매크로/getCourses.py
getCourses.py
py
7,357
python
ko
code
0
github-code
50
25535630570
words = [ 'engender', 'karpatka', 'othellolagkage', 'ptolemaic', 'retrograde', 'supplant', 'undulate', 'xenoepist', 'abberation', ] def get_rotating_point_idx_simple(l): # linear prev = None for idx, item in enumerate(l): if prev and item < prev: ret...
trueneu/algo
interviewcake/rotating_point.py
rotating_point.py
py
1,158
python
en
code
0
github-code
50
42000639061
from Explainer import explainer from VGG import vgg from ResNet50Mod import resnet50 from tensorflow.keras.utils import plot_model from tensorflow.keras import layers as KL from tensorflow.keras.models import Model import os import matplotlib.pyplot as plt class ExplainerClassifierCNN: """ ExplainerClassifierCNN ...
icrto/xML
Keras/ExplainerClassifierCNN.py
ExplainerClassifierCNN.py
py
6,917
python
en
code
10
github-code
50
39545271542
from astropy.coordinates import SkyCoord from astropy.units import Quantity class Region: """ This is the base class for describing a region. You must specify the diameter (diam) or the height and width of the region but not both at the same time. Args: name (str): The name of the region...
cdalvaro/decocc
cdalvaro/models/region.py
region.py
py
2,226
python
en
code
0
github-code
50
39321151581
from client import * import signal client = CrypticClient(log_level=logging.INFO) client.URI = "ws://localhost:8000" client.start_client() def receiver(json: Json): print(json) def action(): action = "signup" client.add_receiver(action, receiver) json = Json(action=action, id="mimi", key="prmp") ...
prmpsmart/cryptic
main_client.py
main_client.py
py
938
python
en
code
0
github-code
50
13120989975
from flask import Flask import RPi.GPIO as GPIO Rled = 4; Bled = 5 GPIO.setmode(GPIO.BCM) GPIO.setup(Rled, GPIO.OUT) GPIO.setup(Bled, GPIO.OUT) app = Flask(__name__) @app.route("/") def mainPage(): return ''' <h1> Main Page </h1> <h2> RED LED <a href="led/red/on">on</a> <a href="/l...
tldus2355/2021-IoT-Project
07_web/flask_led_task.py
flask_led_task.py
py
1,501
python
en
code
0
github-code
50
2392266684
def getStudentNames(): studentsList = [] for i in range(0,12): print(i) studentName = str(input("Enter the student's name: ")) studentsList.append(studentName) return studentsList def getAlphabeticalList(tempList): tempList.sort alphabeticalList = tempList return alphab...
Loganphx/ProgrammingFundamentalsI
Lab 7/logan_ingram_lab7b.py
logan_ingram_lab7b.py
py
1,216
python
en
code
0
github-code
50
11269807288
import pandas as pd from pandas import Series, DataFrame import numpy as np obj = Series([4.5, 7.2, -5.3, 3.6], index=['d', 'b', 'a', 'c']) obj obj2 = obj.reindex(['a', 'b', 'c', 'd', 'e'], fill_value=0) obj2 obj3 = Series(['blue', 'purple', 'yellow'], index=[0, 2, 4]) obj3 obj3.reindex(range(6)) obj3.reindex(range(6...
epicarts/python3_practice
data_analysis/essential_pandas.py
essential_pandas.py
py
7,119
python
ko
code
0
github-code
50
8193695529
from django.shortcuts import render from rest_framework import viewsets from rest_framework.permissions import IsAuthenticated import os from .serializers import * from django.core.files import File from django.conf import settings from rest_framework.response import Response from django.http import HttpResponse impor...
carryuteam/CarryU-API
fileupload/views.py
views.py
py
1,717
python
en
code
0
github-code
50
21558532856
from sqlalchemy import exc from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String from sqlalchemy import testing from sqlalchemy.orm import backref from sqlalchemy.orm import defaultload from sqlalchemy.orm import joinedload from sqlalchemy.orm impor...
jorgemorgado/sqlalchemy
test/orm/inheritance/test_poly_loading.py
test_poly_loading.py
py
31,456
python
en
code
1
github-code
50
30688863609
import numpy as np import scipy.io as scio # 本地地址:D:\FluidSim\FluidSim\FEMNEW\Navier-stokes-Satsit14master tmax = 100 celem = scio.loadmat('celem.mat')['celem'] - 1 node = scio.loadmat('node.mat')['node'] nmax = 341 u0 = np.ones((nmax)) v0 = np.zeros((nmax)) numOfElements = 100 for t in range(0,tmax): ...
clatterrr/NumericalComputation
FiniteElement/NavierStokes-satsit/demo0.py
demo0.py
py
4,724
python
en
code
3
github-code
50
28418624655
S = input() T = input() list = [] for i in range(len(S)): list.append(S[0:i] + S[i + 1:]) c = 0 for l in list: if T == l: c += 1 print(c)
mk668a/python_aoj
ateamTest/ateam2.py
ateam2.py
py
154
python
en
code
0
github-code
50
13293220023
import numpy import PIL def draw_boxes(img, boxes, digits, digit_width, digit_height): img_out = img.copy() draw = PIL.ImageDraw.Draw(img_out) for i in range(len(boxes)): color = numpy.random.randint(0, 255, 3) x = boxes[i] draw.polygon([ (x-digit_width/2, 3), ...
nagos/captcha-yolo
utils.py
utils.py
py
1,372
python
en
code
4
github-code
50
70579723675
import os import numpy as np import threading as thr import matplotlib.pyplot as plt from sklearn .model_selection import train_test_split from sklearn .metrics import roc_curve, auc from keras.models import Sequential from keras.layers import Conv2D, BatchNormalization, MaxPool2D, Dense, Flatten, InputLayer, Activatio...
bitgio/CMEPDA_final_project
cnn_original.py
cnn_original.py
py
5,367
python
en
code
0
github-code
50
2794402768
import argparse import os import numpy as np import torch import DDPG import utils import environment def whiten(state): return (state - np.mean(state)) / np.std(state) if __name__ == "__main__": parser = argparse.ArgumentParser() # Choose the type of the experiment parser.add_argument('--experim...
baturaysaglam/RIS-MISO-Deep-Reinforcement-Learning
main.py
main.py
py
6,892
python
en
code
77
github-code
50
29943658246
import torch from torch import nn from torch.nn import functional as F class Residual(nn.Module): def __init__(self, input_channels, num_channels, use_1x1conv=False, padding=1, strides=1): super().__init__() self.conv1 = nn.Conv2d(input_channels, num_channels, kernel_size=3, stride=strides, paddin...
Arni14/Deep-Learning
modern_architectures/resnet.py
resnet.py
py
2,032
python
en
code
0
github-code
50
70782323675
# Samuel Hulme # Cracking the Coding Interview # Question 1.1 # # Implement an algorithm to determine if a string has all unique characters. What is you cannot use additional data structures? # # Thoughts: # To implement this, we can use a dictionary. To do this, iterate through the list and then insert the...
shulme33/Programming
Python/cci_1-1.py
cci_1-1.py
py
3,889
python
en
code
0
github-code
50
39210745835
from ui_elements import Text, Picture from config import * import pygame import random class SystemFish: def __init__(self): self.timer = 0 self.exists = False self.delay = None self.opportunity = None self.fish_counter = None self.randomize() self.fish_al...
Archkitten/CS-AP-2
p2/flyby_fishing/system_fish.py
system_fish.py
py
1,399
python
en
code
0
github-code
50
12520662785
# -*- coding: utf-8 -*- from django import forms from django.conf import settings from django.utils.encoding import force_str from django.utils import timezone, dateparse from django.utils.translation import gettext as _ from core import models # Sets the default Child instance if only one exists in the database. de...
amcquistan/babyasst
core/forms.py
forms.py
py
15,304
python
en
code
0
github-code
50
23078030353
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @文件 :CommonUtils.py @说明 : @时间 :2021/05/29 15:47:14 @作者 :Oasis @版本 :1.0 ''' import os import time import sys import h5py import numpy as np import skimage.io as io import torch import torch.nn as nn import math import torch.nn.functio...
Lumos-Leo/SRGFS_test
Utils/CommonUtils.py
CommonUtils.py
py
29,482
python
en
code
0
github-code
50
10185777640
from cx_Freeze import setup, Executable options = dict( excludes = ['_gtkagg', '_tkagg', 'bsddb', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'Tkconstants', 'Tkinter','tk','tkinter','ttk','curses','email', ], ) exe = ...
bj0/pylans
cxfsetup.py
cxfsetup.py
py
799
python
en
code
6
github-code
50
34873217783
#!/usr/bin/env python2 # -*- coding:utf-8 -*- """ [NAME] Scannerクラスの定義 [DESCRIPTION] Scannerクラスの定義 """ import datetime from schema import Scanner, Person, Exp def start_batch(batch): dt_start = datetime.datetime.now() dt_measure = datetime.timedelta(hours=batch.h_scan) dt_finish = dt_start + dt_measu...
takeriki/colonylive
clive/db/control.py
control.py
py
1,971
python
en
code
0
github-code
50
30210939337
# coding=utf-8 import ast from app import app, db from flask import request from functools import wraps from app.api.utils.utils import BaseUtils from app.models.base_token import BaseToken from app.models.base_customer import BaseCustomer from app.api.utils.responses import BaseResponse class BaseDe...
IndexOffy/indexoffy_api
indexoffy/app/api/utils/decorators.py
decorators.py
py
2,831
python
en
code
0
github-code
50
22439653082
import numpy as np # Numerical Python functions #GGCACTGAACTGAATACAGC is our sequence: A,C,G,T=0,1,2,3 Seq = [2,2,1,0,1,3,2,0,0,1,3,2,0,1,3,3,0,1,0,2,1] #Sequence HLSeq = np.zeros((len(Seq),2)) #Store optimal sequences as we progress HLSeq[:,1] += 1 #Defaults are all low, all high Hi = [.2,.3,.3,.2] #Probabilities...
chuks-ojiugwo/Implementations-and-Applications-of-Machine-Learning
LaverBrandtThronBudget Reconciliation Through Dynamic Programming/Matrix Gonze-Viterbi.py
Matrix Gonze-Viterbi.py
py
1,792
python
en
code
0
github-code
50
551370559
from typing import List, Dict import string import re from collections import Counter from wordcloud import WordCloud from PIL import Image import numpy as np import matplotlib.pyplot as plt from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer, PorterStemmer from nltk.tokenize import word...
guybass/sentiment_analysis
eda.py
eda.py
py
4,830
python
en
code
0
github-code
50
18696574569
class Node: def __init__(self,x): self.l = None self.r = None self.d = x def Insert(node,x): if node == None: return Node(x) if x<node.d: node.l = Insert(node.l,x) else: node.r = Insert(node.r,x) return node def IscompleteBinary(node,i,N)...
riteshsethia7/Codes
Trees/Is_Complete_Binary_Tree.py
Is_Complete_Binary_Tree.py
py
751
python
en
code
0
github-code
50
45692922219
class Solution: def maxEvents(self,events): events.sort(key=lambda x:x[1]) visited = set() for s,e in events: for day in range(s,e+1): if day not in visited: visited.add(day) break return len(visited)
2448845600/LeetCodeDayDayUp
LeetCode题解/weekly-contest-176/3-id5342.py
3-id5342.py
py
305
python
en
code
4
github-code
50
4053207217
# -*- coding: utf-8 -*- """ Listing 10-3. PLANCKSSOLARSPECTRUM """ import numpy as np, matplotlib.pyplot as plt plt.close('all') plt.axis([0,3,0,100]) plt.xlabel('Wavelength $\lambda$ ($\mu$m)') plt.ylabel('S($\lambda$) (MW/m$^{3}$) x 10^-6') plt.grid(True) plt.title('Max Plancks Solar Spectrum') c=2.9979*(10.**8) ...
Apress/python-graphics
Chapter 10/Listing 10-3. PLANCKSSOLARSPECTRUM.py
Listing 10-3. PLANCKSSOLARSPECTRUM.py
py
2,416
python
en
code
34
github-code
50
6896383846
import os, os.path import time, mimetypes import mutagen from supysonic import config from supysonic.db import Folder, Artist, Album, Track def get_mime(ext): return mimetypes.guess_type('dummy.' + ext, False)[0] or config.get('mimetypes', ext) or 'application/octet-stream' class Scanner: def __init__(self, store):...
maikelwever/supysonic
supysonic/scanner.py
scanner.py
py
5,576
python
en
code
null
github-code
50
42751401954
import torch import torch.nn as nn import numpy as np from numpy import linalg as LA class QuantizationF(torch.autograd.Function): @staticmethod def forward(ctx, input, islinear, scale): ctx.save_for_backward(input) ctx.islinear = islinear ctx.scale = scale if ctx.islinear: #lin...
peiswang/FFN
models/quan.py
quan.py
py
1,528
python
en
code
2
github-code
50
37070866974
## coffee_creator.py - CoffeeMachine: Create a coffee # GPLv3 (c) 2020 Laurent Bourgon # # 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 3 of the License, or # (at your op...
BourgonLaurent/CoffeeMachine
CoffeeMachine/coffee_creator.py
coffee_creator.py
py
4,461
python
en
code
0
github-code
50
34655327754
_author_ = 'jake' _project_ = 'leetcode' # https://leetcode.com/problems/valid-sudoku/ # Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. # The Sudoku board could be partially filled, where empty cells are filled with the character '.'. # Create a set of digits seen in each row, column and bo...
jakehoare/leetcode
python_1_to_1000/036_Valid_Sudoku.py
036_Valid_Sudoku.py
py
1,290
python
en
code
49
github-code
50
70618463514
#!/usr/bin/env python #### this script modifies a FATES parameter file. It accepts the following flags # --var or --variable: variable. # --pft or --PFT: PFT number. If this is missing, script will assume that its a global variable that is being modified. # --input or --fin: input filename. # --output or --fout: outpu...
NGEET/fates-release
tools/modify_fates_paramfile.py
modify_fates_paramfile.py
py
7,190
python
en
code
11
github-code
50
19769448823
revision = 'affc03cb46f5' down_revision = '988883a6be1d' branch_labels = None depends_on = None import alembic import sqlalchemy import json import itertools import requests import logging import urllib.parse log = logging.getLogger("affc03cb46f5_game_data") def upgrade(): conn = alembic.context.get_context().bind ...
mrphlip/lrrbot
alembic/versions/affc03cb46f5_game_data.py
affc03cb46f5_game_data.py
py
13,052
python
en
code
30
github-code
50
71590351834
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # 概要 plot補助ツール群 # 参考 * [matplotlibでグラフの文字サイズを大きくする](https://goo.gl/E5fLxD) * [Customizing matplotlib](http://matplotlib.org/users/customizing.html) """ import numpy as np from cycler import cycler import matplotlib.pyplot as plt import matplotlib.patches as patches...
toru-ver4/sip
lib/plot_utility.py
plot_utility.py
py
8,857
python
en
code
4
github-code
50
70392240156
class CabineTelefonica: def __init__(self): self.saldo = 0.0 self.estado = 'INATIVO' self.numero = '' self.valor_moedas_validas = [0.10, 0.20, 0.50, 1.0, 2.0] self.moedas_inseridas = [] def valida_moedas(self, lista_moedas): for moeda in lista_moedas: ...
Alpha241/PL2023
TPC5/cabine.py
cabine.py
py
2,641
python
pt
code
0
github-code
50
10270639147
# -*- coding: utf-8 -*- """ Created on Mon Apr 20 14:18:56 2020 @author: cip18jjp """ def count_boxes(data, box_size, range_box ): import numpy as np """ Parameters ---------- data : Pandas series data consisting of x and y coordinates box_size : array Of box lengths (m)...
jjp4595/PIN_Productivity_Project
Scripts/fractal_working.py
fractal_working.py
py
1,437
python
en
code
0
github-code
50
1127226856
import numpy as np def separated(values, *, limit, stringify, sep): """ Print up to ``limit`` values with a separator. Args: values (list): the values to print limit (optional, int): the maximum number of values to print (None for no limit) stringify (callable): a function to use ...
stellargraph/stellargraph
stellargraph/core/validation.py
validation.py
py
2,274
python
en
code
2,810
github-code
50
37228476875
dizionario = {'a':'b','b':'c','c':'d','d':'e','e':'f','f':'g','g':'h','h':'i','i':'l','l':'m','m':'n','n':'o','o':'p','p':'q','q':'r', 'r':'s','s':'t','t':'u','u':'v','v':'z','z':'a'} parola = input('Inserisci la parola: ') NuovaStr="" for i in parola: NuovaStr+=dizionario[i] print(NuovaStr) decodifica...
theCocoCj/Python
cifrario_Cesare.py
cifrario_Cesare.py
py
636
python
it
code
2
github-code
50
22797019505
import json from django.conf import settings from django.core.management import BaseCommand from mainapp.models import ProductCategory, Product from authapp.models import ShopUser def load_from_json(file_name): with open(f'{settings.BASE_DIR}/json/{file_name}.json', encoding='utf-8') as json_file: return...
ZaharBerdnikov/geekshop
mainapp/management/commands/fill.py
fill.py
py
1,071
python
en
code
0
github-code
50
70401183515
import io import copy import kivy from kivy.app import App from kivy.uix.button import Button from kivy.uix.filechooser import FileChooserIconView from kivy.uix.floatlayout import FloatLayout from kivy.uix.label import Label from kivy.uix.togglebutton import ToggleButton from kivy.uix.boxlayout import BoxLayou...
dkatsios/Graspy
User/GUI_main.py
GUI_main.py
py
27,302
python
en
code
0
github-code
50