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
19710916694
""" source: https://www.hackerrank.com/challenges/breaking-best-and-worst-records/problem explanation : https://kitle.xyz/post/145/ """ # Complete the breakingRecords function below. def breakingRecords(scores): h_score = None h_score_cnt = 0 l_score = None l_score_cnt = 0 for i in scores: ...
kitlexyz/algorithm
hackerrank/breaking-best-and-worst-records.py
breaking-best-and-worst-records.py
py
762
python
en
code
0
github-code
36
27904683592
import argparse def parse_args(): """ parsing and configuration :return: parse_args """ desc = "Tensorflow implementation of pix2pix" parser = argparse.ArgumentParser(description=desc) parser.add_argument('--module', type=str, default='test_dataset', help...
SunNYNO1/pix2pix
code/config.py
config.py
py
2,348
python
en
code
0
github-code
36
2152538973
import os import sqlite3 from sqlite3.dbapi2 import Connection, Cursor from typing import Any, AnyStr, Final, Optional import codenotes.db.utilities.notes as notes import codenotes.db.utilities.notes_categories as notes_categories import codenotes.db.utilities.tasks as tasks import codenotes.db.utilities.tasks_categor...
EGAMAGZ/codenotes
codenotes/db/connection.py
connection.py
py
3,101
python
en
code
0
github-code
36
3023673855
import os from PIL import Image import PIL.ImageOps import argparse import torchvision as V import matplotlib.pyplot as plt import ujson as json import glob import re from . import configs import rich from rich.progress import track console = rich.get_console() def mnist_burst(dest: str, split: str, *, mnist='...
cdluminate/MyNotes
rs/2022-veccls/veccls/mnist.py
mnist.py
py
2,329
python
en
code
0
github-code
36
41774659941
from scapy.all import * from scapy.layers.dot11 import Dot11, Dot11Beacon, Dot11Elt, RadioTap, Dot11Deauth from colorama import Fore from string import Template import run class fakeAP: fake_ap_interface = "none" fake_ssid = "fake" sniffer = "none" def __init__(self, fake_ap_interface, fake_ssid, sn...
yehonatanBar61/EvilTwin_T
fakeAP.py
fakeAP.py
py
5,330
python
en
code
0
github-code
36
70172687463
from django.shortcuts import render # allow us to redirect from django.shortcuts import redirect from django.shortcuts import HttpResponseRedirect from django.core.urlresolvers import reverse from django.http import HttpResponse from django.template import RequestContext, loader # import the User class in models.py ...
luojianhe1992/Django_many_to_one-relation-test
Django many_to_one relation test/HoneyCell_django/WebApp/views.py
views.py
py
8,790
python
en
code
1
github-code
36
6071086081
''' Created on 29.03.2017 @author: abaktheer Microplane Fatigue model 3D (compressive plasticity (CP) + tensile damage (TD) + cumulative damage sliding (CSD)) Using Jirasek homogenization approach [1999] ''' import numpy as np from bmcs_utils.api import Float, View, Item from ibvpy.tmodel.mats3D.mats3D_eval import ...
bmcs-group/bmcs_matmod
bmcs_matmod/ntim/vuntim.py
vuntim.py
py
12,151
python
en
code
0
github-code
36
26558715293
#!/usr/bin/env python3 import sys import os import argparse import pandas as pd import vcf def main(): parser = argparse.ArgumentParser(description="Build reference set consisting of a selection of samples per pangolin lineage.") parser.add_argument('--vcf', required=True, type=str, nargs='+', help="vcf file...
baymlab/wastewater_analysis
manuscript/select_samples_v1.py
select_samples_v1.py
py
7,931
python
en
code
14
github-code
36
21031561371
logs = ['dig1 8 1 5 1', 'let1 art can', 'dig2 3 6', 'let2 own kit dig', 'let3 art zero'] letters, digits = [], [] for log in logs: if log.split()[1].isdigit(): digits.append(log) else: letters.append(log) # sort의 키 정렬. 키를 여러 개 이상 두는 경우 앞에서부터 차례대로 선순위 정렬을 한다.) letters.sort(key=lambda x: (x.spli...
mynamesunpower/algorithm-with-python
03_reorder-log-files/lambda_reorder-log-files.py
lambda_reorder-log-files.py
py
542
python
ko
code
0
github-code
36
19258063201
from test_interface_auto.common.Login import Login # 编辑联系人接口调用 s=Login("15637887286","1234qwer").login() linkmanEditUrl="https://cccrmtest.taxchina.com/crm/linkman/edit" linkmanEditBody={ "custId":"1761", "lkmId": "2854", "lkmName":"相同名字", ...
DXH20191016/untitled
test_interface_auto/common/demo.py
demo.py
py
981
python
en
code
0
github-code
36
15351976065
import os import sys import torchvision.models as models import torch import cv2 import argparse import os import time import json import sys import dlib import pandas as pd import numpy as np import imutils from imutils.face_utils import FaceAligner from tensorflow.keras.models import load_model, model_from_json root...
Freja1122/ERFramework
models/face/facePredictions_faceAPI.py
facePredictions_faceAPI.py
py
4,195
python
en
code
1
github-code
36
15675080040
from django.views.decorators.http import require_http_methods from common.json import ModelEncoder from .models import AutomobileVO, SalesPerson, Customer, SaleRecord from django.http import JsonResponse import json class AutomobileVOEncoder(ModelEncoder): model = AutomobileVO properties = [ "vin", ...
colinprize/DealershipPro
sales/api/sales_rest/views.py
views.py
py
6,502
python
en
code
0
github-code
36
23861721195
import random import string def get_random_string(length): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(length)) class Cipher: def __init__(self, key=None): if key: self.key = key else: self.key = get_random_string(100) ...
stackcats/exercism
python/simple_cipher.py
simple_cipher.py
py
1,230
python
en
code
0
github-code
36
33650052777
import os, sys sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')) import subprocess import shlex import re import pexpect from nltk.tokenize.stanford_segmenter import StanfordSegmenter from nltk import tokenize from TMPosTagger.TMJapanesePosTagger import TMMyKyteaTagger from TMPreprocess...
shasha79/nectm
src/TMPosTagger/TMTokenizer.py
TMTokenizer.py
py
17,900
python
en
code
5
github-code
36
36121458003
import random import json from typing import Tuple, Union, Dict, Any from forte.data.ontology import Annotation from forte.processors.data_augment.algorithms.single_annotation_op import ( SingleAnnotationAugmentOp, ) from forte.common.configuration import Config from forte.utils import create_import_error_msg __...
asyml/forte
forte/processors/data_augment/algorithms/typo_replacement_op.py
typo_replacement_op.py
py
4,240
python
en
code
230
github-code
36
20857499607
#https://leetcode.com/problems/merge-two-binary-trees/ # 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 mergeTrees(self, root1: Optional[TreeNode], root...
manu-karenite/Problem-Solving
BinaryTree/merge2BinaryTrees.py
merge2BinaryTrees.py
py
2,095
python
en
code
0
github-code
36
9044214062
import requests import json import pandas as pd from dotenv import load_dotenv import os load_dotenv() API_KEY = os.getenv("API_KEY") def extract_lat_long_via_address(address_or_zipcode): lat, lng = None, None base_url = "https://maps.googleapis.com/maps/api/geocode/json" endpoint = f"{base_url}?address=...
shrey150/playeasy-gis
convert_to_csv.py
convert_to_csv.py
py
1,396
python
en
code
0
github-code
36
32179628999
from kütüphane import * print("""*********************************** Kütüphane Programına Hoşgeldiniz. İşlemler; 1. Kitapları Göster 2. Kitap Sorgulama 3. Kitap Ekle 4. Kitap Sil 5. Baskı Yükselt Çıkmak için 'q' ya basın. ***********************************""") kütüphane = Kütüphane() ...
mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Sqlite Veritabanı/Kodlama Egzersizleri/proje_deneme.py
proje_deneme.py
py
1,943
python
tr
code
1,816
github-code
36
29380151380
import scrapy from bs4 import BeautifulSoup class CNGlobalStock(scrapy.Spider): # modeled after: https://wallstreetcn.com/articles/3499602 name = "wallstreetcn" start_urls = ["https://wallstreetcn.com/articles/3499602"] def parse(self, response): article_body = response.css("div.rich-...
mattfeng/bluefire
scrapers/wallstreetcn/old/wallstreetcn_scraper.py
wallstreetcn_scraper.py
py
796
python
en
code
1
github-code
36
28068227622
#2217 로프 ( sort) import sys input = sys.stdin.readline N = int(input()) result = [] for i in range(N): result.append(int(input())) result.sort(reverse=True) max_value = 0 for i in range(len(result)): temp = result[i] * (i+1) if temp > max_value: max_value = temp print(max_value) # 1931 회의실 배정 i...
hwanginbeom/algorithm_study
1.algorithm_question/8.Sort/13. sorting_summary_inbeom.py
13. sorting_summary_inbeom.py
py
673
python
en
code
3
github-code
36
40627498679
import db_manager as dbm import handler as hdl def prompt_entry(): print("\nMODO INSERÇÃO:") inp_date = hdl.inp_date_handle(message = "Insira a data [ddbmmaaaa]: ") inp_time = hdl.inp_time_handle() inp_value = hdl.inp_float_handle() try: entry = dbm.tb_entry(Data = inp_date, Hora =...
VFLins/Cashd
prompter.py
prompter.py
py
1,674
python
pt
code
0
github-code
36
40799381446
N = int(input()) res = 0 cols = [0] * N # 각 열에 퀸이 놓였는지를 기록하는 배열 diags1 = [0] * (2*N-1) # / 방향의 대각선에 퀸이 놓였는지를 기록하는 배열 diags2 = [0] * (2*N-1) # \ 방향의 대각선에 퀸이 놓였는지를 기록하는 배열 def dfs(x): global res if x == N: res += 1 return for y in range(N): if cols[y] or diags1[x+y] o...
devjunmo/PythonCodingTest
백준/Gold/9663. N-Queen/N-Queen.py
N-Queen.py
py
665
python
ko
code
0
github-code
36
71331018983
from flask import render_template, flash, redirect, url_for, request, jsonify from datetime import datetime from application.Utils.CLP_Algorithm.volume_maximization import volume_maximization from application.Utils.utils import params from flask_login import current_user, login_user, logout_user, login_required from js...
carlosdonado10/CLP_flask_app
application/routes.py
routes.py
py
10,983
python
en
code
0
github-code
36
4363721495
from django.shortcuts import render from matplotlib import pylab from pylob import * def graph(): x=[1,2,3,4,5,6] y=[5,2,6,7,2,7] plot(x,y,linewidth=2) xlabel('x axis') ylabel('y axis') title('sample graph') grid(True) pylab.show()
sharmajyo/blogsite
blog/views.py
views.py
py
242
python
en
code
0
github-code
36
37290486339
from django.conf.urls import url from . import views urlpatterns = [ url(r'^test_view/$', views.test_fun_1), url(r'^contact_us/$', views.contact_me_view), url(r'^register_test/$', views.register_test), url(r'^test_progress_bar/$', views.test_progress_bar), url(r'^test_choicefield/',views.test_choi...
bitapardaz/bitasync
code_test/urls.py
urls.py
py
375
python
en
code
0
github-code
36
7577946013
N=101 fact=[0]*N f=[[0]*N for i in range(2)] pre=[0]*N suf=[0]*N def value(x): if x<deg: return f[cur][x] pre[0]=x for i in range(1,deg): pre[i]=pre[i-1]*(x-i) suf[deg-1]=x-deg+1 for i in range(deg-2,-1,-1): suf[i]=suf[i+1]*(x-i) ret=0 for i in range(deg): tmp...
czp001/51nod
1048.py
1048.py
py
911
python
en
code
1
github-code
36
70614595305
class Cell: def __init__(self,x,y,size,widthRes,heightRes): self.x=x self.y=y self.size=size self.widthRes=widthRes self.heightRes=heightRes self.gScore=0 self.fScore=0 self.cameFrom=None if x==-1 and y==-1: self.isVisited=True ...
AliGyula/Maze
cell.py
cell.py
py
1,634
python
en
code
0
github-code
36
5784439690
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from collections import namedtuple import six from .bt import BluetoothConnection from .dummy import DummyConnection from .file import FileConnection from .network import NetworkConnection from .seria...
base4sistemas/pyescpos
escpos/conn/__init__.py
__init__.py
py
2,006
python
en
code
67
github-code
36
26820836865
#Pardhu Gorripati #sqlalchemy components from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, Float from sqlalchemy.orm import sessionmaker from sqlalchemy import and_, or_, not_ Base = declarative_base() class baseRoom...
bobbilisantosh321/python
Final Prj.py
Final Prj.py
py
11,507
python
en
code
0
github-code
36
7816667534
import boto3 import re def move_object(sourceBucket, sourceKey, destinationBucket, destinationKey, isVTT): s3 = boto3.client("s3") print( "Move " + sourceBucket + "/" + sourceKey + " to " + destinationBucket + "/" + destinationKey ) if isVTT is True: s3.copy_obj...
awslabs/serverless-subtitles
lambda/SUBLambdaFunctionOutput/index.py
index.py
py
2,775
python
en
code
126
github-code
36
30334587591
import socket import threading from .globals import Global class Heartbeat(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.host = '127.0.0.1' self.port = Global.BackendConfig.heartbeat_port def run(self): try: server = socket.socket(soc...
vicinity-zw/backend
src/backend/heartbeat.py
heartbeat.py
py
1,061
python
en
code
0
github-code
36
28214999241
CHARACTERS = { # Jedi: Obi-Wan Kenobi, Yoda, Luke Skywalker, Mace Windu, Qui-Gon Jin 'obi_wan': { # Unique ID name 'name': 'Obi-Wan Kenobi', # Display name 'image': 'img/cards/characters/obi-wan.jpg', # Character image name 'affiliation': 'jedi', ...
seanyoung247/SW-CI-hackathon
defs.py
defs.py
py
7,825
python
en
code
0
github-code
36
72198305384
import io from collections import Counter import pandas as pd import plotly.express as px from django.db.models import Count, Sum from django.conf import settings from django.http import HttpResponse from pywaffle import Waffle import matplotlib.pyplot as plt from .countries import REGIONS from .models import DEMOGRA...
LCOGT/globalskypartners
reports/plots.py
plots.py
py
5,063
python
en
code
0
github-code
36
12020491772
import util.id import util.serializer # File containing extensions to native classes to provide a bit of # extra functionality when using existing types. # SQL-like GROUPBY class that also encapsulates the logic in a Unix-like "sort | uniq" # Source: http://code.activestate.com/recipes/259173-groupby/ # Example usage...
Valoren/Angpy
util/extend.py
extend.py
py
4,259
python
en
code
1
github-code
36
31045306948
from step_functions.state_machine_resource import execute_state_machine import click # as per available non english ids https://docs.aws.amazon.com/polly/latest/dg/ntts-voices-main.html NEURAL_VOICE_LIST = [ "Vicki", "Bianca", "Takumi", "Seoyeon", "Camila", "Vitoria", "Ines", "Lucia", ...
ryankarlos/AWS-ML-services
projects/nlp/execute_pipeline.py
execute_pipeline.py
py
3,003
python
en
code
1
github-code
36
4014282432
# 문제 출처 : https://programmers.co.kr/learn/courses/30/lessons/12909 def solution(s): stack = [] for char in s: if char == "(": stack.append("(") elif char == ")": if not stack: return False else: stack.pop() if len(stack) ==...
ThreeFive85/Algorithm
Programmers/level2/rightBracket/right_bracket.py
right_bracket.py
py
383
python
en
code
1
github-code
36
11632604595
from abc import abstractmethod from io import BytesIO from json import JSONEncoder import numpy as np import imageio from PIL import Image from pydicom import Sequence from pydicom import read_file from pydicom.dataelem import PersonName from pydicom.multival import MultiValue from pydicom.valuerep import DA, DT, TM, D...
FDU-VTS/PACS-VTS
PACS/ndicom_server/apps/core/utils.py
utils.py
py
6,224
python
en
code
9
github-code
36
31624111623
import re decode = { "1": "1", "-": "-", "A": "2", "B": "2", "C": "2", "D": "3", "E": "3", "F": "3", "G": "4", "H": "4", "I": "4", "J": "5", "K": "5", "L": "5", "M": "6", "N": "6", "O": "6", "P": "7", "Q": "7", "R": "7", "S": "7", ...
GustafFig/Ciencia-Computacao
exercises/35_4/two.py
two.py
py
828
python
en
code
0
github-code
36
27543322449
fname = input('Enter the file name: ') try: fhand = open(fname) except: print('File cannot be opened: ', fname) exit() domaincount = dict() for line in fhand: lines = line.rstrip() words = lines.split() if len(words) == 0 or words[0] != 'From' : continue else: atspot = words[...
kmcad/class-work
domaincount.py
domaincount.py
py
513
python
en
code
0
github-code
36
38661173242
import time start = time.time() class Queue1Stack(object): def __init__(self): self.stack = [] def enqueue(self,item): self.stack.append(item) def dequeue(self): return self.stack.pop(0) q = Queue1Stack() for i in range(5000): q.enqueue(i) for ...
mystery2828/pythonfiles
queueusing1stack.py
queueusing1stack.py
py
389
python
en
code
1
github-code
36
41023646811
import numpy as np import argparse import cv2 cap = cv2.VideoCapture(0) while(1): ret, frame = cap.read() gray_vid = cv2.cvtColor(frame, cv2.IMREAD_GRAYSCALE) cv2.imshow('Original',frame) edged_frame = cv2.Canny(frame,100,200) cv2.imshow('Edges',edged_frame) if cv2.waitKey(1) & 0xFF == ord('q'): ...
emredogan7/METU-EE-2017-2018-Capstone-Design-Project-Repository
Code/edge_detection_canny.py
edge_detection_canny.py
py
365
python
en
code
2
github-code
36
41516616217
import os import shrimpy from datetime import datetime from arbitrage import * def main(): shrimpy_public_key = os.environ.get("PUBLIC_KEY") shrimpy_secret_key = os.environ.get("PRIVATE_KEY") shrimpy_client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_secret_key) # Works well on binance but...
terencebeauj/arbitrage_scanner
main.py
main.py
py
4,921
python
en
code
1
github-code
36
72007183145
from flask import Flask, request from covid import CovidAssist import pycountry import requests_cache import datetime import json import requests import os from twilio.twiml.messaging_response import MessagingResponse app = Flask(__name__) agent = CovidAssist() requests_cache.install_cache(cache_name='covid_cache', ba...
amansr02/CovidAssist
app.py
app.py
py
1,877
python
en
code
0
github-code
36
38078314636
import torch from torch import nn from torch import Tensor class RanEncoder(nn.Module): def __init__(self, per_dim, in_channel, out_channel): super().__init__() self.per_dim = per_dim self.in_channel = in_channel self.out_channel = out_channel self.conv1 = nn.C...
DTI-dream/EDC-DTI
src/core/RAN_encoder.py
RAN_encoder.py
py
984
python
en
code
4
github-code
36
42777147523
from time import sleep from threading import Thread, Lock from os import mkfifo, access, R_OK from canary_api import settings from canary_utils.lib import logger from canary_utils.lib.log import Log, Nginx, SMB, DNS class serverState(object): """Maintains server state, stops the server when disabled.""" de...
toucan-project/TOUCAN
toucan/canary_utils/lib/daemon.py
daemon.py
py
3,744
python
en
code
3
github-code
36
74277064423
from PyQt5 import Qt, QtCore, QtGui, QtWidgets from ui.mainw import Ui_MainWindow import os, json import subprocess class VirtualCD_Window(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self): super(VirtualCD_Window, self).__init__() self.setupUi(self) self.setWindowOpacity(0.5) ...
zslukevin/Virtual-CD
VirtualCD.py
VirtualCD.py
py
3,258
python
en
code
0
github-code
36
40735082379
#B = (X'X)^-1 X' y from plotfit import plotLineReg from derive import approxD2iter, testf def linereg(xlist: list, ylist: list): if len(xlist)!=len(ylist): print("xlist and ylist are not of matching size") return None # 'a' represents entries of A, which is a label for the matrix (X'X) a00...
DryToaster/ComputationalMath
src/linereg.py
linereg.py
py
1,390
python
en
code
0
github-code
36
3900882792
import os import random import cv2 from torchvision import transforms import matplotlib.pyplot as plt torch_image_transform = transforms.ToTensor() def get_data(dir, labels): data = [] for label in labels: path = os.path.join(dir, label) class_num = labels.index(label) f...
nguyen-tho/VGG19_Insect_Classification
get_data.py
get_data.py
py
2,689
python
en
code
2
github-code
36
33517634996
from manimlib.imports import * class Operaciones_continuidad(ThreeDScene): def acomodar_textos(self,objeto): self.add_fixed_in_frame_mobjects(objeto) self.play(Write(objeto)) def acomodar_puntos(self,objeto): self.add_fixed_in_frame_mobjects(objeto) self.add(objeto) # Defin...
animathica/calcanim
Límite y continuidad en funciones multivariable/operaciones_continuas.py
operaciones_continuas.py
py
11,564
python
es
code
19
github-code
36
19909680887
import math from model.enums import SearchType from helpers.utils import load_json, get_elements, get_center_coordinates from setup.setup_app import LOCATOR_KEY_NAME, ELEMENT_NAME_PLACEHOLDER, FINDERS_KEY_NAME, DATA_FILE_PATH from model.element_dto import Element from setup.setup_logger import logger def find_element...
lbonifazi/total-performance-consulting-exercises
main_functions.py
main_functions.py
py
4,282
python
en
code
0
github-code
36
73997935782
#%% packages import numpy as np import pandas as pd import torch import torch.nn as nn import seaborn as sns #%% data import cars_file = 'https://gist.githubusercontent.com/noamross/e5d3e859aa0c794be10b/raw/b999fb4425b54c63cab088c0ce2c0d6ce961a563/cars.csv' cars = pd.read_csv(cars_file) cars.head() #%% visualise the ...
ono5/learn-pytorch
03_ModelingIntroduction/10_LinReg_ModelClass_start.py
10_LinReg_ModelClass_start.py
py
2,294
python
en
code
0
github-code
36
6694542098
import time import random from typing import List, Tuple, Generator class Life: state: List[List[bool]] m: int n: int def __init__(self, m: int, n: int): self.m = m self.n = n self.state = [[False for _ in range(n)] for _ in range(m)] def __repr__(self) -> ...
nurlbk/gameOfLife-video
gameOfLife.py
gameOfLife.py
py
2,472
python
en
code
0
github-code
36
25142936013
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup from pandas import DataFrame from util import spider_util #获取学校学区信息 xx_url='http://map.28dat.net/s_ft/school.aspx?no=101' cz_url='http://map.28dat.net/s_ft/school.aspx?no=225'#初中 url_arr=[] url_arr.append(xx_url) url_arr.append(cz_url) schoolarea = [] for url in u...
w341000/PythonTheWord
SchoolArea.py
SchoolArea.py
py
1,184
python
en
code
0
github-code
36
5044703068
import tkinter as tk from PIL import Image, ImageTk root = tk.Tk() root.title("cakahal johnson") root.geometry("600x200") photo = tk.PhotoImage(file="bg.jpg") label = tk.Label(root, image=photo, bg="black", fg="yellow", width=600, height=200) label.pack() root.mainloop()
cakahal-johnson/pythonZero2Hero2023
tkinter_project/background_image.py
background_image.py
py
275
python
en
code
1
github-code
36
3520624550
"""Defines helpers related to the system database.""" import logging import time from sqlalchemy import create_engine from sqlalchemy.engine import Engine from sqlalchemy.exc import OperationalError from sqlalchemy.orm import sessionmaker from sqlalchemy.sql import text from .project_settings_service import ProjectS...
learningequality/meltano
src/meltano/core/db.py
db.py
py
3,535
python
en
code
1
github-code
36
14175838199
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('workArounds', '0002_remove_monthlyreport_cycle'), ] operations = [ migrations.RemoveField( model_name='workday',...
ravitbar/workers
workArounds/migrations/0003_remove_workday_offday.py
0003_remove_workday_offday.py
py
365
python
en
code
0
github-code
36
17862265310
''' 本节文章 https://learnscript.net/zh-hant/obs-python-scripting/junior/data/create-data/ 如何建立资料 ''' # 汇入模组 obspython import obspython as obs def script_properties(): props = obs.obs_properties_create() # 添加一个选择背景图片的档案对话方块 prop = obs.obs_properties_add_path(props, 'path', '图片路径:', obs.OBS_PATH_FILE, '图片档案(*...
codebeatme/obs-python-scripting
src/zh-hant/junior/create_data.py
create_data.py
py
1,131
python
zh
code
0
github-code
36
34366302943
# Program to swap numbers *WITH* a temporary 3rd variable class SwapNos: def __init__(self, x: int = 0, y: int = 1) -> None: self.x = x self.y = y def swap_third_temp(self) -> None: print(f"before: x={self.x}, y={self.y}") tmp = self.x self.x = self.y self.y...
TrellixVulnTeam/learning_to_test_code_BL81
scripts/tutorials/snippets/swap_variables.py
swap_variables.py
py
778
python
en
code
0
github-code
36
28923475301
#18405. 경쟁적 전염 """ heapq를 쓰는법도 있을것만 같지만 일단 이렇게 구현했다. """ #STEP 1. INPUT SETTING import sys from collections import deque input=sys.stdin.readline N,K=map(int,input().rstrip().split()) board=[] dist=[[-1]* N for _ in range(N)] start_deq=deque([]) for row in range(N): arr=list(map(int,input().rstrip().split())) b...
GuSangmo/BOJ_practice
BOJ/18405.py
18405.py
py
1,764
python
ko
code
0
github-code
36
33638590751
import numpy as np import hydra from tools.profiler import timeit from waymo_dataset.registry import PIPELINES from utils.sampler import preprocess as prep from utils.bbox import box_np_ops def _dict_select(dict_, inds): for k, v in dict_.items(): if isinstance(v, dict): _dict_select(v, inds) ...
abahnasy/waymo_gnn
waymo_dataset/pipelines/preprocess.py
preprocess.py
py
7,111
python
en
code
1
github-code
36
26249935476
#!/usr/bin/env python # -*- coding:utf-8 -*- #@ brief introduction """ 本段程序描述了移动机器人底盘的一些控制方法,包括使能、前进、设置底盘速度等 底盘电机的控制可以通过多种方式,例如:can modbus等 """ from ZL_motor_control import ZL_motor_control # class ZL_motor_control import can from math import * import time # 外部设置bus,然后传递给car class car(object): def __init__(self,w...
TiderFang/motor_control_bus
diff_car_controller/scripts/car_control.py
car_control.py
py
4,546
python
en
code
3
github-code
36
18873855877
import sys from PyQt5 import Qt, QtGui from PyQt5.QtWidgets import QDialog, QWidget, QVBoxLayout, QScrollArea, QApplication, QMainWindow from PyQt5.uic import loadUi from Screens import db_objects as dbo import gnrl_database_con class InspectionPlannerPage(QDialog): def __init__(self, mainWindowRef: QMainWindow...
krzysiek-droid/Deki-Desktop-App
DekiApp_pyqt5/Screens/mainWindow_Pages.py
mainWindow_Pages.py
py
7,953
python
en
code
0
github-code
36
29469018123
#noteParser.py ''' 3.5.x Description: This module splits a note up into its #tag and its text. Author: Michael Mentele ''' import re def parseText(note): '''Parses a string into its hashtag and textstring.''' try: hashtag_idx = note.index('#') except ValueError: raise Exception('No hashtag in note!') hashtag ...
MichaelrMentele/AutoNote
noteParser.py
noteParser.py
py
394
python
en
code
0
github-code
36
25616844067
# -*- coding: utf-8 -*- """ Created on Sun Jul 16 14:39:03 2017 @author: tangwenhua """ import numpy as np """ 1.首先min/max与np.argmin/np.argmax函数的功能不同 前者返回值,后者返回最值所在的索引(下标) 2.处理的对象不同 前者跟适合处理list等可迭代对象,而后者自然是numpy里的核心数据结构ndarray(多维数组) 3.min/max是Python内置的函数 np.argmin/np.argmax是numpy库中的成员函数 """ a = np.arange(6...
kunlaotou/PythonDemo
np_argmax.py
np_argmax.py
py
855
python
zh
code
0
github-code
36
24435584276
from PyMca5.PyMcaPhysics.xrf import FastXRFLinearFit from XRDXRFutils.data import DataXRF, SyntheticDataXRF import h5py from os.path import basename, dirname, join, exists from os import remove class FastFit(): def __init__(self, data = None, cfgfile = None, outputdir = None): self.data = data self...
RosarioAndolina/Map2H5
Map2H5/FastFit.py
FastFit.py
py
1,893
python
en
code
0
github-code
36
4013935422
# 문제 출처 : https://programmers.co.kr/learn/courses/30/lessons/12922 def solution(n): answer = '수' for i in range(1, n): if n == 1: return answer if answer[i-1] == '수': answer += '박' if answer[i-1] == '박': answer += '수' print(answer) return answ...
ThreeFive85/Algorithm
Programmers/level1/waterMelon/water_melon.py
water_melon.py
py
418
python
en
code
1
github-code
36
42778532873
import tempfile from datetime import datetime, timedelta from typing import Any, Generator import openpyxl import pandas as pd import pytest from dateutil.tz import tzutc from pytest_mock import MockFixture from toucan_connectors.s3.s3_connector import S3Connector, S3DataSource from toucan_connectors.toucan_connector...
ToucanToco/toucan-connectors
tests/s3/test_s3.py
test_s3.py
py
9,501
python
en
code
16
github-code
36
17010990531
#import libs import sys import os import socket import pygame pygame.init() #define variables PORT = int(sys.argv[1]) host = "localhost" HOST = socket.gethostbyname(host) #Connect to host at port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #try connecting to host try: ...
ivanebos/pingPongNetworks
client.py
client.py
py
1,036
python
en
code
0
github-code
36
36365319948
""" ins_del @Author: linlin @Date: 17.05.23 """ import numpy as np def _optimize_costs_ins_del( nb_cost_mat, dis_k_vec, sorted_label_pairs, tria_rule_mode, remove_zeros, reconstruct_costs=True ): from gcl_frame.models.optim_costs2 import _optimize_costs_solve from gcl_frame.models.optimizers.utils import _re...
jajupmochi/ged-cost-learn-framework
gcl_frame/models/optimizers/ins_del.py
ins_del.py
py
4,367
python
en
code
0
github-code
36
26769234529
from event_manager.models import Event from datetime import datetime, timedelta from celery import shared_task from django.core.mail import send_mail import pytz from scheduler_APP.settings import EMAIL_HOST_USER @shared_task() def to_remind(): events_set = Event.objects.filter(remind_option__isnull=False) fo...
EugeneVojtik/eugene_vojtik_scheduler
event_manager/tasks.py
tasks.py
py
1,020
python
en
code
0
github-code
36
14065889829
## 시간 제한 N, K = map(int, input().split()) temp_lst = list(map(int, input().split())) sum_tmp = sum(temp_lst[:K]) tmp_kdays =[sum_tmp] # for문 내에서 복잡한 연산 최대한 없애기 (sum을 밖에서 한번만) for i in range(N-K): # 맨앞 지우고 맨뒤 +1 index를 더하기 sum_tmp = sum_tmp - temp_lst[i] + temp_lst[i+K] tmp_kdays.append(sum_tmp) print(ma...
yeon-june/BaekJoon
2559.py
2559.py
py
407
python
ko
code
0
github-code
36
4518167916
#Python libraries that we need to import for our bot import random from flask import Flask, request from pymessenger.bot import Bot # using get import os app = Flask(__name__) ACCESS_TOKEN = "EAAHGgxLDfLYBAGg0ZCgxEgo297oOfe0SuqVIvT2xWmXeJfNKZC7bpm35LZCluAHwULwKiAPmny2SVeLDCBlGackR9F5LYBPnoRHZBhWqGVEEEwZBPA9WbWn1DdApx...
longNT0dev/mess_bot_chat
botMessenger.py
botMessenger.py
py
2,553
python
en
code
0
github-code
36
17551788197
#!/usr/bin/env python3 import cv2 import depthai as dai import contextlib # Start defining a pipeline pipeline = dai.Pipeline() # Define a source - color camera cam_rgb = pipeline.createColorCamera() cam_rgb.setPreviewSize(600, 600) cam_rgb.setBoardSocket(dai.CameraBoardSocket.RGB) cam_rgb.setResolution(dai.ColorCam...
hello-word-yang/depthai-experiments
gen2-multiple-devices/main.py
main.py
py
1,320
python
en
code
null
github-code
36
24690068972
from unitparser.parser.Lexer import LexerException from unitparser.parser.Parser import ParserException from unitparser.unit.UnitParser import UnitParser from unitparser.unit.NumberWithUnit import UnitException __unit_parser = None """ initialize parser, only necessary when using nonstandard config file """ def ini...
fllor/UnitParser
unitparser/__init__.py
__init__.py
py
1,540
python
en
code
0
github-code
36
16145980745
a = [3, 10, -1] a.append(1) # add to the list a.append("Hello") # can mix data types in a list a.append([1, 2]) # list inside a list a.pop() # removes the last element in the list a.pop() a[0] # gets a specific element a[3] # another specific element a[0] = "first" # change a specific element print(a) # ex...
sweetboymusik/Python
Lesson 25 + 26/lists.py
lists.py
py
1,420
python
en
code
0
github-code
36
39479073026
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from cards.models import Card from cards.models import Battle from cards.models import Format from cards.models import FormatBasecard from django.utils import timezone import re from optparse import make_option from datetime i...
jcrickmer/mtgdbpy
cards/management/commands/battlelinks.py
battlelinks.py
py
3,085
python
en
code
0
github-code
36
21663810901
#!/usr/bin/env python3 import random, argparse parser = argparse.ArgumentParser() parser.add_argument("-r", "--rows", help="how many rows defaults to 2") parser.add_argument("-c", "--cols", help="how many cols defaults to 2") args = parser.parse_args() if args.rows: try: rows = int(args.rows) ...
nathankurt/random-seat-teams-bot
random_seats.py
random_seats.py
py
1,528
python
en
code
0
github-code
36
14102775036
""" Functions that are helpful for evaluating models. """ from typing import Dict, Any, List import pandas as pd import numpy as np from . import error_metrics def evaluate_predictions( df: pd.DataFrame, y_true: pd.Series, y_pred: pd.Series, metrics_dict: Dict[str, Any] = { 'mean_absolute_er...
nasa/ML-airport-data-services
data_services/evaluation_utils.py
evaluation_utils.py
py
4,896
python
en
code
3
github-code
36
14822035379
# # @lc app=leetcode.cn id=205 lang=python3 # # [205] 同构字符串 # # https://leetcode-cn.com/problems/isomorphic-strings/description/ # # algorithms # Easy (42.46%) # Total Accepted: 7K # Total Submissions: 16.3K # Testcase Example: '"egg"\n"add"' # # 给定两个字符串 s 和 t,判断它们是否是同构的。 # # 如果 s 中的字符可以被替换得到 t ,那么这两个字符串是同构的。 # # 所...
ZodiacSyndicate/leet-code-solutions
easy/205.同构字符串/205.同构字符串.py
205.同构字符串.py
py
1,352
python
zh
code
45
github-code
36
830274847
import os import sys import numpy as np import torch from torchdrug import data sys.path.append(os.path.dirname(os.path.dirname(__file__))) from diffpack import rotamer if __name__ == "__main__": protein = data.Protein.from_pdb('10mh_A.pdb', atom_feature=None, bond_feature=None, ...
DeepGraphLearning/DiffPack
test/test_rotamer.py
test_rotamer.py
py
1,137
python
en
code
42
github-code
36
25873892301
from Physics import Physics, MassPoint, Position import matplotlib.pyplot as plt import numpy as np import re # Import 3D Axes from mpl_toolkits.mplot3d import axes3d def plotMassPoints(phyInstance): massPts = phyInstance.getMassPoints() pointArray = list(mp.position.arr for mp in massPts) ptMat...
DoktorBotti/RL_LocalGravityAssistant
code/HelperFunctions.py
HelperFunctions.py
py
4,874
python
en
code
0
github-code
36
11378727711
#!/bin/python3 def plus_minus(array): ratio_positive = round(sum(i > 0 for i in array) / len(array), 6) ratio_negative = round(sum(i < 0 for i in array) / len(array), 6) ratio_zero = round(sum(i == 0 for i in array) / len(array), 6) return ratio_positive, ratio_negative, ratio_zero def test_plus_min...
scouvreur/hackerrank
problem_solving/algorithms/warmup/plus_minus.py
plus_minus.py
py
728
python
en
code
1
github-code
36
5709821710
"""Example of script that run Disim and plots data from logs.""" import numpy as np import os import matplotlib.pylab as plt from scipy import optimize def run_disim(idm_args): lua_args = "--lua-args=\"" for n, v in idm_args.items(): lua_args += n+"={},".format(v) lua_args += "\"" duration = 3600 * 6 ...
sgowal/disim
scripts/python/run_and_plot.py
run_and_plot.py
py
1,741
python
en
code
1
github-code
36
72052973863
from starlette.applications import Starlette from starlette.responses import JSONResponse from starlette.routing import Route import uvicorn async def homepage(request): return JSONResponse({'hello': 'world'}) async def empty_route(request): return JSONResponse({'new route': 'this route does no...
MuelGoh/starlette_project
main.py
main.py
py
793
python
en
code
0
github-code
36
28680727075
import sys with open("input.txt") as file: day_1_input = file.read().splitlines() module_masses = [int(i) for i in day_1_input] def get_fuel(mass): fuel = (mass // 3) - 2 return(fuel) if (get_fuel(100756) != 33583): sys.exit("Error: get_fuel function not working") fuel_needed = 0 for mod in module_...
Dan2796/aoc_2019
day_1/script.py
script.py
py
904
python
en
code
0
github-code
36
74784270182
import numpy import pandas as pd import matplotlib.pyplot as plt import matplotlib.tri as tri import matplotlib.cm as cm def ternary_plot(data_fn): reader = pd.read_csv(data_fn) SQRT3 = numpy.sqrt(3) SQRT3OVER2 = SQRT3 / 2. def unzip(l): return zip(*l) def permute_point(p, permutation=None): if no...
yashvardhan747/Statistical-and-Aqual-chemical-plots
StatisticalTools/ternary_plot.py
ternary_plot.py
py
3,213
python
en
code
0
github-code
36
5209818029
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 29 16:04:51 2020 @authors: Verifiers: Alessandro Busatto, Paolo Graziani, Aurora Rossi, Davide Roznowicz; Applet: Giacomo Di Maggio, Marco Emporio, Marco Fattorelli, Sebastiano Gaiardelli, Francesco Trotti; Map: Rosario Di Matteo, Marco Emporio, Adr...
romeorizzi/esami-RO-public
old/generate_all_exams_given_list.py
generate_all_exams_given_list.py
py
4,434
python
en
code
0
github-code
36
856846577
#!/usr/bin/env python from pyhesity import * import argparse parser = argparse.ArgumentParser() parser.add_argument('-v', '--vip', type=str, default='helios.cohesity.com') parser.add_argument('-u', '--username', type=str, default='helios') parser.add_argument('-d', '--domain', type=str, default='local') parser.add_ar...
bseltz-cohesity/scripts
python/viewDR66/deleteOldViews.py
deleteOldViews.py
py
3,313
python
en
code
85
github-code
36
13988006348
class Solution: def containsNearbyDuplicate(self, nums, k): start = dict() for end in range(len(nums)): x = nums[end] if x in start and end - start[x] <= k: return True else: start[x] = end return False
dariomx/topcoder-srm
leetcode/first-pass/palantir-technologies/contains-duplicate-ii/Solution.py
Solution.py
py
299
python
en
code
0
github-code
36
2004723473
""" Project Settings file """ import os from starlette.datastructures import CommaSeparatedStrings, Secret default_route_str = "/api" ALLOWED_HOSTS = CommaSeparatedStrings(os.getenv("ALLOWED_HOSTS", "*")) SECRET_KEY = Secret(os.getenv( "SECRET_KEY", "4bf4f696a653b292bc674daacd25195b93fce08a8dac7373b36c38f63c...
marirs/fastapi-boilerplate
server/core/settings.py
settings.py
py
687
python
en
code
141
github-code
36
6778601752
from utils import session from models import User, Organization from werkzeug.wrappers import Request from werkzeug.utils import cached_property from werkzeug.contrib.securecookie import SecureCookie # you could just use # os.urandom(20) to get something random SECRET_KEY = '\xc9\xd5+\xe7U\x8f\xef\r\xa60\xed\xf4\x1cp...
anzarafaq/iqp
src/py/iqpapp/custom_request.py
custom_request.py
py
1,551
python
en
code
3
github-code
36
70089050984
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rcParams['text.usetex'] = True def main() -> None: w = 1. emission_psf = np.genfromtxt('tem_m_0_n_0.csv', delimiter=',') y_linspace = np.linspace(-2.0, 2.0, np.shape(emission_psf)[0]) x_linspace = np.linspac...
oliver-peoples/honours-project
old/combined_probabilities.py
combined_probabilities.py
py
1,437
python
en
code
0
github-code
36
14811910214
# -*- coding: utf-8 -*- """ Created on Mon Jul 31 22:06:35 2017 @author: Benny """ import random as rnd def printField(field): '''printField printes the Minesweeperfield''' for row in range(len(field)): print() for col in range(len(field[0])): print(field[row...
krother/python_abv_zedat
projekte_ss2017/Minensuche_Benjamin/field.py
field.py
py
3,308
python
en
code
0
github-code
36
34350380990
""" Code Challenge Name: Space Seperated data Filename: space_numpy.py Problem Statement: Take 9 space separated numbers from user. Write a python code to convert it into a 3x3 NumPy array of integers. Input: 6 9 2 3 5 8 1 5 4 Output: [[6 9 2] [3 5 8] [1 5 4]] """ imp...
MohitBansal1999/forsk
d11 Numpy and matplotlib/space_numpy.py
space_numpy.py
py
557
python
en
code
1
github-code
36
70943334823
import time import smbus from datetime import datetime, timedelta import arrow # local/utc conversions # set I2c bus addresses of clock module and non-volatile ram DS3231ADDR = 0x68 #known versions of DS3231 use 0x68 AT24C32ADDR = 0x57 #older boards use 0x56 I2C_PORT = 1 #valid port...
bablokb/pi-wake-on-rtc
files/usr/local/sbin/ds3231.py
ds3231.py
py
15,996
python
en
code
37
github-code
36
70588664425
from math import * # import stuff (*) from math module print(" /|") print(" / |") print(" / |") print("/___|\n") charName = "John" charAge = "69" # str age = 50 # int age = "400" # notice we don't have to change the "type" of age - it's implied based on the data assigned isMale = True ...
jacobRidenour/CodingPractice
Python/_DayOne/1_BasicThings/basics.py
basics.py
py
3,462
python
en
code
0
github-code
36
6829641874
# 一个球的弹跳性是0.6,第一次着地前的最高高度和第二次着地前的最高高度之比 # 给定初始下降高度和允许弹跳次数,输出总的运动距离 Degree = 0.6 class BallDistance: def __init__(self, initial_hight, times): distance = initial_hight * (1 + Degree) self.distance = 0 for i in range(times): self.distance = distance + self.distance di...
Marxinchina/FundamentalsOfPythonDataStractures
1_9/program3.py
program3.py
py
641
python
en
code
0
github-code
36
33639047987
import io import os import sys import tempfile from Config.Config import G_CONFIG from JobApi.ESJobApi import ESJobApi spark_config = G_CONFIG.config['spark'] task_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'tasks') src_root_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') f...
shasha79/nectm
src/JobApi/SparkTaskDispatcher.py
SparkTaskDispatcher.py
py
2,602
python
en
code
5
github-code
36
3985485979
import os from skimage import io import copy import numpy as np import random from glob import glob import h5py import torch import torch.utils.data as data from torchvision import transforms, datasets from src.datasets.root_paths import DATA_ROOTS class BaseSo2Sat(data.Dataset): CLASSES = ['Compact High-Rise', ...
jbayrooti/divmaker
src/datasets/so2sat.py
so2sat.py
py
3,310
python
en
code
3
github-code
36
34932859977
numeros = [] while True: n = (input('Digite um número ou escreva STOP para parar: ')) if n == 'STOP': break else: numeros.append(n) if '5' in numeros: print('5 foi digitado') numeros.sort(reverse=True) print(f'Foram digitados {len(numeros)} números' f'\nA lista de ordem descrescent...
lucasaguiar-dev/Questoes-Python
Projeto donwload/PythonExercicios/ex081.py
ex081.py
py
342
python
pt
code
0
github-code
36