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
17055643944
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class MaskedUserCertView(object): def __init__(self): self._is_certified = None self._user_id = None self._user_name = None @property def is_certified(self): re...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/MaskedUserCertView.py
MaskedUserCertView.py
py
1,861
python
en
code
241
github-code
13
6374990783
import scrapy from ..items import TestItem class TestSpider(scrapy.Spider): name = "test" allowed_domains = ["www.runoob.com"] start_urls = ["http://vip.stock.finance.sina.com.cn/corp/view/vRPD_NewStockIssue.php"] def parse(self, response): data = response.xpath('//*[@id="NewS...
JohnKingm123/DailyTraining
20230920/Proj/ttt/ttt/spiders/test.py
test.py
py
1,134
python
en
code
0
github-code
13
11562139201
class Student: def __init__(self, name: str, school: str): self.name = name.capitalize() self.school = school.capitalize() self.marks = [] def average_mark(self): return sum(self.marks) / len(self.marks) @classmethod def friend(cls, origin, friend_name: str, *args, **kw...
ikostan/automation_with_python
IntroToPython/inheritance.py
inheritance.py
py
1,047
python
en
code
0
github-code
13
21102824071
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 23 09:42:57 2021 @author: rotoapanta """ """ crear una funcion de nombre fibonacci, que reciba como parámetro un numero n fibonacci(n) y que genera los numeros contenidos entre [0,n] correspondiente a la serie o sucesión de Fibonacci """ def fibon...
rotoapanta/programacion_python_aplicada_ingenieria
test2/fibonacci.py
fibonacci.py
py
442
python
es
code
0
github-code
13
29834703955
from spider.exam_handler import * import requests # 考试相关查询爬虫 class Exam(object): def __init__(self): self.url = { 'ch_test': 'http://www.cltt.org/StudentScore/ScoreResult', 'admit_query': 'http://zsjy.gzhu.edu.cn/gklqcxjgy.jsp?wbtreeid=1080' } self.cl...
vancece/GZHU-Pi
Server_py/spider/exam_spider.py
exam_spider.py
py
2,609
python
en
code
19
github-code
13
37019452046
# This is a sample Python script. from mdb_bp import driver from datetime import datetime import csv databaseName = "main" productBlockchainName = "product" materialsBlockchainName = "material" projectBlockchainName = "project" # Press the green button in the gutter to run the script. if __name__ == '__main__': #...
blockpointSystems/python-example
main.py
main.py
py
4,863
python
en
code
0
github-code
13
28680538035
import sys input = sys.stdin.readline N = int(input()) ns = [0] ns.extend([int(input()) for _ in range(N)]) dp = [0 for _ in range(N+1)] if N >= 1: dp[1] = ns[1] if N >= 2: dp[2] = ns[2] + ns[1] if N >= 3: for i in range(3,N+1): dp[i] = max(dp[i-1],dp[i-2]+ns[i],dp[i-3]+ns[i]+ns[i-1]) print(dp[-1])...
hodomaroo/BOJ-Solve
백준/Silver/2156. 포도주 시식/포도주 시식.py
포도주 시식.py
py
323
python
en
code
2
github-code
13
39477635724
import pygame import sys class Grid: # constructor def __init__(self,width,height,R): self.width = width self.height = height self.W = int(width/R) + 1 self.H = int(height/R) + 1 self.R = R self.boxes = {} # add an index to the relevant boxes given a spacial coordinate def add(self,vec,ind): x = i...
BrownestAndStickyest/Some-fun-programming
Fluid simulations/Grid.py
Grid.py
py
1,009
python
en
code
0
github-code
13
18751279978
# -*- coding=utf-8 import time from qcloud_cos import CosConfig from qcloud_cos import CosS3Client import sys import logging import os # 腾讯云COSV5Python SDK, 目前可以支持Python2.6与Python2.7以及Python3.x # https://cloud.tencent.com/document/product/436/48987 logging.basicConfig(level=logging.INFO, stream=sys.stdout) # 设置用户...
tencentyun/cos-python-sdk-v5
demo/ci_media.py
ci_media.py
py
66,969
python
zh
code
173
github-code
13
1346899171
from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils from pyhealth.datasets import SampleEHRDataset from pyhealth.models import BaseModel # VALID_OPERATION_LEVEL = ["visit", "event"] class RETAINLayer(nn.Module): """RETAIN layer. Paper: E...
sunlabuiuc/PyHealth
pyhealth/models/retain.py
retain.py
py
17,019
python
en
code
778
github-code
13
16852688736
# Class and Object Basics ''' Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. ''' # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # class ''' A Class is like an object constructor...
Aswanthcp/python-Basics
classBasics.py
classBasics.py
py
2,657
python
en
code
0
github-code
13
24237793306
from API.LL_API import LL_API import datetime from UI.airplaneUI import AirplaneUI from UI.crewUI import CrewUI from UI.EditMenus.extra_crewmember_menu import AddExtraCrewmemberMenu import datetime class VoyageUI: EMPTY = 'empty' SEPERATOR = '-' def getDateInput(self): '''Gets a date input from t...
helenaj18/Dagbok
NaNair/UI/voyageUI.py
voyageUI.py
py
25,605
python
en
code
0
github-code
13
69893121299
"""Intersections between districts and counties. Get which districts intersect with which counties. This will speed up the block level interpolation because we can reduce to counties that intersect with each district rather than interpolating on the entire state. """ import geopandas as gpd import os from download_ce...
jacobwachspress/locality-splitting
geoprocessing/county_district_intersections.py
county_district_intersections.py
py
3,946
python
en
code
1
github-code
13
20839376233
""" stock unittest """ import unittest import pandas as pd import numpy as np from stock import get_balance_sheet, get_profit_statement from stock import get_annual_report, get_quarterly_results from stock import get_basic_info, get_level0_report, get_level1_report from stock import classifier_level_report, pct_chang...
flychensc/orange
test/test_stock.py
test_stock.py
py
6,205
python
en
code
1
github-code
13
10510330475
from selenium.common.exceptions import NoSuchElementException import math from selenium.common.exceptions import NoAlertPresentException from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from ....
MikalaiKryvusha/stepik-selenium-page-object
pages/base_page.py
base_page.py
py
3,652
python
en
code
0
github-code
13
22233431173
"""import array as arr myArray = arr.array('hello', [1.3, 2.4, 5.6]) print(myArray[0])""" import pprint def ThreeD(a, b, c): lst = [[ ['#' for col in range(a)] for col in range(b)] for row in range(c)] return lst col1 = 5 col2 = 3 row = 2 pprint.pprint(ThreeD(col1, col2, row))
Cu3t0m/Projects-2.0
Python/School/tests.py
tests.py
py
294
python
en
code
0
github-code
13
19552598700
# 491 - Tile Topology # Resources: http://stackoverflow.com/questions/60208/replacements-for-switch-statement-in-python import sys def get_tilings(n): return{ 2: str(1), 3: str(2), 4: str(7), 5: str(18), 6: str(60), 7: str(196), 8: str(704), 9: str(2500), 10: str(9189), 11: str(33896), 12: s...
tristan-hunt/UVaProblems
tiletopology.py
tiletopology.py
py
516
python
en
code
0
github-code
13
498099367
import os import time import torch import datetime import numpy as np from tqdm import tqdm from models import * from transformers import BertTokenizer from trainer.utils import multi_acc, multi_mse, load_datasetbert_from_local, multi_f1_macro, multi_f1_micro from models.get_optim import get_Adam_optim_v2 ALL_MODLES...
yoyo-yun/DG_RRR
trainer/trainer_bert.py
trainer_bert.py
py
17,326
python
en
code
0
github-code
13
42415745375
from torch import nn, optim from torch.autograd import Variable import torch from torch.nn import functional as F class ModelWrapperWGAN: def __init__(self, d, g, clamp_lower, clamp_upper, opt_params, input_, noise, meters, loggers): self...
festeh/GAN-thesis
WGAN/model.py
model.py
py
2,440
python
en
code
0
github-code
13
35784943708
import numpy as np import pickle import os import argparse import matplotlib.pyplot as plt from tqdm import tqdm import torch from torch.utils.data import DataLoader from rf.model import RF_conv_decoder from rf.proc import rotateIQ from data.datasets import RFDataRAMVersion from losses.NegPearsonLoss import Neg_Pe...
UCLA-VMG/EquiPleth
nndl/rf/train.py
train.py
py
11,112
python
en
code
6
github-code
13
18002512993
# -*- coding: utf-8 -*- from django.contrib import admin from translater.models import TranslatedString,OriginalString class TranslatedStringAdmin(admin.ModelAdmin): list_display = ['translated','To'] admin.site.register(TranslatedString,TranslatedStringAdmin) class OriginalStringAdmin(admin.ModelAdmin): ...
lauro-cesar/Django-template-Tag-Translator
translater/admin.py
admin.py
py
466
python
en
code
4
github-code
13
26377037128
#!python import sys import numpy as np import utils # Metric function to compare histograms def chi2_distance(histA, histB, eps = 1e-10): # compute the chi-squared distance d = 0.5 * np.sum([((a - b) ** 2) / (a + b + eps) for (a, b) in zip(histA, histB)]) # return the chi-squared distance return d # This fun...
MarkLuk/cryptopals
challenge03.py
challenge03.py
py
2,790
python
en
code
0
github-code
13
72392505619
import cv2 as cv import numpy as np img = np.ones((800,800,3), dtype='uint8') font = cv.FONT_HERSHEY_COMPLEX # putText format is... image,text,position,font,font-size,color,line-size,line-type cv.putText(img, 'Naruto Uzumaki',(150,400), font, 2, (255,255,255), 6, cv.LINE_4) cv.imshow('Writing Text',img) cv.wai...
Reaper-Dhan/OpenCV-Learning
Drawing/text.py
text.py
py
350
python
en
code
0
github-code
13
19415005286
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib as mlp from matplotlib.font_manager import fontManager # 引入中文字體 fontManager.addfont('ChineseFont.ttf') mlp.rc('font', family='ChineseFont') data = pd.read_csv('./Salary_Data.csv') # print(data) # 數學上可以用 y = w * x + b 來表示一條直線 # 月...
IOUKI/simple-linear-regression
gradientDescent.py
gradientDescent.py
py
3,408
python
en
code
0
github-code
13
72570257939
import lightning.pytorch as pl import torch.nn as nn import torch import math from model.transformer.encoder_layer import EncoderLayer from model.transformer.positional_encoding import positional_encoding class Encoder(nn.Module): def __init__(self, num_layers, d_model, num_heads, dff, input_vocab_size, ...
Junhua9981/NCU_NLP_Assignments
Homework1_NER_WNUT2016/model/transformer/encoder.py
encoder.py
py
1,299
python
en
code
0
github-code
13
25119010319
from __future__ import print_function from ape1_and_apeplan import ipcArgs, envArgs, APE1, APEplan from shared.dataStructures import PlanArgs from timer import globalTimer, SetMode #from time import time from state import ReinitializeState, RemoveLocksFromState import threading import colorama from shared import GLOBAL...
patras91/rae_release
planners/APE_and_APEplan/APE.py
APE.py
py
7,978
python
en
code
1
github-code
13
26388593480
#!/usr/bin/python3 """ module 1 """ from sys import argv saving = __import__("7-save_to_json_file").save_to_json_file loading = __import__("8-load_from_json_file").load_from_json_file try: x = loading("add_item.json") except Exception: x = [] for arg in argv[1:]: x.append(arg) saving(x, "add_item.json")
nourouhichi/higher_level_programming
0x0B-python-input_output/9-add_item.py
9-add_item.py
py
319
python
en
code
0
github-code
13
37449835905
import sys sys.path.insert(0, './yolov5') import os from pathlib import Path import cv2 import torch from yolov5.models.common import DetectMultiBackend from yolov5.utils.datasets import LoadImages from yolov5.utils.general import LOGGER, check_img_size, non_max_suppression, scale_coords, check_imshow, xyxy2xywh, \ ...
nk-v/Tracker
main.py
main.py
py
7,664
python
en
code
0
github-code
13
10686719159
import random from qlearnexamples import * # The Q-Learning Algorithm # EXERCISE ASSIGNMENT: # Implement the Q-learning algorithm for MDPs. # The Q-values are represented as a Python dictionary Q[s,a], # which is a mapping from the state indices s=0..stateMax to # and actions a to the Q-values. # # Choice of actio...
beyzabutun/Artificial-Intelligence
qlearn/qlearn.py
qlearn.py
py
3,531
python
en
code
0
github-code
13
3870210741
import hppfcl import numpy as np import meshcat import meshcat.geometry as mg import meshcat.transformations as tf import pinocchio as pin from distutils.version import LooseVersion import warnings from typing import Any, Dict, Union, List MsgType = Dict[str, Union[str, bytes, bool, float, 'MsgType']] def npToTTuple(M...
agimus-project/winter-school-2023
simulation/sim2_collision/utils_render.py
utils_render.py
py
13,620
python
en
code
0
github-code
13
1808191237
from abc import ABC, abstractmethod from typing import List, NamedTuple, Union from flask import current_app, g from serpapi import GoogleSearch SEARCH_PARAMS = { "engine": "google_scholar", "hl": "en", "start": 0, "num": "20", } class GoogleScholarAuthor(NamedTuple): name: str link: str clas...
OHDSI/CommunityDashboard
projects/plots/plots/services/google_scholar.py
google_scholar.py
py
2,077
python
en
code
5
github-code
13
72714660177
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Fri Apr 29 13:44:51 2016 @author: sthomp Command Line Script to run vetter on the K2 data. Inputs File of this info or the info itself EpicId Campaign Period (days) epoch (bkjd) depth (ppm) config File """ import dave.pipeline.clipboar...
exoplanetvetting/DAVE
runbackend/justVetK2.py
justVetK2.py
py
8,284
python
en
code
9
github-code
13
6048080557
# _*_ coding:utf-8 _*_ import json import requests url = 'https://api.github.com/some/endpoint' payload = {'some': 'data'} headers = {'content-type': 'application/json'} r = requests.post(url, data=json.dumps(payload), headers=headers) print(r.url) print(r.text) payload = {'key': 'value1', 'key2': 'value2'} r = reque...
VersionBeathon/Expension
practice_requests/create_head.py
create_head.py
py
567
python
en
code
0
github-code
13
22107827089
import pandas as pd import logging from decouple import config from sqlalchemy import create_engine def salidas(): RUTA_CSV = 'C:\\Users\\WalterPc\\Documents\\Alkemy\\' nombre = 'archivo.csv' archivo = nombre engine = create_engine(conection()) archivocsv=pd.read_csv(RUTA_CSV+archivo, sep=',...
Wquiroz2022/Analisis-de-Datos---Python
app/config.py
config.py
py
1,378
python
es
code
0
github-code
13
43976370301
import jieba from collections import Counter import math #窗口大小为2 def combine2gram(cutword_list): if len(cutword_list) == 1: return [] res = [] for i in range(len(cutword_list) - 1): res.append(cutword_list[i] + cutword_list[i + 1]) return res #窗口大小为3 def combine3gram(cutword_list): ...
iluveatingmyf/DL-NLP2022-Homework
entropy_calculating_char.py
entropy_calculating_char.py
py
3,629
python
en
code
0
github-code
13
1330807783
import csv import os import datetime import re def read_csv_file(filename): results = [] with open(filename, mode='r') as csv_file: csv_reader = csv.DictReader(csv_file) count = 0 for row in csv_reader: count = count + 1 if "FOODTYPE" in row: if row["FOODTYPE"] != "": results.append(row) retu...
stevezieglerva/nc-state-fair-ride-and-food-finder
create_page.py
create_page.py
py
3,912
python
en
code
0
github-code
13
37882452380
directions = [(-1,0), (1, 0), (0,-1), (0,1)] def helper(r, c, count, lst, num): if count == 7: return [num] else: for dr, dc in directions: if (dr+r>3) or (dr+r<0) or (dc+c>3) or (dc+c<0): continue lst.add(helper(r+dr, c+dc, count+1, lst, num*10 + int(bo...
kod4284/kod-algo-note
삼성Expert/D4/2819-격자판의-숫자-이어붙이기/solution2.py
solution2.py
py
815
python
en
code
0
github-code
13
39587358131
# POC for ACR token creation import adal # <= ToDo: should probably be using MSAL import requests import os import json # can use this to debug requests import http.client # Registry Token mgmt features are not yet available in the SDK # can replace using env vars with KeyVault entries tenant = os.environ['AZURE_TENA...
edwin-huber/ACR_Token_POC
src/ACR_Rest_Client.py
ACR_Rest_Client.py
py
6,170
python
en
code
0
github-code
13
32648513996
from django.db import models class RainbowEntry(models.Model): baseID = models.AutoField(primary_key=True) base = models.CharField("Base", max_length=15, null=True, blank=True) hashes = models.TextField("Hashes", null=True, blank=True) added = models.DateTimeField("Added", auto_now_add=True) class...
rclmenezes/Mebro
jp/models.py
models.py
py
1,608
python
en
code
1
github-code
13
31929390814
""" utility module for azimuthal-related plots """ import numpy as np from scipy.signal import gaussian import util ############################################################################### outer_start = 1.1 outer_end = 2.3 ### Helper Methods ### def my_searchsorted(array, target): """ np.searchsorted, ...
Sportsfan77777/vortex
code_synthetic_images/archive/azimuthal.py
azimuthal.py
py
13,155
python
en
code
1
github-code
13
4087258661
import numpy as np import matplotlib.pyplot as plt import urllib.request # ごくシンプルな畳み込み層を定義しています。 class Conv: def __init__(self, W, filters, kernel_size): self.filters = filters self.kernel_size = kernel_size self.W = W # np.random.rand(filters, kernel_size[0], kernel_size[1]) def f_prop...
yasuno0327/LearnCNN
aidemy/cnn/task8.py
task8.py
py
3,246
python
en
code
1
github-code
13
37862226263
import numpy as np def idlMod(a, b): """ Emulate 'modulo' behavior of IDL. Parameters ---------- a : float or array Numerator b : float Denominator Returns ------- IDL modulo : float or array The result of IDL modulo operation. """ if isinstance(a...
sczesla/PyAstronomy
src/pyasl/asl/idlMod.py
idlMod.py
py
448
python
en
code
134
github-code
13
26108341204
import heapq import sys V, E = map(int, input().split()) start = int(input()) g = [[] for _ in range(V+1)] for _ in range(E): u, v, w = map(int, input().split()) g[u].append([v, w]) D = [sys.maxsize] * (V+1) def dijkstra(start): q = [] heapq.heappush(q, (0, start)) D[start] = 0 while q: ...
necteo/CoTeStudy
boj/1753_최단경로.py
1753_최단경로.py
py
765
python
en
code
0
github-code
13
22236156146
import unittest from unittest import mock import uuid import tempfile import os from pathlib import Path import numpy as np from iblutil.io.parquet import uuid2np, np2uuid, np2str, str2np from iblutil.io import params import iblutil.io.jsonable as jsonable from iblutil.numerical import intersect2d, ismember2d, ismemb...
int-brain-lab/iblutil
tests/test_io.py
test_io.py
py
3,441
python
en
code
0
github-code
13
24344322593
#!/usr/bin/python from max6675 import MAX6675, MAX6675Error import time import socket#for sockets import sys#for exit import struct # Make sure to use the pi's GPIO numbers of pins rather than the generic pin numbers 1-40 as they do not match. cs_pin = 24 #(CS) clock_pin = 23 #(SCLK/SCK) data_pin = 22 #(SO/MOSI) units...
sheparddw/pi-coffee-roaster-probe
sendTempToRDP.py
sendTempToRDP.py
py
2,438
python
en
code
1
github-code
13
30000443028
import json # breadJson breadJson = [ { "breadType": "cream", "recipe": { "flour": 100, "water": 100, "cream": 200 } }, { "breadType": "sugar", "recipe": { "flour": 100, "water": 50, "sugar": 200...
jhs3104/Test_vcanus
1/bread.py
bread.py
py
2,687
python
en
code
0
github-code
13
15147955039
#coding=utf-8 import os import pandas as pd from sklearn.model_selection import train_test_split from dataset.bd_xjtu_dataset import collate_fn, dataset import torch import torch.utils.data as torchdata from torchvision import datasets, models, transforms from torchvision.models import resnet50 import torch.optim as op...
OdingdongO/pytorch_classification
2018_bd_xjtu_train.py
2018_bd_xjtu_train.py
py
3,045
python
en
code
251
github-code
13
70520255697
import os import torch import torch.nn as nn from einops import rearrange # import imageio.v3 as iio import numpy as np import copy import matplotlib.pyplot as plt from torchvision import datasets, transforms import math import torch.nn.functional as F import warnings from IJEPA.video_dataset import VideoFrameDataset,...
gbugli/DL_project_2023
IJEPA/train_decoder.py
train_decoder.py
py
12,512
python
en
code
0
github-code
13
2464952133
import threading import time import random class queue(object): lock = threading.RLock() def __init__(self): self.item = -1 def add(self, n): self.lock.acquire() self.item = n self.lock.release() def remove(self): self.lock.acquire() saida = self.it...
fabiomoreirafms/CES-22-Exercicios
ExercicioThread.py
ExercicioThread.py
py
1,314
python
en
code
0
github-code
13
17092913894
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.PartnerVO import PartnerVO class KoubeiRetailWmsPartnerQueryResponse(AlipayResponse): def __init__(self): super(KoubeiRetailWmsPartnerQueryResponse, self...
alipay/alipay-sdk-python-all
alipay/aop/api/response/KoubeiRetailWmsPartnerQueryResponse.py
KoubeiRetailWmsPartnerQueryResponse.py
py
1,313
python
en
code
241
github-code
13
22191539702
from typing import Any, Iterator import yaml from linkml.validator.loaders.loader import Loader class YamlLoader(Loader): """A loader for instances serialized as YAML""" def __init__(self, source) -> None: """Constructor method :param source: Path to YAML source """ super()...
linkml/linkml
linkml/validator/loaders/yaml_loader.py
yaml_loader.py
py
955
python
en
code
228
github-code
13
34884240139
#Nishit Patel #0946768 #LAB04 import socket local_address = '0.0.0.0' local_port = 80 #TCP/IP socket npsocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) #bind ip address npsocket.bind((local_address,local_port)) #print("Server listening on IP Address : "+ local_address +"\nPort "+ "80") print...
nishitpatel28/security_application_lab4
Echo_Server.py
Echo_Server.py
py
1,095
python
en
code
0
github-code
13
23572265779
a=input() b=input() if len(a)<len(b): print('LESS') elif len(a)>len(b): print('GREATER') else: f=0 for i in range(len(a)): if a[i]>b[i]: print('GREATER') break elif a[i]<b[i]: print('LESS') break else: ...
Kota28/AtCoder
ABC59_B.py
ABC59_B.py
py
399
python
en
code
0
github-code
13
32664834120
"""Retrieve list of emails of people who hold access to a service.""" import json import os import jasmin_account_api_client as jclient import jasmin_account_api_client.api.services as jservices import jasmin_account_api_client.api.users as jusers SERVICE_ID = 92 client = jclient.AuthenticatedClient("https://accoun...
cedadev/jasmin-account-api-client
examples/emails_of_roleholders.py
emails_of_roleholders.py
py
1,082
python
en
code
0
github-code
13
33451067427
import requests class Market: def __init__(self, question, address): self.question = question self.address = address def market_checker(): api_url = "https://clob.polymarket.com/markets" markets = [] response = requests.get(api_url, timeout=10, verify=False).json() for element in...
udvarid/CoreWarDon
util/market_checker.py
market_checker.py
py
480
python
en
code
0
github-code
13
44648342961
import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import math import numpy as np import datetime from scipy import stats def plot_cases_per_country(cummulative_data): countries = ['Canada', 'US', 'China', 'Taiwan*'] # plot cumulative cases for country in countries: plt.plot(c...
HenryF23/COVID-19-Analysis
Project/analyze_rates.py
analyze_rates.py
py
5,280
python
en
code
0
github-code
13
11628913075
#!/usr/bin/env python import numpy as np import pytest from deap import tools from olympus import Observations, ParameterVector from olympus.planners import Genetic # use parametrize to test multiple configurations of the planner @pytest.mark.parametrize( "pop_size, cx_prob, mut_prob, mate_args, mutate_args, se...
aspuru-guzik-group/olympus
tests/test_planners/test_planner_genetic.py
test_planner_genetic.py
py
3,149
python
en
code
70
github-code
13
5943374798
# -*- coding: utf-8 -*- import os import sqlite3 as sql from flask import Flask from flask import request from flask import send_file, render_template, redirect from urllib.parse import unquote_plus app = Flask(__name__) @app.route('/') def redirige(): return redirect("/index") @app.route('/index', methods=['G...
AugustinCobena/Map-MerciMax
app.py
app.py
py
7,518
python
fr
code
0
github-code
13
9891945104
# # Converted to Python by Eric Shen <ericshen@berkeley.edu> # Sobel edge detector recognizer # import cv2 import numpy as np import os import argparse import logging log_format = '%(created)f:%(levelname)s:%(message)s' logging.basicConfig(level=logging.DEBUG, format=log_format) # log to file filename='example.log',...
christhompson/recognizers-arch
apps/darkly/sobel/recog.py
recog.py
py
1,460
python
en
code
1
github-code
13
71350187859
from __future__ import annotations from abc import ABCMeta from abc import abstractmethod from typing import List, Set, Dict, Union, Any, Optional import numpy as np import pandas as pd import peperoncino as pp class ColumnsChangedError(Exception): pass class RowsChangedError(Exception): pass class BaseP...
cafeal/peperoncino
peperoncino/processing.py
processing.py
py
9,825
python
en
code
2
github-code
13
73019818579
''' 1. List all interface Confirm the interface, save selection for next running 2. Start to listen data in the interface 3. Ping device in 5s(may be need configure) Send ping command 4. Collect response Return the mac address ''' from typing import Dict from app.bootstrap import Bootstrap from app.d...
yiweisong/ins401-log
main.py
main.py
py
4,209
python
en
code
0
github-code
13
9520324484
import json import logging import os import re import subprocess import sys from collections import defaultdict from datetime import datetime, timedelta import attr import click from click_loglevel import LogLevel from tools.libs.net_utils import ip_if_not_local from tools.libs.parse_args import LoggingArgumentParser...
canepan/bot
src/tools/bin/service_map.py
service_map.py
py
9,185
python
en
code
1
github-code
13
30630290472
""" Python program to find factoral using two method recursive and iterative""" #By recursion method def fact (n): if n==1: return 1 else: return n*fact(n-1) a=int(input("Enter the number to find the factorial: ")) print(f"The Factorial of {a} is {fact(a)}") #By iteration...
aliasthomas/factorial
factorial.py
factorial.py
py
516
python
en
code
1
github-code
13
11818122295
class hmshow(): def __init__(self, word, letter, guessed): self.word = word self.letter = letter.upper() self.guessed = guessed def show(self): _word = [] length = len(self.guessed) if self.letter not in self.word: print("Incorrect !!!") for l...
PranabBandyopadhyay/Tutorial1
hangman_show.py
hangman_show.py
py
673
python
en
code
0
github-code
13
17091318724
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.MemberWalletBalanceDetailVO import MemberWalletBalanceDetailVO class AntMerchantMemberwalletBalancedetailsQueryResponse(AlipayResponse): def __init__(self): ...
alipay/alipay-sdk-python-all
alipay/aop/api/response/AntMerchantMemberwalletBalancedetailsQueryResponse.py
AntMerchantMemberwalletBalancedetailsQueryResponse.py
py
2,065
python
en
code
241
github-code
13
36549546702
import sys import os import configparser import subprocess import json try: from .matcher import Matcher from .pbar import Pbar from .run_sys_agent import agent_system except ImportError as ex: path=os.path.abspath('.') if 'tools' in path.replace('\\','/').split('/'):#这里是为了便于开发调试 path=path....
ezeeo/ctf-tools
Library/utils/py_env_util.py
py_env_util.py
py
12,214
python
en
code
8
github-code
13
23510532976
from __future__ import division import os import numpy as np import math import csv from time import localtime, strftime from PIL import Image import scipy.misc import subprocess import matplotlib.pyplot as mp def loadDemo(data_path, resize_size): # Read human_demo.txt txt_name = [ss for ss in os.listdir(dat...
fei960922/Research_STGC_IL
src/util.py
util.py
py
8,251
python
en
code
1
github-code
13
23495299506
#!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': arr = [] for _ in range(6): arr.append(list(map(int, input().rstrip().split()))) sum_a = [] for index in range(0,4): for key in range (0,4): a = sum(a...
dvphuonguyen/pythonCoBan
BaiTapCoBan/2D_array.py
2D_array.py
py
562
python
en
code
0
github-code
13
31494025262
# Classe TV: Faça um programa que simule um televisor criando-o como um objeto. O usuário deve ser capaz de # informar o número do canal e aumentar ou diminuir o volume. Certifique-se de que o número do canal e o nível # do volume permanecem dentro de faixas válidas. class TV: def __init__(self): self.vol...
GuilhermeMastelini/Exercicios_documentacao_Python
Classes/Lição 6.py
Lição 6.py
py
1,481
python
pt
code
0
github-code
13
18983427061
import math def ticket_price(age): if 0 <= age < 7 or age >= 60: return "Бесплатно" elif 7 <= age < 18: return "100 рублей" elif 18 <= age < 25: return "200 рублей" elif 25 <= age < 60: return "300 рублей" else: return "Ошибка" def double(value): new_va...
tonyglaz/small_projects
py_tests/utils.py
utils.py
py
1,632
python
en
code
0
github-code
13
27216166598
#!/usr/bin/python3 ''' 这个写出来是为了测试main包好不好使的 这个基本上是一个test的例子, 以后基本上就按照这个文件写 ''' import sys sys.path.append("..") import insummer from insummer.query_expansion import EntityFinder from insummer.read_conf import config from insummer.query_expansion1.semantic_complement import add def test1(): conf = config("../....
lavizhao/insummer
code/test/test_main.py
test_main.py
py
769
python
en
code
7
github-code
13
74593193616
from os import environ import os SESSION_CONFIG_DEFAULTS = dict(real_world_currency_per_point=1, participation_fee=0, fixed_payment=25, additional_payment=50, variable_payment=1, ...
CarlMenger/DP_Stefunko
settings.py
settings.py
py
2,190
python
en
code
0
github-code
13
35295874698
from collections import defaultdict n = int(input()) a = list(map(int, input().split())) mod = 10**9+7 d = defaultdict(int) for i in range(n): d[a[i]] += 1 # odd if n%2!=0: for key in list(d.keys()): if key==0 and d[key]!=1: exit(print(0)) elif key!=0 and key%2==0 and d[key]!=2: exit(print...
nozomuorita/atcoder-workspace-python
abc/abc050/c.py
c.py
py
576
python
en
code
0
github-code
13
10191398595
import copy import sys sys.setrecursionlimit(10 ** 6) n = int(input()) arr = [list(map(int, input().split())) for _ in range(n)] dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] def dfs(x, y): global cnt visited[x][y] = 1 for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0 <= nx < n and ...
Jinnie-J/Algorithm-study
baekjoon/[2468]안전영역.py
[2468]안전영역.py
py
973
python
en
code
0
github-code
13
72641301139
from flask import Flask, render_template, redirect, url_for, flash, request from flask_bootstrap import Bootstrap from flask_ckeditor import CKEditor from datetime import date from werkzeug.security import generate_password_hash, check_password_hash from flask_sqlalchemy import SQLAlchemy from sqlalchemy.orm import rel...
wuwen6937/blog
main.py
main.py
py
8,613
python
en
code
0
github-code
13
17039339854
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayDigitalmgmtHrcominsuInsuclaimQueryModel(object): def __init__(self): self._data_key = None @property def data_key(self): return self._data_key @data_key.setter...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayDigitalmgmtHrcominsuInsuclaimQueryModel.py
AlipayDigitalmgmtHrcominsuInsuclaimQueryModel.py
py
917
python
en
code
241
github-code
13
35205512329
from collections import Counter from util import aoc def parse(input): return sorted(int(j) for j in input.splitlines()) def part_one(model): hist = Counter() hist[3] = 1 # last adapter -> device prev = 0 for j in model: hist[j - prev] += 1 prev = j return hist[1] * hist[3]...
barneyb/aoc-2023
python/aoc2020/day10/adapter_array.py
adapter_array.py
py
659
python
en
code
0
github-code
13
74651580498
import time n1 = int(input('Digite um valor: ')) n2 = int(input('Digite outro valor: ')) usuario = 0 while usuario != 5: print('=-='*10) print('[1] SOMAR\n[2] MULTIPLICAR\n[3] MAIOR\n[4] NOVOS NÚMEROS\n[5] SAIR DO PROGRAMA') usuario = int(input('Sua escolha: ')) print('=-='*10) if usuario == 1: ...
uRexxy/Python-Ex.-CEV
Exercícios/Exercício 059.py
Exercício 059.py
py
865
python
pt
code
1
github-code
13
13382115386
# Run Speed Up Data(Prepare Text File) import os from extractTextFile import OutputExtractor # 首先從 Input 拿到不要執行的 Phase inputf = input("Put the Phase that u not want to execute.(seperate by space) ").split(" ") if not(len(inputf) == 1 and inputf[0] == ""): notExecute = list(map(lambda x: int(x), inputf)) else: ...
Elven9/NTHU-2020PP-Mandelbrot-Set-Calculation
Script/runSpeedup.py
runSpeedup.py
py
2,947
python
en
code
2
github-code
13
10348362786
import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from twitterAPI import * global BLFile BLFile = 'defaultList.txt' global username def window(): app = QApplication(sys.argv) win = QWidget() flo = QFormLayout() userIn = QLineEdit() userIn.textC...
Pilotman/scold-or-troll
main.py
main.py
py
1,787
python
en
code
0
github-code
13
42166261240
import subprocess from selenium.common.exceptions import StaleElementReferenceException,\ MoveTargetOutOfBoundsException import string try: import win32com.client except: pass import enums from base import * import clsTestService from general import General from selenium.webdriver.common.keys import Keys fr...
NadyaDi/kms-automation
web/lib/kea.py
kea.py
py
317,258
python
en
code
0
github-code
13
39443461963
# -*- coding: utf-8 -*- """ Vented box enclosure """ import numpy as np from . import air class VentedBox(object): """ Model a vented box loudspeaker enclosure """ def __init__(self, Vab, fb, Ql): self._Vab = Vab #: Acoustic compliance of box :math:`C_{ab}` #: #: .. note:: Do ...
Psirus/altai
altai/lib/vented_box.py
vented_box.py
py
1,632
python
en
code
0
github-code
13
41847458573
from schemas.response import Response, ErrorResponse, \ JsonResponse from schemas.event import EventScheme from lib.db import ydbclient import ydb from crud import create async def main(event: EventScheme) -> Response: print(event) try: await ydbclient.connect() id = await create(event.bod...
Gamer201760/cloud-func-base
main.py
main.py
py
629
python
en
code
0
github-code
13
40206200810
#! /usr/bin/python3 #Single Exponential Smoothing ''' Similar to weighted average, only with the diference that we consider all of data points, while assigning exponentially smaller weights as we go back in time, eventually approaching the big old zero, the weights are dictated by math and decay uniformly. The smaller...
PitCoder/NetworkMonitor
Service_Monitoring/Holt-Winters/single_exponential_smoothing.py
single_exponential_smoothing.py
py
1,515
python
en
code
2
github-code
13
32315220205
import time import pyvisa import logging import numpy as np class Array3664A: def __init__(self, time_offset, resource_name): self.time_offset = time_offset self.rm = pyvisa.ResourceManager() if resource_name != 'client': try: self.instr = self.rm.open_resource(...
js216/CeNTREX
drivers/Array3664A.py
Array3664A.py
py
2,537
python
en
code
1
github-code
13
5108829198
#-*-coding:utf-8-*- import asyncio import danmaku import redis import pyautogui list_name = 'bilibili' key_list = ('w', 's', 'a', 'd', 'j', 'k', 'u', 'i', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'f', 'o','p','g','h', 'l', 'q', 'e', 'r', 'y', '+', '-') direction = ('w', 's', 'a', 'd') def init_redis...
ShaoChenHeng/danmu_pokemon
danmu/main_sword.py
main_sword.py
py
3,471
python
en
code
4
github-code
13
24375497002
import numpy as np import pandas as pd dates = pd.date_range('20130101',periods=6) df = pd.DataFrame(np.arange(24).reshape((6,4)),index=dates,columns=['A','B','C','D']) df.iloc[2,2] = 111 df.loc['20130101','B'] = 222 # df[df.A>4] = 0 #整个A>4的整列都更改 # df.A[df.A>4] = 0 #仅对A列A>4的数字都更改为0 df.B[df.A>4] = 0 #仅对B列A>4的数字都更改为0 d...
BaymaxBai01/Machine_Learning
numpy & pandas & matplotlib/hm_20_pd_3.py
hm_20_pd_3.py
py
559
python
en
code
0
github-code
13
15153951132
#!/usr/bin/env python """ translate.py [-] <filename> Translates a DNA sequence to a protein sequence """ import sys from optparse import OptionParser from mungo.fasta import FastaFile, pretty from mungo import sequence usage = "%prog [options] <fasta file>" parser = OptionParser(usage=usage) parser.add_option("-...
PapenfussLab/Mungo
bin/translate.py
translate.py
py
914
python
en
code
1
github-code
13
73507449297
from sklearn.manifold import TSNE import matplotlib.pyplot as plt import cv2 import numpy as np def tsne(data, labels): tsne = TSNE(n_components=2) data_tsne = tsne.fit_transform(data) unique_labels = np.unique(labels) plt.figure(figsize=(8, 6)) for label in unique_labels: indices = np....
tiagojosemiranda/Giro
visualizations.py
visualizations.py
py
1,183
python
en
code
0
github-code
13
26068868148
def get_tree(): nums = int(input()) node = dict() for i in range(nums): node[str(i)] = input().split() return nums, node def get_root(nums, tree): tmp = [] for i in tree.values(): tmp += i[1:] for i in range(nums): if not str(i) in tmp: return tree[str(i)...
piglaker/PTA_ZJU_mooc
src06.py
src06.py
py
1,630
python
en
code
0
github-code
13
72308568019
import numpy as np import cv2 class Stitcher: # 拼接函数 def stitch(self, images, ratio=0.75, reprojThresh=4.0, showMatches=False): # ratio是k对匹配算法里面的比例,一般设置0.75;reprojThresh是用来计算单应性矩阵的特征点个数 # 获取输入图片 (imageB, imageA) = images # 检测A、B图片的SIFT关键特征点,并计算特征描述子 (kpsA, ...
huangxinyu1/opencv-
opencv学习/测试.py
测试.py
py
5,456
python
zh
code
0
github-code
13
37482016184
N = int(input()) danzi = [] # 지도의 크기 total_danzi = 0 # 총 단지수 house_cnt = 0 # 단지내 집의 수 house_list = [] # 단지내 집의 수 리스트 for _ in range(N): # 단지 입력받기 val = list(map(int,input())) danzi.append(val) def dfs(x,y): global house_cnt if x <= -1 or x >= N or y <= -1 or y >= N: return False if danz...
Choi-Seong-Hyeok/Algorithm
DFS/단지번호붙이기(rt).py
단지번호붙이기(rt).py
py
891
python
ko
code
0
github-code
13
20418498932
from math import * print("(0 -single filers,1-married filing jointly,\n 2-married filing separately,3 -head ofhousehold)") status=int(input("Enter the filing status: ")) tax=0 if (status == 0): taxableIncome = int(input("Enter the taxable income: ")) a=8350 b=33950 c=82250 d=171550 e=3...
Przemek-Gosik/Zadania_Python
zadania python/Zad1.py
Zad1.py
py
1,517
python
en
code
0
github-code
13
73539334738
import numpy as np from ml.stats import Stats from ml.data import split_xy def classify(theta, x): return 1 if np.dot(theta, x) >= 0 else -1 def train(data, iterations=1000): x, y = split_xy(data) n, d = x.shape theta = np.zeros(d) for it in range(iterations): for i in range(n): ...
anton-bannykh/ml-2013
david.meynster/ml/perceptron.py
perceptron.py
py
786
python
en
code
4
github-code
13
33076705502
from turtle import Screen from paddle import Paddle from ball import Ball from scoreboard import ScoreBoard import time screen = Screen() screen.setup(height=int(600), width=int(800)) screen.bgcolor("black") screen.title("Pong") screen.tracer(0) r_paddle = Paddle((350, 0)) l_paddle = Paddle((-350, 0)) b...
MClaireaux/Pong
main.py
main.py
py
1,270
python
en
code
0
github-code
13
8574143885
from ImageData import train_test_split,load_image import matplotlib.pyplot as plt images, labels, image_names, category =load_image(100) data = train_test_split(image_size=128, test_size=0.3) print("images in test set",len(data.train.images)) print('displaying a loaded image ') plt.imshow(images[123]) plt.show()
shibinmak/CNN-TF-FLOYDHUB
floydhub execution/checks.py
checks.py
py
320
python
en
code
0
github-code
13
21993106572
import pymongo def get_collection_bicycles(): import os # Declaramos una variable con el tiempo de espera máximo para la respuesta del servidor mongo_timeout = 5000 # Variable de entorno que contiene un string con la URI de conexión al cluster mongo_uri = os.environ['MONGO_URI'] # Esta variabl...
isaacvt01/isaacvt01.github.io
src/db/connection/get_collection_bicycles.py
get_collection_bicycles.py
py
1,125
python
es
code
1
github-code
13
17834694846
# -*- coding: utf-8 -*- """ @author: zhaox """ import matplotlib matplotlib.use('Qt5Agg') from matplotlib import pyplot as plt import matplotlib.animation as animation import FE_model import numpy as np import FE_analysis #Build the FE model mesh = FE_model.mesh() properties = FE_model.properties(mesh) BC = FE_model....
e8543420/PS_ML
anima_FRF.py
anima_FRF.py
py
928
python
en
code
0
github-code
13
73908821457
#Import augmentation libraries import albumentations as A import cv2 import numpy as np from pathlib import Path #Import libraries for data visualization import matplotlib.pyplot as plt import json #Define a function to read bounding boxes def get_bbox(data): #Create a list to store the bounding boxes bboxes ...
dataschoolai/augmentation_objectdetection
coco_augmentation.py
coco_augmentation.py
py
5,566
python
en
code
0
github-code
13
74060072658
import json import os from setuptools.command.install import install class InstallEntry(install): def run(self): default_site = 'codeforces' cache_dir = os.path.join(os.path.expanduser('~'), '.cache', 'ACedIt') from acedit.main import supported_sites for site in supported_sites...
coderick14/ACedIt
acedit/install_entry.py
install_entry.py
py
755
python
en
code
77
github-code
13