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
36484016718
import AoC_tools.aoc_tools as aoc data = aoc.read_input("input.txt", "\n") data = [list(d) for d in data] def get_prio(letter): if letter == letter.lower(): return ord(letter) - ord("a") + 1 elif letter == letter.upper(): return ord(letter) - ord("A") + 27 def split_half(prio): half = int...
lannieligthart/advent_of_code
2022/3/part1.py
part1.py
py
621
python
en
code
2
github-code
54
6338254775
import sys import cv2 import numpy as np from pathlib import Path from lib import LUT lut = LUT(1/1.6) def main(): directory = sys.argv[1]#'./yuyushiki3' paths = Path(directory).resolve() for path in paths.iterdir(): if path.suffix == '.png': print(path.as_posix()) im = cv...
non117/zoi
filter.py
filter.py
py
500
python
en
code
19
github-code
54
13332582890
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% [markdown] # # Getting Started # # Following the instructions for generating agent data (either [locally](https://github.com/KDL-umass/ToyboxAgents/wiki/Generate-Agent-Data-Locally) or [on a cluster](https://github.com/KDL-umass...
toybox-rs/ToyboxAgents
analysis/raw_data_tutorial.py
raw_data_tutorial.py
py
20,646
python
en
code
0
github-code
54
74316497123
from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), path('about/', views.about, name='about'), path('decks/', views.decks_index, name='index'), path('decks/<int:deck_id>/', views.decks_detail, name='detail'), path('decks/create/', views.DeckCreate.as_view(), n...
D-Sen/cardcollector
main_app/urls.py
urls.py
py
918
python
en
code
0
github-code
54
28745072331
from scapy.all import * import scapy import http from scapy.utils import PcapWriter import time import queue import pymysql import re import datetime works = queue.Queue() #队列(正常的数据) caijixin = queue.Queue() #队列(异常危险的数据) with open('C:/Users/admin/Desktop/lkd/text.txt','r') as f: #调用规则库 txt = f.read().spli...
Destiny310/gouguangyao
sheji.py
sheji.py
py
3,158
python
en
code
0
github-code
54
74229858082
RTL_LANGUAGES = { 'he', 'ar', 'arc', 'dv', 'fa', 'ha', 'khw', 'ks', 'ku', 'ps', 'ur', 'yi', } COLORS = { 'primary': '#0d6efd', 'blue': '#0d6efd', 'secondary': '#6c757d', 'success': '#198754', 'green': '#198754', 'danger': '#dc3545', 'red': '#dc3545', 'warning': '#ffc107', 'yellow': '#ffc107', ...
PythonFreeCourse/lms
lms/utils/consts.py
consts.py
py
674
python
en
code
96
github-code
54
31688933006
from __future__ import absolute_import import re import socket from base64 import b64encode from urllib import parse as urlparse import gevent from slimta import logging from slimta.smtp.reply import Reply from slimta.http import get_connection from . import PermanentRelayError, TransientRelayError from .pool import...
slimta/python-slimta
slimta/relay/http.py
http.py
py
7,303
python
en
code
168
github-code
54
459800402
import numpy as np from algorithms.initiation.BasicInitiation import BasicInitiation class SpatialStandardPlacement: """ The class of a spatial placement. Object of this class performs placement of all features instances and holds all data of this placement. The placement is performed according to the st...
tomdziwood/moving-objects-data-generator
moving-objects-data-generator/algorithms/utils/SpatialStandardPlacement.py
SpatialStandardPlacement.py
py
7,572
python
en
code
0
github-code
54
7286969297
# time Complexity - O(n^m*m) # Space Complexity - O(m^2) def countConstruct(target,wordBank): if target == "": return 1 count = 0 for i in wordBank: if target.startswith(i): newTarget=target.replace(i,"") if countConstruct(newTarget,wordBank): ...
Arjune-Ram-Kumar-M-Github/FreeCodeCamp.org-Dynamic-Programming--Algorithmic-Problems-Coding-Challenges-Python-Solutions
Naive_Recursion_CountConstruct.py
Naive_Recursion_CountConstruct.py
py
485
python
en
code
1
github-code
54
35939307990
import random import copy from numpy.ma import array from clustering.weight_functions import euclid_dist import numpy as np class MYKMedoids: def __init__(self, n_clusters=8, max_iter=100, tol=1e-4, dist_func=euclid_dist): self.n_clusters = n_clusters self.max_iter = max_iter self.tol =...
melgenek/ml_labs
clustering/MYKMedoids.py
MYKMedoids.py
py
2,146
python
en
code
0
github-code
54
11080834937
from google.cloud import pubsub_v1 import os def publish_message(topicId, message, sourceSubscription): client = pubsub_v1.PublisherClient() projectId = os.environ.get('PROJECT_ID') topicPath = client.topic_path(projectId, topicId) data = message.encode("utf-8") client.publish(topicPath, data=dat...
uk-gov-mirror/ONSdigital.blaise-pubsub-functions
tests/pubsub_test_helper.py
pubsub_test_helper.py
py
433
python
en
code
0
github-code
54
30924435010
""" Given (1) a large dataset from which we can sample new, smaller 'datasets' (2) the number of distinct query datasets that should be used when composing the new dataset this script explores different ways of drawing samples that correspond to these 'datasets'. The idea is to draw several datasets fo...
VIDA-NYU/prida
improvement-prediction/classification/draw_datasets.py
draw_datasets.py
py
2,707
python
en
code
2
github-code
54
12519584196
from Layers import GlobalFilter , NormLayer from non_activation import SigmoidComplex , SoftmaxComplex import torch.nn as nn import numpy as np class AttentionFilter(nn.Module): def __init__(self, F_g, F_l, F_int,dim): super(AttentionFilter,self).__init__() self.Gate_signle = GlobalFilt...
deep-matter/Attention_Filter_Gate
src/model/blocks/attentions_networks.py
attentions_networks.py
py
2,797
python
en
code
0
github-code
54
35991862522
import sys import numpy as np import logging import scipy.integrate as integrate import scipy.optimize import scipy.special import torch from numbers import Number from torch.distributions import constraints from torch.distributions.geometric import Geometric from torch.distributions.categorical import Categorical fro...
gizatt/spatial_scene_grammars
spatial_scene_grammars/distributions.py
distributions.py
py
31,946
python
en
code
14
github-code
54
28177450179
from settingsWindow import * from CytometrKernel import * class settingsWindowController(QtWidgets.QDialog, Ui_SettingsWindow): def __init__(self, parent = None): super(settingsWindowController, self).__init__(parent) self.setupUi(self) self.connectPushButton.clicked.connect(self.connectB...
mikhail-7975/New_4PI_CYTOMETR
InterfaceOnOyqt5/settingsWindowController.py
settingsWindowController.py
py
2,029
python
en
code
0
github-code
54
12850298238
# -*- coding: utf-8 -*- import os import logging import pickle import scrapy import dateutil.parser as dateparser from dateutil.tz import gettz from datetime import datetime from bs4 import BeautifulSoup if not os.path.exists('./log'): os.mkdir('log') logging.basicConfig( filename='log/investing.com.log', ...
Wenbing-Yao/Bitcoin-Price-Trends-Dataset
src/spider/bitspider/spiders/investing_com.py
investing_com.py
py
3,774
python
en
code
1
github-code
54
25249369035
# -*- coding: utf-8 -*- # UTF-8 encoding when using korean x, y = map(int, input().split()) d = int(input()) # 진우 / 선우 # 진우가 밤 증에 자신의 식량 절반을 선우에게 가져다 주었다 # 그 다음날 밤, 선우는 자신의 식량 절반을 진우에게 가져다 주었다 # 가지고 있는 식량의 양이 홀수이면, 그 식량을 통째로 넘겨준다 # 처음에 두 형제는 모두 식량을 100개 씩 가지고 있다. # 진우 선우 # 100 100 # 50 150 # 125 75 # 62 138 tem...
wodnrl1346/Problem_Solving-Algorithm
2_Implementation-Brute-force search/goorm_의좋은 형제.py
goorm_의좋은 형제.py
py
950
python
ko
code
0
github-code
54
3823908958
from __future__ import absolute_import from collections.abc import Iterable from django import template from apps.noclook.templatetags.noclook_tags import noclook_node_to_link from django.utils.safestring import mark_safe from django.utils.html import format_html, format_html_join register = template.Library() @reg...
NORDUnet/ni
src/niweb/apps/noclook/templatetags/table_tags.py
table_tags.py
py
1,338
python
en
code
3
github-code
54
35363013147
import json import os import csv import tkinter as tk import cv2 from PIL import Image import math def getBoxes(fileJson): patcher = fileJson['patcher'] boxes = patcher['boxes'] return boxes # Get width/height of current screen root = tk.Tk() screenWidth = root.winfo_screenwidth() screenHeight = root.winfo_screenh...
jpclemente97/PopsenteretProducerStation
maxDynamicScreenResolution/maxDynamicScreenResolution.py
maxDynamicScreenResolution.py
py
6,744
python
en
code
1
github-code
54
23190811503
from flask import Flask, render_template import sqlite3 import plotly.graph_objects as go @app.route('/plot') def plot(): x_vals = ['Action', 'Drama', 'Crime', 'Adventure', 'Western', 'Biography'] y_vals = [1, 2, 3, 1, 1, 1] movie_data = go.Bar( x=x_vals, y=y_vals ) fig = go.Figur...
Karess123/final-project
graph.py
graph.py
py
484
python
en
code
0
github-code
54
32948081658
import pandas as pd from datetime import datetime, timedelta # make sure only keep the tmp2m over western us (508 grid points) data = pd.read_hdf('tmp2m_western_us.h5') western_us = data[data.start_date == '2019-01-01'][['lat', 'lon']] data_updated = western_us.merge(data, on=['lat', 'lon'], how='inner') data_test = d...
Sijie-umn/SSF-MIP
Groundtruth/filling_missing_values.py
filling_missing_values.py
py
1,855
python
en
code
6
github-code
54
12700898331
import colorsys import cv2 import numpy as np # set hue, saturation and valuness here. h, s, v = 0, 87.5, 87.5 # output image date img = np.full((600, 800, 3), 128, dtype=np.uint8) # cordinate for making color rectangule. sX = 0 sY = 0 eX = 200 eY = 200 # make palette 3columns * 4rows for i in range(3): for j i...
Daiki27/colorPalette-HSV
colorPalette.py
colorPalette.py
py
1,168
python
en
code
0
github-code
54
37524853107
import os import shutil import tempfile import hashlib import flask from flask import request, redirect, url_for, session, abort import arrow import wordextractor import time import gensim.downloader as api import interface from flask import Flask, current_app # All module pre-load app = Flask(__name__) with app.app...
ericzhaoze/549project
wordExtractor/wordextractor/views/index.py
index.py
py
2,031
python
en
code
1
github-code
54
31663200536
#we need to sort so O(n log n) #飞机题和这个题是完全一样的 def min_meeting_rooms(self, intervals: List[Interval]) -> int: # Write your code here #建立两个sorted array #start = [0,5,10] #end = [10,15,30] start = sorted([ele.start for ele in intervals]) end = sorted([ele.end for ele in intervals]) #两个pointer分别...
MaisieGao/Leetcode
双指针/区间/核心/lintcode919 meeting room.py
lintcode919 meeting room.py
py
861
python
en
code
0
github-code
54
2989067587
from nturl2path import url2pathname from django.urls import path from . import views urlpatterns = [ path('', views.home, name ='home'), path('notes/', views.notes, name ='notes'), path('delete_note/<int:id>', views.delete_note, name ='delete_note'), path('notes_detail/(?P<pk>\d+)$', views.NotesDe...
mohammedsalam2002/studentClass_with_django
dashboard/urls.py
urls.py
py
845
python
en
code
0
github-code
54
41087491793
def multipleunpacking(*args): print("Type:",type(args)) print(args) a=[1,5,6] multipleunpacking(a) b=(5,8,9) multipleunpacking(b) c={3,7,6} multipleunpacking(c) r=range(100,105) multipleunpacking(*r) print(*range(1,6),sep="\n")
SNBhushan/BASICS-OF-PYTHON
pyfunc13.py
pyfunc13.py
py
258
python
en
code
0
github-code
54
32456683287
"""This is a module containing constants and fixed functions. """ import numpy as np SIGMA = 5.67e-8 """Stefan–Boltzmann constant, W/(m^2 K^4) """ G = 9.807 """Gravity of Earth, m/s^2 """ R = 8.314 """Gas constant, J/(mol K) """ FLUID = {1: 'Water', 2: 'Air', 3: 'INCOMP::TVP1', 4: 'Toluene', 5: 'R123'}...
hustquick/PythonPackages
Const.py
Const.py
py
3,549
python
en
code
0
github-code
54
3578080622
from typing import Dict, Union from azure.ai.ml.entities._inputs_outputs import Input, Output from azure.ai.ml.entities._job._input_output_helpers import build_input_output class JobIOMixin: @property def inputs(self) -> Dict[str, Union[Input, str, bool, int, float]]: return self._inputs @inputs...
Azure/azure-sdk-for-python
sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_io_mixin.py
job_io_mixin.py
py
969
python
en
code
3,916
github-code
54
2035782568
import streamlit as st import torchxrayvision as xrv import skimage, torch, torchvision def get_image(image_file): img = skimage.io.imread(image_file) img = xrv.datasets.normalize(img, 255) # convert 8-bit image to [-1024, 1024] range img = img.mean(2)[None, ...] # Make single color channel transform =...
Health-Universe/torchxrayvis_sl
main.py
main.py
py
1,185
python
en
code
0
github-code
54
12672502624
# -*- coding: utf-8 -*- from PIL import Image from OCRTool import * import time ### # 图片处理 ### # 练功 class LGManager(object): """docstring for LGManager""" def __init__(self): super(LGManager, self).__init__() self.init() self.color_init() self.ocr_init() self.db_...
MukaManaka/LGBAssistant
LGM.py
LGM.py
py
8,559
python
en
code
0
github-code
54
34945923136
from flask import Flask, render_template from flask.ext.pymongo import PyMongo from pymongo import MongoClient from flask_bootstrap import Bootstrap from importlib.machinery import SourceFileLoader import datetime import sys, os sys.path.append(os.getcwd()) import check_db app = Flask(__name__) Bootstrap(app) conn = M...
gtomic2/yxscrp
app/routes.py
routes.py
py
3,760
python
en
code
0
github-code
54
3904071020
n, m = map(int, input().split()) load = {i: [] for i in range(1, n+1)} point = {i: 0 for i in range(2, n+1)} new_list = [] for i in range(m): a, b = map(int, input().split()) if a == 1: point[b] = 1 new_list.append(b) elif b == 1: point[a] = 1 new_list.append(a) else: ...
yudai1102jp/atcoder
legacy/abc/abc168/d.py
d.py
py
746
python
en
code
0
github-code
54
16487371791
from flask import Flask, render_template, request import spacy import nltk from nltk import word_tokenize, pos_tag nltk.download('punkt') nltk.download('averaged_perceptron_tagger') app = Flask(__name__, static_url_path='/static') nlp = spacy.load("en_core_web_sm") @app.route("/") def index(): ret...
chandana-koganti14/Context
app.py
app.py
py
2,311
python
en
code
0
github-code
54
41727929684
from rest_framework import status from rest_framework.response import Response from rest_framework.reverse import reverse from rest_framework.views import APIView class ListView(APIView): """ Return a list containing all instances of this model. """ serializer_class = None permission_classes = []...
skazancev/django-api-boilerplate
project/api_admin/views/list.py
list.py
py
1,305
python
en
code
1
github-code
54
20036485285
""" A simplified version of the kmall-converter, for readability and usability as a cli. The logic is moved to process_datagram.py """ import os import sys import struct import time import portalocker import utm import click from glob import glob from tqdm import tqdm from pathlib import Path from functools import part...
kwigulaker/EchoLocation
EM2040/utils/kmall_to_xyz/kmall_to_xyz.py
kmall_to_xyz.py
py
8,549
python
en
code
1
github-code
54
31679267902
#! /usr/bin/env python # coding: utf-8 # # qca.py # # by Logan Hillberry # # # Description: # =========== # Provides two key functionalities: # # 1) # Object-Oriented class for interacting with density matrix data saved # by simulations. Enables calculation of entropies, expectation values, # mutual information,...
lhillber/qca
qca.py
qca.py
py
39,011
python
en
code
6
github-code
54
41527008144
#!/usr/bin/env python from distutils.core import setup from setuptools import find_packages # type: ignore from os.path import abspath, join, dirname name = "Mikko Korpela" # I might be just a bit too much afraid of those bots. address = name.lower().replace(" ", ".") + chr(64) + "gmail.com" desc = "A decorator to ...
mkorpela/overrides
setup.py
setup.py
py
1,253
python
en
code
257
github-code
54
10585848108
# -*- coding: utf-8 -*- """ Created on Sun May 20 12:12:48 2018 @author: matth --- 15600 """ from keras.models import Sequential from keras.layers import Lambda, Conv2D, Dense, Dropout, Flatten from keras.layers.convolutional import Convolution2D from keras.layers.convolutional import MaxPooling2D from keras import ba...
IALABGARAGE/PiloteAutomatique
trainmodel.py
trainmodel.py
py
2,147
python
en
code
0
github-code
54
46106316187
import matplotlib.pyplot as plt plt.rc('font',**{'family':'Times New Roman', 'size': 14}) plt.rc('axes', axisbelow=True) plt.rcParams['pdf.fonttype'] = 42 import os import subprocess import datetime import glob import plot_transmission_acks import matplotlib.pyplot as plt def get_video_packets(pcap_path): p = s...
glasgow-ipl/newcwv-nossdav2022
scripts/analytics/paper/count_lost_packets.py
count_lost_packets.py
py
3,052
python
en
code
3
github-code
54
32445172715
import tensorflow as tf import pickle import numpy as np #Load data from pickle file pickle_file = 'sentiment_set.pickle' with open(pickle_file, 'rb') as f: data_list = pickle.load(f) train_x = data_list[0] train_y = data_list[1] test_x = data_list[2] test_y = data_list[3] del data_list #print('Training...
vishal-keshav/Conv-neural-network
NLP/Deep network for sentiment analysis/sentiment_deep_network.py
sentiment_deep_network.py
py
2,495
python
en
code
0
github-code
54
14301491365
import catalog_funcs import const from os import path import pandas as pd import sys catalog = catalog_funcs.open_local_catalog_list() pd_catalog = pd.DataFrame(catalog) print(pd_catalog['Size'].sum()) #total_size = pd_catalog.sum(axis='Size') #print(total_size) ### EXIT ### sys.exit() ############ nft_paths = []...
giovanibs/iSB
catalog/catalog.py
catalog.py
py
776
python
en
code
0
github-code
54
3321761340
from PyQt6.QtWidgets import (QPushButton, QFrame, QListWidget, QListWidgetItem, QCheckBox, QVBoxLayout, QDialog, QMe...
lnls-ima/insertion-devices
gui/widgets/analysis.py
analysis.py
py
21,168
python
en
code
1
github-code
54
38922628151
from django.shortcuts import render, HttpResponseRedirect from django.views import View from django.contrib import messages from task_manager.mixins import LoginRequiredWithMessageMixin from task_manager.tasks.forms import TaskForm, SearchTaskForm from task_manager.tasks.models import Task from django.urls import rever...
vladimirbazhanov/python-project-52
task_manager/tasks/views.py
views.py
py
3,436
python
en
code
0
github-code
54
22851156031
"""Deal with various biological databases and services on the web. """ import time class RequestLimiter: # This class implements a simple countdown timer for delaying WWW # requests. def __init__(self, delay): self.last_time = 0.0 self.delay = delay def wait(self, delay=None): i...
dbmi-pitt/DIKB-Micropublication
scripts/mp-scripts/Bio/WWW/__init__.py
__init__.py
py
519
python
en
code
7
github-code
54
16078389697
import random import copy class LightsOutPuzzle(object): def __init__(self, board): self.board = board def get_board(self): return self.board def perform_move(self, row, col): if row >= 0 and col >= 0: max_nth_row, max_nth_col = len(self.board)-1, len(self.board[0][:])...
498020441/Lights_out_puzzle
bfs_searching_solver.py
bfs_searching_solver.py
py
2,956
python
en
code
0
github-code
54
13431157879
#!/usr/bin/python3 import numpy as np from utils import log class InputFile: def __init__(self, file_path): self._rows = [] self.num_rows = 0 self.num_cols = 0 self.num_ingredients_min = 0 self.num_cells_per_slice_max = 0 self._file = open(file_path, 'r') ...
locke14/hash-code-prep
solutions/file_io.py
file_io.py
py
1,731
python
en
code
0
github-code
54
70794729442
import numpy as np import cv2 from random import randint img = cv2.imread("fuzzy.png",1) # bw = cv2.imread('fuzzy.png', 0) thresholdValue = 45 #min = 0 max = 255 gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) blur = cv2.GaussianBlur(gray, (3, 3), 0) thresh = cv2.adaptiveThreshold(blur, 255, cv2.ADAPTIVE_THRESH_GAU...
jarzab3/openCV
Ex_Files_OpenCV_Python_Dev/Ch03/03_10 Begin/03_10.py
03_10.py
py
1,359
python
en
code
0
github-code
54
4295648879
import os.path from unittest import TestCase, expectedFailure from enstaller.new_solver import Pool from simplesat.pysolver_with_policy import Solver from .common import Scenario class ScenarioTestAssistant(object): def _check_solution(self, filename): # Test that the solution described in the scenari...
pombredanne/sat-solver-2
simplesat/tests/test_scenarios_policy.py
test_scenarios_policy.py
py
2,327
python
en
code
0
github-code
54
15319172171
import os import configparser from pathlib import Path import pandas_datareader.data as web import time config = configparser.ConfigParser() config.read("config.ini", encoding='utf-8') min_cap = config.get('settings', 'min_cap') min_cap_is_defined = False if min_cap.isnumeric(): min_cap_bln = float(min_cap) m...
AntonBespalov/FilterChartsByMarketCap
filterChartsMarketCap.py
filterChartsMarketCap.py
py
3,633
python
ru
code
0
github-code
54
70583367523
def BinaryToWords(binary): binary1 = binary words, i, n = 0, 0, 0 while(binary != 0): dec = binary % 10 words = words + dec * pow(2, i) binary = binary//10 i += 1 return (words) # Driver's code bin_data = input('Enter any Binary number: ...
UTSAVS26/Python-Basics-1
bin_words.py
bin_words.py
py
613
python
en
code
0
github-code
54
2834029308
# # Mars Rover Design Team # marker_search.py # # Created on Dec 01, 2018 # Updated on Aug 21, 2022 # # Find more info on archimedean spirals here https://www.britannica.com/science/spiral-mathematics # import math import core def calculate_next_coordinate(start, former_goal): """ Performs a calculation for...
MissouriMRDT/Autonomy_Software_Python
algorithms/marker_search.py
marker_search.py
py
2,136
python
en
code
23
github-code
54
5110301933
''' Storage module ''' from enum import Enum from functools import reduce, wraps import six from tinydb import Query, TinyDB from .graph.nodes import Root from .helper import Logger class Storage: def _singleton(func): @wraps(func) def func_wrapper(*args, **kwds): if Storage.db is n...
di-unipi-socc/TosKer
tosker/storage.py
storage.py
py
3,797
python
en
code
9
github-code
54
41218868704
from widget import * log = logging.getLogger("wooly.page") strings = StringCatalog(__file__) class Page(Frame): xml_content_type = "text/xml" html_content_type = "text/html" xhtml_content_type = "application/xhtml+xml" xml_1_0_declaration = """<?xml version="1.0" encoding="UTF-8"?>""" xhtml_1_1_do...
ssorj/boneyard
spicerack/wooly/python/wooly/page.py
page.py
py
5,885
python
en
code
2
github-code
54
26775715262
import sqlite3 def initialize_table( table_name: str, container_type_name: str, schema_version: str, cur: sqlite3.Cursor ) -> None: if not _is_metadata_table_initialized(cur): _do_initialize_metadata_table(cur) if not _is_table_initialized(table_name, container_type_name, schema_version, cur): ...
yuanjie-ai/MeUtils
meutils/other/docarray/array/storage/sqlite/helper.py
helper.py
py
2,279
python
en
code
3
github-code
54
14059116864
import pandas as pd import datetime import numpy as np # 1 Deal with CPI cpi = pd.read_excel('data/original_data/CPI.xlsx') cpi = cpi.loc[cpi.loc[:,"Datasign"]=="C",:] cpi.columns=['Date', 'Datasign', 'CPI'] my_logi = np.logical_and(cpi["Date"]>="2002-01",cpi["Date"]<="2021-02") cpi = cpi.loc[my_logi,] cpi.index = cp...
mliw/ts_essay_project
data/Primitive_preparation/0_Data_Preparation.py
0_Data_Preparation.py
py
2,111
python
en
code
0
github-code
54
28075305367
from django.utils.translation import gettext_lazy as _ STATUS_PRODUCT = ( (0, _("Innactive")), (1, _("Active")), (2, _("Deleted")), ) PRODUCT_COLOR_ORDER = ( (1, _("Principal")), (2, _("Secondary")), ) SIZE_PRODUCT = ( ('XS', _("XS")), ('S', _("S")), ('M', _("M")), ('L', _("L")), ...
zulymhj/api-rest-django
catalog/__init__.py
__init__.py
py
406
python
en
code
1
github-code
54
17762644361
""" Секретное слово Напишите программу для расшифровки секретного слова методом частотного анализа. Формат входных данных В первой строке задано зашифрованное слово. Во второй строке задано одно целое число nn – количество букв в словаре. В следующих nn строках записано, сколько раз конкретная буква алфавита встречает...
DAlferova/stepik_advanced
P6_dict/dict_secret_word.py
dict_secret_word.py
py
1,433
python
ru
code
0
github-code
54
25377157364
def solution(files): answer = [] head, num, tail = "", "", "" # head, num, tail = " ", " ", " " 띄어쓰기면 틀리다. for file in files: for i in range(len(file)): if file[i].isdigit(): head = file[:i] num = file[i:] for j in ran...
noxknow/Python-Coding_test
(01) 2018 카카오 블라인드, 인턴쉽/2018 카카오 블라인드 파일명 정렬.py
2018 카카오 블라인드 파일명 정렬.py
py
1,019
python
ko
code
1
github-code
54
31770835570
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from bs4 import BeautifulSoup as bs import time from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("--headless") # chr...
stogoff/pricescrapy
selenium_proxy_test.py
selenium_proxy_test.py
py
1,688
python
en
code
0
github-code
54
21073488228
import streamlit import pandas import requests import snowflake.connector from urllib.error import URLError streamlit.title('My Parents New Healthy Diner') streamlit.header('Breakfast Favorites') streamlit.text('🥣 Omega 3 & Blueberry Oatmeal') streamlit.text('🥗 Kale, Spinach & Rocket Smoothie') streamlit.text('🐔 H...
tim-wright/first_streamlit_app
streamlit_app.py
streamlit_app.py
py
2,444
python
en
code
0
github-code
54
28217146440
# ------------------------------------------------------- # synthesis #author:Maker #version:1.0.0 #create:2016/12/7 #the python version:python3 # ------------------------------------------------------- #encoding=utf-8 import json, os, sys from urllib.request import urlopen from urllib.request import Request from urll...
Makero/piSys
pi-command/synthesis.py
synthesis.py
py
1,435
python
en
code
0
github-code
54
36818351502
import os,sys,time from array import array import ROOT as rt from larcv import larcv import numpy as np # torch import torch import torch.nn as nn import torch.nn.functional as F class LArFlowVisibilityLoss(nn.Module): def __init__(self,nonvisi_weight=1.0e-2): super(LArFlowVisibilityLoss,self).__init__...
NuTufts/larflow
deprecated/old_larflownet_models/larflow_visibility_loss.py
larflow_visibility_loss.py
py
1,319
python
en
code
1
github-code
54
21475998311
#code1 tc = int(input()) for t in range(1, tc+1): n = int(input()) print(n**(1/3)) if abs(n**(1/3)-round(n**(1/3))) < 1e-9: print(f'#{t} {int(round(n**(1/3)))}') else: print(f'#{t} -1') #code2 arr = [0] * (10**6+1) for x in range(len(arr)): arr[x] = x**3 T = int(input()) for tc i...
chocolajin/Algorithm-Study
Advanced/5688_세제곱근을찾아라.py
5688_세제곱근을찾아라.py
py
444
python
en
code
0
github-code
54
44067269354
import numpy as np from glob import glob import csv classes = np.loadtxt('classes.csv', skiprows=1, dtype=str, delimiter=',') labels = classes[:, 2].astype(np.uint8) def write_labels(path): files = glob('{}/*/*_image.jpg'.format(path)) files.sort() name = '{}/test_labels.csv'.format(path) ...
LeslieWu999/16664_Final_Project
test.py
test.py
py
928
python
en
code
0
github-code
54
28666887485
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render, redirect, get_object_or_404 from forms import TicketForm, CommentForm from models import Ticket, Comment, VoteTracker from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_requir...
Lenox89/StreamThree
support_app/views.py
views.py
py
1,729
python
en
code
0
github-code
54
10885193996
from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from time import sleep driver = webdriver.Chrome() driver.implicitly_wait(10) driver.maximize_window() driver.get('https://www.baidu.com/') driver.find_element_by_class_name('soutu-btn').click() driver.find_element_by_clas...
gitly110/python_exc
selenium_learn/model/upload.py
upload.py
py
432
python
en
code
0
github-code
54
7801251568
# def solve(probdata): # for i in probdata: # try: # if (probdata.index(-i)): # print(str(i)+" "+str(probdata.pop(probdata.index(-i))),end = ' ') # except: # pass # t = int(input()) # a = [] # for k in range(0,t): # r = input() # listx = input().split(...
vivasvan1/tempballtrail
GLUT/test.py
test.py
py
700
python
en
code
0
github-code
54
21414101536
# ftp://BDTOPO_V3_ext:Aish3ho8!!!@ftp3.ign.fr/BDTOPO_3-0_2021-03-15/BDTOPO_3-0_TOUSTHEMES_GPKG_LAMB93_D001_2021-03-15.7z import urllib.request import py7zr import re import os def configure(context): context.stage("data.spatial.codes") def execute(context): df_codes = context.stage("data.spatial.codes") r...
Nitnelav/sirane-pipeline
data/bdtopo/download.py
download.py
py
1,162
python
en
code
0
github-code
54
16859240147
""" Script for plotting probability distribution functions of 2D quantities. Usage: plot_pdfs.py [options] Options: --root_dir=<str> Path to root directory containing data_dir [default: .] --data_dir=<str> Name of data handler directory [default: snapshots] --out_name=<str> Name of figure ...
evanhanders/plotpal
examples/d2/2d_rayleigh_benard/plot_b_pdf.py
plot_b_pdf.py
py
1,752
python
en
code
3
github-code
54
24468553498
""" Module with object for storing and accessing gui state variables. Each project open in the GUI will have its own instance of GuiState, as will any video player (`QtVideoPlayer` widget) which shows different images than in the main app GUI (e.g., `QtImageDirectoryWidget` used for visualizing results during training...
talmolab/sleap
sleap/gui/state.py
state.py
py
6,614
python
en
code
340
github-code
54
31559909980
#!/usr/bin/python3 import math ######################################################################## # Defining the class formulae. This is the core of the # # program, inside which the main functions are defined. # # This functions perform the mathematical calculations ...
root-user744/theMathShell
Formulae/formulae.py
formulae.py
py
6,891
python
en
code
2
github-code
54
74868678240
''' Created on 13 nov. 2018 @author: Iván REVISAR Y COMENTAR ''' #Lista de los numeros (Operandos) # Pila de operadores, si es el primero lo guardo, si no, pues miro la prioridad del que hay y el que viene #Si tienen misma prioridad o menos, desapilo # Distinta prioridad dentro de la pila y fuera # Si tengo un cierre...
IvanPerez9/Programming-Paradigms
Python/Practica1/Practica1.py
Practica1.py
py
3,662
python
es
code
7
github-code
54
32385742599
import sys input = sys.stdin.readline def solution(info): result = 1 now_score = (1e8, 1e8, 1e8) for idx, (num, g, s, b) in enumerate(info): if (g, s, b) < now_score: result = idx + 1 now_score = (g, s, b) if num == k: return result n, k = map(int, in...
seongjaee/algorithm-study
Codes/BOJ/8979_올림픽.py
8979_올림픽.py
py
474
python
en
code
0
github-code
54
18068115449
from __future__ import division, absolute_import import copy import numpy as np from sporco.admm import admm from sporco.admm import ccmod import sporco.cnvrep as cr import sporco.linalg as sl from sporco.common import _fix_dynamic_class_lookup from sporco.fft import rfftn, irfftn, empty_aligned, rfftn_empty_aligned ...
bwohlberg/sporco
sporco/admm/ccmodmd.py
ccmodmd.py
py
39,576
python
en
code
238
github-code
54
12643375237
from aiogram import Bot, Dispatcher, executor import requests import json bot = Bot(token='TOKEN') dp = Dispatcher(bot=bot) @dp.message_handler(commands=['start']) async def start(message): await bot.send_message(message.chat.id, 'Привет') @dp.message_handler(regexp='[0-9]+') async def start(messag...
laglol18/numbers_tg_bot
number.py
number.py
py
512
python
en
code
0
github-code
54
2961680571
import logging import matplotlib.pyplot as plt import numpy as np import seaborn as sns from tqdm import tqdm from scipy.stats import multivariate_normal from sklearn.cluster import KMeans, MeanShift from typing import Union, Tuple logging.basicConfig(level=logging.INFO, format='%(message)s') def gaussian_likelihood...
kakou34/misa_lab
lab2/src.py
src.py
py
15,240
python
en
code
0
github-code
54
20841965312
"""Utility Classes for managing Volumes""" from .partitioning import Disk, Partition import yaml class Volume: """Defines a Volume""" def __init__(self, name: str, target: "Partition | None", index: int): self.name = name self.target = target self.index = index @property def is...
LifetimeMistake/failrp
libs/volumes.py
volumes.py
py
2,734
python
en
code
0
github-code
54
37839792920
class HTTPStatus: OK = "HTTP/1.0 200 OK\r\n" NOT_FOUND = "HTTP/1.0 404 not found\r\n" BAD_REQUEST = "HTTP/1.1 400 Bad Request\r\n" METHOD_NOT_ALLOWED = "HTTP/1.1 405 Method Not Allowed\r\n" INTERNAL_SERVER_ERROR = "HTTP/1.1 500 Internal Server Error\r\n" class HTTPMethod: GET = "GET" POST =...
adikabintang/httpsrvrpy
httpsrvpy/__init__.py
__init__.py
py
553
python
en
code
0
github-code
54
5955115389
import torch a = torch.zeros(4, device="cuda:0") # Standard Library import argparse parser = argparse.ArgumentParser() parser.add_argument( "--headless_mode", type=str, default=None, help="To run headless, use one of [native, websocket], webrtc might not work.", ) parser.add_argument( "--visuali...
NVlabs/curobo
examples/isaac_sim/motion_gen_reacher_nvblox.py
motion_gen_reacher_nvblox.py
py
9,528
python
en
code
331
github-code
54
5527859995
""" Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an integer x onto the stack. pop(), which removes and returns the most frequent element in the stack. If there is a tie for most frequent element, the element ...
moontree/leetcode
version1/895_Maximum_Frequency_Stack.py
895_Maximum_Frequency_Stack.py
py
2,751
python
en
code
1
github-code
54
34289555067
from bs4 import BeautifulSoup import LjPage,ToolsBox,Downloader class LjCommPrice(LjPage.LjPage): def parse_datas(self, soup): totalfind = soup.select("h2.total.fl > span") if 0 == ToolsBox.strToInt(totalfind[0].get_text()):return '0' page_datas = [] communitys = soup.select("div.in...
VinceLim68/py3-craw
LjCommPrice.py
LjCommPrice.py
py
2,437
python
en
code
0
github-code
54
36805743413
from django.shortcuts import render,redirect from .forms import User_commentsForm,Student_commentsForm from .models import User,User_comments,Student_comments from django.contrib.auth import get_user_model,logout from django.views.generic import CreateView,FormView from django.contrib.auth.models import User,auth from ...
abeedshaik786/kishore_task1
svapp/views.py
views.py
py
32,468
python
en
code
0
github-code
54
24811837725
import setuptools REQUIREMENTS = ["numpy", "tensorflow", "tqdm", "trimesh"] setuptools.setup( name='human', version='0.0.1', author="Victor T. N.", install_requires=REQUIREMENTS, description="HuMAn: Human Motion Anticipation", url="https://github.com/Vtn21/HuMAn", packages=setuptools.find_...
Vtn21/HuMAn
setup.py
setup.py
py
478
python
en
code
1
github-code
54
36675106255
""" 单向非循环链表的实现 @author:feng.hao @date:2019.3.22 """ # Node的实现 class Node: def __init__(self, initdata): self._data = initdata self._next = None # 默认值None def getData(self): return self._data def getNext(self): return self._next def setData(self, newdata): sel...
deanjingshui/Algorithm-Python
15_链表/SinLinkedList_my.py
SinLinkedList_my.py
py
5,318
python
en
code
1
github-code
54
14940013979
import subprocess, pathlib, os, shutil import librosa, soundfile import re import pykakasi JULIUS_TMP_DIR = "./julius_segment_tmp" JULIUS_SEGMENT_SCRIPT_PATH = "/home/murtaza/segmentation-kit/segment_julius.pl" def format_moras_for_julius(moras): text = "".join(moras) kks = pykakasi.kakasi() hiragana = ""...
murtaza64/koutei
julius_interface.py
julius_interface.py
py
3,800
python
en
code
0
github-code
54
5749144715
# -*- coding:utf-8 -*- """ Definition of physical dimensions. Unit systems will be constructed on top of these dimensions. Most of the examples in the doc use MKS system and are presented from the computer point of view: from a human point, adding length to time is not legal in MKS but it is in natural system; for a...
drastorguev/financethroughpython
venv/lib/python2.7/site-packages/sympy/physics/units/dimensions.py
dimensions.py
py
18,785
python
en
code
13
github-code
54
43746403532
from Node import Node from SequenceNode import SequenceNode class Tree: def __init__(self): self.__root = None self.__size = 0 self.__sons = list() self.__countOpen = 0 self.__flagEndVisit = False self.__countChildSeq = 0 def get_root(self): return sel...
lucamozzz/BPMN2CODE
src/Tree.py
Tree.py
py
11,812
python
en
code
3
github-code
54
34170355858
#!/usr/bin/python import sys import matplotlib.pyplot as plt infile = sys.argv[1] with open(infile) as inf: points = [] lines = [] for line in inf: line = line.rstrip('\n') if line.find('line') == 0: plt.plot(*zip(*[x.split(':') for x in line.split()[1:]]), color="black") ...
Yukkurigame/Yukkuri
bin/show_points.py
show_points.py
py
478
python
en
code
7
github-code
54
39120765605
""" #Exercicio 39: A importãncia de R$780.000.00 será dividida entre três ganhadores de um concurso. Sendo que da quantia total: - O primeiro ganhador receberá 46%; - O segundo receberá 32%; - o terceiro recebera o restante; Calcule e imprima a quantia ganhada por cada um dos vencedores """ premio = 7800000...
VitorKruel102/Curso_Programando_em_Python
Exercicios_Seção04/Exercicio_39_S04.py
Exercicio_39_S04.py
py
548
python
pt
code
0
github-code
54
17711970212
import requests import time import random from .urls import UrlBuilder from .repo import Repo class ArgumentException(Exception): pass class Cleaner: def __init__(self, args, access_key='', do_random_sleep=True, max_sleep_time=2): self.access_key = access_key self.args = args[1:] s...
speratus/forked-repo-cleaner
repo_cleaner/cleaner.py
cleaner.py
py
2,393
python
en
code
0
github-code
54
10494969205
import os.path as osp import xml.etree.ElementTree as ET import os import mmcv import numpy as np import torch from .custom import CustomDataset import tqdm class DET(CustomDataset): CLASSES = ('n02510455', 'n02342885', 'n02355227', 'n02084071', 'n02...
youshyee/Greatape-Detection
mmdet/datasets/det.py
det.py
py
7,252
python
en
code
1
github-code
54
9032069200
def addoptions(): import optparse parser = optparse.OptionParser() exm_i = "./example/F_Protein_PRE_STATE_TRIMER.pdb" exm_f = "./example/F_Protein_POST_STATE_TRIMER.pdb" exm_o = "./output/Morph_PRE_POST_Transition.pdb" exm_n = 5 #Adding the options parser.add_option('-i', default=exm_i, type="string", he...
neeleshsoni21/AIMorpher
src/addoptions.py
addoptions.py
py
1,192
python
en
code
1
github-code
54
12588848941
from simulation_utils import * from correctness import * forecasts = [] actuals = [] n_forecasts = 100 for i in range(n_forecasts): random.seed(i) np.random.seed(i) prices = train_and_test_generate(254, 25, 1000, 0.1, 0.3, 'call', 1060, 0.03) forecast = simulated_pred(prices["train"], prices["test"],...
ozonowicz/option-price-simulation-and-prediction
correctness_test.py
correctness_test.py
py
546
python
en
code
0
github-code
54
32158916422
#-*- coding: utf8 -*- import traceback import urllib import datetime import jieba import requests import json import codecs import sys reload(sys) sys.setdefaultencoding('utf8') from pymongo import MongoClient #from pyspark import SparkContext def dump_pvlog_browser(): try: filename = 'browser.out'...
solaris-meng/ys-analyses
mongodb_dump_browser.py
mongodb_dump_browser.py
py
2,619
python
en
code
0
github-code
54
36731009955
#https://www.acmicpc.net/problem/11727 # 재귀함수 호출 방법1 - Recursion Error 발생 # def step(n): #fail # if n not in memo: # memo[n] = step(n-1) + 2*step(n-2) # return memo[n] def solve(): n = int(input()) # 풀이 1. 재귀함수 호출 # global memo # memo = {1: 1, 2: 3} # res = step(n) # 풀이 2...
YHsla/YHsla
BackJoon/ans_11727_YH.py
ans_11727_YH.py
py
640
python
en
code
0
github-code
54
41766773284
import random import numpy as np import torch from torchtext import data from torchtext import datasets import params as P def fetch_data(): random.seed(P.configure()['seed']) np.random.seed(P.configure()['seed']) torch.manual_seed(P.configure()['seed']) torch.backends.cudnn.deterministic = True ...
FinchMF/CNN_Text_Classification
CNN_Text-binary/classifier/dataset.py
dataset.py
py
1,804
python
en
code
0
github-code
54
26011281880
# Check if given char is vowel or consonant import re vowel_list=['a','e','i','o','u','A','E','I','O','U'] ch=input("Enter the chracter :") if re.search("[a-z]", ch) or re.search("[A-Z]", ch): if ch in vowel_list: print(ch, "vowel") else: print(ch, "Consonat") else: print("Invalid input")
Shivkpra/Python_Assignment_Program
Question_72(input and output).py
Question_72(input and output).py
py
320
python
en
code
0
github-code
54
18197474858
from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from backend.socket_chat.consumers.base import BaseConsumer, private from backend.socket_chat.mixins.events_db import EventsDBMixin class EventsMixin(EventsDBMixin, BaseConsumer): def setup(self, meta): ...
smartblack24/ChatApp
backend/socket_chat/mixins/events.py
events.py
py
6,776
python
en
code
0
github-code
54
17121022935
import requests from datetime import datetime pixela_endpoint = "https://pixe.la/v1/users" params = { "token": "1298gr9()9Yjhoefw@", "username": "harigaze", "agreeTermsOfService": "yes", "notMinor": "yes" } # # response = requests.post(url= pixela_endpoint, json=params) # print(response.text) graph_e...
dlrkd1239/Practicing-Python
Udemy/Day_37/main.py
main.py
py
1,106
python
en
code
0
github-code
54
12203493057
from sys import stdin as si from typing import List class OrangeAteOrenge: def __init__(self): self._input_string_length = int(si.readline().rstrip("\n")) self._input_string = si.readline().rstrip("\n") self._vitamin_string_amount = 0 self._part_string_list = [] self.FindVi...
ABER1047/BaekJoon-Study
[Source_Code] APSODE/AGCU_/QuestionD.py
QuestionD.py
py
1,755
python
en
code
2
github-code
54