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
22913601493
def main(): """Get a string input and print out a formatted list of the occurrence number of words.""" string = input("Enter your string: ") split_string = string.split(" ") split_string.sort() string_dictionary = create_dictionary(split_string) longest_word_length = find_longest_word(split_st...
SPritchard86/cp1404
cp1404Practicals/prac_05/word_occurrences.py
word_occurrences.py
py
1,062
python
en
code
0
github-code
50
4643678359
import logging import unittest import factories from .base import BaseGrapheneElasticTestCase from ..constants import ALL, VALUE __all__ = ( 'HighlightBackendElasticTestCase', ) logger = logging.getLogger(__name__) class HighlightBackendElasticTestCase(BaseGrapheneElasticTestCase): def setUp(self): ...
barseghyanartur/graphene-elastic
src/graphene_elastic/tests/test_source_backend.py
test_source_backend.py
py
3,125
python
en
code
71
github-code
50
14440020787
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 19 20:09:54 2019 @author: Juliane """ from helpers_DNN import * from models_DNN import * from keras.utils import to_categorical from sklearn.model_selection import train_test_split EMBEDDING_DIM = 30 BATCH_SIZE = 512 EPOCHS = 260 ### Build simpl...
Florent-Sierro/ML_Project_2
src/main_DNN.py
main_DNN.py
py
1,616
python
en
code
0
github-code
50
3675159960
import timeit # import random # alist = random.sample(range(1,101),20) #random.sample()生成不相同的随机数 # print(alist) # 常用排序算法练习 # 所有排序算法都仅考虑升序排列,降序仅需要反一下即可 # 选择排序算法: # 一句话:从前往后,每个位置选出从此至结尾中最小的 # 默认升序排列一个列表,否则降序 # 思想在于从头开始,两两对比,通过小的占据当前位置,每次选出当前位置最小(升序)或者最大(降序)的值占位,后移一位,直至循环结尾完成排序 # 属于“从前往后”的排序,平均时间复杂度O(n²) def selection_...
jasonshaw/learningpython
test.py
test.py
py
8,663
python
zh
code
0
github-code
50
38949396195
# read schematic functions from libraries import constants as ct from libraries import globals as gb from libraries import schematics as sch from libraries import meta_elements as me from libraries import html_elements as he from libraries import string_processes as sp from libraries import header from libraries import...
MickyHCorbett/MorfLess
libraries/read_schematic.py
read_schematic.py
py
22,611
python
en
code
0
github-code
50
32156594739
import time import datetime import pandas as pd import numpy as np CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } def get_filters(): """ Asks user to specify a city, month, and day to analyze. Returns: (s...
pranath/bikeshare_analysis
bikeshare.py
bikeshare.py
py
8,092
python
en
code
0
github-code
50
33125097077
import pytest from . import moduleInstalled pytestmark = pytest.mark.skipif(not moduleInstalled('sqlite3'), reason = 'sqlite3 is not installed.') import sqlite3 from medoo.base import Base from medoo.builder import Builder, Field from medoo.dialect import Dialect from medoo.database.sqlite import Sqlite, DialectSqli...
pwwang/pymedoo
tests/test_sqlite.py
test_sqlite.py
py
3,203
python
en
code
15
github-code
50
10410201734
import mdtraj import numpy import scipy from scipy.spatial.transform import Rotation import math import sys import csv from shapely.geometry import Polygon, LinearRing, Point, LineString from shapely.ops import polylabel from shapely.validation import make_valid import shapely from PIL import Image, ImageDraw import ar...
ts-hayden-dennison/pore_info
pore_info.py
pore_info.py
py
13,353
python
en
code
0
github-code
50
70695901917
import requests from django.core.management.base import BaseCommand from uk_political_parties.models import Party, PartyEmblem class Command(BaseCommand): def clean_party(self, party_id, party): cleaned_party = { "party_id": party_id, "party_name": party["name"], "reg...
DemocracyClub/electionleaflets
electionleaflets/apps/core/management/commands/import_parties.py
import_parties.py
py
1,313
python
en
code
8
github-code
50
29991018390
from functools import partial as p import os import string from tests.helpers import fake_backend from tests.helpers.util import wait_for, run_agent, run_container, container_ip from tests.helpers.assertions import * rabbitmq_config = string.Template(""" monitors: - type: collectd/rabbitmq host: $host port:...
someword/signalfx-agent
tests/monitors/rabbitmq_test.py
rabbitmq_test.py
py
1,758
python
en
code
null
github-code
50
3847494735
# -*- coding: utf-8 -*- """ settings tab """ import curses from curse.tab_gen import TabEntry from curse.menu_gen import MenuEntry from curse.list_gen import List class TabSettings(TabEntry): """ setting tab """ def __init__(self, parent): """ initialisation """ TabEntry.__init__(self, '...
sensini42/flvdown
curse/tab_settings.py
tab_settings.py
py
2,117
python
en
code
3
github-code
50
20058427342
import nltk as mahedi print("1. Bangladesh\n2. Taj Mahal\n3. Unreal Engine\n4. BCB\n5. kuet") a = int(input("Choose an option: ")) if a == 1: f = open("trial.txt", "r") str = f.read() elif a == 2: f = open("tajMahal.txt", "r") str = f.read() elif a == 3: f = open("unreal.txt", "r") ...
Prime1996/Quizzy
jbgv.py
jbgv.py
py
2,303
python
en
code
1
github-code
50
16075610767
# Import the SDK and the client module import asyncio import os import requests from label_studio_sdk import Client from const import LABEL_STUDIO_URL, API_KEY, IMPORT_PATH, PROJ_ID async def upload_img(path): # Upload the files in ./img headers = { 'Authorization': 'Token ' + API_KEY, } fil...
haifengjia/Label-Studio-PyScripts
importer.py
importer.py
py
1,378
python
en
code
0
github-code
50
38764130509
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: '''All algos Time: O(n) Space: O(h) (=O(logn) if balanced otherwise O(n))''' ...
coldmanck/leetcode-python
0100_Same_Tree.py
0100_Same_Tree.py
py
1,401
python
en
code
5
github-code
50
44054688012
from django.db import models from django.conf import settings class YoutubeCredential(models.Model): class Meta: db_table = 'youtube_credentials' verbose_name = 'Youtube Credential' verbose_name_plural = 'Youtube Credentials' account_id = models.OneToOneField( settings.AUTH_US...
TonysHub/collaberr-backend
core/api/youtube_analytics/models/auth.py
auth.py
py
818
python
en
code
1
github-code
50
37210978312
from typing import Dict, Union from django.utils.translation import gettext as _ from rest_framework import serializers from authentication.models import User from content.models import Resource, Task, Topic from utils.utils import ( validate_creation_and_deletion_dates, validate_creation_and_deprecation_date...
PabloSSena/activist
backend/events/serializers.py
serializers.py
py
5,342
python
en
code
null
github-code
50
32660302619
''' Created on Oct 12, 2018 @author: purboday ''' from riaps.run.comp import Component import logging import time import os class Seller(Component): def __init__(self, sellernum): super(Seller, self).__init__() self.pid = os.getpid() now = time.ctime(int(time.time())) self.logger....
purboday/UGridAuction
ugrig_auction/Seller.py
Seller.py
py
4,992
python
en
code
2
github-code
50
26240052838
import langchain from langchain import OpenAI, LLMChain, PromptTemplate, SerpAPIWrapper, LLMMathChain, GoogleSearchAPIWrapper from langchain.memory import ConversationBufferMemory, ConversationSummaryMemory from langchain.agents import load_tools, initialize_agent, Tool, AgentType from langchain.callbacks import get_op...
kpister/prompt-linter
data/scraping/repos/cfa532~chroma-langchain-tutorial/GPTClone.py
GPTClone.py
py
3,951
python
en
code
0
github-code
50
36082321562
import psycopg2 class DatabaseConnection: def __init__(self, connect_args=None): with open('password.txt') as f: password = f.readline() try: if connect_args is None: self.connection = psycopg2.connect('dbname=jeopardy user=luke password=' + password) ...
lukelavin/J-Archive-Parser
DatabaseConnection.py
DatabaseConnection.py
py
7,785
python
en
code
0
github-code
50
40427726123
import time def CountFrequency(mylist): #creating an empty dictionary freq={} for item in mylist: if(item in freq): freq[item] += 1 else: freq[item] = 1 for key,value in freq.items(): print("%d : %d"%(key,value)) #driver funtion if __name__ == "__main...
ArnabBasak/PythonRepository
Python_Programs/frequenceCount.py
frequenceCount.py
py
1,130
python
en
code
0
github-code
50
46722441828
from socket import * import binascii from scapy.all import * import json import os from ipaddress import * import ser_fct import datetime serverPort = 67 serverSocket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) #pour permettre la réutilisation d'adresse et le bind() sur des ports réservés serverSocke...
Arouiwassim/DHCP-Server
server.py
server.py
py
5,263
python
fr
code
0
github-code
50
69812516317
import dash # external_stylesheets = ['https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'] # meta_tags are required for the app layout to be mobile responsive app = dash.Dash( __name__, suppress_callback_exceptions=True, meta_tags=[ {"name": "viewport", "content": ...
Makoto1021/coco
app.py
app.py
py
467
python
en
code
0
github-code
50
13883021239
""" Created on Thu May 11 10:19:01 2017 @author: Viktor Andersson """ # This .py file is about loading a data frame with the help of Pandas, and then preprocess the data into a arbitrary format. # TODO: Should save corresponding numbers to a file # String compare import csv import os from pathlib import Path ...
AiLogisticsTeam2017/ArtInt
LogisticsSimulation/DataPreprocessing.py
DataPreprocessing.py
py
18,376
python
en
code
0
github-code
50
40248679760
import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing from Configuration.Eras.Era_Run3_cff import Run3 options = VarParsing('analysis') options.register("doSim", True, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register("cmssw", "CMSSW_X_Y_Z", VarParsin...
cms-sw/cmssw
Validation/MuonCSCDigis/test/runCSCDigiHarvesting_cfg.py
runCSCDigiHarvesting_cfg.py
py
2,247
python
en
code
985
github-code
50
29634270624
#!/usr/bin/env python3.5 """A simple gameserver based on asyncio that returns random states for submitted flags. ./gameserver-asyncio.py [host] [port]""" import sys import socket import re import asyncio import random import codecs HOST = '127.0.0.1' PORT = 8888 STATES = [b'expired', b'no such flag', b'accepted', ...
takeshixx/ctfpwn
tests/gameserver-asyncio.py
gameserver-asyncio.py
py
1,990
python
en
code
0
github-code
50
35571579331
import sys import numpy import datetime import re import collections from collections import OrderedDict import math import time ## ## STRING DEFINITIONS - constant strings of files that were used and additional info that couldn't be pulled from the files ## ref_assembly_str = ',assembly=b37' ref_md5_str = ',md5=bb77...
apanajotu/GI
GI Projekat/variant_call_binom.py
variant_call_binom.py
py
16,784
python
en
code
0
github-code
50
36869289244
#!/usr/bin/env python # -*- coding: utf-8 -*- import time from threading import Event, Thread def countdown(n, started_evt): print('start') started_evt.set() while n > 0: print(n) n -= 1 time.sleep(5) started_evt = Event() print('Launching countdown') t = Thread(target=countdown...
YellowDong/experience
python_learning/threading/thread.py
thread.py
py
414
python
en
code
0
github-code
50
3664284212
import argparse import random import warnings from datetime import datetime import pickle import matplotlib.pyplot as plt import numpy as np import torch from opacus import PrivacyEngine from opacus.utils.batch_memory_manager import BatchMemoryManager from torch.optim.lr_scheduler import ReduceLROnPlateau from utils...
mrchntia/ScaleNorm
semantic_segmentation/hist_plot.py
hist_plot.py
py
6,311
python
en
code
1
github-code
50
14825640393
from PIL import Image,ImageDraw from utils.operation import YOLO def detect(onnx_path='ReqFile/yolov5n-7-k5.onnx',img_path=r'ReqFile/bus.jpg',show=True): ''' 检测目标,返回目标所在坐标如: {'crop': [57, 390, 207, 882], 'classes': 'person'},...] :param onnx_path:onnx模型路径 :param img:检测用的图片 :param show:是否展示 ...
luosaidage/yolov5_onnx_server
detect.py
detect.py
py
765
python
en
code
35
github-code
50
33912968454
''' Ejercicio 4 de la guía Nº3 Utilizando la interación while, recibe como entrada dos números de inicio y final e informa cuantos números de ellos son múltiplos de 2 y 7 según entendi de esto, que da un intervalo de números y a apartir de ahí te dice cuales son los números que están en ese intervalo que son múltiplos...
sebacassone/programacion_ejercicios
Python/Cátedra/34.py
34.py
py
730
python
es
code
1
github-code
50
16091772252
import socket import re pattern = r'(^|\s)[-a-z0-9_.]+@([-a-z0-9]+\.)+[a-z]{2,6}(\s|$)' file = open("T25.4_file.txt") sock = socket.socket() host, port = socket.gethostname(), 12345 sock.connect((host, port)) sock.send(pattern.encode()) msg = sock.recv(1024).decode() print(msg) for line in file: sock.send(' '....
andriidem308/python_practice
matfiz_tasks/Topic25_Sockets/T25.4_client.py
T25.4_client.py
py
416
python
en
code
1
github-code
50
71371652634
import gspread from oauth2client.service_account import ServiceAccountCredentials import matplotlib.pyplot as plt scope = ["https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive"] creds = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', scope) client = gspr...
Raj326/Monitoramento-de-Ambiente
dashboard.py
dashboard.py
py
1,457
python
en
code
0
github-code
50
24162568413
from data import Hospitals, StatisticsStudent import matplotlib.pyplot as plt from copy import deepcopy import numpy as np import assignments import lpsolver import csv import random import pandas as pd import collections from matplotlib.ticker import MaxNLocator import glob def make_student_list(hospitals): stud...
adielcahana/OneSideMatching
simulations.py
simulations.py
py
16,922
python
en
code
0
github-code
50
43953129748
def sma(prices, nday): sma_data = [0] * len(prices) for i in range(nday, len(prices)): sma_data[i] = sum(prices[i - nday:i]) / nday return sma_data def read_data(file): f = open(file) f.seek(0) all_data = f.read() all_data_list = all_data.split('\n') data = [x.split...
akirayang0521/Akira-Python
CIS191 Introduction to Programming/hw4_costco_stock_sma_yang.py
hw4_costco_stock_sma_yang.py
py
1,737
python
en
code
0
github-code
50
7338054873
import random as random import numpy as np import pandas as pd class Operation: def __init__(self,operation): self.operation=operation self.number1, self.number2, self.number3 = self.election(operation) self.printer = self.printing(operation) def election(self,operation): if...
tgquintela/educational-content
Computation exams/classes.py
classes.py
py
7,360
python
en
code
0
github-code
50
17773861568
from inspect import Attribute from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from . models import Sale from . forms import SaleForm from . utils import searchSales # Create your views here. @login_required(login_url='login') def sales(request): sales, searc...
nguonodave/shell-POS-mgt-syst
sales/views.py
views.py
py
1,277
python
en
code
0
github-code
50
72909929436
# 将下载的CALIPSO数据按天分类,存放到相应的文件夹下 # CAL_LID_L2_01kmCLay-Standard-V4-20.2007-12-31T23-51-28ZN.hdf --> ./20071231/ # CAL_LID_L2_01kmCLay-Standard-V4-20.2008-01-01T00-37-48ZD.hdf --> ./20080101/ # ... # CAL_LID_L2_01kmCLay-Standard-V4-20.2008-12-31T23-15-13ZD.hdf --> ./20081231/ import os import shutil import pandas a...
eraevil/No-trash
neaten_CALIPSO_data/src/handle.py
handle.py
py
1,773
python
en
code
0
github-code
50
29593535843
from typing import Dict, Tuple import torch from torch.utils.data import DataLoader from model import NNModel from utils import try_gpu def valid(model: NNModel, test_loader: DataLoader) -> float: correct = 0 total = 0 model.eval() with torch.no_grad(): for data in test_loader: ...
wararaki718/scrapbox4
ml_sample/sample_influence_balanced_loss/valid.py
valid.py
py
1,683
python
en
code
0
github-code
50
22058821747
#Brandon Jones #2/26/19 #Jones_M3P1 #This program will find the highest,lowest,average,and total of a set of data def main(): num=int(input("Enter how many numbers you would like to enter: ")) my_list=[0]*num for index in range(num): number=int(input("Enter a value: ")) my_list[in...
Jonesb5977/csc121
Jones_M3P1.py
Jones_M3P1.py
py
595
python
en
code
0
github-code
50
10670365119
import numpy as np import subprocess all_iterations = [] batch_sizes = [1, 2, 3, 4, 5, 8, 10, 15, 20, 25, 50] for j in batch_sizes: iterations = [] for i in range(0, 100): command = "./planner.sh --algorithm bspi --mdp data/MDP50_%d.txt --batchsize %d" % (i, j) it = int(subprocess.check_outpu...
martiansideofthemoon/cs747-assignments
assign2/run_bspi.py
run_bspi.py
py
559
python
en
code
0
github-code
50
71061066074
import base64 import csv import io from odoo import api, models, fields import xmlrpc.client class ImportCsvEstatePropertyWizard(models.TransientModel): _name = "import.csv.estate.property.wizard" _description = "Wizard to load Properties from CSV" # your file will be stored here: csv_file = fields...
CodeBreakerMG/Tesis-Odoo-Contabilidad
odoo/custom_addons/estate/wizards/import_csv_estate_property_wizard.py
import_csv_estate_property_wizard.py
py
3,262
python
en
code
0
github-code
50
35855005883
nomes = [] def menor_nome(list): """ -> Função devolve o menor mome escrito param: lista de nomes """ menor = cont = 0 for i in list: a = len(i) if cont == 0: menor = a nome_m = i.capitalize() if a < menor: menor = a nome_m ...
SricardoSdSouza/Curso-da-USP
Coursera 2/exercicios da aula/str_menor.py
str_menor.py
py
890
python
pt
code
0
github-code
50
21001568320
import pandas as pd import re from datetime import datetime import os import logging def transform_data(data): # -- Logging path = 'C:/Users/Jhonatans/projects/ETL/Etl-Car-Recommendation/' if not os.path.exists(path + 'logs'): os.makedirs(path + 'logs') logging.basicConfig( filename= ...
Jhonatanslopes/Etl-Car-Recommendation
src/transform.py
transform.py
py
3,645
python
en
code
0
github-code
50
28324708686
# -*- coding: utf-8 -*- from odoo import api, fields, models, _ from odoo.exceptions import UserError, RedirectWarning import time import json import requests from werkzeug import urls import logging _logger = logging.getLogger(__name__) TIMEOUT = 20 GOOGLE_AUTH_ENDPOINT = 'https://accounts.google.com/o/oauth2/aut...
pman-jvm/totaltools-v15
website_google_merchant_center/models/google_merchant_center.py
google_merchant_center.py
py
14,207
python
en
code
0
github-code
50
14268944897
from django.urls import path from api.views.film import FilmRetrieveUpdateAPIView, FilmListAPIView app_name = 'film' urlpatterns = [ path('<int:id>/', FilmRetrieveUpdateAPIView.as_view(), name='film-detail'), path('list/', FilmListAPIView.as_view(), name='film-list') ]
Eugen1y/Cinema
api/urls/film.py
film.py
py
282
python
en
code
0
github-code
50
9642440681
from pathlib import Path import setuptools this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() setuptools.setup( name="streamlit-camera-input-live", version="0.2.0", author="Zachary Blackwood", author_email="zachary@streamlit.io", description="Alte...
blackary/streamlit-camera-input-live
setup.py
setup.py
py
798
python
en
code
13
github-code
50
23476658762
#모범답안 import heapq def solution(food_times, k): if k >= sum(food_times): return -1 #시간이 적은 음식부터 빼야 하므로 순서대로 정렬 q = [] for i in range(len(food_times)): #(음식시간, 음식번호)형태로 우선순위 큐에 삽입 heapq.heappush(q, (food_times[i], i+1)) sum_value = 0#먹기위해 사용한 시간 previous = 0#직전에 다먹은 시간 ...
Gyeony95/Algorithm-Solution
2020-09/프로그래머스/프로그래머스_카카오_무지의 먹방 라이브2.py
프로그래머스_카카오_무지의 먹방 라이브2.py
py
934
python
ko
code
0
github-code
50
19492639639
from flow.el.elCable import ElCable class SinglePhaseMvCable(ElCable): def __init__(self, name, flowSim, nodeFrom, nodeTo, host, connectedPhase=0): ElCable.__init__(self, name, flowSim, nodeFrom, nodeTo, host) self.devtype = "ElectricitySinglePhaseMediumVoltageCable" self.hasNeutral = True self.phases = 1...
utwente-energy/demkit
components/flow/el/singlePhaseMvCable.py
singlePhaseMvCable.py
py
1,005
python
en
code
11
github-code
50
23349911421
import boto3 region = 'us-east-1' tagvalue = 'mbiii' lstinstance = list(()) ec2 = boto3.client('ec2', region_name=region) def lambda_handler(event, context): response = ec2.describe_instances( Filters=[ { 'Name': 'tag:usecase', 'Values': [tagvalue] ...
ratokeshi/aws-lambda-ec2-instance-control
instanceec2list.py
instanceec2list.py
py
841
python
en
code
0
github-code
50
28491020588
import tensorflow as tf def text_conv(embedding_input,filter_size,filter_num,var_scope=None,pooling_method='max',mode='train',dropout_rate=None): with tf.variable_scope(var_scope or 'text_conv',reuse=tf.AUTO_REUSE): embedding_input=tf.cast(embedding_input,dtype=tf.float32,name='change_float') conv=...
DDigimon/NLPDemo
ModelLayers/ConvLayer.py
ConvLayer.py
py
834
python
en
code
1
github-code
50
4106942657
from datasets import MedicalDataset from tqdm import tqdm class ToyDataset(MedicalDataset): def __getitem__(self, idx): return self.get_sample(idx) if __name__ == "__main__": import matplotlib.pyplot as plt import numpy as np from scipy.ndimage.morphology import binary_dilation, distance_trans...
ubar667/radiotherapy_dose_prediction_kaggle
datasets/toy_dataset.py
toy_dataset.py
py
2,171
python
en
code
0
github-code
50
15252893093
#!/usr/bin/env python3 from pwn import * binary = context.binary = ELF('./one_piece') context.log_level = 'INFO' context.log_file = 'log.log' ''' # local libc libc = binary.libc p = process(binary.path) ''' # task libc libid = 'libc6_2.30-0ubuntu2.2_amd64' libpath = os.getcwd() + '/libc-database/libs/' + libid + '/'...
datajerk/ctf-write-ups
fwordctf2020/one_piece/exploit.py
exploit.py
py
1,680
python
en
code
116
github-code
50
21923686793
import time from helpers import * from enums import * from preprocess import * from solution import * import math """ Process method - This method contains the main instance processing and modeling logic """ def process(data): if not data: return None courses, periods, \ slots_per_day, teachers, \ con...
SynimSelimi/examination-timetabling
src/__main__.py
__main__.py
py
8,115
python
en
code
1
github-code
50
26245664178
import asyncio import re import requests import openai from bs4 import BeautifulSoup from googleapiclient.discovery import build from logger import setup_logger from keys import OPENAI_KEY, GOOGLE_SEARCH_API, GOOGLE_SEARCH_ID # Set up logger logger = setup_logger('google_interests') # Set up OpenAI API openai.api_key...
kpister/prompt-linter
data/scraping/repos/dimitri-sky~Aisha-AI-Demo/google_interests.py
google_interests.py
py
6,158
python
en
code
0
github-code
50
16456969342
import argparse import copy import hypergrad as hg # hypergrad package import math import numpy as np import os import time import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms from torchvision import datasets #################################################...
TrueNobility303/F2BA
single_machine/data_cleaning.py
data_cleaning.py
py
17,970
python
en
code
0
github-code
50
22948851168
#!/usr/bin/env python2 import valve.source.a2s as a2s import os import sys import socket import time import supervisor.xmlrpc import xmlrpclib supervisor_socket = "unix:///tmp/supervisor.sock" try: location = os.environ["LOCATION"] if location not in ("DE", "IL", "AU", "NL"): raise KeyError except Key...
QLRace/server-settings
server_monitor.py
server_monitor.py
py
2,764
python
en
code
2
github-code
50
70204237595
#This solution gives 100% accuracy #!/bin/python3 import math import os import random import re import sys import decimal # # Complete the 'plusMinus' function below. # # The function accepts INTEGER_ARRAY arr as parameter. # def plusMinus(arr): length_arr = len(arr) positive_num_length = l...
M-Umr/Python_Language_Prepration
HackerRank/plus_minus.py
plus_minus.py
py
1,090
python
en
code
1
github-code
50
12359666247
import unittest from selenium.webdriver.chrome.service import Service from selenium import webdriver from selenium.webdriver.support.ui import Select from selenium.webdriver.common.by import By class RegisterNewUser(unittest.TestCase): @classmethod def setUp(cls) -> None: service = Service(executable...
Kerepakupai/seleniumProject
select_language.py
select_language.py
py
1,510
python
en
code
0
github-code
50
21643310861
import shutil import glob import subprocess import os import pandas as pd '''by James C. Hu This script will: 1) peform ivar variant calling on all bam files within a directory. 2) Pull and combine variant data based on locations given by input file. ''' # pandas terminal output options pd.options.display.max_columns...
ASU-Lim-Lab/Variant_calling
Variant_calling/ivar_covidseq.py
ivar_covidseq.py
py
2,324
python
en
code
0
github-code
50
34650130706
# 3D柱状图 import random from pyecharts import options as opts from pyecharts.charts import Bar3D # 生成测试数据 data = [[x, y, random.randint(10, 40)] for y in range(7) for x in range(24)] hours = ['12am', '1am', '2am', '3am', '4am', '5am', '6am', '7am', '8am', '9am', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm'...
dairui2/MATLAB
chapter10/10.3.py
10.3.py
py
1,115
python
en
code
1
github-code
50
15960309264
import copy from typing import Any, Dict, Optional, Set, Tuple, Union import torch from torch import Tensor from torch_scatter import scatter_min from torch_geometric.data import Data, HeteroData from torch_geometric.data.storage import EdgeStorage from torch_geometric.typing import EdgeType, OptTensor # Edge Layout...
myhz0606/pytorch_geometric
torch_geometric/sampler/utils.py
utils.py
py
5,280
python
en
code
null
github-code
50
31175971463
from re import split from typing import Optional, Self def contains_item_at_every_pos(string, items): for i in range(len(string)): found_match = False for item in items: if string[i] == item: found_match = True break if not found_match: ...
PythonDominator/Pybattle
lexer.py
lexer.py
py
7,457
python
en
code
8
github-code
50
11956147421
import numpy as np import cv2 import os fname = 'image' # folder name def getcurpath(): return os.path.dirname(os.path.abspath(__file__)) curpath = getcurpath() imagepath = os.path.join(curpath, fname) imname = '%s\Cattura.png' % (imagepath) img = cv2.imread(imname, 0) cv2.imshow('image', img) k = cv2.waitKey(0...
StormFox23/playground-python
image/vision/main.py
main.py
py
448
python
en
code
2
github-code
50
40033668017
from pymongo.cursor import Cursor from app.database.database import DbManager from app.database.models import Activity, User from app.config import Settings class ActivitiesManager(DbManager): def __init__(self, settings: Settings, user: User) -> None: super().__init__(settings.mongodb_host, settings.mon...
rgmf/fit_galgo_api
app/database/activities.py
activities.py
py
854
python
en
code
0
github-code
50
28076246722
# -*- coding: utf-8 -*- """ @Author 坦克手贝塔 @Date 2023/5/7 14:24 """ from collections import Counter from typing import List """ """ """ 思路:如果一个数对 (a,b) 之和能被 60 整除,即 (a+b)mod60=0,那么 (amod60+bmod60)mod60=0,不妨记 x=amod60, y=bmod60,那么有 (x+y)mod60=0,即 y=(60−x)mod60。因此,我们可以遍历歌曲列表,用一个长度为 60 的数组 cnt 记录每个余数 x 出现的次数。对于...
TankManBeta/LeetCode-Python
problem1010_medium.py
problem1010_medium.py
py
957
python
zh
code
0
github-code
50
40428441663
from tkinter import * import pymysql from tkinter import messagebox top = Tk() top.title('DataBase Interface') L1 = Label(text="First Name") L1.place(x=10,y=10) L1.pack() E1 = Entry(bd = 5) E1.pack() L2 = Label(text = "Last Name") L2.place(x=10,y=500) L2.pack() E2 = Entry(bd = 5) E2.pack() def getcontent(): E1cont...
ArnabBasak/PythonRepository
python code.py
python code.py
py
983
python
en
code
0
github-code
50
16252026350
import pytest from pytest_mock import mocker from lib.character import Character from lib.spell import Spell def test_morgue_filepath(): local_mode = True character = Character(name="GucciMane", local_mode=local_mode) expected_filepath = f"/Users/begin/Library/Application Support/Dungeon Crawl Stone Soup/...
davidbegin/morguebot
test/test_character.py
test_character.py
py
2,942
python
en
code
6
github-code
50
36062014752
from rest_framework.permissions import BasePermission class CoursesPermission(BasePermission) : def has_permission(self, request, view) : if request.method == 'POST' and request.user.is_superuser == True : return True if request.method == 'GET' : ...
nicole-malaquias/Kanvas
course/permissions.py
permissions.py
py
811
python
en
code
1
github-code
50
42442587154
import ckan.model as model import ckan.logic as logic from ckan.common import c, _ def get_ksa_helpers(): return dict( ksa_bit_check=ksa_bit_check, ksa_group_list = ksa_group_list, get_ksa_group_img = get_ksa_group_img, relation_attrs_update=relation_attrs_update, relations_displa...
Yesser-GitHub/ckanext-iar
ckanext/ksaiar/helpers.py
helpers.py
py
1,437
python
en
code
0
github-code
50
15253837283
#!/usr/bin/env python3 from pwn import * binary = context.binary = ELF('./chall_15') if not args.REMOTE: p = process(binary.path) else: p = remote('chal.2020.sunshinectf.org', 30015) p.sendline() p.recvuntil('There\'s a place where nothing seems: ') _ = p.recvline().strip() stack = int(_,16) log.info('stack: ' + ...
datajerk/ctf-write-ups
sunshinectf2020/speedrun/exploit_15.py
exploit_15.py
py
953
python
en
code
116
github-code
50
29575496776
import re inputs=int(input()) answer=0 for x in range(inputs): str=input().lower() if len(re.findall("pink",str))>0 or len(re.findall("rose",str))>0: answer+=1 if answer==0: print ('I must watch Star Wars with my daughter') else: print(answer)
blueflotsam/Kattis-Solutions
python/fiftyshadesofpink.py
fiftyshadesofpink.py
py
262
python
en
code
0
github-code
50
8630029592
# python3 import math def nums(num1): length_low=len(str(num1[0])) length_upper=len(str(num1[1])) num=[] z=[] for a in range(length_low,length_upper+1): #print(a) for c in range(1,11-a): length_low_usage=a inter=0 for b in range(c,11): ...
bharadwajvaduguru8/leetcode_contests
question.py
question.py
py
956
python
en
code
0
github-code
50
12418676814
import scrapy class StatesSpider(scrapy.Spider): name = 'states' allowed_domains = ['www.earthquaketrack.com'] # http/s is prohibited in this list var start_urls = ['https://www.earthquaketrack.com/p/myanmar/recent'] def parse(self, response): #rows = response.xpath("(//div[@class='quakes-in...
thonenyastack/earthquake_scan
spiders/states.py
states.py
py
1,422
python
en
code
0
github-code
50
11259784429
import os import numpy from kaggle_imgclassif.cassava.data import CassavaDataModule, CassavaDataset from tests import _ROOT_DATA PATH_DATA = os.path.join(_ROOT_DATA, "cassava") def test_dataset(path_data=PATH_DATA): dataset = CassavaDataset( path_csv=os.path.join(path_data, "train.csv"), path_...
Borda/kaggle_image-classify
tests/cassava/test_data.py
test_data.py
py
760
python
en
code
38
github-code
50
18677190464
import pytest from pycfmodel.model.resources.iam_role import IAMRole @pytest.fixture() def iam_role(): return IAMRole( **{ "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Stat...
midisfi/pycfmodel
tests/resources/test_iam_role.py
test_iam_role.py
py
1,149
python
en
code
null
github-code
50
70978041757
from os import environ from os.path import join, dirname import gzip import glob import pandas as pd from .dataset_modification import ( taxa_to_organism, ) from .constants import ( RANK_LIST, ALLOWED_SUPERKINGDOMS, CANONICAL_RANKS, ROOT_RANK, ) NCBI_DELIM = '\t|' # really... NAM...
dcdanko/MD2
microbe_directory/taxa_tree.py
taxa_tree.py
py
7,927
python
en
code
16
github-code
50
21119742709
import numpy as np import os import sys import itertools import pickle from typing import MutableMapping import pandas as pd from tqdm import tqdm import string try: import ntpath except ImportError as e: raise ImportError("Import dependency not met: %s" % e) import inspect import errno # FNA imports from fna...
zbarni/re_modular_seqlearn
src/utils/parameters.py
parameters.py
py
31,563
python
en
code
1
github-code
50
35933395089
import sys from PyQt5.QtWidgets import QApplication, QDialog, QPushButton, QSlider, QVBoxLayout, QWidget, QFileDialog, QLabel, \ QTableWidgetItem from PyQt5.QtGui import QPixmap, QImage, QColor, qRgb, QTransform from PyQt5.QtCore import Qt from PyQt5 import uic, QtCore from PIL import Image, ImageEnhance, ImageFilt...
Sofi-s/projectQT
csv_table.py
csv_table.py
py
2,148
python
en
code
0
github-code
50
24616134687
from copy import deepcopy from queue import Queue from typing import Set, Dict, Tuple, List, FrozenSet from pulp import pulp, PULP_CBC_CMD from pip._vendor.colorama import Fore, Style from agbs.abstract_domains.state import State from agbs.abstract_domains.symbolic_domain import substitute_in_dict, evaluate_with_cons...
caterinaurban/A-GBS
src/agbs/engine/agbs_interpreter.py
agbs_interpreter.py
py
20,949
python
en
code
2
github-code
50
73386469274
''' lab13_exercises.py You will write a class called MathQuiz. It will contain five (5) methods and simulate a student taking a basic math quiz. The __init__ method will have three parameters: self, the student name, and a file name. Assign the names to instance variables and create four more: a score set to 0,...
ksh1ng/python_Exercise
lab13_exercises.py
lab13_exercises.py
py
3,581
python
en
code
1
github-code
50
73144689435
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import shutil import unittest import git from gitenberg.local_repo import LocalRepo class TestLocalRepo(unittest.TestCase): relative_test_repo_path = './gitenberg/tests/test_data/test_repo' def setUp(self): git.Repo.init(self.relative_test_re...
gitenberg-dev/gitberg
gitenberg/tests/test_local_repo.py
test_local_repo.py
py
2,078
python
en
code
105
github-code
50
7257311945
import os import pandas as pd from sklearn.externals import joblib from settings import SAVE_MODEL_PATH, SAVE_PREDICTION_PATH, TESTING__DATA_PATH, TRAINING__DATA_PATH def read_dataframe(path, type='csv'): dir_path = os.path.abspath(os.path.dirname(__file__)) abs_path = os.path.join(dir_path, path) if typ...
ahmedezzeldin93/heyjobs
job_app/utils.py
utils.py
py
1,561
python
en
code
0
github-code
50
1156488675
def to_file_fasta(item, selection='all', structure_indices='all', output_filename=None, syntaxis='MolSysMT'): from molsysmt.tools.biopython_Seq import is_biopython_Seq from molsysmt.basic import convert if not is_biopython_Seq(item): raise ValueError if output_filename is None: raise...
uibcdf/MolSysMT
attic/form/biopython_Seq/to_file_fasta.py
to_file_fasta.py
py
498
python
en
code
11
github-code
50
25292007954
""" Train a simple GNN model on gamma data """ import numpy as np from matplotlib import pyplot as plt from gamma_gnn.dataset.gamma import GammaDataset from gamma_gnn.utils.loader import Loader from gamma_gnn.models import GNN from gamma_gnn.optimizers import Optimizer from gamma_gnn.losses import LossHandler from ga...
Neutron-Calibration-in-DUNE/NeutronCaptureGNN
examples/train_model.py
train_model.py
py
3,160
python
en
code
0
github-code
50
5321499180
# ITEMS AND DIALOG # This is the list of items, their value (which is slightly changed for each trader), and their description # template: {"name":"", "value":1, "desc":""}, ITEMS = [ {"name":"soggy cardboard", "value":1, "desc":"less than completely useless"}, {"name":"dry cardboard", "value":2, "desc...
jpsank/barter-game
params.py
params.py
py
10,966
python
en
code
0
github-code
50
10942550044
from flask import Flask, redirect, url_for, request,render_template from sqlalchemy.orm import sessionmaker from users import * import os from datetime import datetime from sqlalchemy import desc app = Flask(__name__) engine = create_engine(os.getenv("DATABASE_URL"), echo=True) Session = sessionmaker(bind = engine) se...
ashishk144/wp2
Day3/application.py
application.py
py
1,580
python
en
code
0
github-code
50
8964200296
''' Сформувати функцію для обчислення цифрового кореню натурального числа. Цифровий корінь отримується наступним чином: необхідно скласти всі цифри заданого числа, потім скласти всі цифри знайденої суми і повторювати процес до тих пір, поки сума не буде дорівнювати однозначному числу, що і буде цифровим коренем зад...
androshchyk11/lab10
2.py
2.py
py
1,643
python
uk
code
0
github-code
50
28014556955
from django.conf.global_settings import * # NOQA import hashlib import os import os.path import socket import sys import urlparse DEBUG = False TEMPLATE_DEBUG = True ADMINS = () INTERNAL_IPS = ('127.0.0.1',) MANAGERS = ADMINS APPEND_SLASH = True PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__fil...
ethnoua/ethnoua
src/ethnoua/conf/server.py
server.py
py
4,425
python
en
code
0
github-code
50
30537171697
import copy import asyncio import hashlib from itertools import count from typing import Optional import printer import conf_loader import exceptions from web_session import WebSession from tasks.login import LoginTask class User: _ids = count(0) __slots__ = ( 'id', 'name', 'password'...
yjqiang/YjMonitor
monitor/user.py
user.py
py
4,368
python
en
code
53
github-code
50
74679864475
import json # Read the JSON file with open('config.json') as f: data = json.load(f) # Print the JSON data in a stylish format print('## Configuration') for key, value in data.items(): print('* {}: {}'.format(key, value))
LearnerMN/Algorithm-Problems
uploader.py
uploader.py
py
232
python
en
code
1
github-code
50
14349367715
import sys input = sys.stdin.readline T = int(input()) def oneAndTwo(n): return n // 2 + 1 for _ in range(T): n = int(input()) answer = 0 for i in range(n // 3 + 1): answer += oneAndTwo(n - 3*i) print(answer)
Ohjintaek/Algorithm
Baekjoon/15989.py
15989.py
py
239
python
en
code
0
github-code
50
41630766675
import requests import csv import os from bs4 import BeautifulSoup from unicodedata import normalize from pathlib import Path csvFileName = "alkohol.csv" txtFileName = "alkohol.txt" category = Path(txtFileName).stem def getData(url): headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-...
Qlanowski/padt
swiadomezakupy/SwiadomeZakupyScrapper.py
SwiadomeZakupyScrapper.py
py
3,098
python
en
code
0
github-code
50
17060508538
import pygame import pygame.gfxdraw import sys import time import random # the Label class is this module below from label import * pygame.init() pygame.mixer.init() #hit = pygame.mixer.Sound("sounds/hit.wav") screen = pygame.display.set_mode((800, 800)) clock = pygame.time.Clock() buttons = pygame.sprite.Gro...
Gravery/anime-selector
example.py
example.py
py
8,260
python
en
code
0
github-code
50
9774737646
class DictTrafo(object): def __init__(self, trafo_dict=None, prefix=None): if trafo_dict is None: trafo_dict = {} self.trafo_dict = trafo_dict if type(prefix) is str: self.prefix = (prefix,) elif type(prefix) is tuple: self.prefix = prefix ...
cnvogelg/amitools
amitools/vamos/cfgcore/trafo.py
trafo.py
py
1,867
python
en
code
235
github-code
50
71623147035
# -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore class MyTextPassage(QtGui.QGraphicsWidget): def __init__(self, text, headline, width, font, parent=None): QtGui.QGraphicsWidget.__init__(self, parent) self.text = text self.headline = headline self.font = font self.la...
CrazyCrud/interactiondesign-python
drill4_interaction_techniques/MyTextPassage.py
MyTextPassage.py
py
907
python
en
code
1
github-code
50
13142596165
import os from pkg_resources import resource_filename from click.testing import CliRunner import pandas as pd from qupid.cli.cli import qupid def test_cli(): runner = CliRunner() metadata_fpath = resource_filename("qupid", "tests/data/asd.tsv") metadata = pd.read_table(metadata_fpath, sep="\t", index_c...
gibsramen/qupid
qupid/tests/test_cli.py
test_cli.py
py
1,257
python
en
code
11
github-code
50
21037477056
"""SansaCloud URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-ba...
SeniorZas/UniProjects
Uni Projects/SansaCloud-master/SansaCloud-master/SansaCloud/urls.py
urls.py
py
2,384
python
en
code
0
github-code
50
33862856363
# using recursion -> backtacking # time complexity: O(n^2) # space complexity: O(n) class Solution: def letterCasePermutation(self, S: str) -> List[str]: res = [] def dfs(i, path): if i == len(S): res.append(path) return if S[i].isalpha(): ...
mykoabe/Competetive-Programming
PostCampProgress/Week1/5_letter_case_permutation.py
5_letter_case_permutation.py
py
509
python
en
code
1
github-code
50
41024672008
"""This module contains a helper for getting the sorting arguements figured out""" def get_sort_keys(given, allowed): """Check the list of given values and coerce them into the sort keys for mongo""" keys = [] for key in given: asc = True if key[0] == ' ' or key[0] == '+': a...
raghavach/beerAPI_raghu
beerpi/sort.py
sort.py
py
543
python
en
code
0
github-code
50
7566053894
class Catalog: class Products: products = {'css': '.product-layout'} product_image = {'css': products['css'] + ' .image'} product_name = {'css': products['css'] + ' .caption h4'} class Buttons: button_group = {'css': '.button-group'} add_to_cart_button = {'css': button_g...
maslovaleksandr/opencart_tests
locators/Catalog.py
Catalog.py
py
1,284
python
en
code
0
github-code
50