seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
39430188225
import json import pandas as pd import yfinance as yf import pytz from datetime import datetime, timedelta import time # Read forex pairs from JSON file with open('forex_pairs.json', 'r') as file: forex_pairs = json.load(file) # Define the time frame and time zone timeframe = '1h' timezone = 'Africa/Nairobi' # ...
Nurain313/N1l8w5f9s2g5
Trash/ma.py
ma.py
py
3,229
python
en
code
0
github-code
6
27577951391
from django.shortcuts import get_object_or_404, render, redirect, HttpResponseRedirect from django.views.generic import TemplateView, UpdateView from django.contrib.auth import get_user_model from .models import Message from django.urls import reverse from django.contrib import messages from review.models import Review...
Afeez1131/Anonymous-v1
anonymous/views.py
views.py
py
4,560
python
en
code
0
github-code
6
23019499020
from __future__ import absolute_import from __future__ import print_function import numpy as np import tensorflow as tf TOWER_NAME = 'tower' def sparsity_hook_forward(x_list): """Helper to create summaries of sparsity. Creates a summary that measures the sparsity of a tensor. Args: x_list: a list of tens...
shidong-ai/sparsity_analysis
imagenet/sparsity_util.py
sparsity_util.py
py
5,059
python
en
code
0
github-code
6
71483369148
""" Created by kevin-desktop, on the 18/02/2023 ADD sentiment columns to a sample Excel sheet. """ import numpy as np import pandas as pd import tqdm from asba_model import run_models path = "data/marco_sample.pkl" df = pd.read_pickle(path) dic = {} max_nb_terms = 0 for row in tqdm.tqdm(df.itertuples(name=None)):...
KnuxV/SentA
add_sentiment_to_dataframe.py
add_sentiment_to_dataframe.py
py
868
python
en
code
0
github-code
6
71236766909
import struct from enum import Enum import typing as ty from mate.net.nao_data import Data, DebugValue, DebugImage NO_SUBSCRIBE_KEY = "none" K = ty.TypeVar('K') def split(predicate: ty.Callable[[K], bool], dictionary: ty.Dict[K, dict]): dict1 = {} dict2 = {} for key in dictionary: if predicate(ke...
humanoid-robotics-htl-leonding/robo-ducks-core
tools/mate/mate/net/utils.py
utils.py
py
3,976
python
en
code
5
github-code
6
71396397949
# Import packages import gpxpy import numpy as np # Read gpx-file gpxFile = "yourfile.gpx" gpx_file = open(gpxFile, 'r') gpx = gpxpy.parse(gpx_file) # Calculate speeds between points speed = [] for track in gpx.tracks: for segment in track.segments: for point_no, point in enumerate(segment.points): ...
Haukiii/simpleGpxRunCorrector
simpleGPXrunCorrector.py
simpleGPXrunCorrector.py
py
1,329
python
en
code
0
github-code
6
18485867132
# Read values PMS5003 and return as dict def read_pms5003(pms5003): values = {} try: pm_values = pms5003.read() # int values["pm1"] = pm_values.pm_ug_per_m3(1) values["pm25"] = pm_values.pm_ug_per_m3(2.5) values["pm10"] = pm_values.pm_ug_per_m3(10) except ReadTimeoutError: ...
BurnoutDV/AirWatcher
snippets.py
snippets.py
py
1,836
python
en
code
0
github-code
6
30478183030
# Flatten a Linked List class Node: def __init__(self, head, bottom): # child and down are same self.head = head self.next = None self.bottom = bottom def flatten(head): if head is None: return None temp = None tail = head while tail.next is not None: tail =...
prabhat-gp/GFG
Linked List/Love Babbar/23_flatten_ll.py
23_flatten_ll.py
py
628
python
en
code
0
github-code
6
5560963127
""" this is a mixture of the best #free twitter sentimentanalysis modules on github. i took the most usable codes and mixed them into one because all of them where for a linguistical search not usable and did not show a retweet or a full tweet no output as csv, only few informations of a tweet, switching la...
CemFFM/Sentimentanalysis
full_equipt_sentimentanalysis .py
full_equipt_sentimentanalysis .py
py
11,573
python
en
code
0
github-code
6
7759594347
import os import sys from PyQt5.QtWidgets import QFrame, QSizePolicy def isFloat(s: str): try: float(s) except ValueError: return False return True def isInt(s: str): try: int(s) except ValueError: return False return True def returnFloat(s: str): try: ...
timhenning1997/Serial-Port-Monitor
UsefulFunctions.py
UsefulFunctions.py
py
2,539
python
en
code
2
github-code
6
34180911472
# -*- coding: utf-8 -*- """ Created on Sun Mar 29 18:27:58 2020 @author: Kollarlab """ # import comtypes import os import time #import subprocess #import re import scipy import pylab #import tarfile #import struct #import glob import numpy import time #import pickle #import datetime #import itertools import sys ...
MRitter95/Kollar-Lab
Old_scripts_delete_20220804/Control/Acqiris_development/CdriverPythonWrapper/Acqiris_testScript_Averagertiming.py
Acqiris_testScript_Averagertiming.py
py
2,844
python
en
code
2
github-code
6
38053163844
from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns from django.contrib.sitemaps.views import sitemap from django.contrib.sitemaps import Sitemap from django.contrib import admin from django.conf import settings admin.autodiscover() urlpatterns = i18n_patterns('', ur...
norn/bctip
bctip/urls.py
urls.py
py
1,711
python
en
code
13
github-code
6
19025440782
import os import sys import json import torch import traceback # def returnFalse(): # return False # torch.cuda.is_available = returnFalse from scipy.io import wavfile # from python.speaker_diarization.pipeline.speaker_diarization import SpeakerDiarization class Diarization(object): def __init__(self, logge...
DanRuta/xva-trainer
python/speaker_diarization/model.py
model.py
py
16,869
python
en
code
78
github-code
6
19521291101
''' Created on Oct 15, 2011 @author: waxwing ''' import os, sys, commands from com.android.monkeyrunner import MonkeyRunner if __name__ == '__main__': blacklist = ['main.py', 'monkeytools.py'] monkeys = os.listdir(os.path.abspath(os.path.dirname(sys.argv[0]))) monkeys = filter (lambda m: m[-3:] == '....
oliver32767/android-tools
monkeys/main.py
main.py
py
523
python
en
code
3
github-code
6
72009646268
def shoppingTime(memberId, money): item = [ {'name': 'Sepatu Stacattu', 'price': 1500000}, {'name': 'Baju Zoro', 'price': 500000}, {'name': 'Baju H&H', 'price': 250000}, {'name': 'Sweater Uniklooh', 'price': 175000}, {'name': 'Casing Handphone', 'price': 50000}, ] if memberId == '': retur...
iswanulumam/cp-alta
python/6-array-of-dictionary/3-shopping-time.py
3-shopping-time.py
py
1,416
python
en
code
0
github-code
6
35910630002
from typing import Dict from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from app.routers import visualize app = FastAPI() app = FastAPI( title="Model Visualizer", description="", version="0.10.0", ) app.mount("/home/lirakr/repos/rnd-mermaid/app/static", StaticFiles(directory="/...
LirakR/rnd-mermaid
app/main.py
main.py
py
684
python
en
code
0
github-code
6
21088218856
from copy import deepcopy import numpy as np from action_execution.config_keys import ExecutionConfigKeys from action_execution.execution_models.model import ExecutionModelBase from action_execution.geometry.vector import Vector2, Vector3 from action_execution.geometry.pose import Pose3 class FreeSpace(ExecutionModel...
alex-mitrevski/action-execution
action_execution/execution_models/FreeSpace.py
FreeSpace.py
py
6,572
python
en
code
0
github-code
6
14888013645
def readOnly_file(): f = None try: f = open('my_write_file','w') f.write('vb this is the new content .....') except ValueError: print('unsupported mode error') else: print('data updated .......') finally: if f != None: f.close() def writeOnly_f...
ekpriya/python-files
pythonworks/file handling/file_using_exception.py
file_using_exception.py
py
652
python
en
code
0
github-code
6
29214768086
from django.shortcuts import render from utils import Word def home(request): context = {} if request.method == "POST": text = request.POST['text'] context['results'] = Word(text).result() context['text'] = text return render(request, 'home.html', context)
dest81/test-jerry
words_stats/views.py
views.py
py
296
python
en
code
0
github-code
6
19594690506
import tkinter import mysql.connector from tkinter import * from tkinter import ttk from tkinter.ttk import Treeview from tkinter import messagebox from PIL import Image, ImageTk db = mysql.connector.connect( host="localhost", user="root", password="1234", database="bmh204" ) mycursor ...
arslncanm/Kulup_otomasyon_Python_tkinter
MAYKOD/main.py
main.py
py
24,326
python
en
code
0
github-code
6
70264770749
import subprocess as sp import pymysql import pymysql.cursors import datetime def search(): try: # letter = input(First letter) query = "select H.sport_name from equipment as H where H.quantity in (select max(quantity) from equipment); " print(query) cur.execute(query) con.c...
VanshMarda/Data-and-Application
Project_Phase_4/MiniWorld.py
MiniWorld.py
py
11,599
python
en
code
0
github-code
6
32741409083
import math import numba import numpy as np def main(): starts, ends, rdf = np.loadtxt("rdf.dat").T density = 1200 / 1.0**3 n_bins = len(rdf) bin_width = ends[0] - starts[0] corrector = np.zeros(n_bins) kernel = compute_kernel(rdf, bin_width) for step in range(100): corrector = ...
snsinfu/bit5
test418-ornstein_zernike/oz.py
oz.py
py
1,377
python
en
code
0
github-code
6
12392640532
# Complete the countInversions function below. def countInversions(arr): # arr is empty or null if not arr: return arr # arr is one element if len(arr) == 1: return arr left, right = 0, len(arr) - 1 return merge_sort(arr, left, right) def merge_sort(arr, left, right): inv...
jintang413/hackerrank
src/countinginversions.py
countinginversions.py
py
1,445
python
en
code
0
github-code
6
3648010096
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="waterstructureCreator", version="0.0.1", author="Nicolas G. Hoermann", author_email="hoermann@fhi.mpg.de", description= "Creation of water structures on substrates", long_descripti...
computationalelectrochemistrygroup/WaterStructureCreator
setup.py
setup.py
py
868
python
en
code
3
github-code
6
71066784189
from collections import defaultdict from copy import copy, deepcopy from dataclasses import dataclass from datetime import datetime, timedelta from enum import Enum, auto, IntEnum from typing import List, Tuple, Dict, Optional, Any from dictdiffer import diff from blaseball_mike.chronicler import get_entities from Ch...
beiju/blaseball-player-changes
v1/Players.py
Players.py
py
9,476
python
en
code
0
github-code
6
6701762608
import discord from discord.ext import commands class HostPlugin(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def host(self, ctx): await ctx.send("What is the time of the flight?") flight_time = await self.bot.wait_for('message', check=lambda m: ...
MayyCookie/swissannc
flighta 2.py
flighta 2.py
py
822
python
en
code
0
github-code
6
43133183051
#!/usr/bin/python #encoding=utf-8 #@author:liangyunge@baidu.com #@version:1.0 #@desc:Spider日志模块 #@date:2012-11-23 from ConfParser import confparser from sys import _getframe from time import strftime import os #支持debug,notice,warning三个日志级别 class slogger: def __init__(self): pass @staticmethod def warning(loginf...
ygliang2009/pysearch
SLogger.py
SLogger.py
py
3,955
python
en
code
1
github-code
6
36021786185
import matplotlib.pyplot as plt; import numpy as np; data = np.loadtxt('jV_steady.dat', skiprows=1); ref = np.loadtxt('G0610_cell3/1suns.dat', skiprows=3); V_steady = data[:,0]; J_steady = data[:,1]; V_ref = ref[:,0]; J_ref = ref[:,1]*(-10); V_steady += 0.0; J_steady += 0; # Plot all results plt.figure(num=None, f...
dglowienka/drift-diffusion_mini-modules
Spatial/JV_with_ref.py
JV_with_ref.py
py
563
python
en
code
0
github-code
6
24430769754
import numpy as np from numpy.linalg import * dist = np.array([228.52, 440.12]) # distance tube longH = np.array([172, 383.60]) # longueur tube horizontal longA = np.array([192.37, 436.71]) # longueur tube vertical dDist = dist[1] - dist[0] dLongH = longH[1] - longH[0] dLongA = longA[1] - longA[0] print('dDist...
Sim0nD3p/PySM
layout/central/storeOverview/storeViewerWidget/script.py
script.py
py
498
python
en
code
0
github-code
6
13000612743
import os import time import numpy as np import torch import cv2 import subprocess import argparse from PIL import Image, ImageDraw from facenet_pytorch import MTCNN from optical_flow import OpticalFlowTracker parser = argparse.ArgumentParser(description='Face tracking using Optical Flow.') parser.add_argument('--inpu...
nishadi930313/Labmate
face_tracking.py
face_tracking.py
py
5,042
python
en
code
0
github-code
6
20416367196
#coding: utf-8 #Autor: Fernanda Bezerra vet_vu = [] vet_qnt = [] vet_vt = [] cont_ov = 0 for i in range(0,3): vu = float(input("Digite o valor unitário do produto:")) qnt = int(input("Digite a quantidade vendida do produto:")) vt = vu*qnt vet_vu.append(vu) vet_qnt.append(qnt) vet_vt.append(vt) vt = 0 for i in ra...
nandabezerran/programming-fundamentals
Ex - LT/Ex - LT - Vetores/LT-Vet-02.py
LT-Vet-02.py
py
603
python
pt
code
0
github-code
6
73227662588
import pandas as pd import imp import QR_Code_VCard_WC_copy import imp from tkinter import * from tkinter.ttk import * from tkinter.filedialog import askopenfile import time import os from pathlib import Path global current_path current_path=Path.cwd() def open_file(): global file_path file_...
JonJones98/Virtual-Business-Card-Generator
06_Scripts/Excel_connection_csv.py
Excel_connection_csv.py
py
3,698
python
en
code
0
github-code
6
24929837495
import minimax import time import sys class TicTacToe(): ''' This is a tic tac toe game class. It holds most of the methods that will manipulate the game board such as: player_turn and computer_turn ''' def __init__(self, player_char = None, player2_char = None): self.puzzle = [[" ", " ", " "], ...
noah415/tic-tac-toe
TicTacToe.py
TicTacToe.py
py
5,548
python
en
code
0
github-code
6
75070674748
#! /usr/bin/env python3 import json def find_if (pred, collection): try: return next(filter(pred, collection)) except StopIteration: return None class Transition: def __init__ (self, initial_state_name): self.initial = initial_state_name self.states = [] self.current = self.initial def regist_state (s...
SPNSPN/state-json
py/transition.py
transition.py
py
4,337
python
en
code
0
github-code
6
27247441921
revision = '4160ccb58402' down_revision = None branch_labels = None depends_on = None import json import os from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column sections = { 'update_authorized_keys': 'local', 'authorized_keys_file': 'local', 'githome_executable': 'loca...
mbr/githome
alembic/versions/4160ccb58402_update_from_previous_version.py
4160ccb58402_update_from_previous_version.py
py
2,292
python
en
code
2
github-code
6
4630502954
import tkinter as Tk from math import floor import numpy as np from PIL import Image,ImageTk ## ---------------------- ## ##| CLASSES |## ## ---------------------- ## class Texture: def __init__(self,path): self._img = Tk.PhotoImage(file=path) def getImg(self): return self._img class Textu...
MaximePerriquet/PyCraft
rendering.py
rendering.py
py
10,623
python
en
code
0
github-code
6
36643660386
# -*- coding: utf-8 -*- """ @author: QgZhan @contact: zhanqg@foxmail.com @file: cifar.py @time: 2022/4/19 11:19 """ import os from torch.utils.data import Dataset from dataloader.dataloader_utils import * from torchvision import datasets, transforms from spikingjelly.datasets import cifar10_dvs from torch...
rtao499/SAANet
dataloader/cifar.py
cifar.py
py
10,609
python
en
code
2
github-code
6
30471382710
from tkinter import * from csv import * import mainn import orderr class login_screen: b = 0 def getEntry(self): details_list = [] def openorder(): self.root7.destroy() o=orderr.orderscr() o.ord() #csv file with...
prithiknataraj/OOPS-Laundry_Service
OOPS Laundry Service/loginscreen.py
loginscreen.py
py
2,596
python
en
code
0
github-code
6
42631511615
#!/usr/bin/env python3 # Program to implement tweet classification import nltk import re import sys from collections import Counter import pandas as pd nltk.download('punkt') # Read files train_file = sys.argv[1] test_file = sys.argv[2] output_file = sys.argv[3] train = open(train_file, 'r', errors='ignore').read()...
tanvi5/Games-and-Bayes
part2/geolocate.py
geolocate.py
py
5,766
python
en
code
0
github-code
6
14400330096
#!/usr/bin/env python3.8 """ given a string return list of all the possible permutations of the string and count of possible permutations """ count = 0 list = [] def permutation(string,prefix): global count if len(string)==0: count += 1 list.append(prefix) else: for i in range(len(string)): permutation(s...
dnootana/Python
Interview/string_permutation.py
string_permutation.py
py
682
python
en
code
0
github-code
6
7306633247
import torch from tqdm import tqdm import torch.nn as nn import torch.optim as optim import torchvision.transforms as transforms from torch.utils.tensorboard import SummaryWriter from data_loader import get_loader from CNNtoRNN import CNNtoRNN def train(): transform = transforms.Compose( [ tra...
KarstenKu-Hub/ImageCaptioning
train.py
train.py
py
2,050
python
en
code
0
github-code
6
25868835750
dan = {'name': 'Dan', 'age': 27, 'city': 'Madison', 'state': 'WI'} pierce = {'name': 'Pierce', 'city': 'Madison', 'state': 'WI'} def print_location(user): if 'name' not in user: raise ValueError('user must have name') if 'city' not in user: raise Value...
madison-python/decorators-and-descriptors
decorator2.py
decorator2.py
py
944
python
en
code
0
github-code
6
75204308988
print('''Various Array Operations 1. Linear Search 2. Binary Search 3. Lowest Number 4. Selection Sort Press any other key to exit''') def create_array(): L = [int(input('Enter element ')) for I in range(int(input('Enter size ')))] print(L) return L def low(L): print(f'Lowest no : {min(L...
CS-ION/Class-12-Practicals
Practicals/20.py
20.py
py
1,600
python
en
code
0
github-code
6
75163131066
import pprint, random, datetime class Cliente(): _nomes = ['ERIC RUIZ', 'ROBERTA DE LIMA', 'DEIVIDI SCALZAVARA', 'ADOLFO NETO', 'JOSE MONESTEL', 'WAGNER CORREIA', 'JACEGUAY ZUKOSKI', 'MICHEL SOUZA', 'MAYRA RODRIGUES', 'MICHEL DUARTE', 'MARCIO FOSSA', 'MARCEL BORNANCIN', 'ELOISA PERIN', 'TIAGO WIPPEL', 'LUCAS FISCH...
e-ruiz/big-data
01-NoSQL/atividade-03/big_data_atividade_3.py
big_data_atividade_3.py
py
7,003
python
pt
code
1
github-code
6
28905652001
xyxyAreaFill = [1115, 830, 1670, 1375] #[x1, y1, x2, y2] where xy1=top-left, xy2=bottom-right xywhAreaFill = xyxyAreaFill #[x1, y1, x2, y2] where xy1=top-left, xy2=bottom-right xywhAreaFill[0] = xyxyAreaFill[0] #x top-left xywhAreaFill[1] = xyxyAreaFill[1] #y top-left xywhAreaFill[2] = xyxyAreaFill[2]-xyxyAreaF...
benediktusbryan/Box-in-Area-Detection-System-with-AI
coba.py
coba.py
py
707
python
en
code
0
github-code
6
21211275641
def mySolution(): n = 4 storage = [1, 5, 10, 100] # 1 10 100 # 1 5 10 100 sum1, sum2 = 0, 0 for i in range(len(storage)): if i % 2 == 0: sum2 += storage[i] else: sum1 += storage[i] print(max(sum1, sum2)) def dp(): n = int(input()) arr = list...
kimkimj/Algorithm
python/DP/foodStorage.py
foodStorage.py
py
514
python
en
code
0
github-code
6
73947121148
# utf-8 from random import randint def teste_de_miller(p, b): """p>2 ímpar e b inteiro tal que b != 0 em IZ_p Retorno ------- True se p é composto False se teste inconclusivo Exemplos -------- >>> teste_de_miller(27, 2) True >>> teste_de_miller(25, 7) False >>...
d-nct/cripto-python
miller_rabin.py
miller_rabin.py
py
1,728
python
pt
code
0
github-code
6
7259480306
import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import cv2 import sys class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(6,200) self.fc2 = nn.Linear(200,100) self.fc3 = nn.Linear(100,50) ...
asbudhkar/Hand-Detector-with-Pose-Estimation
train.py
train.py
py
2,462
python
en
code
0
github-code
6
13933582750
from django import forms from .models import TodoList class TodoListForm(forms.ModelForm): class Meta: model = TodoList fields = ['task_title', 'task_description', 'task_status'] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['task_title'].wi...
priyanka-infobeans/infoToDoList
infobeans_todolist/todolist_app/forms.py
forms.py
py
451
python
en
code
0
github-code
6
35914161974
class Solution: """ @param nums: the given array @return: the minimum difference between their sums """ def findMin(self, nums: list) -> int: sum_of_nums = sum(nums) m = sum_of_nums // 2 n = len(nums) dp = [0] * (m + 1) for i in range(1, n + 1): f...
Super262/LintCodeSolutions
algorithms/dp/problem0724.py
problem0724.py
py
517
python
en
code
1
github-code
6
20160930177
from django.urls import path from web import views app_name ="web" urlpatterns = [ path('',views.index,name="index"), path("create/",views.create_product,name="create_product"), path('deleted/<int:id>/',views.deleted_product,name="deleted_product"), path('edit/<int:id>/',views.edit_product,name="ed...
Aswathy-G/advanceddjango-project
web/urls.py
urls.py
py
389
python
en
code
0
github-code
6
5962356858
from aoc_helpers.perf_helpers import * from aoc_helpers.input_helpers import * from collections import defaultdict from collections import Counter import string import time import numpy as np import matplotlib.pyplot as plt from scipy.spatial import Voronoi, voronoi_plot_2d from scipy.spatial import cKDTree def Poly...
colejd/AdventOfCode2018
day_06/day6part1_borked.py
day6part1_borked.py
py
3,325
python
en
code
0
github-code
6
28513937002
#usr/bin/python3.8 # 读和写文件 # open() 将会返回一个 file 对象,基本语法格式如下: # open(filename, mode) # filename:包含了你要访问的文件名称的字符串值。 # mode:决定了打开文件的模式:只读,写入,追加等。所有可取值见如下的完全列表。这个参数是非强制的,默认文件访问模式为只读(r)。 # 打开一个文件 f = open("/tmp/foo.txt", "w") f.write( "Python 是一个非常好的语言。\n是的,的确非常好!!\n" ) f.close() f = open("/tmp/foo.txt", "r") str = f.r...
BeiGuoDeXue/python
15、输入输出/read_write_file.py
read_write_file.py
py
618
python
zh
code
0
github-code
6
14755463895
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init # ==========================Core Module================================ class conv_block(nn.Module): def __init__(self, ch_in, ch_out): super(conv_block, self).__init__() self.conv = nn.Sequential( ...
ikkbic/My-Repositories
segmentionn_models_trans/UNet-1.py
UNet-1.py
py
3,430
python
en
code
0
github-code
6
30729211140
import threading from random import randint import pika import time from src.klein_queue.errors import KleinQueueError from src.klein_queue.rabbitmq.publisher import Publisher from src.klein_queue.rabbitmq.consumer import Consumer from klein_config.config import EnvironmentAwareConfig test_config = { "rabbitmq": {...
mdcatapult/py-queue
tests/rabbitmq/test_consumer.py
test_consumer.py
py
17,024
python
en
code
0
github-code
6
5092513077
# For taking integer inputs. import math def inp(): return(int(input())) # For taking List inputs. def inlist(): return(list(map(int, input().split()))) # For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings a...
sudiptob2/atcoder-training
Medium 100/12.Grid Compression.py
12.Grid Compression.py
py
1,015
python
en
code
2
github-code
6
355842723
from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document class HakCuti(Document): def fill_employee_details(employees): return frappe.db.sql(''' select t1.name as employee, t1.employee_name from `tabEmployee` t1, `tabSalary Structure Employ...
bawaaaang/absensi
absensi/absensi/doctype/hak_cuti/hak_cuti.py
hak_cuti.py
py
460
python
en
code
0
github-code
6
13703480148
# buttontest # create at 2015/6/15 # autor: qianqians import sys sys.path.append('../../') from plask import * import json def test(): app = plaskapp('0.0.0.0', 5000) p = pypage('edittest', 'http://127.0.0.1:5000/', pyhtmlstyle.margin_left) p.add_page_route('/') e = pyedit('edit', pyedit.text, pyhtmlstyle.margin_...
theDarkForce/plask
test/login/logintest.py
logintest.py
py
1,172
python
en
code
2
github-code
6
11728318125
import numpy as np from tabulate import tabulate from clustering.external_evaluation import calculate_purity from clustering.k_means import KMeans from data_preparation.inverted_index import InvertedIndex from data_preparation.pre_processing import parse_corpus, pre_process_corpus corpus, y_true, titles = parse_corpu...
nzabdelke/News-Clustering
main.py
main.py
py
3,536
python
en
code
0
github-code
6
71969293949
import argparse import logging from common import _utils def main(argv=None): parser = argparse.ArgumentParser(description='ML Trainer') parser.add_argument('--project', type=str, help='Google Cloud project ID to use.') parser.add_argument('--region', type=str, help='Which zone to run the analyzer.') parser....
kubeflow/kfp-tekton-backend
components/deprecated/dataproc/train/src/train.py
train.py
py
1,939
python
en
code
8
github-code
6
3919530622
# standard python import base64 import bz2 import datetime import json import multiprocessing import optparse import os import re import socket import sys import time import urllib.parse import urllib.request # custom browser driver from webxray.ChromeDriver import ChromeDriver class Client: def __init__(self, serve...
thezedwards/webXray
webxray/Client.py
Client.py
py
4,988
python
en
code
1
github-code
6
36185365035
''' Ahmad Abu Hanifah A1C020026 Teknik Otomasi Pertanaian ''' import numpy as np import matplotlib.pyplot as plt dOsp = 6.5 vmin = 0 # kecepatan aliran udara (L/s) vmax = 2 # kecepatan aliran udara (L/s) V = 1000000 #Volume sistem (L) kLa = 0.045 # per menit n = 4 # Jumlah aerator # a = 0.4 # Luas permukaan antarmuka...
AbuHanifah1878/Teknik_Otomasi_Pertanian
KontrolDOOnOff.py
KontrolDOOnOff.py
py
1,349
python
en
code
0
github-code
6
27089285988
import sys import json unique = {} start = ['a','f','l','q','u'] end = ['e','k','p','t','z'] if(len(sys.argv) != 4): print("========================================================================================================") print("SORRY!! Please provide the path to the INPUT json file, the OUTPUT file...
STEELISI/Venmo
Fan_in.py
Fan_in.py
py
2,106
python
en
code
0
github-code
6
43381026267
import boto3 def lambda_handler(event, context): sns = boto3.client('sns') message = event.get('message', 'Default message') params = { 'Message': message, 'TopicArn': 'arn:aws:sns:us-east-1:896553604990:LiveScore' } try: response = sns.publish(**params) message_i...
bayarbayasgalanj/cloud_computing
Project/lambda_function.py
lambda_function.py
py
512
python
en
code
0
github-code
6
7859721528
import re with open('regexps.ini') as fichier: text = fichier.read() for line in text.split("\n"): match = re.match(r"([a-zA-Z]*)\s*=\s*([^;]*[^\s;])", line) print(match) if match: print("Ligne conforme: ", line)
mercator-ocean/python-notes
exercices/makina/stdlib/regexps_1.py
regexps_1.py
py
240
python
en
code
0
github-code
6
38959225786
# Sparse Matrix Representation using lists def sparseMatrix(sparseMatrix, m, n): # initialize size as 0 size = 0 for i in range(m): for j in range(n): if (sparseMatrix[i][j] != 0): size += 1 # number of columns in compressMatrix(size) should # be equal to number of non-zero elements in sparse...
9Mugen/int108
sparse_matrix.py
sparse_matrix.py
py
996
python
en
code
0
github-code
6
18307501302
import warnings from copy import deepcopy from typing import Union, List, Tuple, Dict import numpy as np from aequilibrae.matrix import AequilibraeMatrix from aequilibrae.paths.graph import Graph from aequilibrae.paths.results import AssignmentResults class TrafficClass: """Traffic class for equilibrium traffic...
AequilibraE/aequilibrae
aequilibrae/paths/traffic_class.py
traffic_class.py
py
7,635
python
en
code
140
github-code
6
33093309616
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.categorical import Categorical device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class Decoder(nn.Module): ''' This class contains the implementation of Decoder Module. Args: embedding_dim:...
facebookresearch/UNLU
codes/rnn.py
rnn.py
py
8,608
python
en
code
34
github-code
6
33526668503
#Crie um programa que declare uma matriz de dimensão 3×3 e preencha com valores lidos pelo teclado. No final, mostre a matriz na tela, com a formatação correta. lista_números=[] i=0 matriz=int(input("Qual a matriz? ")) matriz_1=matriz for c in range(matriz*matriz): lista_números.append(float(input("Digite um número...
cauavsb/python
mundo-3-py/ex15.py
ex15.py
py
509
python
pt
code
0
github-code
6
23361190894
import os import numpy as np from numpy import array, zeros, diag, diagflat, dot import numpy from flask import Flask, render_template, request, redirect, url_for from werkzeug.utils import secure_filename import copy from os.path import join, dirname, realpath UPLOAD_FOLDER = './uploads/' ALLOWED_EXTENSIONS = set([...
konstantinkonstantinovich/Numerical-Methods-Sprint01-
Sprint01/app.py
app.py
py
9,328
python
en
code
0
github-code
6
25185578484
import unittest import logging from generative_notch.pipeline.trait_assembler.trait_assembler import flatten_dict, interpolate_instructions CONFIG = { 'batch_name': 'MyShinyBatch', 'render': { 'width': '1920', 'height': '1080' } } CONTEXT = { 'combination_id': '001' } INSTRUCTIONS = [...
thomaswinged/generative-notch
tests/test_trait_assembler.py
test_trait_assembler.py
py
1,460
python
en
code
0
github-code
6
13895462756
######################################################################################## # Module with functions for parametric estimation of GC ######################################################################################## import numpy as np import scipy.linalg from .tools import * def YuleWalker(X, m, ma...
ViniciusLima94/pyGC
pygc/parametric.py
parametric.py
py
1,814
python
en
code
30
github-code
6
2965742594
from odoo import http from odoo.http import request from odoo.addons.web.controllers.main import ensure_db import werkzeug import logging _logger = logging.getLogger(__name__) class SimpleUrlController(http.Controller): @http.route('/redir', type='http', auth="user") def redirect(self, **args): ens...
Tawasta/server-tools
base_simple_urls/controllers/simple_urls.py
simple_urls.py
py
2,344
python
en
code
3
github-code
6
69957260347
#! /usr/bin/python3 #-*-coding: utf-8-*- def add_rxn(name, D_mets, model, rev=True): # this function would be defined to add reactions to the model r_name = name r_obj = cobra.Reaction(rname) r_obj.name = r_name r_obj.id = r_name model.add_reaction(r_obj) r_obj.add_metabolites(D_mets) r_obj...
chloea31/AraCore
src/init_fba/manipulate_model.py
manipulate_model.py
py
1,639
python
en
code
0
github-code
6
73734292027
import json import os from account import Account home_path = os.getenv("HOME") config = json.load(open(os.path.join(home_path, ".config", "revChatGPT", "config.json"))) cache = json.load(open(os.path.join(home_path, ".cache", "revChatGPT", "config.json"))) # 从配置读取 token session_token = config['accounts'][0]['sessio...
fkxxyz/rev-chatgpt-web
test.py
test.py
py
662
python
en
code
0
github-code
6
1245466067
import pandas as pd from absplice.utils import get_abs_max_rows def variant_to_string(df): chrom = str(df['#Chrom']) if 'chr' not in chrom: chrom = 'chr' + chrom return chrom + ':' + str(df['Pos']) + ':' + df['Ref'] + '>' + df['Alt'] df_pred = pd.read_csv(snakemake.input['model'], sep='\t', skipro...
gagneurlab/AbSplice_analysis
workflow/scripts/common/splicing_result/postprocess_preds/cadd_splice.py
cadd_splice.py
py
972
python
en
code
0
github-code
6
16010028786
from random import random import toga from colosseum import CSS def build(app): data = [] for x in range(5): data.append([str(x) for x in range(5)]) label = toga.Label('No row selected.') def selection_handler(widget, row): label.text = 'You selected row: {}'.format(row) if row is n...
Ocupe/toga_test_app_collection
table/table/app.py
app.py
py
1,513
python
en
code
0
github-code
6
17516466448
import torch from torch import nn __all__ = [ '_CONV_DICT', '_CONV_TRANS_DICT', '_AVG_POOL_DICT', '_MAX_POOL_DICT', '_NORM_DICT', '_REFLECTION_PAD_DICT', '_CENTER_CROP_DICT', '_ACTIVATION_DICT', 'activation_from_str' ] def center_crop_1d(layer: torch.Tensor, target: torch.Tensor) -...
broadinstitute/CellMincer
cellmincer/models/components/functions.py
functions.py
py
2,557
python
en
code
1
github-code
6
8463884764
from django.utils import timezone from rest_framework import status from rest_framework.generics import CreateAPIView, RetrieveUpdateDestroyAPIView from rest_framework.response import Response from rest_framework.views import APIView from logistics.models import Logistic, LogisticRate from receivers.models import Rece...
Duade10/ditosell-api
orders/views.py
views.py
py
4,947
python
en
code
0
github-code
6
32172334196
def fix_quotes(text: str) -> str: """ 将文本中的全角引号左右互换的问题修正. e.g. ”...“ -> “...” """ lst = 0 out = [] while True: lq = min(text.find("“", lst), text.find("”", lst)) if lq == -1: break rq = min(text.find("“", lq + 1), text.find("”", lq + 1)) i...
byronwanbl/pdf-comb
fix_quotes.py
fix_quotes.py
py
843
python
en
code
1
github-code
6
42812438276
from __future__ import print_function import numpy as np from skimage import io from tqdm import tqdm import argparse import os from config import palette, invert_palette def convert_to_color(arr_2d, palette=palette): """ grayscale labels to RGB-color encoding """ arr_3d = np.zeros((arr_2d.shape[0], arr_2d.sh...
nshaud/DeepNetsForEO
legacy/notebooks/convert_gt.py
convert_gt.py
py
2,413
python
en
code
468
github-code
6
37962588904
import socket class Topic: def __init__(self, host="byond.oraclestation.com", port=5000, key="default_pwd"): self.host = host self.port = port self.key = key sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, proto=socket.IPPROTO_TCP) sock.connect((self.hos...
OracleStation/PySS13Bot
Topic.py
Topic.py
py
1,125
python
en
code
1
github-code
6
37123499778
import nltk from Model.Model import Model from View.View import View from docx import Document from datetime import datetime from classes.Document import MyDocument import os import string import pymorphy2 from tkinter import filedialog from tkinter import messagebox import tkinter as tk from matplotlib.figure import F...
F1linnn/info-search-system
Controller/Controller.py
Controller.py
py
14,983
python
en
code
0
github-code
6
15837575627
# -*- coding: utf-8 -*- # @Time : 2022/6/17 15:05 # @Author : renyumeng # @Email : 2035328756@qq.com # @File : Solve.py # @Project : ProbabilityTheoryAndMathematicalStatisticsExperiments import numpy as np import scipy.stats as sts class Solve: def __init__(self, N) -> None: self.n: int = N self._...
renyumeng1/ProbabilityTheoryAndMathematicalStatisticsExperiments
firstExper/第三题/Solve.py
Solve.py
py
1,551
python
en
code
1
github-code
6
42493210531
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 13 13:15:49 2018 @author: michal """ import networkx as nx from copy import deepcopy #import numpy as np from solution import Solution from random import sample class PublicationMatcher: def primitiveMaxPointsOfRest(self, publications): ...
chemiczny/pubMatch
pubMatch/publicationMatcher.py
publicationMatcher.py
py
13,317
python
en
code
0
github-code
6
35292064506
import pandas as pd import datetime import pickle import numpy as np from sklearn.linear_model import SGDRegressor from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import StandardScaler from sklearn.externals import joblib import random # Codes des compagnies aériennes et l'équivalent du cod...
makboulhoussen/flightdelay
web-interface/webdelay/delayapi/flightDelayPred.py
flightDelayPred.py
py
7,291
python
en
code
0
github-code
6
73474178748
from fastapi import APIRouter, Depends, FastAPI from src.dependencies.auth import firebase_authentication from src.routes.audios import views as audios_views from src.routes.auth import views as auth_views from src.routes.users import views as users_views api_router = APIRouter() api_router.include_router(auth_views....
CrowdsourcingApps/Crowdsourcing-Ayat
src/routes/__init__.py
__init__.py
py
846
python
en
code
2
github-code
6
32469363998
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def helper(self, l, r): if l > r: return None max_idx = l for i in range(l,...
MdAbedin/leetcode
0601 - 0700/0654 Maximum Binary Tree.py
0654 Maximum Binary Tree.py
py
673
python
en
code
7
github-code
6
3476194370
from collections.abc import MutableMapping from collections.abc import MutableSequence from dpath import options from dpath.exceptions import InvalidKeyName import dpath.segments _DEFAULT_SENTINAL = object() MERGE_REPLACE = (1 << 1) MERGE_ADDITIVE = (1 << 2) MERGE_TYPESAFE = (1 << 3) def __safe_path__(path, separato...
gshanko125298/Prompt-Engineering-In-context-learning-with-GPT-3-and-LLMs
myenve/Lib/site-packages/dpath/util.py
util.py
py
12,695
python
en
code
3
github-code
6
30061421331
from bs4 import BeautifulSoup import requests import json HEADING_ORDER = [ "defensePhysical", "defensePhysicalStrike", "defensePhysicalSlash", "defensePhysicalPierce", "defenseMagic", "defenseFire", "defenseLightning", "defenseHoly", "immunity", "robustness", "focus", "...
lewisc64/Elden-Ring-Poise-Optimizer
data/sources/wiki/scrape_wiki.py
scrape_wiki.py
py
2,230
python
en
code
0
github-code
6
73727858748
#!/usr/bin/env python3 import argparse import boutvecma import easyvvuq as uq import chaospy import os import numpy as np import time import matplotlib.pyplot as plt CAMPAIGN_NAME = "Conduction." def refine_sampling_plan(campaign, analysis, number_of_refinements): """ Refine the sampling plan. Paramet...
boutproject/VECMA-hackathon
workflows/sc_adaptive_restartable/example_restartable_sc_adaptive.py
example_restartable_sc_adaptive.py
py
8,019
python
en
code
2
github-code
6
41675773440
# 적록색약 import sys sys.setrecursionlimit(1000000) input = sys.stdin.readline N = int(input()) area1 = [] area2 = [] for _ in range(N): lst1 = [] lst2 = [] for s in list(input().strip()): lst1.append(s) if s == "G": lst2.append("R") else: lst2.append(s) ...
jisupark123/Python-Coding-Test
알쓰/week4/10026.py
10026.py
py
1,597
python
en
code
1
github-code
6
11948500012
# takes an input file and output file # input file is a Gcal in csv format # output file: add 2 commas beggining of line if there are no commas in the line import os, sys inputFile = open(sys.argv[1], "rt") outFile = open(sys.argv[2], "wt") for line in inputFile: if line.count(",") == 0: strName = line.s...
umabot/pyCleanGcal
addCommas.py
addCommas.py
py
444
python
en
code
1
github-code
6
71608494589
# coding=utf-8 import logging from datetime import datetime import markupsafe from playhouse.shortcuts import dict_to_model, model_to_dict from app import components from app.notes.model import Note, TaggedNote from app.tags import tagService from app.categories import categoryService class NoteService(components....
caiwan/cai-notepad
backend/app/notes/__init__.py
__init__.py
py
3,356
python
en
code
6
github-code
6
31569984020
# normal libraries from inspect import signature # used in the method eval of the class import numpy as np import scipy.stats # functions of statistics # other files from corai_error import Error_type_setter from scipy.integrate import simps # my libraries np.random.seed(124) # section ############...
Code-Cornelius/ITiDeEP
src/hawkes/kernel.py
kernel.py
py
7,949
python
en
code
0
github-code
6
39434532575
from collections import Counter import zarr from fastai.tabular.all import * from fastai.data.all import * from fastai.vision.gan import * from fastai import * from tsai.all import * from torch import nn import numpy as np import seaborn as sns import matplotlib.colors as mcolors import matplotlib.pyplot as plt import...
numediart/xAAEnet
main.py
main.py
py
9,638
python
en
code
1
github-code
6
855878754
#!/usr/bin/env python # This example shows how to extract portions of an unstructured grid # using vtkExtractUnstructuredGrid. vtkConnectivityFilter is also used # to extract connected components. # # The data found here represents a blow molding process. Blow molding # requires a mold and parison (hot, viscous plasti...
VisTrails/VisTrails
examples/vtk_examples/VisualizationAlgorithms/ExtractUGrid.py
ExtractUGrid.py
py
3,366
python
en
code
100
github-code
6
25329151854
import numpy as np def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) def sigmoid_prime(y_hat): return y_hat * (1 - y_hat) class Perceptron: """Perceptron implements a simple perceptron cell.""" def __init__(self, inputs): self.weights = np.random.randn(1, inputs) self.bias = 0 ...
spy16/snowman
scripts/percep.py
percep.py
py
1,414
python
en
code
1
github-code
6
72497450429
from bs4 import BeautifulSoup import requests, os #Configuration Variables search_refs = True build_path = "API" API_URL = "https://pythonapi.upbge.org/" #Further addons headers = {"bge" + os.sep + "types.py" : """ import mathutils inf = 0 class CListValue: def __init__(self, ctype): self.__ret__ = ctype...
elmeunick9/UPBGE-CommunityAddon
documentation/BGEMockGen/make.py
make.py
py
14,473
python
en
code
6
github-code
6
33126999128
from sklearn.model_selection import train_test_split from src.config import config from mindspore import Tensor import mindspore class ModelDataProcessor: def __init__(self): self.get_dict() def get_dict(self): self.word_dict = {} with open(config.vocab_file, 'r') as f: c...
Xie-Minghui/DPCNN_MS0
src/data_loader.py
data_loader.py
py
3,040
python
en
code
1
github-code
6