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
39944748888
import email import email.policy import email.utils import email.message import email.mime.multipart import email.mime.text import email.parser import os import time import traceback import boto3 from botocore.exceptions import ClientError # us-east-1 REGION = os.getenv("REGION") # your-bucket-name S3_BUCKET = os.g...
kura/private-relay
lambda.py
lambda.py
py
7,749
python
en
code
0
github-code
1
13043659438
import logging from ...node import InputTrigger from ...stream import DataStream from ...exceptions import SensorGraphSemanticError from .scope import Scope class GatedClockScope(Scope): """A scope that will gate all requested clocks with a latch. Args: sensor_graph (SensorGraph): The sensor graph we...
iotile/coretools
iotilesensorgraph/iotile/sg/parser/scopes/gated_clock_scope.py
gated_clock_scope.py
py
3,501
python
en
code
14
github-code
1
70449564515
import logging from .. import interface from builtins import NotImplementedError from radios.MotorolaCommon.Tests.RXFrontEndGain import protoRxFrontEndGain import time class testRxFrontEndGain(protoRxFrontEndGain): def isRadioEligible(self): if (self._radio.bandsplit == "Q" or self._radio.bands...
jelimoore/OpenAutoBench
radios/MotorolaXPR/Tests/RXFrontEndGain.py
RXFrontEndGain.py
py
1,180
python
en
code
3
github-code
1
9213677792
def get_bounds( start_loc , end_loc , sample_len , max_bounds , min_bounds=0 , from_test=False , start_buffer=1000 , end_buffer=0 , start_index=None , end_index=None , target_gap=False ): train_len, test_len, post_len, target_len, sample_len = split_sample_len(sample_len)...
mazmazz/SkepticSystem
python/skepticsys/datasets/bounds.py
bounds.py
py
5,243
python
en
code
1
github-code
1
17110154056
import requests import records import json db = records.Database("mysql:///....?charset=utf8") # db.query(""" # create table video_group ( # id int primary key auto_increment, # group_id varchar(50), # title varchar(100), # data text, # comment_count int default 0, # like_count int default 0, #...
zhangheli/ScrapyLabs
crawl_toutiao.py
crawl_toutiao.py
py
1,859
python
en
code
25
github-code
1
74295579552
__author__ = 'Anni' import random from buildingControl.smartbes import SmartBes from building.pvsystem import PVSystem import numpy as np class DataBase(object): """ holds information and methods for creating random BES's """ @staticmethod def createRandomBESs(number, sharesOfB...
cmolitor/pycity
city/database.py
database.py
py
12,340
python
en
code
1
github-code
1
39207013702
#!/bin/python3 """ Advent of Code 2021 Day 7 Part 2 https://adventofcode.com/2021/day/7 """ __author__ = "Adam Karl" INPUT_FILE = 'crabPositions.txt' def alignCrabs(): """Determine the position that requires the least amount of fuel for all crabs to reach. Return that position and the total fuel required"""...
adamkkarl/advent-of-code-2021
07/part2.py
part2.py
py
1,083
python
en
code
0
github-code
1
411798820
import logging from typing import Optional from ..effect import EffectFactory from .effect_checker import EffectChecker, AnnotationEffect, AnnotationRequest class UTREffectChecker(EffectChecker): """UTR effect checker class.""" def __init__(self) -> None: self.logger = logging.getLogger(__name__) ...
iossifovlab/gpf
dae/dae/effect_annotation/effect_checkers/utr.py
utr.py
py
3,917
python
en
code
1
github-code
1
30276485484
from pyroll.cli.program import main from pyroll.cli.config import RES_DIR import click.testing import os def test_create_project(tmp_path): runner = click.testing.CliRunner() os.chdir(tmp_path) result = runner.invoke(main, ["create-project"]) assert result.exit_code == 0 print(result.output) ...
pyroll-project/pyroll-cli
tests/test_create_project.py
test_create_project.py
py
495
python
en
code
1
github-code
1
43495745433
from datetime import datetime from pytest import fixture from .model import User from .schema import UserSchema from .interface import UserInterface @fixture def schema() -> UserSchema: return UserSchema() def test_UserSchema_create(schema: UserSchema): assert schema def test_UserSchema_works(schema: Us...
lucasg-mm/arborator-grew-nilc
backend/app/user/schema_test.py
schema_test.py
py
1,027
python
en
code
3
github-code
1
26641924170
from openpyxl import load_workbook workbook = load_workbook(filename=r'F:\kinscloud.github.io\Python\Excel\testxls.xlsx') #print(workbook.sheetnames) sheet = workbook.active for row in sheet.rows: #for row in sheet.iter_rows(min_row=2,max_row=3,min_col=1,max_col=3): for cell in row: print(cell.valu...
kinscloud/kinscloud.github.io
Python/Excel/openpyxlDemo.py
openpyxlDemo.py
py
458
python
en
code
0
github-code
1
32166503776
#!/usr/bin/env python3 import asyncio import sys from getpass import getpass from pathlib import Path from typing import Dict import httpx import hug IGNORED_AUTHOR_LOGINS = {"deepsource-autofix[bot]"} REPO = "pycqa/isort" GITHUB_API_CONTRIBUTORS = f"https://api.github.com/repos/{REPO}/contributors" GITHUB_USER_CONT...
PyCQA/isort
scripts/check_acknowledgments.py
check_acknowledgments.py
py
2,528
python
en
code
6,145
github-code
1
31497220843
#regular expressions # import re # match and search # match()-find a perticular fn at the begining of a string # search()-it can find entire line or word in the string import re l="python programing is fun" m=re.search("python",l) if m: print("match found") else: print("no match") # search # sub-search and rep...
niyas547/core-python
fundamentals/2-JULY/008-07-22/02-regular_exprssns.py
02-regular_exprssns.py
py
568
python
en
code
0
github-code
1
17869707915
#!/usr/bin/python3 """Alta3 Research | By RZFeeser Making choices with "if" logic""" # starship registry list sshipreg = ["ncc-1701"] # create our "trigger" ans = "y" while ans == "y": # prompt user for the "new starship" to be added to sshipreg newsship = input("What is the starship you would like to r...
rzfeeser/mycode-2021-07-19
example09-if-and-loop.py
example09-if-and-loop.py
py
988
python
en
code
0
github-code
1
73550670432
import sys sys.path.append("/home/trung/_qhe-library") from subprocess import call, Popen, PIPE import numpy as np import FQH_states as FQH import misc import time from itertools import product, combinations_with_replacement import string import random def read_jack(root, debug=False): # To adapt to the changes in c...
hq-tr/one_body_potential
disk_potential_pins/jack_get.py
jack_get.py
py
3,558
python
en
code
0
github-code
1
43336500122
import sys import os from PyQt5 import QtWidgets, uic, QtCore import pyqtgraph as pg import numpy as np from ..communication import SCPI_mannager, upload import json class graph_view(pg.GraphicsLayoutWidget): def __init__(self, top_window): super().__init__(show=True) self.top_window :...
ruofan-he/redpitaya_PNR
frontend/top/top.py
top.py
py
19,736
python
en
code
1
github-code
1
23490191054
import sys from loguru import logger as log from bs4 import BeautifulSoup from pyquery import PyQuery as pq from selenium.common.exceptions import ElementClickInterceptedException from my_selenium import MySelenium from locate104 import LocateOneZeroFour # remove default level log.remove() # level DEBUG|INFO log.add...
brian-hsu/crawl104
crawl104.py
crawl104.py
py
10,812
python
en
code
0
github-code
1
15471163955
import torch def css(outputs, labels, n_classes, m, m2): batch_size = outputs.size(0) defer = [n_classes] * batch_size outputs = -m2 * torch.log2(outputs[range(batch_size),labels])\ -m * torch.log2(outputs[range(batch_size), defer]) return torch.sum(outputs) / batch_size def my_CrossEntr...
Xiaozhi-sudo/learning-to-defer
CIFAR/losses.py
losses.py
py
1,128
python
en
code
0
github-code
1
18335037385
import sys # add module search path sys.path.append('/flash/res') sys.path.reverse() #revert search direction to load custom libs first from producer import Producer from subscriber import subscribe try: import utime as time except ModuleNotFoundError: import time def is_int_or_float(*args, **kwargs): f...
hjgode/m5home
res/eventbus_thread_test.py
eventbus_thread_test.py
py
1,036
python
en
code
6
github-code
1
71223290915
# O(n+p) # n = numCourses | p = len(prerequisites) class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: prerequisitesDict = self.buildPrerequisitesDict(prerequisites, numCourses) visited = set() order = [] for course in prerequisitesDic...
ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck
problems/LC210.py
LC210.py
py
1,246
python
en
code
0
github-code
1
1936442404
import re from django import template from django.template.defaultfilters import stringfilter from django.utils.html import escape from django.conf import settings from django_fortunes.models import Fortune register = template.Library() @register.filter @stringfilter def fortunize(value): """ Transforms a f...
n1k0/djortunes
django_fortunes/templatetags/fortune_extras.py
fortune_extras.py
py
1,168
python
en
code
7
github-code
1
33762031374
from tests.my_test_case import MyTestCase from configuration import PrefixDict class TestUtils(MyTestCase): def setUp(self): pass def test_prefix_dict(self): words = ['ban', 'banka', 'bankestr', 'banket', 'bankik', 'banks', 'blan', 'blanka', 'blankestr', 'blanket', 'blankik',...
taucompling/morphophonology_spe
source/tests/test_utils.py
test_utils.py
py
2,491
python
es
code
5
github-code
1
16173183915
#Лістинг 2 a = [1, 2, 3] b = 5 def func(x, y): x.append(4) y = y + 1 func(a, b) print("a=", a) # Вихід a=[1, 2, 3, 4] print("b=", b) # Вихід b=5 # лістинг 5 def f(x): def g(y): return y return g a = 5 b = 1 h=f(a) h(b) # Вихід 1
paseidon72/Hillel_Andrey
testoviy/variable.py
variable.py
py
286
python
uk
code
0
github-code
1
26855426781
# This program is in the public domain # Author: Paul Kienzle """ SNS data loaders The following instruments are defined:: Liquids, Magnetic These are :class:`resolution.Pulsed` classes tuned with default instrument parameters and loaders for reduced SNS data. See :mod:`resolution` for details. """ import re im...
reflectometry/refl1d
refl1d/snsdata.py
snsdata.py
py
9,380
python
en
code
16
github-code
1
26191830771
"""Stock Prediction""" """Requirements""" import pandas as pd import yfinance as yf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.callbacks import Callback import numpy as np import matplotlib...
mmdrez4/stock_price_prediction
codes/stock_prediction_quantization.py
stock_prediction_quantization.py
py
2,158
python
en
code
0
github-code
1
10119600024
''' Input: a List of integers Returns: a List of integers ''' def moving_zeroes(arr): zeros = list(filter(lambda ii: ii == 0, arr)) no_zeros = list(filter(lambda ii: ii != 0, arr)) + zeros return no_zeros if __name__ == '__main__': # Use the main function here to test out your implementation arr =...
Edudeiko/Algorithms
cs-module-project-algorithms-master/moving_zeroes/moving_zeroes.py
moving_zeroes.py
py
409
python
en
code
0
github-code
1
73707557475
#################################################################################################### # Copyright 2013 John Crawford # # This file is part of PatchCorral. # # PatchCorral is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by ...
defcello/PatchCorral
src/gui/ui_voicelists.py
ui_voicelists.py
py
6,632
python
en
code
1
github-code
1
18931784296
from django.urls import path from .views import * urlpatterns = [ path('api/', PostList.as_view()), path('api/<int:pk>/', PostDetail.as_view()), path("", sorry, name="sorry"), # path('location/', LocationList.as_view()), # path('location/<int:pk>/', LocationDetail.as_view()), ]
mehtanishad/Rest_Api_Assessment
rest_api/restApi_App/urls.py
urls.py
py
304
python
en
code
0
github-code
1
22019597734
from typing import List class Solution: def numRescueBoats(self, people: List[int], limit: int) -> int: people.sort() heavy_person = len(people) - 1 light_person = 0 boats = 0 while heavy_person >= light_person: if heavy_person == light_person: ...
zahedul/leetcode
boats_to_save_people.py
boats_to_save_people.py
py
643
python
en
code
0
github-code
1
33047134457
import json with open("brassiceae3.txt", "r", encoding="utf-8") as f: lines = f.readlines() data_1 = open("brassiceae3奇数行.txt", 'w', encoding='utf-8') data_2 = open("brassiceae3偶数行.txt", 'w', encoding='utf-8') num = 0 # 行数-1 for line in lines: if (num % 2) == 0: # num为偶数说明是奇数行 print(line.s...
Lost-real/liji_python-learning
拼接1.py
拼接1.py
py
539
python
en
code
0
github-code
1
39479793327
import json import matplotlib.pyplot as plt print("Loading cross validation history...") with open("imdb_histories", "r") as f: histories = json.load(f) # Visualizing the data control = histories[0] ctrl_val = control["val_loss"] epochs = range(1, len(ctrl_val) + 1) print("Plotting comparisions...") for idx,...
byelipk/deep-imdb
imdb_model_compare_eval.py
imdb_model_compare_eval.py
py
642
python
en
code
0
github-code
1
29544867356
import pytest from eth2.beacon.db.chain import BeaconChainDB from eth2.beacon.state_machines.forks.serenity.blocks import ( SerenityBeaconBlock, ) from eth2.beacon.tools.builder.initializer import ( create_mock_genesis, ) from eth2.beacon.tools.builder.proposer import ( create_mock_block, ) from eth2.beaco...
hwwhww/trinity
tests/eth2/beacon/state_machines/test_demo.py
test_demo.py
py
3,132
python
en
code
null
github-code
1
37329810654
def isContained(firstPair, secondPair): if firstPair[0] <= secondPair[0] <= firstPair[1] and firstPair[0] <= secondPair[1] <= firstPair[1]: return True if secondPair[0] <= firstPair[0] <= secondPair[1] and secondPair[0] <= firstPair[1] <= secondPair[1]: return True return False def isOverl...
SKosier/AdventOfCode2022
day4/day4.py
day4.py
py
1,220
python
en
code
0
github-code
1
30046035779
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed unde...
openstack/senlin
senlin/tests/unit/db/test_registry_api.py
test_registry_api.py
py
7,359
python
en
code
44
github-code
1
13282499257
from __future__ import division import numpy as np import ROOT as r import math import os,sys from scipy.integrate import quad, dblquad from darkphoton import * # proton mass mProton = 0.938272081 # GeV/c - PDG2016 protonEnergy = 400. # GeV/c protonMomentum = math.sqrt(protonEnergy*protonEnergy - mProton*mProton) #V...
ShipSoft/FairShip
python/proton_bremsstrahlung.py
proton_bremsstrahlung.py
py
7,527
python
en
code
21
github-code
1
21224899005
import pika import psutil import time # Conecta ao RabbitMQ connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) # Conecta ao servidor RabbitMQ local channel = connection.channel() # Cria um canal de comunicação # Declara o tópico de temperatura channel.queue_declare(queue='temperat...
mandaver/Atividades_Sistemas_Dist
Atividade_2/produtor.py
produtor.py
py
915
python
pt
code
0
github-code
1
17571257794
# Import Files import requests import json with open("details.txt") as f: lines = f.readlines() api_token = lines[0].rstrip() account_id = lines[1].rstrip() def get_account_info(steam_ids): """ Returns the results of a steam api get request containing a summary of one or more steam users. :pa...
Exist3/SteamLibraryCompare
steam_api_scrape.py
steam_api_scrape.py
py
3,993
python
en
code
0
github-code
1
39004618196
#!/usr/bin/python3 """ Square Class.""" class Square: """define a Square.""" def __str__(self): """print square""" return self.pos_print()[:-1] def __init__(self, size=0, position=(0, 0)): """ initialize the square """ self.size = size self.position = position @pr...
mwaskagi/alx-higher_level_programming
0x06-python-classes/101-square.py
101-square.py
py
1,891
python
en
code
1
github-code
1
5729046508
""" /* * Reto #9 * CÓDIGO MORSE * Fecha publicación enunciado: 02/03/22 * Fecha publicación resolución: 07/03/22 * Dificultad: MEDIA * * Enunciado: Crea un programa que sea capaz de transformar texto natural a código morse y viceversa. * - Debe detectar automáticamente de qué tipo se trata y realizar la convers...
Jenny2443/Weekly-Challenge-2022-Jenny
Python/Day9/Day9.py
Day9.py
py
2,582
python
es
code
0
github-code
1
34283143644
"""Parser for Moat BLE advertisements.""" from __future__ import annotations from sensor_state_data import ( DeviceClass, DeviceKey, SensorDescription, SensorDeviceInfo, SensorUpdate, SensorValue, Units, ) from .parser import MoatBluetoothDeviceData __version__ = "0.1.1" __all__ = [ ...
Bluetooth-Devices/moat-ble
src/moat_ble/__init__.py
__init__.py
py
510
python
en
code
0
github-code
1
72361760035
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @File :price.py @Description :价格表查询 @DateTime :2023-01-12 14:07 @Author :Jay Zhang """ from sqlalchemy.orm import Session from Permission.models import Permission from Tracking.models import Tracking from User.models import User, Emplo...
zxj17815/progress_tracking
User/curd.py
curd.py
py
1,082
python
en
code
0
github-code
1
11461439102
t=int(input()) if 1<=t<=1000: for i in range(t): num=int(input()) sum=0 while num!=0: sum=sum+int(num%10) num=int(num/10) if 1<=num<=1000000: print(sum)
3207-Rhims/100days-of-code-challenge
codechef/digit.py
digit.py
py
250
python
en
code
0
github-code
1
30431561202
#Calcular a média de tres notas de um aluno. Menor que 7 é reprovado n1=int(input("Nota1: ")) n2=int(input("Nota2: ")) n3=int(input("Nota3: ")) med=float(n1+n2+n3)/3 if med==10 : print("Aprovado com Distincao") elif med>=7: print("Aprovado") else: print("Reprovado")
murilloaguiar/Python
Exercicios/media_de_notas.py
media_de_notas.py
py
277
python
pt
code
0
github-code
1
7455951090
# logger import sys from pandacommon.pandalogger.PandaLogger import PandaLogger from pandajedi.jedicore.JediTaskBufferInterface import JediTaskBufferInterface from pandajedi.jedicore.MsgWrapper import MsgWrapper from pandajedi.jediddm.DDMInterface import DDMInterface from pandajedi.jediorder.TaskRefiner import TaskRef...
PanDAWMS/panda-jedi
pandajedi/jeditest/testOneTaskToRefine.py
testOneTaskToRefine.py
py
1,424
python
en
code
3
github-code
1
21877280591
import os import sys sys.path.append("../..") import time import math from z3 import * import argparse from multiprocessing import Process from multiprocessing.spawn import freeze_support from common.utils import show_output, read_instance, write_output, COLORS def write_report(instance_name, sol, report_file): ...
mwritescode/VLSI
SMT/src/iterative_solve_smt.py
iterative_solve_smt.py
py
6,936
python
en
code
1
github-code
1
25202185157
import mysql.connector as mysql class DatabaseUtil: """Create reviews database""" @staticmethod def setup_database(): db = mysql.connect( host="localhost", user="root", passwd="password" ) cursor = db.cursor() cursor.execute("CREATE DAT...
nbratanov/HotelSummaryGenerator
hotel_information/database/database_util.py
database_util.py
py
1,970
python
en
code
0
github-code
1
74533048992
import numpy as np from skimage import measure from sklearn.metrics import auc def run(score_imgs, labeled_imgs, fpr_thresh=0.3, max_steps=2000, class_name=None): labeled_imgs = np.array(labeled_imgs) labeled_imgs[labeled_imgs <= 0.45] = 0 labeled_imgs[labeled_imgs > 0.45] = 1 labeled_imgs = la...
wogur110/PNI_Anomaly_Detection
refinement/get_aupro.py
get_aupro.py
py
3,461
python
en
code
10
github-code
1
5982856075
#!/usr/bin/python3 # A class that define square with private attribute ''' Size private attribute shoud be an interger''' class Square: '''instantition the class private attribute''' def __init__(self, size=0): '''checking the condition''' self.__size = size if not isinstance(size, int...
Gasorekibo/alu-higher_level_programming
python-classes/2-square.py
2-square.py
py
449
python
en
code
0
github-code
1
10258603001
#!/home/ha74mit/bin/miniconda3/envs/anc_virus/bin/python3 # extract fasstq entries from a multi-fastq file on the basis of provided text-files (TaxID_sci_names.py) containing headers to look for # the script loads all fastq records in a file to RAM in a dictionary and searches in it; depending on fastq-file size and a...
marlt/MA_Methods
extract_reads_dicts.py
extract_reads_dicts.py
py
4,203
python
en
code
0
github-code
1
17407466389
# The Nature of Code # Daniel Shiffman # http://natureofcode.com # # Modified by Filipe Calegario # Draws a "vehicle" on the screen from Vehicle import Vehicle from Food import Food import random import math #random.randint() def setup(): global vehicle size(640, 360) velocity = PVector(1, 0) vehicle...
MEBM1/mebm-AgenteAutonomo-SI
Ativ2_SI.pyde
Ativ2_SI.pyde
pyde
972
python
en
code
0
github-code
1
6164148530
import numpy as np from string import punctuation from random import shuffle from gensim.test.utils import get_tmpfile import gensim import pandas as pd from gensim.models.word2vec import Word2Vec from gensim.models import KeyedVectors import time from nltk.tokenize import TweetTokenizer def load1_6million(path, toke...
masdeval/NLP
FinalProject/Word2Vec_Twitter.py
Word2Vec_Twitter.py
py
3,101
python
en
code
0
github-code
1
619421172
def converterBGR2CMYK(bgr): altura,largura,channels = bgr.shape bgrdash = bgr.astype(np.float64)/255. C = 1 - bgrdash[:,:,2] M = 1 - bgrdash[:,:,1] Y = 1 - bgrdash[:,:,0] CMY = np.dstack((C,M,Y)) minValor = np.min(CMY,2) print(minValor[124,0]) CMYK = np.zeros((altura,largura,4)) ...
Mikael-Kalashnikov/Processamento-Digital-de-Imagem
implementacoes/teste.py
teste.py
py
734
python
en
code
1
github-code
1
24270815601
from blackjack.hand import Hand from blackjack.card import Card seventeen = Hand() seventeen.add(Card("Queen", "Hearts")) seventeen.add(Card("7", "Clubs")) low_ace = Hand() low_ace.add(Card("Ace", "Spades")) low_ace.add(Card("Queen", "Clubs")) low_ace.add(Card("2", "Hearts")) high_ace = Hand() high_ace.add(Card("Ace"...
zjhuntin/blackjack
blackjack/tests/test_hand.py
test_hand.py
py
1,396
python
en
code
null
github-code
1
34744890295
from typing import * from BinaryTree import TreeNode from BinaryTree import creatTree # 确定本题的使用方法 # 确定本题的边界条件 # 如果本题只有一个节点,且key等于此节点 直接返回None class Solution: def deleteNode(self, root: Optional[TreeNode], key: int) -> Optional[TreeNode]: if root and not root.left and not root.right: if root.va...
PorterZhang2021/LeetCode
7.二叉树/一刷总结测试/34-1. 450.删除二叉搜索树中的节点.py
34-1. 450.删除二叉搜索树中的节点.py
py
1,615
python
en
code
0
github-code
1
28849219985
import pickle import streamlit as st import pandas as pd import numpy as np import seaborn as sns from scipy import stats from datetime import datetime from sklearn import preprocessing from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score, confu...
sing829/yolov5_streamlit_updated
separate_py/show_ml2.py
show_ml2.py
py
10,796
python
en
code
0
github-code
1
10412664593
from mathematics import PBox from ciphers.utils import * from des import * class DES: def __init__(self, key: int): self.key = int_to_bin(key, block_size=64) self.PC_1 = PBox.des_key_initial_permutation() self.PC_2 = PBox.des_shifted_key_permutation() self.P_i = PBox.des_initial_pe...
anishLearnsToCode/cryptography
des/DES.py
DES.py
py
2,049
python
en
code
13
github-code
1
18995343621
# Factor Analysis import matplotlib.pyplot as plt def Factor_EM(Input_data,K_sub=3): trans=Input_data (N,D)=trans.shape #Initialize u=np.mean(trans,axis=0) Input_data=FTI sigma_full=np.cov(FTI.transpose()) [U_matrix,D_matrix,V_matrix]=np.linalg.svd(sigma_full) eta_start=...
saikrishnawds/Generative-Face-Image-Classification
model4_Factor_analysis.py
model4_Factor_analysis.py
py
5,914
python
en
code
0
github-code
1
10357753792
from a_sudoku import SUDOKU_1 from checks import Checker def check_empty(puzzle): for y in range(9): for x in range(9): if puzzle[y][x] == -1: return x, y return None, None def solve_sudoku(puzzle): x,y = check_empty(puzzle) if x == None: return True fo...
Thopterulu/Backtracking-Sudoku
v2.py
v2.py
py
749
python
en
code
0
github-code
1
32613495520
# -*- coding: utf-8 -*- from myapps.s03.views._global import * class View(GlobalView): def dispatch(self, request, *args, **kwargs): response = super().pre_dispatch(request, *args, **kwargs) if response: return response self.max_ore = 2.0 self.max_hydrocarbon = 2.0 self....
Nelyth26/ngexile
myapps/s03/views/commanders.py
commanders.py
py
14,379
python
en
code
null
github-code
1
33565357577
import networkx as nx import numpy as np from scipy import random import pandas as pd import copy import random from collections import OrderedDict, Counter from multiprocessing import Pool import itertools import matplotlib.pyplot as plt #%matplotlib inline def generate_my_simplicial_complex_d2(N,p1,p...
kittan13/school_lab
simplagion-master/Generalized degree distribution of the Random Simplicial Complex model.py
Generalized degree distribution of the Random Simplicial Complex model.py
py
5,339
python
en
code
0
github-code
1
15486771413
import re import requests from bs4 import BeautifulSoup def baidu_search(word: str) -> str: """ 百度百科检索问题 :param word: 需要查询的问题 :return: 百度百科查询结果 """ headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/53...
shangruobing/infoweaver-backend
NFQA/QAS/utils/baidu_search.py
baidu_search.py
py
829
python
en
code
2
github-code
1
73085692514
import numpy as np import pygame class GridEnvironment: def __init__(self): self.grid = np.zeros((7,7)) self.starting_position = [0,0] self.goal_position = [5,4] self.reset() self.walls = [[3, 2], [2, 3], [1, 4]] #actions are up, down, left, right mapped to 0, 1, 2...
Jakub202/IDATT2502-ML
excercise8/gridworld/GridEnvironment.py
GridEnvironment.py
py
5,224
python
en
code
0
github-code
1
24452925908
import math import numpy as np import copy class Agent: def __init__ (self, name, position, board): self.name = name self.position = position self.board = board self.board.set_cell_reward(self.position, -10) # ---------- SOURCES ------------- # stay = [0.95, 0.01, 0.01, 0...
GIOVRUSSO/Control-Group-Code
students_projects/exploration_via_crowdsourcing/Second version of the algorithm/agent_v0.9.py
agent_v0.9.py
py
11,634
python
en
code
6
github-code
1
3982305761
#!/usr/bin/env python # import google.appengine.api.users from google.appengine.ext import blobstore from google.appengine.ext import db from google.appengine.api import images from google.appengine.ext.webapp import blobstore_handlers import logging import jinja2 import webapp2 import json import os import re ipadReg...
bruntonspall/visual-schedule
main.py
main.py
py
7,684
python
en
code
0
github-code
1
27528671913
#!/usr/bin/python3 import argparse import cv2 import numpy as np def onTrackbar(threshold): print("Selected threshold " + str(threshold) + " for limit") def main(): # parse the argument parser = argparse.ArgumentParser() parser.add_argument('-i', '--image', type=str, required=True, help='Full path ...
JorgeFernandes-Git/PSR_AULAS_2021
openCV/Ex3_MOUSE_TRACKBAR/main4.py
main4.py
py
3,084
python
en
code
0
github-code
1
41332458191
import json from django.http import JsonResponse from django.views import View from owners.models import Owner, Dogs class OwnerRegister(View): def get(self, request): result = [] owner = Owner.objects.all() # 쿼리문이기 때문에 바로 response를 하지못한다 그래서 반복문을 통해 딕셔너리형테로 만들어준뒤에 response를 해야한다. ...
nicholas019/crud2_owner
owners/views.py
views.py
py
3,456
python
en
code
0
github-code
1
71165257954
import cv2 import librosa import numpy as np import random from sklearn.preprocessing import LabelEncoder, StandardScaler, MinMaxScaler, scale def scale_feature(feature, featureSize): widthTarget, heightTarget = featureSize height, width = feature.shape # scale according to factor newSize = (int...
ksraj/CoughVid
helper/preprocessor.py
preprocessor.py
py
3,017
python
en
code
1
github-code
1
37106040488
from astropy.io import fits import pandas as pd import numpy as np import time import traceback import os flux1350=[] flux3000=[] df=pd.read_csv('/media/richard/Backup Plus/candidate_dr16_0.8_final.csv',low_memory=False) groupid=df['GroupID_1'] specname=df['specname_new'] z=df['Z'] area_1350=df['LINEAREA_1350'] area_30...
RichardPeng0624/SDSSspectrum-painting
linearea.py
linearea.py
py
2,118
python
en
code
0
github-code
1
71276798435
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import base64 import requests from contextlib import closing from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests im...
ColtAllen/codex_vitae_app
codex_vitae/etl/api_requests.py
api_requests.py
py
4,294
python
en
code
0
github-code
1
20918803999
# -*- coding: utf-8 -*- import os import sys import time import pickle import requests import pandas as pd from tqdm import tqdm from urllib import response from bs4 import BeautifulSoup class Scraper: def __init__(self): self.base_url = "https://scholar.google.com/" dir_persistent = os.path.joi...
andreeaiana/graph_confrec
src/data/H5IndexScraper.py
H5IndexScraper.py
py
7,691
python
en
code
8
github-code
1
29972846358
#import the spaCy library import spacy # Load the spaCy model for NER(this is the sm version so faster but less accurate) nlp = spacy.load("en_core_web_sm") # Define a function to anonymize personal information def anonymize_text(text): # Use spaCy NER to process the input text doc = nlp(text) # Create ...
Sai9555/anonymize_data
src/TxtSpaCyV1.0.py
TxtSpaCyV1.0.py
py
1,954
python
en
code
0
github-code
1
72601518114
import requests import json import time from string import ascii_letters,digits import random from base64 import b64encode from hashlib import sha256 from os import urandom def request_verify_code(phone_number): random.seed(urandom(8)) h=sha256() code_verifier=''.join([ random.choice(ascii_letters+di...
chenliTW/goshare-reserve
src/utils.py
utils.py
py
3,273
python
en
code
0
github-code
1
22589006256
import pygame, sys from pygame.locals import * import random pygame.init windowSurface = pygame.display.set_mode((800, 600), 0, 32) pygame.display.set_caption('game') brown=(190,128,0) black=(0,0,0) green=(0,128,0) blue=(0,0,255) white=(255,255,255) red=(255,0,0) xtree1=[200,250,100,225,350] ytree=[200,50,350] x1=...
micah-kitzler/first-pygame-game
game.py
game.py
py
9,217
python
en
code
1
github-code
1
36079132985
import argparse import os from collector.github_repo_collector import GithubRepositoryCollector from const.constants import GITHUB_ACCESS_TOKEN def parse_args() -> argparse.Namespace: """ Parse arguments. :return: a namespace with the arguments """ parser = argparse.ArgumentParser(description='Ge...
JulianBenitez99/ECI-MS-Thesis
GoCSVRepo/main.py
main.py
py
732
python
en
code
0
github-code
1
70446181794
def sous_chaine_naif(a, b): for i in range(len(a) - len(b) + 1): trouvé = True for j in range(len(b)): if b[j] != a[i + j]: trouvé = False if trouvé: return True return False def sous_chaine_naif_2(a, b): for i in range(len(a) - len(b) + 1): ...
FrancoisBrucker/cours_informatique
docs/old_a_trier/src_orig/cours/algorithme-code-théorie/algorithme/etude-recherche-sous-chaines.py
etude-recherche-sous-chaines.py
py
3,492
python
en
code
4
github-code
1
73955751394
import random import colorsys class wsColorer(): hues = None rgb = None def __init__(self, hues): # Initialize two hues that all words will be coloured with self.hues = [-1, -1] if len(hues) == 1: self.hues[0] = hues[0] self.hues[1] = hues[0] return elif len(hues) == 3: self.rgb = hues...
PetrKorab/Animated-Word-Cloud
colorer.py
colorer.py
py
1,030
python
en
code
0
github-code
1
33272217515
""" ForceFunctions.py """ import math import random import numpy as np from MeasureSimulation import * """ LJ_Force -------------------------------------------------------------------------------------------------- - Put the Lennard-Jones potential to calculate the force of the intera...
LukeSylvander/Physics-Honours-Code
ForceFunctions.py
ForceFunctions.py
py
7,734
python
en
code
0
github-code
1
28776224145
import sys from collections import deque input = sys.stdin.readline def bfs(i, j): visited[i][j] = 1 union = [(i, j)] _sum = graph[i][j] q.append((i, j)) while q: x, y = q.popleft() for dx, dy in [(0, 1), (0, -1), (1, 0), (-1, 0)]: nx = x + dx ny = y + dy ...
jiyoon127/algorithm_study
Implementation/인구_이동.py
인구_이동.py
py
1,264
python
en
code
0
github-code
1
161486334
#!/usr/bin/env python # -*- coding: utf-8 -*- """test_manifest_in ---------------------------------- Tries to build and test the `manifest-in` sample project. """ import glob from . import project_setup_py_test from .pytest_helpers import check_sdist_content, check_wheel_content @project_setup_py_test("manifest-i...
jem0101/BigSwag-SQA2022-AUBURN
TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/scikit-build@scikit-build/tests/test_manifest_in.py
test_manifest_in.py
py
1,217
python
en
code
2
github-code
1
73799749795
inp = open('input.txt').read().split('\n') caves_graph = {} # Build graph for line in inp: curr = line.split('-') caveA = curr[0] caveB = curr[1] if caveA in caves_graph: caves_graph[caveA].append(caveB) else: caves_graph[caveA] = [caveB] if caveB in caves_graph: ca...
IsabellaCapriotti/AdventOfCode
2021/day12.py
day12.py
py
2,307
python
en
code
0
github-code
1
21217490923
import json import tornado.httpserver import tornado.ioloop import tornado.web import tornado.websocket import tornado.options import os.path from tornado.options import define, options define("port", default=8000, help="run on the given port", type=int) class Message: #消息 sender="" text="" roomID="" time="" d...
Drenight/2019ComprehensiveProject
exp2/cookies.py
cookies.py
py
4,273
python
en
code
4
github-code
1
19498126311
#Casey Latimere Kreicar #CMSC 210 Project 7 Function w/Bonus Program #Prof. Palesis #April 19th 2021 # # # ######START###### # ##FUNCTION## # #Define function def totalBonusFunction(): #Calculate the total bonus by adjusting the sales bonus #per years of service: #if years of service is 10 or more, #increase the sales...
latimere/CMSC210
CMSC210Project7.py
CMSC210Project7.py
py
1,306
python
en
code
0
github-code
1
900614867
import random import os import shutil from PIL import Image, ImageDraw import torch from torchvision import datasets, transforms from detectron2.utils.logger import setup_logger from detectron2.config import get_cfg from detectron2.engine import DefaultPredictor import asyncio def crop_portraits(portraits_list, film_f...
mariana200196/cartoon-face-detector
API/helper_functions.py
helper_functions.py
py
3,002
python
en
code
0
github-code
1
73793723235
# Create a Scraper that extracts information about job descriptions # 1. Open up website # 2. Parse the HTML and gather content objects from the indeed page # - list of Job Titles # - list of Job Descriptions from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webd...
nitink23/Sachacks2023nava
job_scraper/indeed_scraper.py
indeed_scraper.py
py
2,542
python
en
code
0
github-code
1
9708255908
from app import app from flask import request, render_template, jsonify, session import re from app.modules.text_translator_ch2en import translator_ch2en from app.modules.text_translator_en2ch import translator_en2ch from app.modules.summa_TextRank import TextRank_Summarizer_en from app.modules.snownlp_TextRank import...
ChingHung21/Bilingual-Lesson-Assistant
app/views.py
views.py
py
9,410
python
en
code
0
github-code
1
28994089757
# a great deal of code modified and copied from: # https://github.com/OpenBounds/Processing import sys import os import logging import subprocess import tempfile import glob import click from pyproj import Proj, transform import fiona from fiona.crs import from_epsg, to_string from fiona.transform imp...
cat-cfs/gcbm_preprocessing
preprocess_tools/gcbm_aws/util.py
util.py
py
7,193
python
en
code
0
github-code
1
5604036908
import math N = int(input()) n = int(math.sqrt(N)) ans = 0 for i in range(n, 0, -1): if N % i == 0: ans = N // i break counter = 0 while ans >= 10: counter += 1 ans //= 10 print(counter+1)
yuu246/Atcoder_ABC
practice/recommendation/ABC57_C.py
ABC57_C.py
py
218
python
en
code
0
github-code
1
25295807822
from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException from webdriver_manager.chrome import ChromeDriverManager import time impor...
manishhemnani06/LINKEDIN_JOB_ANALYSIS_
SCRAPPING_CODE/SCRAPPING_MAIN_FILE.py
SCRAPPING_MAIN_FILE.py
py
8,400
python
en
code
1
github-code
1
11237122693
""" Author: Venkata Yellapragada, vyellapr@purdue.edu Assignment: 02.5 - Fluid Mechanics Date: 02/03/2022 Description: Outputs the kinematic viscosity based on user inputs for temperature, velocity, diameter. I have to calculate this by hand for AAE 333. Contributors: NA My contributor(s) helped me:...
nyellapragada/Purdue_EBEC_101
fluid_mechanics_vyellapr.py
fluid_mechanics_vyellapr.py
py
1,860
python
en
code
0
github-code
1
28768775449
from rest_framework import generics, viewsets from .models import approvals from .serializer import approvalsSerializers from sklearn.externals import joblib import pandas as pd from .form import ApprovalsForm from django.shortcuts import render from keras import backend as K from django.contrib import messages # Cre...
xolanisiqhelo/djangoAPI
api/views.py
views.py
py
3,125
python
en
code
0
github-code
1
35394508983
x = [6,4,3,2,5,76,8,8,6,4,2,1,123,4,2,1,3,4,5,6] y = ["Janet", "Jessie", "Bobby", "Alice", "Kelly"] x.append(2) #append a value to the list x.insert(0,2)# insert 2 into index of 0 (it will append itself at that location)it does not replace! x.remove(2) #removes the first 2 x.remove(x[2])#removes the third elemen...
AKP101/Practice-Excercises-Python
ListManipulation.py
ListManipulation.py
py
516
python
en
code
0
github-code
1
7419507068
from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensor2tensor.layers import common_attention from tensor2tensor.layers import common_hparams from tensor2tensor.layers import common_layers from tensor2tensor.layers import discretization from tensor2tenso...
ml4astro/galaxy2galaxy
galaxy2galaxy/models/autoencoders_utils.py
autoencoders_utils.py
py
11,475
python
en
code
27
github-code
1
1967729697
from copyreg import constructor import csv import sys from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By if (len(sys.argv) < 1): raise Exception('Argument Missing: run with "blockc...
0x14os/well-known-parser
parser.py
parser.py
py
2,246
python
en
code
null
github-code
1
28159584514
import json import requests from datetime import date, datetime from mysql.connector import (connection) from elasticsearch import Elasticsearch from elasticsearch.helpers import bulk from pprint import pprint import os.path import pandas as pd import time ''' Module to make queries easier via python elasticsearch a...
belaz/elasticpoc
python/search-by-querypost.py
search-by-querypost.py
py
6,362
python
en
code
0
github-code
1
13365106466
import numpy as np import tensorflow as tf from PIL import Image def get_data(img_file, labels_file, image_size): """ Given a file path and two target classes, returns an array of normalized inputs (images) and an array of labels. Extract only the data that matches the corresponding classes (there are 101 class...
meera-kurup/skimage
code/preprocess.py
preprocess.py
py
2,139
python
en
code
0
github-code
1
11424750185
class Solution: def getPowerSet(self,s): if(s is None): return None if(len(s)==1): return[[],s]; subSets=self.getPowerSet(s[1:len(s)]) n=len(subSets) for i in range(n): l=list(subSets[i]); l.append(s[0]) subSets.app...
mshadloo/Algorithm
chapter 8/8-4-powerSet.py
8-4-powerSet.py
py
961
python
en
code
0
github-code
1
70976183713
# -*- coding: utf-8 -*- """ Created on Mon Nov 19 11:41:36 2018 @author: Susan """ import pandas as pd import numpy as np import matplotlib.pyplot as plt # making phi matrix def base_func(x,j,M,s): muj = np.asarray(4*j/M).reshape(1,len(j)) # 各種不同muj phi = (np.tile(x,M)-np.tile(muj,(x.shape[0],1)))/s # si...
chunshou-Liu/MachineLearning
Assignment2/Bayesian Linear Regression.py
Bayesian Linear Regression.py
py
8,786
python
en
code
0
github-code
1
7937095341
from django.urls import path from app.views import SignUpView, ProductListView, ProductCreateView, ProductApprove, ProductUpdateView, ApproveView, \ RedirectView urlpatterns = [ path('', RedirectView.as_view()), path('signup', SignUpView.as_view(), name='signup'), path('products', ProductListView.as_vi...
ToshipSo/PinkBlue
app/urls.py
urls.py
py
669
python
en
code
0
github-code
1
8219036837
from dns_messages.dns_objects import * from ..dns_objects.dns_message import DnsMessage, OPCODE, RCODE from ..utilities import convert_bytes_to_bit_list, extract_int_from_raw_bits, parse_name RR_TYPE_TO_CLASS_MAPPING = { RRType.A: A, RRType.NS: None, RRType.CNAME: CNAME, RRType.SOA: SOA, RRType.PT...
wahlflo/dns-messages
dns_messages/dns_objects/dns_message_parser.py
dns_message_parser.py
py
6,281
python
en
code
0
github-code
1
12252245392
import pandas as pd import numpy as np import os import warnings from .dataset import Dataset from .dataframe_tools import * from .exceptions import FailedReindexWarning, ReindexMapError class Endometrial(Dataset): def __init__(self, version="latest", no_internet=False): """Load all of the endometrial dat...
noaoch/CPTAC-data-parser
cptac/endometrial.py
endometrial.py
py
13,971
python
en
code
0
github-code
1