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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
31224847324 | import numpy as np
import math
from matplotlib import pyplot as plt
import pandas as pd
import datetime
import glob
##---------------------define the dates and wl---------------------
day='20180928'
Case='4'
# ##---------------------convert the date to doy---------------------
date = pd.to_datetime(day, format='%Y%m%... | katiabarros/uni_leipzig_programs | LEIPSIC_weight_and_plot.py | LEIPSIC_weight_and_plot.py | py | 1,524 | python | en | code | 0 | github-code | 90 |
70291253738 | __author__ = "Alien"
# JSON模块,数据存储
import json # 导入json模块
number = [1,2,3,4,5] # 创建要导入的列表
filename = 'number.json' # 指定json文件,通常以.json结尾
with open(filename,'w') as file:
json.dump(number,file) # 用json.dump()写入列表到文件
| Big-Belphegor/python-stu | Day11/number_writer.py | number_writer.py | py | 371 | python | zh | code | 0 | github-code | 90 |
18487909839 | N, M = map(int, input().split())
max_ = 1
for n in range(int(M / N) + 1, 0, -1):
d = (M - N * n)
if d >= 0 and d % n == 0:
max_ = n
break
print(max_)
| Aasthaengg/IBMdataset | Python_codes/p03241/s001888830.py | s001888830.py | py | 178 | python | en | code | 0 | github-code | 90 |
4500168077 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
sys.path.append('./')
import numpy as np
import torch
from vdn_.networks import VDN
from skimage.measure import compare_psnr, compare_ssim
from skimage import img_as_float, img_as_ubyte
from vdn_.utils import load_state_dict_cpu
from matplotlib import pyplot as pl... | stephenysh/NACPA-1 | nac_offline_3/real_world_noise_estimator.py | real_world_noise_estimator.py | py | 1,813 | python | en | code | 0 | github-code | 90 |
39361973433 | from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from .models import *
from .forms import AddMovieForm
# Create your views here.
def home(request):
movies = Movie.objects.all()
context = {
'movies': movies,
}
return render(request, 'main/i... | prysykes/movie_site | main/views.py | views.py | py | 1,408 | python | en | code | 0 | github-code | 90 |
35571814698 | from aiohttp import web
import socketio
import sys
import asyncio
from module.game import Game
error=False
# creates a new Async Socket IO Server
sio = socketio.AsyncServer()
# Creates a new Aiohttp Web Application
app = web.Application()
# Binds our Socket.IO server to our Web App
# instance
sio.attach(app)
app.ro... | thecodacus/ai-in-a-box-flappy-bird | app.py | app.py | py | 1,545 | python | en | code | 0 | github-code | 90 |
25136922634 | #!/usr/bin/env python
import sys
def get_binary_data(path):
data = None
with open(path, "rb") as binary_file:
data = binary_file.read()
return data
escape_sequence = '%-12345X'
commands = [
escape_sequence + '@PJL JOB NAME = "Haxmas 2017"',
'@PJL ENTER LANGUAGE = PCL',
get... | mkienow-r7/haxmas-2017 | create_pjl_job.py | create_pjl_job.py | py | 491 | python | en | code | 0 | github-code | 90 |
12143014906 | # -*- coding: utf-8 -*-
# © 2020 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
class MagentoBackend(models.Model):
_inherit = "magento.backend"
default_user_id = fields.Many2one("res.users", "Comercial por defecto")
| Comunitea/CMNT_00056_2016_BT | project-addons/magento_sale_store/models/magento_model.py | magento_model.py | py | 291 | python | en | code | 0 | github-code | 90 |
38054891674 | # -*- coding:UTF-8 -*-
import re
import sys
import math
import json
import jieba
import random
import pandas as pd
from tqdm import tqdm
import numpy as np
from multiprocessing import Pool, cpu_count
from random import *
class DataProcessor:
def __init__(self, data_dir):
self.data_dir = data_dir
se... | zhouhao001832050/Medical_Entity_Link_Prompt | data_processor.py | data_processor.py | py | 14,259 | python | en | code | 1 | github-code | 90 |
2298846932 | import unittest, tempfile, os
import most_likely_tags as mlt
import transformation_based_learning as tbl
SENTENCES = [
[['The', 'AT'], ['victory', 'NN'], ['was', 'BEDZ'], ['the', 'NN'],
['first', 'OD'], ['of', 'IN'], ['the', 'AT'], ['season', 'NN'],
['for', 'IN'], ['the', 'AT'], ['Billikens', 'NPS'], ['a... | aduston/nlp | transformation_based_learning_test.py | transformation_based_learning_test.py | py | 4,608 | python | en | code | 0 | github-code | 90 |
7359947348 | from distutils.core import setup
from setuptools import find_packages
with open('README.md') as f:
readme = f.read()
with open('requirements/install_requires.txt') as reqs:
install_requires = reqs.read().split('\n')
with open('requirements/dependency_links.txt') as reqs:
dependency_links = reqs.read().sp... | funkyminh/archiprod | setup.py | setup.py | py | 840 | python | en | code | 0 | github-code | 90 |
41168545158 | from .system import System, load_dynamic_class, load_object
from .errors import TranslatableError, UserInputError
from .dict import deep_update
def caps_to_snake(txt: str, separator: str = "_") -> str:
new_s = txt[0].lower()
for x in txt[1:]:
if x.isupper():
new_s += separator
new_s... | dfo-meds/data-manager | src/pipeman/util/__init__.py | __init__.py | py | 351 | python | en | code | 0 | github-code | 90 |
21129785587 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_rhino
from compas_igs.rhino.diagramobject import DiagramObject
from compas_igs.rhino.forminspector import FormDiagramVertexInspector
__all__ = ['FormObject']
class FormObject(DiagramObject):
... | BlockResearchGroup/compas-IGS | src/compas_igs/rhino/formobject.py | formobject.py | py | 11,498 | python | en | code | 1 | github-code | 90 |
9069969665 | import os.path
from moviepy.editor import *
root_dir = 'D:/program/Anansi/'
video_output_dir = os.path.join(root_dir, 'outputs')
image_output_frames_dir = os.path.join(video_output_dir, 'simple_dino_puzzle')
video_output_path = os.path.join(image_output_frames_dir, 'video.mp4')
source_audio_path = os.path.j... | EhsanCode/scripts | Python/frames_to_video_with_audio.py | frames_to_video_with_audio.py | py | 932 | python | en | code | 0 | github-code | 90 |
5113821560 | #!/usr/bin/python
# -*- coding=utf-8 -*-
'''
Ident.py - Python 3.6.8
Run as:
python [-h] [-v] [--config_file] [path] [--show] [is_show]
input arguments:
path parse all bag file under the path
is_show 1 is show the fitting picture, 0 is not show
optional arguments:
-h ... | weizhenming-white/wzm-workspace | PycharmProjects/EasyWork/tools/ident.py | ident.py | py | 5,382 | python | en | code | 1 | github-code | 90 |
18104412679 | import math
def is_prime(num):
if num == 2:
return True
elif not num & 1:
return False
for i in range(3, math.ceil(math.sqrt(num))+1, 2):
if num % i == 0:
return False
return True
N = int(input())
nums = [int(input()) for _ in range(N)]
ans = len([num for num in ... | Aasthaengg/IBMdataset | Python_codes/p02257/s810201695.py | s810201695.py | py | 354 | python | en | code | 0 | github-code | 90 |
18228553489 | import sys
def input():
return sys.stdin.readline()[:-1]
def main():
S = input()[::-1] # 入力文字列を逆順で格納
counts = [0] * 2019
counts[0] = 1
num, d = 0, 1
for char in S:
num = num + int(char) * d
num = num % 2019
d = d * 10
d = d % 2019
counts[num] += 1 #余りの数... | Aasthaengg/IBMdataset | Python_codes/p02702/s627089639.py | s627089639.py | py | 540 | python | en | code | 0 | github-code | 90 |
1030065386 | """converts all raw data to format readable by R`s zoo lib
string example:
23 Feb 2005|43.72
R reading command:
data <- read.zoo("demo1.txt", sep = "|", format="%d %b %Y")
"""
import os
import pickle
data_dirs = ['wiki', 'sot', 'google', 'itjobs']
def convert():
for data_dir in data_dirs:
data_dir = o... | testlnord/trends | core/data2R.py | data2R.py | py | 1,015 | python | en | code | 3 | github-code | 90 |
13111320606 | import pandas as pd
import re
table1 = pd.read_html("https://www.tutorialrepublic.com/html-reference/html5-tags.php")[0]
table1["Tag"] = table1["Tag"].apply(lambda x: re.sub("<|>", "", x))
table1["Description"] = table1["Description"].apply(lambda x: x.split()[0])
table1["Check"] = table1["Description"]
table1["Check... | LuisGan-C/CSSwithPyCharmFree | scrapeCSSKeywords.py | scrapeCSSKeywords.py | py | 820 | python | en | code | 5 | github-code | 90 |
25449073005 | """Deployment Stage
"""
from typing import Dict, Any, Sequence
import aws_cdk as cdk
from constructs import Construct
from aws_cdk import Environment, IPolicyValidationPluginBeta1, PermissionsBoundary
from backend import Backend
class Deployment(cdk.Stage):
"""Deployment(cdk.Stage)
Args:
cdk (Stage)... | wahab-io/apigateway-private-integration-ecs | cdk/deployment.py | deployment.py | py | 1,053 | python | en | code | 0 | github-code | 90 |
35183601811 | """
Codigo que muestra el manejo de los operadores de asignación
"""
class tipoOperador:
# Aca se definen las variables o caracteristicas privadas de la clase
def __init__(self, valor1, valor2):
self.a = valor1
self.b = valor2
def igual(self):
print('El valor de a es {} y el de b es {}'... | oaor/python | MT/Ciclo1/Recursos para la semana 2.-20220428/tipoOperador.py | tipoOperador.py | py | 1,942 | python | es | code | 0 | github-code | 90 |
43664843703 | from flask import jsonify
from app import app
from data_access.database_models import Question, Category
@app.route('/api/categories', methods=['GET'])
def categories_get_all():
all_categories_in_db = Category.query.all()
all_categories = [category.format() for category in all_categories_in_db]
return js... | vgotra/FSND | projects/02_trivia_api/starter/backend/controllers/CategoriesController.py | CategoriesController.py | py | 832 | python | en | code | 0 | github-code | 90 |
326372070 | #!/usr/bin/env python
from itty import get, post, Redirect, run_itty
LOG = []
TEMPLATE = """
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Party Time</title>
</head>
<bo... | Kobold/firefox-form-test | main.py | main.py | py | 1,008 | python | en | code | 1 | github-code | 90 |
25762904391 | #!/usr/bin/env python
import time, sys
import subprocess
import argparse
proc = subprocess.Popen(['gnuplot', '-noraise'], stdin=subprocess.PIPE)
class PlotBuffer(object):
"""Buffer for holding incoming streaming data"""
def __init__(self):
self.buffer = []
def __getitem__(self, key):
return self.buffer[key... | sweenzor/depict | plotter.py | plotter.py | py | 1,634 | python | en | code | 2 | github-code | 90 |
32762542709 | # Array strats
# Sorting
# Auxillary array/map, only when O(1) is not neccesary
# Runner pointers
# Binary search if looking for something or O(lgN) time is needed
# 1.1
# O(N) time, N is chars in string, single pass
# O(N) space, 1 entry in map per character if all are unique
def isUnique(string: str) -> b... | kelr/practice-stuff | ctci/ch1.py | ch1.py | py | 12,165 | python | en | code | 0 | github-code | 90 |
4090682674 | __author__ = 'martinsolheim'
import os
path_dir = os.path.dirname(__file__)
filename = os.path.join(path_dir, "data/kilma_data_blindern.txt")
results = []
with open(filename, newline='\n') as inputFile:
for line in inputFile:
results.append(line.strip().split())
inputFile.close()
minValue = 100
date = "00... | MartinMekk/julekalender | fourth_of_december.py | fourth_of_december.py | py | 698 | python | en | code | 1 | github-code | 90 |
37119046053 | from LinkedList import LinkedList
# 翻转单链表
def reverseRecursion(node):
if (node is None or node.next is None):
return node
p = reverseRecursion(node.next)
node.next.next = node
node.next = None
return p
lst = LinkedList()
lst.add_last(1)
lst.add_last(3)
lst.add_last(5)
lst.add_last(7)
ls... | nanw01/python-algrothm | Python Algrothm Advanced/practice/080401reverserecursion.py | 080401reverserecursion.py | py | 424 | python | en | code | 1 | github-code | 90 |
73626267815 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import scrapy
from challenge16.items import Challenge16Item
class GithubSaveSpider(scrapy.Spider):
name = 'github_save'
@property
def start_urls(self):
url_list = [
'http://github.com/shiyanlou?tab=repositories',
'... | Yao-Phoenix/challenge | challenge16/challenge16/spiders/github_save.py | github_save.py | py | 1,229 | python | en | code | 0 | github-code | 90 |
40144967873 | # -*- coding: utf-8 -*-
"""
Created on Wed May 19 00:07:30 2021
@author: aditya01
"""
import pandas as pd
from scipy.interpolate import interp1d
import numpy as np
aFN='D:/_UF/UF_Students/Sierra/Sierra_Pastels/Spectra_ALL.csv'
oFN='D:/_UF/UF_Students/Sierra/Sierra_Pastels/Spectra_Mean.csv'
grpField='COLOR'
refFiel... | ufecodyn/minispect | AIM2021/1_combSpectra.py | 1_combSpectra.py | py | 1,111 | python | en | code | 1 | github-code | 90 |
11002637673 | # 负责 pynput 的按键转换
# 封装 keyTranslator ,负责key、char、vk的转换
from pynput._util.win32 import KeyTranslator
# ==================== 按键转换器 ====================
# 封装 keyTranslator ,负责key、char、vk的转换
class _KeyTranslatorApi:
def __init__(self):
self._kt = KeyTranslator()
self._layout, _layoutData = self._kt._... | hiroi-sora/Umi-OCR_v2 | UmiOCR-data/py_src/platform/win32/key_translator.py | key_translator.py | py | 1,751 | python | zh | code | 917 | github-code | 90 |
18533440779 | #import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
a0=int(input())
if a0!=0:
print(-1)
exit()
ab=0
ans=0
for i ... | Aasthaengg/IBMdataset | Python_codes/p03347/s458635207.py | s458635207.py | py | 479 | python | en | code | 0 | github-code | 90 |
2938857029 | import asyncio
from datetime import timedelta
from temporalio import activity, workflow
from temporalio.client import Client
from temporalio.common import RetryPolicy
from temporalio.worker import Worker
from custom_decorator.activity_utils import auto_heartbeater
# Here we use our automatic heartbeater decorator. ... | temporalio/samples-python | custom_decorator/worker.py | worker.py | py | 2,430 | python | en | code | 68 | github-code | 90 |
7106920648 | # import stuff
import sys
import pandas as pd
def get_context_pattern_top3(infile, motif_source):
'''
gets context from the union of top 3 epitope and paratope motifs.
motifs: XXX, X1X, XX, X2X
no longer top 3, we do 4 now
motif_source: motif or motif_partner
:return:
'''
df = pd.read_c... | GreiffLab/manuscript_ab_epitope_interaction | src/abdb_prepdata_sup_fig13.py | abdb_prepdata_sup_fig13.py | py | 3,686 | python | en | code | 20 | github-code | 90 |
21278838639 | from tensorflow.keras import Model
import tensorflow as tf
import numpy as np
import pkgutil
from io import StringIO
import tensorflow.keras.backend as K
import math
from functools import lru_cache
# Low Order Model:
# Coefficient of determination
def coeff_determination(y_pred, y_true): #Order of function inputs is ... | NREL/dw-tap | dw_tap/loadMLmodel.py | loadMLmodel.py | py | 10,670 | python | en | code | 1 | github-code | 90 |
11996487762 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import copy
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.or... | martinezjulio/sdnn | models/vgg.py | vgg.py | py | 8,493 | python | en | code | 5 | github-code | 90 |
18253957849 | n = int(input())
d = 'abcdefghijklm'
def conv(s):
s = list(map(lambda x: d[x], s))
return ''.join(s)
def dfs(s, k):
if len(s) == n:
print(s)
else:
for i in range(k):
dfs(s+d[i], k)
dfs(s+d[k], k+1)
dfs('a', 1)
| Aasthaengg/IBMdataset | Python_codes/p02744/s125463441.py | s125463441.py | py | 269 | python | en | code | 0 | github-code | 90 |
39335858911 | import tkinter as tk
from tkinter import ttk
from math import pi, sin, cos
import matplotlib.pyplot as plt
from random import randrange, uniform
import pickle
import os
import sys
from itertools import product
import re
#####
#Functions with:
# CORE - main calculation/etc used by the other functions
# RE... | Raging-Tiger/system_simulator_project | QS_v.1.3.py | QS_v.1.3.py | py | 58,246 | python | en | code | 1 | github-code | 90 |
9380903926 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
"""Main entry point into the Catalog service."""
import uuid
import webob.exc
from keystone import config
from keystone.common import manager
from keystone.common import wsgi
CONF = config.CONF
class Manager(manager.Manager):
"""Default pivot point for the Catalog... | termie/keystonelight | keystone/catalog/core.py | core.py | py | 1,751 | python | en | code | 13 | github-code | 90 |
2203876482 | class Solution(object):
def canCompleteCircuit(self, gas, cost):
"""
:type gas: List[int]
:type cost: List[int]
:rtype: int
"""
length = len(gas)
if length==1:
if(gas[0]>=cost[0]):
return 0
else:
... | zpyao1996/leetcode | gasstation.py | gasstation.py | py | 910 | python | en | code | 0 | github-code | 90 |
13906670371 | """
file: test_link_sort.py
author: Jarred Moyer
description: tester for functions in linked_insort.py
"""
from hw10 import linked_insort
from hw10 import linked_code
def read_file( fname ):
"""
Open a file of containing one integer per line,
prepend each integer to a linked sequence,
and re... | jam941/hw | hw10/test_link_sort.py | test_link_sort.py | py | 1,283 | python | en | code | 0 | github-code | 90 |
3187660507 |
import getopt
import sys
import os
import os.path
import xml.dom.minidom
import xml.dom
def usage():
print("""
usage:
unzeroradius.py -d [svg folder]
if a file has <circle r='0' replace with r='.00000000001'
""")
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "dir... | fritzing/fritzing-parts | scripts/unzeroradius.py | unzeroradius.py | py | 1,947 | python | en | code | 462 | github-code | 90 |
22530124415 | #!/usr/bin/env python
# coding: utf-8
# In[123]:
import json
with open('/Users/jameshayes/TEST996.json','r') as fd:
dataAPI = json.load(fd)
# In[124]:
x = 0
for data in dataAPI['STATION']:
if 'MINMAX' in data:
pass
else:
data['MINMAX'] = 'Missing'
... | jimhnws/jimhnws | process_Data_local_WPC.py | process_Data_local_WPC.py | py | 3,872 | python | en | code | 0 | github-code | 90 |
17997014429 | from collections import deque
N,M = map(int,input().split())
dic = {}
for i in range(M):
a,b,c = map(int,input().split())
a -= 1
b -= 1
if a not in dic:
dic[a] = []
dic[a].append([b,c])
lis = [[0] * N for j in range(N)]
lis[0][0] = 1
lmax = [0] * N
lmax[0] = 1
mcost = [-1 * float("... | Aasthaengg/IBMdataset | Python_codes/p03722/s840414060.py | s840414060.py | py | 1,041 | python | en | code | 0 | github-code | 90 |
10407230454 | from rico2coco.coco_components import (
get_annotations,
get_images,
get_info,
get_licenses,
)
def test_get_inf():
assert isinstance(get_info(), dict)
def test_get_licenses():
assert isinstance(get_licenses(), list)
def test_get_images():
image_data = next(get_images())
assert isin... | xrhd/rico2coco | rico2coco/tests/test_coco_components.py | test_coco_components.py | py | 670 | python | en | code | 1 | github-code | 90 |
6926225202 | def is_prime(n):
if n <= 1:
return False
elif n <= 3:
return True
elif n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
count = 0
n = 2
while True:
if is_prim... | karirogg/peulervaktin | peuler/p7.py | p7.py | py | 422 | python | en | code | 2 | github-code | 90 |
27642200417 | # _*_ coding:utf-8 _*_
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.feature_extraction import DictVectorizer
from sklearn.tree import DecisionTreeClassifier
from sklearn import feature_selection
def loadDataSe... | Manfestain/MLcombat | WithSklearn/feature_Selected.py | feature_Selected.py | py | 2,442 | python | en | code | 1 | github-code | 90 |
22158925940 | """SocketIO API definition."""
from typing import Dict
from . import socketio, log
from .player import get_user_id
from .game_rooms import find_user_room, game_rooms
from flask_socketio import disconnect, emit
@socketio.on("connect")
def on_connect() -> None:
"""Handle new SocketIO connection."""
log.info(
... | mephi13/inquisitors | server/src/inquisitors-server/socketio_api.py | socketio_api.py | py | 4,574 | python | en | code | 1 | github-code | 90 |
18016463129 | import sys
import numpy as np
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(input())
A = np.array(input().split(), np.int64)
A = np.sort(A)
Acum = np.cumsum(A)
ans = 1
for i in range(N-2,-1,-1... | Aasthaengg/IBMdataset | Python_codes/p03786/s943387946.py | s943387946.py | py | 463 | python | en | code | 0 | github-code | 90 |
1150539649 | import matplotlib.pyplot as plt
import numpy as np
from src.factory import Factory
from src.dataset import Dataset
def mining():
factory = Factory(image_shape=(224, 224))
factory.mining('training')
factory.mining('validation')
def show_info():
ds = Dataset(image_shape=(224, 224))
ds.print_datase... | sontuphan/floor-detection | test/dataset.py | dataset.py | py | 966 | python | en | code | 0 | github-code | 90 |
31003409060 | import tkinter as tk
from PyPDF2 import PdfFileWriter, PdfFileReader
import glob
import os
from tkinter import messagebox
def split(file):
inputpdf = PdfFileReader(file, "rb")
print(inputpdf)
for i in range(inputpdf.numPages):
output = PdfFileWriter()
output.addPage(inputpdf.getPage(i))
... | fdosoto/PDFApp_Tkinter | split.py | split.py | py | 1,563 | python | en | code | 0 | github-code | 90 |
23181569785 | # coding=utf-8
'''
Created on 2013-10-22
@author: maisonwan
'''
from Arguments import LoadArgument
import sys
if __name__ == '__main__':
load = LoadArgument()
try:
args = load.parse_argv(sys.argv)
except:
sys.exit(-1)
finally:
load.__del__() | lunabox/system_event_logger | Logger.py | Logger.py | py | 299 | python | en | code | 0 | github-code | 90 |
20360079818 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 8 20:53:01 2021
@author: divxd
"""
#Day 001 - 05 - Variables
a = input("a: ")
b = input("b: ")
c = b
b = a
a = c
print("a: " + a)
print("b: " + b)
| divx89/100DaysOfCode-Python | Day001-21209-Working_With_Variables/05-Variables.py | 05-Variables.py | py | 198 | python | en | code | 1 | github-code | 90 |
1342263940 | import base64, json, requests, sys
# Globals.
g_sess = requests.Session()
# Report a fatal error in context associated with an HTTP response.
def _failed(resp, reason):
req = resp.request
raise RuntimeError(f"A {req.method} request to {req.url} failed: "
f"{reason}. Response was: {vars(resp)}... | burrmill/burrmill | lib/functions/delete_untagged_images/main.py | main.py | py | 7,201 | python | en | code | 22 | github-code | 90 |
23383282128 | """
Programme réalisé par Abid, Yassine, 1g8
"""
from tkinter import*
import pygame
#initialisation graphique
pygame.init()
key=1
fenetre = pygame.display.set_mode((1200, 768))
pygame.display.set_caption("jeu d'aventure")
font = pygame.font.Font('freesansbold.ttf', 30)
image12=pygame.image.load("intro.pn... | YABID99/nsi-jeu-Yassine-c-est-lui- | jeu yass nsi/jeux yass (c'est luimais vraiment oui oui).py | jeux yass (c'est luimais vraiment oui oui).py | py | 5,264 | python | fr | code | 0 | github-code | 90 |
18356592109 | N = int(input())
s = []
for i in range(N):
tmp = list(input())
tmp.sort() # ソート
s.append(''.join(tmp)) # 文字列の結合
s.sort()
i, j = 0, 1
count = 0
total = 0
while j < N:
while s[i] == s[j]:
count += 1
j += 1
if j == N:
break
if count >= 1:
tmp1, tmp2 = 1, 2
for k in range(count+1,... | Aasthaengg/IBMdataset | Python_codes/p02947/s335701246.py | s335701246.py | py | 441 | python | en | code | 0 | github-code | 90 |
18028920519 | n = int(input())
mod = 10 ** 9 + 7
# 素因数分解 - 試し割り法
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
... | Aasthaengg/IBMdataset | Python_codes/p03828/s341457625.py | s341457625.py | py | 700 | python | en | code | 0 | github-code | 90 |
29568014454 | # bootsmooth
# data.py module
import logging
# simple wrapper for simpljson
from django.utils import simplejson
def json_error(p_err):
return simplejson.dumps({'error': p_err})
def json_success(p_err):
return simplejson.dumps({'success': p_err})
def json_dump(p_obj):
return simplejson.dumps(p_obj)
def fromE... | maxstr/io15Hackathon | webapp/bootsmooth/data.py | data.py | py | 1,577 | python | en | code | 1 | github-code | 90 |
38957981236 | '''A Python module for reading and writing C3D files.'''
from __future__ import unicode_literals
import sys
import io
import copy
import numpy as np
import struct
import warnings
import codecs
PROCESSOR_INTEL = 84
PROCESSOR_DEC = 85
PROCESSOR_MIPS = 86
class DataTypes(object):
''' Container defining different d... | EmbodiedCognition/py-c3d | c3d/c3d.py | c3d.py | py | 94,819 | python | en | code | 94 | github-code | 90 |
20524710434 | from urllib import request
sample_url = "https://bragland.wikispaces.com/file/view/Tuesdays+with+Morrie+full+text.pdf"
def download_data(url):
response = request.urlopen(url)
csv = str(response.read())
lines = csv.split("\\n")
saved_file = "goog.txt"
fr = open(saved_file, "w")
for line in lines... | prajjwalsinghzz14/hello-world | download_from_urls.py | download_from_urls.py | py | 395 | python | en | code | 0 | github-code | 90 |
34715856621 | # Errors
# with open("a_file.txt") as file:
# file.read()
# KeyError
# a_dicitonary = {"key":"value"}
# value = a_dicitonary["non_existent_key"]
# IndexError
# fruit_list = ["Apple", "Banana", "Pear"]
# fruit = fruit_list[3]
# TypeError
# text = "abc"
# print(text + 5)
########### example 1: try / except / else... | hao134/100_day_python | day30_errors_exceptions_and_json_data_improving_the_password/main.py | main.py | py | 2,931 | python | en | code | 2 | github-code | 90 |
17970353839 | input()
numbers = tuple(map(int, input().split(' ')))
n_4_multiples = 0
n_2_multiples = 0
n_other = 0
for n in numbers:
if n % 4 == 0:
n_4_multiples += 1
elif n % 2 == 0:
n_2_multiples += 1
else:
n_other += 1
if n_2_multiples > 0:
n_other += 1
if n_other - n_4_multiples <= 1... | Aasthaengg/IBMdataset | Python_codes/p03637/s791076778.py | s791076778.py | py | 361 | python | en | code | 0 | github-code | 90 |
17277068210 | from django.urls import path, include
from .views import *
app_name="analyze"
urlpatterns = [
path('crawl',crawl,name="crawl"),
path('analyze',analyze,name="analyze"),
path('modify',modify,name="modify"),
path('URL_detail/<int:id>',URL_detail,name="URL_detail"),
path('URL_delete/<int:id>',URL_dele... | DGUFARM/URL_FARM | analyze/urls.py | urls.py | py | 579 | python | en | code | 0 | github-code | 90 |
7032692636 | import abc
from ..elements import StateUnit
from .transition_base import TransitionBase
from ..exceptions import InvalidElementException
from ..utils import ListUtils
class StateBase(StateUnit, metaclass=abc.ABCMeta):
def add_transition(self, transitions):
for transition in ListUtils.to_list(transitions)... | wafec/wafec-py-fsm | PyFSM/pyfsm/uml/state_base.py | state_base.py | py | 1,288 | python | en | code | 0 | github-code | 90 |
71225021416 | # -*- coding: utf-8 -*-
"""
@date: 2022/7/27 下午2:22
@file: accuracy.py
@author: zj
@description:
"""
import torch
import numpy as np
from .functional import accuracy
from ...utils.logger import LOGGER
from ...utils.misc import colorstr
__all__ = ['Accuracy']
class Accuracy:
def __init__(self, batch_rank_la... | zjykzj/SimpleIR | simpleir/metric/impl/accuracy.py | accuracy.py | py | 990 | python | en | code | 8 | github-code | 90 |
73690115178 | from django.urls import path
from .views import *
urlpatterns = [
path('', Products.as_view(), name='product'),
path('create', CreateProduct.as_view(), name='create_product'),
path('update/<int:pk>', UpdateProduct.as_view(), name='update_product'),
path('delete/<int:pk>', DeleteProduct.as_view(), name... | JuanPabloGHC/djangoE-COMMERCE | products/urls.py | urls.py | py | 341 | python | en | code | 0 | github-code | 90 |
41332847820 | from functools import reduce
# Your number list
numbers = [1, 2, 3, 4, 5]
# Using reduce to get the sum of the numbers
result = reduce(lambda x, y: x + y, numbers)
print(result)
# reduce kya karega ke sabse pehle 1+2=3,then 3+3=6, then 6+4=10, then 10+5=15.
'''from functools import reduce
import operator
# Your nu... | rohit9098singh/python_programming | ch23_3_reduce.py | ch23_3_reduce.py | py | 476 | python | en | code | 0 | github-code | 90 |
16089220548 | import math
import matplotlib.pyplot as plt
import numpy as np
from methods.method import Method
class Cordas(Method):
def solve(self):
a = self.a
b = self.b
epsilon = self.episolon
func = self.func
fda = func(a)
fdb = func(b)
x = (a * fdb - b * fda) / (fdb... | alissonpeloso/UFFS | Semestre_7/Calculo_numerico/1.zeros_de_funcoes/methods/cordas.py | cordas.py | py | 871 | python | en | code | 4 | github-code | 90 |
18203896949 | # -*- codinf: utf-8 -*-
import math
N = int(input())
# 素因数分解
n = N
i = 2
f = {} # keyが素因数、valueが素因数の数
while i * i <= n:
count = 0
while n % i == 0:
count += 1
f[i] = count
n /= i
i += 1
if 1 < n:
f[n] = 1
if len(f) == 0:
print(0)
exit()
count = 0
for v in f.values():
d = 1
while v > 0:
... | Aasthaengg/IBMdataset | Python_codes/p02660/s084689743.py | s084689743.py | py | 415 | python | en | code | 0 | github-code | 90 |
18396576269 | # -*- coding: utf-8 -*-
n = int(input())
shop = []
for i in range(n):
s, p = input().split()
p = int(p)
shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}]
shop_sorted = sorted(shop, key=lambda x:x['val'])
for shop in shop_sorted:
print(shop['idx'])
| Aasthaengg/IBMdataset | Python_codes/p03030/s811534827.py | s811534827.py | py | 265 | python | en | code | 0 | github-code | 90 |
22016587122 | from tkinter import *
from PIL import Image,ImageTk
from random import randint, choices
#main fereastra
root= Tk()
root.title("Rock Scissors Paper") #titlu fereastra
root.configure(background= "purple") #schimb culoarea background-ului(pt mov cod ... | WetternekTeacaZaharia/Rock-Scissors-Paper | Rock_Scissors_Paper.py | Rock_Scissors_Paper.py | py | 4,584 | python | en | code | 0 | github-code | 90 |
18167891299 | n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i+1, n):
for k in range(j+1, n):
_lst = [l[i], l[j], l[k]]
if len(set(_lst)) == 3:
_max = max(_lst)
_lst.remove(_max)
if _max < sum(_lst):
... | Aasthaengg/IBMdataset | Python_codes/p02583/s448038607.py | s448038607.py | py | 361 | python | en | code | 0 | github-code | 90 |
39127523867 | import random
import uvicorn
from fastapi import FastAPI, APIRouter
from fastapi.responses import JSONResponse
from settingsConfig import PrettyJSONResponse
from helpers.database import databaseSession
from helpers.sqlQueries import SqlQueries
from helpers.logger import logger
app = FastAPI()
log = logger.getLogger... | LunexCoding/ItMegastar_TestTask | server.py | server.py | py | 4,403 | python | en | code | 0 | github-code | 90 |
18582393399 | #import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return... | Aasthaengg/IBMdataset | Python_codes/p03476/s079103726.py | s079103726.py | py | 1,008 | python | en | code | 0 | github-code | 90 |
2234886796 | import numpy as np
import pandas as pd
import plotly.express as px
from Dashboardfunctions.api_fun import *
import streamlit as st
##Overall Metrics
def avg_views(df):
'''
Returns average views. Works for both pages of dashboard
'''
return round(df["viewCount"].astype(int).mean())
def avg_subs(homepa... | samwong21/Data-Res-Aview | Dashboardfunctions/metrics_samviz.py | metrics_samviz.py | py | 3,775 | python | en | code | 0 | github-code | 90 |
13499442028 | from scipy.io import arff
import pandas as pd
from sklearn import preprocessing
from sklearn.impute import SimpleImputer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from pathlib import Path
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.... | sabinachang/code-smell-identification | model/nb.py | nb.py | py | 3,107 | python | en | code | 0 | github-code | 90 |
31106196727 | """
This code is a Python script for Webscraping the visa types from www.berlin.de, following by creation of YAML file per visa type.
It uses BeautifulSoup, requests and other libraries from Settings.py, Category_Files.py and Cleaning_Method.py.
After definition of section titles it runs a for loop over the categorie... | MykolaWauer/Mykobot | Additional_Steps/Data_Definition_YAML.py | Data_Definition_YAML.py | py | 5,551 | python | en | code | 1 | github-code | 90 |
24745463007 | import re
import numpy as np
import scipy as sp
import os, sys
import pickle
import pandas as pd
from scipy.interpolate import interp1d
import FormPars
#import ROOT
#from ROOT import TFile
#from ROOT import TTree
#from ROOT import TBranch
class MyHistorianData:
def __init__(self, SCPickleFile):
self.Re... | zachgreene/ElectronLifetime | PythonCodeELMCMC/HistorianData.py | HistorianData.py | py | 21,956 | python | en | code | 0 | github-code | 90 |
18496958999 | n,x = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
for i in range(n):
a[i] = abs(a[i] - x)
def gcd(x,y):
while y != 0:
x, y = y, x % y
return x
res = a[0]
for i in range(n):
res = gcd(res,a[i])
print(res) | Aasthaengg/IBMdataset | Python_codes/p03262/s218574532.py | s218574532.py | py | 245 | python | en | code | 0 | github-code | 90 |
21295804469 | SECRET_KEY = 'kEPiWoToNhvwmMrWeAs5'
PROPAGATE_EXCEPTIONS = True
# Database configuration
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:reprak11@localhost/goals_db'
SQLALCHEMY_POOL_RECYCLE = 60
SQLALCHEMY_TRACK_MODIFICATIONS = False
SHOW_SQLALCHEMY_LOG_MESSAGES = False
ERROR_404_HELP = False | Reprak11/Propositos-Comunidad-2021 | flask-backend/config/default.py | default.py | py | 304 | python | en | code | 0 | github-code | 90 |
10995883081 | # -*- coding: utf-8 -*-
# (c) Nano Nano Ltd 2019
from ..out_record import TransactionOutRecord
from ..dataparser import DataParser
WALLET = "Coinfloor"
def parse_coinfloor_trades(in_row):
if in_row[7] == "Buy":
return TransactionOutRecord(TransactionOutRecord.TYPE_TRADE,
... | 737147948/BittyTax | bittytax/conv/parsers/coinfloor.py | coinfloor.py | py | 2,676 | python | en | code | null | github-code | 90 |
34139161045 | import numpy as np
import scipy.signal as sig
import scipy.io as load_mat
from math import pi
import matplotlib.pyplot as plt
from src import xponder
plt.ion()
xp = xponder()
hr = 5
min_overlap_front = 0.2
min_overlap_back = 0.02
def pick_sb(p_series):
dB = 20 * np.log10(np.abs(p_series))
peak_i, _ = sig.... | nedlrichards/canope_gw_scatter | notebooks/time_separation.py | time_separation.py | py | 4,106 | python | en | code | 0 | github-code | 90 |
12865756038 | import base64
try:
from importlib.resources import files as resources_files
except ImportError:
from importlib_resources import files as resources_files
import json
import os
import re
import tempfile
from pathlib import Path
import nbformat
import pandas as pd
import pypandoc
import requests
from nbconvert im... | m-rossi/jupyter-docx-bundler | jupyter_docx_bundler/converters.py | converters.py | py | 13,070 | python | en | code | 38 | github-code | 90 |
18067018989 | s=input()
l=[]
for i in s:
if i=="0":
l.append("0")
elif i=="1":
l.append("1")
elif i=="B":
if l!=[]:
l.pop()
if l==[]:
print("")
else:
print("".join(l))
| Aasthaengg/IBMdataset | Python_codes/p04030/s587351177.py | s587351177.py | py | 181 | python | ja | code | 0 | github-code | 90 |
18193723369 | N = int(input())
a_list = list(map(int, input().split()))
all_xor = 0
res = []
for a in a_list:
all_xor ^= a
for a in a_list:
res.append(a ^ all_xor)
print(*res)
| Aasthaengg/IBMdataset | Python_codes/p02631/s459454232.py | s459454232.py | py | 173 | python | en | code | 0 | github-code | 90 |
18526610869 | N = int(input())
ans = 100000
for A in range(N+1):
num = 0
B = N-A
while A != 0:
num += A % 6
A = A//6
while B != 0:
num += B % 9
B = B//9
ans = min(ans,num)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03329/s965532722.py | s965532722.py | py | 222 | python | en | code | 0 | github-code | 90 |
18455758959 | #!/usr/bin/env python3
import sys, math, fractions, itertools, heapq
def solve(N: int, k: int, t: "List[int]", d: "List[int]"):
arr = sorted(zip(t, d), key=lambda x: x[1], reverse=True)
q = [] # ヒープ
v = set() # ネタの種類
s = 0 # 美味しさの合計
for t,d in arr[:k]:
s += d
if t in v:
... | Aasthaengg/IBMdataset | Python_codes/p03148/s172662407.py | s172662407.py | py | 1,485 | python | en | code | 0 | github-code | 90 |
9759742157 | #!/usr/bin/python3 -tt
"""This proggy parses given files for occurences of translatable strings if
some are found they are output in a xgettext style file."""
import sys
import os
from collections import defaultdict
class occurences:
def __init__(self, file, line):
self.line = line
self.file = ... | widelands/widelands | utils/confgettext.py | confgettext.py | py | 5,210 | python | en | code | 1,844 | github-code | 90 |
18115659569 | #!/usr/bin/env python3
"""
ソートテク関連の基本的な関数の詰め合わせ (命名は C++ STL algorithm による)
stable_partition(seq, func):
O(n)
空間計算量も O(n)
述語が True を返す全ての要素が、述語が False を返す全ての要素よりも前になるようにシーケンスを並び替える (破壊、安定)
nth_element(seq, k, begin, end):
O(n)
E = seq[k] とする
特定の要素 E よりも小さい全ての要素が E よりも前になり、 E 以上の全ての要素がEよりも後にな... | Aasthaengg/IBMdataset | Python_codes/p02272/s722617212.py | s722617212.py | py | 3,780 | python | ja | code | 0 | github-code | 90 |
13608048009 | #
# abc005 c
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.r... | mskt4440/AtCoder | abc005/c.py | c.py | py | 1,654 | python | en | code | 0 | github-code | 90 |
2545207734 | import pyautogui as pt
from isOnline import isLive
import moveclick as mc
import datetime
streamersMap = ['roshtein', 'ninja', 'xqc',
'GMHikaru', 'shroud']
connectedStreamers = []
dcStreamers = []
now = datetime.datetime.now()
if(pt.locateOnScreen('imagenesC/chromesessionbar.png') is None... | tomimacia/TwitchLog | app.py | app.py | py | 1,875 | python | en | code | 0 | github-code | 90 |
27984438202 | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy.interpolate import UnivariateSpline
from specutils import Spectrum1D
from astropy import units as u
from astropy.nddata import StdDevUncertainty
__all__ = ['trace', 'BoxcarExtract']
def _gaus(x, a, b, x0, sigma):
"... | jradavenport/pykosmos | kosmos/apextract.py | apextract.py | py | 14,682 | python | en | code | 2 | github-code | 90 |
86345522884 | from __future__ import print_function, division
import os
import time
import cv2
import numpy as np
import onnxruntime
import torch
from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision import models, transforms
from mnext import mnext
from utils import progress_bar
def softmax_np... | QFaceblue/Driving-Behavior-Recognition | model_test.py | model_test.py | py | 10,781 | python | en | code | 3 | github-code | 90 |
22572513435 | import random
from . import cfg as ewcfg
from ..model.weapon import EwWeapon
from ..utils import core as ewutils
def get_weapon_type_stats(weapon_type):
types = {
"normal": {
"damage_multiplier": 1.1,
"cost_multiplier": 1,
"crit_chance": 0.2,
"crit_multipli... | mudkipslaps/endless-war | ew/static/weapons.py | weapons.py | py | 104,424 | python | en | code | null | github-code | 90 |
18682848761 | # -*- coding: utf-8 -*-
import simple_draw as sd
# На основе кода из lesson_004/05_snowfall.py
# сделать модуль snowfall.py в котором реализовать следующие функции
# создать_снежинки(N) - создает N снежинок
# нарисовать_снежинки_цветом(color) - отрисовывает все снежинки цветом color
# сдвинуть_снежинки() - сдвигае... | Vndanilchenko/python_developer | lesson_006/02_snowfall_module.py | 02_snowfall_module.py | py | 2,680 | python | ru | code | 0 | github-code | 90 |
38611716444 | import numpy as np
import pybullet as p
import math
from plyfile import PlyData, PlyElement
def get_point_parameters(curr, final, step, total):
inst = np.array(curr[:9]) + (step / total) * (np.array(final) - np.array(curr[:9]))
return inst
init_camera_vector = (0, 0, 1) # z-axis
init_up_vector = (0, 1, 0) # y-a... | nicholasmullikin/robotic-sink-cleaner | utils.py | utils.py | py | 3,270 | python | en | code | 0 | github-code | 90 |
39993174015 | from os.path import basename, splitext
from urllib.parse import urljoin
import json
import asyncssh
from aiohttp import FormData
async def get_experiment_nodes(session, url, auth, exp_id):
""" Get experiment nodes"""
async with session.get(
urljoin(url,
'experiments/{}/nodes'.format(ex... | iot-lab/iot-lab-monkey | iotlabmonkey/scenario_test.py | scenario_test.py | py | 2,363 | python | en | code | 1 | github-code | 90 |
18452794579 | n=int(input())
l=[]
for i in range(n):
a,b=map(int,input().split())
l.append((a+b,a,b))
l.sort(reverse=True)
k=0
x=0
y=0
while k<n:
if k%2==0:
x+=l[k][1]
else:
y+=l[k][2]
k+=1
print(x-y) | Aasthaengg/IBMdataset | Python_codes/p03141/s477240669.py | s477240669.py | py | 222 | python | en | code | 0 | github-code | 90 |
74101009896 | #
# @lc app=leetcode.cn id=198 lang=python3
#
# [198] 打家劫舍
#
# @lc code=start
class Solution:
def rob(self, nums: List[int]) -> int:
size = len(nums)
if size == 0:
return 0
elif size == 1:
return nums[0]
elif size == 2:
return nums[0]if nums[0] ... | Foabo/leetcode | 198.打家劫舍.py | 198.打家劫舍.py | py | 738 | python | en | code | 0 | github-code | 90 |
18022020669 | from itertools import product
MAX = 10**4
N, Ma, Mb = map(int, input().split())
chems = [tuple(map(int, input().split())) for _ in range(N)]
chems = sorted(chems, key=lambda x: x[2])
rng = range(401)
dp = [[[None for _ in rng] for _ in rng] for _ in range(N+1)]
dp[0][0][0] = MAX
for i, (a, b, c) in enumerate(chems):
... | Aasthaengg/IBMdataset | Python_codes/p03806/s833913662.py | s833913662.py | py | 996 | python | en | code | 0 | github-code | 90 |
32454023844 | # -*- coding: utf-8 -*-
import os
from google.cloud import bigquery
from google.cloud.bigquery.client import Client
import pandas_gbq
import hyperopt
from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
from sklearn.model_selection import train_test_split
import numpy as np
from numpy import sqrt
import pandas as p... | NikiAY/predictive_ML | DOM/bigQ_xgb_eur_hyperopt.py | bigQ_xgb_eur_hyperopt.py | py | 6,755 | 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.