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
39326157381
import requests import datetime from datetimerange import DateTimeRange import json import math import pytz def get_hijri(timezone): r = requests.get('http://api.aladhan.com/v1/gToH?date='+datetime.datetime.now(pytz.timezone(timezone)).strftime('%d-%m-%Y')).json() return r['data']['hijri']['day'] +' '+ r['data...
RaihanStark/sakumuslim
engine.py
engine.py
py
4,264
python
en
code
0
github-code
36
28521177727
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.variables.variable import Variable from opus_core.misc import safe_array_divide from variable_functions import my_attribute_label c...
psrc/urbansim
urbansim/gridcell/total_number_of_possible_SSS_jobs_from_buildings.py
total_number_of_possible_SSS_jobs_from_buildings.py
py
2,426
python
en
code
4
github-code
36
32094159630
from decimal import Decimal import setoptconf as soc GOOD_SIMPLE_VALUES = ( (soc.String, None, None), (soc.String, 'foo', 'foo'), (soc.String, '1', '1'), (soc.String, 1, '1'), (soc.String, 1.23, '1.23'), (soc.String, Decimal('1.23'), '1.23'), (soc.Integer, None, None), (soc.Integer, ...
jayclassless/setoptconf
test/test_datatypes.py
test_datatypes.py
py
4,436
python
en
code
3
github-code
36
3006495445
from pandas.io.parsers import read_csv import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm def carga_csv(filename): valores = read_csv(filename, header=None).to_numpy() return valores.astype(float) def h(x, theta): return theta[0] + theta[...
jorgmo02/AA
P1/practica1.py
practica1.py
py
5,108
python
es
code
0
github-code
36
4254235874
""" Example 1: Input: arr1=[[1, 3], [5, 6], [7, 9]], arr2=[[2, 3], [5, 7]] Output: [2, 3], [5, 6], [7, 7] Explanation: The output list contains the common intervals between the two lists. Example 2: Input: arr1=[[1, 3], [5, 7], [9, 12]], arr2=[[5, 10]] Output: [5, 7], [9, 10] Explanation: The output list contains the...
blhwong/algos_py
grokking/merge_intervals/intervals_intersection/main.py
main.py
py
1,000
python
en
code
0
github-code
36
27033338799
from __future__ import print_function import argparse from ast import literal_eval import logging from utils import metrics_manager from utils import data_manager try: import ConfigParser config = ConfigParser.ConfigParser() except ImportError: import configparser config = configparser.ConfigParser()...
awslabs/deeplearning-benchmark
benchmark_runner.py
benchmark_runner.py
py
2,670
python
en
code
119
github-code
36
13488107411
def roman(num): roman_map = {1: "I", 2: "II", 3: "III", 4: "IV", 5: "V", 6: "VI", 7: "VII", 8: "VIII", 9: "IX", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M"} result = "" remainder = num for i in sorted(roman_map.keys(), reverse=True):# 2 print(i) if remainder > 0: ...
AydinTokuslu/AWS-DevOps-Projects
Project-001-Roman-Numerals-Converter/benim-cozumum/roman.py
roman.py
py
593
python
en
code
0
github-code
36
41287151080
from game_of_greed_v2.game_logic import GameLogic class Game: def __init__(self, roller=None): self.roller = roller def play(self): print('Welcome to Game of Greed') wanna_play = input('Wanna play? ') if wanna_play == 'n': print('OK. Maybe another time') else...
LTUC/amman-python-401d7
class-07/demo/game-of-greed-v2/game_of_greed_v2/game.py
game.py
py
785
python
en
code
2
github-code
36
34710160257
import os import shutil import time import unittest from configparser import ConfigParser from os import environ from Bio import SeqIO from installed_clients.WorkspaceClient import Workspace as workspaceService from GenomeFileUtil.GenomeFileUtilImpl import GenomeFileUtil from GenomeFileUtil.GenomeFileUtilServer impor...
kbaseapps/GenomeFileUtil
test/supplemental_genbank_tests/genbank_upload_parameter_test.py
genbank_upload_parameter_test.py
py
8,715
python
en
code
0
github-code
36
24486995491
"""archive hails Revision ID: da94441f919f Revises: 51c630a38d3c Create Date: 2022-03-16 13:46:13.409774 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'da94441f919f' down_revision = '51c630a38d3c' branch_labels = None...
openmaraude/APITaxi
APITaxi_models2/migrations/versions/20220316_13:46:13_da94441f919f_archive_hails.py
20220316_13:46:13_da94441f919f_archive_hails.py
py
1,462
python
en
code
24
github-code
36
23083264879
from django.shortcuts import render from .forms import RegisterForm, LoginForm from django.shortcuts import redirect from django.contrib import messages from django.contrib.auth import authenticate , login # Create your views here. def index(request): return render(request,'acounts/index.html') def register(req...
Shivam38391/django-asignment
acounts/views.py
views.py
py
1,792
python
en
code
3
github-code
36
5892047689
from typing import Tuple import numpy as np import yaml import os def PIDController( v_0: float, y_ref: float, y_hat: float, prev_e_y: float, prev_int_y: float, delta_t: float ) -> Tuple[float, float, float, float]: """ PID performing lateral control. Args: v_0: linear Duckiebot speed ...
bratjay01/bharath_duckiebot
modcon/packages/solution/pid_controller_homework.py
pid_controller_homework.py
py
2,430
python
en
code
0
github-code
36
13511295213
#! /usr/bin/python import tensorflow as tf import numpy as np from check_base import * import mnist class mnist_cnn_test_1(check_base): def __init(self,reader): self.base = super(mnist_cnn_test_1,self) self.base.__init__(reader) def decl_predict(self): x = self.decl_placeholder("...
angelbruce/NN
mnist_cnn_1_test.py
mnist_cnn_1_test.py
py
1,151
python
en
code
0
github-code
36
74963734183
# !/usr/bin/env python # -*- coding:utf-8 -*- """ @FileName: weChatClient @Author : sky @Date : 2022/8/1 15:48 @Desc : 客户端 """ import wx import socket import threading # 客户端继承wx.frame,就拥有了窗口界面 class WeChatClient(wx.Frame): def __init__(self, c_name): # 调用父类的构造函数 wx.Frame.__init__(self, Non...
Bxiaoyu/NotesRep
Wechat/weChatClient.py
weChatClient.py
py
3,819
python
en
code
0
github-code
36
7112777830
import scipy.integrate as integrate import sympy as sp x = sp.symbols('x') n = sp.symbols('n') f = (1/sp.pi) * x**3 * sp.sin(n*x) lower = -sp.pi upper = sp.pi integral = sp.integrate(f,(x,lower,upper)) simplified_integral = sp.simplify(integral) print(simplified_integral)
ClarkieUK/Fourier-Series
testing.py
testing.py
py
276
python
en
code
0
github-code
36
73720676264
# -*- coding: utf-8 -*- # @date:2022/12/12 9:55 # @Author:crab-pc # @file: onlinelibrary_detail import random from urllib.parse import urljoin import time from selenium import webdriver from selenium.webdriver.chrome.options import Options import logging import os import pandas as pd from concurrent.futures import Thre...
yjsdl/contribute_link
contributuLink/spiders/onlinelibrary_detail.py
onlinelibrary_detail.py
py
2,627
python
en
code
0
github-code
36
28147682147
import os import cv2 as cv import numpy as np import time import json import threading from queue import Queue import sys picture_path='C:/Users/Administrator/Desktop/1/' picture_number=0 #第几个图片 num=0 #成功了多少张图片 #魔方的颜色 greenLower = (46, 133, 46) greenUpper = (85, 255, 255) redLower = (150, 100, 6) redUpper = (1...
xiaomoxiao/magic-cube
MultiThreading/code/getdata.py
getdata.py
py
14,183
python
en
code
0
github-code
36
5459057284
import configparser from constants.Constants import Constants as const from .OptimizerParamsFactory import OptimizerParamsFactory from model.OptimizerFactory import OptimizerFactory class ConfigParams(object): def __init__(self, file): config = configparser.ConfigParser() config.read_file(open(...
SlipknotTN/kaggle_dog_breed
keras/lib/config/ConfigParams.py
ConfigParams.py
py
1,442
python
en
code
0
github-code
36
70677270824
""" Filename: locate_nci_data.py Author: Damien Irving, irving.damien@gmail.com Description: Locate CMIP5 data at NCI """ # Import general Python modules import sys, os, pdb import argparse from ARCCSSive import CMIP5 import six import glob # Define functions def main(inargs): """Run the program.""...
DamienIrving/ocean-analysis
downloads/locate_nci_data.py
locate_nci_data.py
py
3,321
python
en
code
9
github-code
36
35869343289
# receiver import socket, select from pickle import loads def extract_ip(): st = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: st.connect(('10.255.255.255', 1)) IP = st.getsockname()[0] except Exception: IP = '127.0.0.1' finally: st.close() ...
jmerc141/UDP-Chatroom
my_receiver.py
my_receiver.py
py
644
python
en
code
0
github-code
36
14248726433
# 모든 상어가 이동한 후의 보드를 반환하는 함수 def move_shark(board, priority_move, look_direction, shark_info_for_smell, dx, dy): n = len(board) new_board = [[0] * n for _ in range(n)] for x in range(n): for y in range(n): if board[x][y] != 0: # 만약 상어가 존재하면 shark_num = board[x][y] ...
vmfaldwntjd/Algorithm
BaekjoonAlgorithm/파이썬/구현/[백준 19237]어른 상어/Baekjoon_19237.py
Baekjoon_19237.py
py
6,119
python
ko
code
0
github-code
36
6724801910
from RestrictedPython import compile_restricted_function, safe_builtins, limited_builtins, utility_builtins someglobalvar = 123 myscript = """ import math import tempfile import io #folgende befehle fuehren zu fehlern #f = open("app.py", "rb") #f = NamedTemporaryFile(delete=False) def g(x): #return x + 1 + someglo...
aleksProsk/HydroOpt2.0
minimal-code-examples/minimal-embedded-script2.py
minimal-embedded-script2.py
py
2,656
python
en
code
0
github-code
36
42927359751
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: j = -1 for i in range(len(nums)): if (target-nums[i]) in nums: if (nums.count(nums[i]) == 1) and (nums[i]==target-nums[i]): continue else: ...
Ftttttt/LeetCode_solution
Python/two_sum.py
two_sum.py
py
574
python
en
code
0
github-code
36
33205266662
import unittest from booksorter import BookSorter class BookSorterTest(unittest.TestCase): def test_scan_command(self): bs = BookSorter('sacn', '--config config.json', '--target ./books') bs.run() # test there is booktypes.json and it has pr...
yuan201/sortbooks
test_booksorter.py
test_booksorter.py
py
1,079
python
en
code
0
github-code
36
31932662699
class ClassMV: def __init__(self): self.alpha = 0 self.beta = 0 self.a = 0 self.k = 0 self.points = [] for i in range(71): temp = self.poly(i)**35%71 if temp == 1: val = self.poly(i)**18%71 self.points.append((i,val)) self.p...
JuanDa14Sa/Cripto
Main/MV.py
MV.py
py
2,320
python
en
code
0
github-code
36
12480966037
import view as user import model_div import model_sub import model_sum import model_mult import logger def button_click(): global value_a, value_b print('1-комплексные числа, 2- рациональные числа') value_item = int(input('Выберите значение: ')) print() if value_item == 1: value_a = user.i...
dungogggggggggggggg/pythonProject7
controller.py
controller.py
py
1,510
python
ru
code
0
github-code
36
36728200947
#!/usr/bin/env python from pwn import * __DEBUG__ = 1 #context.log_level = 'debug' p = None def init(): global p envs = {'LD_PRELOAD':'/home/nhiephon/libc.so.6'} if __DEBUG__: p = process('./library_in_c', env=envs) else: p = remote('shell.actf.co', 2020...
Aleks-dotcom/ctf_lib_2021
angstormctf/chall4/sol3.py
sol3.py
py
1,485
python
en
code
1
github-code
36
22546241259
from PySide2.QtUiTools import QUiLoader #pip3 install PySide2 from PySide2.QtWidgets import QApplication, QTableWidgetItem from PySide2.QtCore import QFile, QIODevice, QTimer from PySide2.QtWidgets import QFileDialog, QMessageBox import math from PySide2.QtCore import QStringListModel import sys import os from PySide2....
romenskiy2012/recording_spark
Client/GUI_user.py
GUI_user.py
py
12,345
python
en
code
1
github-code
36
13300689829
from art import logo import os bid = list() def add_new_bidder(name: str, bid_price: int) ->dict[str, int]: user_data = dict() user_data["name"] = name user_data["bid_price"] = bid_price return user_data def find_the_highest_bidder(bid: dict[str, int]) ->tuple[str, int]: highest_bid = 0 ...
robmik1974/secret-auction
main.py
main.py
py
1,215
python
en
code
0
github-code
36
18937659990
from django.db import models from wagtail.admin.panels import FieldPanel from wagtail.snippets.models import register_snippet class SimpleTaxonomy(models.Model): """An abstract model for simple taxonomy terms.""" class Meta: abstract = True ordering = ['title'] title = models.CharField( ...
IATI/IATI-Standard-Website
taxonomies/models.py
models.py
py
1,010
python
en
code
5
github-code
36
74698538345
A = int(input()) B = int(input()) C = int(input()) if A>B and C and A!=B!=C: print("%d eh o maior" % A) if B>A and C and A!=B!=C: print("%d eh o maior" % B) if C>A and B and A!=B!=C: print("%d eh o maior" % C)
jaquelinediasoliveira/SENAI
1DES/FPOO/Python/ex005.py
ex005.py
py
231
python
en
code
0
github-code
36
43914452628
# 벌집 N = int(input()) shell = 1 # N==1인 경우 if N == 1: print(1) exit() # N>1인 경우, shell을 하나씩 증가시켜 N이 해당 shell에 속하는지 확인 while (True): start = 3*shell**2 - 3*shell + 2 end = 3*shell**2 + 3*shell + 1 if start <= N and N <= end: print(shell+1) exit() shell += 1
yesjuhee/study-ps
baekjoon/StepByStep/01-Input-Output-Operations/2292.py
2292.py
py
355
python
ko
code
0
github-code
36
21241362539
#!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess import time import signal from threading import Thread from rtm.logger import logger __author__ = 'David Qian' """ Created on 12/08/2016 @author: David Qian """ class ExecutorThread(Thread): """Executor thread, communicate with the real runner ...
krizex/RunnerTimer
src/rtm/executor.py
executor.py
py
2,631
python
en
code
0
github-code
36
74147827945
import re import argparse from os import listdir def read_file(filename: str) -> str: with open("./regex_labs/src/{}.txt".format(filename)) as f: return f.read() def creditcards(content): """All credit card numbers and respective brands""" matches = re.findall(r"([0-9\s]+)\n?([a-zA-Z\s]+)\n?", c...
zepcp/code_labs
regex_labs/regex.py
regex.py
py
1,669
python
en
code
1
github-code
36
70947908905
""" a good algorithm for concatenating two singly linked list together, given both the head node of each list """ from example_singly_linked_list import SinglyLinkedList def concat(L, M): # concat two linked lists together # the result is stored in L if M._head is not None: # if M is none, does no...
luke-mao/Data-Structures-and-Algorithms-in-Python
chapter7/q2.py
q2.py
py
1,291
python
en
code
1
github-code
36
72908299944
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class MinHeap: def __init__(self): self.root = None def insert(self, value): # Создаем новый узел с заданным значением new_node = ListNode(value) # Если куча пуста, делаем...
TatsianaPoto/yandex
Algorithm_complexity/heap/linked_list_sorted.py
linked_list_sorted.py
py
1,790
python
ru
code
0
github-code
36
8231917354
from __future__ import absolute_import from __future__ import division from __future__ import print_function #from __future__ import unicode_literals This breaks __all__ on PY2 from . import config, metrics from .core import Baseplate def make_metrics_client(raw_config): """Configure and return a metrics client....
Omosofe/baseplate
baseplate/__init__.py
__init__.py
py
1,147
python
en
code
null
github-code
36
495660367
import os import types import pytest import yaml from dagster import ( DagsterEventType, DagsterInvalidConfigError, RunConfig, check, execute_pipeline, pipeline, seven, solid, ) from dagster.core.instance import DagsterInstance, InstanceRef, InstanceType from dagster.core.storage.event...
helloworld/continuous-dagster
deploy/dagster_modules/dagster/dagster_tests/core_tests/storage_tests/test_local_instance.py
test_local_instance.py
py
5,700
python
en
code
2
github-code
36
10272333559
from flask import Flask, g, render_template,\ request, redirect, url_for, flash, session import hashlib import os import mysql.connector import google.oauth2.credentials import google_auth_oauthlib.flow from google.auth.transport import requests import requests, json os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '...
FaelPressao/Projeto_Academia_Versao_Final
academia/main.py
main.py
py
10,533
python
en
code
0
github-code
36
43303567074
from rpython.tool.flattenrec import FlattenRecursion def test_flattenrec(): r = FlattenRecursion() seen = set() def rec(n): if n > 0: r(rec, n-1) seen.add(n) rec(10000) assert seen == set(range(10001))
mozillazg/pypy
rpython/tool/test/test_flattenrec.py
test_flattenrec.py
py
253
python
en
code
430
github-code
36
33508499662
import cv2 as cv import numpy as np # Load and Read input cap = cv.VideoCapture('Test.mp4') #Array to store orientation of each frame orient_ation = [] count = 0 orient_ation.append(count) while True: #Read input for current frame ret1,current_frame = cap.read() #Print error message if the...
mightykim91/navigation_system
source_code/version_2AB.py
version_2AB.py
py
3,430
python
en
code
0
github-code
36
30325551719
# -*- coding: utf-8 -*- import http.client import csv import json conn = http.client.HTTPSConnection("empresa.app.invoicexpress.com") # Lendo os dados do arquivo CSV com ponto e vírgula como separador with open("itens2.csv", newline="") as csvfile: reader = csv.reader(csvfile, delimiter=";") # Especific...
wesleyy598/Consumindo-API-Python
InvoiceXpress/Importar Invoice/Importar Preços de Portugal.py
Importar Preços de Portugal.py
py
1,145
python
en
code
1
github-code
36
29413120017
import numpy as np import cv2 cap = cv2.VideoCapture(0) # Define the codes and create VideoWriter object fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480)) while True: ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) if ret == True: ...
land-pack/opencv-example
basic/simple_cap_save_video.py
simple_cap_save_video.py
py
553
python
en
code
1
github-code
36
6795008221
from exo_accounts.test_mixins.faker_factories import FakeUserFactory from test_utils.test_case_mixins import UserTestMixin from test_utils import DjangoRestFrameworkTestCase class TestLocationCityCountry( UserTestMixin, DjangoRestFrameworkTestCase): def setUp(self): super().setUp() ...
tomasgarzon/exo-services
service-exo-core/utils/tests/test_location.py
test_location.py
py
1,615
python
en
code
0
github-code
36
17386735173
import numpy as np import math from skimage import io, util import heapq def randomPatch(texture, patchLength): h, w, _ = texture.shape i = np.random.randint(h - patchLength) j = np.random.randint(w - patchLength) return texture[i:i+patchLength, j:j+patchLength] def L2OverlapDiff(patch, patchLength, ov...
QURATT/https---github.com-QURATT-DIPProject
image_quilting.py
image_quilting.py
py
5,186
python
en
code
0
github-code
36
9149914830
#coding = 'utf-8' ''' 这是一个格栅布局的小例子! 文章链接:http://www.xdbcb8.com/archives/209.html ''' import sys from PyQt5.QtWidgets import (QWidget, QPushButton, QApplication, QGridLayout, QLCDNumber) class Example(QWidget): ''' 格栅布局 ''' def __init__(self): ''' 一些初始设置 ''' super().__i...
redmorningcn/PyQT5Example
PyQt5All/PyQt56/QGrild layout.pyw
QGrild layout.pyw
pyw
2,002
python
zh
code
1
github-code
36
34493975789
import logging import os from argparse import ArgumentParser from typing import Dict, List, Tuple, Set import pandas as pd from tqdm import tqdm from gebert.utils.io import save_node_id2terms_list, save_dict, save_tuples, read_mrconso, read_mrrel def get_concept_list_groupby_cui(mrconso_df: pd.DataFrame, cui2node_i...
Andoree/GEBERT
gebert/data/umls2graph.py
umls2graph.py
py
10,606
python
en
code
2
github-code
36
33319841830
import pygame as pg from input_box import InputBox pg.init() screen = pg.display.set_mode((640, 480)) def main(): clock = pg.time.Clock() input_box1 = InputBox(100, 100, 140, 32) done = False while not done: for event in pg.event.get(): if event.type == pg.QUIT: ...
MrRamka/FlyGame
test_input_form.py
test_input_form.py
py
575
python
en
code
0
github-code
36
75072650344
from vedo import Picture, show from vedo.applications import SplinePlotter pic = Picture("../data/sox9_exp.jpg").bw() # black & white plt = SplinePlotter(pic) plt.show(mode="image", zoom="tight") outline = plt.line plt.close() print("Cutting using outline... (please wait)") msh = pic.tomesh().cmap("viridis_r") cut_...
BiAPoL/PoL-BioImage-Analysis-TS-Early-Career-Track
docs/day2aa_surface_processing/vedo_material/scripts/07-grab_scalars.py
07-grab_scalars.py
py
447
python
en
code
6
github-code
36
5099519953
import telepot from flask import Flask, request try: from Queue import Queue except ImportError: from queue import Queue TOKEN = "525915971:AAHCrRmA_e8BsKDVLFw6pB6XS_BjJsUEnqM" CHANNEL = "@signorinaggio" app = Flask(__name__) update_queue = Queue() bot = telepot.Bot(TOKEN) firma = "@formaementisC...
IlPytone/delegator
app.py
app.py
py
1,156
python
en
code
0
github-code
36
14854743181
import pyttsx3 #pip install pyttsx3 import speech_recognition as sr #pip install speechRecognition from datetime import datetime import wikipedia #pip install wikipedia import webbrowser import os import smtplib import psutil from pygame import mixer import json import requests import time engine = pyttsx3.init('sapi5...
yash358/J.A.R.V.I.S
main.py
main.py
py
5,838
python
en
code
0
github-code
36
24788878049
import sys from collections import defaultdict, deque def main(): T = int(sys.stdin.readline().strip()) for _ in range(T): F = int(sys.stdin.readline().strip()) graph = defaultdict(set) ret = defaultdict(int) # def dfs(start): # visited = defaultdict(bool) # ...
inhyeokJeon/AALGGO
Python/baekjoon/4195_friend.py
4195_friend.py
py
1,644
python
en
code
0
github-code
36
13782113749
from pydantic import BaseModel, validator import datetime class Room(BaseModel): final_date: datetime.datetime = None initial_date: datetime.datetime = None size_m2: float = None location: str = None mensal_rent: float = None weekly_rent: float = None room_id: int = None deposit_area: f...
JulioHey/Banco-de-Dados---EP
server/model/room.py
room.py
py
4,807
python
en
code
0
github-code
36
29351890076
''' Created by Yuqiao Hu and Yinan Wu ''' # cited from http://www.cs.cmu.edu/~112/index.html from cmu_112_graphics import * import time def appStarted(app): reset(app) def reset(app): app.rows = 10 app.cols = 10 app.margin = 10 app.textSpace = 40 app.winner = '' app.dotX = -1 app.dotY = -1 app.listWhite = ...
Katrina0406/My-Projects
GoBang Game/gobang.py
gobang.py
py
6,490
python
en
code
1
github-code
36
7040650853
import pytest import math from vec import Vector2 import numpy.testing as npt from adr.World import Ambient from adr.Components import FreeBody from adr.Components.Auxiliary import LandingGear @pytest.fixture def plane(): env = Ambient() plane = FreeBody( name='plane', type='plane', m...
CeuAzul/ADR
tests/Components/Auxiliary/test_LandingGear.py
test_LandingGear.py
py
2,830
python
en
code
12
github-code
36
43348915031
""" Default tests for Env classes """ import pytest import numpy as np import tensorflow as tf from sionna.ofdm import PilotPattern from cebed.envs import OfdmEnv, EnvConfig def mock_pilot_pattern(config): """Dummy pilot pattern where the pilots are set to one""" shape = [ config.n_ues, confi...
SAIC-MONTREAL/CeBed
tests/test_env.py
test_env.py
py
5,096
python
en
code
7
github-code
36
32793887647
import os import torch import torch device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') dataset_path = os.path.dirname(__file__) + '/../data/dataset.txt' teacher_forcing_ratio = 0.5 HIDDEN_SIZE = 512 def change_to_device(model): if device.type == 'cpu': model.cpu() else: ...
junix/gen_poem
conf/__init__.py
__init__.py
py
333
python
en
code
0
github-code
36
16044252945
from pymysql import connect import yaml import logging.config class DB(): def __init__(self): """连接数据库""" logging.info('===================== init data =====================') logging.info("connect db") self.conn = connect(host='127.0.0.1', user='root', password='Zx123456', db='django_restful') def clear(...
langlixiaobailongqaq/django_restful
api/test_project/mysql_action.py
mysql_action.py
py
2,049
python
en
code
1
github-code
36
73788737704
import pathlib import re import shutil import subprocess import tarfile import tempfile import urllib.parse import urllib.request import zipfile javaVersion = "11.0.12+7" def createBinaryArchive(platform: str, arch: str) -> None: print(f"Processing platform/arch '{platform}/{arch}'...") lspCliVersion = getLspCl...
valentjn/lsp-cli
tools/createBinaryArchives.py
createBinaryArchives.py
py
4,493
python
en
code
7
github-code
36
13124489294
def is_palindrome(text): """Cheks if text is palindrome. Args: text: string to be checked Returns: True if text is a palindrome, False if not """ text = text.lower() for i in range(len(text) // 2): if text[i] != text[len(text) -i-1]: return False return True...
pawel123789/Project3
is_palindrome.py
is_palindrome.py
py
355
python
en
code
0
github-code
36
12296289562
#ordered collection #heterogenous #growable #mutable #properties of array #square bracket list1=[1,2,3,4,5,6,'a',"asd",4.5,5.555555,[1,2,3,4],{1,2,4,5,6},(3,4,2,1),{'key1':1,'key2':2}] #print(list1) #print(list1[1:4:1]) #slicing operator #part 1-starting index #part 2-last index #part 3- number of steps,-1 for reverse ...
00143kabir/c_programmes
python/python_lists.py
python_lists.py
py
509
python
en
code
0
github-code
36
8899583521
from flask import redirect, render_template, request, url_for from flask_login import login_required from application import app, db, get_css_framework, ITEMS_PER_PAGE from application.room.models import Room from application.place.models import Place from application.place.forms import PlaceForm from application.plac...
Robustic/Orchestime
application/place/views.py
views.py
py
2,867
python
en
code
0
github-code
36
71064138024
print("Welcome to Calculator") #Addition Function def sum(num1, num2): #find operator add_pos = expr.find("+") if add_pos != -1: print(inValid) #recognize "+" expression expr[add_pos] = "+" isdigit(expr[ :add_pos]) #Find number before plus sign isdigit(expr[add_po...
masonperry/Program-4
Program04 Perry.py
Program04 Perry.py
py
2,688
python
en
code
0
github-code
36
33723812737
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Mar 8 11:02:21 2019 @author: routhier """ import os import pandas as pd import numpy as np import datagenerator as script def test_generator(tmpdir, monkeypatch): def mock_read_csv(file_in, sep): table = pd.DataFrame() table...
etirouthier/MultiAnnotation
DataPipeline/test_datagenerator.py
test_datagenerator.py
py
1,105
python
en
code
0
github-code
36
317625316
#!/bin/python3 import math import os import random import re import sys def flatten(matrix, offset, size): Y, X = offset m, n = size ret = [] for y in range(Y, Y+m): ret.append(matrix[y][X]) for x in range(X+1, X+n): ret.append(matrix[Y+m-1][x]) for y in range(Y+m-2, Y-1, -1): ret.append(matri...
DStheG/hackerrank
HackerRank/matrix-rotation-algo.py
matrix-rotation-algo.py
py
1,373
python
en
code
0
github-code
36
7183191265
#!/usr/bin/env python3 """Init Tsne and the appropriate values""" import numpy as np def P_init(X, perplexity): """Initializes the values D, P, betas, and H""" n, d = X.shape def dist(X): """Finds the dist D""" sum_X = np.sum(np.square(X), axis=1) D = np.add(np.add(-2 * np.matmul(...
JohnCook17/holbertonschool-machine_learning
unsupervised_learning/0x00-dimensionality_reduction/2-P_init.py
2-P_init.py
py
611
python
en
code
3
github-code
36
37854390965
#!/usr/bin/env python3 ''' curve fit to histogram ''' import collections import numpy as np from scipy.optimize import curve_fit import matplotlib.axes as maxes import matplotlib.patches as mpatches from matplotlib.lines import Line2D as mline from .markline import add_fcurve __all__=['add_gauss_fit'] # gaus...
hujh08/datapy
plot/curvefit.py
curvefit.py
py
5,360
python
en
code
0
github-code
36
34326375432
import tensorflow as tf # from tensorflow.keras import layers from tensorflow import keras from data import DataManager import os from utils import utils # https://github.com/rlcode/reinforcement-learning-kr/blob/master/3-atari/1-breakout/breakout_a3c.py # https://github.com/yinchuandong/A3C-keras/blob/master/a3c.py #...
aoba0203/magi
train/agent/BaseModel.py
BaseModel.py
py
6,290
python
en
code
0
github-code
36
41709039982
from AnilistPython import Anilist import csv anilist = Anilist() myList = anilist.search_anime(score=range(50, 99)) anilist.print_anime_info("Vinland saga") field_names = ['name_romaji', 'name_english', 'starting_time', 'ending_time', 'cover_image', 'banner_image', 'airing_format', 'airing_status', 'airing...
ZackaryElmo/AniMap
AniListToCSV.py
AniListToCSV.py
py
643
python
en
code
0
github-code
36
9454046228
# coding: utf-8 import os from mongoengine import connect from fastapi import APIRouter from app.database.documents import Article from app.database.utils import query_to_dict router = APIRouter(prefix="/api", tags=["Api"]) @router.get("/articles") def articles(skip: int = 0, limit: int = 10): """List the articl...
nicolasjlln/lbc-challenge
app/routers/api.py
api.py
py
1,626
python
en
code
0
github-code
36
28091727369
from flask import render_template, request, redirect, url_for, send_from_directory, jsonify, make_response, flash, Markup import os from werkzeug.utils import secure_filename from web_scripts import * @app.route('/') def home(): return render_template('main.html') @app.route('/upload-music', methods = ['GET', 'PO...
philipk19238/slowed-and-reverbed
app/routes.py
routes.py
py
2,366
python
en
code
2
github-code
36
31456650987
from nltk.corpus import movie_reviews import re from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from nltk import pos_tag import string clitics = open('clitics', 'r').readlines() sents0 = movie_reviews.words("neg/cv000_29416.txt") sents1 = movie_revi...
hassanMetwally/pre-processing
pre processing.py
pre processing.py
py
2,678
python
en
code
0
github-code
36
13628425885
from collections import Counter import pandas as pd import nltk from src.tagger import Tagger def get_counts(dataf): with open(dataf, "r") as fh: # Get counts raw = fh.read() # tokens = nltk.word_tokenize(raw) tokens = raw.split() unigrm = Counter(tokens) bigrm = nl...
rgalhama/retro_adjs
src/analyses_TPs/tps.py
tps.py
py
3,266
python
en
code
0
github-code
36
151229982
import sys import uuid import os import shutil from lxml import etree import openpyxl from zipfile import ZipFile core = "docProps/core.xml" def extractWorkbook(filename, outfile="xml"): with ZipFile(filename, "r") as zip: zip.extract(core, outfile) def checkForCheaters(filename): try: parse...
suborofu/tulactf-2022-writeups
web/Cheaters/web/flask-serv/tester.py
tester.py
py
1,878
python
en
code
0
github-code
36
24201075393
# quick sort 구현 def quick_sort(start, end): global n if start >= end: return pivot = n[start] # print("pivot:",pivot) low = start + 1 high = end while low <= high: while low < end + 1 and n[low] <= pivot: low += 1 while high > start and n[high] > pivot: high -= 1...
superyodi/burning-algorithm
basic/boj_2693.py
boj_2693.py
py
807
python
en
code
1
github-code
36
35257408476
import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk,GdkPixbuf from ui import login import socket import select import json import os import redis from ui import event HOST = "127.0.0.1" PORT = 5000 class ChatWindow(Gtk.Window): def __init__(self): super().__init__(title="Mega Chat | ...
Kiril0l/gtk_new
ui/chat.py
chat.py
py
7,521
python
ru
code
0
github-code
36
4454907121
from flask_testing import TestCase from config import create_app from db import db AUTHORISED_ENDPOINTS_DATA = ( ("POST", "/new_resource/"), ("POST", "/tag_resource/"), ("POST", "/upload_file/1/"), ("PUT", "/resource_status/1/read/"), ("PUT", "/resource_status/1/dropped/"), ("PUT", "/resource_...
tedypav/FlaskCourse_OnlinePersonalLibrary
tests/test_application.py
test_application.py
py
4,228
python
en
code
1
github-code
36
28318096244
from sqlalchemy import create_engine, Column, String, Integer from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base import pymysql pymysql.install_as_MySQLdb() # 构建连接引擎对象 engine = create_engine("mysql://root@localhost/py1709_torn_db1", encoding="utf-8"...
laomu/py_1709
2.Tornado_cursor/days02数据模型/demo02sqlalchemy增删改.py
demo02sqlalchemy增删改.py
py
2,838
python
zh
code
0
github-code
36
23987656239
import sys from cefpython3 import cefpython as cef from widgets.cefapplication import CefApplication from widgets.config import ZOOM_FACTOR from widgets.mainwindow import MainWindow def main(): """ See https://github.com/cztomczak/cefpython/blob/master/api/ApplicationSettings.md for mor settings """...
slo-ge/viewsive
src/start.py
start.py
py
945
python
en
code
0
github-code
36
36378630131
import unittest import os import opendatasets as od import sqlite3 import pandas as pd #Testing automated pipeline class TestDownloadAndSaveDataset(unittest.TestCase): def setUp(self): # Set up necessary variables for testing self.dataset_url = 'https://www.kaggle.com/datasets/thedevastator/jobs-da...
arpita739/made-template
project/test.py
test.py
py
1,677
python
en
code
null
github-code
36
42778570533
from typing import Any import pytest from pydantic import ValidationError from toucan_connectors.toucan_connector import ToucanDataSource class DataSource(ToucanDataSource): collection: str # required, validated against type query: Any # required, not validated comment: str = None # not required, no ...
ToucanToco/toucan-connectors
tests/test_datasource.py
test_datasource.py
py
3,757
python
en
code
16
github-code
36
28511009690
import tester # tester import random import pexpect import time import struct import sys import socket import importlib.util EASYDB_PATH = "/cad2/ece326f/tester/bin/easydb" def load_module(modname): path = tester.datapath(modname + ".py", 'asst3') spec = importlib.util.spec_from_file_location(modname, path) ...
CoraZhang/Object-Oriented-Programming
tester/scripts/asst3.py
asst3.py
py
6,122
python
en
code
0
github-code
36
34105486078
from pymongo import MongoClient from wa_api import WA_API # Collection Names AC = "archers" CC = "competitions" QC = "qualifications" QAC = "qualifications_arrows" class MongoManage: def __init__(self, host='localhost', port=27017, rs=None): if rs: self.client = MongoClient(host=host, port=po...
Tayum/di0d
courses/database_discipline/course3_term2/coursework/mongomanage.py
mongomanage.py
py
7,237
python
en
code
0
github-code
36
12780763778
import random def main(): questionCount = 10 correctResults = 0 print("Test d'addition. Combien de chiffres voulez-vous?") chiffre = int(input()) if chiffre == 1: maxValue = 10 elif chiffre == 2: maxValue = 100 elif chiffre == 3: maxValue = 1000 for i in range(...
janoscoder/experiments
incubator/mahault_add_training.py
mahault_add_training.py
py
1,437
python
en
code
0
github-code
36
74646989223
from unittest import TestCase from src.dense_retriever import DenseRetriever class TestRetrieval(TestCase): def test_retrieval(self): retriever = DenseRetriever("msmarco-distilbert-base-v3") sentences = ["this is a test", "the food is hot on the table"] for index, sentence in enumerate(se...
fractalego/samsumbot_client
test/test_retriever.py
test_retriever.py
py
565
python
en
code
0
github-code
36
21539046169
import random import array as arr masiv = arr.array('i', [random.randint(35, 55) for _ in range(12)]) print("Маси учнів підгрупи:") print(masiv) set1 = max(masiv) counter = masiv.index(set1) print(f"Найбільша маса: {set1}") print(f"Номер учня, маса якого найбільша: {counter + 1}")
RiabtsevaAnne/9project
project.py
project.py
py
344
python
uk
code
0
github-code
36
38922961353
from urllib.request import FancyURLopener from bs4 import BeautifulSoup from random import choice import csv from time import sleep from urllib.parse import quote,unquote import json user_agents = [ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11', 'Opera/9.25 (Windows NT 5....
nmaswood/tv_scraping
fetch_cast_html.py
fetch_cast_html.py
py
1,368
python
en
code
0
github-code
36
71056879784
from wordcloud import WordCloud import matplotlib.pyplot as plt from collections import Counter from konlpy.tag import Okt from PIL import Image import numpy as np import sys #사용자 정의 가능한 정보 입력 least_num = int(input("워드 클라우드 단어 최소 빈도를 정수로 입력하시오.:")) directory = input("데이터의 주소를 입력해 주세요.(파일단위입니다.):") temp_save...
LimJinOuk/Word-Cloud
WordCloud.py
WordCloud.py
py
2,206
python
ko
code
0
github-code
36
43301493084
from rpython.jit.metainterp.counter import JitCounter def test_get_index(): jc = JitCounter(size=128) # 7 bits for i in range(10): hash = 400000001 * i index = jc._get_index(hash) assert index == (hash >> (32 - 7)) def test_get_subhash(): assert JitCounter._get_subhash(0x518ebd...
mozillazg/pypy
rpython/jit/metainterp/test/test_counter.py
test_counter.py
py
4,080
python
en
code
430
github-code
36
20762327407
import twilio_setup import eleven_labs_setup import call_handling import latency_management import interruption_handling import call_mimic def main(): # Initialize Twilio and Eleven Labs twilio_api = twilio_setup.initialize_twilio() eleven_labs_api = eleven_labs_setup.initialize_eleven_labs() # Start ...
shadowaxe99/Phonezone
main.py
main.py
py
1,011
python
en
code
0
github-code
36
1762674415
import logging import itertools from typing import Optional import demoji from .apple import scraper_apple from .google import scraper_google __all__ = ["scraper", "scraper_google", "scraper_apple"] def content_filter(content: str) -> Optional[str]: content = demoji.replace(content) if len(content) < 20: ...
moriW/app_words
scraper/__init__.py
__init__.py
py
1,099
python
en
code
0
github-code
36
14733803314
# a plugin: CSV whitelist. # here we create a 'document type' (or 'an instance of Doc') with one input (a csv file) # NOTE: 'doc' is a magic variable that is used to build a Doc instance `Doc( **module.doc )` # This eliminates any need for us to 'from doc import Doc', which is good. from datetime import datet...
JeffKwasha/hachit
plugins/whitelist.py
whitelist.py
py
1,667
python
en
code
1
github-code
36
5134072941
import asyncio from telethon.tl.functions.channels import EditAdminRequest from telethon.tl.functions.contacts import BlockRequest, UnblockRequest from telethon.tl.types import ChatAdminRights from telethon.errors.rpcerrorlist import ChatSendMediaForbiddenError, PeerIdInvalidError from . import * @telebot.on(admin_...
ankitkumarbh/Telegram-Userbot
telebot/plugins/schd.py
schd.py
py
1,538
python
en
code
0
github-code
36
34588741728
import os from pathlib import Path from pyontutils.utils import get_working_dir from pyontutils.integration_test_helper import _TestScriptsBase as TestScripts from .common import project_path, project_path_real, test_organization, onerror from .common import fake_organization import sparcur import sparcur.cli import sp...
SciCrunch/sparc-curation
test/test_integration.py
test_integration.py
py
4,836
python
en
code
11
github-code
36
4079175993
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt from deconstruct_lc import read_config from deconstruct_lc import tools_fasta from deconstruct_lc import tools_lc from deconstruct_lc.scores.norm_score import NormScore class RemovePfam(object): def __init__(self): config = r...
shellydeforte/deconstruct_lc
deconstruct_lc/remove_structure/remove_pfam.py
remove_pfam.py
py
7,821
python
en
code
0
github-code
36
17218989395
import torch import torch.nn as nn from modules.updown_cell import UpDownCell from modules.captioner import Captioner class UpDownCaptioner(Captioner): def __init__(self, vocab, image_feature_size=2048, embedding_size=1000, hidden_size=512, attention_projection_size=512, seq_length=20, beam_size...
Songtuan/Captioning-Model
modules/captioner/UpDownCaptioner.py
UpDownCaptioner.py
py
1,641
python
en
code
0
github-code
36
32158875551
#! /usr/bin/env python3 import sys from math import log """A module for demonstraiting exceptions.""" def convert(s): """Convert to an integer.""" try: x = int(s) except (ValueError, TypeError) as e: print("Conversion error: {}".format(str(e)), file=sys.stderr) raise return x ...
perenciolo/pluralsight
python/fundamental/01/exceptional.py
exceptional.py
py
378
python
en
code
0
github-code
36
29642501697
import argparse import numpy as np import scipy.stats from statsmodels.stats.proportion import * import matplotlib import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.patches import Patch import matplotlib.patches as mpatches matplotlib.rcParams['font.family'] = 'Arial' def get_conf_in...
pqian11/fragment-completion
analysis/exp1_analysis.py
exp1_analysis.py
py
20,639
python
en
code
5
github-code
36
31911094208
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
TendTo/Telegram-SpottedDMI-Bot
docs/source/conf.py
conf.py
py
4,898
python
en
code
null
github-code
36
12075612630
from CrearPreguntas import * import random class Partida: def __init__(self): self._puntaje = 0 self._preguntas_partida = [] self._nombre = "" self._nivel = 0 self._respuesta = 0 self._vivo = True def get_puntaje(self): return self._puntaje def get_vivo(self): return self._vivo def get_nivel(se...
pSARq/retoSofka
Partida.py
Partida.py
py
1,979
python
es
code
0
github-code
36