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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
11732136587 | import keras
import numpy as np
from keras.layers import Input, Dense
from keras.models import Model
from keras.optimizers import Adam
from sklearn.cluster import KMeans
from keras.models import load_model
import csv
import sys
path_train = sys.argv[1]
path_test = sys.argv[2]
path_out = sys.argv[3]
def load_data():
... | hungchingliu/ML2018SPRING | hw4/autoencoder.py | autoencoder.py | py | 2,623 | python | en | code | 0 | github-code | 1 |
71066804513 | from wireless import wifi
from espressif.esp8266wifi import esp8266wifi as wifi_driver
import streams
import threading
# Import the Zerynth APP library
from zerynthapp import zerynthapp
streams.serial()
sleep(1000)
print("STARTING...")
# save the index.html in the board flash
new_resource("template/index.html")
# ... | FedericoGuidi/RemoteLEDControl | main.py | main.py | py | 3,534 | python | en | code | 5 | github-code | 1 |
23355532518 | def main():
outfile = open('counting.txt', 'w')
print('This program will create a text file with counting numbers')
N = int(input('How many numbers would you like to store in this file: '))
for number in range(N): # the variable number will get every value from 0 to N-1 in each iteration
out... | Nurckye/SpamML | abc.py | abc.py | py | 466 | python | en | code | 4 | github-code | 1 |
1656456443 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/9/8 12:39
# @Author : JJkinging
# @File : utils.py
from torch.utils.data import Dataset, DataLoader
from data.code.predict.test_utils import load_vocab, collate_to_max_length
class CCFDataset(Dataset):
def __init__(self, filename, intent_filename... | SCU-JJkinging/CCIR-Cup | data/code/scripts/dataset.py | dataset.py | py | 4,968 | python | en | code | 22 | github-code | 1 |
74726242592 | import logging
from dataclasses import dataclass
from http import HTTPStatus
from paddington import (
Joint, Track, ErrorEvent, ErrorTypeSwitch, RouteNotFound, SequentialSwitch,
)
from web_framework.app import App, WsgiContext
from web_framework.rest_view import RestWheelSet, HttpResponse
from web_framework.wsgi_s... | Tishka17/paddington | examples/web_app/app.py | app.py | py | 2,384 | python | en | code | 8 | github-code | 1 |
1639918231 | a,b = map(int,input().split())
s = 1
for i in range(1,1001):
n = a*i
if n%10==0 or (n%10==b):
print(s)
break
else:
s+=1
| mdaiyub/Codeforces | 732A.py | 732A.py | py | 169 | python | en | code | 2 | github-code | 1 |
40378963481 | from locust import HttpUser, task
from urllib3.exceptions import InsecureRequestWarning
import urllib3
urllib3.disable_warnings(InsecureRequestWarning)
__version__ = "1"
params = {}
params["all"] = {
"types[0]": "software-catalog",
}
params["all_components"] = {
"types[0]": "software-catalog",
"filters... | redhat-performance/backstage-performance | scenarios/search-catalog.py | search-catalog.py | py | 1,228 | python | en | code | 0 | github-code | 1 |
10557505124 |
# coding: utf-8
# In[34]:
#Mandelbrot fractal creation program
#e.g. complex fractal shapes with recursive detail at increasing magnifications
#code adapted from example found @ docs.scipy.org/doc/numpy/user/quickstart.html
import matplotlib.pyplot as plt
import numpy as np
def mbrot(h,w,maxit=125): #higher ite... | NathanNYC/Mandelbrot-Variations | Mbot.py.py | Mbot.py.py | py | 850 | python | en | code | 0 | github-code | 1 |
35636565941 | import arviz as az
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pymc as pm
import pytensor
import pytensor.tensor as pt
print(f"Running on PyMC v{pm.__version__}")
def my_model(theta, x):
m, c = theta
return m * x + c
def my_loglike(theta, x, data, sigma):
model = my_model... | HOLL95/General_electrochemistry | heuristics/testing_pymc.py | testing_pymc.py | py | 3,438 | python | en | code | 2 | github-code | 1 |
5130228201 |
# coding: utf-8
# In[1]:
import shapefile
import matplotlib.pyplot as plt
import numpy as np
# In[16]:
import pandas as pd
path_to_netatmo_coords_df = (r'X:\hiwi\ElHachem\Prof_Bardossy\Extremes'
r'\NetAtmo_BW'
r'\rain_bw_1hour'
... | AbbasElHachem/extremes | _05_plot_ppt_dwd_netatmo_stations.py | _05_plot_ppt_dwd_netatmo_stations.py | py | 1,849 | python | en | code | 0 | github-code | 1 |
42272258033 | from astropy.utils.data import get_pkg_data_filename
from ..catalogues import Catalogue
from ..lr import LRMatch
def set_catalogues():
mocfile = get_pkg_data_filename('data/testcat_moc_1.moc')
pcat_datafile = get_pkg_data_filename('data/testcat_moc_1.fits')
pcat = Catalogue(pcat_datafile, area=mocfi... | ruizca/astromatch | astromatch/tests/test_lr.py | test_lr.py | py | 1,769 | python | en | code | 5 | github-code | 1 |
19562145539 | """ This is a modified version of
https://github.com/ifeherva/optimizer-benchmark/blob/master/optimizers/__init__.py """
import argparse
import torch.optim as optim
import math
from .coolmom_pytorch import Coolmomentum
__all__ = ['parse_optimizer', 'supported_optimizers']
optimizer_defaults = {
'coolmom... | borbysh/coolmomentum | optimizers/__init__.py | __init__.py | py | 2,377 | python | en | code | 7 | github-code | 1 |
32017566370 | from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import redirect, render
from .HospitalDBConnect import *
def home(request):
''' the home for hosptial admins '''
appt_count = view_appt_count()
doc_count = view_doc_count()
room_count = view_room_c... | yonathanF/Hospital_Management | HospitalManagement/Hospital/views.py | views.py | py | 6,376 | python | en | code | 0 | github-code | 1 |
10989384624 | import sys
from towhee.runtime import register, pipe, ops, accelerate, AutoConfig, AutoPipes
from towhee.data_loader import DataLoader
from towhee.serve.triton import triton_client
from towhee.utils.lazy_import import LazyImport
# Legacy towhee._types
from towhee import types
_types = types # pylint: disable=protect... | towhee-io/towhee | towhee/__init__.py | __init__.py | py | 5,238 | python | en | code | 2,843 | github-code | 1 |
8818476440 | import cv2, math
from math import *
import numpy as np
import sys
from decimal import *
sys.path.append("../")
from libs.configs import cfgs
IMG_LOW = 1100
black = (0,0,0)
red = (0, 0, 255)
def convert_rect_origin(rect):
if rect[4] == 90 or rect[4] == -90:
new_rect = [rect[0],rect[1],rect[3],rect[2], 0]
... | anegawa/book_detection | tools/test.py | test.py | py | 7,650 | python | en | code | 0 | github-code | 1 |
22721407976 | import os
import time
import numpy as np
import tensorflow as tf
import avod
from avod.core import trainer_utils
import avod.builders.config_builder_util as config_builder
from avod.builders.dataset_builder import DatasetBuilder
from avod.core.models.avod_model import AvodModel
from avod.core.models.dt_avod_model imp... | Guoxs/DODT | avod/experiments/run_inference_by_one.py | run_inference_by_one.py | py | 5,124 | python | en | code | 1 | github-code | 1 |
74046925793 | import random
import time
from Objects_Blueprints import HitMan
from human_info import all_humans
print("""
Welcome to the Hit Man game. assassinate people until you have a Very high reputation or There is no one left to assassinate . That's it. Have fun!
When you forget who to assassinate, you can ask for the list ... | Beefy-py/HitMan_Game | hit_man_game.py | hit_man_game.py | py | 6,239 | python | en | code | 0 | github-code | 1 |
32023888041 | import pandas as pd
import plotly as py
import numpy as np
from plotly.graph_objs import *
from os import path
trace1 = Choropleth(
z=['1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],
showlegend=True,
autocolorscale=False,
colorscale=[[0, 'rgb(255,255,255)'], [1, '#a0db8e']],
hoverinfo='text... | nshahr/Data-Visualization | ngas-ovr-map.py | ngas-ovr-map.py | py | 3,195 | python | en | code | 0 | github-code | 1 |
19659832895 | import math
import logging
from datetime import datetime
from drive_controller import DrivingController
# 제한 속도
SPEED_LIMIT = 100
logging.basicConfig(filename='{}.log'.format(datetime.now().strftime('%Y-%m-%d-%H-%M')), level=logging.DEBUG)
class DrivingClient(DrivingController):
def __init__(self):
# =... | holy-water/self-driving | driving_client.py | driving_client.py | py | 6,808 | python | en | code | 0 | github-code | 1 |
28151218606 | # -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from ncar.items import NcarItem
class GetsomeSpider(CrawlSpider):
global li
li = list()
name = 'getsome'
allowed_domains = ['ncar.cc']
start_urls = ['http://bbs.ncar.c... | sv2sv/ncar | ncar/spiders/getsome.py | getsome.py | py | 1,337 | python | en | code | 0 | github-code | 1 |
5071621268 |
# coding:utf-8
# 卷积核尺寸,卷积核个数,池化层尺寸,全连接层的节点数,学习率,权重,偏置
import copy
import random
import time
import matplotlib.pyplot as plt
import numpy as np
from public.public_function import *
from public.cnn_single_keras_tensorflow import *
# from multi_part.first_part import *
from keras.models import load_mod... | githubzhch/ensemble-learning-grf | _2_multi_moead/multi_moead_cluster.py | multi_moead_cluster.py | py | 19,841 | python | zh | code | 0 | github-code | 1 |
15393129745 | from itertools import product
from useful_functions import converged
# import Gurobi but don't crash if it wasn't loaded
import warnings
warnings.formatwarning = lambda msg, *args: "warning: " + str(msg) + "\n"
try:
import gurobipy as G
except ImportError:
warnings.warn("Gurobi is required to solve MDPs by linear p... | btwied/MDP_interdiction | exact_solvers.py | exact_solvers.py | py | 5,531 | python | en | code | 0 | github-code | 1 |
8692823944 | import mysql.connector
import cv2
import pyttsx3
import pickle
import PySimpleGUI as sg
import time
"""
This is the gui program for face recognition.
verify() should be used with a subprocess and the childConn is one end of the pipe.
If unable to recognize face for a period longer than TIMEOUT, the program will termin... | hongming-wong/COMP3278-Group-Project | back-end/faces_gui.py | faces_gui.py | py | 5,134 | python | en | code | 0 | github-code | 1 |
25163443774 | import time
import pyautogui
from pykeyboard import PyKeyboard
from pymouse import PyMouse
from positions import POSITION
from roles import Role
from scenes.common import CommonScene
from tools import loading, locate
# 场景3:游戏界面
class GameScene(CommonScene):
@staticmethod
def goto_association():
"""
... | huiyaoren/genshin_test_tools | scenes/game.py | game.py | py | 7,704 | python | en | code | 1 | github-code | 1 |
30277225234 | #!/usr/bin/env python
from __future__ import absolute_import
import cProfile
import logging
import sys
import time
import rosgraph
import roslaunch
import rospy
from pyros import PyrosROS
roscore_process = None
# BROKEN ?? start roscore beofre running this...
# if not rosgraph.masterapi.is_online():
# # Trying... | pyros-dev/pyros | tests/test_pyros/profile_pyros_ros.py | profile_pyros_ros.py | py | 3,954 | python | en | code | 24 | github-code | 1 |
20029740083 | from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class SignupForm(UserCreationForm):
email = forms.EmailField(label="Email address",
help_text="A valid email address is required.",
error_messages={'invalid':"Please supply a... | crcsmnky/opensciencedata | webapp/users/forms.py | forms.py | py | 908 | python | en | code | 2 | github-code | 1 |
29004478715 | # %% [markdown]
# # Question 2.
# Implement the Principal Component Analysis algorithm for reducing the dimensionality of the points
# given in the datasets: https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.
# data. Each point of this dataset is a 4-dimensional vector (d = 4) given in the first colum... | debonil/ml-assignments | Assignment3/M21AIE225_PA1_2.py | M21AIE225_PA1_2.py | py | 9,673 | python | en | code | 0 | github-code | 1 |
72827287075 | import sys
n,m = map(int,sys.stdin.readline().split())
arr = []
camera = {
1 : [0],
2 : [0,2],
3 : [0,3],
4 : [0,2,3],
5 : [0,1,2,3]
}
dir = {
0 : [0,1],
1 : [-1,0],
2 : [0,-1],
3 : [1,0]
}
for _ in range(n):
arr.append(list(map(int,sys.stdin.readline().split())))
cameraList ... | clapans/Algorithm_Study | 박수근/all_code/15683.py | 15683.py | py | 1,603 | python | en | code | 0 | github-code | 1 |
29728640167 | import numpy as np
from PIL import Image
from tqdm import tqdm
from modules.Zest.Zest_Network import Zest_Network
class Zest_ImageProcessing(Zest_Network):
square_size_HQ = 32
square_size_LQ = 16
def __init__(self, x, y) -> None:
super().__init__(x, y)
def process_image(self, image_path ... | XOYZ69/Zest | modules/Zest/Zest_ImageProcessing.py | Zest_ImageProcessing.py | py | 3,094 | python | en | code | 0 | github-code | 1 |
28986345346 | from django.shortcuts import render, redirect
from django.views.decorators.clickjacking import xframe_options_exempt
import json
import sys
if '/God' not in sys.path:
sys.path.append('/God')
import Twitter
import Github
import datetime
import NatureLang
import Sitemap
repo = "twitter_network"
information_page... | minegishirei/flamevalue | trashbox/django3/app/fanstatic/twitter_views.py | twitter_views.py | py | 5,034 | python | en | code | 0 | github-code | 1 |
15127269052 | def countGroups(related):
num = 0
people = len(related)
related = [[int(char) for char in row] for row in related]
for i in range(people):
if related[i][i] == 1:
num += 1
dfsHelper(i, people, related)
return num
def dfsHelper(idx, people, related):
if relate... | mmichalak-swe/Algo_Expert_Python | Amazon_OA_Demo/Gifting_Groups/attempt_1.py | attempt_1.py | py | 488 | python | en | code | 3 | github-code | 1 |
15609782422 | import json
class NLG:
# get text by action from config file
def __init__(self,
json_path):
self.json_path=json_path
self.get_json_infor()
def get_json_infor(self):
# get config file
f = open(self.json_path, encoding='utf-8')
file=json.load(f)
... | foowaa/bert-dst | nlg.py | nlg.py | py | 635 | python | en | code | 1 | github-code | 1 |
72799928675 | import django.forms as forms
from django_utils.form_helpers import DivForm, FormValidator, RecaptchaForm
import django_utils.form_widgets as form_widgets
def build_flag_form(actions, reasons):
"""
Generates a DivForm to be used for submitting content flags.
"""
base_fields = {'action' : forms.Choice... | genghisu/eruditio | eruditio/shared_apps/django_moderation/forms.py | forms.py | py | 958 | python | en | code | 0 | github-code | 1 |
11645362565 | # -*- coding: utf-8 -*-
import scrapy
import sqlite3
from ..items import IndexarticlesItem
class IndexarticleSpider(scrapy.Spider):
name = 'indexarticle'
allowed_domains = ['index.hu']
conn = sqlite3.connect(r'C:\Users\Athan\OneDrive\Documents\Dissertation\Python\webscraperorigo\url.db')
curr = conn.cu... | AJszabo/dissertation | indexarticles/indexarticles/spiders/indexarticle.py | indexarticle.py | py | 2,149 | python | en | code | 0 | github-code | 1 |
23044885851 | '''
Module untuk membantu dalam 'menjawab' query/request user
Reinaldo Antolis / 13519015
Jeane Mikha / 13519116
Josep Marcello / 13519164
27 April 2021
'''
from datetime import datetime, timedelta
from matching import boyer_moore
import re
def extract_date(msg: str) -> 'list[datetime]':
'''
Fungsi untuk m... | jspmarc/BotWangy | src/response.py | response.py | py | 18,205 | python | id | code | 0 | github-code | 1 |
31064789985 | #!/usr/bin/env python
import os
import sys
import pdb
import numpy as np
from scipy.interpolate import interp1d
from scipy.constants import pi
from matplotlib import pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from astropy.constants import h, k_B, c, G
from astropy import units as u
from astropy.co... | avantyghem/Cluster | Cluster.py | Cluster.py | py | 5,318 | python | en | code | 0 | github-code | 1 |
74502512992 | from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect, render
from .forms import CommentForm, PostForm
from .models import Follow, Group, Post, User
NUMBER_OF_POSTS: int = 10
def index(request):
template = '... | KseniyaGurevich/hw05_final | yatube/posts/views.py | views.py | py | 4,737 | python | en | code | 1 | github-code | 1 |
74945416673 | #!/usr/bin/env python
Import('env')
if env.get('WITH_MAKEMPS'):
# To run the test, type
# ascdev test/dopri5/dopri5.a4c
lib = env.SharedLibrary("makemps",["slv6.c","mps.c"]
,LIBS = ['ascend']
,LIBPATH = ['#']
,SHLIBSUFFIX = env['EXTLIB_SUFFIX']
,SHLIBPREFIX = env['EXTLIB_PREFIX']
)
env.Depends(li... | georgyberdyshev/ascend | solvers/makemps/SConscript | SConscript | 504 | python | en | code | 5 | github-code | 1 | |
27841276814 | # Windows DAQ device interface
import opmodaq.parameters as params
import opmodaq.device as dev
import opmodaq.generators as gen
from ctypes import cast, POINTER, c_ushort
from mcculw import ul, structs, enums
from mcculw.enums import ULRange, InterfaceType
from mcculw.device_info import DaqDeviceInfo
fro... | MenloSystems/opMoDAQ | opmodaq/opmodaq/devices/mcc_mccul.py | mcc_mccul.py | py | 5,285 | python | en | code | 0 | github-code | 1 |
5594272033 | t = int(input())
for i in range(t):
n,p = map(int, input().split())
if n==1 or n==2:
print(p**3)
continue
maximum = n%(int(n/2)+1)
k = p - maximum
y = p - n
ans = (k**2)+(k*y)+(y**2)
print(ans) | mayank-kumar-giri/Competitive-Coding | JanuaryLongChallenge/modulo.py | modulo.py | py | 237 | python | en | code | 0 | github-code | 1 |
11020158140 | from django.shortcuts import render
from app01 import models
from utils import mypage
# Create your views here.
def book_list(request):
# 查找到所有的书籍
books = models.Book.objects.all()
# 拿到总数据量
total_count = books.count()
# 从url拿到page参数
current_page = request.GET.get("page", None)
page_obj ... | xyw324/DemoPaging | app01/views.py | views.py | py | 674 | python | en | code | 2 | github-code | 1 |
16166429334 | # coding: utf-8
from abc import ABCMeta
import asyncio
import json
from aiohttp import web, MsgType
from bson import json_util
from django.conf import settings
from django.utils.timezone import now
from parkkeeper import models
from parkkeeper.event import async_recv_event, get_sub_socket
from parkkeeper.const import M... | telminov/django-park-keeper | parkkeeper/ws.py | ws.py | py | 8,471 | python | en | code | 4 | github-code | 1 |
23550603160 | import logging
import os
import time
from pathlib import Path
import tomllib
IS_DEVELOPMENT = bool(os.environ.get("DEVELOPMENT", False))
parsed_toml = tomllib.load(open("config.toml", "rb"))
SECRET_KEY = parsed_toml.get("SECRET_KEY", "S$cR3t_K3y")
API_HOST = parsed_toml.get("API_HOST")
API_PORT = int(parsed_toml.get... | GetWVKeys/wv_cdm_api | api/config.py | config.py | py | 1,107 | python | en | code | 32 | github-code | 1 |
20994349960 | import inspect
import tokenize
from indenter import Indenter
import pylatex
from .utilities import is_list_or_set
from .traits import TraitRegistry, Trait
newlines = "\n\n"
def content_report(fidia_trait_registry):
# type: (TraitRegistry) -> str
assert isinstance(fidia_trait_registry, TraitRegistry)
... | astrogreen/fidia | fidia/reports.py | reports.py | py | 15,595 | python | en | code | 0 | github-code | 1 |
12270733668 | from laser import *
g = Grid(100,100,[[3,4],[7,8]], [[5,9], [99, 33]])
# s = State(3, 4, RIGHT, MINNOR, [], 1)
# print(s)
# for s in s.next_states(g):
# print(s)
m = Manichie()
init_s = State(-1, 0, RIGHT, EMPTY, [], 0)
print(m.trans_states([init_s], g))
| qq915522927/vmware-2019-code-challenge | test.py | test.py | py | 262 | python | en | code | 0 | github-code | 1 |
27421766026 | #!/usr/bin/env python3
# coding: utf-8
# In[2]:
import numpy as np
import keras
class DataGenerator(keras.utils.Sequence):
def __init__(self, input_texts, target_texts, input_token_index, target_token_index, max_encoder_seq_length, max_decoder_seq_length, num_encoder_tokens, num_decoder_tokens, batch_size, shuf... | GirayEryilmaz/University-Projects | cmpe597/project/seq2seq.py | seq2seq.py | py | 10,255 | python | en | code | 1 | github-code | 1 |
36500206584 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 15:07:43 2020
@author: Pooya Poolad
A poisson event generator.
"""
try:
import numpy as np
import numpy.random as rnd
#import matplotlib.pyplot as plt
from numba import jit,cuda
from numba.cuda.random import create_xoroshiro12... | ppoolad/MonteCarlo_ToF | Utility/event_generator.py | event_generator.py | py | 4,924 | python | en | code | 4 | github-code | 1 |
70839196513 | # 디버깅용 시험 제출시 제거
import sys
sys.stdin = open('input.txt','r') # 표준입력을 콘솔창에서 파일로 변경
q = 10
for test_case in range(1, q + 1):
N = int(input())
h = list(map(int, input().split()))
view = 0
for i in range(2, N - 2):
#left = h[i - 2] if (h[i - 2] > h[i - 1]) else h[i - 1]
#right... | ckdfh0917/Algorithm | 알고리즘/D01_배열1/01_practice/view.py | view.py | py | 611 | python | ko | code | 0 | github-code | 1 |
8803404546 | #!/usr/bin/env python3
#coding: utf-8
############################################
# B-CNA-410 #
############################################
# #
# MONFA-MATAS Patricica & ROZET Corentin #
# #
# ... | sheiiva/CNA_groundhog | src/main.py | main.py | py | 848 | python | de | code | 0 | github-code | 1 |
22653630816 | from PIL import Image
import os
import codecs
include_extension = ['bmp']
def P2A(image, name):
x,y = image.size
print(f"x={x},y={y}\n")
file = codecs.open(name, 'w', 'utf-8')
for i in range(x):
for j in range(y):
r,g,b = image.getpixel((i,j))
file.write(f"{r},{g},{b},"... | Dalminham/CV_Processing | General_format/Evaluation/Pic2Array.py | Pic2Array.py | py | 728 | python | en | code | 0 | github-code | 1 |
736500735 | import bs4
import requests
import json
from io import StringIO
import gzip
import csv
import codecs
from bs4 import BeautifulSoup
import sys
import io
import StringIO
reload(sys)
sys.setdefaultencoding('utf-8')
linker = []
myTopics = ["football","basketball","nba","mls","nfl","nhl","cricket","soccer"]
def GetRecord... | SouravBihani/Large-Scale-Text-Processing | Data/Common Crawl/Utilities/CCDataExtract.py | CCDataExtract.py | py | 3,095 | python | en | code | 1 | github-code | 1 |
73599315554 | import unittest
from unittest import mock
from ..pyodbc_helpers import *
class Test_module_pyodbc_helpers(unittest.TestCase):
def fix_dbc(self):
dbc = mock.MagicMock(spec=['cursor', 'autocommit', 'rollback'])
dbc.autocommit = True
dbc.cursor.return_value.__enter__.return_val... | ivangeorgiev/gems | legacy/src/pyodbc_helpers/tests/test_pyodbc_helpers.py | test_pyodbc_helpers.py | py | 3,790 | python | en | code | 14 | github-code | 1 |
2715646635 | import os,glob
from Bio import SeqIO
import statistics
import numpy as np
from Bio.Seq import Seq
input_bs_file = '/scratch/users/anniz44/genomes/donor_species/vcf_round2/BS/binding_results_ccpA.txt'
ref_BS = '/scratch/users/anniz44/genomes/donor_species/vcf_round2/BS/ccpA_BS_RegPrecise_difflength.fa'
vcf_folder = '/s... | caozhichongchong/snp_finder | snp_finder/scripts/compareBSold.py | compareBSold.py | py | 11,703 | python | en | code | 2 | github-code | 1 |
35436338480 | #! /usr/bin/env python3
import re
data = ""
with open('05.txt', 'r') as file:
data = file.read().strip()
# ignore cid for now
import math
maxseat = -1
for row in data.strip().split('\n'):
bins = row[0:7]
lr = row[7:]
rng = (0, 127)
for binc in bins[0:-1]:
diff = int(rng[1]) - int(rng[0])... | finwarman/advent-of-code-2020 | 05/01.py | 01.py | py | 1,127 | python | en | code | 1 | github-code | 1 |
2158776369 | import torch
import open_clip
from pathlib import Path
import pandas as pd
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-32', pretrained='laion400m_e32')
def vectorize(img):
with torch.no_grad():
image = preprocess(img).unsqueeze(0)
vec = model.encode_im... | wyttnik/SimilarImageSearchNeuron | base_creation.py | base_creation.py | py | 733 | python | en | code | 0 | github-code | 1 |
12838807967 | import random
print("\t\tWelcome in the game 'Guess The Number':)")
hidden_number = random.randint(1,1000)
print("\nI guessed the number in range 1 to 1000")
print("Try to guess the number for the minimum amount of tries! GOOD LUCK;) ")
amount_of_tries = 0
input_value = 0
while True:
input_value = int(input("Enter ... | HackCodeMan/python-project | Игра Отгадай Число/Guess the number.py | Guess the number.py | py | 713 | python | en | code | 0 | github-code | 1 |
23637428297 | class Relogio:
def __init__(self, hora, minuto, segundo) -> int:
self.hora = hora
self.minuto = minuto
self.segundo = segundo
def anvacar(self,valor):
self.segundo = self.seundo + valor
if self.segundo == 60:
self.minuto = self.minuto + 1
elif... | Pedroliaan/POO-dependencia | lista férias/025.py | 025.py | py | 1,351 | python | pt | code | 0 | github-code | 1 |
25009901167 | # -*- coding: utf-8 -*-
from fastapi import APIRouter, Path
from .controllers import PostCtrl
post_router = APIRouter(prefix='/posts')
@post_router.get('', summary="获取文章列表")
async def get_posts_list(page: int = 1, per_page: int = 10):
pagination = PostCtrl().get_posts_paginate(page=page, per_page=per_page)
... | zxins/fast-lofter | services/post/apis.py | apis.py | py | 816 | python | en | code | 0 | github-code | 1 |
10711671633 | import pandas as pd
import pandas.testing as tm
import numpy as np
from numpy import loadtxt
from sklearn.cluster import KMeans
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
import xgboost
from xgboost import XGBClassifier
import hashlib
import json
from time import time
... | eelay234/blockchain | progress/Web3/June/fraud_detection_using_kmeans.py | fraud_detection_using_kmeans.py | py | 9,159 | python | en | code | 0 | github-code | 1 |
29455914344 | # Import the necessary modules.
import tkinter as tk
import tkinter.messagebox
import pyaudio
import wave
import os
import threading
class RecAUD:
def __init__(self,topic_names ,chunk=3024, frmat=pyaudio.paInt16, channels=2, rate=44100):
# Start Tkinter and set Title
self.topic_names = topic_names
... | duchung19399/voice-recording | record.py | record.py | py | 7,351 | python | en | code | 0 | github-code | 1 |
15226484150 | import time
import os, sys
import traceback
import socket
import hmac
import hashlib
import mensagem_pb2
import threading
from random import randint
import logging
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(threadName)s:%(message)s')
from random import (
choice, randint
)
from string import (
... | VictorSCosta/Python-Protobuf-example-client-server | servidor.py | servidor.py | py | 2,582 | python | pt | code | 0 | github-code | 1 |
21753575473 | from time import sleep
r1 = int(input('Digite o 1° lado do triangulo: '))
r2 = int(input('Digite o 2° lado do triangulo: '))
r3 = int(input('Digite o 3° lado do triangulo: '))
print ('Calculando....')
sleep(2)
if r1 + r2 > r3 or r1 + r3>r2 or r3+r1>r1:
if r1==r2 and r2==r3:
print ('Você formou u... | Brunlr/Curso_em_Video_Python | EX042.py | EX042.py | py | 741 | python | pt | code | 0 | github-code | 1 |
16136952400 | from bson import ObjectId
from fastapi import HTTPException
from starlette import status
from app.api.dto.user import User
from app.repository.entity.user_entity import UserEntity
from app.repository.user_repository import UserRepository
from app.util.logger import logger
class UserDBService:
def __init__(self, ... | amosproj/amos2023ws01-ticket-chat-ai | Backend/app/service/user_db_service.py | user_db_service.py | py | 2,331 | python | en | code | 3 | github-code | 1 |
71223312995 | # O(n)
# n = n
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
res = []
for i in range(1, n + 1):
string = ""
if i % 3 == 0:
string += "Fizz"
if i % 5 == 0:
string += "Buzz"
res.append(string if len(string) > ... | ClaudioCarvalhoo/you-can-accomplish-anything-with-just-enough-determination-and-a-little-bit-of-luck | problems/LC412.py | LC412.py | py | 353 | python | en | code | 0 | github-code | 1 |
7074745807 | from django.conf.urls import include
from utils.urls import cbv_url_helper as url
from . import views
urlpatterns = [
url(r'^$', views.SuperAdminHomeView),
url(r'^stats/$', views.StatsView),
url(r'^stats/initial/$', views.InitialStatsView),
url(r'^stats/get/$', views.GetStatsView),
url(r'^admins... | s3vdev/sxconsole-lite | sxconsole-lite/sxconsole/urls.py | urls.py | py | 502 | python | en | code | 0 | github-code | 1 |
26297959246 | from kafka import KafkaProducer
import sys
msg = str(sys.argv[1])
def run():
try:
producer = KafkaProducer(
bootstrap_servers = ['localhost:9093','localhost:9094','localhost:9095']
)
def message() -> dict:
if msg[0] < "N":
partition = 0
... | fzayed/Project-Milestone-Group-11 | Lab 2/Ireni_100657302/kafka-python/producer.py | producer.py | py | 837 | python | en | code | 0 | github-code | 1 |
9486016084 | import os
def disk_usage(path):
total=os.path.getsize(path)
if os.path.isdir(path):
for filename in os.listdir(path):
childpath = os.path.join(path,filename)
total+=disk_usage(childpath)
print("{0:<7}".format(total),path)
return total
def sum_linear(s,n):
... | koustavmandal95/Python_Basic_codes | disk_storage.py | disk_storage.py | py | 876 | python | en | code | 0 | github-code | 1 |
70752875233 | with open('day17.txt') as file:
line = file.readline().strip()
_, _, x_range, y_range = line.split()
x_range = x_range.split('=')[1].removesuffix(',')
y_range = y_range.split('=')[1].removesuffix(',')
x_min, x_max = [int(x) for x in x_range.split('..')]
y_min, y_max = [int(y) for y in y_range.sp... | blat-blatnik/Advent-of-Code | 2021/day17.py | day17.py | py | 1,516 | python | en | code | 0 | github-code | 1 |
3581159598 | from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
#for rendering templates with flask
#First letter must be uppercase
app = Flask(__name__) #The name of the application name or package
#app.config['SQLALCHEMY_DATABASE_URI']= 'postgresql+psycopg2://postgres:Aluc... | kevinnarvaes/fav-quotes-flaskapp | quotes.py | quotes.py | py | 1,787 | python | en | code | 0 | github-code | 1 |
40818797234 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
driver=webdriver.Chrome()
driver.implicitly_wait(5)
driver.maximize_window()
driver .get ("https://tr.wikipedia.org/wiki/Anasayfa")
seçkin_madde_alanı=driver.find_element(By.ID,"mp-tf... | htcAK/selen-um | çalışma_sayfam.py | çalışma_sayfam.py | py | 608 | python | tr | code | 0 | github-code | 1 |
27823076441 | import cv2
class ShapeDetection():
def __init__(self):
self.corners = []
self.is_displaying = False
"""
Trouve les contours du plus grand quadrilatère sur l'image envoyée
"""
def detect_from_picture(self, img):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
_, thre... | GregoryMoutote/issou_project | Calibration/ShapeDetection.py | ShapeDetection.py | py | 1,667 | python | en | code | 0 | github-code | 1 |
22288570912 | import torch
import torch.nn.functional as F
from torch.distributed.tensor.parallel import (
PairwiseParallel,
parallelize_module,
)
from torch.distributed._tensor import DeviceMesh, distribute_tensor, DTensor
from torch.distributed._tensor.placement_types import _Partial, Replicate, Shard
from torch.testing._... | llv22/pytorch-macOS-cuda | test/distributed/_tensor/test_dtensor.py | test_dtensor.py | py | 17,654 | python | en | code | 2 | github-code | 1 |
73111180834 | # -*- coding: utf-8 -*-
import scrapy
import time
from scrapy.http import Request
from loguru import logger
from SafetyInformation.items import SafeInfoItem
from SafetyInformation.settings import SLEEP_TIME, TOTAL_PAGES
class SecUnSpider(scrapy.Spider):
name = 'sec_un'
allowed_domains = ['sec-un.org']
st... | Silentsoul04/SafetyInformation | SafetyInformation/spiders/sec_un.py | sec_un.py | py | 2,029 | python | en | code | 0 | github-code | 1 |
41032364306 | import os
import jinja2
import yaml
from pathlib import Path
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
autoescape=jinja2.select_autoescape(
enabled_extensions=("html", "xml"), default_for_string=True
),
)
if __name__ == "__main__":
sdk_metadata = Pat... | awsdocs/aws-doc-sdk-examples | .tools/images/render-blurbs.py | render-blurbs.py | py | 689 | python | en | code | 8,378 | github-code | 1 |
35575043040 | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Article, Lesson, NewUser, Tutorial, Chapter, Book
from .serializers import (ArticleSerializer,
RegisterSerializer,
LoginSeri... | devanshsharma416/ReactDjangoApplication | UserModel/views.py | views.py | py | 8,063 | python | en | code | 1 | github-code | 1 |
20994653930 | # Increase the chances that this code will work in both Python 2 and Python 3 (however, this is written for Python 3!!!)
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shutil
from typing import *
from astropy.io import fits
from tdfdr import aaorun
import loggin... | astrogreen/obs_techniques_workshop | data_reducer.py | data_reducer.py | py | 5,514 | python | en | code | 0 | github-code | 1 |
1146211945 | import sys
input = sys.stdin.readline
s = list(input().rstrip('\n'))
mul , answer = 1, 0
Stack = []
for index, data in enumerate(s):
if data == '(':
mul *= 2
Stack.append('(')
elif data == '[':
mul *= 3
Stack.append('[')
elif data == ')':
if len(Stack) == 0 or Stack[... | seoljeongwoo/learn | algorithm/boj_2504.py | boj_2504.py | py | 676 | python | en | code | 0 | github-code | 1 |
72357043233 | # This script creates the color-color and rms plots used in state separation
# This is quite messy because of the different ways the rms and coco files are defined
import os
import numpy as np
from matplotlib import pyplot as plt
from math import exp
from math import sqrt
import matplotlib
import matplotlib.patches ... | jkuut/dyn-pow-method | colcol_rms.py | colcol_rms.py | py | 8,867 | python | en | code | 0 | github-code | 1 |
674845764 | import sys
if sys.version_info.major == 2:
import mock
else:
from unittest import mock
import json
import numpy as np
import random
import string
import tensorflow as tf
from grpc._cython import cygrpc
from nose.tools import assert_equal
from nose.tools import assert_is_instance
from nose.tools import assert... | maibrahim2016/background_removal | src/models/tests/test_segmenter.py | test_segmenter.py | py | 10,993 | python | en | code | 0 | github-code | 1 |
18187474839 | import pytest
from forest.components import tiles
@pytest.mark.parametrize(
"name,expect",
[
(
tiles.OPEN_STREET_MAP,
"https://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png",
),
(
tiles.STAMEN_TERRAIN,
"http://tile.stamen.com/terrain-backgroun... | MetOffice/forest | test/test_components_tiles.py | test_components_tiles.py | py | 2,153 | python | en | code | 38 | github-code | 1 |
37120203160 | from typing import List
import timm
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from detectron2.layers import ShapeSpec
from detectron2.modeling import Backbone
from detectron2.modeling.backbone.fpn import LastLevelMaxPool
__all__ = ["BiFPN"]
def get_world_siz... | zetyquickly/DensePoseFnL | fpn.py | fpn.py | py | 5,990 | python | en | code | 113 | github-code | 1 |
24248168494 | from collections import defaultdict
class TrieNode:
def __init__(self):
self.is_word = False
self.children = defaultdict(TrieNode)
class WordDictionary:
def __init__(self):
self.root = TrieNode()
def add_word(self, word):
cur_node = self.root
for ch in word:
... | ekinrf/ProgPuzzles | Cache/python/word_dict.py | word_dict.py | py | 968 | python | en | code | 0 | github-code | 1 |
34841985760 | # Binary Tree Right Side View: https://leetcode.com/problems/binary-tree-right-side-view/
# Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
# Initial solution is pretty simple you just do a depth level traversal... | KevinKnott/Coding-Review | Month 01/Week 01/Day 06/a.py | a.py | py | 2,545 | python | en | code | 0 | github-code | 1 |
71994365793 | from django.urls import path
from .views import *
from . import views
app_name='eventos'
urlpatterns = [
path('calendario-dinamico/', Calendario.as_view(), name='calendario-dinamico'),
path('evento/',MostrarEvento.as_view(), name='detalle-evento'),
path('evento/<int:pk>/asistencias',ConfirmarAsistencia.as... | lucasppperalta/ONG-WEB-BLOG-INFORMATORIO2 | eventos/urls.py | urls.py | py | 1,195 | python | es | code | 0 | github-code | 1 |
4350359718 | # text constants
ARIEL = "ariel"
WHITE = (255, 255, 255)
GREEN = (0, 150, 0)
# screen constants
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
# players constants
PLAYER_HEIGHT = 100
PLAYER_MAX_Y = WINDOW_HEIGHT - 150 # legs line
PLAYER_MIN_Y = PLAYER_MAX_Y - PLAYER_HEIGHT - 25
# goal constants
Y_GOAL = WINDOW_HEIGHT / 2
... | NoamG888/Head-soccer | constants.py | constants.py | py | 371 | python | en | code | 0 | github-code | 1 |
27401851860 | import pytest
from cognite.pygen.utils.text import to_pascal, to_snake
@pytest.mark.parametrize(
"word, singularize, pluralize, expected",
[
("Actress", True, False, "Actress"),
("BestLeadingActress", True, False, "BestLeadingActress"),
("Actress", False, True, "Actresses"),
],
)
... | cognitedata/pygen | tests/test_unit/test_generator/test_utils/test_text.py | test_text.py | py | 942 | python | en | code | 2 | github-code | 1 |
19322565982 | n = int(input())
data = []
data = list(map(int, input().split()))
data.sort()
result = 0
def get_primes(n):
is_prime = [False, False] + [True]*(n+1)
max_range = int(n**0.5)
for i in range(2, max_range+1):
if is_prime[i]:
for j in range(i*2, n+1, i):
is_prime[j] = False
... | hanameee/Algorithm | Fastcampus/baekjoon/src/1978.py | 1978.py | py | 497 | python | en | code | 2 | github-code | 1 |
17218843406 | from sys import stdin
def exp(b,e,m):
res = 1
b %= m
while e > 0:
if e & 1:
res = (res * b) % m
b = (b*b) %m
e >>= 1
return res
def main():
for line in stdin:
a,op,b = line.split()
a,b = map(int,(a,b))
if op == '+':
print((a%... | MatthewFreestone/Kattis | checkingforcorrectness/ch.py | ch.py | py | 499 | python | en | code | 0 | github-code | 1 |
23411365980 | #!/usr/bin/python3
"""Program to automatically type strings in application windows upon
authenticating with a RFID or NFC UID. Useful for example to enter your master
password in Mozilla Firefox or Mozilla Thunderbird, which don't integrate with
any third-party keyring manager.
To add a rule for automatic typing, invo... | richardevcom/PAMPy-NFC | bin/scripts/ppnfc_autotype.py | ppnfc_autotype.py | py | 17,131 | python | en | code | 1 | github-code | 1 |
27577939256 | from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from tickets.models import Ticket
@login_required
def dashboard(request):
#from django.apps.apps import get_model
#t = get_model('openticketing', 'Ticket')
from django.db import connection
with connection.cur... | majidasadish/OpenTicketing | OpenTicketing/tickets/app_views/pages/dashboard.py | dashboard.py | py | 826 | python | en | code | null | github-code | 1 |
15973346603 | # module
import multiprocessing
import pandas as pd
import time
# custom utils
import utils_c
def get_asm_img(file_name):
root_path = '../'
colnames = ['asm_img_' + str(i+1) for i in range(1000)]
feature_list = {'hash': file_name}
for v in colnames:
feature_list[v] = 0
file_path = root... | SONG-WONHO/DataChallenge2018 | module/module_asm_to_img/main.py | main.py | py | 1,639 | python | en | code | 0 | github-code | 1 |
31502391023 | #!/usr/bin/python3
from helpers import session
from helpers import cookies
from helpers import form
import json
import cgi
import os
import datetime
print("Content-Type: text/html")
def simple_message(message):
print("")
print(message)
print("<br>")
print('Redirecting you back in 5 seconds...<meta http-equiv="ref... | abir-taheer/silver-potato | process_submission.py | process_submission.py | py | 1,439 | python | en | code | 0 | github-code | 1 |
32244067237 | # Python 3.6
"""
Peak handle functions.
Maintainer: Shpakov Konstantin
Link: https://github.com/shpakovkv/SignalProcess
"""
from __future__ import print_function
import matplotlib
import matplotlib.pyplot as pyplot
import os
import sys
import numpy
import bisect
import argparse
import numpy as np
import scipy.int... | shpakovkv/SignalProcess | scripts/PeakProcess.py | PeakProcess.py | py | 37,640 | python | en | code | 0 | github-code | 1 |
36861387593 | """Models for storing VCF variant statistics information."""
import enum
import hashlib
import math
import pathlib
import typing
import attr
import cattr
import json
from logzero import logger
import vcfpy
_TGenotype = typing.TypeVar("Genotype")
class Genotype(enum.Enum):
#: Reference homozygous.
REF = "0... | holtgrewe/clin-qc-tk | qctk/models/vcf.py | vcf.py | py | 5,860 | python | en | code | 0 | github-code | 1 |
73214463715 | import os
import json
import torch
from simpletransformers.question_answering import QuestionAnsweringModel
from evaluate import in_eval
def create_parentDir(path, exist_ok=True):
head, tail = os.path.split(path)
os.makedirs(head, exist_ok=exist_ok)
def read_data(train_file, dev_file, test_file=None):
tra... | TingFree/WDA | bert_qa.py | bert_qa.py | py | 4,038 | python | en | code | 0 | github-code | 1 |
70839100513 | import sys
sys.stdin = open('input.txt', 'r')
for test_case in range(1,11):
q = int(input()) # 쓰레기값
print('#{} '.format(test_case), end='')
arr = []
for _ in range(100):
arr.append(list(map(int, input().split())))
# 도착점 찾기
k = 0
for j in range(100):
if arr[99][j] == 2:
... | ckdfh0917/Algorithm | SW-Expert-Academy/D4/1210. Ladder1.py | 1210. Ladder1.py | py | 1,252 | python | ko | code | 0 | github-code | 1 |
39117178463 | #####################################################################
#
# CAS CS 320, Spring 2015
# Midterm (skeleton code)
# analyze.py
#
# ****************************************************************
# *************** Modify this file for Problem #5. ***************
# ******************************************... | alekplay/schoolwork | CS320/midterm/analyze.py | analyze.py | py | 2,484 | python | en | code | 0 | github-code | 1 |
6127005103 | #!/usr/bin/python3
# HW3
# Vivek Khanolkar
# vkhanolk
# 2/11/2021
#Following code modified from FindMI.py
import sys
if len(sys.argv) != 3:
sys.stderr.write("Usage: %s <integer> <modulus>\n" % sys.argv[0])
sys.exit(1)
NUM, MOD = int(sys.argv[1]), int(sys.argv[2])
# utilizing russianPeasant method ... | vivek42537/ECE-404 | HW3/mult_inv.py | mult_inv.py | py | 1,736 | python | en | code | 0 | github-code | 1 |
8877755972 | # modified https://www.tutorialspoint.com/python_data_structure/python_graph_algorithms.htm
from operator import add
class graph:
def __init__(self,gdict=None):
if gdict is None:
gdict = {}
self.gdict = gdict
pq = []
path = []
pqh = []
def ufc(graph, start, cost, goal, explored = None ):
... | asamak1351/CSE-5120-Programming-Assignment--1 | roman/ufc.py | ufc.py | py | 2,542 | python | en | code | 0 | github-code | 1 |
11777003093 | import sys, os, struct, ctypes, ctypes.util, socket, Queue, threading
from os.path import *
sys.path.append(dirname(dirname(abspath(__file__))))
from kitchen import *
from rfid.rfid_tag_read import *
from utils.general_utils import *
def encode(x):
if type(x) == str: # python2.x
return x.encode('hex')
... | fridgeresearch/kitchen | backend/python/bluetoothle/ble.py | ble.py | py | 5,081 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.