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
73388984743
"""Plot Stream PGM.""" import sys import daft import matplotlib.pyplot as plt from showyourwork.paths import user as user_paths paths = user_paths() # Add the parent directory to the path sys.path.append(paths.scripts.parent.as_posix()) # isort: split # Matplotlib style plt.style.use(paths.scripts / "paper.mplsty...
nstarman/stellar_stream_density_ml_paper
src/scripts/pgm.py
pgm.py
py
5,422
python
en
code
0
github-code
36
35196259562
import logging import random as rand from enum import Enum import numpy as np from numpy import array as arr from numpy import concatenate as cat import scipy.io as sio from scipy.misc import imread, imresize class Batch(Enum): inputs = 0 part_score_targets = 1 part_score_weights = 2 locref_targets ...
eldar/pose-tensorflow
dataset/pose_dataset.py
pose_dataset.py
py
14,519
python
en
code
1,127
github-code
36
25468573866
from mycroft import MycroftSkill, intent_file_handler import openai import os class Chatgpt(MycroftSkill): def __init__(self): MycroftSkill.__init__(self) openai.api_key = os.environ[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] # Set the API key @intent_file_handler('chatgpt.intent') ...
adamkalbouneh/chatgpt-skill
__init__.py
__init__.py
py
723
python
en
code
1
github-code
36
8349368138
import numpy as np from ising import * class Ising_analysis: def __init__(self,sim_list): self.sim_list = sim_list self.m_rav = None self.av_methyl = None def average_methylation(self): """ Calculates average methylation rate for each time step across the whole region. ...
jakesorel/methylsim
ising_analysis.py
ising_analysis.py
py
1,162
python
en
code
0
github-code
36
70943556903
from pyspark.sql import SparkSession from pyspark.streaming import StreamingContext from time import sleep spark = SparkSession.builder.appName('streaming').getOrCreate() sc = spark.sparkContext ssc = StreamingContext(sc, 1) ssc.checkpoint('/tmp') lines = ssc.socketTextStream('0.0.0.0', 301) words = lines.flatMap(lam...
bablookr/big-data-experiments
pyspark-experiments/streaming/stream.py
stream.py
py
522
python
en
code
0
github-code
36
73609824105
import os import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import shutil import tikzplotlib from cued.plotting.colormap import whitedarkjet from cued.plotting import contourf_remove_white_lines, label_inner, init_matplotlib_config, unit...
ccmt-regensburg/CUED
cued/plotting/latex_output_pdf.py
latex_output_pdf.py
py
32,799
python
en
code
11
github-code
36
150778063
from django.urls import path from django.contrib import admin from django.urls import include #Add URL maps to redirect the base URL to our application from django.views.generic import RedirectView from . import views urlpatterns = [ path('start/', views.StartPlay.as_view(), name='start-play'), path('start/<i...
edbranson/scorekeeping
scorekeeping/score/urls.py
urls.py
py
1,095
python
en
code
0
github-code
36
41699358611
import tensorflow as tf import tf_mpi.mpi_ops as mpi_wrappers from .distributed_optimizer import DistributedOptimizer worker_index = mpi_wrappers.mpi_rank() worker_size = mpi_wrappers.mpi_size() class DistributedAllReduceOptimizer(DistributedOptimizer): def __init__(self, optimizer, name=None, use_locking=Fals...
xinyandai/mpi-tensorflow
tf_mpi/optimizers/distributed_optimizer_allreduce.py
distributed_optimizer_allreduce.py
py
1,188
python
en
code
2
github-code
36
876677252
print(r"Welcome \rto \aPython world \b, \nlets play \rsome \tescape \vcharacter game") str="Core Python" for i in range(len(str)): print(str[i]) print() for i in str[::-1]: print(i, end ="") print() str1=input("Enter main string") str2=input("Enter sub string") m= str1.find(str2, 0, len(str1)) ...
akhilti/pythonsample
String_game.py
String_game.py
py
911
python
en
code
0
github-code
36
29719085837
from collections import defaultdict def cast(val, regs): """if int return int else return char""" try: return int(val) except ValueError as ve: return regs[val] def run_cmd(line, regs, idx): """run a command""" try: cmd, x, y = line.split() except ValueError as ve: ...
yknot/adventOfCode
2017/23_01.py
23_01.py
py
1,138
python
en
code
0
github-code
36
74051522983
# # Sum watts up? readings for each location and create a new data stream # class wattsup_aggregate (): idname = 'local_aggregate' query = {'profile_id': 'YWUr2G8AZP', '_processor_count': 0, 'x-match': 'all'} # dict of location->{wattsupid->watts} wattsups = {} # Called when each packet i...
lab11/gatd-lab11
processors/wattsup_aggregate.py
wattsup_aggregate.py
py
1,112
python
en
code
0
github-code
36
17172274930
import asyncio import json import discord import requests from discord.ext import commands from config.functional_config import check_channels, failure, FAILURE_COLOR, HEADERS, accept, loading, \ SUCCESS_COLOR, GENERAL_COLOR from config.online_config import server, URL_carta async def checking(ctx, server_name)...
YarSav1/ForMCObot
cogs/for_all/minecraft/tasks_minecraft/check/check_serv.py
check_serv.py
py
3,423
python
en
code
0
github-code
36
70351098983
#!/usr/bin/python import sys import numpy as np from mvpa2.tutorial_suite import * myargs=sys.argv area_ID=myargs[1] thedata=list() # I / O partlist=np.loadtxt("./pipeline/part_list",dtype="str") thelabels=np.loadtxt("./data/intext.txt") for p in np.arange(len(partlist)): #for p in np.arange(1): currbasename="....
FBK-NILab/eye-movements
et-fmri-analysis/classification.py
classification.py
py
3,703
python
en
code
0
github-code
36
73403061863
#!/usr/bin/env python # _*_ coding: utf-8 _*_ # @Time : 2023/1/13 22:03 # @Author : Rongrui Zhan # @desc : 本代码未经授权禁止商用 import os.path import flet from pdf2image.exceptions import PDFPageCountError from bonecommand import all_commands from bonecommand.utils import user_path from bonecommand.pdf.utils import convert_pd...
zrr1999/BoneCommand
bonecommand/gui.py
gui.py
py
1,605
python
en
code
0
github-code
36
11706181479
from tkinter import * def quit_application(): root.destroy() root = Tk() root.title("Calculator") root.minsize(150, 330) root.configure(background='darkorchid3') # connecting to the external styling optionDB.txt root.option_readfile('optionDB.txt') # widget specific styling text = Text(root, background='black...
RussFerns/git
calculatorFront.py
calculatorFront.py
py
1,309
python
en
code
1
github-code
36
41834816410
# -*- coding: utf-8 -*- """ Created on Fri Oct 15 15:09:57 2021 @author: ko-ko """ import os import sys import numpy as np import openpyxl as pyxl from scipy import interpolate as interp import math """------------------------------------------------------------""" """ ...
FlyingSheeps/airfoilplotter
airfoilplotter.py
airfoilplotter.py
py
8,793
python
en
code
0
github-code
36
17470757258
from transaction import * import pandas as pd print('Hi Pelanggan! Selamat Datang di Kasir Otomatis') print('==============================================') nama = input('Silahkan Masukkan Nama Anda: ') transaksi = Transaksi(nama) while(True): # Pilihan untuk action users print('Silahkan pilih proses transaksi ...
thoriqcholidy/Pacmann-Self-Service-Cashier
chasier.py
chasier.py
py
6,536
python
id
code
0
github-code
36
34517047847
import snap7 from snap7.util import * from snap7.snap7types import * s7 = snap7.client.Client() s7.connect('192.168.14.45', 0, 1) data = s7.db_read(1, 0, 4) value = get_real(data, 0) print(value) data = bytearray(5) set_real(data,0, -0.0177002) data = data[:-1] print(data) s7.db_write(1, 0, data)
AndreasScharf/IotAdapter
sonstiges/s7setvalue.py
s7setvalue.py
py
300
python
en
code
0
github-code
36
3171467835
n = int(input()) dictionary = {} for i in range(n): line = input().split() country = line[0] rivers = line[1:] for river in rivers: dictionary[river] = country river_names = input().split() for river in river_names: if river in dictionary: print(river, "flows through", dictionar...
sagyndykovaaida/Python
lab7(1).py
lab7(1).py
py
783
python
en
code
0
github-code
36
35815306473
from pathlib import Path import sys import numpy as np from collections import defaultdict import torch from torch.utils.tensorboard import SummaryWriter from rl_envs.grid_world_env import GridWorldEnv from ReplayMemory import * def print_actions(agent, env, get_optimal = False): with torch.no_grad(): act...
zhilu1/rl_practice
perform_deep_learning.py
perform_deep_learning.py
py
3,939
python
en
code
0
github-code
36
9826643435
import uvicorn from fastapi import FastAPI, Response, Depends, Query from config import META_VERIFY_TOKEN, FASTAPI_HOST, FASTAPI_PORT from model import Event from example.api import get_weather_info, get_yelp_info, select_yelp_type, get_yelp_typeIdx from utils import event_parser, verify_payload from typing import List...
GaryHo34/SeattleBot
example/example.py
example.py
py
3,107
python
en
code
3
github-code
36
73710404904
__license__ = 'GPL v3' __copyright__ = '2013, 2014, 2023, Jellby <jellby@yahoo.com>' __docformat__ = 'restructuredtext en' try: from PyQt5.Qt import QDialog, QDialogButtonBox, QFont, QPlainTextEdit, QVBoxLayout except ImportError: from PyQt4.Qt import QDialog, QDialogButtonBox, QFont, QPlainTextEdit, QVBoxLa...
Jellby/PrincePDF
log_box.py
log_box.py
py
1,434
python
en
code
3
github-code
36
72265753383
"""covert_dataset.py - demo: '../../demo/to-hf/convert_dataset.demo.ipynb' """ import os import re import json import pandas as pd def remove_java_comments(codedata: str) -> str: """remove comments in the java source code""" codedata = re.sub(r"/\*(.*?)\*/", "", codedata, flags=re.MULTILINE | re.DOTALL) c...
jalaxy33/PROMISE-dataset
preprocessed/src/to-hf/convert_dataset.py
convert_dataset.py
py
7,027
python
en
code
1
github-code
36
9366051037
from sympy import symbols, Matrix, eye, sin, cos, pi, pprint, diff import math import sympy as sym import numpy as np import matplotlib.pyplot as plt from functools import partial from mpl_toolkits.mplot3d import axes3d, Axes3D Q1, Q2, Q3, Q4, Q5= symbols('coxa femur tibia pitch wheel') Joint_Angles = [Q1...
HarshShirsath/Robot-Modelling-Project-2-NASA-Athlete-Rover-
FK_athlete.py
FK_athlete.py
py
1,595
python
en
code
0
github-code
36
34240292583
import discord from discord.ext import commands import time intents = discord.Intents.all() bot = commands.Bot(command_prefix='!', intents=intents) @bot.event async def on_ready(): print("Başladı") @bot.command() async def send(ctx, *, args=None): if args != None: members = ctx.guild.members ...
omergoc/DiscordReklamBotu
app.py
app.py
py
600
python
en
code
2
github-code
36
10954038644
# -*- coding: utf-8 -*- import wx from controlador import control_hilo class entrada ( wx.Frame ): def __init__( self, parent ): wx.Frame.__init__ ( self, None , id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( int(parent.resolucion[0]), int(parent.resolucion[1]) ), ...
scfouetsfalceon/Inamba
vista/terminal.py
terminal.py
py
2,194
python
en
code
0
github-code
36
5728396322
import json import os import uuid import asyncio from typing import MutableMapping from aio_pika import Message, connect from aio_pika.abc import ( AbstractChannel, AbstractConnection, AbstractIncomingMessage, AbstractQueue, ) class RpcClient: connection: AbstractConnection channel: AbstractCh...
PoteeDev/scenario-manager
manager/amqp.py
amqp.py
py
3,831
python
en
code
0
github-code
36
22011646889
from fgo.interops import * import random from functools import reduce from copy import copy def click(): return reduce(Compose, [ Wait(Range(0.15, 0.25)), Left(), Wait(Range(0.1, 0.2)), Left(), Wait(Range(0.3, 0.5)) ]) def fix_dpi(origin: Event) -> Event: @origin....
thautwarm/do-you-like-wan-you-si
fgo/common.py
common.py
py
560
python
en
code
11
github-code
36
74431933545
# from the graphs, output metrics of dependency analysis. # INPUT: # folder_analysis (global variable, folder for analysis) # folder_analysis/graph_set_per_domain.bin (output of 2_build_dependency.py) # folder_analysis/graph_set_global.bin (output of 2_build_dependency.py) # folder_analysis/domain_list.txt (use...
cess-pro/Domain_Relation
src/sf/3_analyze_dependency.py
3_analyze_dependency.py
py
7,500
python
en
code
0
github-code
36
35102278935
import csv from itertools import chain from typing import Optional from src import PrioritizedCountryTokensList def fix_tokens_list(tokens_list: PrioritizedCountryTokensList): handmade_aliases = { 'united kingdom': ['uk'], 'united states': ['usa', 'new york', 'us', 'new jersey', 'denver, co', 'oh...
sergey-s-null/10s-BigDataEntrance
PythonScripts/util/location_mappings/3_merge.py
3_merge.py
py
3,036
python
en
code
0
github-code
36
10697052181
# -*- coding: utf-8 -*- ''' This code is the implementation of two-phase level set for the following paper: T. F. Chan and L. A. Vese, "Active contours without edges," in IEEE Transactions on Image Processing, vol. 10, no. 2, pp. 266-277, Feb. 2001, doi: 10.1109/83.902291. Note: level set initialization and parameters...
zzhenggit/level_set_collections
Chan_Vese_model/demo.py
demo.py
py
1,079
python
en
code
1
github-code
36
938498832
import torch import torch.nn as nn import torch.nn.functional as F class GRUEncoder(nn.Module): def __init__(self, config, gpu_list, *args, **params): super(GRUEncoder, self).__init__() self.hidden_size = config.getint("model", "hidden_size") self.bi = config.getboolean("model", "bi_direc...
china-ai-law-challenge/CAIL2020
sfks/baseline/model/encoder/GRUEncoder.py
GRUEncoder.py
py
802
python
en
code
150
github-code
36
27005163734
#!/usr/bin/python2.4 # (C) Simon Drabble 2008 # This software is released under the Gnu General Public Licence v2.0. # See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html __author__ = 'Simon Drabble <python-devel@thebigmachine.org>' import struct from StringIO import StringIO import unittest import riff cl...
mramos1004/pyriff
riff_test.py
riff_test.py
py
4,592
python
en
code
0
github-code
36
7779238712
import os # The secret key is used by Flask to encrypt session cookies. # [START secret_key] SECRET_KEY = 'my_key' # [END secret_key] # Google Cloud Project ID. This can be found on the 'Overview' page at # https://console.developers.google.com PROJECT_ID = 'my_project_id' MONGO_URI = 'mongo_db_uri' # Google Cloud ...
nuong/Python-Flask-Demo
config.py
config.py
py
1,536
python
en
code
0
github-code
36
27119964864
#Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, crie duas listas extras que vão conter apenas os valores pares e os valores ímpares digitados, respectivamente. Ao final, mostre o conteúdo das três listas geradas. par = [] impar = [] while True: n = int(input('Digite um número: '))...
JoaoFerreira123/Curso_Python-Curso_em_Video
Exercícios/#082.py
#082.py
py
583
python
pt
code
0
github-code
36
38568308899
''' Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. ''' class Solution(object): def maxSubArray(self, nums): """ ...
archanakalburgi/Algorithms
leetcode_problems/21_aug/max_subarray.py
max_subarray.py
py
653
python
en
code
1
github-code
36
8596463464
from django.urls import path from .views import HomePageView, SearchResultsView from phones import views urlpatterns = [ path('', HomePageView.as_view(), name='home'), path('search/', SearchResultsView.as_view(), name='search_results'), path('create/', views.create), path('edit/<int:id>...
Avalardiss/phonebook
phones/urls.py
urls.py
py
438
python
en
code
0
github-code
36
18287540788
# Use the file name mbox-short.txt as the file name fname = input("Enter file name: ") fh = open(fname) y=0 count=0 y=float(y) for line in fh: if not line.startswith("X-DSPAM-Confidence:"): continue n=line.find("0.") x=float(line[n:]) y=x+y count=count+1 average=y/count print("Average spam c...
Abhishek32971/python_my_code
college/ActivitySet01/problem09.py
problem09.py
py
340
python
en
code
1
github-code
36
21154413667
#!/usr/bin/env python3 from bs4 import BeautifulSoup import sys import urllib.request import os.path import os import smtplib import time class IPCheck: def __init__(self): self.oldIP = None self.currentIP = None self.logFile = os.getenv('HOME') + '/.ipcheck/log' self.logDirectoryC...
optiseth/ipcheck
ipcheck.py
ipcheck.py
py
2,708
python
en
code
0
github-code
36
15443990274
#!/usr/bin/python3.1 # anti-docx, a .docx-to-text converter written by Albin Stjerna # # Please, feel free to do what you want with this code. It is way too short # for a proper license. :) import zipfile, sys, textwrap from xml.sax import parse, ContentHandler from optparse import OptionParser def extract_document(fn...
amandasystems/anti-docx
anti-docx.py
anti-docx.py
py
2,244
python
en
code
4
github-code
36
4602760440
from .utils import hsv_to_rgb, byte_scale_rgb # Angle of each LED in degrees # # Made using sim.py - see commented out code in LED.__init__ led_angle = ( 204.2, 195.1, 185.1, 174.9, 164.9, 155.8, 145.5, 139.3, 131.1, 120.2, 106.2, 90.0, 73.8, 59.8, 48.9, ...
ncw/mirror
modes/time.py
time.py
py
1,990
python
en
code
5
github-code
36
24248570033
import os import sys import datetime as dt import numpy as np G_WeekDays = ('MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN') def dmy2Weekday(dmy): return dt.datetime.strptime(str(dmy, encoding='utf-8'), '%d-%m-%Y').date().weekday() def ReadData(filename): WeekDays, ClosingPr...
shtyi037/Python_practice
DATASCIENCE/weekdays.py
weekdays.py
py
1,871
python
en
code
0
github-code
36
44008094218
# Basic idea: # Physicsy sandy sand (pixel-perfect collisions, run simulation to keep up with real time) # Character moving around # Tap direction (WASD) to choose stuff to pick up, tap next to throw # Hold direction to choose stuff to morph, press other keys to morph it import pygame from pygame.locals import * impo...
ninjafrostpn/PythonProjects
Bending/Bending 3.py
Bending 3.py
py
5,219
python
en
code
0
github-code
36
3714710740
############################################################################## # # Author : Pawan Singh Pal # Email : pawansingh126@gmail.com # Date : Oct 2018 # ############################################################################## import unittest import game class TestGame(unittest.TestCase): ...
msampathkumar/battleship
game/game_test.py
game_test.py
py
1,404
python
en
code
0
github-code
36
17454665839
import getpass import os import subprocess from paramiko.client import SSHClient, AutoAddPolicy from paramiko.config import SSHConfig from .transfer import Transfer class Connection(object): host = None original_host = None user = None port = None ssh_config = None connect_timeout = None ...
Yeolar/bunder
bunder/connection.py
connection.py
py
5,335
python
en
code
0
github-code
36
43165056383
#from osgeo import gdal, osr, ogr # Python bindings for GDAL import numpy as np import matplotlib.pyplot as plt import sys import os import pickle import json from rlxutils import subplots from .utils import pimshow class Chipset: def __init__(self, chipset_folder=None, data=None, metadata=None): sel...
VMBoehm/SAR-landslide-detection-pretraining
src/datamodules/components/chips.py
chips.py
py
13,357
python
en
code
25
github-code
36
6689998525
#!/usr/bin/env python3 import argparse import os import unittest import testtools import sys PROJECT_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.pardir) sys.path.append(PROJECT_DIR) parser = argparse.ArgumentParser(description="Run tests.") parser.add_argument("--deployment", choices=["aw...
spcl/serverless-benchmarks
tests/test_runner.py
test_runner.py
py
1,892
python
en
code
97
github-code
36
26287011843
from unittest.mock import patch import pytest from deboiler import Deboiler from deboiler.dataset import ListDataset from deboiler.models.page import ParsedPage, RawPage @pytest.mark.parametrize("operation_mode", ["memory", "performance"]) def test_pipeline_end_to_end(operation_mode): # `parse_counter` defined ...
globality-corp/deboiler
deboiler/tests/test_operation_modes.py
test_operation_modes.py
py
2,080
python
en
code
2
github-code
36
36726073158
#! /usr/bin/env python import sys import random def help(): print("usage: generator.py <n_couples> <n_cars> <n_places> [<seed>]") print("\t for solvability, cars should be at list n_couples + 1.") sys.exit(2) if len(sys.argv) not in [4, 5]: help() couples = int(sys.argv[1]) cars = int(sys.argv[2])...
AI-Planning/pddl-generators
hiking/generator.py
generator.py
py
1,875
python
en
code
44
github-code
36
29376670360
import time import unittest from datetime import datetime from typing import Tuple from flask.testing import FlaskClient from flask_socketio import SocketIOTestClient from sqlalchemy import select from app import db from app import make_app from app import socket_io from app.authentication.models import chats, User f...
dmytro-afanasiev/flask-simple-chats
tests/test_socketio_events.py
test_socketio_events.py
py
15,296
python
en
code
0
github-code
36
22750603244
import random import pickle import time import os from linear_data_structures import Queue from order import Order from people import Customer, Courier from graph import Graph, Vertex from pathfinder import getShortestDistance title_str = 'PyDispatcher CLI' side_spaces = 30 title_formatted = f"{' ' * side_spaces}{tit...
scottlai0/AY2023-24---IE5600-Group-Assignment
src/main.py
main.py
py
23,495
python
en
code
1
github-code
36
15827619242
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import * import logging import pymongo import pickle import numpy as np import bson im...
e-mission/e-mission-server
emission/storage/decorations/common_trip_queries.py
common_trip_queries.py
py
4,875
python
en
code
22
github-code
36
42926700856
from django.shortcuts import render from patient.models import Patient from .models import Need, Appointment from .forms import AddNeedForm def add_need(request, patient_number): form = AddNeedForm(request.POST or None) current_patient = Patient.objects.get(id=patient_number) if form.is_valid(): n...
guillaume-guerdoux/tournee_infirmiers
tournee_infirmiers/event/views.py
views.py
py
1,057
python
en
code
0
github-code
36
11316618459
import pandas as pd import datetime import json def date_to_week(d): split_date = d.split('/') return int(datetime.date(int(split_date[2]), int(split_date[0]), int(split_date[1])).strftime('%U')) # Historical deaths data (and 2020, which will be overwritten where possible) deaths = pd.read_csv('deaths_2020-06...
AdamHickerson/covid-19-deaths
corona2.py
corona2.py
py
3,769
python
en
code
0
github-code
36
4393984163
# 숨바꼭질 # https://www.acmicpc.net/problem/6118 import heapq import sys input = sys.stdin.readline n, m = map(int, input().split()) INF = int(1e9) graph = [[] for i in range(n + 1)] distance = [INF] * (n + 1) for _ in range(m): a, b = map(int, input().split()) graph[a].append((b, 1)) graph[b].append((a, 1...
sjjam/Algorithm-Python
baekjoon/6118.py
6118.py
py
933
python
en
code
0
github-code
36
30180533882
#!/bin/env python3 import sys import re from functools import cache def readfile(filename): with open(filename) as f: inp = f.read() return inp def step1(inp): return recurse(inp, findwire(inp, 'a')) def step2(inp, override): inp = re.sub('.*-> b\n', f'{override} -> b\n', inp) return step1(inp) de...
reyemxela/adventofcode
2015/07/main.py
main.py
py
1,530
python
en
code
0
github-code
36
16128993395
import time import asyncio import tornado.web import tornado.ioloop class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world\n") class NonBlocking(tornado.web.RequestHandler): async def get(self): await asyncio.sleep(10) class Blocking(tornado.web.RequestHandl...
czasg/ScrapyLearning
czaSpider/dump/tornado学习/test.py
test.py
py
647
python
en
code
1
github-code
36
9788698464
from langchain.document_loaders import TextLoader from langchain.text_splitter import CharacterTextSplitter from langchain.embeddings.openai import OpenAIEmbeddings from langchain.vectorstores import Pinecone from langchain import VectorDBQA, OpenAI from langchain.chains import RetrievalQA import pinecone import os ...
ellizzabbetth/intro-into-vector-db
main.py
main.py
py
1,279
python
en
code
0
github-code
36
26763695977
import logging import pandas as pd import numpy as np from .mapping import big_map, pivot_result_to_one_map from .group_columns import full_id_vars, lateralisation_vars from .melt_then_pivot_query import melt_then_pivot_query # main function is QUERY_LATERALISATION def gifs_lat(gif_lat_file): """ factor fu...
thenineteen/Semiology-Visualisation-Tool
mega_analysis/crosstab/mega_analysis/QUERY_LATERALISATION_GLOBAL.py
QUERY_LATERALISATION_GLOBAL.py
py
19,998
python
en
code
9
github-code
36
5536685399
import json import os import pathlib import sys from PyQt5 import QtCore, QtGui from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtGui import QFontDatabase from PyQt5.QtWidgets import * import Globals def Log(*args): # 0 Non Issue # 1 Minor Issue # 2 Non Essential issue # 3 Essential ...
AntCDev/Another-Chance
main.py
main.py
py
21,012
python
en
code
1
github-code
36
14696985443
from datasets import load_dataset import matplotlib.pyplot as plt rated_KoRAE = load_dataset("Cartinoe5930/KoRAE_rated", split="train") score_result = {} x_label = [] for i in range(0, 21): score_result[i * 0.5] = 0 x_label.append(i * 0.5) for data in rated_KoRAE: score_result[float(data["score"])] += 1 ...
gauss5930/KoRAE
rating/score_plot.py
score_plot.py
py
630
python
en
code
0
github-code
36
9055030549
def insert_new_venue(mydb, mycursor, venue_data): get_max = 'select max( venue_id ) from Venue;' mycursor.execute(get_max) myresult = mycursor.fetchall() new_id = (myresult[0][0] + 1) sql = f"""insert ignore into Venue (venue_id, venue_name) values ({new_id}, '{venue_data['venue_nam...
SidhaantAnand/MLB-Analysis
addData/add_venue.py
add_venue.py
py
2,866
python
en
code
0
github-code
36
36531588851
# The Purpose of the app: track what movies the user has watched and the order # in which the user has watched them. import sys import os home = os.path.expanduser("~") desktop_rel_path = '/Desktop/MOOC_work/udemy/complete_python_and_postgres_dev_course/section6_movie_system' if home + desktop_rel_path not in sys.path...
BrandonHoeft/mooc-work
udemy/complete_python_and_postgres_dev_course/section6_movie_system/app.py
app.py
py
2,405
python
en
code
0
github-code
36
42088370430
from src.depth_transform import * from src.audio_transform import * from PIL import Image import matplotlib.pyplot as plt import numpy as np from src.dataset_utils import _load_audio_file MAX_DEPTH = 10000 MIN_DEPTH = 0.0 def test_depth_arr(depth): params = {"max_depth": 10000} depth = transform_depth(depth, ...
Hadiaz1/Batvision-tf
tests/data_tests.py
data_tests.py
py
1,376
python
en
code
1
github-code
36
14547146966
import os from pprint import pprint os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from app_ml.functionalities.constants import SPARK_WINDOW, MONGO_URL, WINDOW, SAVED_MODEL_PATH, POSTGRES_URL from app_ml.functionalities.preprocessing import create_test_set from app_ml.models.RNN import RNN from sqlalchemy import create_eng...
serapan/DrEYEve
app_ml/data/insert_data_to_postgres.py
insert_data_to_postgres.py
py
3,331
python
en
code
0
github-code
36
72967433705
def find_max_min(arg):#created function find_max_min with arg as its parameter. ans = [] max_num = max(arg) min_num = min(arg) if min_num == max_num: length = len(arg) ans.append(length) else: ans.append(min_num) ans.append(max_num) return ans #the labels used rhime with the expected inputs ...
Awesome94/DAY-2-BOOTCAMP-LABS
Max_min.py
Max_min.py
py
432
python
en
code
0
github-code
36
7786068615
# coding: utf8 # auto: flytrap import unittest from custom import CustomCarry, Seed, change_custom_seed, _default_custom_seed class CustomTest(unittest.TestCase): def test_custom_class(self): print('custom_class:1') custom = CustomCarry() c = custom.next() self.assertEqual(c, '1') ...
flytrap/custom
custom/CustomCarry/test.py
test.py
py
1,660
python
en
code
1
github-code
36
3125630169
from sklearn.ensemble import GradientBoostingRegressor from sklearn.model_selection import GridSearchCV import catboost as cb import xgboost as xgb import pandas as pd def gradientBoost(X,y): gboost=GradientBoostingRegressor(random_state=11) params={'max_depth':[1,2,3],'n_estimators':[100,300,500,1000]} se...
aamir09/DS2Project
PartB/models/boosting.py
boosting.py
py
1,456
python
en
code
2
github-code
36
28923806171
#14499. 주사위 굴리기 """ cube의 정보를 세 개의 배열에 담는다. LR = [top, right, under, left] UD = [top, left, under, front] FB = [front, left, back, right] [1] Idea 확인 [2] rotate시킬때 잘못했음 [3] 문제를 똑바로 안 읽었음. """ import sys input = sys.stdin.readline N,M,x,y,K = map(int,input().rstrip().split()) boards = [list(map(int,input().rstri...
GuSangmo/BOJ_practice
BarkingDog/12_simulation/14499.py
14499.py
py
2,120
python
en
code
0
github-code
36
23099937336
import os import sys import urllib.request import urllib.parse import datetime import time import json client_id ='GWWUHPgV0uguJWvgsMFu' client_secret = 'slKycSCDf4' # url 접속 요청 후 응답리턴함수 def getRequestUrl(url): req = urllib.request.Request(url) req.add_header("X-Naver-Client-Id", client_id) req.add_hea...
omago123/StudyBigData
day01/naverCrawler.py
naverCrawler.py
py
2,636
python
en
code
0
github-code
36
32282451401
import socket import os ADDR='./sockfile' try: os.unlink(ADDR) except OSError: if os.path.exists(ADDR): raise skt=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM) skt.bind(ADDR) #进程中传输时,绑定文件名字 skt.listen(5) while True: sk,addr=skt.accept() print('addr:',addr) while True: da...
joiller/exercises
unix_recv.py
unix_recv.py
py
425
python
en
code
0
github-code
36
18530889108
#mymodule.py GLOBAL_CHARS = [] GLOBAL_CURSOR = ['UP', 'DOWN', 'LEFT', 'RIGHT', 'UPARROW', 'DOWNARROW', 'LEFTARROW', 'RIGHTARROW', 'PAGEUP', 'PAGEDOWN', 'HOME', 'END', 'INSERT', 'DELETE', 'DEL', 'BACKSPACE', 'TAB', 'SPACE'] GLOBAL_SYSTEM = ['ENTER', 'ESCAPE', 'PAUSE BREAK', 'PRINTSCREEN', 'MENU APP', 'F1', 'F2','F3','...
ryarmst/FuzzyDuckling
fuzzyDuckling.py
fuzzyDuckling.py
py
1,441
python
en
code
0
github-code
36
73313411305
# -*- coding: utf-8 -*- # @Time : 2022 09 # @Author : yicao import csv import os import time import numpy as np import torch import math from utils import log_util class RecordTest: def __init__(self, log_file, test_file): self.log_file = log_file self.test_file = test_file + ' test.csv' ...
zhengLabs/FedLSC
utils/record_util.py
record_util.py
py
10,384
python
en
code
1
github-code
36
30524124831
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Author: HuHao <huhao1@cmcm.com> Date: '2018/7/19' Info: """ import os,traceback,re,sys,string from calendar import month_abbr from collections import namedtuple import textwrap def test_text(): text = 'yeah, but no, but yeah, but no, but yeah' print(tex...
happy-place/data-base
api-test/py-test/Part3_Python_CookBook/test_str.py
test_str.py
py
9,271
python
en
code
1
github-code
36
5187515239
from django.urls import path from.import views app_name ="hospital" urlpatterns = [ path('',views.index,name="index"), path('about',views.about,name="about"), path('contact',views.contact,name="contact"), path('appointment',views.appointment,name="appointment"), path('doctorprofile',views.doctorpr...
pythonhere/web
hospital/urls.py
urls.py
py
1,823
python
en
code
0
github-code
36
19778742293
from Kock.drawing.bar_graph import * from Kock.Orf.function_orf_methods import * from Kock.Orf.class_id_methods import * from Kock.Orf.orf_relation_methods import * from Kock.readwrite.read_input_files import * if __name__ == '__main__': # Lectura del fichero tb_functions. classes, functions = read_input_file...
chus73/Koch_bacillus
Koch/main.py
main.py
py
2,376
python
en
code
0
github-code
36
33520209237
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ' hipnuc protocol module ' import threading import struct import datetime import time class HipnucFrame_Exception(Exception): def __init__(self,err='HI221GW Frame Error'): Exception.__init__(self,err) class HipnucFrame_NoValid_Exception(HipnucFrame_Exceptio...
hipnuc/products
examples/Python/hipnuc_protocol.py
hipnuc_protocol.py
py
21,962
python
en
code
56
github-code
36
16479298643
import os import gzip import numpy as np import struct import urllib from urllib import request # load compressed MNIST gz files and return numpy arrays def load_data(filename, label = False): with gzip.open(filename) as gz: magic_number = struct.unpack('I', gz.read(4)) n_items = struct.unpack('>I...
microsoft/vscode-tools-for-ai
mnist-vscode-docs-sample/utils.py
utils.py
py
2,445
python
en
code
302
github-code
36
14301735578
"""Loads pre-pickled data and feature sets""" import os import pickle from sentiment import utils def get_labeled_sentiment_data(): """ Load pre-pickled sentiment data with labels. """ pickle_file = os.path.join(utils.get_project_root(), 'data/pickles/sentiment_data_lab...
SinanTang/simple-sentiment-analyser.lambda
sentiment/services/features.py
features.py
py
1,306
python
en
code
1
github-code
36
4078872082
class Solution: # @param A : list of list of integers # @return a list of list of integers def solve(self, A): row = len(A) col = len(A[0]) for i in range(row): for j in range(i): A[i][j], A[j][i] = A[j][i], A[i][j] return A A = [[1, 0], [1, 0]] ...
VishalDeoPrasad/InterviewBit
Diagonal Flip.py
Diagonal Flip.py
py
357
python
en
code
1
github-code
36
21477614483
import sys INF = sys.maxsize n = int(input()) arr = list(map(int, input().split())) arr.sort() start = 0 end = len(arr) - 1 pair = [] min_val = INF while start < end: total = arr[start] + arr[end] # 둘 간의 합을 기존과 비교해 작은걸 채택하고, 두 용액의 산성도도 별도 변수에 저장 if abs(total) < min_val: min_val = abs(total) ...
Minsoo-Shin/jungle
week02/2470_두용액2_two_pointers.py
2470_두용액2_two_pointers.py
py
500
python
ko
code
0
github-code
36
19415250824
import azureml.core from azureml.core import Workspace, Experiment from azureml.core.authentication import ServicePrincipalAuthentication from azureml.core.compute import ComputeTarget, DatabricksCompute from azureml.exceptions import ComputeTargetException from azureml.pipeline.steps import PythonScriptStep from azure...
jomit/SecureAzureMLWorkshop
aml_pipeline/build_pipeline.py
build_pipeline.py
py
4,596
python
en
code
1
github-code
36
20298727355
from flask import Flask, render_template, request, redirect, url_for, flash from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///weight.db' db = SQLAlchemy(app) class WeightEntry(db.Model): id = db.Column(db.Integer, primary_key=True) weight = db.Col...
kozhydlo/Weight-tracking
main.py
main.py
py
1,176
python
en
code
0
github-code
36
13880556989
#!/usr/bin/python3 # -*- coding:utf-8 -*- import sys import os from configparser import ConfigParser import time from ctypes import * import logging import time from PIL import Image,ImageDraw,ImageFont import traceback import calendar import datetime from datetime import date from dateutil.parser import parse from dat...
f1ynng8/omnifocus-eink
raspberrypi/daemon.py
daemon.py
py
10,089
python
en
code
0
github-code
36
12991191723
import os from telegram.ext import Updater from telegram.error import BadRequest, Unauthorized TOKEN = os.environ.get('TELEGRAM_TOKEN') updater = Updater(token=TOKEN) bot = updater.dispatcher.bot def send_message(chat_id: int, text: str): try: bot.send_message(chat_id=chat_id, text=text) return T...
OpenSUTD/evs-notifications
apis/telemsg/src/bot.py
bot.py
py
456
python
en
code
1
github-code
36
15943063220
import numpy as np from scipy.special import factorial ident = 'dick6D' d = 6 title_plot = r'$f_6(u)=\left(\prod_{i=2}^6 u_i^{i-1} \right) \exp\left\{\prod_{i=1}^6 u_i\right\}$' mat_folder = 'simuDick/d6' true_val = np.exp(1.) - np.sum(1. / factorial(np.arange(6))) orders = [1, 2, 4, 6, 8] min_neval = 100 max_neval = ...
nchopin/cubic_strat
nonvanish_xp/dick6D.py
dick6D.py
py
475
python
en
code
0
github-code
36
73360145384
# django imports from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.decorators import permission_required from django.core.urlresolvers import reverse from django.db import IntegrityError from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django....
django-lfs/lfs
manage/views/product/properties.py
properties.py
py
5,016
python
en
code
23
github-code
36
72502764263
import itertools import math import pickle from collections import defaultdict,Counter import collections import copy import spacy from spacy.lang.en.stop_words import STOP_WORDS Q = 'Los The Angeles Boston Times Globe Washington Post' DoE = {'Los Angeles Times':0, 'The Boston Globe':1,'The Washington Post':2, 'Star Tr...
Xin1896/COMP6714
proj1-partA/test3.py
test3.py
py
1,707
python
en
code
1
github-code
36
16930492443
import aiosqlite from datetime import datetime DB = 'db.sqlite' async def search_db_entry(user_id, type, kind, location, distance): curdate = str(datetime.now().strftime('%Y%m%d')) query = f"SELECT * FROM geteilt where expires_at > {curdate}" query += f" AND user_id <> {user_id}" if type != 'all': ...
subkultur/teilwas_bot
tw_db.py
tw_db.py
py
6,545
python
en
code
0
github-code
36
74424262825
import pandas as pd import urllib.request import bs4 as bs import re class Movie_Titles: def __init__(self, movie_df, refresh_on_start, engine): self.df = movie_df self.refresh_on_start = refresh_on_start self.engine = engine def get_titles(self): """Obtain the titles of the mo...
chiaracapuano/WhatToWatch
docker_files/update-database/Movies_Titles.py
Movies_Titles.py
py
1,707
python
en
code
0
github-code
36
33182046648
import os import random from hangman_words import word_list from hangman_art import stages, logo def main_menu(): """ Displays the main menu and returns the user's choice. """ clear() print(logo) print("Welcome to Hangman Game!") print("\nMain Menu:") print("1. Start a New Game") ...
Code-Institute-Submissions/Hang-Man-7
run.py
run.py
py
3,994
python
en
code
null
github-code
36
6415260764
n=int(input("Enter the limit: \n")) # for i in range(1, n + 1): # for j in range(1, i + 1): # print("2", end=" ") # print() num = 65 # # outer loop to handle number of rows # for i in range(0, n): # num = num + 1 # # not re assigning num # # ...
npabhinand/PYTHON
udemy/patterns/number_pyramid.py
number_pyramid.py
py
882
python
en
code
0
github-code
36
15829018139
''' heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]] ''' class Solution: def pacificAtlantic(self, heights) : m, n = len(heights), len(heights[0]) visit_p = [[0] * n for _ in range(m)] visit_a = [[0] * n for _ in range(m)] for i in range(m): for j...
wangwenju269/leetcode
广度深度优先搜索/417. 太平洋大西洋水流问题.py
417. 太平洋大西洋水流问题.py
py
1,158
python
en
code
1
github-code
36
21683733200
#!/usr/bin/env python3 import numpy as np import networkx as nx import logging import collections import os import math try: from PySide2 import QtGui, QtCore except ImportError: from PySide6 import QtGui, QtCore from functools import lru_cache from origami.core.predict import PredictorType from origami.core.neig...
poke1024/origami
origami/batch/annotate/utils.py
utils.py
py
11,088
python
en
code
69
github-code
36
31471841488
from typing import Optional import pytest from robotoff.insights.ocr.label import LABELS_REGEX XX_BIO_XX_OCR_REGEX = LABELS_REGEX["xx-bio-xx"][0] ES_BIO_OCR_REGEX = LABELS_REGEX["xx-bio-xx"][1] @pytest.mark.parametrize( "input_str,is_match,output", [ ("ES-ECO-001-AN", True, "en:es-eco-001-an"), ...
alexouille123/robotoff
tests/insights/ocr/test_label.py
test_label.py
py
727
python
en
code
null
github-code
36
41732652808
class ListNode: def __init__(self, val): self.val = val self.next = None class MyLinkedList: def __init__(self): self.head = None self.tail = None self.size = 0 def getFirst(self): return self.head.val def getLast(self): return self.tail.val ...
rajneeshkumar146/AlmaBetter
lecture_016/linkedList.py
linkedList.py
py
2,748
python
en
code
1
github-code
36
16636179375
from torch.nn import BCEWithLogitsLoss from pytorch_toolbelt import losses as L import numpy as np import torch import matplotlib.pyplot as plt def main(): losses = { "bce": BCEWithLogitsLoss(), # "focal": L.BinaryFocalLoss(), # "jaccard": L.BinaryJaccardLoss(), # "jaccard_log": L...
BloodAxe/pytorch-toolbelt
demo/demo_losses.py
demo_losses.py
py
1,750
python
en
code
1,447
github-code
36
71243269224
import omdb import csv import requests def search_dictionaries(key, value, list_of_dictionaries): return [element for element in list_of_dictionaries if element[key] == value] API_KEY = 'd76fe527' #premium service OMDB API Key # Set the default key for all future calls. omdb.set_default('apikey', API_KEY) #build li...
akhavarovskiy/moviedb
build_db/omdb_import.py
omdb_import.py
py
2,393
python
en
code
0
github-code
36
41824709985
def sum(numbers): added_value = 0 for num in numbers: num_val = int(num) added_value = added_value + num_val return added_value num = [] while True: entries = input("Enter a number or 'done' to quit: ") if entries.lower() == 'done': print('Goodbye') break eli...
neshure/Intro2Python102
unit_2/built_function_lab2.1.py
built_function_lab2.1.py
py
416
python
en
code
0
github-code
36
30467860787
class Solution: def sumSubarrayMins(self, A: List[int]) -> int: stack = [] stack.append([A[0], 0, A[0]]) res = A[0] for i in range(1, len(A)): while len(stack) > 0 and stack[-1][0] >= A[i]: stack.pop() if len(stack) == 0: temp =...
dundunmao/LeetCode2019
907. Sum of Subarray Minimums.py
907. Sum of Subarray Minimums.py
py
2,043
python
en
code
0
github-code
36