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
6810114320
#!/usr/bin/python3 import numpy as np import matplotlib.pyplot as plt np.set_printoptions(precision=4) def f(x): return 1/(1+5*x**2) xw=np.linspace(-1,1,65) fw=f(xw) """ A=np.array([xw**i for i in range(0,xw.shape[0])]) wsp=np.linalg.solve(A.T,fw) print(wsp) def f(p): sum=np.zeros_like(p) for i in range(wsp.shape[...
matstep0/metody_numeryczne
zad8/zad8.py
zad8.py
py
710
python
en
code
0
github-code
13
2715181311
from random import choice import pandas as pd from bw2calc import MultiLCA from bw2data import calculation_setups import bw2data as bd from bw2data.backends import Activity def run_multi_lca( name: str, functional_units: dict[Activity:float], impact_methods: list[str] ): """ Perform MultiLCA calculation...
LIVENlab/enbios
enbios2/bw2/experiment_multiLCA.py
experiment_multiLCA.py
py
1,881
python
en
code
3
github-code
13
18347578118
""" Adapted from https://github.com/tornadomeet/ResNet/blob/master/symbol_resnet.py Original author Wei Wu Referenced https://github.com/bamos/densenet.pytorch/blob/master/densenet.py Original author bamos Referenced https://github.com/andreasveit/densenet-pytorch/blob/master/densenet.py Original author andreasveit Ref...
zhreshold/mxnet-ssd
symbol/densenet.py
densenet.py
py
8,900
python
en
code
763
github-code
13
11442377904
#matplotlib #2D ploting lib import cv2 from matplotlib import pyplot as plt img=cv2.imread('HappyFish.jpg') cv2.imshow('image',img) #how to show image using matplotlib img= cv2.cvtColor(img,cv2.COLOR_BGR2RGB) plt.imshow(img) plt.xticks([]), plt.yticks([]) plt.show() cv2.waitKey(0) cv2.destroyAllWindows()
Ines-chihi3/openCV-tutorial
15-Matplotlib.py
15-Matplotlib.py
py
309
python
en
code
0
github-code
13
33638113886
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('blog', '0005_reply'), ] operations = [ migrations.RemoveField( model_name='reply', name='comment', ...
asbxzeeko/tenkiamemma
blog/migrations/0006_auto_20151113_0929.py
0006_auto_20151113_0929.py
py
625
python
en
code
0
github-code
13
32798193665
class RedBlackNode: def __init__(self, data): self.data = data self.height = 0 self.left = None self.right = None self.color = "red" self.parent = None class RedBlack: def __init__(self, root=None, height=-1): self.root = root def rbt_tree_replace...
akarellano2/DataStructures
RedBlack.py
RedBlack.py
py
7,528
python
en
code
0
github-code
13
10717159096
import time import RPi.GPIO as GPIO class BaseValve(): def __init__(self, logger, config): self.logger = logger self.config = config def open(self): self.logger.info("Opening valve") def close(self): self.logger.info("Closing valve") class TestValve(BaseValve): def open(self): BaseValve....
adi-miller/Irrigate
valves.py
valves.py
py
1,498
python
en
code
0
github-code
13
29329209912
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import patches import seaborn as sns from matplotlib.colors import LinearSegmentedColormap import mortality_frequency as mf import cartopy.crs as ccrs from hexalattice.hexalattice import * import surface_temperature as st achi =...
Damyck/tMednet
tmednetGUI/Probita.py
Probita.py
py
3,834
python
en
code
2
github-code
13
2061930760
"""Module for configuring Pytest with custom logger settings. This module allows users to disable specific loggers when running pytest. """ import logging import os import pandas as pd import pytest @pytest.fixture(autouse=True) def set_pandas_options() -> None: """Forces pandas to print all columns on one lin...
ADGEfficiency/energy-py-linear
tests/conftest.py
conftest.py
py
998
python
en
code
56
github-code
13
43261311812
from heapq import heappop, heappush from collections import defaultdict class Segtree(): def segfunc(self, x, y): return min(x, y) def __init__(self, LIST, ELE): self.n, self.ide_ele = len(LIST), ELE self.num = 1 << (self.n - 1).bit_length() self.tree = [ELE] * 2 * self.num ...
Shirohi-git/AtCoder
abc161-/abc170_e2.py
abc170_e2.py
py
2,186
python
en
code
2
github-code
13
72915497298
import re import dataclasses import mimetypes import pytest webview = pytest.importorskip('qutebrowser.browser.webengine.webview') from qutebrowser.qt.webenginecore import QWebEnginePage from qutebrowser.utils import qtutils from helpers import testutils @dataclasses.dataclass class Naming: prefix: str = "" ...
qutebrowser/qutebrowser
tests/unit/browser/webengine/test_webview.py
test_webview.py
py
4,239
python
en
code
9,084
github-code
13
73615769939
#!/usr/local/bin/python import sys import twitter import argparse # OAuth keys for account and API access. import keys def main(args): api = twitter.Api(consumer_key=keys.consumer_key, consumer_secret=keys.consumer_secret, access_token_key=keys.access_token_key, ...
karnival/chirp
chirp.py
chirp.py
py
1,617
python
en
code
0
github-code
13
27697655163
import asyncio import faros_discovery async def test_some_remote_operations(found): # This opens a context over a list of Remote objects. Within the following # scope, each of them has a valid connection open, until the end of the # async with block. async with faros_discovery.Remote.sshify(found) as connecti...
skylarkwireless/pyfaros
doc/ssh_example_documented.py
ssh_example_documented.py
py
2,978
python
en
code
0
github-code
13
28660704664
from robust_motifs.data import ResultManager, BcountResultManager from pathlib import Path import seaborn as sns import matplotlib.pyplot as plt # Plots absolute motif count for individual rats and compares to control models. r_average = ResultManager(Path("data/ready/average")) r = [] for pathway in range(13,18): ...
matsantoro/counting_motifs
plot_scripts/plot_individuals_bcounts.py
plot_individuals_bcounts.py
py
2,051
python
en
code
1
github-code
13
360990153
#!/usr/bin/env python import os import time try: import lcm except ImportError as e: print('Could not import LCM') print('If you are working in a venv, try cloning upstream and then:\n') print('\tpip install -e ~/path/to/lcm/lcm-python\n') raise e import management class LCMSyslog: def __in...
bluesquall/lcm-syslog
python/lcmsyslog.py
lcmsyslog.py
py
2,207
python
en
code
0
github-code
13
71497004819
# 언어 : Python # 날짜 : 2022.1.2 # 문제 : BOJ > 1로 만들기 2(https://www.acmicpc.net/problem/12852) # 티어 : 실버 1 # ===================================================================== def solution(): visited = [] queue = [[N, [N]]] while queue: number, path = queue.pop(0) if number == 1: ...
eunseo-kim/Algorithm
BOJ/class5/01_1로 만들기 2.py
01_1로 만들기 2.py
py
790
python
en
code
1
github-code
13
7293039260
import numpy as np import matplotlib.pyplot as plt def estimate_coef(x,y): print(x) print(y) n = np.size(x) print("Size - ",n) m_x, m_y = np.mean(x), np.mean(y) print("Mean x- ",m_x,"Mean y - ",m_y) SS_xx = np.sum(y * x - n * m_y *m_x) SS_xy = np.sum(x * x - n * m_x * m_x) print(SS_x...
shruti735/Machine-Learning
Learning11.py
Learning11.py
py
1,079
python
en
code
0
github-code
13
7050430955
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import cv2 video_reader=cv2.VideoCapture(0) #read input from webcam while True: success,frame=video_reader.read()...
ISHPREETKAUR01DISNEY/Resume
Video.py
Video.py
py
542
python
en
code
0
github-code
13
36293038972
# Aqui estamos criando a tabela de ranking listando a pontuação dos jogadores import sqlite3 from sqlite3 import Error def create_connection(db_file): conn = None try: conn = sqlite3.connect(db_file) print(sqlite3.version) return conn except Error as e: print(e) return co...
GabrielSkf/T_Rex-Adventure
CRIANDO TABELA.py
CRIANDO TABELA.py
py
1,202
python
pt
code
1
github-code
13
6634457324
"""Escreva um programa que leia dois números inteiros e compare-os. mostrando na tela uma mensagem:""" from utilidadescev.dado import leiafloat from utilidadescev.string import linha linha(25, 'azul') num1 = leiafloat('Primeiro número: ') num2 = leiafloat('Segundo número: ') linha(25, 'azul') linha(25, 'amarelo') if ...
rafaelsantosmg/cev_python3
cursoemvideo/ex038.py
ex038.py
py
494
python
pt
code
1
github-code
13
17046185904
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.InsurancePeriod import InsurancePeriod from alipay.aop.api.domain.RecomProduct import RecomProduct class AlipaySecurityRiskHahaIsptestQueryModel(object): def __init__(self): ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipaySecurityRiskHahaIsptestQueryModel.py
AlipaySecurityRiskHahaIsptestQueryModel.py
py
3,628
python
en
code
241
github-code
13
12791243437
#If statement if x > 8: print('This number is equals to 10 ') # Will execute if x > 8 is true print('This number is not equal 10 ') # will execute if x > 8 is not true (Outside of if statement) #If else statement if x >= 10: print('Ths number is equals to 10') # Will execute if x >= 10 is true else: pri...
watermillow321/Hello_World
Loop.py
Loop.py
py
4,264
python
en
code
0
github-code
13
62349043
#!/usr/bin/python # -*- coding: utf-8 -*- from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QDialog, QTableWidgetItem, QHeaderView from lab1.gui import gui, transaction from PyQt5.QtGui import QIcon import pymysql import sys class MainWindow(QMainWindow): def __init__(self): super().__in...
HIT-SCIR-chichi/hit_db_lab
lab1/main.py
main.py
py
15,405
python
en
code
11
github-code
13
11510830139
import argparse import os import platform import re import subprocess import sys from pathlib import Path from timeit import default_timer as timer from .errors import PyxellError from .indentation import transform_indented_code from .parser import PyxellParser from .transpiler import PyxellTranspiler abspath = Path...
adamsol/Pyxell
src/main.py
main.py
py
5,964
python
en
code
51
github-code
13
5590670180
import numpy as np import re def universities_to_keep(authors, universities): while('(' in authors and ')' in authors): universities.append( authors[authors.find('(')+1 : authors.find(')')] ) authors = authors[: authors.find('(')] + authors[ authors.find(')')+1 : ] if '(' in autho...
brozi/graphs-and-text
authors_and_universities.py
authors_and_universities.py
py
2,132
python
en
code
1
github-code
13
2322648441
import pandas as pd import numpy as np import gensim from gensim import corpora, models from tqdm import tqdm from keras.preprocessing.text import Tokenizer import operator stopwords = gensim.parsing.preprocessing.STOPWORDS EMBED_SIZE = 300 MAX_FEATURES = 10000 #the number of unique words MAXLEN = 220 #max lenght o...
Dzz1th/Kaggle-Jigsaw_toxic_comment
Model/text_preprocessing.py
text_preprocessing.py
py
10,624
python
en
code
0
github-code
13
9759661768
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 26 17:00:52 2022 @author: nicholassimon """ # Import relevant libraries import spacy import pandas as pd from spacytextblob.spacytextblob import SpacyTextBlob import snscrape.modules.twitter as sntwitter import statistics import os # NLP variab...
cgwhall/NBA-Projections
2_Twitter_NLP.py
2_Twitter_NLP.py
py
4,175
python
en
code
0
github-code
13
43263479952
from collections import Counter n = int(input()) a = Counter(map(int, input().split())) ans = 0 for i in range(max(a) + 1): cnt = a[i - 1] + a[i] + a[i + 1] ans = max(cnt, ans) print(ans)
Shirohi-git/AtCoder
arc081-/arc082_a.py
arc082_a.py
py
198
python
en
code
2
github-code
13
9982054720
from app.bid import FingerGuessCard def test_FingerGuessCard(): for i, v in enumerate(FingerGuessCard.points): c1 = FingerGuessCard() c1.set_point(v) c2 = FingerGuessCard() c2.set_point(v) r = FingerGuessCard.compare(c1.point, c2.point) assert r == 0 c3 = F...
abrance/LimitedGuessing
test/app/bid.py
bid.py
py
576
python
en
code
0
github-code
13
33691440442
#!/usr/bin/python import time import pprint import json import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import os from datetime import datetime, timedelta from pip import main print(os.getcwd()) print(os.path.dirname(__file__)) data_path=os.path.dirname(__file_...
Payton814/Helix_Temp_Masking
Helix_Temp_Stuff/plot_temps_timeline_overall.py
plot_temps_timeline_overall.py
py
15,866
python
en
code
0
github-code
13
32315416575
import json from pathlib import Path import zmq import zmq.auth from zmq.auth.thread import ThreadAuthenticator def Decode(topicfilter, message): """ Function decodes the message received from the publisher into a topic and python object via json serialization """ dat = message[len(topicfilter) :...
js216/CeNTREX
test.py
test.py
py
1,450
python
en
code
1
github-code
13
24259802794
# Factorial of a number def main(): n=int(raw_input("Enter a non-negative integer: " )) def factorial(n): if n<0: return "Wrong value, Enter a integer" # checking input else: if n==0: #base case return 1 else: return n*factorial(n-1) #recursive call print ("Factorial of", n,...
AdonisPeguero/Computer-Science-Work
project 3 part 1 python.py
project 3 part 1 python.py
py
485
python
en
code
0
github-code
13
18074126172
# 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: vc = [] def smallest(self, root, s): if (root == None): return ...
akshitagit/Python
Data_Structures/Smallest String Starting From Leaf.py
Smallest String Starting From Leaf.py
py
770
python
en
code
116
github-code
13
29591579062
import matplotlib.pyplot as plt import numpy as np #generating the mandelbrot set with python. Used as a reference for the cairo implementation def get_iter(c:complex, thresh:int =4, max_steps:int =25) -> int: # Z_(n) = (Z_(n-1))^2 + c # Z_(0) = c z=c i=1 while i<max_steps and (z*z.conjugate()).re...
Orland0x/StarknetFractals
scripts/mandelbrotWithPython.py
mandelbrotWithPython.py
py
1,461
python
en
code
14
github-code
13
28104547167
last_login = {} user_total_time = {} with open("logs.txt") as f: for line in f: login, action, time = line.split(";") time = int(time) if action == "LOGIN" : last_login[login] = time elif action == "LOGOUT": user_total_time[login] = user_total_time.get(login, ...
Damianpon/damianpondel96-gmail.com
Zjazd 4/zad2_.py
zad2_.py
py
512
python
en
code
0
github-code
13
5915673374
from SerialData import SerialData class Hyperparameters(SerialData): def __init__(self, debug_mode: bool = False): super().__init__() self.parameters = Hyperparameters._default_parameters(debug_mode) def serialize(self) -> dict: return self.parameters def deserialize(self, obj:...
dkoleber/nas
src/Hyperparameters.py
Hyperparameters.py
py
2,482
python
en
code
0
github-code
13
73680771537
#迭代 class Solution: def invertTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ if root == None: return root.left,root.right = root.right,root.left self.invertTree(root.left) self.invertTree(root.right) return root #栈...
ericzhai918/Python
JZ-Offer/invert_binary_tree.py
invert_binary_tree.py
py
735
python
en
code
0
github-code
13
74564830098
#!/usr/bin/env python """ Unittests for IteratorTools functions """ from __future__ import division, print_function import unittest from WMCore.ReqMgr.DataStructs.RequestError import InvalidSpecParameterValue from WMCore.ReqMgr.Utils.Validation import (validateOutputDatasets, ...
dmwm/WMCore
test/python/WMCore_t/ReqMgr_t/Utils_t/Validation_t.py
Validation_t.py
py
2,882
python
en
code
44
github-code
13
72943545938
# country = input().split(", ") # capitals = input().split(", ") # dict_capitals = dict(zip(country, capitals)) # # for key,value in dict_capitals.items(): # print(f"{key} -> {value}") country = input().split(", ") capital = input().split(", ") country_capital = {country[i]: capital[i] for i in range(len(country...
Andon-ov/Python-Fundamentals
20_dictionaries_exercise/capitals.py
capitals.py
py
398
python
en
code
0
github-code
13
40503144425
""" ciphertext 中有一堆 ZERO 與 ONE 先處理成 0 和 1 每 8 個為一組,轉成 ascii """ import base64 import morse_talk as mtalk s = input().split() ans = '' for x in s: if x == "ONE": ans += '1' elif x == "ZERO": ans += '0' else: print("another thing : '", x, "'.") s = "" for i in range(0, len(ans), 8)...
forward0606/CTF
encode/alexctf-2017: CR1: Ultracoded/decode.py
decode.py
py
966
python
en
code
2
github-code
13
22391178157
#!/usr/bin/env python3 from PIL import Image import argparse import pathlib def image_to_pam(image_path, pam_path): im = Image.open(image_path) # Can be many different formats. pix = im.load() width, height = im.size channels = len(im.mode) assert channels == 3 or channels == 4 ...
IgniparousTempest/libretro-superflappybirds
engine/png_to_pam.py
png_to_pam.py
py
1,808
python
en
code
7
github-code
13
30241219543
'=======================================Функции====================================' #функции - именованный блок кода который принимает аргументы и возвращает результат # my_sum - lambda num1, num2: num1 + num2 # res - my_sum(5,10) # print(res)#15 #lambda - ключевое слово для создания анонимной функции def my_sum2(...
Bekaaaaaaaa/python27---lections-
functions/functions.py
functions.py
py
4,007
python
ru
code
0
github-code
13
15851360535
import numpy as np import scipy import read_data as rd import wordle as w import wordle_game as wg import console_game as cg import wordle_gui as gui import random class GameMode: CONSOLE = 1 SUGGESTED_GUESS_TESTING = 2 GUI = 3 def main(): #game_mode = GameMode.CONSOLE #game_mode = GameMode.SUGGE...
joewestersund/wordle
main.py
main.py
py
5,112
python
en
code
0
github-code
13
17521403997
import pandas as pd from matplotlib import pyplot as plt import seaborn as sns import textwrap sns.set(style="white", font="Arial", context="paper") # Create box whisker function def PlotBoxWhiskerByGroup(dataframe, outcome_variable, group_variable_1,...
KyleProtho/AnalysisToolBox
Python/Visualizations/PlotBoxWhiskerByGroup.py
PlotBoxWhiskerByGroup.py
py
7,324
python
en
code
0
github-code
13
34015666232
# -*- coding: cp1251 -*- import sys import json import time import math import datetime import requests import psycopg2 rows_count = 20000 """ Необходимое количество записей """ if 1 < len(sys.argv): rows_count = sys.argv[1] print(rows_count) """ Функция для подключения к юазе данных """ def sql_connect()...
misterobot404/estate-price-calculator
worker.py
worker.py
py
7,839
python
ru
code
1
github-code
13
36164666696
# -*- coding: utf-8 -*- from selenium import webdriver from time import sleep from bs4 import BeautifulSoup from selenium.webdriver.common.by import By from bs4 import BeautifulSoup import re from fake_useragent import UserAgent import requests def customer_review_flipkart(main_url): main_url = main_url+'&page='...
posi2/web-scrapping
customer_review_flipkart_selenium.py
customer_review_flipkart_selenium.py
py
2,525
python
en
code
0
github-code
13
38682245956
from data import get_mnist import numpy as np import matplotlib.pyplot as plt """ w = weights, b = bias, i = input, h = hidden, o = output, l = label e.g. w_i_h = weights from input layer to hidden layer """ images, labels = get_mnist()#unosimo slike i lables #images-shape(60000,784) lables- shape(60000.10) #weights ...
N1ko1a/MNIST-Neural-Network
nn.py
nn.py
py
2,950
python
en
code
2
github-code
13
13061050435
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext from numpy import get_include ext_modules = [ Extension("staticgraph.graph_edgelist", ["staticgraph/graph_edgelist.pyx"], include_dirs=[get_include()]), Extension("stati...
parantapa/staticgraph
setup.py
setup.py
py
1,181
python
en
code
1
github-code
13
20798536650
# 3. Write a function that receives as parameters two lists a and b and returns: (a intersected with b, a reunited with b, a - b, b - a) list_C = [] def intersection_of_lists(list_A,list_B) : global list_C list_C = [value for value in list_A if value in list_B] print(list_C) def reunion_of_lists(lis...
Tiberius2/PythonProgramming
Lab2/Lab2PyEx3.py
Lab2PyEx3.py
py
1,170
python
en
code
0
github-code
13
17044832834
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOpenMiniVersionGrayOnlineModel(object): def __init__(self): self._app_version = None self._bundle_id = None self._gray_strategy = None @property def app_ver...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayOpenMiniVersionGrayOnlineModel.py
AlipayOpenMiniVersionGrayOnlineModel.py
py
1,972
python
en
code
241
github-code
13
28596486300
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 6 23:33:03 2021 @author: Dartoon """ import numpy as np import astropy.io.fits as pyfits import matplotlib.pyplot as plt import pandas as pd import glob s_sample = pd.read_csv('../Shenli_data/five_band_color.csv', index_col = 0) folder = 'NTT_...
dartoon/my_code
projects/2021_dual_AGN/extra/analysis_offset_to_Shenli.py
analysis_offset_to_Shenli.py
py
4,476
python
en
code
0
github-code
13
40307304356
SECRET_KEY = 'asdf' HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine', }, } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } import logging logging.disable(logging.CRITICAL) INSTALLED_APPS...
django-oscar/django-oscar-sagepay-direct
tests/settings.py
settings.py
py
902
python
en
code
4
github-code
13
896248956
# -*- encoding: utf-8 -*- from discord.ext import commands from discord import app_commands, Interaction, Color, Embed from views import SimpleEmbed, SimpleButton from setup import logger class CommandsCog(commands.Cog): """ A cog is a collection of commands, listeners, and optional state to help group commands...
splinestein/splinebot
commands.py
commands.py
py
1,730
python
en
code
0
github-code
13
16027270204
# 유기농배추 # 백준 1012 # 난이도 : 실버2 # 인접해있는 1 묶음의 개수 구하기 from collections import deque # 동서남북 dy = (0, 0, 1, -1) dx = (1, -1, 0, 0) # bfs 코드 def bfs(X, Y): queue = deque([]) queue.append((X, Y)) field[X][Y] = 0 while queue: a, b = queue.popleft() for i in range(4): nx, ny = a +...
joonann/ProblemSolving
python/202307/0718/b_1012_유기농배추.py
b_1012_유기농배추.py
py
1,096
python
ko
code
0
github-code
13
605559379
import io import os import torch from setuptools import setup, find_packages from torch.utils.cpp_extension import BuildExtension, CUDAExtension def get_requirements(): req_file = os.path.join(os.path.dirname(__file__), "requirements.txt") with io.open(req_file, "r", encoding="utf-8") as f: return [l...
1ytic/warp-rnnt
pytorch_binding/setup.py
setup.py
py
2,286
python
en
code
204
github-code
13
36737144423
#Returns a pandas dataframe with required query results. from airflow.models import BaseOperator import pandas as pd from datetime import datetime from airflow.plugins_manager import AirflowPlugin from google_analytics_plugin.hooks.mysql_hook import MySqlHook class MySqlQueryOperator(BaseOperator): def __init__...
nihalsangeeth/airflow-plugins-collection
plugins/google_analytics_plugin/operators/mysql_query_operator.py
mysql_query_operator.py
py
953
python
en
code
2
github-code
13
71031587537
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates from statsmodels.tsa.ar_model import AutoReg as AR from matplotlib.dates import DateFormatter import statsmodels.api as sn from statsmodels.graphics.tsaplots import plot_acf import math from math import sqrt from s...
Prakash-Mandloi/machine-learnig--to-predict-covid-case
covid_case_predictor.py
covid_case_predictor.py
py
5,071
python
en
code
0
github-code
13
26039770500
""" Created on 30.05.2021 This script handles the GET and POST requests to the covid19 API endpoint http://localhost:8000/api/covid19/ This api gets the latest covid19 data, shows the organized and sorted data. Users also could search according to country code 'GET': Returns the html page for the case repo...
bounswe/2021SpringGroup4
practice-app/api/covid_reports/main.py
main.py
py
6,863
python
en
code
2
github-code
13
15475045585
str1 = '4 4 1 1 16' str2 = ['1 1','1 2','1 3','1 4','2 1','2 2','2 3','2 4','3 1','3 2','3 3','3 4','4 1','4 2','4 3','4 4'] from collections import deque n,m,s,t,q = map(int,str1.split()) flea_dict = {} for i in range(q): split_cord = str2[i].split() flea_dict[(int(split_cord[0]),int(split_cord[1]))] = -1 ...
ougordeev/Yandex
3_B_38_flea_horse.py
3_B_38_flea_horse.py
py
1,331
python
en
code
0
github-code
13
32618375326
class Solution(object): def mergeAlternately(self, word1, word2): """ :type word1: str :type word2: str :rtype: str """ merged = "" if len(word1) <= len(word2): for i in range(len(word1)): merged += word1[i] + word2[i] m...
LesleyBonyo/DSA-Python
python/mergeStringAlternatively.py
mergeStringAlternatively.py
py
535
python
en
code
0
github-code
13
4816784162
"""A bot for managing War of the Visions guild information via Discord.""" from __future__ import print_function from __future__ import annotations import json import logging import discord from data_files import DataFiles from reminders import Reminders from wotv_bot_common import ExposableException from wotv_bot imp...
andrewhayden/ffbe_forever_guild_bot
ffbe_forever_guild_bot.py
ffbe_forever_guild_bot.py
py
4,980
python
en
code
0
github-code
13
35654788052
""" Factory Method é um padrão de criação que permite definir uma interface para criar objetos, mas deixa as subclasses decidirem quais objetos criar. O FACTORY METHOD permite adiar a instanciação para as subclasses, garantindo o baixo acoplamento entre classes. """ import random from abc import ABC, abstractmethod fr...
JonasFiechter/UDEMY-Python
design_patterns/factory_method_CREATION.py
factory_method_CREATION.py
py
1,824
python
en
code
0
github-code
13
38256486201
import pandas as pd from tqdm import tqdm ## train data와 test data를 읽어와 pandas dataframe형태로 저장 def preprocess_query(type='train'): if type=='train': file_name = '../input/1. 실습용자료.txt' elif type=='test': file_name = '../input/2. 모델개발용자료.txt' with open(file_name, 'r', encoding='CP949') as f:...
donggunseo/SCI_Kostat2022
preprocess.py
preprocess.py
py
4,267
python
ko
code
2
github-code
13
70282254417
import sublime import sublime_plugin import datetime import os import logging import shutil import string import re log = logging.getLogger(__name__) cur1 = re.compile('\\$0') # A really quick and dirty template mechanism. # Stolen from: https://makina-corpus.com/blog/metier/2016/the-worlds-simplest-python-template-...
ihdavids/dnd
sets.py
sets.py
py
4,312
python
en
code
0
github-code
13
20879398154
# Impelement a queue in Python # Makes use of the list data structure inherent to Python class Queue: def __init__(self): self.Q = [] def remove(self): try: self.Q.pop(0) except: print("Error: queue is empty.") def add(self, item): self.Q.append(ite...
blakerbuchanan/algos_and_data_structures
datastructures/datastructures/queues.py
queues.py
py
697
python
en
code
0
github-code
13
70368875859
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : __init__.py @Date : 2022/03/23 @Author : Yaronzz @Version : 1.0 @Contact : yaronhuang@foxmail.com @Desc : """ import getopt import sys import os import easy_docs.docsify import easy_docs.util from http.server import HTTPServer, SimpleHTTPRequ...
yaronzz/easy-docs
easy_docs/__init__.py
__init__.py
py
1,807
python
en
code
1
github-code
13
32377749439
#4.3 loop #4.3.1 while_loop ##t=3 ##while t>0: ## print("t-minus "+str(t)) ## t=t-1 ##print("blastoff!") ##x=20 ##while x>10: ## print(x,"I am sorry, Dave.") ## x=x-1 ##print(x,"I cannot print that for you.") #fibonacci number ##fib=[1,1] ##while True: ## x=fib[-2]+fib[-1] ## i...
youngmei/python_starter
chapter4_loop.py
chapter4_loop.py
py
2,695
python
en
code
0
github-code
13
12805540781
def rlist(start, end, prefix='net_', suffix='', step=1): return ['%s%s%s' % (prefix, str(x), suffix) for x in xrange(start, end + 1, step)] feature_toggle = "echo 'hafnium.tempWorkarounds.skipProcessingBlock162=true' > /tmp/hafnium-simulation.properties;" \ "chmod 755 /tmp/hafnium-sim...
richa92/Jenkin_Regression_Testing
robo4.2/fusion/tests/wpst_crm/feature_tests/TBIRD/OVF3627_Nitro_Profiles/data_variables.py
data_variables.py
py
9,837
python
en
code
0
github-code
13
21667654132
# -*- coding: utf-8 -*- """ Created on Mon Nov 23 11:11:28 2015 @author: moizr_000 """ ''' The purpose of the following classes is to merge an MTA and WU dataframe into a master turnstile-weather dataframe with all the major structural features necessary for analysis. The MTADataFrame class does the brunt of this wor...
mar467/Turnstile-Weather
tw_dataframes.py
tw_dataframes.py
py
15,216
python
en
code
0
github-code
13
12496341233
from pathlib import Path import numpy as np # hatch.py """Get physics data for EGSnrc run Hatch is called before simulation begins. For Photons, hatch calls egs_init_user_photon, which in turn opens files via egsi_get_data, for compton, photoelectric, pair, triplet, Rayleigh (depending on the settings) and does corre...
darcymason/egsnrc
src/egsnrc/hatch.py
hatch.py
py
1,275
python
en
code
5
github-code
13
73989937297
''' Using https://www.alphavantage.co to retrieve stock prices. Requires a unique key, freely availalble. Sample request: https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=INX&apikey=0KEDXOP6GN0KTIY5 Return result: { "Meta Data": { "1. Information": "Daily Prices (open, high, ...
yh412467790/market-watch1
symbol_check.py
symbol_check.py
py
4,485
python
en
code
0
github-code
13
25578833622
""" Parse EFSMT instances in SMT-LIB2 files We provide two differnet implementations 1. Use a customized s-expression parser 2. Use z3's substitution facility """ from typing import Tuple import z3 # Being explicit about Types Symbol = str Number = (int, float) Atom = (Symbol, Number) List = list Expr = (Atom, List) ...
ZJU-Automated-Reasoning-Group/arlib
arlib/quant/efsmt_parser.py
efsmt_parser.py
py
8,603
python
en
code
6
github-code
13
21934916388
import operator from enum import Enum from functools import reduce from typing import Optional, List from django.db.models import Q from django.db.models.functions import Lower from django.shortcuts import get_object_or_404 from django.urls import reverse from ninja import ModelSchema, NinjaAPI, Field from ninja.pagin...
EBI-Metagenomics/holofood-database
holofood/api.py
api.py
py
17,034
python
en
code
0
github-code
13
42932983950
"""2.Создать новый двумерный массив, исключив из переданного массива совпадающие столбцы. (Совпадающие столбцы – столбцы, у которых все соответствующие элементы равны друз другу). При формировании нового массива оставить только первый из каждого набора совпадающих столбцов.""" matrix = [ [0, 3, 4, 5, 4, 5, 4], ...
syth0le/practice-coding-of-a-VSU-student
Python/CS_faculty/first/second.py
second.py
py
1,254
python
ru
code
0
github-code
13
15770372514
#!/anaconda3/bin/python print("Content-Type: text/html") print() import os, html_sanitizer def getList(): sanitizer = html_sanitizer.Sanitizer() files = os.listdir('data') # 맥OS 특성 상 맨 앞 히든파일 하나 pop으로 제거 (.dataStore 어쩌구 안 생기면 필요없을 수도 있음) # files.pop(0) listStr = '' for item in files: it...
kyoblee/web1
view.py
view.py
py
528
python
ko
code
0
github-code
13
8979905978
from tkinter import * root =Tk() root.title('Телефонная книженция') root.geometry('1280x720') numbers=[] def new_window(): win =Toplevel(root) win.grab_set() win.focus_set() win.wait_window() win.title('Создание контакта') win.minsize(width=600, height=400) add_button =Button(root, text='Д...
frolivanov/first-lesson
interfaces/kniga.py
kniga.py
py
1,022
python
ru
code
0
github-code
13
73071866897
import cv2 source = "sunny.jpeg" destination = "newImage.png" # percent by which to resize scale_percent = 400 # read the image src = cv2.imread(source, cv2.IMREAD_UNCHANGED) # calculate the new dimensions width = int(src.shape[1] * scale_percent / 100) height = int(src.shape[0] * scale_percent / 100) ...
SunnyMaurya63/Python_projects
ImageResizer/main.py
main.py
py
480
python
en
code
0
github-code
13
13163197801
import cv2 import numpy as np import random def show_labeled_pic(file_path, target_size=600): ''' visulize the made pictures with bbox target size: the target size for showing file_path: the path contains the train/val/test filename ''' #get a random picture from the filelist ...
thilius/3D_BBOX_from_2D
KITTI_Dataset/check_dataset_with_labels.py
check_dataset_with_labels.py
py
3,263
python
en
code
8
github-code
13
7116873954
#!/usr/bin/env python3 import numpy as np import rospy import math from std_msgs.msg import Empty, Float64 from geometry_msgs.msg import Pose2D from geometry_msgs.msg import Twist from controller import Supervisor TIME_STEP = 10 robot = Supervisor() # Cruise speed cars in left lane def callback_speed_cars_left_lane...
hector-aviles/ICRA2024
catkin_ws/src/icra2024/controllers/supervisor_icra/supervisor_icra.py
supervisor_icra.py
py
5,115
python
en
code
1
github-code
13
42482220564
# # bento-box # E2E Test # import pytest from git import Repo from math import cos, sin from bento import types from bento.sim import Simulation from bento.utils import to_yaml_proto from bento.graph.plotter import Plotter from bento.spec.ecs import EntityDef, ComponentDef from bento.example.specs import Velocity, Po...
bentobox-dev/bento-box
e2e/test_e2e.py
test_e2e.py
py
8,052
python
en
code
0
github-code
13
39066036325
import pygame import math from queue import PriorityQueue RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 255, 0) YELLOW = (255, 255, 0) WHITE = (255, 255, 255) BLACK = (0, 0, 0) PURPLE = (128, 0, 128) ORANGE = (255, 165, 0) GREY = (128, 128, 128) TURQUOISE = (64, 224, 208) class Node(): def __init__(self, row, ...
MatthiasHuber-Digital/PythonProgramming
AStarSearchAlgo_Objects_20220205.py
AStarSearchAlgo_Objects_20220205.py
py
11,761
python
en
code
0
github-code
13
15798415758
import requests from collections import Counter from nltk.corpus import stopwords import threading import json ## BOOKS ## Alice in Wonderland by Lewis Caroll GUTENBERG_URI = "https://www.gutenberg.org/files/11/11-0.txt" content_type = 'book' ## POEMS don't start until "SELECTED POEMS:" and have copywrite after Poems...
orsoknows/gutenberg-bot
streamParser.py
streamParser.py
py
2,000
python
en
code
0
github-code
13
28151334424
import requests HEADERS = { 'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0', 'accept': '*/*', } # currency: btc or ltc def get_cource(currency: str, product_price: int): cource = requests.get(f'https://apirone.com/api/v2/ticker?currency={currency}', headers=HE...
bat-py/the_first
crypto_price.py
crypto_price.py
py
442
python
en
code
1
github-code
13
26164290412
''' Author: Shuailin Chen Created Date: 2021-08-08 Last Modified: 2021-08-31 content: ResNet for domain adaptation purpose NOTE: these codes do not consider the plugin layers, so it may not suitable for models with plugin layers ''' import warnings import torch.nn as nn import torch.utils.checkpoint as cp from mm...
slchenchn/SAR_build_extract_v2
mmseg/models/backbones/resnet_mixbn.py
resnet_mixbn.py
py
15,813
python
en
code
0
github-code
13
12914033773
import logging from random import randrange, uniform import matplotlib.pyplot as plt from lib.kmeans.template_factory import get_templates from mpl_toolkits.mplot3d import Axes3D from pandas import DataFrame class KMeans: def __init__(self, db): self.__db = db self.__templates = get_templates(db....
SANElibDevTeam/SANElib
lib/kmeans/kmeans.py
kmeans.py
py
9,369
python
en
code
7
github-code
13
2451534227
import heapq num = input() ans = input() newNum = [] count = "" for n in num: if n == "0": count += "0" else: newNum.append(n) newNum.sort() if newNum: newNum[0] += count result = "".join(newNum) else: result = count # print(newNum) if result == ans: print("OK") else: print...
asnakeassefa/A2SVContest
correctSolution.py
correctSolution.py
py
336
python
en
code
0
github-code
13
6999431143
from airflow.models import ID_LEN from sqlalchemy import Column, Integer, String, DateTime, Boolean, JSON from airflow_dag_template.sqlalchemy_util import provide_session from airflow_dag_template.sqlalchemy_util import Base, props class TaskDefineModel(Base): __tablename__ = "l_task_define" __table_args__...
itnoobzzy/EasyAirflow
plugins/airflow_dag_template/TaskDefine.py
TaskDefine.py
py
1,686
python
en
code
0
github-code
13
39751824922
from typing import Dict # Third Party Imports from pubsub import pub # RAMSTK Package Imports from ramstk.configuration import RAMSTKUserConfiguration from ramstk.logger import RAMSTKLogManager from ramstk.views.gtk3 import Gtk, _ from ramstk.views.gtk3.widgets import RAMSTKWorkView # RAMSTK Local Imports from . imp...
ReliaQualAssociates/ramstk
src/ramstk/views/gtk3/usage_profile/view.py
view.py
py
7,751
python
en
code
34
github-code
13
35661276230
""" https://peps.python.org/pep-0380/ を簡略化したもの RESULT = yield from EXPR と等価な疑似コード 以下の条件で簡略化 - .throw() や .close() はなし - 処理できる例外も StopIteration のみ """ def yield_from(EXPR): # イテレータ _i を取得するために iter() を用いているので、 EXPR には任意のイテラブルを指定できる _i = iter(EXPR) # サブジェネレータ try: # サブジェネレータが予備処理される # その結果は格...
kazuma624/fluent-python
16-coroutine/yield_from0.py
yield_from0.py
py
2,026
python
ja
code
0
github-code
13
13736471682
from manejaHelados import ManejadoHelados from manejaSabores import ManejaSabores class Menu: __cod: int def __init__(self, cod = 0): self.__cod = cod def mostrar_menu(self): print('Opción 1: Cargar sabores') print('Opción 2: Registrar venta') print...
AlePerez2003/Ejercicio2U3
menu.py
menu.py
py
1,516
python
es
code
0
github-code
13
17053612994
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class IotVspOrgUserAddNotifyUserInfoRequest(object): def __init__(self): self._auth_code = None self._ext = None self._msg = None self._state = None self._vid = ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/IotVspOrgUserAddNotifyUserInfoRequest.py
IotVspOrgUserAddNotifyUserInfoRequest.py
py
2,522
python
en
code
241
github-code
13
3415533380
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver import ChromeOptions import time import requests import chardet as cd class brower_scrapy: ''' 通过自动化测试工具Selenium模拟人工操作浏览器 ''' # @function 初始化类,设置成员变量 # @parm(self) brower_scrapy 指向实例对象的指针 # @parm(opetions) Set 驱动属性配...
Joker3Chen/Scrapy-Web-Java
Scrapy-Python/scrapy_module.py
scrapy_module.py
py
4,983
python
en
code
0
github-code
13
70102288019
# from BeautifulSoup import BeautifulSoup from bs4 import BeautifulSoup from urllib.request import urlopen import re #https://arstechnica.com #http://synthia-dataset.net/download-2/ url_str = 'http://synthia-dataset.net/download-2/' html_page = urlopen(url_str) soup = BeautifulSoup(html_page) links = [] for link in s...
cyoukaikai/ahc_ete
smrc/utils/test/download_dataset.py
download_dataset.py
py
616
python
en
code
2
github-code
13
2839346331
import math # sqrt sqrt = math.sqrt(13) # pow: equivalent to use ** exp = math.pow(2.3, 3) # absolute value abs_value = abs(-9) # a built in function # max number (built-in) max_value = max(12, 23, 21, 10, 9, -8) # min number (built-in) min_value = max(12, 23, 21, 10, 9, -8) # trigonometric rations (...
vivekanandpv/python-sample-code
py-11-math.py
py-11-math.py
py
803
python
en
code
0
github-code
13
11351450521
''' bitmap通常基于数组来实现,数组的每个元素可看成是一系列二进制数,所有元素组成更大的二进制集合; python的整数类型为有符号类型,所以一个整数可用位数为31位 ''' import math class Bitmap(): def __init__(self, maxLength): # 计算需要多少个数组元素,向上取整 self.size = int(math.ceil(maxLength/31)) # 初始化bitmap self.arr = [0 for i in range(self.size)] def calElemIndex(self, num,):...
DaToo-J/NotesForBookAboutPython
ch9 大数据/bitmapTest.py
bitmapTest.py
py
2,177
python
zh
code
0
github-code
13
43577844204
"""empty message Revision ID: 7ff37bb2fe5e Revises: f60d63b471d5 Create Date: 2020-07-09 13:31:50.034106 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '7ff37bb2fe5e' down_revision = 'f60d63b471d5' branch_labels = None depe...
haydavid23/cs50FinalProject
migrations/versions/7ff37bb2fe5e_.py
7ff37bb2fe5e_.py
py
4,829
python
en
code
0
github-code
13
124227030
"""add role and district Revision ID: 4f2014c21c7d Revises: f19249efe3d2 Create Date: 2022-05-17 21:47:36.345019 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '4f2014c21c7d' down_revision = 'f19249efe3d2' branch_labels = None depends_on = None...
lewein/FastApiProject
migrations/versions/4f2014c21c7d_add_role_and_district.py
4f2014c21c7d_add_role_and_district.py
py
1,082
python
en
code
0
github-code
13
17085048334
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.ConnectServerAdaptResult import ConnectServerAdaptResult class AlipayIserviceCliveConnectCreateResponse(AlipayResponse): def __init__(self): super(Alipay...
alipay/alipay-sdk-python-all
alipay/aop/api/response/AlipayIserviceCliveConnectCreateResponse.py
AlipayIserviceCliveConnectCreateResponse.py
py
933
python
en
code
241
github-code
13
6574801386
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/11/24 上午11:06 # @Author : HuangBenHao import joblib import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import sys scaler_path = r'./best_model/min_max_scaler.pkl' model_state_dict_path = r'./best_model/_NN_epoch88_1109_16_1...
Lazzben/human-body-classification
predict2.py
predict2.py
py
1,474
python
en
code
0
github-code
13
12012391406
import os import json import requests headers = { 'Origin': 'https://y.qq.com', 'Referer': 'https://y.qq.com/portal/search.html', 'Sec-Fetch-Mode': 'cors', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36' } def get_music...
fanan-uyun/SpiderCase
2、QQ音乐/qqmusic.py
qqmusic.py
py
3,014
python
en
code
7
github-code
13