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
35300100688
# @nzm_ort # https://github.com/nozomuorita/atcoder-workspace-python # import module ------------------------------------------------------------------------------ from collections import defaultdict, deque, Counter import math from itertools import combinations, permutations, product, accumulate, groupby, chain from ...
nozomuorita/atcoder-workspace-python
abc/abc247/C/answer.py
answer.py
py
782
python
en
code
0
github-code
13
31544634834
#!/usr/bin/env python3 import time, threading, random, logging, os, hashlib, json, queue#, pdb import glovar from network import broadMessage # committee process class BlockProcessing(threading.Thread): def __init__(self, cominfo, logdirectory): threading.Thread.__init__(self) sel...
louis0121/pos
blockgen.py
blockgen.py
py
18,630
python
en
code
0
github-code
13
9156811140
import barcode from barcode.writer import ImageWriter text="enter your text here" text1=str(text) code=barcode.get_barcode_class("code128") image=code(text,writer=ImageWriter) save_img=image.save('my image barcode')
satkar2001/BarcodeGenerator
test.py
test.py
py
219
python
en
code
1
github-code
13
71284048659
from . import constants import sys from .charsetprober import CharSetProber class CharSetGroupProber(CharSetProber): def __init__(self): CharSetProber.__init__(self) self._mActiveNum = 0 self._mProbers = [] self._mBestGuessProber = None def reset(self): CharSetProber.r...
arduino/Arduino
arduino-core/src/processing/app/i18n/python/requests/packages/charade/charsetgroupprober.py
charsetgroupprober.py
py
2,606
python
en
code
13,827
github-code
13
10173133495
# -*- coding: utf-8 -*- """ Created on Wed Jul 19 19:22:00 2017 @author: thinktic """ fd = open("datos_ficheros","r",encoding="UTF-8") linea= fd.readline() print("La longitud de la priemra linea es {}".format(len(linea.rstrip()))) #fd.close() Usamos seek(0) para reiniciar la suma y no hace falta cerrar fd ## Nuemro ...
jmchema/CursoPython
Dia3/Ejercicios/Ejercicio1.py
Ejercicio1.py
py
1,146
python
en
code
0
github-code
13
71348361618
""" Created on Thu Aug 20 17:44:07 2020 @author: nrdas """ import sounddevice as sd from pyAudioAnalysis import audioSegmentation as ag from pyAudioAnalysis import audioBasicIO as aIO from scipy.io.wavfile import write duration = 15 fs = 44100 print(sd.query_devices()) print('recording now!') sample = sd.rec(int(d...
Dashora7/VoiceID
processing.py
processing.py
py
652
python
en
code
0
github-code
13
71528340499
#!/usr/bin/env python3 # Run with: # ./week2_dotplots.py ./sorted_SRVelvet_lastz.out # ./week2_dotplots.py ./sorted_BCVelvet_lastz.out # ./week2_dotplots.py ./sorted_SRSpades_lastz.out # ./week2_dotplots.py ./sorted_BCSpades_lastz.out # ./week2_dotplots.py ./sorted_LRSpades_lastz.out """ Usage: dotplot.py ./sort...
JSYamamoto/qbb2018-answers
lab2/dotplots.py
dotplots.py
py
1,827
python
en
code
0
github-code
13
29218780221
from typing import List from pyteal.ir import TealBlock from pyteal.errors import TealInternalError def sortBlocks(start: TealBlock, end: TealBlock) -> List[TealBlock]: """Topologically sort the graph which starts with the input TealBlock. Args: start: The starting point of the graph to sort. R...
algorand/pyteal
pyteal/compiler/sort.py
sort.py
py
1,039
python
en
code
269
github-code
13
7954870719
"""Created: Friday July 20, 2018 Modified: Thursday August 2, 2018 Jorge Luis Flores Calculates the similarity between each mRNA and a sequence from a given file containing the calculated vectors of mRNA. Stores in .csv files a matrix where each row corresponds to an mRNA, and each column corresponds to t...
jl-flores/udem-2018-bioinfo
distance-calc/Distance_measuring.py
Distance_measuring.py
py
12,672
python
en
code
0
github-code
13
35360566510
import os import pytest from typing import Dict from pathlib import Path import yaml import logging from unittest import mock # Import dvc from dvc.core.config import ConfigReader, ConfigDefault from dvc.core.database import SupportedDatabaseFlavour import logging @pytest.fixture(params=(logging.DEBUG, logging.WARN...
kenho811/Python_Database_Version_Control
tests/fixtures/config_service.py
config_service.py
py
6,001
python
en
code
2
github-code
13
26302021202
import json from datetime import datetime from django.db import models from django.utils.translation import gettext_lazy as _ from IOTdevices.actions import * from server.settings import PROJECT_ID, subscriber, publisher class OperationMode(models.TextChoices): NORMAL = 'NL', _("Normal") OVERRIDE = 'OR', _(...
naveennvrgup/smart-traffic-light
maps/models.py
models.py
py
5,371
python
en
code
0
github-code
13
36038750585
import math def is_prime_num(num): for i in range(2, math.floor(math.sqrt(num)) + 1): if (num % i == 0 and num != i): return False return num > 1 def problem3(num): largest = num for i in range(2, math.floor(math.sqrt(num)) + 1): if (is_prime_num(i) and num % i == 0): ...
karthigb/recreational
challenge/projectEuler/problem3.py
problem3.py
py
420
python
en
code
0
github-code
13
17248105286
"""flashio URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
patraz/cardsio
flashio/urls.py
urls.py
py
3,379
python
en
code
0
github-code
13
1652921645
#要实现还是很简单...然后我就超时了 #关键应该在那个对1337模运算上 class Solution(object): def superPow(self, a, b): """ :type a: int :type b: List[int] :rtype: int """ B=0 l=len(b) for i in range(l): B+=b[i]*10**(l-i-1) return a**B%1337 #或者这个更...
fire717/Algorithms
LeetCode/python/_372.SuperPow.py
_372.SuperPow.py
py
2,458
python
zh
code
6
github-code
13
21498375229
def filter_with_new_bit(array_to_filter, current_bit_index, most_common=True): nr_ones= sum([int(x[current_bit_index]) for x in array_to_filter]) #Count number of ones at a certain index in array if nr_ones>=len(array_to_filter)-nr_ones: #1 is more common result_bit= "1" if most_common else "0" else:...
shaefeli/AdventOfCode2021
day03/day3_py_part2.py
day3_py_part2.py
py
1,270
python
en
code
0
github-code
13
43231756874
import numpy as np import pygame as pg from modules.swarm_path_search import SwarmPathSearch pg.font.init() def render(srf: pg.Surface, points: np.ndarray, rsa: SwarmPathSearch): pid_font = pg.font.SysFont("Ubuntu", 12, True) maxw = np.max(rsa.weights) for i in range(points.shape[0]): for j in...
VY354/my_repository
Python/projects/swarm_intelligence/swarm_path_search/src/modules/swarm_path_search_visualizer.py
swarm_path_search_visualizer.py
py
769
python
en
code
0
github-code
13
36021905808
from Letter_frequency_a_and_c import polish_tables_to_import, english_tables_to_import, german_tables_to_import from math import fabs def getting_frequencies(table): sum_of_letters = 0 for value in table.values(): sum_of_letters += value for k, v in table.items(): if sum_of_...
MatPatCarry/Algorithms_univerity_classes
WDA_List_5/Letter_frequency_c_functions.py
Letter_frequency_c_functions.py
py
3,209
python
en
code
0
github-code
13
23636995249
import json, os, random, h5py, tqdm, ast from collections import Counter from PIL import Image import numpy as np from torch.utils.data import Dataset import torch def parse_and_prepare_data(dataset, karpathy_json_path, image_folder, captions_per_image, min_word_freq, output_folder, max_len): dataset = dataset.low...
numan947/DescribeIt-A-ReImplementation-of-Show-Attend-And-Tell
data.py
data.py
py
8,467
python
en
code
0
github-code
13
39530376054
import math import resource import socket from logging import getLogger import errno import msgpack import outcome import anyio from async_generator import asynccontextmanager from .exceptions import SerfClosedError, SerfConnectionError, SerfError from .result import SerfResult from .util import ValueEvent, Cancelled...
smurfix/asyncserf
asyncserf/connection.py
connection.py
py
13,002
python
en
code
3
github-code
13
29821977560
import subprocess import os import socket import fcntl import struct import json import time import datetime import picamera import picamera.array import atexit configFile = '/home/pi/camera.json'; HOST = '192.168.1.99' # HOST = '192.168.10.2' PORT = 81 CODE_PING_PONG = 100 CODE_ADD_SCANNER = 1000 CODE_TAKE_THUMB...
amakaroff82/scanner
scanerPI/server.py
server.py
py
9,792
python
en
code
0
github-code
13
7927061610
############# # Camera.py # ############# # This is the proverbial sausage factory. # There are lots of things to play with in here # and I've tried to mark areas of interest from collections import namedtuple from math import radians, tan, sqrt from random import uniform from time import time from Utility.Vector impo...
mld2443/PythonRayTracer
Camera.py
Camera.py
py
5,012
python
en
code
0
github-code
13
12088324723
# 语句 # 3个物理行,3个逻辑行 # a = 10 # b = 20 # print(a, b) # a = 10; b = 20 # 不推荐 # print(a, b) # # # a = 10 # # b = 20 # 不推荐 # # print(a, b) # # # 物理行长 --》换行 # print(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8) # # # 显式换行 # # \ 续行符,表示下一行也是上一行未完的语句 # result = 1 + 2 + \ # 3 + 4 + \ # 5 + 6 + \ # 7 + 8 # prin...
15149295552/Code
Month01/Day02/demo04_statement.py
demo04_statement.py
py
814
python
en
code
1
github-code
13
33253338869
import numpy as np import math import random # free parameters in common J = 1 L = 64 BLOCK = 2 # fun_phi NUM_SYSTEM = 128 # num of independent systems STEP = 5 # sampling time divide nRG = 4 # RG iteration times # MCRG NUM_INTERACTION = 8 # 0 for Odd interaction def Initial(): global L ...
helloworld0909/MCRG_on_Ising_model
source.py
source.py
py
8,469
python
en
code
1
github-code
13
5776487207
import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image, ImageOps, ImageFilter import os import shutil from sklearn.model_selection import train_test_split #data = pd.read_csv('train.csv', sep=",", header=None) data = pd.read_csv('test.csv', sep=",", header=None) #data = pd.read_csv...
jiegenghua/Traffic-Sign-Detection
datapreprocessing.py
datapreprocessing.py
py
3,102
python
en
code
1
github-code
13
7511257632
# -*- coding: utf-8 -*- """ Created on Sun Apr 26 17:53:38 2015 @author: andy """ import gensim import hansard_fetcher as fetcher WORDVECS = 'temporary/GoogleNews-vectors-negative300.bin' def load_wordvecs(): return gensim.models.Doc2Vec.load_word2vec_format(WORDVECS, binary=True) def get_test_sentences():...
andyljones/hansard_analysis
word2vec_interface.py
word2vec_interface.py
py
738
python
en
code
0
github-code
13
19702044425
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription, SwitchDeviceClass from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import DeviceInfo from .. import DOMAIN, SIGNAL_UPDATE_DATA, RedmondKettle, MODE_BOIL, STATUS_ON class RedmondPo...
Nemiroff/hassio-r4s
custom_components/ready4sky/switches/power_switch.py
power_switch.py
py
1,447
python
en
code
null
github-code
13
28462325130
import random def get_random_int(min, max): result = random.randint(min, max) return result def game(my_random, min, max, attempts): if attempts == 0: print("Вы проиграли! А число было: %d" % my_random) return user_in = input("Угадай число от %s до %s. Осталось %s попыток: ...
Sadburritos/python_homework
June06/04.py
04.py
py
1,010
python
ru
code
0
github-code
13
33481709115
import unittest import datetime import io import os import shutil import replicate_polymer.replicate_polymer as replicate_polymer from replicate_polymer_lib.check_connect_pdb import check_conect_pdb class TestCheckConnectPdb(unittest.TestCase): # =============================================================== ...
jrdcasa/replicate_polymer_topology
tests/01-test_check_connect_pdb.py
01-test_check_connect_pdb.py
py
4,181
python
en
code
0
github-code
13
8865933561
# -*- encoding: utf-8 -*- from setuptools import setup, find_packages from codecs import open import os basedir = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(basedir, "README.md"), encoding="utf-8") as readmefile: long_description = readmefile.read() setup( name="cosmopvcod", versio...
jamesmhbarry/PVRAD
cosmopvcod/setup.py
setup.py
py
1,039
python
en
code
1
github-code
13
14218506129
import requests import streamlit as st from PIL import Image from io import BytesIO import datetime API_BASE_URL = "https://api.ebird.org/v2" st.title("Recent Bird Sightings in New Hanover County") def get_recent_sightings(): today = datetime.date.today() last_month = today - datetime.timedelta(days=30) ...
weshuth/nhcbirds
main.py
main.py
py
1,724
python
en
code
0
github-code
13
37996828378
include.block( "SMEWTrilepSkim/SMTRILEP_PhotonSelector.py" ) from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags from D2PDMaker.D2PDMakerConf import D2PDPhotonSelector from AthenaCommon.AlgSequence import AlgSequence preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName()) preseq += D2PDP...
rushioda/PIXELVALID_athena
athena/PhysicsAnalysis/D3PDMaker/PhysicsD3PDMaker/share/SMTRILEP_PhotonSelector.py
SMTRILEP_PhotonSelector.py
py
722
python
en
code
1
github-code
13
2056803620
import datetime from scrapy.http.response.html import HtmlResponse from climatedb import parse from climatedb.crawl import create_article_name, find_start_url from climatedb.models import ArticleItem from climatedb.spiders.base import BaseSpider class ChinaDailySpider(BaseSpider): name = "china_daily" def ...
ADGEfficiency/climate-news-db
climatedb/spiders/china_daily.py
china_daily.py
py
1,244
python
en
code
12
github-code
13
3013405280
from rest_framework import status from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework.views import APIView from base.utils import get_today from base.messages import Messages from django. db. models import Sum from ..models import DailyMenu, MainMenu, Feedbac...
shreeramy/RestaurantAPITask
restrant/api/api_views.py
api_views.py
py
4,890
python
en
code
0
github-code
13
39389390276
# -*- coding: utf-8 -*- """ Created on Wed Jul 1 21:16:00 2020 @author: Emerl2 """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import tensorflow as tf train_path = r'C:\Users\Emerl2\shopee-product-detection-student\train\train\train\\' test_path = r'C:\Users\Emerl2\shopee-produ...
Emerler/Product-Detection
find-broken-file.py
find-broken-file.py
py
889
python
en
code
0
github-code
13
16455537139
import discord from discord.ext import commands from discord.ext.commands import Greedy from typing import Union TOKEN = "token-here" bot = commands.Bot(command_prefix='pls', help_command=None, activity=discord.Game(name="`pls yoink <emotes>` or `delete <emotes>`"), ...
DoggieLicc/Emote-Yoinker
emoteyoink.py
emoteyoink.py
py
2,156
python
en
code
0
github-code
13
37785399865
"""Data Structures for Disjoint Sets, Reference - CLRS Page 565""" # ------------------------- Visual Representation for Linked List implementation on Page 565 CLRS -------------------------- set_dict = {} # Make it global to make the program simpler. Disjoint sets are stored here with key = representat...
anantvir/Graph_DataStructures
Disjoint_Sets_Union_Find.py
Disjoint_Sets_Union_Find.py
py
2,630
python
en
code
0
github-code
13
35113917718
import numpy as np import csv import cv2 import os import matplotlib.image as mpimg import matplotlib.pyplot as plt from sklearn.utils import shuffle from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers import Flatten, Dense, Lambda, Dropout from keras.layers.convol...
DirkH78/CarND-Behavioral-Cloning-P3
model.py
model.py
py
5,256
python
en
code
0
github-code
13
70858175377
""" Author: Daniel Krusch Purpose: To convert product type data to json Methods: GET, POST """ """View module for handling requests about product categories""" from django.contrib.auth.models import User from django.http import HttpResponseServerError from rest_framework.viewsets import ViewSet from rest_fram...
thejmdw/swipehome-server
swipehomeapi/views/search.py
search.py
py
4,882
python
en
code
0
github-code
13
71924192339
import tensorflow as tf class Resnet: """ Builds a model up to the final convolutional layer 34 layer resnet number_of_sections = 5 out_width & out_height == image_size*((0.5)**number_of_sections) returns a conv layer of shape (batch_size, out_width, out_height, 512) ...
colinsteidtmann/object-detection
models/resnet_model.py
resnet_model.py
py
6,982
python
en
code
0
github-code
13
71945808978
''' Ordered dictionaries: they remember the insertion order. So when we iterate over them, they return values in the order they were inserted. For normal dictionary, when we test to see whether two dictionaries are equal, this equality os only based on their K and V. For ordered dictionary, when we test to see whethe...
AniketKul/learning-python3
ordereddictionaries.py
ordereddictionaries.py
py
849
python
en
code
0
github-code
13
26785344165
from flask import Flask from flask import request from flask import jsonify import os import tempfile from speech_to_text import speech_to_text_translated, speech_to_text from summary_with_openai import summary_with_davinci from text_to_italian import translate from text_to_summary import text_to_summary from video_to...
AndreaCaglio97/video-summarization
app.py
app.py
py
2,902
python
en
code
0
github-code
13
40131128370
class Solution: def defangIPaddr(self, address: str) -> str: address = list(address) for i in range(len(address)): if address[i] == '.': address[i] = '[.]' answer = '' for c in address: answer += c return a...
dlwlstks96/codingtest
LeetCode/1108_Defanging an IP Address.py
1108_Defanging an IP Address.py
py
326
python
en
code
2
github-code
13
26603260750
# 可视化神经网络的过滤器 # 想要观察卷积神经网络学到的过滤器 # 显示每个过滤器所响应的视觉模式 from keras.applications import VGG16 from keras import backend as K import matplotlib.pyplot as plt import numpy as np # import tensorflow as tf # # tf.compat.v1.disable_eager_execution() model = VGG16(weights='imagenet', include_top=False) model.summ...
linhexiu/Attention
V9.py
V9.py
py
3,023
python
en
code
0
github-code
13
12261348210
#!/usr/bin/env python from gimpfu import * GRID_COLUMNS = 12 GRID_COLUMN_WIDTH = 80 GRID_WIDTH = GRID_COLUMNS * GRID_COLUMN_WIDTH def python_grid(image, draw, guide_1, guide_2): image.undo_group_start(); offset_left = (image.width - GRID_WIDTH) / 2 for i in range (GRID_COLUMNS): base = offset_left + i * GRI...
wellspring/dotfiles
config/GIMP/2.10/plug-ins/python_grid.py
python_grid.py
py
872
python
en
code
2
github-code
13
4054637220
import cgi import datetime import urllib import webapp2 import jinja2 import os import random from Data import * from google.appengine.ext import db from google.appengine.api import users jinja_environment = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) class Vote(webapp2.Reques...
sujalw/votemash
Vote.py
Vote.py
py
4,349
python
en
code
0
github-code
13
41831549812
from ClaseAMPL import SolverWithAMPL import os import time class Control: def __init__(self): self.urlCarpetaCodigo = os.getcwd() + "\\codigosAMPL\\" self.urlCarpetaData = os.getcwd() + "\\datosAMPL\\" def createArchive(self, filename, listVariables, listPrices, listRestrictions): # C...
CerberusStar/ProyectoJoeStar
Controladora.py
Controladora.py
py
3,525
python
es
code
1
github-code
13
27997775772
import pygame import random pygame.display.init() pygame.font.init() def menu(): print('menu()') global run loop = True while loop: global text_score clock.tick(0) screen.fill((255, 255, 255)) # render font to image text_score = font.render('Sco...
zephyrdark/threelaneball
threelaneball.py
threelaneball.py
py
5,631
python
en
code
0
github-code
13
25901550046
import os import shutil import re import codecs import math import xml.etree.ElementTree import traceback from qgis.PyQt.QtCore import QDir, QSize from qgis.core import (QgsSingleSymbolRenderer, QgsCategorizedSymbolRenderer, QgsGraduatedSymbolRenderer, ...
tomchadwin/qgis2web
qgis2web/olStyleScripts.py
olStyleScripts.py
py
32,071
python
en
code
494
github-code
13
715187830
# -*- coding: utf-8 -*- """ Created on Tue Jan 10 14:04:15 2023 @author: fzbri """ import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.utils import resample #from sklearn.model_selection import cross_val_score from sklearn.model_selection import train_test_split from ...
bricha-fz/ml_credit_risk_xai
data_processing.py
data_processing.py
py
5,396
python
en
code
0
github-code
13
40649434695
import model_q3 from keras.optimizers import Adam from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import ModelCheckpoint import numpy as np from sklearn.cluster import KMeans from sklearn.decomposition import PCA from shutil import copyfile import os img_width, img_height = 224, 224 valid...
rogeriobonatti/ml_proj
eval3.py
eval3.py
py
2,036
python
en
code
0
github-code
13
10111527115
import asyncio import discord from discord import Embed, ApplicationContext, Interaction, Colour, MISSING from discord.ui import View, Button import czbook from bot import BaseCog, Bot from utils.discord import get_or_fetch_message_from_reference, context_info class InfoCog(BaseCog): def __init__(self, bot: Bo...
watermelon1024/czbooks-helper
cogs/info.py
info.py
py
7,543
python
en
code
1
github-code
13
31917686723
import time import pygame # Import constants and game-related functions from other modules from checkers.constants import WIDTH, HEIGHT, RED, WHITE from checkers.game import Game from minimax.algorithm import minimax,alpha_beta,get_all_moves from winner_gui import display_winner from difficulty_selection_gui import D...
Yahia-Hasan/Ai-Checkers-Game
main.py
main.py
py
3,220
python
en
code
0
github-code
13
74021098579
from django.contrib.auth import login from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect from .decorators import * from .forms import * from .models import * # from tablib import Dataset # Create your views here. def index_view(request): if request.method == "P...
douniagh/MyApplication-
projet1/myapplication/app1/views.py
views.py
py
7,766
python
en
code
0
github-code
13
17934644397
#https://www.youtube.com/watch?v=clMJ8BwCGa0&ab_channel=Exponent import math array = [1,2,3,4,1] def find_repeated_number(arr:list)->int: ''' brute force solution to find a repeated number. We know there is only one repeated number o(n^2) ''' for i in range(0, len(arr)): temp = arr[0:i] + a...
antoniojsp/retos
coding_interview/repeated_number_interview.py
repeated_number_interview.py
py
1,728
python
en
code
0
github-code
13
12574214044
"""add category column to items Revision ID: 366a6fa49471 Revises: a0a65e21f96f Create Date: 2022-01-12 12:01:15.398481 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '366a6fa49471' down_revision = 'a0a65e21f96f' branch_labels = None depends_on = None def up...
justinrusso/loot-locker
migrations/versions/20220112_120115_add_category_column_to_items.py
20220112_120115_add_category_column_to_items.py
py
887
python
en
code
2
github-code
13
20293397794
# -*- coding: utf-8 -*- import re from chaoslib.types import Configuration, Secrets from logzero import logger from chaosazure.application_gateway.constants import RES_TYPE_SRV_AG from chaosazure.application_gateway.actions import __network_mgmt_client from chaosazure.common.resources.graph import fetch_resources __...
chaostoolkit-incubator/chaostoolkit-azure
chaosazure/application_gateway/probes.py
probes.py
py
3,590
python
en
code
22
github-code
13
42363839131
#! /usr/bin/env python # from astroquery.admit import ADMIT if True: import pickle a = pickle.load(open('alma.pickle','rb')) a = ADMIT() a.query(source_name_alma="NGC3504") a.check() if False: r = a.sql("SELECT * from win") print(len(r),r) if False: q1 = 'SELECT * from spw, sources WHERE sour...
teuben/study7
check1.py
check1.py
py
729
python
en
code
0
github-code
13
36520150294
import torch import random from torch import nn, optim from torch.nn import functional as F import numpy as np from copy import deepcopy from tqdm import trange import matplotlib.pyplot as plt class ReplayMemory(): def __init__(self, capacity): self.capacity = capacity self.memory = [] se...
joshnroy/TransferLearningThesis
new/dqn.py
dqn.py
py
7,879
python
en
code
0
github-code
13
73488209617
# Evaluate the value of an arithmetic expression in Reverse Polish Notation. # Valid operators are +, -, *, and /. Each operand may be an integer or another expression. # Note that division between two integers should truncate toward zero. # It is guaranteed that the given RPN expression is always valid. That means ...
aslamovamir/LeetCode
Evaluate_Reverse_Polish_Notation.py
Evaluate_Reverse_Polish_Notation.py
py
2,244
python
en
code
0
github-code
13
39025807376
import random class SkipList: """ Class representing skiplist as created by William Pugh A skip list is built in layers. The bottom layer is an ordinary ordered linked list. Each higher layer acts as an "express lane" for the lists below, where an element in layer i appears in layer i+1 with some...
wiknwo/data_structures_and_algortithms
Data Structures/Linked List/SkipList.py
SkipList.py
py
12,104
python
en
code
0
github-code
13
73147135377
import os import joblib import numpy as np import tensorflow as tf from feature_processing import extract_feature from cnn_model import get_model from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import OneHotEncoder from sklearn.model_selection import train_test_split # TO DO # Need as comma...
ILuxa15/sound_classification
example_predict.py
example_predict.py
py
1,938
python
en
code
1
github-code
13
17608780387
class ListElement: def __init__(self, value=None, next=None): self.value = value self.next = next def delNode(pos): global listHead if pos == 1: listHead = listHead.next else: prev = listHead for i in range(2, pos): prev = prev.next ...
ishizukuma/FE_B_sample
Python/Q10.py
Q10.py
py
1,530
python
en
code
3
github-code
13
7181719100
#!/usr/bin/python3 #-*- coding:utf8 -*- ''' 页面主体在 <div id="contentmain"> 标签内 标题为 <div id="title"> 正文为 <div id="content"> 下一页 <a href="54900.htm">下一页</a> ''' import requests from bs4 import BeautifulSoup import re import os from multiprocessing import Pool header = {'Host': 'www.wenku8.net', 'User-Agent': '...
CatAndCoffee/playground
埃罗芒阿老师小说爬虫/spider_multiprocessing.py
spider_multiprocessing.py
py
2,449
python
en
code
4
github-code
13
25002939509
from string import Template import stories class aa(): class StoryMemberPostsTopicOnBook(stories.Story): ID = "MemberPostsTopicOnBook" TitleTemplate = _('<a href="/Members/$MemberKey">$MemberFullname</a> has posted a new topic under <a href="ParentURL">$ParentTitle</a>') BodyTemplate = _(''' <strong>The mess...
wrook/wrook
root/feathers/talk_stories.py
talk_stories.py
py
1,640
python
en
code
4
github-code
13
73053461457
# dataset settings dataset_type = 'WordEmbeddingDataset' train_pipeline = [ dict(type='LoadEmbeddingFromFile'), dict(type='ToTensor', keys=['emb']), dict(type='ToTensor', keys=['gt_label']), dict(type='MyCollect', keys=['emb', 'gt_label']) ] test_pipeline = [ dict(type='LoadEmbeddingFromFile'), ...
LiUzHiAn/kdxf
configs/datasets/word_emb_dataset_config.py
word_emb_dataset_config.py
py
1,270
python
en
code
0
github-code
13
34139190948
import fasttext import sys if len(sys.argv) < 2: print("Data folder is required as an argument") sys.exit(1) folder = sys.argv[1] if folder[-1] != "/": folder = folder + "/" # train classifier model = fasttext.train_supervised(input=folder + "training.txt", lr=0.1, epoch=25, wordNgrams=2) model.save_model(fo...
jeromechoo/sanctions-tracker
4_train_model.py
4_train_model.py
py
898
python
en
code
4
github-code
13
16463128313
import numpy as np import codecs #计算欧氏距离 def distance(x1,x2): return np.sqrt(sum(np.power(x1-x2,2))) #对一个样本找到与该样本距离最近的聚类中心 def nearest(point, cluster_centers): min_dist = np.inf m = np.shape(cluster_centers)[0] # 当前已经初始化的聚类中心的个数 for i in range(m): # 计算point与每个聚类中心之间的距离 d = distance(...
yunyikristy/CM-ACC
kmeanspp.py
kmeanspp.py
py
2,810
python
en
code
19
github-code
13
36114818405
import os import shutil from docutils import nodes from docutils.parsers.rst import Directive from docutils.parsers.rst import directives, Directive from sphinx.util.docutils import SphinxDirective, SphinxTranslator def setup(app): app.add_node(pdfimage, html=(visit, depart)) app.add_directive...
carnotresearch/cr-vision
docs/extensions/pdfimage.py
pdfimage.py
py
2,504
python
en
code
2
github-code
13
9087834350
#https://www.acmicpc.net/problem/15489 #백준 15489번 파스칼 삼각형(DP) #import sys #input = sys.stdin.readline r, c, w = map(int, input().split()) limit = r+w-1 dp = [[0]*limit for _ in range(limit)] for i in range(limit): for j in range(i+1): if j == 0 or j == i : dp[i][j] = 1 else: ...
MinsangKong/DailyProblem
07-14/1.py
1.py
py
504
python
en
code
0
github-code
13
6808406273
from __future__ import print_function import sys, os, re, arcpy, traceback from arcpy import env from arcpy.sa import * from safe_print import Safe_Print ######Created By Brian Mulcahy########## #Step 5 will create rasters based off the given stream's xs and stream vertices #If user corrected for backwater and was give...
bmulcahy/WSEL-Python-Tool
WSEL_Step_5.py
WSEL_Step_5.py
py
10,327
python
en
code
1
github-code
13
29728328005
""" Some solvers for simple linear systems. Last updated: 10.2.2019 """ import numpy as np import math import pandas as pd def gj_method(mat, augment_c): """A (procedural?) function for solving a linear system using the Gauss-Jordan method Contrary to the np.lingalg method arsenal, the input to this function...
trevormcinroe/mathematics
linear_systems.py
linear_systems.py
py
7,104
python
en
code
0
github-code
13
20533996775
from __future__ import annotations from gi.repository import GLib, Gio import turtlico.utils as utils from turtlico.locale import _ def compile(input_file: Gio.File, output_file_path: str) -> int: if input_file is None: utils.error(_('No input file specified')) return 1 output_file = Gio.F...
saytamkenorh/turtlico
turtlico/app/cli.py
cli.py
py
966
python
en
code
3
github-code
13
25306301567
import CheckProxy, getFreeProxy, setting import time class RegularlyCheck(object): def __init__(self): self.redis_clien = setting.redis_clien() # redis数据库对象 self.get_proxies = getFreeProxy.GetProxy() self.check_proxies = CheckProxy.CheckProxy() def regularlyGetProxy(self): # 当前数据库中的proxy小于指定要求的proxy数量时, 开...
luzehe/proxy_pool
proxy_pool/ProxyPool-1.0/proxy_pool/main.py
main.py
py
690
python
en
code
1
github-code
13
74098122579
import numpy as np A = np.array([[1,2],[-1,0],[2,1]]) B = np.array([[1,3],[2,1],[-3,-2]]) C = np.array([[2,5],[0,3],[4,2]]) print(2*A - 3*B + 2*C) A = np.array([[2, -1], [1, 0], [-3, 4]]) B = np.array([[1, -2, 5], [3, 4, 0]]) print(A.dot(B)) print(B.dot(A)) A = np.array([[1,2,3],[4,5,6],[7,8,9]]) B = A.T print(...
tranduythanh/learn-python
math-software/lab3b.py
lab3b.py
py
1,084
python
vi
code
0
github-code
13
41897328572
#Uses python3 import sys def acyclic(adj): visited=[] marked=[0]*len(adj) label=False for i in range(len(adj)): if i not in visited: marked[i]=1 label=explore(adj,i,visited,marked) if label: break marked[i]=0 if label: ...
Shaun10020/Algorithms-on-Graphs
Graph decomposition 2/CS curriculum/acyclicity.py
acyclicity.py
py
1,045
python
en
code
0
github-code
13
14121956759
from pyfda.libs.compat import (QWidget, pyqtSignal, QComboBox, QIcon, QSize, QPushButton, QHBoxLayout, QVBoxLayout) import numpy as np import scipy.signal as sig from scipy.signal import signaltools from scipy.special import sinc import pyfda.filterbroker as fb # importing filterbroker ...
chipmuenk/pyfda
pyfda/filter_widgets/firwin.py
firwin.py
py
23,890
python
en
code
601
github-code
13
17053241774
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.InsAgreementDTO import InsAgreementDTO from alipay.aop.api.domain.InsurePlanDTO import InsurePlanDTO class InsureRecommResultDTO(object): def __init__(self): self._ag...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/InsureRecommResultDTO.py
InsureRecommResultDTO.py
py
10,269
python
en
code
241
github-code
13
14645882675
from sqlalchemy import Boolean, Column, ForeignKey, Identity, Integer, String, Table from stripe_openapi.file import File from . import metadata IssuingDisputeCanceledEvidenceJson = Table( "issuing_dispute_canceled_evidencejson", metadata, Column( "additional_documentation", File, ...
offscale/stripe-sql
stripe_openapi/issuing_dispute_canceled_evidence.py
issuing_dispute_canceled_evidence.py
py
2,018
python
en
code
1
github-code
13
27308901555
import functools import click from clef.esgf import esgf_query from clef.helpers import load_vocabularies def tidy_facet_count(v): return v[::2] @functools.lru_cache() def get_esgf_facets(project): q = esgf_query(limit=0, project=project, type="Dataset", facets="*") q = {k: tidy_facet_count(v) for k, v...
coecms/clef
clef/cordex.py
cordex.py
py
3,147
python
en
code
7
github-code
13
11996856653
# -*- coding: utf-8 -*- # DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited. # This material is based upon work supported under Air Force Contract No. FA8702-15-D-0001. # Any opinions,findings, conclusions or recommendations expressed in this material are those # of the author(s) an...
informaticslab/SimAEN
Simaen-Model/src/generate_simaen_config.py
generate_simaen_config.py
py
2,881
python
en
code
2
github-code
13
27765020829
import requests import pandas as pd import time app_url = "http://localhost:5000" auth_route = "/login" upload_route = "/update/data" username = "user1" password = "password123" print(f"Logging into API now @ {app_url + auth_route}") # Authenticate and retrieve JWT token response = requests.post( app_url + auth...
bbartling/demand-response-research
old/posting_script/posting_script.py
posting_script.py
py
1,896
python
en
code
1
github-code
13
20386972028
import numpy as np import tensorflow as tf import os import matplotlib.pyplot as plt import cv2 as cv from tensorflow import keras from skimage.io import imread , imshow from skimage.transform import resize from tqdm import tqdm import random IMG_WIDTH = 128 IMG_HIGHT = 128 IMG_CHANNEL = 3 TRAIN_PATH = 'stage1_tra...
Onkarsus13/Cell-Detection
uCNN.py
uCNN.py
py
6,196
python
en
code
0
github-code
13
21680114405
import os import requests import zipfile import sqlite3 import pandas as pd import isbnlib from dotenv import load_dotenv from datetime import date load_dotenv() url = os.getenv("ISBN_URL") pwd = os.getenv("ISBN_PWD") def update_data(): """Downloads product list (zip)""" # Note: file contains only Kierrätys...
EskoJanatuinen/isbn_search
data_etl.py
data_etl.py
py
2,832
python
en
code
0
github-code
13
35517240284
from SLL import * class length_SLL(SLL) : ''' This class is inherited from SLL class. It will be used to add functionality of finding length of the linked list. ''' def getLength(self) : ''' Find the length of/ number of nodes in the linked list. Returns : cou...
paramSonawane/99Problems
Python/P04.py
P04.py
py
848
python
en
code
0
github-code
13
34672448476
#度和热度计算 import pandas as pd import networkx as nx date=list(range(201901,201913)) date+=list(range(202001,202013)) for day in date: data=pd.read_csv("./month/"+str(day)+".csv",low_memory=False) data=data[(data["org_continent"]=="EU")&(data["dst_continent"]=="EU")] G=nx.from_pandas_edgelist(data,"origin","d...
hinczhang/Graduate-Thesis
degreeAndHotness.py
degreeAndHotness.py
py
2,793
python
en
code
0
github-code
13
31405903363
from tkinter import filedialog from PIL import ImageTk, Image import cv2 import math as m import numpy as np import tkinter as tk import tkinter.ttk as ttk import os import sys root_path = os.path.abspath(os.path.join('..')) sys.path.append(root_path) import _init_paths import numpy as np import torch import torch....
lsc25846/Wildlife-Recognition-System
demo/GUI.py
GUI.py
py
7,720
python
en
code
1
github-code
13
2723167840
from django.urls import path from . import views # from django.conf import settings # from django.conf.urls.static import static # +static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) urlpatterns = [ # path for user path('usercreate', views.UserCreateAPI.as_view()), path('useralldata', views.Use...
vidhansharma026/Blog-API
BlogAPI/blog/urls.py
urls.py
py
1,386
python
en
code
0
github-code
13
13141023941
#!/usr/bin/env python """ LogicRLUtils.py The general utilities for LogicRL. """ __version__ = "0.0.1" __author__ = "David Qiu" __email__ = "dq@cs.cmu.edu" __website__ = "http://www.davidqiu.com/" __copyright__ = "Copyright (C) 2018, David Qiu. All rights reserved." import numpy as np import cv...
LogicRL/MontezumaRevenge
src/utils/LogicRLUtils.py
LogicRLUtils.py
py
1,473
python
en
code
2
github-code
13
4094002495
from django import template from post.models import Post,Comment,Notification register = template.Library() @register.inclusion_tag('post/show_notifications.html', takes_context=True) def show_notifications(context): request_user = context['request'].user unseen = Notification.objects.filter(to_user= request...
Dristy03/Programming-Community
account/templatetags/custom_tags.py
custom_tags.py
py
559
python
en
code
0
github-code
13
16654336100
from sklearn.linear_model import LinearRegression import numpy as np import pandas as pd import csv import sys sc_expression_data = sys.argv[1] human_tfs = sys.argv[2] test_data = pd.read_table(sc_expression_data, index_col=0) tfs = pd.read_table(human_tfs, index_col=0, names='TF') reg = LinearRegression() X = test_...
prullens/GRNi_Benchmarking
LinearRegression.py
LinearRegression.py
py
874
python
en
code
0
github-code
13
1076266449
# i have to build a faulty calculator which shows the correct result # for all the operations except some of the operation like # 45*3=555, 56+9=77,56/6=4 operator = input('enter the operator\n' '* for multiplication\n' '+ for addition\n' '/ for division\n' ...
manishkumarsahgopsaheb/faulty_calculator
main.py
main.py
py
895
python
en
code
0
github-code
13
326272827
import pandas as pd import csv import matplotlib.pyplot as plt import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.svm import SVC iris = datasets.load_iris() boston = datasets.load_boston() iris_features = iris.data iris_labels = iris.target print(iris) p...
santosh500/Deep-Learning-and-Python-Projects
Python Project 3/Source/Problem2.py
Problem2.py
py
2,172
python
en
code
0
github-code
13
16466746262
from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import WebDriverException import time import unittest MAX_WAIT = 10 class NewVisitorTest(LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox(...
kathryn-rowe/django_test_the_goat
similar_med_app/functional_tests/tests.py
tests.py
py
3,750
python
en
code
0
github-code
13
574406497
from flask import render_template,flash,redirect,url_for,current_app from app.main.forms import EditProfileForm,PostForm from app import db from app.main import bp from flask_login import current_user,login_required from app.models import User,Post from flask import request from datetime import datetime from werkzeug.u...
sileyouhe/microblog
app/main/routes.py
routes.py
py
6,169
python
en
code
0
github-code
13
1969322241
import json import matplotlib.pyplot as plt import numpy as np import pandas as pd from pathlib import Path from alibi_detect.cd import KSDrift from load_data import get_tables_from_folder, get_tables_from_path from datatypes import TableInfo, Distribution, TableDistribution from typing import List, Tuple, Callable f...
VadyusikhLTD/prjctr-ML-in-Prod
week6/src/univariate_update_frequency.py
univariate_update_frequency.py
py
6,681
python
en
code
0
github-code
13
29493256875
# -*- coding: utf-8 -*- # @Time : 2023/4/5 下午6:40 # @Author : Lingo # @File : trainer_conica.py import torch.nn.functional from torch import nn from transformers.trainer import * from transformers.trainer_utils import PredictionOutput from torch.utils.data import Dataset, DataLoader from typing import Optional, List, ...
DenglinGo/CONICA
utils/trainer_conica.py
trainer_conica.py
py
29,247
python
en
code
0
github-code
13
72308557139
import cv2 as cv import numpy as np #改变一些图像 def access_pixels(image): print(image.shape) #获取图片的高宽和通道数 height = image.shape[0] width = image.shape[1] channels = image.shape[2] print("width:%s,height:%s,channels:%s"%(width,height,channels)) for row in range(height): for ...
huangxinyu1/opencv-
opencv学习/02np数组操作.py
02np数组操作.py
py
1,860
python
en
code
0
github-code
13
8080719687
from __future__ import print_function, division import datetime import os import sys import torch.nn as nn import cv2 import numpy as np from scipy.misc import imread from utils import CFScore import torch from utils import helpers from torch.autograd import Variable import torch.nn.functional as F from torch.nn.modul...
wjx1198/MTSSN-WT
utils/utils.py
utils.py
py
9,772
python
en
code
0
github-code
13
29877308275
radius = int(2) pie = float(3.1459) diameter = 2 * radius circumference = 2 * pie * radius area = pie * (radius**2) print('Diameter is',diameter) print ("Circumference is", circumference) print ('Area is',area)
susannaholubiyi/Python
diameter.py
diameter.py
py
220
python
en
code
0
github-code
13
12045836170
import matplotlib.pyplot as plt import numpy as np # functions to show an image def imshow(img): img = img / 2 + 0.5 # unnormalize plt.imshow(np.transpose(img, (1, 2, 0))) def plot_dataset_images(train_loader, no_images): """ This will plot 'n' (no_images) images for g...
Paurnima-Chavan/cifar-s10
src/utils.py
utils.py
py
1,765
python
en
code
0
github-code
13