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
41237359815
import os, sys import multiprocessing as mp def pipeline(config, genome, protocol, cells, minreads, name, fq1, fq2, dir, top_million_reads, step, parallel): """ Run the Data Processing Pipeline... #. Stats and count the barcode from pair-end 1 sequences; #. Read the barcode counts files; ...
beiseq/baseqDrops
package/baseqDrops/pipeline.py
pipeline.py
py
6,329
python
en
code
13
github-code
6
39485917026
from ast import Tuple from app.screen.titled_screen import TitledScreen from app.globals import State, MovieService, TheatreService, BookingService from core.viewmodels import Ticket from core.utils import TheatreUtils class TicketManagementScreen(TitledScreen): def __init__(self): super().__init__("Ticke...
IsaTippens/Groupware
app/staff/ticket_management.py
ticket_management.py
py
4,674
python
en
code
0
github-code
6
31036723867
''' Source code modified from https://github.com/budzianowski/PyTorch-Beam-Search-Decoding/blob/master/decode_beam.py implementation of beam search on GPT-2's logits ''' import operator import torch import torch.nn as nn import torch.nn.functional as F from queue import PriorityQueue import sys class BeamSearchNode(...
HKUST-KnowComp/GEIA
decode_beam_search.py
decode_beam_search.py
py
6,377
python
en
code
22
github-code
6
34600680585
import numpy as np import matplotlib.pyplot as plt def sigmoid(Z): """sigmoid Arguments: Z {[np.array]} -- [Wx + b] Returns: A - [np.array] -- [1 / 1+exp(- Wx + b)] cache - Z """ A = 1/(1+np.exp(-Z)) cache = Z return A, cache def relu(Z): """rectified linear unit Arguments: Z {[np.array]} --...
anantsrivastava30/deeplearning
dnn_utils.py
dnn_utils.py
py
1,924
python
en
code
2
github-code
6
74787884667
# This file is part of "Junya's self learning project about Neural Network." # # "Junya's self learning project about Neural Network" # is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the L...
junyakaneko/learning-and-neural-network
chapter3/problem1.py
problem1.py
py
3,651
python
en
code
1
github-code
6
41843852670
# Code courtesy: https://towardsdatascience.com/support-vector-machine-python-example-d67d9b63f1c8 # Theory: https://www.youtube.com/watch?v=_PwhiWxHK8o import numpy as np import cvxopt from sklearn.datasets.samples_generator import make_blobs from sklearn.model_selection import train_test_split from matplotlib import ...
gmortuza/machine-learning-scratch
machine_learning/instance_based/svm/svm.py
svm.py
py
3,218
python
en
code
6
github-code
6
74492815226
"""Wrapper a los proceso de scrapping """ import tempfile import os from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.desired_capabilities import DesiredCapabilities # pylint: disable=unused-import from scrapper.procesos.patentes_inpi_novedades import...
pmoracho/scrapper-2
scrapper/scrapping.py
scrapping.py
py
3,958
python
en
code
0
github-code
6
32163459953
# import torch # import torch.nn as nn # from torch.autograd import Variable import tensorflow as tf class reparameterize(tf.keras.Model): def __init__(self): super(reparameterize, self).__init__() @tf.function def call(self, mu, logvar, sample_num=1, phase='training'): if phase == 'traini...
mihirp1998/ProbabilisticNeuralProgrammedNetwork_Tensorflow
lib/reparameterize.py
reparameterize.py
py
1,077
python
en
code
8
github-code
6
50277551
from typing import * # ref https://leetcode.cn/problems/naming-a-company/solution/by-endlesscheng-ruz8/ from collections import defaultdict class Solution: def distinctNames(self, ideas: List[str]) -> int: group = defaultdict(int) for s in ideas: group[s[1:]] |= 1 << (ord(s[0]) - ord...
code-cp/leetcode
solutions/6094/main.py
main.py
py
1,093
python
en
code
0
github-code
6
34965299401
def two_split(nums,target,lo,high): while(lo<=high): middle = (lo + high)/2 if(nums[middle] < target): lo = middle+1 elif(nums[middle]>target): high = middle-1 else: return middle return lo class Solution(object): def search(self, nums, t...
qingyuannk/phoenix
binary_search/search_rotate_array.py
search_rotate_array.py
py
1,018
python
en
code
0
github-code
6
21669508962
import requests from common.log import GetLogger log = GetLogger().get_logger() class BaseRequest(): def __init__(self): pass def get(self,url,params=None,**kwargs): try: response=requests.get(url,params=params,**kwargs) log.info("==========接口API请求开始===========") ...
menghuai1995/PythonAutoCode
API_Autotest/common/baseRequest.py
baseRequest.py
py
1,787
python
en
code
0
github-code
6
72729152507
#!/usr/bin/env python3 import rospy from sensor_msgs.msg import LaserScan from geometry_msgs.msg import PoseWithCovarianceStamped #from nav_msgs.msg import Odometry from math import floor import matplotlib.pyplot as plt import numpy as np #teste #This node receives topic 'scanner' and 'poser' and adds noise to them...
joaofgois/saut_ogm
scripts/noiser.py
noiser.py
py
3,485
python
en
code
0
github-code
6
34861021547
from statuspage.forms import StatusPageModelForm from utilities.forms import StaticSelect from ..models import Component, ComponentGroup __all__ = ( 'ComponentForm', 'ComponentGroupForm', ) class ComponentForm(StatusPageModelForm): fieldsets = ( ('Component', ( 'name', 'link', 'descri...
Status-Page/Status-Page
statuspage/components/forms/models.py
models.py
py
1,145
python
en
code
45
github-code
6
3005447062
import os class Event_Controler: def __init__(self, rede_p1, rede_p2): self.need_objects = True self.comandos = [] self.redep1 = rede_p1 self.redep2 = rede_p2 def set_objects(self, bola, player_1, player_2, partida): self.bola = bola self.player_1 = player_1 ...
MateusRosario/PingPongGameSimpleNNAI
Neural_Net/Event_Controler.py
Event_Controler.py
py
3,465
python
en
code
0
github-code
6
37976582239
""" Revised Monitor for screen addition, removing logging & LED Author: Howard Webb Date: 10/09/2018 Controller to collect GPS and Sonar data and integrate into a single record May also collect non-serial data (ie. turbidity) Store to a file, incrementing for each new run """ from __future__ import print_function from...
webbhm/Sonar-GPS
GPS/Monitor.py
Monitor.py
py
7,011
python
en
code
2
github-code
6
12064640805
""" A Module for Encrypt and Decrypt message """ import ReadWriteFileManagement # Import the Fernet module from cryptography.fernet import Fernet DATABASE_DIR_PATH = "../../databases/chat_db/" FILE_NAME = "encryptKey.key" """ A function for generating an encryption key. the function generate the using Fernet class,...
RoyYotam/My-Chat
src/help classes/EncryptMessage.py
EncryptMessage.py
py
2,030
python
en
code
0
github-code
6
10136905988
import cv2 as cv import copy import numpy as np from matplotlib import pyplot as plt img = cv.imread("/home/arkaprabha/CViiing/photos/cameron.jpeg") cv.imshow("image",img) def reframe(frame=None,scale=0.75): width= int(frame.shape[1] + scale) height = int(frame.shape[0] + scale) dimen = (width,height) ...
ArkaprabhaChakraborty/CViiing
python/basics.py
basics.py
py
4,193
python
en
code
1
github-code
6
13303958661
from fastapi import APIRouter, Depends from app.dependencies import verify_api_key from app.libraries.libpoller import Poller from app.schemas.poller import PollerModel, PollerUpdateModel, PollerCreateModel router = APIRouter(tags=["poller"]) oPoller = Poller() # Poller Requests ( API_KEY required ) @router.get("/p...
treytose/Pyonet-API
pyonet-api/app/routers/poller.py
poller.py
py
1,534
python
en
code
0
github-code
6
15549783234
import random import csv import time from src.world import World from src.user import User from src.euclidregion import EuclidRegion from src.regionprovider import GreedyRegionProvider from src.userprofile import UserProfile from src.gridregion import GridRegion region_provider = GreedyRegionProvider.unmodified_gener...
ems236/EECS456XRegions
bias_test.py
bias_test.py
py
2,362
python
en
code
0
github-code
6
71176383548
import boto3, datetime, time region = 'us-west-2' accesskey = os.environ['ACCESSKEY'] secretkey = os.environ['SECRET_ACCESSKEY'] def send_firehose(message: str): client = boto3.client('firehose', aws_access_key_id=accesskey, aws_secret_access_key=secretkey, region_name=region) # Send message to firehose respo...
kfunamizu/python_commonlib
firehose/src/firehose.py
firehose.py
py
479
python
en
code
0
github-code
6
2931948188
from typing import Dict from network.api.base import BaseRepository import re from http.cookies import SimpleCookie import dukpy import requests import http.client from network.api.base_mainpage_cookies_loader import BaseMainPageCookiesLoader IPP_JS_PATH = 'resources/ipp.js' class PagesRepository(BaseRepository, Bas...
Emperator122/dns-shop_price_comparator
network/api/pages.py
pages.py
py
2,270
python
en
code
0
github-code
6
17466244152
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: GAN.py # Author: Yuxin Wu <ppwwyyxxc@gmail.com> import tensorflow as tf import numpy as np from tensorpack import (QueueInputTrainerBase, TowerContext, get_global_step_var) from tensorpack.tfutils.summary import summary_moving_average, add_moving_summary fr...
jxwufan/NLOR_A3C
tensorpack/examples/GAN/GAN.py
GAN.py
py
2,676
python
en
code
16
github-code
6
9303272302
import os import sys import shutil if not os.path.exists("build"): os.mkdir("build") os.chdir("build") code = os.system("cmake .. -DPK_USE_CJSON=ON -DPK_USE_BOX2D=ON") assert code == 0 code = os.system("cmake --build . --config Release") assert code == 0 if sys.platform == "win32": shutil.copy("Release/main...
0Armaan025/pocketpy
cmake_build.py
cmake_build.py
py
624
python
en
code
null
github-code
6
5200005552
""" The production code for predicting smell events and sending push notifications (sending push notifications requires the rake script in the smell-pittsburgh-rails repository) """ import sys from util import log, generateLogger, computeMetric, isFileHere import pandas as pd from getData import getData fro...
CMU-CREATE-Lab/smell-pittsburgh-prediction
py/prediction/production.py
production.py
py
10,561
python
en
code
6
github-code
6
26986918036
# -*- coding: utf-8 -*- import base64 import pytest from nameko_grpc.headers import ( HeaderManager, check_decoded, check_encoded, comma_join, decode_header, encode_header, filter_headers_for_application, sort_headers_for_wire, ) class TestEncodeHeader: def test_binary(self): ...
nameko/nameko-grpc
test/test_headers.py
test_headers.py
py
6,536
python
en
code
57
github-code
6
12701288482
from collections import deque import sys d = deque() n = int(sys.stdin.readline().rstrip()) for i in range(n): order = sys.stdin.readline().rstrip().split() a = order[0] if a == "push": d.append(order[1]) elif a == "pop": if d: print(d.popleft()) else: p...
MinChoi0129/Algorithm_Problems
BOJ_Problems/18258.py
18258.py
py
647
python
en
code
2
github-code
6
20794460102
import numpy as np import matplotlib.pyplot as plt x = []; y = [] for i in range(100): x.append(np.sin(np.pi/48*i)) y.append(2-2*np.cos(np.pi/48*i)) plt.plot(x, y) plt.show()
duynamrcv/mpc_ros
test.py
test.py
py
185
python
en
code
1
github-code
6
73886255546
import psycopg2 import os import http.server import socketserver import logging import sys class IndexHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): self.path = 'index.html' return http.server.SimpleHTTPRequestHandler.do_GET(self) print("start app") app_port = os.environ.get("A...
hed854/tp3-kubernetes
frontend/app.py
app.py
py
978
python
en
code
0
github-code
6
73510645947
from collections import defaultdict N = int(input()) for i in range(N): forwared = defaultdict(int) reverse = defaultdict(int) m,n= map(int,input().split()) nums = [] ans = 0 for i in range(m): temp = list(map(int,input().split())) nums.append(temp) for i in range(m): ...
yonaSisay/a2sv-competitive-programming
xsum.py
xsum.py
py
627
python
en
code
0
github-code
6
2862637647
#coding:utf-8 from API.APIMode import Bit_ZAPI import time import urllib path='/api_v1/tradeAdd' secret ='a5ccc6b23756d49229844de248b2839c' params = {} params['api_key'] = '425c89d5d669ea4de9e20379604505e6' params['timestamp'] = str(int(time.time())) params['nonce'] = str(int(time.time() % 1000000)) params['coin'] = s...
lyonLeeLPL/Bit-Z
Transact/Test.py
Test.py
py
692
python
en
code
0
github-code
6
74182190907
''' * กลุ่มที่ : 23010016 * 65010195 ชลศักดิ์ อนุวารีพงษ์ * chapter : 1 item : 4 ครั้งที่ : 0002 * Assigned : Tuesday 4th of July 2023 03:28:37 PM --> Submission : Tuesday 4th of July 2023 03:39:57 PM * Elapsed time : 11 minutes. * filename : exercise4.py ''' def odd_list(al): income_list = al odd_num_l...
chollsak/KMITL-Object-Oriented-Data-Structures-2D
Python1/exercise4.py
exercise4.py
py
725
python
en
code
0
github-code
6
810350566
'''Random Pick Index - https://leetcode.com/problems/random-pick-index/ Given an integer array nums with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array. Implement the Solution class: Solution(int[] nums) Initializes the obj...
Saima-Chaity/Leetcode
Array_String/Random Pick Index.py
Random Pick Index.py
py
1,557
python
en
code
0
github-code
6
8454082456
from uuid import uuid4 from sqlalchemy import text from critique_wheel.adapters.sqlalchemy import iam_repository from critique_wheel.critiques.models.critique import Critique from critique_wheel.members.models.IAM import MemberStatus from critique_wheel.members.value_objects import MemberId from critique_wheel.works....
davidjnevin/ddd_critiquewheel
critique_wheel/tests/integration/test_IAM_repository.py
test_IAM_repository.py
py
4,132
python
en
code
1
github-code
6
2046128502
import os import sys RASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(RASE_DIR) import time import threading from verify import Verify from scrapy import cmdline from multiprocessing import Process from Bearcat_ProxyPool.settings import SPIDER_TIME curPath = os.path.abspath(os.path.dirname(__file...
yuzhiyizhan/Bearcat_ProxyPool
main.py
main.py
py
1,261
python
en
code
2
github-code
6
18525593045
import argparse import os import mmcv import torch from mmcv.runner import get_dist_info, init_dist, load_checkpoint from drp.apis import set_random_seed, single_gpu_test from drp.datasets import build_dataloader, build_dataset from drp.models import build_model from drp.datasets.pipelines.utils import get_weight ...
yivan-WYYGDSG/AGMI
tools/test.py
test.py
py
3,775
python
en
code
1
github-code
6
30647763320
string = "aaabbccccdaajj" mylist = list(string) mylist.append(" ") z = 0 c = [] for y in range(len(mylist)-1): z = z+1 if mylist[y] != mylist[y+1]: c.append(z) z=0 a = [] for x in range(0, len(string)-1): if string[x] == string[x+1]: a.append(int(x)) k = "" for x in a: myli...
itshimanshu2602/Python_restart
code4.py
code4.py
py
567
python
en
code
0
github-code
6
14096602197
from .helpers import * class TestClientTeams(ClientTestCase): def test_teams_get_teams_for_workspace(self): res = { "data": [ { "id": 5832, "name": "Atlanta Braves" }, { "id": 15923, "name": "New York Yankees" } ] } responses.add(GET,...
Asana/python-asana
tests/test_client_teams.py
test_client_teams.py
py
506
python
en
code
281
github-code
6
70777980988
import random import re import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from keras.preprocessing.text import Tokenizer import torch def transform_to_index_tensor(pairs,rus_w2i,en_w2i,device): rus_tensor = [] en_tensor = [] for word in range(len(pairs[0])): en_tensor.appe...
stefanos50/Seq2Seq-Machine-Translation
DataPreprocessing.py
DataPreprocessing.py
py
4,664
python
en
code
0
github-code
6
34042438403
from django.db.models import Q from django_filters.rest_framework import DjangoFilterBackend from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from gcloud.core.apis.drf.exceptions import ValidationException from gcloud.core.apis.d...
caiyj/bk-sops
gcloud/label/viewsets.py
viewsets.py
py
4,792
python
en
code
null
github-code
6
911733982
import pdfplumber import os,re file_path = "/home/FDDC_announcements_round2_train_pdf/" def pdf_tbl2txt(file): pdf = pdfplumber.open(file_path + "my.pdf") for i in pdf.pages: # page = pdf.pages[0] # i.extract_table() if i.find_tables(table_settings={}): i.crop(boundiipng_bo...
YankeeMarco/aliyun-FDDC-2018-Financial-Challenge-
pdf_to_text_with_table_tags.py
pdf_to_text_with_table_tags.py
py
322
python
en
code
14
github-code
6
31011028990
""" Name: Timothy James Duffy, Kevin Falconett File: metrics.py Class: CSc 483; Spring 2023 Project: TextSummarizer Provides methods to calculate the ROUGE metric and print the results. """ # Filter tensorflow warnings. import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from database import * from rouge import Rouge ...
tjdaz/TextSummarizer
metrics.py
metrics.py
py
2,310
python
en
code
0
github-code
6
21965971169
#### Author: Ernesto González 52857 #### Date: 12/10/2019 import pylab class DerivativeApproxManager(): def __init__(self, function, function_derivative, x_point, h_values): self.function = function self.function_derivative = function_derivative self.x = x_point self.h_values = h...
ernestofgonzalez/PhysicsBsc
TerceiroSemestre/MétodosNuméricos/Exercício01/derivative_approx.py
derivative_approx.py
py
2,551
python
pt
code
0
github-code
6
24528285056
import concurrent.futures import logging import time def thread_function(name): logging.info("Thread %s: starting", name) time.sleep(2) logging.info("Thread %s: finishing", name) class FakeDatabase: def __init__(self): self.value = 0 def update(self, name): logging.info("Thread ...
hiddenxx/Scripts
Learning/LearningThreads.py
LearningThreads.py
py
1,819
python
en
code
1
github-code
6
6575851777
from time import sleep from digitemp.master import UART_Adapter from digitemp.device import DS18B20 import random import asyncio import logging class TemperatureMonitor: def __init__(self): self.bus = UART_Adapter('/dev/ttyUSB0') self.sensor = DS18B20(self.bus) self.listeners = [] def...
SchrodingersCat00/vuurwachter
src/temp_monitor.py
temp_monitor.py
py
1,091
python
en
code
0
github-code
6
40128251295
""" http://www.sphinx-doc.org/en/stable/ext/doctest.html https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/doctest.py * TODO ** CLEANUP: use the sphinx directive parser from the sphinx project """ import doctest import enum import re import sys import textwrap import traceback from pathlib import Path from t...
thisch/pytest-sphinx
src/pytest_sphinx.py
pytest_sphinx.py
py
20,904
python
en
code
27
github-code
6
13301085850
import requests from prettytable import PrettyTable #write this into terminal if using linux or cmd if using windows #pip3 install Prettytable requests city = input('Enter City => ')#City name here api = "your api here"#api of https://openweathermap.org get urs from the website response = requests.get(f"http:...
xavian1996/weatherpy
main.py
main.py
py
1,968
python
en
code
0
github-code
6
36180496136
""" Zimri Leisher and Luca Araujo Codeforces database, API and web app """ import sys import traceback import psycopg2 import json import config import flask from collections import defaultdict api = flask.Blueprint('api', __name__) def get_connection(): return psycopg2.connect(database=config.database, ...
LucaDantas/cs257
webapp/api.py
api.py
py
13,186
python
en
code
0
github-code
6
13538825366
from screen_objects.boy import Boy from screen_objects.wall import Wall def test_boy_is_cooked_from_recipe(): boy = Boy((100, 100), (20, 0), 'tootling boy') assert boy.body.substance.radius == 7.5 assert boy.body.sprite.colour == (0, 0, 220) assert boy.body.movement.max_accelleration == 2 def test_b...
SimonCarryer/video_game_ai
tests/test_boy.py
test_boy.py
py
478
python
en
code
2
github-code
6
30578251026
import logging import itertools import math import sys import collections import datetime import shutil import click from .status import JobStatus, JOB_EVENT_STATUS_TRANSITIONS logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) SYMBOLS = [" ", "I", "R", "X", "C", "H", "S"] STATUS_TO_SYMBOL = dict(...
JoshKarpel/condor_necropsy
condor_necropsy/state_graph.py
state_graph.py
py
5,724
python
en
code
0
github-code
6
44426795976
from time import sleep from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.mininode import * from test_framework.script import CScript, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG class P2PInvMsgTimeOrder(BitcoinTestFramework): def set_test_par...
bitcoin-sv/bitcoin-sv
test/functional/bsv-p2p_inv_msg_time_order.py
bsv-p2p_inv_msg_time_order.py
py
3,698
python
en
code
597
github-code
6
16292938825
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 11 14:27:38 2021 @author: maximelucas """ import numpy as np import matplotlib.pyplot as plt rho_max=250 v_max=130 long=1000 A=150 B=40000 ga=[0 for i in range(B)] gb=[0 for i in range(B)] rho0=[200 for i in range(A//5)]+[0 for i in range(4*A//5)]...
Maksime0/Mod-lisation-et-mesures-pour-le-trafic-routier
Documents annexes/Godonov/godonov_anime.py
godonov_anime.py
py
1,309
python
en
code
0
github-code
6
29716875304
from basePlayer import BasePlayer import itertools from math import inf from random import choice import numpy as np from generals import State import pickle from minimaxPlayer import MinMaxPlayer from generals import PlayerEnum from game import Board from game import Controller from generals import g f...
Gbor97/TicTacToe
SVMPlayer.py
SVMPlayer.py
py
5,736
python
en
code
0
github-code
6
74637015868
import pandas as pd from src.distribution import compute_distribution_1_week def test_compute_distribution_1_week(): """Test compute 1 week distribution In this test case: - We have 1 brand that is sold by 1 bar -> distribution is 100% every week when this bar sells - We have 1 brand sold by 2 b...
afouchet/training_practical_testing
tests/test_distribution.py
test_distribution.py
py
1,293
python
en
code
0
github-code
6
21368239786
import numpy as np import hardware.sr_lockin as lockin lo = lockin.SR830("GPIB0::08::INSTR") idn = lo.identification() print(idn) freq = lo.get_frequency() print(freq) lo.set_reference_mode(1) getrefmode = lo.get_reference_mode() print(getrefmode) lo.set_frequency(10000) freq2 = lo.get_frequency() print...
physikier/magnetometer
lockin_test.py
lockin_test.py
py
1,054
python
en
code
0
github-code
6
8927199604
import contextlib import os import shutil import tempfile import mandrel import unittest class TestCase(unittest.TestCase): def assertIs(self, a, b): # python 2.6/2.7 compatibility self.assertTrue(a is b) @contextlib.contextmanager def tempdir(dir=None): """Context manager that yields a tempor...
ethanrowe/python-mandrel
mandrel/test/utils.py
utils.py
py
1,612
python
en
code
4
github-code
6
18023127994
import os import sqlite3 import shutil import sys import psutil def is_browser_running(browser_name): for process in psutil.process_iter(): try: if browser_name in process.name().lower(): return True except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess...
KIMJOONSIG/Reboot3
Linux/p3_BrowserHistory.py
p3_BrowserHistory.py
py
2,892
python
ko
code
0
github-code
6
73200075389
def calcPrimes(n): """ Calculate Prime Factors of an Integer """ if type(n) is not int: raise ArgumentException("Requires argument of type int") factors = [] d = 2 while d * d <= n: while (n % d) == 0: factors.append(d) n /= d; d += 1 if n > 1: ...
jgroff/projecteuler
src/problem003.py
problem003.py
py
547
python
en
code
0
github-code
6
73676828986
import serial,os,sys ser = serial.Serial('/dev/ttyAMA1', 115200) drawPath = "/home/ubuntu/my_ws/src/test_odom_rap/drawLcd/drawLcd.py" byte_list = [0x55, 0x0E, 0x01, 0x02, int(0 / 256), int(0 % 256), 0,0, 0,0, 0, 0, 1] k = 0 for i in range(l...
caiyilian/INTELLIGENT-FOOD-DELIVERY-ROBOT
树莓派代码/drawLcd/auto_startup.py.py
auto_startup.py.py
py
1,524
python
en
code
2
github-code
6
1798363402
import tkinter as tk import windows.Window as Window import time import random import math class GameWindow(Window.Window): def __init__(self, master, controller): super().__init__(master=master) self.master = master self.controller = controller # Extra variables self._job...
Akoens/PyGOL
windows/GameWindow.py
GameWindow.py
py
7,051
python
en
code
0
github-code
6
22115422189
from ibapi.client import * from ibapi.wrapper import * import threading import time # Change as necessary port = 7496 class TestApp(EClient, EWrapper): def __init__(self): EClient.__init__(self, self) # Only the necessary news-related callbacks are implemented below # Headlines delivered to thi...
hardhittad22/Python-testers
News/News.py
News.py
py
2,518
python
en
code
null
github-code
6
10062234348
import dataclasses import logging import typing import httpx from sequoia.exceptions import DiscoveryResourcesError, DiscoveryServicesError, ResourceNotFound, ServiceNotFound logger = logging.getLogger(__name__) __all__ = ["Resource", "ResourcesRegistry", "Service", "ServicesRegistry"] @dataclasses.dataclass clas...
pikselpalette/sequoia-python-client-sdk-async
sequoia/types.py
types.py
py
3,925
python
en
code
1
github-code
6
7804713762
from app import get_app_db import chalicelib.db as dynamoDB import csv db = get_app_db() with open('Deckle.csv') as f: taskReader = csv.reader(f, delimiter=',') for task in taskReader: name = task[0] duration = int(task[1]) deadlineDateTime = task[2] db.add_item(description=name, duration=duration, dead...
lexonli/Deckle-API
taskParser.py
taskParser.py
py
346
python
en
code
0
github-code
6
37513630544
from model.group import Group import random def test_delete_some_group(app, db): # if app.group.count() == 0: if len(db.get_group_list()) == 0: app.group.create(Group(name="test")) old_groups = db.get_group_list() group = random.choice(old_groups) # index = randrange(len(old_groups)) app...
Iren337/pyton_training
test/test_del_group.py
test_del_group.py
py
877
python
en
code
0
github-code
6
5821317586
# «Дано натуральное число. Определить: максимальную нечетную цифру числа; n = int(input('Введите натуральное число: ')) max = n % 10 posl = 0 n = n // 100 while n > 0: posl = n % 10 if posl > max: max = posl n = n // 100 print('Максимальная нечетная цифра числа = ', max)
GarryG6/PyProject
11.py
11.py
py
407
python
ru
code
0
github-code
6
13171858253
word1=input() for i in range(0,len(word1)): if word1[i]=='h': index1=i break for i in range(len(word1)-1,index1, -1): if word1[i]=='h': index2=i break word2=word1[index2:index1:-1] print(word1[:index1]+word2+word1[index2:])
dagasheva01/py
lab28.py
lab28.py
py
243
python
en
code
0
github-code
6
37698137583
coms = open('input.txt', 'r').readlines() coms = [i.replace('\n', '') for i in coms] coms = [i.split(' ') for i in coms] commands = [] for _, x in coms: if x[0] == '+': x = int(x.replace('+', '')) elif x[0] == '-': x = -int(x.replace('-', '')) commands.append([_, x]) #pri...
DLNinja/Advent-Of-Code-2020
day8.py
day8.py
py
1,234
python
en
code
0
github-code
6
3928902472
#Grids 1-4 are 2x2 grid1 = [ [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] grid2 = [ [1, 0, 4, 2], [4, 2, 1, 3], [0, 1, 0, 4], [3, 4, 2, 1]] grid3 = [ [1, 2, 3, 4], [2, 1, 4, 3], [3, 4, 2, 1], [4, 3, 1, 2]] grid4 = [ [1, 3, 4, 2], [4, 2, 1, 3], [2, 1, 3, ...
Louie-B/Course_work_1
CW1.py
CW1.py
py
5,614
python
en
code
0
github-code
6
11322722554
from keras.models import * from keras.layers import * from model.model_basic import BasicDeepModel from keras.utils.vis_utils import plot_model from keras import regularizers dp = 7 filter_nr = 64 filter_size = 3 max_pool_size = 3 max_pool_strides = 2 dense_nr = 256 spatial_dropout = 0.2 dense_dropout = 0.5 conv_kern...
nlpjoe/daguan-classify-2018
src/model/dpcnn_model.py
dpcnn_model.py
py
5,042
python
en
code
154
github-code
6
14637407916
#!/bin/python3 import math import os import random import re import sys # # Complete the 'minimumBribes' function below. # # The function accepts INTEGER_ARRAY q as parameter. # def minimumBribes(q): i = 1 tshift = 0 for p in q : shift = p - i if (shift > 2) : print("Too chaot...
94aharris/BrainExt
Python/HakerRanker/NewYears.py
NewYears.py
py
663
python
en
code
3
github-code
6
41183939223
# 1) Eingabe Suchbeggriff (deutsch) # 2) Bestimmung der gesamtanzahl der Elemente ( = maximaler Index ) # 3) Schleife: Vergleich Eingabe mit jew. Listenelement # 4) Wenn Element gefunden -> Index speichern # 5) Zugriff auf Listenelement[Index] in Liste (englisches Wörterbuch) ''' woerterbuch_deutsch = ["Apfel", "...
karina1702/Karinasrepository
Wörterbuch_Algorithmus.py
Wörterbuch_Algorithmus.py
py
3,175
python
de
code
0
github-code
6
32059806236
#!/usr/bin/env python3 """ led.py Notes ----- - Docstrings follow the numpydoc style: https://numpydoc.readthedocs.io/en/latest/format.html - Code follows the PEP 8 style guide: https://www.python.org/dev/peps/pep-0008/ """ import RPi.GPIO as GPIO from time import sleep import logging import constants as c LED_OU...
Hasan-Baig/SYSC3010_Home_Pixel
lightclapper/led.py
led.py
py
2,584
python
en
code
0
github-code
6
40428589911
""" Name: virtual_ip_address.py Description: create, update, and delete operations on netbox ip_addresss for virtual machines """ from inspect import stack import sys from netbox_tools.common import get_vm, vm_id, tag_id from netbox_tools.virtual_machine import make_vm_primary_ip, map_vm_primary_ip OUR_VERSION = 105 ...
allenrobel/netbox-tools
lib/netbox_tools/virtual_ip_address.py
virtual_ip_address.py
py
11,371
python
en
code
6
github-code
6
31356519066
import pygame import sys # 게임 창 크기 설정 screen_width = 800 screen_height = 600 # 버튼 클래스 정의 class Button: def __init__(self, x, y, width, height, idle_image, hover_image): self.rect = pygame.Rect(x, y, width, height) self.idle_image = idle_image self.hover_image = hover_image self.ima...
frogress/prac_pygame
opentutorials/chatgpt.py
chatgpt.py
py
2,576
python
en
code
0
github-code
6
10808451041
from typing import Dict, Tuple from AnalysisOfUnstructuredData.helpers.hsc.publisher import Publisher class PublisherRelation: titles_types: Dict[str, str] _id: Tuple[int, int] def __init__(self, publisher_1: Publisher, publisher_2: Publisher): self.publisher_1 = publisher_1 self.publis...
TheDecks/Studies
AnalysisOfUnstructuredData/helpers/hsc/relation.py
relation.py
py
1,688
python
en
code
0
github-code
6
38479953864
# -*- coding:utf-8 -*- class Ball: '''Ball Definition by ball movement info''' def __init__(self,ball): self.x = ball[2] self.y = ball[3] self.z = ball[4]/5 self.radius = ball[4] self.color = '#ff8c00'
RobinROAR/ViewNBATrackingData
Ball.py
Ball.py
py
251
python
en
code
2
github-code
6
40319717427
from ansible.module_utils.basic import AnsibleModule from ansible_collections.ansibleguy.opnsense.plugins.module_utils.base.handler import \ module_dependency_error, MODULE_EXCEPTIONS try: from ansible_collections.ansibleguy.opnsense.plugins.module_utils.base.api import single_post from ansible_collection...
ansibleguy/collection_opnsense
plugins/modules/system.py
system.py
py
2,071
python
en
code
158
github-code
6
74637089147
# TODO: (only sent audio, still need sync) receive audio packets and sync with video # DONE: try to connect to host AFTER clicking on 'start' button # TODO: fix crash when video is ended or trying to reconnect import base64 import os import socket import sys import numpy as np from PyQt5 import QtGui, QtCore, QtWidget...
shully899509/OpenParty
pyqt player client.py
pyqt player client.py
py
10,093
python
en
code
0
github-code
6
74028440509
from setup import * from lesson import full_data ''' ex 7.1 Taking the elements data frame, which PySpark code is equivalent to the following SQL statement? select count(*) from elements where Radioactive is not null; a element.groupby("Radioactive").count().show() b elements.where(F.col("Radioactive").isNotNull())...
eldoria/learning-pyspark
chapter_7/functions_exercices.py
functions_exercices.py
py
5,500
python
en
code
0
github-code
6
16407449430
import mysql.connector import csv import matplotlib.pyplot as plt import matplotlib from matplotlib import colors as mcolors import datetime import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) # Sort colors by hue, saturation, value and n...
natashaarmbrust/github-sentiment
pr_sentiments.py
pr_sentiments.py
py
3,745
python
en
code
0
github-code
6
22780895982
from project.band import Band from project.band_members.drummer import Drummer from project.band_members.guitarist import Guitarist from project.band_members.singer import Singer from project.concert import Concert class ConcertTrackerApp: def __init__(self): self.bands = [] self.musicians = [] ...
DanieII/SoftUni-Advanced-2023-01
oop/exam_practice/19_December_2022/project/concert_tracker_app.py
concert_tracker_app.py
py
5,504
python
en
code
0
github-code
6
31963141041
from sys import stdin input = stdin.readline n = int(input()) dp = {1: 0} def rec(n: int): if n in dp.keys(): return dp[n] if n % 3 == 0 and n % 2 == 0: dp[n] = min(rec(n//3)+1, rec(n//2)+1) elif n % 3 == 0: dp[n] = min(rec(n//3)+1, rec(n-1)+1) elif n % 2 == 0: ...
yongwoo-jeong/Algorithm
백준/Silver/1463. 1로 만들기/1로 만들기.py
1로 만들기.py
py
440
python
en
code
0
github-code
6
30980414030
from matplotlib.pyplot import draw import pygame from pygame.locals import * pygame.init() pygame.mixer.init() # set screen resolution resolution = (725,725) # open a screen of above resolution screen = pygame.display.set_mode(resolution) # storing screen variable values width = screen.get_width() height = screen....
jessica-leishman/high-rollers
analysis_static/manual slices/hrStatic4.py
hrStatic4.py
py
2,135
python
en
code
0
github-code
6
27959320759
import os from os import getenv from dotenv import load_dotenv load_dotenv() # FOR CODES API_ID = int(getenv("API_ID","2302493")) API_HASH = getenv("API_HASH","1bf8344851a88633343fde339f2eee20") SUDO_USERS = list(map(int, getenv("SUDO_USERS", "5366284852").split())) LOGGER = int(getenv("LOGGER","-1001804302628"))...
Anirudh1212121/DcSpamBot
config.py
config.py
py
899
python
en
code
null
github-code
6
32010842805
class Spell: def __init__(self, name="Fireball", damage=30, mana_cost=50, cast_range=2): self.name = name self.damage = damage self.mana_cost = mana_cost self.cast_range = cast_range @property def get_spell(self): sepell_prop = {} sepell_prop['name'] = self.n...
1oss1ess/HackBulgaria-Programming101-Python-2018
week-7/engin/spell.py
spell.py
py
654
python
en
code
0
github-code
6
23205117046
alist = [] for i in range(1,101): alist.append(i) hangshu = 3 # lieshu = int(len(alist)/hangshu) # lastlieshu = lieshu + len(alist) % hangshu # print(lieshu, lastlieshu) for i in range(0, len(alist)): if (i+1)%lieshu == 0 and (i+1)/lieshu != hangshu: print(alist[i]) else: print(alist[i]...
jaredchin/Core-Python-Programming
第六章/练习/6-19.py
6-19.py
py
328
python
en
code
0
github-code
6
1544268645
import itertools def test(kenken_grid): n = kenken_grid[0][0] dom = [] for i in range(n): dom.append(i + 1) vars = [] for i in dom: for j in dom: vars.append('V{}{}'.format(i, j)) cons = [] for i in range(n): vars_row = vars[(i * n): ((i + 1) * n)] ...
monkeykingg/projects
3rd_year/csc384/A2/sol/test.py
test.py
py
691
python
en
code
2
github-code
6
27322987878
from __future__ import print_function, division, absolute_import, unicode_literals import logging import os from inspect import isclass from tempfile import NamedTemporaryFile from collections import OrderedDict from fontTools.misc.py23 import tobytes, tounicode, UnicodeIO from fontTools.feaLib.parser import Parser fr...
Torneo-Tipografico-Comunidad/Torneo-2020
Calmadita /05_SOURCES/sources/venv/lib/python3.7/site-packages/ufo2ft/featureCompiler.py
featureCompiler.py
py
10,497
python
en
code
7
github-code
6
31350011958
import unittest from seleniumwire import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By #This code uses the google chrome browser to conduct a single test on the python.org website #It uses the website search bar to search for "pycon" # Selenium installa...
Kitchlew/Summer
SQA/sel.py
sel.py
py
1,254
python
en
code
0
github-code
6
3311087483
from math import * from Robot import * from Path import * class Follower: def __init__(self, file): print('Sending commands to MRDS server', MRDS_URL) self.robot = Robot() self.path = Path(file) self.path = self.path.getPath() self.startTime = None s...
aliciastrommer/done
Follower.py
Follower.py
py
1,575
python
en
code
0
github-code
6
39297894031
#用菜单实现矩阵的加和乘 #python3.4 #作者:代* #_____________求和函数_________________ def Sum(a,b): #定义一个二维数组 #c=[[0 for i in range(L1)]for i in range(H1)] c=[[0]*L1]*H1 if H1==H2 and L1==L2: for i in range(0,H1): for j in range(0,L1): c[i][j]=int(a[i][j])+int(b[i][j]) print ('两个矩阵和为;',c) ...
FreedomSkyMelody/some-small-program
matrix_operations.py
matrix_operations.py
py
2,082
python
zh
code
0
github-code
6
36615991000
import asyncio import logging import random import sys from time import sleep def run_async(): async def mytask(tid: str): n = random.randint(1, 3) for i in range(n): logging.info(f"task {tid} {i} of {n}") await asyncio.sleep(1) logging.info(f"finished {tid} {n}") ...
wwagner4/pymultiworker
tryout.py
tryout.py
py
1,397
python
en
code
0
github-code
6
41675652390
# N번째 큰 수 import sys import heapq # sys.setrecursionlimit(10000000) input = sys.stdin.readline N = int(input()) # lst = [list(map(int, input().split())) for _ in range(N)] res = [] for _ in range(N): for num in map(int, input().split()): if len(res) < N: heapq.heappush(res, num) el...
jisupark123/Python-Coding-Test
알쓰/week1/2075.py
2075.py
py
973
python
en
code
1
github-code
6
18857851018
import numpy as np from Beta_estimate import Beta_est from C_estimation import C_est from I_spline import I_S from g_linear import g_L def Est_linear(train_data,X_test,Beta0,nodevec,m,c0): Z_train = train_data['Z'] U_train = train_data['U'] De_train = train_data['De'] Beta0 = np.array([Beta0]...
qiangwu2023/dnn_current_status
Model_Linear/iteration_linear.py
iteration_linear.py
py
1,323
python
en
code
1
github-code
6
20546789103
import discord from discord.ext import commands from discord.ext.commands import Command from chime.main import prefix from chime.misc.CustomCommand import CustomCommand from chime.misc.StyledEmbed import StyledEmbed class EmbedHelpCommand(commands.HelpCommand): """This is an example of a HelpCommand that utiliz...
realmayus/chime
chime/cogs/HelpCommandCog.py
HelpCommandCog.py
py
4,233
python
en
code
1
github-code
6
9887556442
import cv2, sys, time def start_split(filename): start = time.time() video = cv2.VideoCapture(filename) if not video: print("无法读取视频文件") sys.exit(1) count = 0 while video.isOpened(): print("\r正在处理第{0}帧图像".format(count), end="") ret, frame = video.read()...
Temperature6/BadAppleVideoProcess
VideoSplit.py
VideoSplit.py
py
825
python
en
code
1
github-code
6
31997355144
# 1. Реализовать функцию, принимающую два числа (позиционные аргументы) # и выполняющую их деление. Числа запрашивать у пользователя, # предусмотреть обработку ситуации деления на ноль. caption = f'Основы языка Python. Урок 3. Домашнее задание 1.\n' print(caption) def dividing(num_1, num_2): """Выполняет деление ...
SokIL69/python
Lesson3/hw3_1.py
hw3_1.py
py
1,329
python
ru
code
0
github-code
6
17693067570
import numpy as np def data_to_matrix(path): return ( np.loadtxt(open(path, "rb"), delimiter=",", usecols=[0,1,2,3]), np.loadtxt(open(path, "rb"), delimiter=",", usecols=4), ) def seidel_method(A, B, eps): """ Метод Зейделя """ print(seidel_method.__doc__) D = np.diag(A) a = [-...
geekylthyosaur/lpnu
NM/seidel_method.py
seidel_method.py
py
1,284
python
uk
code
2
github-code
6
3670374638
import math from collections import defaultdict from typing import Union, Callable, Tuple, List import gevent from gevent.queue import Queue from requests import PreparedRequest, Response from lib.utils.logger import Logger from lib.utils.request_helper import RequestHelper, RequestInfo class BaseFinder(RequestHelp...
medalahonor/suseeker
lib/finders/base_finder.py
base_finder.py
py
13,362
python
ru
code
3
github-code
6
26260800957
import pygame class Item: def __init__(self, image, x, y, id, player): self.image = pygame.image.load(image) self.x, self.y = x, y self.player = player self.id = id def draw(self, screen): screen.blit(self.image, (self.x, self.y)) def onPlayerCollision(self): pygame.mixer.music.load("other\...
SeaPickle754/zeldaish
item.py
item.py
py
588
python
en
code
0
github-code
6
19202891943
#!/usr/bin/python3 """ A module that include the parent class Basemodel """ import models from datetime import datetime from uuid import uuid4 class BaseModel: """ class BaseModel that defines all common attributes/methods for other classes. """ def __init__(self, *args, **kwargs): """ ...
sanotogii/AirBnB_clone
models/base_model.py
base_model.py
py
2,261
python
en
code
0
github-code
6