seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
26080546821
# Example 1: # here we are making a class class Student: pass # we are making an object from student class harry = Student() larry = Student() # we can make instance variable of an object like this harry.name = "Harry" harry.std = 12 harry.section = 1 larry.std = 9 larry.subjects = ["hindi", "physics"] print(har...
roman-ojha/python
Notes/Main/OOP/02_Class_and_Object/02_Creating_Our_Class.py
02_Creating_Our_Class.py
py
3,134
python
en
code
2
github-code
6
27579511655
import os import shutil import torch def make_dirs(args, opts, mode="train"): splits , features = '', '' if args.video_sets == 'videos': splits += 'new_' if args.input_feature == '2d': features += 'new_' splits += 'splits' features += 'features' train_list = os.path.join(opts....
t-koba-96/skill-assessment
src/util.py
util.py
py
3,287
python
en
code
0
github-code
6
21386838378
# -*- coding: utf-8 -*- import datetime from functools import partial import ipyvuetify as v from traitlets import ( Unicode, observe, directional_link, List, Int, Bool, Any, link ) from sepal_ui.sepalwidgets.sepalwidget import SepalWidget, TYPES from sepal_ui.frontend.styles import sepal_darker class...
dfguerrerom/restoration_viewer
component/widget/custom_widgets.py
custom_widgets.py
py
4,906
python
en
code
0
github-code
6
29584086251
# -*- coding: utf-8 -*- import unicodedata from datetime import datetime, timedelta from html2text import html2text from openerp import models, api, fields from openerp.exceptions import Warning class AvancysNotification(models.Model): _name = 'avancys.notification' user_id = fields.Many2one('res.users', 'Us...
odoopruebasmp/Odoo_08
v8_llevatelo/avancys_notification/avancys_notification.py
avancys_notification.py
py
11,966
python
en
code
0
github-code
6
35764996048
import os # import urllib.request # from types import SimpleNamespace # from urllib.error import HTTPError import random import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd # import tabulate import torch import torch.nn as nn import torch.nn.functional as F import torch...
tianyao-aka/Expresive_K_hop_GNNs
QM9/func_util_V2.py
func_util_V2.py
py
6,416
python
en
code
2
github-code
6
71811415868
#!/usr/bin/env python # -*- coding:utf-8 -*- """code_info @Time : 2020 2020/7/13 15:53 @Author : Blanc @File : selenium_test.py """ from selenium import webdriver browser = webdriver.Chrome() browser.get('https://space.bilibili.com/1') name=browser.find_element_by_id('h-name') print(name.text) brow...
Flynn-Lu/PythonCode
2020python实训/Day11/selenium_test.py
selenium_test.py
py
331
python
en
code
0
github-code
6
5722675237
import os import struct from lxml import etree import datetime # | Character | Byte order | Size | Alignment | # | --------- | ---------------------- | -------- | --------- | # | @ | native | native | native | # | = | native | standard | none ...
HappyKimoto/BinaryToXml
bintoxml.py
bintoxml.py
py
7,191
python
en
code
0
github-code
6
35684957719
# Given the head of a LinkedList and two positions ‘p’ and ‘q’, reverse the LinkedList from position ‘p’ to ‘q’. class Node: def __init__(self, v, n=None): self.value = v self.next = n def print_ll(self): while self is not None: print(self.value) self = self.next...
hitesh-goel/ds-algo
grokking-tci/6_reverse_ll/reverse_sub_ll.py
reverse_sub_ll.py
py
1,144
python
en
code
0
github-code
6
11726198344
import sys import codecs import os import numpy as np import torch from torch.autograd import Variable from .constants import MAX_CHAR_LENGTH, NUM_CHAR_PAD, PAD_CHAR, PAD_POS, PAD_TYPE, ROOT_CHAR, ROOT_POS, ROOT_TYPE, END_CHAR, END_POS, END_TYPE, _START_VOCAB, ROOT, PAD_ID_WORD, PAD_ID_CHAR, PAD_ID_TAG, DIGIT_RE from...
ganeshjawahar/ELMoLex
dat/nlm_data.py
nlm_data.py
py
8,163
python
en
code
12
github-code
6
4488441296
""" """ import argparse import copy import functools import itertools # import operator import os from pathlib import Path import re import galsim import joblib import metadetect import ngmix import numpy as np import pyarrow as pa import pyarrow.compute as pc import pyarrow.dataset as ds import pyarrow.parquet as pq...
LSSTDESC/chromatic-shear-bias
chromatic_shear_bias/generators/stars.py
stars.py
py
2,290
python
en
code
4
github-code
6
36712615798
from .mail import on_warning_last_data_upd import threading from datetime import datetime class SensorDataSignals: def __init__(self): self.date = datetime.now() self.timer = threading.Timer(10, on_warning_last_data_upd(datetime.now())) def time_warning(self, sender, **kwargs): if sel...
novelsk/AtlasDjango
app/atlas/signals.py
signals.py
py
513
python
en
code
0
github-code
6
31106755329
''' Given a binary tree t and an integer s, determine whether there is a root to leaf path in t such that the sum of vertex values equals s. Example For t = { "value": 4, "left": { "value": 1, "left": { "value": -2, "left": null, "right": { ...
JorG96/DataStructures
hasPathWithGivenSum.py
hasPathWithGivenSum.py
py
1,521
python
en
code
0
github-code
6
43140645221
"""``atomicmass`` - Return the atomic mass of an atom or molecule. This is really just a wrapper for `periodictable <https://periodictable.readthedocs.io/en/latest/index.html>`_ but returns the mass as an `astropy quantity <http://docs.astropy.org/en/stable/units/index.html>`_. """ import periodictable as pt import as...
mburger-stsci/nexoclom
nexoclom/atomicdata/atomicmass.py
atomicmass.py
py
1,498
python
en
code
0
github-code
6
2223517855
from math import cos, sin, radians class Day12(): def __init__(self, input, target): instructions = input.strip() self.instructions = [[x[0], int(x[1:])] for x in instructions.split('\n')] self.direction = [1, 0] self.location = [0, 0] self.wayp...
thekakkun/coding_challenges
advent_of_code/2020/day_12.py
day_12.py
py
4,925
python
en
code
0
github-code
6
27959312759
import torch # Define Net class TestNet(torch.nn.Module): def __init__(self): super(TestNet, self).__init__() def forward(self, x1, x2): y1 = torch.add(x1, 10) y2 = torch.add(x2, 5) y3 = torch.add(y1, y2) y4 = torch.add(y3, 10) return y4 def sample1(): x1...
SAITPublic/PimAiCompiler
examples/runtime/python/ir_net/simple_add.py
simple_add.py
py
805
python
en
code
2
github-code
6
33016130821
from flask import Flask, flash, json, request, redirect, Response, url_for from flask_cors import CORS app = Flask(__name__) app.config['SESSION_TYPE'] = 'filesystem' app.config.from_envvar('APP_SETTINGS') CORS(app) @app.route('/ping', methods=['GET']) def ping(): response = app.response_class( response...
aaronjenkins/flask-api-template
api.py
api.py
py
478
python
en
code
0
github-code
6
7074303331
#Note: 1)The detection works only on grayscale images. So it is important to convert the color image to grayscale. # 2) detectMultiScale function is used to detect the faces. # It takes 3 arguments — the input image, scaleFactor and minNeighbours. scaleFactor specifies how much the image size is reduced with each scale...
amanpanditap/Python_Projects
facedetection/facedetection-image.py
facedetection-image.py
py
3,295
python
en
code
3
github-code
6
9781885238
from egzP2atesty import runtests def partition(tab,p,r,indeksy): x=tab[indeksy[r]][1] i=p-1 for j in range(p,r): if tab[indeksy[j]][1]>=x: i+=1 tab[indeksy[i]],tab[indeksy[j]]=tab[indeksy[j]],tab[indeksy[i]] tab[indeksy[i+1]],tab[indeksy[r]]=tab[indeksy[r]],tab[indeksy[i...
wiksat/AlghorithmsAndDataStructures
ASD/BitAlgo-Summer/egzP2a/egzP2a.py
egzP2a.py
py
1,169
python
pl
code
0
github-code
6
23386753962
from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.status import HTTP_404_NOT_FOUND from scraper.models import PartsDetails from scraper.serializers import PartsDetailsSerializer # Create your views here. @api_view(['GET']) def company_parts(request, form...
spsree4u/urparts_scraper
scraper/views.py
views.py
py
1,537
python
en
code
0
github-code
6
37009080740
import os import pathlib import requests from flask import Flask, session, abort, redirect, request, render_template, make_response from google.oauth2 import id_token from google_auth_oauthlib.flow import Flow from pip._vendor import cachecontrol import google.auth.transport.requests from static.py.chat import socket...
SeanDaBlack/checkmasters
app.py
app.py
py
8,145
python
en
code
0
github-code
6
86625733247
#! /usr/bin/env python import os import sys import time import numpy as np from multiprocess import Pool sys.path.append(os.path.join(os.environ['REPO_DIR'], 'utilities')) from utilities2015 import * from metadata import * from data_manager import * from learning_utilities import * #################################...
mistycheney/MouseBrainAtlas
deprecated/learning/apply_classifiers_v4.py
apply_classifiers_v4.py
py
2,806
python
en
code
3
github-code
6
71862936509
MEM_SIZE = 100 reg = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'sp': 0, 'acc': 0, 'pc': 0, 'ivec': 0, 'int': 0, 'timer': 0, 'halt': False} memory = [0] * MEM_SIZE # move the values def mov(opr): reg[opr[0]] = reg[opr[1]] reg['pc'] = reg['pc'] + 1 # memory list include lists one by one > reg di...
LearnCsWithDIR/Create-Virtual-Machine
vm-1.py
vm-1.py
py
1,479
python
en
code
1
github-code
6
43634206373
# pylint: disable=no-self-use,invalid-name,no-value-for-parameter from __future__ import division from __future__ import absolute_import import torch from allennlp.common.testing.model_test_case import ModelTestCase from allennlp.nn.decoding.chu_liu_edmonds import decode_mst class BiaffineDependencyParserTest(Mode...
plasticityai/magnitude
pymagnitude/third_party/allennlp/tests/models/biaffine_dependency_parser_test.py
biaffine_dependency_parser_test.py
py
3,576
python
en
code
1,607
github-code
6
21884431887
"""Simulate a number of large CHIME populations.""" from frbpoppy import CosmicPopulation, lognormal, Survey from frbpoppy import SurveyPopulation, pprint N_SRCS = [3e4, 3.5e4, 4e4] N_DAYS = 100 RATE = [8, 9, 10] # per day # Chime started in Aug 2018. Assuming 2/day for one-offs. # Total of 9 repeaters published on 9...
TRASAL/frbpoppy
tests/chime/sim_runs.py
sim_runs.py
py
1,794
python
en
code
26
github-code
6
15634510217
''' height = raw_input('pls input your height(cm)') weight = raw_input('pls input your weight(kg)') height = float(height)/100 w = float(w) bmi = w/h**2 print(bmi) if bmi > 30: print('you are heavy') elif 30 >= bmi > 18: print('you are healthy') else: print('you are thin') ''' username = raw_input('pls type...
greatlqp/python_lesson
test_0308_2.py
test_0308_2.py
py
604
python
en
code
0
github-code
6
37158488723
import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt from datetime import datetime eboladata=pd.read_csv('datavis/ebola.csv') filtered = eboladata[eboladata['value']>0] filtereddata = filtered[filtered['Indicator'].str.contains('death')] Guineadata = filtereddata[filtereddata['Coun...
QiliWu/Python-datavis
datavis/ebola comfirmed death.py
ebola comfirmed death.py
py
1,578
python
en
code
2
github-code
6
8372223063
import os from unittest.mock import patch, Mock, PropertyMock import pytest from m1l0_services.imagebuilder.v1.imagebuilder_service_pb2 import BuildRequest, BuildConfig from builder.core.imagebuilder import ImageBuilder @patch("shutil.rmtree") def test_cleanup_code_path(mock_shutil): mock_shutil.return_value = M...
m1l0ai/m1l0_image_builder
tests/test_imagebuilder.py
test_imagebuilder.py
py
3,538
python
en
code
0
github-code
6
6246496296
from urllib.request import urlretrieve import os def get_dataset_file(url, savepath): if not os.path.exists(savepath): os.mkdir(os.path.dirname(savepath)) urlretrieve(url, savepath) if __name__ == "__main__": url = "http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-...
cheesecat47/ML_DL_Jan2020
get_dataset.py
get_dataset.py
py
424
python
en
code
0
github-code
6
12309608299
from setuptools import find_packages, setup import os version = "0.0.1" readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() req_file = os.path.join(os.path.dirname(__file__), 'requirements.txt') requirements = [i.strip() for i in open(req_file).readlines()] setup_params = dict( name="pye...
mclovinxie/dialect-pyexcel
setup.py
setup.py
py
1,222
python
en
code
3
github-code
6
69809838269
import tkinter import tkinter.messagebox import customtkinter import requests import webbrowser from PIL import Image, ImageTk import spotify customtkinter.set_appearance_mode("system") # Modes: "System" (standard), "Dark", "Light" customtkinter.set_default_color_theme("green") # Themes: "blue" (standard), "green", ...
algebrabender/Spotify-API-Project
gui.py
gui.py
py
7,464
python
en
code
0
github-code
6
19334470717
#!/usr/bin/python3 file0 = open('index0','r') file = open('index','r') indexs = file.read().split() index0s = file0.read().split() for index0 in index0s: if not index0 in indexs: indexs.append(index0) for index in indexs: print(index)
zhangfeiyang/finance-tmp
update_index.py
update_index.py
py
255
python
en
code
0
github-code
6
8879382170
# -*- coding: utf-8 -*- import unittest import sys sys.path.append('../src/') import mac_tran_dao as dao class TestSearchWordFromChunk(unittest.TestCase): def test_chunk_srch_en(self): dao.delete_word_tbl() en_input = "human" jp_input = u"人間" #need the u prefix to declare utf-8 dao.insert_wo...
iku000888/Machine-Translation-JP-EN
tests/chunk_search_test.py
chunk_search_test.py
py
2,164
python
en
code
0
github-code
6
37342054211
import pyaml from github import Github import requests import datetime import time def open_json(fileUrl): import json import requests if fileUrl[0:4] == "http": # es URL try: pointer = requests.get(fileUrl) return json.loads(pointer.content.decode('utf-8')) ...
smart-data-models/data-models
utils/10_model.yaml_v13.py
10_model.yaml_v13.py
py
15,076
python
en
code
94
github-code
6
23448354960
import socket from socket import AF_INET6, SOCK_STREAM from threading import Thread localIPv6 = "fe80::c10c:de5e:2cbf:132c%9" globalIPv6 = "2001:14ba:a0bd:dd00:c10c:de5e:2cbf:132c" # Remember to Disable firewall for clients in other networks to be able to connect to the server portIPv6 = 36000 buffer = 102...
SpringNuance/chat_application_command-line-version
client_IPv6.py
client_IPv6.py
py
1,436
python
en
code
1
github-code
6
39165330944
# # @lc app=leetcode.cn id=20 lang=python3 # # [20] 有效的括号 # # @lc code=start class Solution: # 插入左括号,判断右括号 def isValid(self, s: str) -> bool: sLen = len(s) if sLen % 2 !=0: return False stack = list() rightMap = { ')': '(', '}': '{', ']': '[', } ...
cl6222877/leetcode_gogo
20.有效的括号.py
20.有效的括号.py
py
635
python
en
code
0
github-code
6
4510504745
from tkinter import * import tkinter as tk import sqlite3 import sys print("Imported") con = sqlite3.connect("project.db") print("Connected") root = tk.Tk() v = tk.IntVar() v1 = tk.IntVar() v2 = tk.IntVar() v3 = tk.IntVar() def createtable(): create = ("CREATE TABLE IF NOT EXISTS vehicle(NAME VARCHAR(200),"+ ...
karankhat/Vehicle_Rental_Agency
python.py
python.py
py
14,870
python
en
code
0
github-code
6
20899251668
from utilities import * def main(): # Sampling print("Sampling the room...") frames = sample_noise() name, _ = write_noise("sample.wav", frames) new_frames = create_noise(name) name,_ = write_noise("whitenoise.wav", new_frames) player = WavePlayerLoop("whitenoise.wav",True) player.pl...
mx60s/tamuhack2019
main.py
main.py
py
944
python
en
code
2
github-code
6
24447759905
from cloudify import ctx from cloudify.decorators import operation from cloudify.state import ctx_parameters as inputs @operation def set_floating_ip_on_port(**_): """ Use this operation when connecting a host to a floating IP. This operation will set the `public_ip` runtime property on the host instance ...
Cloudify-PS/manager-of-managers
plugins/cmom/cmom/misc/ip.py
ip.py
py
3,018
python
en
code
1
github-code
6
25632521939
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = 'CwT' from queue import Queue, Empty import logging import traceback from selenium.common.exceptions import TimeoutException from . import Global logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class Scheduler(object): def __init_...
futurelighthouse/crawler_sqlmap
crawler/util/scheduler.py
scheduler.py
py
2,516
python
en
code
null
github-code
6
9439114675
import shutil import os import random import argparse import sys from xml.dom import minidom import traceback parser = argparse.ArgumentParser(description="Choose a random number of individual files from a data repository") parser.add_argument("-fs", "--files", help="Set the path to the directory with the XML files", ...
fusion-jena/QuestionsMetadataBiodiv
data_repositories/random_file_selector.py
random_file_selector.py
py
3,800
python
en
code
4
github-code
6
42287839856
import argparse import os.path import glob from snakePipes import __version__ def ListGenomes(): """ Return a list of all genome yaml files (sans the .yaml suffix) """ dName = os.path.dirname(__file__) genomes = [os.path.basename(f)[:-5] for f in glob.glob(os.path.join(dName, "shared/organisms/*.y...
maxplanck-ie/snakepipes
snakePipes/parserCommon.py
parserCommon.py
py
12,233
python
en
code
355
github-code
6
29579806350
# -*- coding: utf-8 -*- """ Created on Fri Dec 7 12:41:01 2018 @author: Akitaka """ # 1:ライブラリのインポート-------------------------------- import numpy as np #numpyという行列などを扱うライブラリを利用 import pandas as pd #pandasというデータ分析ライブラリを利用 import matplotlib.pyplot as plt #プロット用のライブラリを利用 from sklearn import cross_validation, ...
nakanishi-akitaka/python2018_backup
1207/ml25.py
ml25.py
py
1,632
python
ja
code
5
github-code
6
27857361755
# Nombre: Diccionario.py # Ovjetivo: Muestra el funcuinamiento de los diccionario # Autor: Rafael Ochoa # Fecha: 02/07/2019 lista = [] materias = {"Algoritmos": "100", "Inteligencia Artificial": "69", "Base de Datos": "100"} lista.append(materias) print(lista)
Rafa8a/Automatas2
Diccionario.py
Diccionario.py
py
287
python
es
code
0
github-code
6
21353904775
from functools import lru_cache class Solution: def ladderLength(self, beginWord: str, endWord: str, wordList: [str]) -> int: wordList.append(beginWord) wordList = list(set(wordList)) s_len = len(beginWord) n = len(wordList) wd_ids = [i for i in range(n)] w...
Alex-Beng/ojs
FuckLeetcode/127. 单词接龙.py
127. 单词接龙.py
py
1,603
python
en
code
0
github-code
6
73573190267
import pymysql from dbutils.pooled_db import PooledDB class MysqlPool: config = { 'creator': pymysql, 'host': "127.0.0.1", 'port': 3306, 'user': "tron", 'password': "123456", 'db': "vecrv_sun_airdrop_claimed", 'charset': 'utf8', 'maxconnections': 70,...
dpneko/pyutil
mysql_client.py
mysql_client.py
py
5,065
python
zh
code
0
github-code
6
36562104917
import sys from scipy.sparse import csr_matrix import numpy import re from collections import Counter number = '[0-9]+' isNumber = re.compile(number) FREQ_THRESH = 5 def normalize_word(word): if isNumber.search(word): return '---$$$---' else: return word def trim_vocab(vocab): ...
mfaruqui/vector-semantics
src/nn/process_parallel_data.py
process_parallel_data.py
py
3,788
python
en
code
5
github-code
6
34181193922
# -*- coding: utf-8 -*- """ Created on Fri May 8 14:11:28 2020 @author: Kollarlab """ from Instruments.HDAWG import HDAWG from Instruments.SGS import RFgen import numpy import time import sys import scipy import pylab import scipy.optimize from mplcursors import cursor as datacursor import threading from userfuncs...
MRitter95/Kollar-Lab
Old_scripts_delete_20220804/Control/DataFigureExample.py
DataFigureExample.py
py
8,375
python
en
code
2
github-code
6
24532771859
import os raw_img_src = "../../Data/Input_Data/raw_img_data/" section_ids = ["r1","r2","r3","r4"] img_type = "xpl" for i in range(10): for j in range(10): if j != 0: print(j) break break
JonasLewe/thesis_codebase
Code/testing/merged_img_generator.py
merged_img_generator.py
py
245
python
en
code
0
github-code
6
19855461730
import tkinter as tk class TabFrameTemplate(tk.Frame): def __init__(self,parent): self.parent = parent super().__init__(self.parent) self["width"] = 1000 self["height"] = 500 self["bg"] = "green" self.canvas = tk.Canvas(self,bg="#F3BFB3",width=800,height=500) ...
wrrayos/InventoryCustodianSlip
templates/tabFrameTemplate.py
tabFrameTemplate.py
py
1,656
python
en
code
0
github-code
6
39045297717
import copy import coordinates as cor import ctypes import os import Email_Sender_Machine as esm import PyGameSource as pgs import TreeCalc as tc import pygame, sys import math os.system('cls') PI = math.pi pygame.init() os.system('cls') windowSize = pygame.display.get_desktop_sizes() print(windowSize) window = p...
Matin-Modarresi/connect-four
connect four/connect_four.py
connect_four.py
py
3,851
python
en
code
0
github-code
6
15896435397
""" RED NEURONAL CONVOLUCIONAL, Dataset con fotos de Humanos y Caballos """ import tensorflow as tf from keras.preprocessing.image import ImageDataGenerator # Genera las imagenes # Preprocesado # Rescala las imagenes del Train train_datagen = ImageDataGenerator(rescale = 1./255, ...
karlosmir/ML-Projects
ML/RNC01.py
RNC01.py
py
2,915
python
es
code
0
github-code
6
4369691360
import pandas as pd import numpy as np import tensorflow as tf import tensorflow_text as text import pickle import argparse from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.models import load_model from sklearn.metrics imp...
chennychenchen99/AutoScorer
models/trained_model_files/calculate_test_performance.py
calculate_test_performance.py
py
2,875
python
en
code
0
github-code
6
8273446218
from django.http import HttpResponse from django.core.cache import cache from custom_cache_page.utils import hash_key class TestCache: def test_cache_page(self, request_factory, mock_cached_view): request = request_factory.get('/bo') mock_cached_view(request) cached_response = cache.get(ha...
kishan-character/django-custom-cache-page
tests/test_cache.py
test_cache.py
py
510
python
en
code
null
github-code
6
32400182580
#!/usr/bin/env python # coding=utf-8 import pylirc class Buttons: # 初始化,这里的app需要和调用它的文件名称一致,conf需要和之前实验中irexec地址一致,"/etc/lirc/irexec.conf" def __init__(self, app, conf): if not pylirc.init(app, conf, 1): raise Exception("Unable to init pylirc") # 阻塞模式关闭 pylirc.blocking(0) ...
chronosmaker/RPiRadio
Buttons.py
Buttons.py
py
623
python
en
code
0
github-code
6
11769609560
#Lets check anagrams. """ Anagram is a word, phrase or name formed by rearranging the letters of another word. Like spar from rasp """ def anagram(st1:str, st2:str) ->bool: st_len = len(st1) tru = [] for f in st1: if f in st2: tru.append(True) else: tru.append(Fals...
Kamalabot/Programmers57Challenges
exe24_anagram.py
exe24_anagram.py
py
719
python
en
code
1
github-code
6
10220457455
from typing import List from nazurin.models import Illust, Image, Ugoira from nazurin.utils import Request from nazurin.utils.decorators import network_retry from nazurin.utils.exceptions import NazurinError from nazurin.utils.logging import logger from .base import BaseAPI class SyndicationAPI(BaseAPI): """Pub...
y-young/nazurin
nazurin/sites/twitter/api/syndication.py
syndication.py
py
2,028
python
en
code
239
github-code
6
14512503096
psw = input('Введите пароль: ') #запрос ввода пароля msg = 'Ваш пароль состоит только из цифр' # задаем "по-умолчанию" значение сообщения, которое будет выводиться после ввода пароля psw_len = len(psw) #вычисление длинны пароля try: result_1 = 2/psw_len # проверка пустого пароля result_2 = int(psw) # проверка ...
zarubb/ps-pb-psw_vrf
app.py
app.py
py
958
python
ru
code
0
github-code
6
27022192120
import cv2 import numpy as np kernel = np.ones((5,5),np.uint8) # Take input from webcam cap = cv2.VideoCapture(0) while True: ret, frame = cap.read() #Guassian blur to reduce noise frame = cv2.GaussianBlur(frame,(5,5),0) #bgr to hsv hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) ...
ashwin876/Ball_Tracking_Python
Green_ball_Tracking.py
Green_ball_Tracking.py
py
2,342
python
en
code
0
github-code
6
14560619174
import os from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from astropy.time import Time from astropy.coordinates import solar_system_ephemeris # , EarthLocation from astropy.coordinates import get_body_barycentric solar_system_ephemeris.set('de432s') def get_planet...
caron14/swingby_challenge
planet_position.py
planet_position.py
py
3,877
python
en
code
0
github-code
6
39270259657
import datetime as dt import re import time import requests import html5lib from bs4 import BeautifulSoup import googleapiclient.discovery import google.auth def get_calendar_html(year, month): CALURL = "https://syllabus.naist.jp/schedules/preview_monthly" text = requests.get(f"{CALURL}/{str(year)}/{str(mont...
Masahiro-Kobayashi-NAIST/NAIST-Class-to-Google-Calander
naist-calendar.py
naist-calendar.py
py
4,663
python
en
code
0
github-code
6
30217414474
import matplotlib.pyplot as plt plt.plot([1,2,3],[4,5,4], color = '#21c4ed', linestyle='dashed', marker='o') # erste Liste die X-Werte, zweite Liste Y-Werte # color via HEX - Farbe finden über color picker (google) # allgemeine Infos = https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot #linestyle = http...
ThePeziBear/MyPythonLibrary
Visualizing_Python/Matplotlib/1_General_Matplotlib_settings.py
1_General_Matplotlib_settings.py
py
4,912
python
de
code
0
github-code
6
32543172289
import aioredis import pytest from aiorate_limiter import RateLimiterOpts from aiorate_limiter.storage.redis import RedisRateLimiter, REDIS_SCRIPT_HASH @pytest.fixture async def redis(): redis = await aioredis.create_redis("redis://localhost:6379") yield redis redis.close() await redis.wait_closed(...
theruziev/aiorate_limiter
tests/storages/test_redis_rl.py
test_redis_rl.py
py
1,623
python
en
code
2
github-code
6
7002248991
from ...flaskapp.utils.db_utils import conn from ...common.constants import CURRENT_TERM from ...flaskapp.utils.utils import previous_term from ..utils import student_utils as student def transcript_is_outdated(user_id): cur.execute("""SELECT term_year, term_month FROM students_completed_courses scc ...
minupalaniappan/gradfire
daviscoursesearch/flaskapp/service/user.py
user.py
py
1,113
python
en
code
12
github-code
6
40677398663
from magma.configuration_controller.request_consumer.request_db_consumer import ( RequestDBConsumer, ) from magma.db_service.config import TestConfig from magma.db_service.models import ( DBCbsd, DBCbsdState, DBRequest, DBRequestType, ) from magma.db_service.session_manager import Session from magma...
magma/magma
dp/cloud/python/magma/configuration_controller/tests/unit/test_request_consumer.py
test_request_consumer.py
py
3,787
python
en
code
1,605
github-code
6
15598827362
import torch from torch import nn from torch.nn import init # L2 Norm: solve "feature map" scale inconsistent class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None self.eps = 1e-10 ...
AceCoooool/detection-pytorch
ssd/utils_ssd/L2Norm.py
L2Norm.py
py
752
python
en
code
24
github-code
6
9781742668
INF=float('inf') G = [[0, 3, INF, 5], [2, 0, INF, 4], [INF, 1, 0, INF], [INF, INF, 2, 0]] nV = 4 distance = list(map(lambda i: list(map(lambda j: j, i)), G)) print(distance) for k in range(nV): for i in range(nV): for j in range(nV): distance[i][j] = min(di...
wiksat/AlghorithmsAndDataStructures
ASD/BeforeExam/egzamin_2_szablony/Floyd-Warshall.py
Floyd-Warshall.py
py
622
python
en
code
0
github-code
6
17035760804
# グラフのパス (paizaランク C 相当) # https://paiza.jp/works/mondai/graph_dfs_problems/graph_dfs__path_one_step3 INPUT1 = """\ 3 1 2 """ OUTPUT1 = """\ 1 2 3 """ INPUT2 = """\ 5 5 3 """ OUTPUT2 = """\ 5 4 3 2 """ def main(input_str): # n: 頂点数, s: 起点, k: 回数 n, s, k = map(int, input_str.split()) # 隣接リスト ad_list ...
atsushi0919/paiza_workbook
graph_dfs_problems/01-03_path_one_step3.py
01-03_path_one_step3.py
py
997
python
ja
code
0
github-code
6
5479410467
import itertools from copy import deepcopy from random import shuffle from .type_utils import is_seq_of def concat_seq(in_list, dtype): assert dtype in [list, tuple] return dtype(itertools.chain(*in_list)) def concat_list(in_list): return concat_seq(in_list, list) def concat_tuple(in_list): return...
haosulab/ManiSkill2-Learn
maniskill2_learn/utils/data/seq_utils.py
seq_utils.py
py
2,031
python
en
code
53
github-code
6
27937206338
import re from .Enums import SelectionMode from .Exceptions import SelectionReuseException from . import Database __author__ = 'Riley Flynn (nint8835)' class DatabaseSelection: """ Represents a selection of items from a JSON DB. Can have items retrieved from it, or can be modified. Upon modification...
nint8835/NintbotForDiscord
libraries/JSONDB/Selection.py
Selection.py
py
4,508
python
en
code
1
github-code
6
39122705161
from flask import* from database import DB,CR teacher=Blueprint("teacher",__name__) @teacher.route("/") def TeacherHome(): return render_template("teacherhome.html") @teacher.route("/answerquestion",methods=["post","get"]) def AnswerQuestion(): CR.execute("SELECT * FROM sdatabase") qanda=CR.fetchall() ...
ShanoliaJoseph/flask
teacher.py
teacher.py
py
1,145
python
en
code
0
github-code
6
21056363812
import torch import torchvision from torchvision import models import torchvision.transforms as transforms from torchvision.transforms import ToPILImage import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import matplotlib.pyplot as plt import numpy as np import time from func...
modusV/Machine-Learning-Homeworks
HW3/main.py
main.py
py
9,042
python
en
code
0
github-code
6
71484026108
import sys import heapq if sys.version[0] == '2': range, input = xrange, raw_input MAX_SPEED = 30 dvs = (-1, 0, 1) while True: N, M = map(int, input().split()) if not (N | M): break S, G = map(lambda x: int(x) - 1, input().split()) edge = [[] for _ in range(N)] for _ in range(M): ...
knuu/competitive-programming
aoj/11/aoj1162.py
aoj1162.py
py
1,221
python
en
code
1
github-code
6
15447622348
import pyglet class Tower: def __init__(self, pos): super().__init__() self.pos = pos class TownHall(Tower): def __init__(self, pos): super().__init__(pos) self.image = pyglet.image.load('./Assets/town hall.png') self.image.anchor_x = self.image.width // 2 sel...
dungcatcher/siege
towers.py
towers.py
py
543
python
en
code
0
github-code
6
32285228189
#!/usr/bin/env python from inv_memo import * bin_file = './memo' context(os = 'linux', arch = 'amd64') # context.log_level = 'debug' #========== env = Environment('debug', 'local', 'remote') env.set_item('mode', debug = 'DEBUG', local = 'PROC', remote = 'SOCKET') env.set_item('target', debug = {'argv':[bin_fil...
shift-crops/CTFProblemArchive
2019/CODE BLUE CTF/InvisibleMemo/exploit/exploit_memo_probably_4096.py
exploit_memo_probably_4096.py
py
1,692
python
en
code
1
github-code
6
30754540175
for _ in range(int(input())): n = int(input()) candles = list(map(int, input().split(' '))) candles = sorted(candles, reverse=True) if len(candles) == 1: if candles[0] > 1: print('NO') else: print('YES') else: if candles[0] > candles[1] + 1: ...
Tanguyvans/Codeforces
780/B.py
B.py
py
376
python
en
code
0
github-code
6
20921242416
import networkx as nx from graph_manager.graph_tools import clusters_dict2clusters_list from graph_manager.plot_tools import * def louvain(G, resolution=1, eps=0.001): clusters_dict = maximize(G, resolution, eps) n = len(clusters_dict) k = len(set(clusters_dict.values())) while k < n: H = aggr...
sharpenb/Multi-Scale-Modularity-Graph-Clustering
Scripts/clustering_algorithms/louvain.py
louvain.py
py
2,921
python
en
code
2
github-code
6
71780099388
from django.contrib.auth.models import AbstractUser from django.core.validators import RegexValidator from django.db import models class User(AbstractUser): '''Модель пользователя''' email = models.EmailField( verbose_name='Электронная почта', max_length=254, unique=True, db_i...
GirzhuNikolay/foodgram-project-react
backend/users/models.py
models.py
py
1,353
python
en
code
0
github-code
6
32724523948
import tornado.ioloop import tornado.web import hashlib import uuid import json from time import mktime from datetime import datetime from email.utils import formatdate up_user = '' up_password = '' up_method = 'PUT' up_host = 'v1.api.upyun.com' up_path = '/bucket/' up_base_url = "http://bucket.b0.upaiyun.com/%s" ...
zhicheng/storage
main.py
main.py
py
1,410
python
en
code
1
github-code
6
13925195329
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 18 17:27:59 2018 @author: du This is neural network configuration file """ num_epoch = 1000 batch_size = 32 milestones = [2] max_len = 40 hidden_size2 = 50 # hidden size for image feature hidden_size = 50 # hidden size for superimpoed text fea...
yuhaodu/TwitterMeme
step2_MemeClassifier/.ipynb_checkpoints/classifier_utils-checkpoint.py
classifier_utils-checkpoint.py
py
573
python
en
code
6
github-code
6
42029059098
import torch import time import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision from torchvision import transforms import os from Network import FullyConvNet from Network import train from PIL import Image import numpy as np import argparse import cv2 from ser...
qLethon/bin_picking_robot
main.py
main.py
py
8,023
python
en
code
0
github-code
6
30071759044
import pandas as pd from tensorflow import keras import os import numpy as np from sklearn.preprocessing import MinMaxScaler class AbundanceGenerator(keras.utils.Sequence): def __init__(self, abundance_file,species,batch_size=32, shuffle=True,to_fit=True): 'Initialization' self.abundance_file=abund...
uclchem/Chemulator
src/abundancegenerator.py
abundancegenerator.py
py
1,233
python
en
code
6
github-code
6
20031000434
import sys from PIL import Image Image.MAX_IMAGE_PIXELS = 1000000000 image = Image.open("WAC_TIO2_COMBINED_MAP.png") width, height = image.size print("width",width,end=" ") print("height",height,end=" ") aspect_ratio = width/height print("aspect_ratio",aspect_ratio) if aspect_ratio == 2: print("aspect ratio alre...
Sven-J-Steinert/DLR_Paper_2023
maps/preparation/TiO2/old/02_place_in_global.py
02_place_in_global.py
py
1,072
python
en
code
0
github-code
6
26042346056
from __future__ import annotations from dataclasses import dataclass from typing import Any from pants.bsp.spec.base import BuildTargetIdentifier # ----------------------------------------------------------------------------------------------- # Compile Request # See https://build-server-protocol.github.io/docs/spec...
pantsbuild/pants
src/python/pants/bsp/spec/compile.py
compile.py
py
4,430
python
en
code
2,896
github-code
6
2772686666
'''有K种不同的玫瑰花,现在要摆放在N个位置上,要求每种颜色的花至少出现过一次,请问有多少种不同的方案数呢?,因为答案可能很大,你只需要输出它对772235取余后的结果. 输入描述: 输入只有1行,分别有两个整数N,K( 1 <= N <= 50000 , 1 <= K <= 30 ) 输出描述: 输出一行表示答案 输入例子1: 3 2 输出例子1: 6 ''' def fun(k,n): ### K 种花 无限取 求出取出总共为n种花的分布情况 res = [0] t = math.factorial(n+k)%772235 help(k,0,n,res,t) return res[0...
queryor/algorithms
gatherAlgorithms/玫瑰花.py
玫瑰花.py
py
1,573
python
zh
code
0
github-code
6
8915987730
#Faça um programa que leia dois números inteiros e informe se estes são iguais ou diferentes #Solcitando os numeros ao user e salvando nas variaveis correspondentes n1 = int(input("Digite o primeiro número ")) n2 = int(input("Digite o segundo número ")) #Veririficando se os valores são iguals e informando ao usuário ...
lucasnasc46/curso-python22
Desafaio 1/questao2.py
questao2.py
py
422
python
pt
code
0
github-code
6
19705741714
# https://www.beecrowd.com.br/judge/pt/problems/view/1173?origem=1 lista = list(range(10)) entrada = 51 while entrada > 50: entrada = int(input()) lista[0] = entrada print(f"N[0] = {lista[0]}") for i in range(1, 10): lista[i] = lista[i - 1] * 2 print(f"N[{i}] = {lista[i]}")
caioopra/URI-Beecrowd
1173.py
1173.py
py
291
python
pt
code
0
github-code
6
72774182909
class Solution(object): # brute force def minDistanceBrute(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ if len(word1)==0: return len(word2) if len(word2)==0: return len(word1) if word1[0]==word2...
V-nsh/DSA
leetcode/leetcode75/DP_mult/72_edit_distance.py
72_edit_distance.py
py
2,597
python
en
code
1
github-code
6
72908363068
# -*- coding: utf-8 -*- from odoo import models, fields, api, _ from dateutil.relativedelta import relativedelta from odoo.exceptions import ValidationError, UserError from datetime import datetime, timedelta from odoo.http import request class OpAdmissionRegisterCustom(models.Model): _inherit = "op.admi...
mrrtmob/odoo_acac
local-addon/pm_admission/models/pm_admission.py
pm_admission.py
py
30,867
python
en
code
0
github-code
6
27920291546
import os import time import numpy as np import pandas as pd import logging import shutil from pathlib import Path from deep_squeeze.disk_storing import calculate_compression_ratio def repeat_n_times(n): """ A decorator that repeats a decorated function (in our case the compression pipeline) n times and retu...
MikeXydas/DeepSqueeze
deep_squeeze/experiment.py
experiment.py
py
5,487
python
en
code
10
github-code
6
40176552944
import os import sys import cv2 import PIL import pprint import pytesseract import time SRC_DIR = os.path.dirname(os.path.realpath(__file__)) sys.path.append(SRC_DIR) #print(sys.path) import fetch import display import filter page_seg_mode = 11 # Parse sparse text def group_names(data): d2 = dict2list(data) n...
JohnMcAninley/beer-goggles
goggles/extract.py
extract.py
py
6,035
python
en
code
0
github-code
6
16414819917
from sklearn import cross_validation f = open("Pubmed-Diabetes/data/Pubmed-Diabetes.DIRECTED.cites.tab") m = open("Pubmed-Diabetes/data/Pubmed-diabetes.NODE.paper.tab") #define the dataset dataList = [] # dataList[i] = [paper_id + class_label + word_attributed + [citing paper + cited paper]] #construct the data from ...
randywhisper/DataAnalyst_py583
code/structed_Pub.py
structed_Pub.py
py
1,727
python
en
code
2
github-code
6
26804210661
inside_edges = [] edge_to_pen = {} num_pens = int(input()) for pen_idx in range(num_pens): data = [int(data) for data in input().split()] num_edges = data[0] corners = data[1: num_edges + 1] edges = [tuple(sorted([corners[idx], corners[(idx + 1) % num_edges]])) for idx in range(num_edges)...
Stevan-Zhuang/DMOJ
CCC/CCC '10 S4 - Animal Farm.py
CCC '10 S4 - Animal Farm.py
py
1,289
python
en
code
1
github-code
6
72509864189
from flask import ( Blueprint, render_template, request, redirect, session, flash, url_for, abort, ) from .models import * from flask_mail import Message from flask_login import current_user, login_required from sqlalchemy.exc import SQLAlchemyError from Hispanist_flask import mail from Hisp...
vecherninanika/Hispanist_Flask
Hispanist_flask/my_app/pages.py
pages.py
py
3,473
python
en
code
0
github-code
6
18476191196
import tornado.httpserver import tornado.ioloop import tornado.web import json import webapp import RF24module import time import database global radioNodi global dbn class GetListaNodiSettingHandler(tornado.web.RequestHandler): def get(self): #*************************************** #**********...
salviador/LightHub
raspberry/app/AggiungiNodi.py
AggiungiNodi.py
py
5,476
python
it
code
0
github-code
6
11506766967
# брой правоъгълни маси # дължина на масите # ширина на масите # размер на покривки = дължина + ширина на масите + 120 # карета = дължина на маса / 2 # долар = 1.85 tables_all = int(input()) tables_length = float(input()) tables_width = float(input()) covers = tables_all * (tables_length + 2 * 0.30) * (tab...
PIvanov94/SoftUni-Software-Engineering
PB-Python April 2020 Part 2/Tailoring Workshop.py
Tailoring Workshop.py
py
752
python
bg
code
0
github-code
6
40696903853
import argparse import logging import sys def create_parser(): parser = argparse.ArgumentParser( "Get magma managed configs for the specified service. (mconfig)", ) parser.add_argument( "-s", "--service", required=True, help="Magma service name", ) parser.add_argume...
magma/magma
orc8r/gateway/python/scripts/magma_get_config.py
magma_get_config.py
py
1,967
python
en
code
1,605
github-code
6
6701340278
import cv2 import numpy as np import imgaug.augmenters as iaa import imgaug as ia import torchvision from torchvision import transforms from PIL import Image, ImageEnhance, ImageOps from RandAugment.augmentations import Lighting, RandAugment class ResizeImage(object): def __init__(self, height=256, width=256): ...
toandaominh1997/ProductDetectionShopee
datasets/augment.py
augment.py
py
8,295
python
en
code
0
github-code
6
75131969148
# -*- coding: utf-8 -*- """https://blog.csdn.net/zwq912318834/article/details/79870432""" import scrapy from selenium import webdriver import time from scrapy import signals # scrapy 信号相关库 from pydispatch import dispatcher # scrapy最新采用的方案 class LoginBlibliSpider(scrapy.Spider): name = 'login_bl...
hahahei957/NewProject_Opencv2
use_of_selenium/use_of_selenium/spiders/login_blibli.py
login_blibli.py
py
1,782
python
en
code
0
github-code
6
18244671014
from os import path, mkdir, listdir import configparser import utils def default_config(config): """Put here the content of the default configuration file""" config['vosk'] = {'project_name': 'vosk', 'model_name': '', 'models_url': 'https://alphacephei.com/vosk/mode...
cg-Kdaf/Zacharias
src/private_data.py
private_data.py
py
4,247
python
en
code
0
github-code
6
18049656660
#! /usr/bin/env python3 # pyre-strict import os from common_tests import CommonTestDriver from test_case import TestCase class HierarchyTests(TestCase[CommonTestDriver]): @classmethod def get_template_repo(cls) -> str: return "hphp/hack/test/integration/data/hierarchy" def test_inheritance(self...
WeilerWebServices/Facebook
hhvm/hphp/hack/test/integration/hierarchy_tests.py
hierarchy_tests.py
py
4,662
python
en
code
3
github-code
6