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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
38896568460 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 13:26:14 2019
@author: Xavier Tanguay
"""
def get_ei_db(ei_name) :
# =============================================================================
# # Modify to reach your own directory where all your ecospold files are stored.
# =========... | xtanguay/EoL_recycling_approaches | 02_Ecoinvent_import.py | 02_Ecoinvent_import.py | py | 1,867 | python | en | code | 1 | github-code | 90 |
20043687481 | def horizontal_search(list_of_lines, word):
for i in range(len(list_of_lines)):
line = list_of_lines[i]
if word in line:
return [i + 1, line.index(word) + 1, i + 1, line.index(word) + len(word)]
return False
def vertical_search(list_of_lines, word):
max_len_line = max([len(i) f... | dkarpelevich/checkio | ALICE_IN_WONDERLAND/hidden-word.py | hidden-word.py | py | 1,402 | python | en | code | 0 | github-code | 90 |
34865374964 | import random
import Crypto
from Crypto.Cipher import AES
class AESObject():
def __init__(self,key,mode=AES.MODE_CBC,IV=16 * '\x00'):
self.key=key
self.mode=mode
self.IV=IV
def decrypt_file(self,encrypted_data):
decryptor = AES.new(self.key, self.mode, IV=self.IV)
dec... | DS-KoolAid/tacocon_CTF_2020 | Crypto/File_Recovery/solution_files/dec.py | dec.py | py | 1,166 | python | en | code | 4 | github-code | 90 |
17274149562 | import pathlib
from typing import Tuple, Union
from src.shared.typings import BBox, GrayImage
from src.repositories.gameWindow.core import getLeftArrowPosition
from src.utils.core import cacheObjectPosition, hashit, locate, locateMultiple
from src.utils.image import convertGraysToBlack, loadFromRGBToGray
from .config i... | lucasmonstrox/PyTibia | src/repositories/chat/core.py | core.py | py | 4,535 | python | en | code | 214 | github-code | 90 |
36758303758 | import sys
import pymssql
import os
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
from PyQt5.uic import loadUi
from PyQt5.QtGui import QRegExpValidator, QIntValidator
from PymysqlUtil import PymysqlUtil
from CreateDocx import createdocx,printdocx
class WordDialog(QDialog):
def __init__(self):
... | zwx51/Make_Docx_by_Template | WordDialog.py | WordDialog.py | py | 3,675 | python | en | code | 2 | github-code | 90 |
34377400740 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 22:32:23 2017
@author: Andrei
"""
import numpy as np
import pandas as pd
import os
import json
def load_module(module_name, file_name):
"""
loads modules from _pyutils Google Drive repository
usage:
module = load_module("logger", "logger.py")
logger = ... | GoDriveCarBox/GDCB-4E-DEV | WORK/PersistentAnomalyDetector/batch_generator_test.py | batch_generator_test.py | py | 3,502 | python | en | code | 0 | github-code | 90 |
12898802535 | import os
import sys
import pwd
import getopt, sys
import pkg_resources
import time
import trio
import client as cli
from client import close, error, bpwait, bpresume, sent, stop, rmv
udb = {}
def get_udb (keys):
return cli.get_db(udb, keys)
def update_udb (keys, val):
cli.update_db(udb, keys, val)
dsdict ... | jsa-aerial/aerobio | Support/py/aerobio/__main__.py | __main__.py | py | 6,702 | python | en | code | 7 | github-code | 90 |
26965651967 | import logging
from time import sleep
from decimal import Decimal
from selenium.common.exceptions import (
StaleElementReferenceException, TimeoutException, WebDriverException
)
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import... | jantman/biweeklybudget | biweeklybudget/tests/acceptance_helpers.py | acceptance_helpers.py | py | 15,378 | python | en | code | 87 | github-code | 90 |
5563457750 | from typing import Optional
from abstract_classes import TransportFactory
from skoda import SkodaFactory
from volvo import VolvoFactory
def client_code(brand: str) -> Optional[int]:
number_buses, number_trams, number_trolleys = 10, 5, 40
N = 200000 # орієнтований пробіг експлуатації
if brand == "Skoda"... | kristyko/SoftwareDesignPatterns | AbstractFactory/MunicipalTransport/MunicipalTransport.py | MunicipalTransport.py | py | 1,200 | python | en | code | 0 | github-code | 90 |
35433626705 | from typing import List
class Solution:
def countSquares(self, matrix: List[List[int]]) -> int:
res = 0
for i in range(len(matrix)):
for j in range(len(matrix[i])):
if matrix[i][j] == 1 and i >= 1 and j >= 1:
matrix[i][j] = min(matrix[i - 1][j], matr... | kateshostak/leetcode | count_square_submatrices_with_all_ones.py | count_square_submatrices_with_all_ones.py | py | 794 | python | en | code | 0 | github-code | 90 |
18022087919 | import numpy as np
N, ma, mb = map(int, input().split())
abc = tuple(map(int, input().split()) for _ in range(N))
inf = 10000
dp = np.full((401, 401), inf, dtype=int)
dp[0][0] = 0
for a, b, c in abc:
for i in range(400, a - 1, -1):
dp[i][b:] = np.minimum(dp[i][b:], dp[i - a][: - b] + c)
ans = inf
x = 1
... | Aasthaengg/IBMdataset | Python_codes/p03806/s919091078.py | s919091078.py | py | 493 | python | en | code | 0 | github-code | 90 |
15004386584 | import os
import xarray
from lib.plots import qq_plot
OUTPUT_DIR = 'output/'
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
scolors = ['c','royalblue','steelblue','blue','darkblue','cyan']
d = xarray.open_dataset('data/ECMWFifs_and_Obsv_StationPos_2017111300_2020082300.nc')
station = 0
forecast_index... | CENTEC-IST/wavefai | test_scripts/qqPlots.py | qqPlots.py | py | 708 | python | en | code | 0 | github-code | 90 |
39198502286 | def binary_search(arr, low, high, x):
if high >= low:
mid = (high + low) // 2
if arr[mid] == x:
return mid
elif arr[mid] > x:
return binary_search(arr, low, mid - 1, x)
else:
return binary_search(arr, mid + 1, high, x)
else:
return ... | kabbo06/automation | binary_search.py | binary_search.py | py | 789 | python | en | code | 0 | github-code | 90 |
684029165 | import click
class AliasedGroup(click.Group):
"""This class introduces iproute2-like behaviour,
command will be inferredby matching patterns.
If there will be more than 1 matches - exception will be raised
Examples:
>> solar ch stage
>> solar cha process
>> solar res action run rabbitmq_... | Mirantis/solar | solar/cli/base.py | base.py | py | 803 | python | en | code | 8 | github-code | 90 |
28747771511 | fin=open("cowjog.in")
fout=open("cowjog.out","w")
n=int(fin.readline().strip())
l=[]
for i in range(n):
l.append(list(int(x) for x in fin.readline().strip().split()))
l.sort(key=lambda x: x[0])
arr=[]
for i in l:
arr.append(i[1])
count=n
for i in range(len(arr)-1,0,-1):
if arr[i]<arr[i-1]:
arr[i-1]=... | SriramV739/CP | USACO/Contest/Bronze/2014December/cowjog.py | cowjog.py | py | 387 | python | en | code | 0 | github-code | 90 |
11034013833 | import logging
import time
from app import app, chunk_cleanup_queue, storage
from util.log import logfile_path
from workers.gunicorn_worker import GunicornWorker
from workers.queueworker import JobException, QueueWorker
logger = logging.getLogger(__name__)
POLL_PERIOD_SECONDS = 10
class ChunkCleanupWorker(QueueWo... | quay/quay | workers/chunkcleanupworker.py | chunkcleanupworker.py | py | 2,379 | python | en | code | 2,281 | github-code | 90 |
10231990406 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 22 11:42:14 2019
@author: Jolin
"""
from gensim.models import word2vec
import os
import json
cur=os.path.dirname(os.path.abspath(__file__))
doc_path=os.path.join(cur,'data/subtask1_training_afterrevise.txt')
txt_path=os.path.join(cur,'data/text.txt')
f1=open(txt_path,'... | MenglinLu/Chinese-clinical-NER | word2vec_bilstm_crf/gensim_word2vec.py | gensim_word2vec.py | py | 985 | python | en | code | 331 | github-code | 90 |
14867866465 | import yaml
# yaml文件数据的读取
def read_yaml_file(path):
f = open(path, 'r', encoding='utf-8')
data = yaml.load(f, Loader=yaml.FullLoader)
return data
if __name__ == '__main__':
print(read_yaml_file('../data/phone.yaml'))
| z8128747/20230601 | api_test/api_test1/read_yaml/read_yaml.py | read_yaml.py | py | 251 | python | en | code | 0 | github-code | 90 |
18555291649 | n=int(input())
a={}
for _ in range(n):
s=input()
if a.get(s):a[s]+=1
else:a[s]=1
m=int(input())
b={}
for _ in range(m):
s=input()
if b.get(s):b[s]+=1
else:b[s]=1
ans=0
for i in a:
ans=max(a[i]-b.get(i,0),ans)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03408/s496445816.py | s496445816.py | py | 233 | python | en | code | 0 | github-code | 90 |
16503058217 | from multidoc.util import jsonl_reader
from multidoc.dataset.dureader import DureaderExample
def test_char_preprocessing():
path = './data/search.train.json'
for example in jsonl_reader(path):
ex = DureaderExample( example )
if ex.illegal_answer_doc() or 'fake_answers' not in example or len(exa... | kumiko-oreyome/hqa_project | test/test_dureader.py | test_dureader.py | py | 1,683 | python | en | code | 0 | github-code | 90 |
485485652 | import tensorflow as tf
from keras.layers import LSTM, Dense
from keras.utils import to_categorical
from sklearn.model_selection import train_test_split
import os
import numpy as np
actions = np.array(["jab", "cross", "hook", "uppercut"])
DATA_PATH = os.path.join("/home/david/Documents/Projects/boxing/keypoints")
la... | daveyang-code/boxing | train.py | train.py | py | 1,564 | python | en | code | 0 | github-code | 90 |
38107236383 | # CreateCred.py
# Creates a credential file.
from cryptography.fernet import Fernet
import re
import ctypes
import time
import os
import sys
class Credentials:
def __init__(self, username="matthias.herzog", api_key="dd0c7925689fbf4f2083412497c30f9d2445",
customer_ID="5c7ef0e0b4132", expiry_time=... | jkleinau/aufmassConverterPy | createCred.py | createCred.py | py | 4,634 | python | en | code | 0 | github-code | 90 |
30606419018 | from user.utils import account_activation_token
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from celery import shared_task
from d... | aykhanmv/rentcar | user/tasks.py | tasks.py | py | 1,684 | python | en | code | 1 | github-code | 90 |
39714048707 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 14 21:41:01 2018
@author: diegosoaresub
"""
import pandas as pd
import numpy as np
class Limits:
BASE_RATE = 5.05
def __init__(self):
self.int_rate_table = {
'A': {'min': 1.06, 'max': 3.41},
'B': {'mi... | diegosoaresub/loan_negotiation | predict/WsPredict/limits.py | limits.py | py | 1,902 | python | en | code | 0 | github-code | 90 |
32811933801 | from .. import uuids
names = {}
for name, uuid in uuids.Service.__dict__.items():
names[uuid] = name
class ServiceError (Exception):
def __init__ (self, *args, **kw):
self.service = kw.pop("service")
self.status = kw.get("status")
super().__init__(*args)
def __str__ (self):
... | AMRC-FactoryPlus/acs-krb-keys-operator | lib/amrc/factoryplus/service_client/service_error.py | service_error.py | py | 725 | python | en | code | 0 | github-code | 90 |
294170000 | #import pandas
import numpy as np
import csv
import matplotlib.pyplot as plt
import matplotlib.cm as cm
##Data_pandas=pandas.read_csv("beer_reviews.csv",delimiter=",",index_col="brewery_id") Index premiere colonne
#Data_pandas=pandas.read_csv("beer_reviews.csv",delimiter=",")
#Labels_pandas=list(Data_pandas)
Data_cs... | WiemZou/PLDAC | Data_expl_User.py | Data_expl_User.py | py | 5,630 | python | fr | code | 0 | github-code | 90 |
10641037266 | from presentation_maker.data_objects import Presentation, Topic
from presentation_maker.presentation_genrating_stage.presentation_generation.BartLargeCnnGenerator import \
BartLargeCnnGenerator
from presentation_maker.presentation_genrating_stage.presentation_generation.BartLargeP2sGenerator import \
BartLargeP... | mekdad057/Edu-Presentation-Maker | presentation_maker/presentation_genrating_stage/presentation_generation/GenerationHandler.py | GenerationHandler.py | py | 2,750 | python | en | code | 0 | github-code | 90 |
2192145307 | import tensorflow as tf
from config import *
batch_norm = tf.contrib.layers.batch_norm
w_init = tf.contrib.layers.variance_scaling_initializer()
b_init = tf.constant_initializer(0.0)
def lrelu(x, leak=0.2, name="lrelu"):
with tf.variable_scope(name):
f1 = 0.5 * (1 + leak)
f2 = 0.5 * (1 - leak)
... | pianomania/LSGAN | model.py | model.py | py | 6,109 | python | en | code | 2 | github-code | 90 |
16084217140 | from utilities import *
from settings import *
class Menu:
def __init__(self, game, state):
self.state = state
self.current_option = 0
self.game = game
self.dim_screen = pygame.Surface(
self.game.screen.get_size()).convert_alpha()
self.dim_screen.fill((0, 0, 0, ... | sebwojtasik/Eventyr | gui.py | gui.py | py | 5,906 | python | en | code | 0 | github-code | 90 |
18154185749 | N, K = (int(i) for i in input().split())
l, r = [0]*K, [0]*K
for k in range(K):
l[k], r[k] = (int(x) for x in input().split())
# dp : マスiまで移動する方法のパターン数
# TLE
'''
import numpy as np
dp = [0]*N
dp[0] = 1
for i in range(N):
for k in range(K):
for j in range(l[k], r[k]+1):
if (i+j < N):
... | Aasthaengg/IBMdataset | Python_codes/p02549/s475774457.py | s475774457.py | py | 931 | python | en | code | 0 | github-code | 90 |
1275597825 | import speech_recognition as sr
import pyttsx3
from datetime import datetime
import wikipedia as wk
import pywhatkit as pw
import webbrowser
audio = sr.Recognizer()
maquina = pyttsx3.init()
def executa_comando():
try:
with sr.Microphone(1) as mic:
# Chama o algortmo de redução de ruidos no s... | PolicarpoDi/VirtualAssistantPython | app.py | app.py | py | 2,320 | python | pt | code | 0 | github-code | 90 |
2438831685 | # Converts a trained Keras model from an HDF5 file to Metal format.
#
# Keras stores the weights for each layer in this shape:
# (kernelHeight, kernelWidth, inputChannels, outputChannels)
#
# Metal expects weights in the following shape:
# (outputChannels, kernelHeight, kernelWidth, inputChannels)
import os
impo... | hollance/Forge | Examples/MNIST/Training/convert_h5.py | convert_h5.py | py | 2,109 | python | en | code | 1,269 | github-code | 90 |
72716354538 | import torch as pt
from torch import Tensor
from numpy import ndarray
from torch.utils.tensorboard.writer import SummaryWriter
from typing import Dict, Union
import mlflow
class Writer():
def __init__(self, outpath, name, phase):
self.w = SummaryWriter(outpath)
self.gstep = 0
self.gepoch =... | chenmoon2bird/byt0rch | iem_pytorch/utils/writer.py | writer.py | py | 4,147 | python | en | code | 0 | github-code | 90 |
73753066215 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.shortcuts import redirect
from django.utils import translation
from django.urls import include, path, re_path
from django.conf.urls.i18n import i18n_patterns
from django.views import defaults as defa... | guma44/brivo | config/urls.py | urls.py | py | 3,336 | python | en | code | 0 | github-code | 90 |
669841953 | #!/usr/bin/python3
import sys
import socket
import select
import json
import base64
import csv
import random
from common_comm import send_dict, recv_dict, sendrecv_dict
from Crypto.Cipher import AES
# Dicionário com a informação relativa aos clientes
users = {}
# return the client_id of a socket or None
def find_cl... | HDias19/AP1 | server.py | server.py | py | 8,948 | python | en | code | 0 | github-code | 90 |
8034981255 | def numIslands(grid):
islandNum = 0
if grid == None:
return 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] == '1':
islandNum+=1
print("count", islandNum)
flip(grid,i,j)
return islandNum
def flip(grid,i,j):
if(i<0 or j<0 or i>=le... | Gilgahex/codeInterviewPrep | numIslands.py | numIslands.py | py | 596 | python | en | code | 0 | github-code | 90 |
18434298139 | #!/usr/bin/env python3
(n,m,),*s=[[*map(int,i.split())]for i in open(0)]
s.sort()
ans = 0
for a,b in s:
if m<1:
break
if m > b:
ans += a*b
m -= b
else:
ans += m*a
m=0
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p03103/s525904637.py | s525904637.py | py | 230 | python | en | code | 0 | github-code | 90 |
18441466989 | import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
INF = 10**12
def main():
A, B, Q = in_nn()
tmp = list(map(int, read().split()))
s = [... | Aasthaengg/IBMdataset | Python_codes/p03112/s426080477.py | s426080477.py | py | 986 | python | en | code | 0 | github-code | 90 |
34963643356 | from rest_framework.response import Response
class InvalidWanikaniAPIKeyResponse(Response):
def __init__(self):
super().__init__()
self.status_code = 400
self.data = {
"error": "This Wanikani API Key is invalid! Check your settings page."
}
| Kaniwani/kw-backend | api/responses.py | responses.py | py | 291 | python | en | code | 71 | github-code | 90 |
11029795913 | import json
from contextlib import contextmanager
from app import app, notification_queue
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
from data import model
DEFAULT_BATCH_SIZE = 1000
def build_repository_event_data(namespace_name, repo_name, extra_data=None, subpage=None):
""... | quay/quay | notifications/__init__.py | __init__.py | py | 3,481 | python | en | code | 2,281 | github-code | 90 |
38599565637 | class Solution:
def largestRectangleArea(self, heights: List[int]) -> int:
'''time: O(N), space: O(N)'''
h = len(heights)
left, right = [-1 for _ in range(h)], [h for _ in range(h)]
for i in range(1, h):
p = i - 1
while (p >= 0 and heights[p] >= heights[i]):
... | YunjinPark/algorithms | leetcode/leetcode_0084_Largest_Rectangle_in_Histogram.py | leetcode_0084_Largest_Rectangle_in_Histogram.py | py | 673 | python | en | code | 0 | github-code | 90 |
23346706196 | import streamlit as st
import pandas as pd
import numpy as np
import pandas as pd
#import geoplot as gplt
#import geoplot.crs as gcrs
#import geopandas as gpd
import matplotlib.pyplot as plt
import networkx as nx
import osmnx as ox
import geojson
import pydeck as pdk
import time
st.set_page_config(
page_title="Ex-... | oliviapcs/mapbox_st | mapbox.py | mapbox.py | py | 6,123 | python | en | code | 0 | github-code | 90 |
1213014894 | import xlrd
from TestMain.operationExcel import OperationExcel
from xlutils.copy import copy # 写入Excel
from TestMain.res_data_config import *
class GetData:
def __init__(self, file_name=None):
# 初始化操作excel的对象
self.opExcel = OperationExcel(file_name)
self.prefix_url = "http://10.0.20.126/... | budaLi/Unittest | MyAutoTest/TestMain/get_data.py | get_data.py | py | 7,094 | python | en | code | 4 | github-code | 90 |
32935493648 | from cgitb import text
from random import expovariate
from timeit import repeat
import requests
import re
import string
from bs4 import BeautifulSoup
import time
import webbrowser
from sys import argv
from time import sleep
from origamibot import OrigamiBot as Bot
from origamibot.listener import Listener
print("Bot S... | mastero101/Bot_WebScraping | avisoBotv3.py | avisoBotv3.py | py | 3,730 | python | en | code | 0 | github-code | 90 |
35223615719 | import unittest
import numpy as np
from Orange.data import Table, DiscreteVariable, Domain
from Orange.classification import LogisticRegressionLearner, TreeLearner
class TestModelMapping(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.iris = iris = Table("iris")
tables = []
... | biolab/orange3 | Orange/classification/tests/test_base.py | test_base.py | py | 9,388 | python | en | code | 4,360 | github-code | 90 |
12757978417 | import argparse
parser = argparse.ArgumentParser(prog = 'PROG', description = 'Calculate box square')
parser.add_argument('-v','--verbose',type = int, choices = [0,1,2], help = 'choice display option')
parser.add_argument('lenght',type = int, help = 'the lenght of box')
args = parser.parse_args()
if __name__ == "_... | Locchuong96/others | argparse/prog19.py | prog19.py | py | 575 | python | en | code | 4 | github-code | 90 |
1281615355 | def leiaint(msg):
while True:
try:
i = int(input(msg))
except (ValueError, TypeError):
print('\033[0;31mERRO! Digite um número inteiro válido!\033[m')
continue
except (KeyboardInterrupt):
print('\033[31mO usuário preferiu não informar o... | PolicarpoDi/ExerciciosMundo3Python | ex113/leia.py | leia.py | py | 797 | python | pt | code | 0 | github-code | 90 |
41725824539 | # -*- coding: UTF-8 -*-
import numpy as np
from psydac.linalg.kron import KroneckerLinearSolver
from psydac.linalg.stencil import StencilVector
from psydac.linalg.block import BlockLinearOperator, BlockVector
from psydac.core.bsplines import quadrature_grid
from psydac.utilities.quad... | pyccel/psydac | psydac/feec/global_projectors.py | global_projectors.py | py | 35,773 | python | en | code | 40 | github-code | 90 |
6337674799 | #!/usr/bin/env python3
"""Dense block"""
import tensorflow.keras as K
def dense_block(X, nb_filters, growth_rate, layers):
"""Builds a Dense block"""
init = K.initializers.he_normal(seed=None)
for _ in range(layers):
bn1 = K.layers.BatchNormalization()(X)
activation1 = K.layers.Activatio... | luischaparroc/holbertonschool-machine_learning | supervised_learning/0x08-deep_cnns/5-dense_block.py | 5-dense_block.py | py | 920 | python | en | code | 6 | github-code | 90 |
27392675860 | import random
def dedupe(list):
seen = []
for i in list:
if i not in seen:
seen.append(i)
return seen
a = [random.randint(1,10) for i in range(20)]
print('原列表',a,'\n')
print('去重后',dedupe(a),'\n\n')
def dedupe(items,key=None):
seen=set()
for item in items:
value=item if k... | QWQ-ea/python-schoolwork | 小组实验三/1-2.py | 1-2.py | py | 739 | python | en | code | 1 | github-code | 90 |
23697721612 | import FWCore.ParameterSet.Config as cms
## Building Tag and probe muctrons
from HLTrigger.HLTfilters.hltHighLevel_cfi import *
hltHighLevel.throw = False
hltHighLevel.HLTPaths = ["HLT_IsoMu24"]
patMuonTrigger = cms.EDProducer("PATTriggerProducer",
processName = cms.string('HLT'),
triggerResults = cms.InputTa... | kopfa/TagProbe | python/Muon_TnP_Producer_cff.py | Muon_TnP_Producer_cff.py | py | 4,063 | python | en | code | 0 | github-code | 90 |
26307013383 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
Create csv files for each database table based on schema.py
Code from quiz submission in Lesson 13, Part 11
'''
import xml.etree.ElementTree as ET
import pprint
import re
import csv
import codecs
import cerberus
import schema
osmFile = "toronto_map_updated5.osm" #... | nabeelamerchant/dand-p4-data-wrangling | 5. convert_osm_to_csv.py | 5. convert_osm_to_csv.py | py | 7,817 | python | en | code | 0 | github-code | 90 |
8973503580 | import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
column1 = dbc.Col(
[
dcc.Markdown(
"""
# Information
Hi, my name is Emmett Boudrea... | emmettgb/Quake-Predictor | pages/process.py | process.py | py | 1,513 | python | en | code | 0 | github-code | 90 |
43789517134 | import util as u
import os
class ImageProcessingParameters():
# DOG,LOG,DOH - The minimum standard deviation for Gaussian Kernel. Keep this low to detect smaller blobs
min_sigma = 0
# DOG,LOG,DOH - The maximum standard deviation for Gaussian Kernel. Keep this high to detect larger blobs
max_sigma = 0
... | olpal/MushroomCNN | parameters.py | parameters.py | py | 4,251 | python | en | code | 0 | github-code | 90 |
36669019883 | #!/usr/bin/env python3
import sys
import simplejson as json
def main():
# loop through each line of stdin
for line in sys.stdin:
try:
# parse the incoming json
j = json.loads(line.strip())
# initialize output structure
output = dict()
... | VB1-VENOM/Big-Data | A1/Assignment1/mapper-2.py | mapper-2.py | py | 1,305 | python | en | code | 0 | github-code | 90 |
2334798626 | import torch
import random
import pandas as pd
from copy import deepcopy
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
import os
import numpy as np
tqdm.pandas()
random.seed(0)
class UserItemRatingDataset(Dataset):
"""Wrapper, convert <user, item, rating> Tensor into Pytorch Dataset"""
... | sleung852/tdc-product-recommendation | data.py | data.py | py | 9,712 | python | en | code | 0 | github-code | 90 |
4962699972 | import copy
import dismod_at
import at_cascade
# ----------------------------------------------------------------------------
# This routine is very similar to get_child_job_table in create_job_table.
# Perhaps there is a good way to combine these two routines.
#
# child_job_list =
def possible_child_job_list(
# all... | bradbell/at_cascade | at_cascade/avgint_parent_grid.py | avgint_parent_grid.py | py | 13,497 | python | en | code | 3 | github-code | 90 |
18671499649 | from django.contrib import admin
from .forms import dateform
from django_postgres_extensions.models.expressions import F
from OTP.models import Emails
from django_admin_listfilter_dropdown.filters import (
DropdownFilter, ChoiceDropdownFilter, RelatedDropdownFilter)
from django.db import models
from django.forms im... | khoji2001/Django-project | contract/admin.py | admin.py | py | 69,338 | python | en | code | 0 | github-code | 90 |
31676331467 | from asyncio import protocols
from django.http.response import JsonResponse, ResponseHeaders
from django.shortcuts import render
from django.core.files.base import ContentFile
from django.utils.text import slugify
from django.db.models import Min
from django.db.models.query import QuerySet
from rest_framework import v... | Bioprotocols/laboped | backend/editor/views.py | views.py | py | 5,609 | python | en | code | 4 | github-code | 90 |
23407475838 | from flask import request
from flask_limiter import Limiter
from utils import cfg, Console
from .flask_app import app
from .runtime_settings import unittest_mode
SHL = Console("RateLimiter")
def determine_ip():
if request.headers.get("X-Forwarded-For", request.remote_addr) == cfg.get("own_ip"):
return r... | FI18-Trainees/angular_todo | python/src/app/rate_limiter.py | rate_limiter.py | py | 754 | python | en | code | 1 | github-code | 90 |
18540668809 | import itertools
from collections import Counter
import math
N = int(input())
A = list(map(int, input().split()))
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
B = itertools.accumulate(A)
B = [0] + list(B)
C = Counter(B)
ans = 0
for v in C.values():
if ... | Aasthaengg/IBMdataset | Python_codes/p03363/s352671473.py | s352671473.py | py | 377 | python | en | code | 0 | github-code | 90 |
21466576274 | import turtle
turtle.addshape("face.gif")
turtle.shape("face.gif")
turtle.speed(10000)
dist1 = 200
dist2 = 75
dist3 = 30
angle = 45
for i in range(360):
turtle.right(i)
turtle.pendown()
turtle.forward(dist1)
turtle.right(angle)
turtle.forward(dist2)
turtle.right(2 * angle)
turtle.forward(dist3)
turtle.penup()
... | uri20-meet/meetyl1201819 | lab3.py | lab3.py | py | 354 | python | en | code | 0 | github-code | 90 |
2203677422 | class Solution(object):
'''
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if not prices:
return 0
length=len(prices)
low=[0]*length
clow=prices[0]
for i in range(length):
if prices[i]<clow:... | zpyao1996/leetcode | Best Time to Buy and Sell Stock.py | Best Time to Buy and Sell Stock.py | py | 977 | python | en | code | 0 | github-code | 90 |
38866206435 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#============================================================
# https://ps1images.stsci.edu/ps1image.html
# By Sophia Kim 2019.01.22. based on code PS1 suggests on the link above
# Pan-STARRS DR1 data query
# from https://michaelmommert.wordpress.com/2017/02/13/accessing-t... | SilverRon/imsngpy_old | query.py | query.py | py | 23,729 | python | en | code | 1 | github-code | 90 |
40133968464 | import os
def main():
software_name = os.getenv('softwareName')
command = os.getenv('command')
command_version = os.getenv('commandVersion')
with open("software", "a", encoding="UTF-8") as f:
f.write(software_name + "," + command + "," + command_version + "\n")
if __name__ == "__main__":
... | thesixonenine/Print-Software-Version | add_software_version.py | add_software_version.py | py | 573 | python | en | code | 0 | github-code | 90 |
5344341034 | #!/usr/bin/env python3
import torch.nn as nn
class APPNP(nn.Module):
'''
APPNP: ICLR 2019
Predict then Propagate: Graph Neural Networks Meet Personalized Pagerank
https://arxiv.org/pdf/1810.05997.pdf
'''
def __init__(self, nfeat, nhid, nclass, dropout=0.5, alpha=0.1):
super().__init__... | wang-chen/gnn-assignment | models/appnp.py | appnp.py | py | 1,031 | python | en | code | 0 | github-code | 90 |
18550463099 | S = input()
if S == "zyxwvutsrqponmlkjihgfedcba":
print("-1")
exit()
if len(S) < 26:
for i in range(26):
if not chr(ord("a") + i) in S:
print(S + chr(ord("a") + i))
exit()
else:
pop_list = []
S = list(S)
while True:
pop_chr = S.pop()
pop_list.appe... | Aasthaengg/IBMdataset | Python_codes/p03393/s542851928.py | s542851928.py | py | 542 | python | en | code | 0 | github-code | 90 |
72133335338 | #!usr/bin/python
# -*- coding: utf-8 -*-
from django.contrib import admin
from main.models import User, Comment
class UserAdmin(admin.ModelAdmin):
list_display = ('id', 'username', 'is_active', 'is_admin')
search_fields = ('username', )
ordering = ('-id', )
class CommentAdmin(admin.ModelAdmin):
lis... | lexifdev/filibuster | filibuster/apps/main/admin.py | admin.py | py | 609 | python | en | code | 0 | github-code | 90 |
35936508757 | from train import *
parser = argparse.ArgumentParser()
parser.add_argument('--missing_percentage', type = float, default = 0.5,
help ='missing percentage/100 data has missing value')
parser.add_argument('--data_variable_size', type=int, default=30,
help='the number o... | INPUTrrr0/DAG-VAE-Data-Imputation | main.py | main.py | py | 8,017 | python | en | code | 0 | github-code | 90 |
18166503259 | H, W, M = map(int,input().split())
Bomb = []
for _ in range(M):
hi, wi = map(lambda x: int(x) - 1, input().split())
Bomb.append((hi, wi))
counterH = [0] * H
counterW = [0] * W
for (hi, wi) in Bomb:
counterH[hi] += 1
counterW[wi] += 1
# 最大のところを選ぶ
max_h = max(counterH)
max_w = max(counterW)
count = 0
... | Aasthaengg/IBMdataset | Python_codes/p02580/s731284350.py | s731284350.py | py | 568 | python | en | code | 0 | github-code | 90 |
18214382569 | class book:
def __init__(self, C, A):
self.C = C
self.A = A
N, M, X = [int(i) for i in input().split()]
P = []
for i in range(N):
tmp = [int(i) for i in input().split()]
C = tmp.pop(0)
P.append(book(C, tmp))
learn = [0 for i in range(M)]
minc = 10**7
flag = 0
for i in range(2 ** N):
... | Aasthaengg/IBMdataset | Python_codes/p02683/s068355277.py | s068355277.py | py | 660 | python | en | code | 0 | github-code | 90 |
26889516814 | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self):
self.root = None
def insert(self, data):
node = Node(data)
if self.root is None:
self.root = node
else... | rodrigoney/ztm-coding | trees/binary_search_tree.py | binary_search_tree.py | py | 1,744 | python | en | code | 0 | github-code | 90 |
28989056367 | tilemap = [[0, 1, 2],
[10, 11, 12],
[20, 21, 22]]
mapdictionary = {tilemap[0][0]: "You are in a forest surrounded by trees",
tilemap[0][1]: "You now stand on the banks of a river",
tilemap[0][2]: "You swim across the river and find yourself on a beach",
... | SeizeTheFuture/textrpg | gamemap.py | gamemap.py | py | 904 | python | en | code | 0 | github-code | 90 |
69966726698 | import os
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
def ensure_directory_exists(dir):
if not os.path.isdir(dir):
os.makedirs(dir)
def save_test_val_acc_loss_plots(train_acc, val_acc, train_loss, val_loss):
output_dir = os.path.join(os.curdir, 'output')
ensure_director... | imosafi/FC_fashion_mnist | utils.py | utils.py | py | 1,322 | python | en | code | 0 | github-code | 90 |
72756266538 | """Main File"""
import pygame
import random
from fish import *
from seaweed import *
from bubbles import *
if __name__ == "__main__":
pygame.init()
screen = pygame.display.set_mode(
(0, 0), pygame.FULLSCREEN
) # add screen scaling when in window mode
screenX, screenY = screen.get_size()
... | L33tCr33p3r/AquariumSim | main.py | main.py | py | 3,351 | python | en | code | 0 | github-code | 90 |
14942188481 | from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from wind.models import StockData, KLine, DayData
# Create your views here.
from django.views import View
# 数据处理类
class Result:
def __init__(self,data):
self.status = 0
self.msg = ""
self. data = data
... | maotai1015/web1 | wind/views.py | views.py | py | 7,233 | python | en | code | 0 | github-code | 90 |
18297947419 | from bisect import bisect_right as br
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):a[i]*=-1
a.sort()
b=[0]
for i in a:b.append(b[-1]+i)
ng=2*10**5+7
ok=-1
while ok+1!=ng:
mid=(ng+ok)//2
co=0
for i in a:co+=br(a,-(mid+i))
if co<m:ng=mid
else:ok=mid
ans=0
co=0
for i in a:
in... | Aasthaengg/IBMdataset | Python_codes/p02821/s682757559.py | s682757559.py | py | 394 | python | en | code | 0 | github-code | 90 |
40448440301 | import codecs, locale, sys
# Inspired from http://kofoto.rosdahl.net/trac/wiki/UnicodeInPython
def get_file_encoding(f):
if hasattr(f, "encoding") and f.encoding:
e = f.encoding
else:
e = locale.getpreferredencoding()
if e == 'ANSI_X3.4-1968': # fancy name for ascii
# We're sure to... | hohlov/fretephone-applet | setencoding.py | setencoding.py | py | 1,350 | python | en | code | 1 | github-code | 90 |
21318018335 | def Display():
icnt = 0
for icnt in range(10,1,-1):
print(icnt)
if(icnt==2):
break
else:
print("displyaing if successfully terminated")
def main():
Display()
if __name__=='__main__':
main()
| jyotikawade/python_personal | 21_for_loop_2.py | 21_for_loop_2.py | py | 216 | python | en | code | 0 | github-code | 90 |
71177261097 | import base64
import subprocess
import setzer.document.build_system.builder.builder_build as builder_build
from setzer.app.service_locator import ServiceLocator
class BuilderBackwardSync(builder_build.BuilderBuild):
def __init__(self):
builder_build.BuilderBuild.__init__(self)
self.config_folde... | cvfosammmm/Setzer | setzer/document/build_system/builder/builder_backward_sync.py | builder_backward_sync.py | py | 2,182 | python | en | code | 362 | github-code | 90 |
2605574095 | #!/usr/bin/python3
from pwn import *
#context.log_level = 'DEBUG'
filename = './split32'
binary = ELF(filename)
cat_flag_addr = next(binary.search('/bin/cat flag.txt'))
system_plt = binary.plt['system']
p = process(filename)
p.recvuntil('> ')
p.sendline('A' * 44 + p32(system_plt) + 'JUNK' + p32(cat_flag_addr))
... | saullocarvalho/ropemporium-solutions | 1_split/32.py | 32.py | py | 362 | python | en | code | 0 | github-code | 90 |
27303330281 | import warnings
warnings.filterwarnings("ignore")
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import osmnx as ox
import geopandas as gpd
from shapely.geometry import Point
import pandas as pd
import numpy as np
from numpy import inf
import matplotlib.pyplot as plt
import cv2
from tensorflow.keras.preprocessing.ima... | ualsg/Global-road-network-patterns | morphoindex_generator_v2.py | morphoindex_generator_v2.py | py | 20,931 | python | en | code | 7 | github-code | 90 |
21044859598 | import pygame
import loader.asset as asset
import helper.misc as misc
from math import atan2, degrees
import loader.mapper as mapper
import defs.finals as finals
class GameObject:
def __init__(self, pos, xy, image, is_tile, group=None, animations=None):
self.animations = animations or {}
self.curre... | sjpau/sinsaw | entity/gameobject.py | gameobject.py | py | 5,321 | python | en | code | 0 | github-code | 90 |
21275621314 | from typing import List
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
ss = list([])
s = set(nums1) & set(nums2)
while len(s) > 0:
for i in s:
nums1.remove(i)
nums2.remove(i)
ss.append(i)
... | Yue-Du/Leetcode | 350.py | 350.py | py | 428 | python | en | code | 0 | github-code | 90 |
37559673505 | from data_structures.queue import Queue
import pytest
value_tuple = (u'a', 1, True, None, False, 0)
def test_init_queue():
u"""Test Queue init."""
q = Queue()
assert isinstance(q, Queue)
def test_enqueue():
u"""Asserts nodes are added and hold their own value."""
q = Queue()
for val in valu... | jefrailey/data-structures | tests/test_queue.py | test_queue.py | py | 924 | python | en | code | 0 | github-code | 90 |
9238764325 | # Define customer class to represent the customer participating in the survey
class Customer:
def __init__(self, name):
self.name = name
self.responses = {} # Dictionary to be used to store survey responses for each question
def collect_survey_response(self, question, answer):
s... | Popeydanielmate/python_survey_app | python survey_app.py | python survey_app.py | py | 2,001 | python | en | code | 0 | github-code | 90 |
18002913599 | # import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
A=int(input())
B=int(input())
print('GREATER' if A>B else 'LESS' if... | Aasthaengg/IBMdataset | Python_codes/p03738/s128460264.py | s128460264.py | py | 349 | python | en | code | 0 | github-code | 90 |
3873680447 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 5 05:54:31 2020
@author: gualteros
"""
x = []
x.append(1010101010)
x.append(1111111111)
x.append(1212121212)
x.append(1313131313)
x.append(1231231233)
x.append(3254235434)
print ("\n",x)
z = []
z.append(["Mariana Montoya",1234,"Administrador"])
z.a... | walter-agf/Practica_6 | Doc/Experimentos/tuplas.py | tuplas.py | py | 623 | python | en | code | 0 | github-code | 90 |
13865916714 | import tensorflow as tf
import cv2
import matplotlib.image as Image
import matplotlib.pyplot as plt
import tensorflow.contrib.slim as slim
import numpy as np
from OHEM import MSE_OHEM_Loss
from net import CRAFT_net
from text_utils import get_result_img
from datagen import procces_function, generator, normalizeMeanVari... | namedysx/CRAFT-tensorflow | craft.py | craft.py | py | 5,361 | python | en | code | 66 | github-code | 90 |
18470532439 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
S = input().strip()
ans = 0
b = 0
for s in S:
if s == "B":
b += 1
else:
ans += b
print(ans)
if __name__ == '__main__':
main()
| Aasthaengg/IBMdataset | Python_codes/p03200/s453947045.py | s453947045.py | py | 279 | python | en | code | 0 | github-code | 90 |
20649792815 | from django.urls import path
from . import views
urlpatterns = [
path('createList/', views.createList.as_view(), name='createList'),
path('getUserLists/', views.getUserLists.as_view(), name='getUserLists'),
path('addToListContent/', views.addToListContent.as_view(), name='addToListContent'),
path('remo... | PolMirasso/Django-WhereToWatch | UserList/urls.py | urls.py | py | 568 | python | en | code | 0 | github-code | 90 |
38933020730 | #!/usr/bin/env python
'''
Author: djs
Date: 2012-07-03
Description: Using the text of Ulysses by James Joyce attempt to train a Markov
chain to construct sentences. The results have been, shall we say, interesting?
>>> construct_sentence('This','world',M)
'This thing! Poor collar. Roman of purse silken where and say... | danshea/python | MarkovChains/trainer.py | trainer.py | py | 2,901 | python | en | code | 2 | github-code | 90 |
27003172088 | """
author:张鑫
date:2021/5/20 10:30
https://m.maoyan.com/ajax/movieOnInfoList?token=&optimus_uuid=14CF28D0B91311EB9B76EBFB0987B06C0389F1EE08884031AB2A42411C25D506&optimus_risk_level=71&optimus_code=10
https://m.maoyan.com/ajax/movieOnInfoList?token=&optimus_uuid=14CF28D0B91311EB9B76EBFB0987B06C0389F1EE08884031AB2A42411C... | zhangxin302/pythonProject | piblic_comments/films.py | films.py | py | 4,446 | python | en | code | 3 | github-code | 90 |
23194269197 | #Paper05
#How Open Source Projects use
#Static Code Analysis Tools in Continuous Integration Pipelines
import requests
from json import dump
from json import loads
token = '1baee390be22fca3b244974f0ed3b36bf2e8b2ab' #token gleison
dir = '/home/gleison/GraphQLStudy/FilesJson/Paper05_GraphQL'
headers = {"Authorization"... | gleisonbt/migrating-to-graphql | runtime_study/GraphQL/paper05.py | paper05.py | py | 1,834 | python | en | code | 1 | github-code | 90 |
42259006670 | from PyQt5.QtCore import QDir, Qt, QUrl
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import (QApplication, QFileDialog, QHBoxLayout, QLabel,
QPushButton, QSizePolicy, QSlider, QStyle, QVBoxLayout, QWidget)
from PyQt5.QtWi... | IvasheshinSergey/Unittest | Derevo/videoplayer.py | videoplayer.py | py | 3,961 | python | en | code | 0 | github-code | 90 |
11086910151 | import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from django.test import LiveServerTestCase
from selenium import webdriver
class MesonTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def... | mrlia/mesonDonRamon | fts/tests.py | tests.py | py | 1,963 | python | en | code | 0 | github-code | 90 |
41980408831 | # stworzyc system zarzadzania biblioteką, któy umożliwa dodawanie ksiązek, wypozyczanie oraz zwracanie ksiązek
# nalezy pamiętac jakie ksiazki posiadamyw bibliotece a jakie wypozyczone
# klasy Book, Library
# __repr_
# obsłuzyc błedy
# rozszerzenie user co wypożyczył ksiązce
class Book:
# autor, tytuł, isbn
... | rajkonkret/or-20-11-sr | 3.16 - kl16 - proj-rozszerz.py | 3.16 - kl16 - proj-rozszerz.py | py | 4,582 | python | pl | code | 0 | github-code | 90 |
31784482913 | #!/usr/bin/python3
"""
2-post_email.py
"""
import urllib.request
import urllib.parse
import sys
def request_with_parameter(the_url, the_email):
"""makes a request to input URL with email as a parameter"""
values = {'email': the_email}
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
... | johncoleman83/bootcampschool-higher_level_programming | 0x11-python-network_1/2-post_email.py | 2-post_email.py | py | 641 | python | en | code | 1 | github-code | 90 |
33171420101 | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
from collections import defaultdict
def show_image(img, label='image'):
cv.imshow(label, img)
cv.waitKey(0)
# smoothing using filter
def smooth(img, filter_type):
if filter_type == "mean":
return cv.blur(img, (5,5))
if filter_type == "gaus... | VictoriaTGu/sibs-d4d | src/utils.py | utils.py | py | 1,265 | python | en | code | 3 | github-code | 90 |
17106842316 | import sys
input = sys.stdin.readline
k, n = map(int, input().split())
dic = dict()
for _ in range(n):
stu_num = input().rstrip()
if dic.get(stu_num) == None:
dic[stu_num] = 1
else:
del dic[stu_num]
dic[stu_num] = 1
cnt = 0
for stu, times in dic.items():
if times > 1:
... | kyj098707/BOJ | boj/13. hash/13414.py | 13414.py | py | 388 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.