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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
74051998556 | import csv
import re
import json
INPUT_FNAME = "../webapp/schemas/uploader/v5 CSH Project - Data Specifications - Case Charge Data.tsv"
OUTPUT_FNAME = '../webapp/schemas/uploader/case-charge.json'
PKEY_REGEX = '\* Row identifier is a combination of (.*) and should be unique to each row'
DEFAULT_DATE_FORMAT = '%Y-%m-%d... | dssg/matching-tool | scripts/development/schema_convert.py | schema_convert.py | py | 2,465 | python | en | code | 7 | github-code | 50 |
74851067356 | from __future__ import division, absolute_import, print_function
from six import string_types
import warnings
from datetime import datetime, timedelta
import numpy as np
from math import sqrt, sin, cos, atan2
from astropy.io import fits
from astropy.wcs.wcs import WCS
import astropy.units as u
import astropy.coordinat... | esa/auromat | auromat/fits.py | fits.py | py | 16,299 | python | en | code | 17 | github-code | 50 |
3598408884 | # import dependencies
import sqlite3
import sys
# Create the connections
conn = sqlite3.connect('Sensors.db')
curs = conn.cursor()
# Print out data from table BME_DATA
for row in curs.execute("SELECT * FROM BME_DATA ORDER BY TIME_STAMP DESC LIMIT 2000"):
print (row)
conn.close() | slavisha84/ETL_PROJECT | Testing_DB.py | Testing_DB.py | py | 287 | python | en | code | 0 | github-code | 50 |
32710713295 | import abc
from abc import ABC
from minerl.herobraine.hero.handlers.translation import TranslationHandler
from minerl.herobraine.hero.handler import Handler
from minerl.herobraine.hero import handlers
from minerl.herobraine.hero.handlers import POVObservation, CameraAction, KeybasedCommandAction
from minerl.herobraine... | sihangw/minerl | minerl/herobraine/env_specs/human_controls.py | human_controls.py | py | 1,635 | python | en | code | null | github-code | 50 |
41535672559 | from typing import List, Tuple
SIZE_OF_FIELD = 4
def read_input() -> Tuple[int, List[List[str]]]:
buttons_count = int(input())
field = []
for _ in range(SIZE_OF_FIELD):
field.append(list(input()))
return buttons_count, field
def count_win_rounds(buttons_count: int, field: List[List[str]]) -... | and-volkov/yap.algorithms | sprint15/task2.py | task2.py | py | 896 | python | en | code | 0 | github-code | 50 |
73821537114 | import DataProcessing.ModuleReanalysisData as Mre
import DataProcessing.ModuleFeatures as Ml
folder_data_tot = './data/'
folderLUT = folder_data_tot
foldersaving=folder_data_tot+'Xy/'
pkl_inputfile = folder_data_tot+'tracks_IBTRACKS_1979_after.pkl'
size_grid = 1
size_crop = 11
levtype = 'pl' # or 'sfc'
flag_write_ys ... | sophiegif/FusionCNN_hurricanes | scripts_data_collect_process/script_make_img_features_database.py | script_make_img_features_database.py | py | 1,786 | python | en | code | 20 | github-code | 50 |
26385476925 | from store.models import Product, Category
from users.models import Consultant
imprimerie_category = Category.objects.get(name="Imprimerie")
sup_publi_category = Category.objects.get(name="Supports publicitaires")
mane_category = Category.objects.get(name="Objets publicitaires")
articles_promotionnels= Category.object... | Aleks512/Ventalis | products.py | products.py | py | 8,955 | python | en | code | 0 | github-code | 50 |
34536155371 | # -*- coding: utf-8 -*-
import codecs
import csv
import requests
from bs4 import BeautifulSoup
def getHTML(url):
r = requests.get(url)
return r.content
def parseHTML(html):
soup = BeautifulSoup(html,'html.parser')
body = soup.body
company_middle = body.find('div',attrs={'class':'middle'})
c... | zhanghanxuan123/Python_study_code | demo01/Netdemo06.py | Netdemo06.py | py | 1,118 | python | en | code | 1 | github-code | 50 |
170087305 | from tkinter import ttk
import tkinter
#Auliary constants
WINDOW_NAME = "Calculator"
ROOT_DISPLAY_STATE = "readonly"
CLEAR_OPERATOR = "C"
ERASE_OPERATOR = "←"
ADD_OPERATOR = "+"
SUBTRACT_OPERATOR = "-"
MULTIPLICATION_OPERATOR = "×"
DIVISION_OPERATOR = "÷"
DOT = "."
RESULT_OPERATOR = "="
C_0 = "0"
C_1 = "1"
C_2 = "2"
... | FimesX/Calculator-v1.0 | main.py | main.py | py | 5,470 | python | en | code | 0 | github-code | 50 |
42983694220 | from odoo import models, fields, api
class ConvertToEmployee(models.TransientModel):
_name = "covert.to.employee"
_description = "Employee List"
ROLES = [
('developer', 'Developer'),
('tester', 'Tester'),
('analyst', 'Analyst'),
('trainer', 'Trainer')
]
trainee_na... | kunalchambhare/js_code | bista_training/wizard/convert_to_employee_wiz.py | convert_to_employee_wiz.py | py | 932 | python | en | code | 1 | github-code | 50 |
39317579296 | """
Some various utilities to ease making tests around Django and HTML responses.
"""
import os
import hashlib
from django.contrib.sites.models import Site
from django.template.response import TemplateResponse
from django.test.html import parse_html
from django.urls import reverse
from pyquery import PyQuery as pq
... | emencia/cmsplugin-blocks | cmsplugin_blocks/utils/tests.py | tests.py | py | 7,647 | python | en | code | 2 | github-code | 50 |
19949969236 | from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn.metrics import mean_squared_error, r2_score
data=input("enter the name of the dataset file:")
df=pd.read_csv(data)
number=LabelEncod... | not4win/5th-sem-soft-computing | sc lab1/skl.py | skl.py | py | 951 | python | en | code | 0 | github-code | 50 |
28569627767 | import json
import logging
import yaml
from alarm import AlarmManager
from filtered_metrics import get_filtered_metrics
from paramiko_ssh_client import ParamikoSSHClient
from server_metrics_aggregator import ServerMetricsAggregator
with open('server_config.yaml', 'r') as config_file:
server_config = yaml.safe_lo... | aakashjangidme/server_monitor_raw | main.py | main.py | py | 1,125 | python | en | code | 0 | github-code | 50 |
21229650655 | from math import sqrt, pi, sin, cos
from supervisor import Supervisor
from basic import AvoidObstacles, GoToGoal, AOAndGTG
from ..geometry import Pose2D
class K3Supervisor(Supervisor):
def __init__(self):
Supervisor.__init__(self)
self._controllers = [
AvoidObstacles(),
GoT... | dgchurchill/python-simiam | simiam/controllers/khepera3.py | khepera3.py | py | 3,311 | python | en | code | 1 | github-code | 50 |
1685678996 | from typing import List
import paddle
import paddle.nn as nn
from paddle3d.ops import pointnet2_ops
def voxel_query(max_range: int, radius: float, nsample: int, xyz: paddle.Tensor, \
new_xyz: paddle.Tensor, new_coords: paddle.Tensor, point_indices: paddle.Tensor):
"""
Args:
max_range... | PaddlePaddle/Paddle3D | paddle3d/models/common/pointnet2_stack/voxel_query_utils.py | voxel_query_utils.py | py | 3,663 | python | en | code | 479 | github-code | 50 |
18191728823 | import json
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('JobTable')
s3 = boto3.client('s3', region_name='us-east-1')
sqs = boto3.resource('sqs', region_name='us-east-1')
queue = sqs.get_queue_by_name(QueueName='JobQueue')
JOB_SIZE = 3
bucket_name = 'render-files-bucket'
def validate_in... | PaoloMura/render-farm | server/lambda_server.py | lambda_server.py | py | 3,714 | python | en | code | 0 | github-code | 50 |
21217707169 | import rhinoscriptsyntax as rs
import random
rs.EnableRedraw(True)
#definition for placing random points in x,y, and z ranges
def placePt(x_range,y_range,z_range):
x = random.uniform(0,x_range)
y = random.uniform(0,y_range)
z = random.uniform(0,z_range)
pt = [x,y,z]
return pt
#initializing first p... | wloka-1/python | line to follow next points.py | line to follow next points.py | py | 736 | python | en | code | 0 | github-code | 50 |
30265484508 | import os
import pprint
os.system('clear')
ruta = '/home/teo/codigo/curso_21_22/viernes/programacion/python/funciones_miercoles.txt'
dic_salida = {}
def modo1():
clave = 0
# Leer archivo
with open(ruta) as archivo:
for l in archivo:
#Procesar fila a fila
fila = l[:-1:].spl... | teo-core/curso_21_22 | fichero_a_dict.py | fichero_a_dict.py | py | 674 | python | es | code | 3 | github-code | 50 |
14189568262 | import pygame
import time
import random
pygame.init()
screenWidth=800
screenHeight=600
window=pygame.display.set_mode([screenWidth,screenHeight])
pygame.display.set_caption("ENDLESS")
black=(0,0,0)
green=(0,255,0)
blue=(0,0,255)
red=(255,0,0)
runRight=[pygame.image.load('sonic run 1 flip.gif'),pygame.image.load('son... | TDAF2509/Python-Libraries | PYTHON/Endless for my own testing/Older versions/endless adding keys.py | endless adding keys.py | py | 12,577 | python | en | code | 0 | github-code | 50 |
74562549275 | #
# @lc app=leetcode.cn id=783 lang=python3
#
# [783] 二叉搜索树节点最小距离
#
from sbw import *
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def m... | StBinge/leetcode | 783.二叉搜索树节点最小距离.py | 783.二叉搜索树节点最小距离.py | py | 789 | python | en | code | 0 | github-code | 50 |
42246359724 |
from geoip import geolite2
from socket import *
from googlesearch import *
from hashlib import *
import pyfiglet
from termcolor import colored
import os
from time import sleep
screen=pyfiglet.figlet_format('No System Is Safe ')
print('''
Follow Me in Telegram https://t.me/System_Hac
************... | systemhacked1/system-info-networkp-ip | oneinall.py | oneinall.py | py | 3,982 | python | en | code | 1 | github-code | 50 |
36118534420 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from ckip_transformers import __version__
from ckip_transformers.nlp import CkipWordSegmenter, CkipPosTagger, CkipNerChunker
def main():
# Show version
print(__version__)
# Initialize drivers
print("Initializing drivers ... WS")
ws_driver = CkipWord... | ckiplab/ckip-transformers | example/example.py | example.py | py | 1,900 | python | en | code | 573 | github-code | 50 |
14894536637 | # Old table parsing info
# 20120614: removed pp distance to next player
# 20140209: removed score rank
from bs4 import BeautifulSoup
import os
import csv
SNAPSHOTS_DIR = "snapshots"
# stupid locale stuff
def clean_int(s):
return ''.join(c for c in s if c not in ",.\xa0")
def clean_float(s):
return float(s.... | jxu/osu-player-history | extract_table.py | extract_table.py | py | 3,970 | python | en | code | 1 | github-code | 50 |
33020146610 | #!/usr/bin/env python3
#
# A lot of this code is based on one of these two projects:
# https://github.com/kumina/python_container_demo_app
# https://github.com/yurishkuro/opentracing-tutorial/tree/master/python
import os
import sys
import http.server
import prometheus_client
import json
import signal
import threading
... | kumina/jaeger-demo | time-app/router.py | router.py | py | 6,541 | python | en | code | 0 | github-code | 50 |
74248898074 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
import struct
from .base import CharsetBase
class UTF8(CharsetBase):
title = 'CODE TABLE OF UTF-8'
description = [
u"UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或... | liuyug/charset | charset/utf8.py | utf8.py | py | 10,972 | python | zh | code | 5 | github-code | 50 |
29900411158 | # Copyright 2017, Digi International Inc.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DI... | voreckr/HHS-Rocket-Project | ReceiveDataSample_HHS_6A.py | ReceiveDataSample_HHS_6A.py | py | 5,536 | python | en | code | 0 | github-code | 50 |
18781707691 | import Create_csv as cc
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LogisticRegression
class ML:
def __init__(self):
pass
def preprocess(self, a, y, t):
cc.Create_csv()
df1 = pd.read_csv('/home/karan/Pych... | karandoshi98/First-Python-Project-Disease-Survey | ml.py | ml.py | py | 2,129 | python | en | code | 1 | github-code | 50 |
75043703196 | #!/usr/bin/python
import time
import roslib
roslib.load_manifest('raw_script_server')
import rospy
import actionlib
from raw_script_server.msg import *
from simple_script_server import *
sss = simple_script_server()
## Script server class which inherits from script class.
#
# Implements actionlib interface for the ... | RC4Group4/ResearchCamp4 | raw_command_tools/raw_script_server/src/script_server.py | script_server.py | py | 1,737 | python | en | code | 1 | github-code | 50 |
44878419809 | from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.dexterity.interfaces import IDexterityFTI
from ploneconf.core.content.person import IPerson
from ploneconf.core.content.person import Person
from ploneconf.core.testing import PLONECONF_CORE_INTEGRATION_TE... | cleberjsantos/2021.ploneconf.org | api/src/ploneconf.core/src/ploneconf/core/tests/test_content_person.py | test_content_person.py | py | 2,904 | python | en | code | null | github-code | 50 |
39503259202 | import pika
import pymongo
import json
# Connect to MongoDB
mongo_client = pymongo.MongoClient("mongodb://admin:secret@localhost:27017/")
mongo_db = mongo_client["project"]
patients_collection = mongo_db["Patient"]
# Define the queue names
register_queue = 'register_patient'
lookup_queue = 'lookup_patient'
all_patien... | Ahkh3e/RabbitMQProject | Workers/patient_worker.py | patient_worker.py | py | 2,188 | python | en | code | 0 | github-code | 50 |
28201624930 | # -*- coding: utf-8 -*-
def getFetchedTitle(s):
end = (len(s)-2)
if s[end:] == ",\n":
return s[0:end]
else:
# ultima parola dell'elenco
return s
def filterTagNameSequence(tags, coll):
coll_ = [] # istanzio una collection vuota
for el in coll:
# filtro una lista di ... | salvioner/lyra | dataset/fetch.py | fetch.py | py | 1,244 | python | it | code | 0 | github-code | 50 |
71935869596 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import datetime as dt
import struct
import os
import logging
from scipy.io import loadmat
from netCDF4 import Dataset
import netCDF4 as nc4
from scipy.interpolate import interp1d
from matplotlib import pyplot as plt
import time
from sys import exit
impo... | conwayek/MethaneAIR_L0-L1B | wavecal_routines.py | wavecal_routines.py | py | 52,743 | python | en | code | 1 | github-code | 50 |
6302595863 | import pytest
from FeedAutofocus import Client, fetch_indicators_command, get_indicators_command
from CommonServerPython import *
INDICATORS = [
"d4da1b2d5554587136f2bcbdf0a6a1e29ab83f1d64a4b2049f9787479ad02fad",
"19.117.63.253",
"19.117.63.253:8080",
"domaintools.com",
"flake8.pycqa.org/en/lates... | demisto/content | Packs/AutoFocus/Integrations/FeedAutofocus/FeedAutofocus_test.py | FeedAutofocus_test.py | py | 4,567 | python | en | code | 1,023 | github-code | 50 |
3765447154 | from typing import *
class Solution:
def xorOperation(self, n: int, start: int) -> int:
"""
Time: O(n)
Space: O(1)
"""
result = start
nums = [start]
for i in range(1, n):
nums.append(start + 2*i)
for i in... | rajpatel5/LeetCode | Python Solutions/Easy/1486.py | 1486.py | py | 398 | python | en | code | 0 | github-code | 50 |
45567581669 | import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import (
LinearRegression,
LogisticRegression,
BayesianRidge,
)
from sklearn.svm import SVR, SVC
from sklearn.model_selection import cross_val_score, train_test_split
from sklearn.metrics import (
accuracy_score,
... | t1anchen/peer-py | client/e2e/ml.py | ml.py | py | 8,012 | python | en | code | 1 | github-code | 50 |
71786589594 | # 내가 푼 것.
n, k = map(int, input().split())
cnt = [[0] * 201 for _ in range(201)] # 0으로 채우면 최소 1개는 나옴.
cnt[0] = [0] + [1] * 200
for i in range(1, 201):
cnt[i][1] = 1
for i in range(1, 201):
for j in range(1, 201):
for h in range(i+1):
cnt[i][j] += cnt[i - h][j - 1]
cnt[i][j] %=... | JH-TT/Coding_Practice | BaekJoon/Dynamic/2225.py | 2225.py | py | 1,165 | python | ko | code | 0 | github-code | 50 |
35995079594 | from django import forms
from core.constants import *
from core.models import Coach, StartingLineup
from core.utilities import populate_quarter
class PlayerEntryForm(forms.Form):
profile_image = forms.ImageField(required=False)
player_number = forms.IntegerField(min_value=0, max_value=99)
first_name = fo... | ch0164/lacrosse_scoreboard | core/forms.py | forms.py | py | 16,663 | python | en | code | 0 | github-code | 50 |
34918108394 |
from flask import Flask, render_template, request, jsonify
from flask_cors import CORS, cross_origin
from pyproj import Geod
app = Flask('My_orto')
CORS(app)
@app.route('/')
def hi():
return 'hi'
# @app.route('/get', methods = ['get', 'post'])
# def get():
# parameters_map =... | artkon2712/TestTask | test.py | test.py | py | 977 | python | en | code | 0 | github-code | 50 |
767651859 | import math
def IMT(weight, height):
IMT = weight / (math.pow(height, 2))
if 18.5 <= IMT <= 25:
return "Оптимальная масса"
elif IMT < 18.5:
return "Недостаточная масса"
else:
return "Избыточная масса"
weight = float(input())
height = float(input())
print(IMT(weight, height))
| VisteN2203/PythonBreedACourseForAdvanced.py | 2.0 Повторяем основные конструкции языка Python/2.1 Часть 1/main 2.1-2 title - Индекс массы тела.py | main 2.1-2 title - Индекс массы тела.py | py | 341 | python | ru | code | 0 | github-code | 50 |
13875478564 | # reference/source:
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
E = 2.718281828459045
def funTest(x,args=np.array([])):
return pow(E,x) - 2*x
def dfunTest(x,args=np.array([])):
return pow(E,x) - 2
def quadraticInterpolation(a,h,h0,g0):
numerator=g0*a**2
denominator=2... | seanys/Transportation-and-Optimization-Notes | User-Equilibrium-Project&Line-Search/line_search.py | line_search.py | py | 9,042 | python | en | code | 5 | github-code | 50 |
17508132490 | import tkinter as tk
from tkinter import *
b=str()
rt=Tk()
rt.title("Simple Calculator")
rt.geometry("300x150")
enter= StringVar()
entry= Entry(rt,width='5',textvariable=enter ,font=('Courier',25))
entry.place(x=100,y=10)
def put_data(a):
global b
b+=a
enter.set(b)
def get_s... | TheRexishere/Python | Simple_Calculator GUI.py | Simple_Calculator GUI.py | py | 1,107 | python | en | code | 0 | github-code | 50 |
32657924659 | import logging
from datetime import datetime
from datetime import timedelta
import time
class StatsHandler(object):
def __init__(self, start):
"""
:param start: time when this object is initialised, which is basically when the MainHAndler starts
:return: None
"""
# start ti... | purbashacg9/asyncproxy | handlers/statshandler.py | statshandler.py | py | 2,809 | python | en | code | 0 | github-code | 50 |
25535439580 | f = open('contacts.txt')
#n = int(input().strip())
n = int(f.readline().strip())
db = dict()
for _ in range(n):
#query = input().strip().split()
query = f.readline().strip().split()
if query[0] == 'add':
i = 1
while i <= len(query[1]):
try:
db[query[1][:i]] += 1... | trueneu/algo | hackerrank/data_structures/trie/contacts.py | contacts.py | py | 506 | python | en | code | 0 | github-code | 50 |
18253389039 | from django.conf.urls import url
from ..views import (FrFragasvarListView, FrFragasvarCreateView, FrFragasvarDetailView,
FrFragasvarUpdateView, FrFragasvarDeleteView)
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^create/$', # NOQA
login_required(FrF... | ISOF-ITD/djangoapps | sprakfragan/urls/fr_fragasvar_urls.py | fr_fragasvar_urls.py | py | 844 | python | en | code | 0 | github-code | 50 |
2899665166 | # import csv
# exampleFile = open('report.csv')
# exampleReader = csv.reader(exampleFile)
# # exampleData = list(exampleReader)
# # print(exampleData)
# # print("\n")
# # print("\n")
# for row in exampleReader:
# print('Row #' + str(exampleReader.line_num) + ' ' + str(row))
#
# print("\n")
# print("\n")
import cs... | kamalkschauhan/Python | CSVExtract.py | CSVExtract.py | py | 513 | python | en | code | 0 | github-code | 50 |
70316996636 | '''
This scripts speaks a random greeting every minute on your Sonos speaker system.
Please see: https://github.com/OH-Jython-Scripters/lucid/blob/master/README.md
To use this, you should set up astro.py as described
here https://github.com/OH-Jython-Scripters/lucid/blob/master/Script%20Examples/astro.py
It also ass... | openhab-scripters/lucid | Script Examples/greetings.py | greetings.py | py | 1,995 | python | en | code | 3 | github-code | 50 |
30238304712 | import torch
import torch.nn as nn
import torch.nn.functional as F
from text_lab.text_bert import LEAM
from text_lab.channelwise_lstm import cw_lstm_model
class fusion_layer(nn.Module):
def __init__(self,embedding_dim,fusion_dim,dropout,ngram,output_dim = 25):
super(fusion_layer, self).__init__()
... | finnickniu/LDAM | text_lab/fusion_cls.py | fusion_cls.py | py | 2,106 | python | en | code | 2 | github-code | 50 |
39205244861 | from ..interface import Contract, ContractNotRespected
from ..syntax import(add_contract, W, contract_expression, O, S, ZeroOrMore,
Group, add_keyword, Keyword)
from .compositions import or_contract
class Tuple(Contract):
def __init__(self, length=None, elements=None, where=None):
C... | AndreaCensi/contracts | src/contracts/library/tuple.py | tuple.py | py | 3,461 | python | en | code | 392 | github-code | 50 |
5622639185 | #Contains telegram functions
#requires telegram user credentials
from difflib import SequenceMatcher
import json
from API_keys import *
from telethon.tl.types import InputPeerUser
from telethon import TelegramClient
from telethon import functions, types
import distance
from Friday_Functions import *
class Methods:
... | Rohith-JN/Friday | Telethon.py | Telethon.py | py | 1,859 | python | en | code | 1 | github-code | 50 |
29337299891 | import argparse
import os
import json
import cv2
import numpy as np
from sklearn.cluster import KMeans
from utils import *
DEFAULT_LABELS = "mask_labels.json"
VERBOSE = False
parser = argparse.ArgumentParser()
parser.add_argument("--head_img", type=str, default=r"sample_img\head", help="Path to folder with head img")... | GreasyGoose/MADE_final_project | skin_color_correction/skin_correct.py | skin_correct.py | py | 7,133 | python | en | code | 0 | github-code | 50 |
17682180983 | '''
combines the distance to Nash equilibrium per time slot for all the runs
'''
import csv
import argparse
from numpy import median
from utility_method import saveToCSV, saveToTxt, computeMovingAverage
parser = argparse.ArgumentParser(description='Combines the distance to Nash equilibrium per time slot for all the r... | anuja-meetoo/Co-Bandit | combineDistanceToNashEquilibrium.py | combineDistanceToNashEquilibrium.py | py | 3,772 | python | en | code | 0 | github-code | 50 |
1742327708 | #======================================================
# Configuration file for the ensemble storm track segmentation
# Contains the parameters used.
#
# Author: Montgomery Flora (Git username : monte-flora)
# Email : monte.flora@noaa.gov
#======================================================
param_set = [ {'min_t... | NOAA-National-Severe-Storms-Laboratory/frdd-wofs-ml-severe | wofs_ml_severe/conf/segmentation_config.py | segmentation_config.py | py | 1,366 | python | en | code | 0 | github-code | 50 |
33289854164 | import werkzeug
from flask import Flask, jsonify
from flask_sqlalchemy import SQLAlchemy
werkzeug.cached_property = werkzeug.utils.cached_property
from flask_restplus import Api, Resource
from datetime import datetime
from joblib import load
from bs4 import BeautifulSoup
import requests
import json
import p... | saminbassiri/news_and_comment_API | app.py | app.py | py | 6,594 | python | en | code | 0 | github-code | 50 |
26210548918 | import logging
from typing import Iterable, List
import torch
import openai
from tqdm import tqdm
from ..formatter import WhisperTimestampsFormatter
from .base import Engine
from .settings import SYMAI_CONFIG
from pathlib import Path
from openai import OpenAI
class TTSEngine(Engine):
def __init__(self):
... | kpister/prompt-linter | data/scraping/repos/ExtensityAI~symbolicai/symai~backend~engine_text_to_speech.py | symai~backend~engine_text_to_speech.py | py | 2,275 | python | en | code | 0 | github-code | 50 |
33849826084 | # -*- coding: utf-8 -*-
import io
from core.evaluation.labels import Label
from core.source.synonyms import SynonymsCollection
class OpinionCollection:
""" Collection of sentiment opinions between entities
"""
def __init__(self, opinions, synonyms):
assert(isinstance(opinions, list) or isinstance... | nicolay-r/attitudes-extraction-ds | core/source/opinion.py | opinion.py | py | 5,195 | python | en | code | 3 | github-code | 50 |
11588513111 | import logging
from tqdm import tqdm
import os
import re
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import codecs
from pdfminer.pdfparser import PDFParser, PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPa... | taai-taiwan/academic-search | PDFExtract.py | PDFExtract.py | py | 3,925 | python | en | code | 0 | github-code | 50 |
27773455016 | from keras.preprocessing.image import ImageDataGenerator
def load_images():
image_path='C:/Users/subhankar nath/desktop/neural_network/flowers_classification/flower_photos'
data_gen= ImageDataGenerator(rescale=1.0/255)
data= data_gen.flow_from_directory(image_path, target_size=(64,64), batc... | SubhankarNath/neural_network | flowers_utils.py | flowers_utils.py | py | 354 | python | en | code | 0 | github-code | 50 |
3118044744 | test_pangram_positive = [
"The quick brown fox jumps over the lazy dog.",
"Waltz, bad nymph, for quick jigs vex.",
"Glib jocks quiz nymph to vex dwarf.",
"Sphinx of black quartz, judge my vow.",
"How quickly daft jumping zebras vex!",
"The five boxing wizards jump quickly.",
"Jackdaws love m... | ashishjain1547/public_lessons_in_python | Ch 7 - Problems on Strings/Level 1/4_Check if given String is Pangram or not/script - using list, sorted, set and join.py | script - using list, sorted, set and join.py | py | 884 | python | en | code | 0 | github-code | 50 |
72649944156 | import numpy as np
from tensorflow import keras
from tensorflow.keras.layers import Embedding, Masking, Input, Bidirectional, LSTM, Dense, Dropout, concatenate
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
from gensim.models import KeyedVectors
from tensorflow.keras.models import Mode... | cranedroesch/frailtyclassifier | utils/prefit.py | prefit.py | py | 8,093 | python | en | code | 0 | github-code | 50 |
28640562996 | def is_int_num(num):
try:
# result = int(num)
int(num)
# return True
except Exception as e:
return False
else:
return True
if __name__ == '__main__':
one_num = input("请输入一个整数: ")
print(is_int_num(one_num))
| shiqi0128/My_scripts | python_study/Py28_0410_file_exception/lm_08_examples.py | lm_08_examples.py | py | 282 | python | en | code | 0 | github-code | 50 |
3513243398 | import tkinter as tk
from board import *
from game import Game
class CheckersBoard:
def __init__(self, master, array):
self.master = master
self.canvas = tk.Canvas(master,width=400, height=400)
self.canvas.pack()
self.square_size = 50
self.colors = {
... | daniasalman63/CIProject_checkers | mycheckers(with_compulsory_jump_move)/GUI.py | GUI.py | py | 3,424 | python | en | code | 0 | github-code | 50 |
36719698309 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'adison'
# @Time : 2017/12/18
import random
import datetime
from functools import reduce
from app.models import db, User, Article, Source, Category, Tag, Comment, Role, Permission
from .helpers import get_category_ids
from ..ext import redis
from config im... | adisonhuang/flask-blog | app/utils/processors.py | processors.py | py | 5,516 | python | en | code | 100 | github-code | 50 |
7745509253 | #!/usr/bin/env python
import sys
last_key = None
last_value = 0
final_key = None
final_value = 0
this_value = 0
for input_line in sys.stdin:
input_line = input_line.strip()
this_key, value = input_line.split("\t", 1)
value = int(value)
if last_key == this_key:
this_value += value
els... | ydeng003/High-Perfomance-Computing-Programming | Hadoop Map Reduce/Programming1/reducer.py | reducer.py | py | 574 | python | en | code | 0 | github-code | 50 |
33419576755 | from random import randint, choice
import typing
from discord import Embed
from discord.ext import commands
COLOR = 0xff9933
class Roll(commands.Cog):
"""Introduces some different kinds of random chance."""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def flip(self, ctx... | SeeWhatSticks/stick_bot | extensions/Roll.py | Roll.py | py | 1,585 | python | en | code | 0 | github-code | 50 |
21955506801 | import subprocess
import boto3
import click
import os
import webbrowser
from frontend import create_frontend_html_file
@click.command()
@click.option('--bucket-name',
default='localhost',
help='Specify existing S3 bucket to upload to (defaults to localhost)')
def deploy(bucket_name: str)... | ashwinkumar01/aws_sam_simple_app | manage.py | manage.py | py | 2,504 | python | en | code | 0 | github-code | 50 |
33784838407 | import mmcv
import time
import torch
import warnings
from mmcv.runner.builder import RUNNERS
from mmcv.runner.iter_based_runner import IterBasedRunner, IterLoader
from mmcv.runner.utils import get_host_info
@RUNNERS.register_module()
class IterBasedSSLRunner(IterBasedRunner):
def train(self, lab_data_loader, unl... | Divadi/DetMatch | mmdet3d/core/runner/iter_based_ssl_runner.py | iter_based_ssl_runner.py | py | 4,696 | python | en | code | 32 | github-code | 50 |
20922587230 | import gzip
import io
import lz4.frame
import struct
import sys
from .event import Event
import proio.proto as proto
from .writer import magic_bytes
class Reader(object):
"""
Reader for proio files
This class can be used with the `with` statement, and it also may be used
as an iterator that seque... | decibelcooper/proio | py-proio/proio/reader.py | reader.py | py | 6,390 | python | en | code | 2 | github-code | 50 |
28590851793 | # Instructions
# You are going to write a program that tests the compatibility between two people.
# To work out the love score between two people:
# variables
t_true_count = 0
r_true_count = 0
u_true_count = 0
e_true_count = 0
l_love_count = 0
o_love_count = 0
v_love_count = 0
e_love_count = 0
true_total_count = 0
... | robsdata/100daysofcode_python-2023 | day_01-10/day-3/love-calculator.py | love-calculator.py | py | 2,340 | python | en | code | 2 | github-code | 50 |
74283401435 | from django.shortcuts import render
from.models import About,Skills,Edeucation,Experience
# Create your views here.
def home(request):
about=About.objects.last()
coding_skills=Skills.objects.filter(type='Coding')
design_skills=Skills.objects.filter(type='Design')
edeucation=Edeucation.objects.all()
... | Hammuda007/django-blog | about/views.py | views.py | py | 582 | python | en | code | 2 | github-code | 50 |
25156324356 | import matplotlib.pyplot as plt
import ai
from ai.examples.diffusion.model import DiffusionMLP
EVAL_BS = 1000
def run(outpath, device='cpu', n_steps=5000, train_bs=32, sample_interval=500):
ds = ai.data.toy.moons(n=8000, include_labels=False, mult=2.)
model = DiffusionMLP(2).init().to(device)
opt = a... | calvinpelletier/ai | examples/diffusion/main.py | main.py | py | 1,071 | python | en | code | 0 | github-code | 50 |
36488985083 | def roman_to_integer(roman):
roman_numerals = {
'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000
}
result = 0
prev_value = 0
for numeral in reversed(roman):
value = roman_numerals[numeral]
if value < prev_value:
result -= value
else:
... | Leelamanikanta01/assigment1_python | Assignment.py | Assignment.py | py | 481 | python | en | code | 0 | github-code | 50 |
74459541275 | from flask_restful import Resource
from flask_jwt import jwt_required
from models.request import RequestModel
from models.client import ClientModel
from models.parser import Parser
class Request(Resource):
"""Request endpoint for url/request"""
@jwt_required()
def post(self):
"""Post endpoint for ... | Connor13C/BriteCore_Demo | resources/request.py | request.py | py | 3,431 | python | en | code | 0 | github-code | 50 |
13505764959 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 14:23:31 2020
Script to create directory structure for any project.
@author: rt2
"""
import os
dirs = ["input", "src", "models", "notebooks"]
def main():
for dirName in dirs:
try:
# Create target Directory
os.makedirs(dirName)
... | rahul-trip/DataSc | supporting_scripts/create_dir_struct.py | create_dir_struct.py | py | 511 | python | en | code | 0 | github-code | 50 |
14085193648 | import requests
b = 1
while b == 1:
a = input()
a = str(a)
c = requests.get(
"https://zhuan-ti-hou-duan.onrender.com/bookTouchShelf",
params={"rfid": a, "touchShelf": "A1"},
)
print(c)
print(a)
| kw404/rfid_bookshelf | RFID_code/import requests.py | import requests.py | py | 235 | python | en | code | 0 | github-code | 50 |
5003032733 | from browser import html, window
from typing import Callable, Literal
ACCENTS = Literal['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'link']
########################################################################
class MDCObject():
""""""
# ------------------------------... | UN-GCPDS/radiant-framework | radiant/static/modules/brython/bootstrap/base.py | base.py | py | 5,345 | python | en | code | 5 | github-code | 50 |
28477546383 | import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader, ConcatDataset
import glob
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, accuracy_score
import random
import cv2
import sys
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as ... | nikunjt0/Brain-MRI-Tumor-Detector | trainingModel.py | trainingModel.py | py | 5,047 | python | en | code | 0 | github-code | 50 |
10214224472 | import json
import argparse
import contextlib
import sh
import subprocess
import pathlib
from allennlp.commands.train import train_model
from allennlp.common import Params
# from smbop.dataset_readers.spider_basic_pkl import SmbopSpiderDatasetReader
from smbop.dataset_readers.spider_retriever_nn import SmbopSpiderRetri... | ali6947/NeuralSemanticParser | exec_retriever.py | exec_retriever.py | py | 7,408 | python | en | code | 0 | github-code | 50 |
23388235853 | import requests
from bs4 import BeautifulSoup
from weather.models import Weather
from pprint import pprint
# 네이버 날씨 크롤링
def forecast():
cities = ['서울특별시',
'인천광역시',
'부산광역시',
'대구광역시',
'인천광역시',
'광주광역시',
'대전광역시',
'울산광역시',
... | devjunseok/off_the_outfit_backend | weather/crawling.py | crawling.py | py | 2,358 | python | en | code | 1 | github-code | 50 |
4644130279 | import json
import faiss
import numpy as np
from sklearn import preprocessing
from config.constant import EMBEDDING_DIMENSION
def load_db(db_path, use_gpu = False):
with open(db_path, 'r') as f:
db = json.load(f)
first_time = True
list_feature = []
list_id = []
list_len = []
fo... | BarryZM/Dialog_generate_tool | FaceRecognition/utils/load_faiss.py | load_faiss.py | py | 1,026 | python | en | code | 0 | github-code | 50 |
32637069210 |
import csv
import math
from django.core.management.base import BaseCommand
from django.core.exceptions import ValidationError
from hs_core.hydroshare import convert_file_size_to_unit
from theme.models import UserQuota
from hs_core.hydroshare.resource import get_quota_usage_from_irods
class Command(BaseCommand):
... | hydroshare/hydroshare | theme/management/commands/report_quota_inconsistency.py | report_quota_inconsistency.py | py | 2,117 | python | en | code | 171 | github-code | 50 |
8122948448 | import os
from os.path import join
from datetime import timedelta
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from keycloak_oidc.default_settings import *
import urllib.parse
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = os.environ.get('DJANGO_DEBUG')... | tickHub/omslagroute | app/settings/settings.py | settings.py | py | 10,140 | python | en | code | 0 | github-code | 50 |
21351830448 | '''
VectorTracker v1.0 by Jorrit Schulte
Add this to menu.py:
nuke.load('VectorTracker.py')
nuke.menu("Nodes").addCommand('user/VectorTracker', "nuke.createNode('VectorTracker.gizmo')")
'''
def allScriptNodes():
#collect all nodes in the root node graph
nodes = nuke.allNodes()
groups = [node for node in n... | CreativeLyons/NukeSurvivalToolkit_publicRelease | NukeSurvivalToolkit/python/NST_VectorTracker.py | NST_VectorTracker.py | py | 8,679 | python | en | code | 181 | github-code | 50 |
14620274998 | from youtrack_reporter.app.settings import load_app_settings
from youtrack_reporter.app.message_queue.state import MQAppState
from youtrack_reporter.app.database.instance import db_init
from youtrack_reporter.app.youtrack import YouTrackAsyncAPI
from youtrack_reporter.app.youtrack import YouTrackAsyncAPI
from youtrack... | Bondifuzz/youtrack-reporter | local/tests/db_entities.py | db_entities.py | py | 2,533 | python | en | code | 0 | github-code | 50 |
39455613842 | import mysql.connector
#try:
connection = mysql.connector.connect(host='localhost',
database='sys',
user='root',
password='1234')
q = '''create table itemmast
(
ITNO decimal(4),
... | cdaman123/BTech_6_Lab | dbms/ass1.py | ass1.py | py | 883 | python | en | code | 3 | github-code | 50 |
27211207283 | import torch.nn as nn
class resnet50_Decoder(nn.Module):
"""
CenterNet_neck
"""
def __init__(self, inplanes, bn_momentum=0.1):
super(resnet50_Decoder, self).__init__()
self.bn_momentum = bn_momentum
self.inplanes = inplanes
self.deconv_with_bias = False
# 16,1... | zranguai/CenterNet-pytorch | models/neck.py | neck.py | py | 1,449 | python | en | code | 0 | github-code | 50 |
1952701848 | #
from __future__ import division
import _config
import sys, os, fnmatch, datetime, subprocess, pickle
sys.path.append('/home/unix/maxwshen/')
import numpy as np
from collections import defaultdict
from mylib import util
import pandas as pd
from scipy.stats import binom
# Default params
# inp_dir = _confi... | maxwshen/lib-analysis | ag5a4_profile_subset.py | ag5a4_profile_subset.py | py | 5,731 | python | en | code | 2 | github-code | 50 |
22477861761 | import pygame
from . import settings
from .vector import Vector
import math
class Ray:
def __init__(self, x, y):
self.position = Vector(x, y)
self.direction = Vector(1, 0)
def look_at(self, x, y):
self.direction.x = x - self.position.x
self.direction.y = y - self.position.y
... | SnkSynthesis/pyraycaster | pyraycaster/ray.py | ray.py | py | 1,862 | python | en | code | 1 | github-code | 50 |
22064790743 | from flask import Blueprint, render_template, request, flash, redirect, url_for
from flask import Flask
from flask_mail import Mail, Message
email = Blueprint('email', __name__)
@email.route('/email', methods=['POST'])
def send_email():
to_you = request.form['recipient']
from_me = request.form['sender']
... | TitusCharlie/updated-ticket | website/email.py | email.py | py | 530 | python | en | code | 0 | github-code | 50 |
13829213288 | from django.http import JsonResponse
from django.shortcuts import render, reverse, redirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.models import User
from .models import (
PortfolioUser, UserSkill, PortfolioUserSocialMediaLink, Review, NewClient, PortfolioUserAddress, C... | gautamw3/portfolio_cum_blog | portfolio/views.py | views.py | py | 19,382 | python | en | code | 0 | github-code | 50 |
40134368210 | import FWCore.ParameterSet.Config as cms
process = cms.Process("QcdHighPtDQM")
process.load("DQMServices.Core.DQM_cfg")
process.load("DQMServices.Components.DQMEnvironment_cfi")
process.dqmSaver.workflow = cms.untracked.string('/Physics/QCDPhysics/Jets')
process.maxEvents = cms.untracked.PSet(
input = cms.untra... | cms-sw/cmssw | DQM/Physics/test/qcdHighPtDQM_cfg.py | qcdHighPtDQM_cfg.py | py | 1,378 | python | en | code | 985 | github-code | 50 |
43404396725 | import cv2 as cv
import numpy as np
start = '7/blue.png'
end = '7/red.png'
img_start = cv.imread(start)
img_end = cv.imread(end)
ran = 10
for x in range(1,ran):
scale = x / float(ran)
cha = (img_end.astype(np.int)-img_start.astype(np.int))
img_inter = img_start + cha * scale
path = '{}/img_{}_{}_inter_{}.png'.... | youyuge34/PI-REC | scripts/color_inter.py | color_inter.py | py | 490 | python | en | code | 2,006 | github-code | 50 |
25522928386 | # Programa que utiliza as funções de data do calendário baseadas nas configurações atuais da CPU
# Quando executado o código ele imprime o dia o mês e o ano no console
from datetime import date
def trabalhando_com_data():
data_atual = date.today()
data_atual_str = data_atual.strftime('%d/%m/%Y')
p... | riangomesz/Pyhton-exercises-3 | funcao_data.py | funcao_data.py | py | 498 | python | pt | code | 2 | github-code | 50 |
26378079390 | #https://leetcode.com/problems/partition-array-into-three-parts-with-equal-sum/submissions/
class Solution:
def canThreePartsEqualSum(self, arr: List[int]) -> bool:
if sum(arr)%3!=0:
return False
avg=int(sum(arr)/3)
part, cnt = 0,0
for num in arr:
part+=num
... | 724thomas/CodingChallenge_Python | LeetCode/1013PartitionArrayIntoThreePartsWithEqualSum.py | 1013PartitionArrayIntoThreePartsWithEqualSum.py | py | 421 | python | en | code | 0 | github-code | 50 |
29780157398 | from PyQt5 import QtWidgets
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtWidgets import QApplication, QTableView, QMainWindow
import sys
from TelefonRehberi import Ui_MainWindow
class TelApp(QtWidgets.QMainWindow):
def __init__(self):
super(TelApp, self).__init__()
... | celilcavus/CelilCavus.PYQT5.TelefonRehberi | Rehber.py | Rehber.py | py | 1,258 | python | en | code | 0 | github-code | 50 |
44170686304 | url = 'https://api.us-south.text-to-speech.watson.cloud.ibm.com/instances/f817b9d7-38b4-491a-86b7-1a0ea5888912'
apikey = 'R4KLNIlE97YzWbcdoMRQRJd_yCZWkVndMOB7Vbm0eiMS'
from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
apikey ='Ji5U7aNqFY7GNQy1Ae3eb2yLRXcicIS... | munira4x/TextTospeech | convert.py | convert.py | py | 1,019 | python | en | code | 0 | github-code | 50 |
19930582404 | from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.urls import reverse
from django.shortcuts import get_object_or_404, render, redirect
from .models import food, Meal, Entry
from django.db.models import Q
from accounts.views import keep_session_active
import requests
import datetime
# Creat... | GittyDawg/Health4Wellness | Health4Wellness/food/views.py | views.py | py | 11,078 | python | en | code | 2 | github-code | 50 |
33909565637 | from cdwa import Item, Image, PersonOrCorporateBody, PlaceOrLocation, GenericConcept, Subject
class HarvardItem(Item):
def __init__(self,rec,relevance):
# Imago Mundi administrative metadata
self.pid = u"-".join(['Harvard',str(rec['objectnumber']),"item"])
self.relevance = relevance
... | joemull/aby | final-proj-si-507/museums/harvard.py | harvard.py | py | 874 | python | en | code | 0 | github-code | 50 |
11399118396 | """
거스름돈으로 사용할 500원, 100원, 50원, 10원짜리 동전이 무한히 존재한다.
손님에게 거슬러 줘야 할 돈이 N원이 일때, 거슬러 줘야 할 동전의 **최소 개수**를 구하여라
단, 거슬러 줘야 할 돈 N은 항상 10의 배수이다.
"""
N = int(input()) # 손님에게 거슬러 줘야 할 금액
cnt = 0 # 거슬러 줘야 할 돈전의 개수
jandon = [500, 100, 50, 10]
for i in jandon:
cnt += N // i
N = N % i
print(cnt) | song7351/algorithm_study | 1.이코테/1.greedy/3-1.py | 3-1.py | py | 504 | python | ko | code | 0 | github-code | 50 |
38021908518 | """
*packageName :
* fileName : 전력망을 둘로 나누기
* author : qkrtkdwns3410
* date : 2022-09-15
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2022-... | guqtls14/python-algorism-study | 박상준/프로그래머스/카카오/전력망을 둘로 나누기.py | 전력망을 둘로 나누기.py | py | 1,641 | python | en | code | 0 | github-code | 50 |
9971901238 | alpha = input()
alpha = alpha.upper()
alpha = list(alpha)
count={}
for i in alpha:
try: count[i] += 1
except: count[i]=1
result = set()
for i in count:
if count[i] >= max(count.values()):
result.add(i)
if len(result) >= 2:
print('?')
# else:
# print(max(count,key=count.get))
# print(list... | portals2/prectice_baekjoon | 0_bronze/b1#1157.py | b1#1157.py | py | 1,261 | python | ko | code | 0 | github-code | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.