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
29752329020
# days to seconds, hours to minutes # to repr an interval of time,create timedelta instance like this from datetime import timedelta a = timedelta(days=2, hours=6) b = timedelta(hours=4.5) c = a + b print(c.days) print(c.seconds) print(c.seconds / 3600) print(c.total_seconds() / 3600) from datetime import datetime ...
pranavchandran/redtheme_v13b
chapter_2_strings_and_text/days_to_seconds/days_to_seconds_other.py
days_to_seconds_other.py
py
1,950
python
en
code
0
github-code
36
7773371889
import random import time from pathlib import Path from typing import Any import numpy as np from midi.decode import get_array_of_notes from midi.encode import get_file_from_standard_features from models.music_model import MusicModel, ProgressCallback, ProgressMetadata class MarkovChain(MusicModel): n_gram_size...
piotrowskv/music_generation
models/models/markov_chain/markov_chain.py
markov_chain.py
py
6,790
python
en
code
0
github-code
36
473540501
#!/usr/bin/env python import musescore_parser as mp import sys from fractions import Fraction from dataclasses import dataclass, field from typing import Optional import re #https://github.com/OpenLilyPondFonts/lilyjazz/blob/master/JazzSampler.pdf @dataclass class Base: def __post_init__(self): print("%...
duhovniprojekt/duhovne_pjesme_novi_sad_1966
scripts/new/lilypond_generator.py
lilypond_generator.py
py
27,495
python
en
code
0
github-code
36
3843330309
import numpy import numpy as np import pandas as pd import pygad import tlsh import json from tools import featurer import sys import csv import tensorflow as tf from tensorflow import keras from keras import layers import filenames_modified as filenames MALWAREIDX = int(sys.argv[1]) BATCH_SIZE = 10 # print(MALWAREID...
ZsZs88/Poisoning
genetic_modified.py
genetic_modified.py
py
7,404
python
en
code
0
github-code
36
35865754669
""" no longer needed since pointnet2_ssg_cls can provide this form """ import torch import torch.nn as nn import torch.nn.functional as F import sys,os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(os.path.dirname(BASE_DIR)) sys.path.append(ROOT_DIR) sys.path.append(os.path.join(ROO...
PointCloudYC/PointNet-modern.pytorch
models/pointnet2/pointnet2_msg_cls.py
pointnet2_msg_cls.py
py
1,339
python
en
code
3
github-code
36
15871926331
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import os def read_image(image): return mpimg.imread(image) def format_image(image): return tf.image.resize(image[tf.newaxis, ...], [224, 224]) / 255.0 def get_category(img): """Write a Function...
FourthBrain/Intro-to-Flask
inference.py
inference.py
py
1,815
python
en
code
1
github-code
36
31628499109
import traceback import sys from discord.ext import commands import discord class ErrorHandler(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_command_error(self, ctx, error): if hasattr(ctx.command, 'on_error'): return igno...
docgonzo2015/Botler-discord-bot
cogs/errors.py
errors.py
py
1,104
python
en
code
0
github-code
36
3204081333
# -*- coding: utf-8 -*- """ Created on Mon Apr 1 21:36:27 2019 @author: Rodrigo """ import csv import sqlite3 e = csv.writer(open('output.csv', 'w')) e.writerow(['cpf','UC']) conn = sqlite3.connect('enel.db') cursor = conn.cursor() # lendo os dados cursor.execute(""" SELECT * FROM enel; """) f...
rasiqueira/enel
bd.py
bd.py
py
409
python
en
code
0
github-code
36
36568920733
from django.urls import path, re_path from . import views app_name = 'adminapp' urlpatterns = [ path('', views.login, name='login'), path('category/add/', views.add_category, name='add_category'), path('article/add/', views.add_post), path('article/list/', views.post_list), path('category/list/', v...
MicroPyramid/ngo-cms
admin/urls.py
urls.py
py
2,514
python
en
code
8
github-code
36
9993622660
import json from django.core.management import call_command from django.core.management.base import BaseCommand from people.models import Person, Address class Command(BaseCommand): help = 'Loads sample data into the database' def handle(self, *args, **options): # Clear the database call_comm...
finlay422/challenge_project
people/management/commands/load_sample_data.py
load_sample_data.py
py
734
python
en
code
0
github-code
36
37635088720
# Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. # Example 1: # Input: n = 13 # Output: 6 # Example 2: # Input: n = 0 # Output: 0 # Constraints: # 0 <= n <= 2 * 109 class Solution: def countDigitOne(self, n: int) -> int: strn =...
sunnyyeti/Leetcode-solutions
233 Number of Digit One.py
233 Number of Digit One.py
py
1,146
python
zh
code
0
github-code
36
35648526405
from src.knowledge_graph import KGEntity, KGProperty from .kgqa_dataset import KGQADataSet from .kgqa_data import KGQAData from typing import List import logging import json class Mintaka(KGQADataSet): def load(self, path: str) -> List[KGQAData]: datasets: List[KGQAData] = [] with open(path, enco...
bumsikki/KAPPR
src/dataset/mintaka.py
mintaka.py
py
1,837
python
en
code
null
github-code
36
22565135811
#coding:utf-8 from weixin import WXAPPAPI api = WXAPPAPI(appid=APP_ID, app_secret=APP_SECRET) session_info = api.exchange_code_for_session_key(code=code) # ่Žทๅ–session_info ๅŽ session_key = session_info.get('session_key') crypt = WXBizDataCrypt(WXAPP_APPID, session_key) # encrypted_data ๅŒ…ๆ‹ฌๆ•ๆ„Ÿๆ•ฐๆฎๅœจๅ†…็š„ๅฎŒๆ•ด็”จๆˆท...
sun5411/myPython
python-weixin-master/my_test.py
my_test.py
py
485
python
zh
code
0
github-code
36
7182820045
#!/usr/bin/env python3 """A denselayer dense block in tensorflow keras""" import tensorflow.keras as K def dense_block(X, nb_filters, growth_rate, layers): """A dense block, X is the previous layer, nb_filters is the number of filters to use, growth rate is the rate to change the number of filters by, and...
JohnCook17/holbertonschool-machine_learning
supervised_learning/0x08-deep_cnns/5-dense_block.py
5-dense_block.py
py
1,357
python
en
code
3
github-code
36
27040895007
import argparse import auxil.mydata as mydata import auxil.mymetrics as mymetrics import gc import tensorflow as tf import keras.backend as K from keras.callbacks import ModelCheckpoint from keras.models import load_model from keras.losses import categorical_crossentropy from keras.layers import * from keras.models imp...
deeplearning2020/comparison
algorithms/proposed.py
proposed.py
py
7,971
python
en
code
0
github-code
36
8445188718
import operator import cupy from cupy._core import internal from cupy._core._scalar import get_typename from cupyx.scipy.sparse import csr_matrix import numpy as np TYPES = ['double', 'thrust::complex<double>'] INT_TYPES = ['int', 'long long'] INTERVAL_KERNEL = r''' #include <cupy/complex.cuh> extern "C" { __glob...
cupy/cupy
cupyx/scipy/interpolate/_bspline.py
_bspline.py
py
29,962
python
en
code
7,341
github-code
36
23108069207
from flask import Flask, app from flask_login import LoginManager from flask_sqlalchemy import SQLAlchemy # init SQLAlchemy so we can use it later in our models db = SQLAlchemy() def create_app(): application = Flask(__name__) application.config['SECRET_KEY'] = '9OLWxND4o83j4K4iuopO' application.config['...
peastuti/sb-admin-2-flask-login
project/__init__.py
__init__.py
py
946
python
en
code
1
github-code
36
13962486159
from django.db import IntegrityError from django.utils.timezone import make_aware from datetime import datetime import logging from .utils import get_extras class DatabaseHandler(logging.Handler): """ A log handler to store logs into the database. Currently, only log entries that belong to an event ar...
helfertool/helfertool
src/toollog/handlers.py
handlers.py
py
2,156
python
en
code
52
github-code
36
1859807791
""" Support module for PyWikipediaBot regression tests. """ __version__ = '$Id: 7895f03ac2688d7155e5e94da60e51af65ee9b11 $' import sys # Add current directory and parent directory to module search path. sys.path.insert(0, '..') sys.path.insert(0, '.') del sys
SirComputer1/SCBot
tests/test_utils.py
test_utils.py
py
263
python
en
code
1
github-code
36
22331304969
from rubrix.server.apis.v0.models.commons.model import BulkResponse from rubrix.server.apis.v0.models.text2text import ( Text2TextBulkRequest, Text2TextRecordInputs, Text2TextSearchResults, ) def test_search_records(mocked_client): dataset = "test_search_records" delete_dataset(dataset, mocked_cli...
Skumarh89/rubrix
tests/server/text2text/test_api.py
test_api.py
py
4,194
python
en
code
null
github-code
36
2490959644
import IECore import IECoreScene import Gaffer import GafferScene import GafferImage # Add standard cycles AOVs with IECore.IgnoredExceptions( ImportError ) : # If cycles isn't available for any reason, this will fail # and we won't add any unnecessary output definitions. import GafferCycles lightPasses = [ ...
boberfly/GafferCycles
startup/gui/outputs.py
outputs.py
py
3,815
python
en
code
81
github-code
36
17884750945
import pprint import threading from typing import Dict, TYPE_CHECKING from PySide2.QtWidgets import QTabWidget, QTextBrowser, QWidget from lib.comm import get_var, set_var from widgets import PMTableView, PMGTableWidget, PMDockObject, PMGTableViewer, PMGJsonTree if TYPE_CHECKING: from lib.extensions.extensionlib....
pyminer/pyminer
pyminer/packages/workspace_inspector/data_viewer.py
data_viewer.py
py
8,746
python
en
code
77
github-code
36
2286169944
""" Created on Sat Sep 25 00:00:00 2018 @author: Nikhil """ """ If you have any questions or suggestions regarding this script, feel free to contact me via nikhil.ss4795@gmail.com """ # Polynomial Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd #...
Nikhil4795/Polynomial_Linear_Regression
Polynomial_regression_2/polynomial_regression.py
polynomial_regression.py
py
1,854
python
en
code
0
github-code
36
26987164949
import datetime from django import forms from django.core.exceptions import ValidationError from .models import TimeLog, Subject, Tag class DateForm(forms.Form): def __init__(self, *args, **kwargs): self.min_date = kwargs.pop('min_date') self.max_date = kwargs.pop('max_date') # if user h...
mf210/WAYD
timing/forms.py
forms.py
py
5,996
python
en
code
3
github-code
36
23701537076
import argparse import os import shutil import numpy as np import torch import torchvision from torch import nn as nn from torch.utils.tensorboard import SummaryWriter from torch.utils.data import Dataset, DataLoader from tqdm import tqdm import helpers from dcgan import generators, discriminators from dcgan.train_con...
dfridman1/GANs
dcgan/train.py
train.py
py
7,028
python
en
code
0
github-code
36
5515862018
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os from vgg import load_pretrained_VGG16_pool5 import cifar10_utils import tensorflow as tf import numpy as np LEARNING_RATE_DEFAULT = 1e-4 BATCH_SIZE_DEFAULT = 128 MAX_STEPS_DEFAULT = 1...
frhrdr/dlc2016
practical_3/retrain_vgg.py
retrain_vgg.py
py
10,700
python
en
code
1
github-code
36
74491447145
import time import json import datetime invalid = "\n--Invalid response, please try again.--" scheduleFile = "schedule.json" assignmentFile = "assignment.json" def load(): for i in range(0, 40): time.sleep(0.00000000000001) print("-", end='', flush=True) print() def unload(): for i in ran...
BenVN123/PythonScheduler
scheduler.py
scheduler.py
py
8,943
python
en
code
1
github-code
36
1417017554
import csv # import csv library '''This code takes a file input and header input the function utilises those inputs to open the file then checks the header the header is added to a dictionary called unique_list and stores the count of the header it then gets printed''' # a function that takes the file and header and c...
Kaizuu08/PythonShowcase2023Semester1
Week 8/csv_dictreader.py
csv_dictreader.py
py
1,178
python
en
code
0
github-code
36
8460276839
from time import sleep from appium import webdriver from appium.webdriver.common.mobileby import MobileBy from appium.webdriver.extensions.android.gsm import GsmCallActions from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWait class TestBrowser(): de...
yyw15910852287/hogwarts_appium
ไบคไบ’api/test_jiaohu.py
test_jiaohu.py
py
1,876
python
zh
code
0
github-code
36
33920201413
from math import ceil type_sushi = input() name_restaurant = input() number_portions = int(input()) delivery = input() is_invalid_restaurant = False price = 1 if name_restaurant == "Sushi Zone": if type_sushi == "sashimi": price = 4.99 elif type_sushi == "maki": price = 5.29 elif type_sushi...
IvayloSavov/Programming-basics
sample_exam/3..py
3..py
py
1,549
python
en
code
0
github-code
36
14195362149
#!/usr/bin/python3 """ Unittest for review module """ import os import unittest from models.review import Review from models.base_model import BaseModel from models.engine.file_storage import FileStorage class Test_Review(unittest.TestCase): """ Test for Review Class """ m = Review() def setUp(self)...
Drixner/holbertonschool-AirBnB_clone
tests/test_models/test_review.py
test_review.py
py
1,509
python
en
code
4
github-code
36
14597675926
from sys import stdin ways = [[0 for length in range(1001)] for n in range(1001)] ways[0][0] = 1 for n in range(1001): for length in range(1, 1001): ways[n][length] += 2 * ways[n - 1][length - 1] if n >= 2: ways[n][length] += ways[n - 2][length - 1] if n >= 3: ways[...
vfolunin/archives-solutions
UVa Online Judge/10198.py
10198.py
py
440
python
en
code
0
github-code
36
14566552628
from django.contrib.auth.models import User from django.db import models import cover.models from documents.models import (Book, Chunk, Image, BookPublishRecord, ImagePublishRecord) from documents.signals import post_publish from dvcs.signals import post_publishable def book_changed(sender, instance, created,...
fnp/redakcja
src/documents/models/listeners.py
listeners.py
py
1,794
python
en
code
4
github-code
36
25969368475
""" Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value. Example 1: Input: [1,12,-5,-6,50,3], k = 4 Output: 12.75 Explanation: Maximum average is (12-5-6+50)/4 = 51/4 = 12.75 Note: 1 <= k <= n <= 30...
wqh872081365/leetcode
Python/643_Maximum_Average_Subarray_I.py
643_Maximum_Average_Subarray_I.py
py
884
python
en
code
0
github-code
36
5921271913
# -*- coding: utf-8 -*- """ Created on Fri Aug 30 18:57:26 2019 @author: Mico """ import pandas as pd import os import numpy as np def enconde_string_category(df,df_clean,mapping,col_name): column_data = pd.factorize(df[col_name].str.lower()) mapping[col_name] = column_data[1].tolist() df_clean[col_name]...
larosi/hackathon-enaex-2019
0_Data_cleansing.py
0_Data_cleansing.py
py
2,522
python
en
code
0
github-code
36
34846072669
#!/usr/bin/env python # coding: utf-8 # refer to https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/ # # to tune parameters # refer to http://yangguang2009.github.io/2017/01/08/deeplearning/grid-search-hyperparameters-for-deep-learning/ # In[1]: from __future__ import print_functio...
dxcv/TradingAlgo
Multi-LSTM/LSTMsinKeras-VirtualCurrency-Simple.py
LSTMsinKeras-VirtualCurrency-Simple.py
py
7,561
python
en
code
0
github-code
36
41895099219
class Item: def __init__(self, name, price, quantity=0): # this method is like constructor in java.this method is executed automatically when an instance is created # by making quantity = 0 that means giving a default value when u don't the value currently # so if quantity is not p...
Harjith001/python_files
OOPs/p2.py
p2.py
py
1,576
python
en
code
0
github-code
36
40497969641
from PRISMRenderingShaders.CustomShader import CustomShader """PlaneIntersectingShader Class containing the code for the Plane intersecting shader. :param CustomShader: Parent class containing the function to access the parameters of the shader. :type CustomShader: class. """ class PlaneIntersectingShader(CustomSh...
andrey-titov/SlicerPRISMRendering
PRISMRendering/PRISMRenderingShaders/PlaneIntersectingShader.py
PlaneIntersectingShader.py
py
2,384
python
en
code
null
github-code
36
39974821125
# USAGE # python align_faces.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/example_01.jpg # import the necessary packages from imutils.face_utils import FaceAligner from imutils.face_utils import rect_to_bb import argparse import imutils import dlib import cv2 # construct the argument par...
juanluisrosaramos/dataset_tuning
align_faces.py
align_faces.py
py
1,729
python
en
code
1
github-code
36
4778253189
import os import tempfile import pytest import warnings import numpy as np import onnxruntime as ort import torch from torch import nn as nn from typing import Optional, Union, Tuple, List import transformer_engine.pytorch as te from transformer_engine.common import recipe import transformer_engine_extensions as tex fr...
NVIDIA/TransformerEngine
tests/pytorch/test_onnx_export.py
test_onnx_export.py
py
55,538
python
en
code
1,056
github-code
36
21756414147
while 1: try: numbers = input() data = [int(i) for i in input().split()] #create variable max_by_far = data[0] min_by_far = data[0] max_location = 0 min_location = 0 current_index = 1 # now data is a map object , but also iterable ...
nikita-sunyata/codeforces
144A/144A.py
144A.py
py
1,655
python
en
code
0
github-code
36
42854245545
#!/usr/bin/env python3 import tkinter as tk root = tk.Tk() root.geometry("400x480") root.resizable(width=False, height=False) root.title("Calculator") def btn1(): val1 = valVar.get()+'1' notOk = True while notOk: if val1[0] == '0' and val1[1] == '.': notOk = False elif val1[0] == '0' and val1[1] != '.': ...
cezarnegru/Calculator_python
main.py
main.py
py
7,162
python
en
code
0
github-code
36
11476729859
"""AD&D Second Edition Combat Simulator""" # Always prefer setuptools over distutils from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encoding='u...
gene1wood/adnd2e-combat-simulator
setup.py
setup.py
py
1,409
python
en
code
2
github-code
36
14091966619
quiz = { "stimulus":"Answer the following algebra questions:", "stem":"If x = 8, then what is the value of 4(x+3)?", "choices":["1.35","2.36","3.40","4.44"], "right choice": 4, } while True: print(quiz["stimulus"]) print(quiz["stem"]) print(*quiz["choices"],sep='\n') answer = input("Your...
VuThiThuyB/vuthithuy-fundamental-c4e22
session4/hw/serious3.py
serious3.py
py
516
python
en
code
0
github-code
36
15868980621
from collections import deque import sys dx = [1,-1,0,0] dy = [0,0,-1,1] def iswall(x,y): if x<0 or y<0 : return False if x >= n or y >= m : return False if matrix[x][y] == 0 : # ๋ฐฉ๋ฌธํ•œ ๊ฒฝ์šฐ return False return True # ๊ทธ ์™ธ์˜ ๊ฒฝ์šฐ def bfs(x,y): queue = deque() print(queue) q...
HYEONAH-SONG/Algorithms
ํŒŒ์ด์ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ธํ„ฐ๋ทฐ/๋ฏธ๋กœํƒˆ์ถœ.py
๋ฏธ๋กœํƒˆ์ถœ.py
py
815
python
en
code
0
github-code
36
25625621383
class Classy: def __init__(self): pass def minSlidingWindow(self,s,t): ''' :param s: :param t: :return: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: ...
Akashdeepsingh1/project
2020/MinSlidingWindow.py
MinSlidingWindow.py
py
1,175
python
en
code
0
github-code
36
38449435175
#!/usr/bin/env python import rospy from std_msgs.msg import String from move_base_msgs.msg import MoveBaseGoal from move_base_msgs.msg import MoveBaseAction import re from Command import Command from Queue import Queue import actionlib from tf import transformations from geometry_msgs.msg import Quaternion from sound_p...
elmdecoste/ros_advanced_voice
scripts/speech_queue.py
speech_queue.py
py
2,950
python
en
code
0
github-code
36
4062917788
import pickle import random def main(): ## Analyze a bridge hand. bridgeHand = getHandOfCards(13) displayBridgeHand(bridgeHand) analyzeBridgeHand(bridgeHand) def getHandOfCards(numberOfCards): deckOfCards = pickle.load(open("deckOfCardsList.dat", 'rb')) return random.sample(deckOfCards, number...
guoweifeng216/python
python_design/pythonprogram_design/Ch6/6-PP-3.py
6-PP-3.py
py
783
python
en
code
0
github-code
36
39430112426
# # @lc app=leetcode.cn id=189 lang=python3 # # [189] ๆ—‹่ฝฌๆ•ฐ็ป„ # # @lc code=start class Solution: def rotate(self, nums: List[int], k: int) -> None: """ Do not return anything, modify nums in-place instead. """ def swap(l, r): while l < r: nums[l], nums[r] = ...
RoseCabbage/Leetcode_Solutions
Solutions/189.ๆ—‹่ฝฌๆ•ฐ็ป„.py
189.ๆ—‹่ฝฌๆ•ฐ็ป„.py
py
540
python
en
code
0
github-code
36
74512068263
import math def fun(a, first, last, key): if first > last: return -1 else: mid = math.floor((first+last)/2) if key == a[mid]: return mid elif key < a[mid]: return fun(a, first, mid-1, key) else: return fun(a, mid+1, last,...
heatherThida/Function-and-Compiler-Languages-comparison
mystery.py
mystery.py
py
633
python
en
code
0
github-code
36
26297680284
import random def rand_white(): num = random.randrange(0,3) if num == 0: return " " elif num == 1: return "\t" else: return "\n" amounts = 5 fil = "duplicate.txt" dup = True d_number = 19 if dup: amounts -= 2 lista = [] for i in range(amounts): num = random.ran...
hadi-ansari/TDP002
gamla_tentor_tdp002/2018_jan/uppgift5.py
uppgift5.py
py
825
python
en
code
0
github-code
36
27037909109
import torch from torch import nn from fuxictr.pytorch.models import MultiTaskModel from fuxictr.pytorch.layers import FeatureEmbedding, MLP_Block class SharedBottom(MultiTaskModel): def __init__(self, feature_map, model_id="SharedBottom", gpu=-1, ...
xue-pai/FuxiCTR
model_zoo/multitask/SharedBottom/src/SharedBottom.py
SharedBottom.py
py
3,155
python
en
code
671
github-code
36
1925887546
#!/bin/python import collections import os import re import subprocess import time GHOSTLY_PATH = '/usr/bin/ghostly' ALLIE_DBG = '../target/debug/allie' # Old versions ALLIE_1_1 = './bin/allie_v1.1' ALLIE_1_0 = './bin/allie_v1.0' ALLIE_0_9 = './bin/allie_v0.9' ALLIE_0_8 = './bin/allie_v0.8' ALLIE_0_7 = './bin/allie...
Kwarf/Allie-2017
benchmarker/bench.py
bench.py
py
2,332
python
en
code
0
github-code
36
25209486610
#!/usr/local/bin/python3 import socket import struct import crcmod #from dataservice.datawave_produce.waveproduce import sin_wave,triangle_wave import random def crccreate(b,length): crc16_func = crcmod.mkCrcFun(0x18005, initCrc=0xFFFF, rev=True, xorOut=0x0000) return crc16_func(b[0:length]) def crccheckhole(...
Scottars/nis_website
dataservice/epicsrelated/simulate2.py
simulate2.py
py
2,560
python
en
code
0
github-code
36
2111005207
import machine # Sensor is completly unreliable for me and showing extremely different values in same condition when trying to get the max and min values class MoistureSensor: """A class that can read set pins for a moisture sensor installed on Lopy4""" max_moisture_sensor_value = 1000 # From multiple manual ...
christoffergranstedt/lnu-iot-moisture-thing
lib/sensors/MoistureSensor.py
MoistureSensor.py
py
1,152
python
en
code
1
github-code
36
15469459200
pixel_data = open("D8-input.txt").read().strip() width = 25 height = 6 row_length = width * height layers = [[] for i in range(len(pixel_data) // row_length)] print("Number of layers: ", len(layers)) for l in range(len(layers) ): for pos in range(row_length): layers[l].append(pixel_data[l * row_length + ...
micheltosu/AdventOfPythonCode
2019/D8.py
D8.py
py
1,585
python
en
code
0
github-code
36
29772321096
import unittest import HtmlTestRunner from selenium import webdriver import time from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys class Lo...
degea78/Bitdefender
test-bitdef/testCases/testBitdef.py
testBitdef.py
py
2,917
python
en
code
0
github-code
36
73881080745
from flask import Flask, request import json from jwt.exceptions import JWTException from jwt.jwt import JWT from jwt.jwk import OctetJWK def login(app: Flask): @app.post("/api/auth/login") def test(): reqest_data = request.get_json() try: jwt = JWT() login = reqest_dat...
Axime/Aska2.0
server/routes/auth/login.py
login.py
py
1,121
python
en
code
0
github-code
36
35623428711
from django.urls import path from .views import * app_name = "Mentor" urlpatterns = [ path("", view=MentorListView.as_view(), name="listar y crear mentores"), path("user/", view=MentorByUserRUD.as_view(), name="traer mentor por id de usuario"), path("<int:pk>/", view=MentorRUDView.as_view(), name="Obtener,...
DiegoStevenVera/MentorTic
apps/mentor/urls.py
urls.py
py
554
python
es
code
0
github-code
36
36887287548
from flask import Flask, request from . import db app = Flask(__name__) @app.route("/api/message", methods=["GET"]) def get_random_message(): """Return a random message to play the part of 'message in a bottle'.""" return { "content": db.get_random_message() } @app.route("/api/message", methods=["POST"]) d...
mshenfield/swellnote
swellnote/__init__.py
__init__.py
py
584
python
en
code
1
github-code
36
15560736212
#!/usr/bin/env python3 # This is a simple script that takes in an scurve file produced by # csvcolumn_to_scurve and produces a png graph of the scurve. import argparse import csv import matplotlib.pyplot as plt import numpy as np FIELDS = ['N/total', 'New/Old'] def get_data(input_file): global FIELDS for...
apple/swift
utils/dev-scripts/scurve_printer.py
scurve_printer.py
py
2,875
python
en
code
64,554
github-code
36
39279840802
from astropy.io import fits from astropy.convolution import convolve, Box1DKernel import scipy as sp import matplotlib import matplotlib.pyplot as plt import glob ''' O 436 B 582 A 745 F 766 G 596 K 759 M 306 ''' ''' O 476, 8773, 9818 B 96, 378, 462, 489, 492 A 17, 114, 120, 136 F 52, 158 G 25, 27, 30, 85 K 61, 65 ...
grd349/LearningLAMOST
Matt/RegressorRF/Figures/plot_class.py
plot_class.py
py
1,790
python
en
code
1
github-code
36
12675528453
#!/usr/bin/python3 from tkinter import * from tkinter import messagebox from tkinter import simpledialog from decimal import * entries = [] class LoanCalculator: def __init__(self): self.window = Tk() # Create Window self.window.title("Loan Calculator") # Create Labels La...
ZimboPro/scripts
pythonScripts/homeloan/homeloan.py
homeloan.py
py
10,534
python
en
code
0
github-code
36
43156623065
#!/usr/bin/env python import unittest import mock from quadcopter_brain import QuadcopterBrain class TestQuadcopterBrain(unittest.TestCase): @mock.patch('landing_site.LandingSite') @mock.patch('quadcopter.Quadcopter') def setUp(self, quadcopter_mock, landing_site_mock): self.quadcopter_brain = ...
vpreston/mission_runner
quadcopter_brain/src/quadcopter_brain/test_quadcopter_brain.py
test_quadcopter_brain.py
py
6,854
python
en
code
0
github-code
36
24012640957
import random def random_network_creator(n): ''' Creates a random network for a given number of variables ''' # create a new network file file_name = "random_networks/demofile2.BIFXML" # can change output filename here f = open(file_name, "a") # write stock variables into file f.writelines([...
ORickL/KR-Bayesian-network
generating_networks.py
generating_networks.py
py
3,283
python
en
code
0
github-code
36
23563895086
from sys import argv from os.path import join from define import define from resources import ResourceTimestamp,resources_dirname from storage import StorageAccessor def upload(filename, filepath): storage.upload_resource(filename, filepath) timestamp_str = storage.get_resource_timestamp(filename) ...
kaktuswald/inf-notebook
resources_upload.py
resources_upload.py
py
1,554
python
en
code
4
github-code
36
35855718282
from __future__ import print_function import scrapy from scrapy.http.cookies import CookieJar from scrapy.spiders import CrawlSpider, Rule from scrapy.selector import Selector from scrapy.http import Request,FormRequest from mytest.items import myItem class mySpider(scrapy.Spider): name = "myspider" allowed_...
zhengwuyang/notes
Testcode/Scrapytest/mytest/spiders/my_spider.py
my_spider.py
py
2,289
python
en
code
0
github-code
36
34598487595
# IntesisHome Inegration with Domoticz # # Author: CV8R # """ <plugin key="BasePlug" name="IntesisBox WMP-1 Protocol" author="CV8R" version="0.0.9" > <description> <h2>IntesisBox WMP-1</h2><br/> <ul style="list-style-type:square"> <li>IntesisBox WMP-1 interface for air conditioners into IP based con...
luismalddonado/IntesishomewithDomoticz
plugin.py
plugin.py
py
18,692
python
en
code
3
github-code
36
18038169787
class MagicDictionary: def __init__(self): self.wordsdict = {} def buildDict(self, dictionary: List[str]) -> None: for word in dictionary: self.wordsdict[len(word)] = self.wordsdict.get(len(word),[]) + [word] def search(self, searchWord: str) -> bool: for candi in self...
LittleCrazyDog/LeetCode
676-implement-magic-dictionary/676-implement-magic-dictionary.py
676-implement-magic-dictionary.py
py
750
python
en
code
2
github-code
36
28987537714
import threading as td import RPi.GPIO as GPIO import datetime as dt import time from helpers import TimeMeasure import elemental_api_class as liveapi class StreamAvailController: def __init__(self, gpi_trigger, event_id, elemental_ip, lock_interval = 3, in_cue = False): self.gpi_trigger = gpi_trigg...
Hristiyan-Andreev/gpi_0.7_hw_reworked
s_av_ctrl.py
s_av_ctrl.py
py
4,401
python
en
code
2
github-code
36
10331225638
import json import requests class SSEStatsOnTime(object): """ http://www.sse.com.cn/services/hkexsc/home/ """ def __init__(self): self.url = 'http://yunhq.sse.com.cn:32041//v1/hkp/status/amount_status' self.headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x6...
wilsonkrum/DataFactory
hkland_flow/stock_hu_ontime.py
stock_hu_ontime.py
py
1,796
python
en
code
0
github-code
36
23480034500
from copy import deepcopy # 4 x 4 ํฌ๊ธฐ์˜ ์ •์‚ฌ๊ฐํ˜•์— ์กด์žฌํ•˜๋Š” ๊ฐ ๋ฌผ๊ณ ๊ธฐ์˜ ๋ฒˆํ˜ธ์™€ ๋ฐฉํ–ฅ ๊ฐ’์„ ๋‹ด๋Š” ํ…Œ์ด๋ธ” fish_array = [[None] * 4 for _ in range(4)] for i in range(4): fish = list(map(int, input().split())) # ๋งค ์ค„๋งˆ๋‹ค 4๋งˆ๋ฆฌ์˜ ๋ฌผ๊ณ ๊ธฐ๋ฅผ ํ•˜๋‚˜์”ฉ ํ™•์ธํ•˜๋ฉฐ for j in range(4): # ๊ฐ ์œ„์น˜๋งˆ๋‹ค [๋ฌผ๊ณ ๊ธฐ ๋ฒˆํ˜ธ, ๋ฐฉํ–ฅ]์„ ์ €์žฅ # ๋‹จ, ์ฃผ์–ด์ง€๋Š” ๋ฐฉํ–ฅ์€ 1๋ฒˆ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๊ธฐ ๋•Œ๋ฌธ์— 1์„ ๋นผ์คŒ f...
raddaslul/basic_algoritm
hikers/adolescent_shark.py
adolescent_shark.py
py
4,047
python
ko
code
0
github-code
36
71911570984
# Import tools and libraries import random from words import words import string # Import pre-dertermined list of uppercased characteres # Getting a valid word with only letters from our WORDS list def get_valid_word(words): word = random.choice(words) # Randomly chooses a word from the list while "-" in wo...
Luciano2712/game_hangman
run.py
run.py
py
2,360
python
en
code
0
github-code
36
40961448639
# coding: utf-8 import itertools import re from simpleai.search import (backtrack, CspProblem, LEAST_CONSTRAINING_VALUE, min_conflicts, MOST_CONSTRAINED_VARIABLE) largos = { '1H': 2, '2H': 3, '4H': 2, '5H': 2, '7H': 2, '8H': 2, '10H': 3, '11H': 2, '1V': 2, '2V': 2, '3V': 3, '4V': ...
ucse-ia/ucse_ia
practicas/crucigramas.py
crucigramas.py
py
5,727
python
en
code
5
github-code
36
10834212692
from turtle import Turtle STARTING_POSITION = (0, -280) MOVE_DISTANCE = 20 FINISH_LINE_Y = 280 class Player(Turtle): # create a turtle def __init__(self): super().__init__() self.shape('turtle') self.penup() self.shapesize(1) self.setheading(90) ...
joshrivera116/crossyRoad
player.py
player.py
py
532
python
en
code
0
github-code
36
34638872728
import requests from bs4 import BeautifulSoup """ https://www.youtube.com/watch?v=PzWIdcFY9YQ """ url = 'https://url.com/sitemap.xml' sitemapsoup = BeautifulSoup(requests.get(url).content, 'lxml') sitemapurls = sitemapsoup.find_all("loc") xml_urls = [sitemapurl.text for sitemapurl in sitemapurls] count = 0 cerr...
martamc-sp/PythonforSEO
lessons/4-urls-canonical.py
4-urls-canonical.py
py
824
python
en
code
0
github-code
36
39013711189
# https://www.acmicpc.net/problem/15649 # N๊ณผ M (1) def seq(idx): # idx๊ฐ€ M๋ผ๋ฉด arr ์ถœ๋ ฅ if idx == M: print(*arr) return for i in range(1, N+1): # ์ˆ˜์—ด์— ์‚ฌ์šฉํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด ์žฌ๊ท€ if not used[i]: # ๋ฐฐ์—ด์— i๊ฐ’์„ ๋„ฃ์Œ arr[idx] = i used[i] = 1 seq(idx+1) ...
eomsteve/algo_study
dm/3_week/15649.py
15649.py
py
463
python
ko
code
0
github-code
36
31802052529
# /usr/bin/python3.6 # -*- coding:utf-8 -*- def get(stack): result = stack.pop() if stack.__len__() == 0: print("result:"+str(result)) return result else: last = get(stack) stack.append(result) return last def reverse_stack(stack): if stack.__len__() == 0: ...
bobcaoge/my-code
python/face_programs/codes/03_usingrecursivefunctiontoreservestack.py
03_usingrecursivefunctiontoreservestack.py
py
544
python
en
code
0
github-code
36
11525663576
import sqlite3 con = sqlite3.connect('example.db') cursor = con.cursor() persons = [("kiran", 21, "kiran@gmail.com"), ("anu", 29, "anu@yahoo.com"), ("sathis", 65, "satish@rediff.com")] cursor.executemany("INSERT INTO person values (?, ?, ?)", persons) print(cursor.rowcount) con.commit() con.clo...
avinash431/IntroductionToPython
databases/database-3.py
database-3.py
py
325
python
en
code
0
github-code
36
4109037837
from sys import stdin input = stdin.readline nodes, n = [int(x) for x in input().split()] isEntrance = [1] * nodes isDest = [1] * nodes connections = [[] for _ in range(nodes)] for _ in range(n): a, b = [int(x) for x in input().split()] isEntrance[b] = 0 isDest[a] = 0 connections[a].append(b) q = [[]]...
AAZZAZRON/DMOJ-Solutions
tsoc15c2p4.py
tsoc15c2p4.py
py
862
python
en
code
1
github-code
36
33911980837
#!/usr/bin/env python3 import queries import connection_handler from IPython import embed import mysql.connector import grammar_format from dotenv import load_dotenv from managers.word_manager import Word_Manager import re load_dotenv() class Phrase_Manager: def __init__(self, phrase="None", person="None", pe...
aburk3/Brain
managers/phrase_manager.py
phrase_manager.py
py
6,593
python
en
code
1
github-code
36
41907946588
import torch import torch.nn as nn class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv_1 = self._con_dw_sep(3, 16) self.conv_2 = self._con_dw_sep(16, 32) self.conv_3 = self._con_dw_sep(32, 64) self.fc1 = nn.Linear(10816, 512) sel...
CSID-DGU/2022-2-SCS4031-EZ_SW
age_prediction_model/model.py
model.py
py
1,212
python
en
code
0
github-code
36
8525512026
import tensorflow as tf import os import sys import data_generation import networks import scipy.io as sio import param import util import truncated_vgg from keras.backend.tensorflow_backend import set_session from keras.optimizers import Adam import scipy.misc def train(model_name, gpu_id): with tf.Session() as ...
TZebin/Deep-Learning-Camp-JEJU2018
Code/posewarp-cvpr2018/code/posewarp_train.py
posewarp_train.py
py
4,468
python
en
code
0
github-code
36
410387277
"""gistandard URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
RobbieHan/gistandard
gistandard/urls.py
urls.py
py
4,296
python
en
code
546
github-code
36
35535578848
def fibonacci(n): x = [0, 1] if n in x: return n a, b = x for i in range(n-1): a, b = b, (a + b) % 10 return b n = int(input()) print(fibonacci(n))
calkikhunt/algorithmic-toolbox
fibonacci_last_digit.py
fibonacci_last_digit.py
py
184
python
en
code
0
github-code
36
18844787736
import sys,time,unittest from selenium.webdriver.common.by import By from selenium import webdriver sys.path.append(".//") sys.path.append(sys.path[0].split("ATQ้กน็›ฎ")[0] + 'ATQ้กน็›ฎ\\02.ๆ–นๆณ•ๆจกๅ—') import Function_temp as F class ATQtest(unittest.TestCase): #driverๅ…จๅฑ€ๅ˜้‡ option =webdriver.FirefoxOptions() option.set...
cainiaosun/study
ๆต‹่ฏ•/UI่‡ชๅŠจๅŒ–/ๆต‹่ฏ•ๅทฅๅ…ท__Selenium/selenium/Selenium/ATQ้กน็›ฎ/01.่„šๆœฌๆ–‡ไปถ/็™ปๅฝ•.py
็™ปๅฝ•.py
py
5,365
python
zh
code
0
github-code
36
16989917132
from logging import Logger from typing import List from pypika import Table # type: ignore from pypika import PostgreSQLQuery as Q from app.models.mart import engine_mart from app.models.askue import AccountPoint from app.models.mart import RegPointModel, RsPointModel, BalanceModel, BalanceRegModel from sqlalchemy.eng...
giveyourtears/electroComputationServer
app/jobs/balance/data_mart_layer.py
data_mart_layer.py
py
10,828
python
en
code
2
github-code
36
73223886825
#!/usr/bin/env python3 import argparse import cv2 import pic import sys import time from PIL import * def clearscreen(n): print('\033[1A\033[K'*n, end='') def main(filename, resize, colors=None, webcam=False, invert=False, scale=(1, 1), nosleep=False): vc = cv2.VideoCapture(filename) tpf = 1.0/...
bahorn/emojipic
emojipic/ani.py
ani.py
py
1,143
python
en
code
1
github-code
36
30478416347
import pprint import numpy as np import tensorflow as tf import tensorflow_datasets as tfds import tensorflow_ranking as tfr import tensorflow_recommenders as tfrs import collections class RankingModel(tfrs.Model): def __init__(self, loss): super().__init__() # Compute predictions. self.score_model = ...
colinfritz-ai/GAP_Recommender_System_MVP
GAP_Recommender_System_Model.py
GAP_Recommender_System_Model.py
py
1,065
python
en
code
0
github-code
36
40264961839
first_sector = "A" last_sector = input() first_sector_rows_count = int(input()) odd_places_count = int(input()) total = 0 for sector in range(ord(f"{first_sector}"), ord(f"{last_sector}") + 1): for row in range(1, first_sector_rows_count + 1): current_places = odd_places_count if row % 2 == 0: ...
ivoivanov0830006/1.1.Python_BASIC
6.Nested_loops/**06.Wedding_seats.py
**06.Wedding_seats.py
py
2,824
python
bg
code
1
github-code
36
43509623765
#!/usr/bin/env python3 """ Fake module for testing. Imitiates link-parser bindings. """ __author__ = "Mark Birger" __date__ = "4 Apr 2015" def parse(string): if string == "Hello world": return {'links': [[0, 2, 'Wa'], [1, 2, 'AN']], 'words': ['LEFT-WALL', 'hello.n', 'world.n']} elif string == "Another...
kusha/dialog
tests/link_parser.py
link_parser.py
py
1,737
python
en
code
1
github-code
36
37635424970
# Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. # Write an algorithm to minimize the largest sum among these m subarrays. # Example 1: # Input: nums = [7,2,5,10,8], m = 2 # Output: 18 # Explanation: # There are four way...
sunnyyeti/Leetcode-solutions
410 Split Array Largest Sum.py
410 Split Array Largest Sum.py
py
1,656
python
en
code
0
github-code
36
11875963511
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 17 12:34:56 2019 @author: stark """ import requests from PageLinker import LinkFinder from domain import * from utility import * class Spider: projectName = '' baseURL = '' domainName = '' queueFile = '' crawledFile = '' ...
pandafy/WebCrawler
spider.py
spider.py
py
3,354
python
en
code
0
github-code
36
12487779900
""" Programming Fundamentals Final Exam Preparation - 24 July 2019 link: https://judge.softuni.bg/Contests/Practice/Index/1759#0 Name: 01. Concert """ class Band: def __init__(self, name: str, new_members=None, time=0): self.name = name self.members = [] self.add_members(new_mem...
SimeonTsvetanov/Coding-Lessons
SoftUni Lessons/Python Development/Python Fundamentals September 2019/Problems And Files/41 PAST EXAMS/Final Exams/04. 24 July 2019 Preparation Final Exam/01. Concert.py
01. Concert.py
py
1,901
python
en
code
9
github-code
36
40961271099
import argparse import os import shutil from subprocess import run from probar_entrega1 import probar import pandas as pd BASE_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__))) def bajar_repositorio(info_grupo): print("Cloning", info_grupo['grupo']) grupo_path = os.path.join(BASE_PATH, info_...
ucse-ia/ucse_ia
2018/corrector.py
corrector.py
py
1,647
python
es
code
5
github-code
36
2809455803
class Scope: def __init__(self, parent=None): self.dct = {} self.parent = parent def __getitem__(self, item): if not item in self.dct: if self.parent: return self.parent[item] else: return None return self.dct[item] d...
GrigoryBartosh/au01_paradigms2016
HW_04/model.py
model.py
py
5,374
python
en
code
0
github-code
36
5843240330
import sublime, sublime_plugin, os mainfilepath="../main.tex" texcommand="%!TEX root" texroot = texcommand + " = " + mainfilepath class TexRootCommand(sublime_plugin.TextCommand): def run(obj, edit): line = obj.view.substr(obj.view.line(0)) if not line.startswith(texcommand): obj.view.insert(edit, 0, te...
saspre/SublimeLatexTopping
Pratex.py
Pratex.py
py
647
python
en
code
0
github-code
36
3745893127
"""empty message Revision ID: 9c5fa6db20f1 Revises: ar399258p714 Create Date: 2023-03-06 13:56:47.958406 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '9c5fa6db20f1' down_revision = 'ar399258p714' branch_labels = None depends_on = None def upgrade(): op...
abnamro/repository-scanner
components/resc-backend/alembic/versions/9c5fa6db20f1_finding_column.py
9c5fa6db20f1_finding_column.py
py
1,202
python
en
code
137
github-code
36
13324525829
# ์—๋ผํ† ์Šคํ…Œ๋„ค์Šค์˜ ์ฒด def list_prime(n): sieve = [True]*n # ์ฒด ์ดˆ๊ธฐํ™”: n๊ฐœ ์š”์†Œ์— True ์„ค์ •(์†Œ์ˆ˜๋กœ ๊ฐ„์ฃผ) m = int(n**0.5) # n๊ฐœ์˜ ์ตœ๋Œ€ ์•ฝ์ˆ˜๊ฐ€ sqrt(n)์ดํ•˜์ด๋ฏ€๋กœ i=sqrt(n)๊นŒ์ง€ ๊ฒ€์‚ฌ for i in range(2, m+1): if sieve[i] == True: # i๊ฐ€ ์†Œ์†Œ์ธ ๊ฒจ์šฐ for j in range(i+i, n, i): # i์ดํ›„ i์˜ ๋ฐฐ์ˆ˜๋“ค์„ False ํŒ์ • sieve[j] = Fals...
ipcoo43/baekjoon
lesson115.py
lesson115.py
py
507
python
ko
code
0
github-code
36
4889121541
from utils import parseDate, checkDateInTheFuture, checkDateFromNotTooBig, s3Query from http_response import okResponse, badRequestResponse from typing import Union import os import boto3 BucketName = os.environ.get('BUCKET_NAME') FileName = os.environ.get('PROV_FILE_NAME') s3 = boto3.client('s3') maxMonths = 5 de...
menalb/covid-data-app
api/bucketquery/coviddata/app_prov.py
app_prov.py
py
1,582
python
en
code
0
github-code
36