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
314381107
''' 3. class Profile: """ Create regular class taking 8 params on init - name, last_name, phone_number, address, email, birthday, age, sex Override a printable string representation of Profile class and return: list of the params mentioned above """ ''' class Profile: def __init__(self, name, last_n...
irynaa-semchuk/HW
Task_3.py
Task_3.py
py
975
python
en
code
0
github-code
36
73335955623
from unittest import TestCase from adsws.api.discoverer import affinity from flask.ext.restful import Resource import flask from flask_restful import Resource, Api import mock class SetCookieView(Resource): """ Returns a good HTTP answer with a coockie set in the headers """ storage = None @affinit...
adsabs/adsws
adsws/tests/test_affinity.py
test_affinity.py
py
2,266
python
en
code
2
github-code
36
20391820190
"""Write a program which removes specific characters from a string. INPUT SAMPLE: The first argument is a path to a file. The file contains the source strings and the characters that need to be scrubbed. Each source string and characters you need to scrub are delimited by comma. For example: how are you, abc hello ...
joelstanner/codeeval
python_solutions/REMOVE_CHARACTERS/REMOVE_CHARACTERS.py
REMOVE_CHARACTERS.py
py
1,314
python
en
code
0
github-code
36
12567048655
#adapted from source: https://github.com/tftdias/mp7descriptors/blob/master/edge_histogram_descriptor_generator.py __author__ = 'Tiago' import cv2 import numpy as np import sys def calc_edge_histogram(img): ''' Calculates the mpeg7 edge histogram according to https://www.dcc.fc.up.pt/~mcoimbra/lectures/VC_141...
andiwi/prvc_predicting_interestingness_in_visual_media
feature_extraction/mpeg7_edge_histogram.py
mpeg7_edge_histogram.py
py
7,119
python
en
code
0
github-code
36
7946726176
import torch.nn as nn import torch class BasicBlock(nn.Module): # 18-layers、34-layers exception = 1 def __init__(self, in_channels, out_channles, stride=1, downsample=None, **kwargs): super(BasicBlock, self).__init__() self.conv1 = nn.Co...
yedupeng/Artificial_Model
ResNext/ResNext_Model.py
ResNext_Model.py
py
5,475
python
en
code
0
github-code
36
938525732
from torch.utils.data import DataLoader import logging import formatter as form from dataset import dataset_list logger = logging.getLogger(__name__) collate_fn = {} formatter = {} def init_formatter(config, task_list, *args, **params): for task in task_list: formatter[task] = form.init_formatter(confi...
china-ai-law-challenge/CAIL2020
sfks/baseline/reader/reader.py
reader.py
py
3,478
python
en
code
150
github-code
36
37021411015
import torch import torch.nn as nn import torch.nn.functional as F import torch_scatter as scatter from modules.utils import MergeLayer_output, Feat_Process_Layer from modules.embedding_module import get_embedding_module from modules.time_encoding import TimeEncode from model.gsn import Graph_sampling_network from mode...
EdisonLeeeee/STEP
src/model/tgat.py
tgat.py
py
5,947
python
en
code
6
github-code
36
43162890839
# ResNet:提出了层间残差跳连,引入了前方信息,缓解梯度消失,使神经网络增加层数成为可能。 # 单纯堆叠神经网络层数,会使神经网络模型退化,以至于后面的特征丢失了前面特征的原本模样 # 用一根跳连线将前面的特征直接接到后边,使输出结果包含了堆叠卷积的非线性输出和跳过两层堆叠卷积直接连接过来的恒等映射x, # 让它们对应的元素相加,有效缓解了神经网络模型堆叠导致的退化,使得神经网络可以向着更深层级发展。 # ResNet中的“+” 与InceptionNet中的“+” 不同的。 # Inception中的“+”是沿深度方向叠加,相当于千层蛋糕增加层数 # ResNet块中的“+”是两路特征图对应元素相...
Demonya/tensorflow_basic
P5/P5.15:ResNet.py
P5.15:ResNet.py
py
6,041
python
en
code
0
github-code
36
4018788178
class Solution: def canConstruct(self, r: str, m: str) -> bool: d1 = Counter(m) for char in r: if char in d1 and d1[char] > 0: d1[char] -= 1 continue else: return False return True
anups1ngh/DSA
0383-ransom-note/0383-ransom-note.py
0383-ransom-note.py
py
280
python
en
code
0
github-code
36
33194329184
# Probably can do this with a bi-directional search too! dijkstras # is only useful when there are different costs associated with traversing # certain paths in the graph! import heapq from sys import argv def getPath(visited, s, e): path = [] path.append(e) cur = e while cur != s: path.append...
sushachawal/InterviewPractice
Python/dijkstras.py
dijkstras.py
py
1,104
python
en
code
0
github-code
36
8384706762
"""Functions for application """ import collections import base64 import skbio import pandas as pd from io import StringIO def parse_sequences(seq_lines, consensus_sequence): msa = skbio.alignment.TabularMSA.read(seq_lines, constructor=skbio.sequence.DNA) seqs, name...
johnchase/dash-alignment-viewer
webapp/util.py
util.py
py
3,587
python
en
code
2
github-code
36
3383192351
class Solution: def canPartition(self, nums: List[int]) -> bool: if sum(nums) % 2: return False dp = set() dp.add(0) target = sum(nums) // 2 for i in range(len(nums) - 1, -1, -1): nextDP = set() for t in dp: if (t + nums[i...
neetcode-gh/leetcode
python/0416-partition-equal-subset-sum.py
0416-partition-equal-subset-sum.py
py
481
python
en
code
4,208
github-code
36
1418338347
#!/usr/bin/env python # coding=utf-8 ''' Description: Author: yangyuxiang Date: 2021-05-13 22:22:41 LastEditors: yangyuxiang LastEditTime: 2021-05-14 07:54:14 FilePath: /leetcode/773.滑动谜题.py ''' # # @lc app=leetcode.cn id=773 lang=python # # [773] 滑动谜题 # # @lc code=start class Solution(object): def slidingPuzzle(...
yangyuxiang1996/leetcode
773.滑动谜题.py
773.滑动谜题.py
py
1,563
python
en
code
0
github-code
36
3650309290
import psycopg2 import os from os.path import join, dirname from dotenv import load_dotenv dotenv_path = join(dirname(__file__), '../.env') load_dotenv(dotenv_path) def connect(): return psycopg2.connect( host=os.environ.get('ENV_host'), database=os.environ.get('ENV_database'), user=os.env...
dapt4/taskapp-flask-angular-postgres
backend/db/connect_db.py
connect_db.py
py
876
python
en
code
1
github-code
36
73358372584
import csv import sys def read_csv(filename): rows = [] with open(filename, 'r') as file: reader = csv.reader(file) for row in reader: #print(row) rows.append(row) return rows def main(): # print command line arguments for arg in sys.argv[1:]: prin...
ErikZhou/scrape_twitter
read_csv.py
read_csv.py
py
454
python
en
code
0
github-code
36
20634684215
from function import * arr = read_file("my_array_10.txt") # def Quick_Sort(arr): """Quick Sort""" # less = [] # equal = [] # bigger = [] # if len(arr) > 1: # pivot = arr[0] #pivot là đặt trưng của quicksort # for x in arr: # if x < pivot: # ...
hnanh99/sort_algorithm
quick_sort.py
quick_sort.py
py
837
python
en
code
0
github-code
36
9016676437
#!/usr/bin/env python3 import sys, datetime, threading, time, shutil, hashlib from Key import Key from Display import Display from Simulation import Simulation class Main: def __init__(self): self.cuteloading = None self.asynckey = None try: sys.stdout.write(Display.screen(True...
Mieschendahl/MAPF
MAPF.py
MAPF.py
py
2,019
python
en
code
0
github-code
36
31803569689
# /usr/bin/python3.6 # -*- coding:utf-8 -*- import re class Solution(object): def div(self, a, b): while a % b != 0: a, b = b, a % b return b def addition(self, first_frac, second_frac, flag): a, b = first_frac c, d = second_frac numerator = a*d + b*c if fl...
bobcaoge/my-code
python/leetcode/592_Fraction_Addition_and_Subtraction.py
592_Fraction_Addition_and_Subtraction.py
py
1,499
python
en
code
0
github-code
36
72339753704
import cv import cv2 import numpy as np import math import time from os import listdir ballTargetImgIndex = 0 def quick_scan_cv(configs, autonomyToCV, GCS_TIMESTAMP, CONNECTION_TIMESTAMP): print("Starting Quickscan CV") #Set output image folder based on simulation attribute in configs out_imagef_path = co...
NGCP/VTOL
archives/quick_scan_cv.py
quick_scan_cv.py
py
13,002
python
en
code
9
github-code
36
14889874420
from __future__ import print_function from operator import itemgetter import collections import os.path import re import sys # Avoid endlessly adding to the path if this module is imported multiple # times, e.g. in an interactive session regpath = os.path.join(sys.path[0], "registry") if sys.path[1] != regpath: s...
AndroidBBQ/android10
frameworks/native/opengl/tools/glgen2/glgen.py
glgen.py
py
11,061
python
en
code
176
github-code
36
4938093058
from random import * class Data: def __init__(self): self.length = 0 self.feature_vectors = [] self.labels = [] self.predictions = [] self.images_binary = [] self.images_color = [] self.feature_names = [] self.table_ids = [] self.numeric_labels = [] #feature_vectors = [phi(I1), phi(I2),...,phi(In...
CognitionTree/Leaves-Classifier
Python-Implementation/Data.py
Data.py
py
9,056
python
en
code
3
github-code
36
12833767605
from functools import reduce with open("input.txt", "r") as f: inputs = f.read().splitlines() def accScore(acc, inputs): return acc + [ ord(a) - ord('A') + 27 if ord(a) < ord('a') else ord(a) - ord('a') + 1 for a in inputs[0] if all(a in line for line in inputs[1:]) ][0] score1 = reduce(a...
efoncubierta/advent-of-code
2022/day03/main.py
main.py
py
570
python
en
code
0
github-code
36
15560593642
import os import platform from . import shell from .versions import Version __all__ = [ # Command line configurable 'BUILD_VARIANT', 'CMAKE_GENERATOR', 'COMPILER_VENDOR', 'SWIFT_USER_VISIBLE_VERSION', 'CLANG_USER_VISIBLE_VERSION', 'SWIFT_ANALYZE_CODE_COVERAGE', 'DARWIN_XCRUN_TOOLCHAIN...
apple/swift
utils/build_swift/build_swift/defaults.py
defaults.py
py
3,417
python
en
code
64,554
github-code
36
6504272930
import sys from io import StringIO text_input1 = """4 6""" text_input2 = """3 2""" sys.stdin = StringIO(text_input1) # sys.stdin = StringIO(text_input2) r, c = [int(x) for x in input().split()] matrix = [] for n in range(r): current_row = [] for m in range(c): current_sequence = chr(97 + n) + chr(...
gyurel/Python-Advanced-Course
exercises_multidimensional_lists/matrix_of_palindromes.py
matrix_of_palindromes.py
py
479
python
en
code
0
github-code
36
40103583521
import flask from flask import render_template, request from definitions import annotation_new import json import services.correspondence_service as cs import services.query_service as qs import services.equivalence_class_service as em import services.rotation_service as rs import services.center_service as ccs import ...
sridevan/correspondence_server
corr_server/views/correspondence_views.py
correspondence_views.py
py
23,793
python
en
code
0
github-code
36
15339693534
from functools import partial def parse(s: str, ind: int = 0): return_index = ind != 0 result = [] ind += 1 # First character is "[" while s[ind] != "]": if s[ind] == ",": ind += 1 elif s[ind] == "[": sub_result, ind = parse(s, ind) result.append(su...
martinsbruveris/advent-of-code
aoc/aoc_2022/day_13.py
day_13.py
py
1,783
python
en
code
0
github-code
36
19248855489
with open('input.txt') as input_file: two_count = 0 three_count = 0 for line in input_file: letters = {} for letter in line: if letter in letters: letters[letter] += 1 else: letters[letter] = 1 exactly_two = False exactl...
dan-oppenheim/aoc2018
day02/part1.py
part1.py
py
627
python
en
code
0
github-code
36
72673665383
import numpy as np from itertools import combinations from TransitionToClosedView import * def quick_check_zero_det(matrix: np.ndarray): zero_line = True for i in range(matrix.shape[1]): for j in range(matrix.shape[0]): if matrix.item(i, j) != 0: zero_line = False ...
Hembos/optimization-method
Transport task/EnumerationMethod.py
EnumerationMethod.py
py
7,249
python
ru
code
0
github-code
36
38250977833
from django.shortcuts import render from django.http import HttpResponse from rest_framework.response import Response from rest_framework.decorators import api_view from .serializers import TodoSerializer from .models import Todo # Create your views here. @api_view(['GET']) def index(request): return Response('h...
SergeJohn/todo-app
backend/api/views.py
views.py
py
1,251
python
en
code
1
github-code
36
15770214644
# coding: utf-8 # In[ ]: def z_funct(s:str): """Вычисляет префикс-функцию строки(она же z-функция): для каждого i-го значения строки вычисляет максимальную длину собственного суффикса, начинающегося с i элемента, совпадающего с ее префиксом :param s:str - строка для которой вычисляется z-функция ...
annykay/problrms_ROSALND
Finding a motiv in DNA.py
Finding a motiv in DNA.py
py
2,219
python
ru
code
0
github-code
36
36002070419
#ACSL 2015 Problem 5 def maxAppear(text): maxVal='A' for x in letters: if text.count(x)>text.count(maxVal): maxVal=x return [maxVal,text.count(maxVal)] def splitWords(text): text=[x if x in letters else ' ' for x in text] text=''.join(text) text=text.split() text=[x fo...
Parmanandsatyam/All-star-coding-sol
acsl2014_2015/Cherry Creek Problem 5.py
Cherry Creek Problem 5.py
py
1,891
python
en
code
0
github-code
36
9829739630
def make_matrix(): matrix_size = int(input()) matrix = [] for row_index in range(matrix_size): row = input() matrix.append(row) return matrix def find_symbol(matrix, symbol): for r in range(len(matrix)): for c in range(len(matrix[r])): if symbol == matrix[r][c]:...
skafev/Python_advanced
03Third_week/04Symbol_in_matrix.py
04Symbol_in_matrix.py
py
580
python
en
code
0
github-code
36
36935271833
record_secods = float(input()) distance_meters = float(input()) swiming_distance_meter = float(input()) his_time = distance_meters * swiming_distance_meter drag = (distance_meters // 15) * 12.5 total_time = his_time + drag diff = abs(record_secods - total_time) if total_time < record_secods: print(f'Yes, he succe...
didarata/SoftUni-Python-Software-Engineering
SoftUni Basics/05.Conditional Statements - Exercise/06_world_swimming_record.py
06_world_swimming_record.py
py
446
python
en
code
0
github-code
36
18795636222
#!/usr/bin/python # -*- coding: utf-8 -*- from PyQt4.QtCore import QString from PyQt4.QtGui import QWidget, QMessageBox, QDesktopWidget, QVBoxLayout from Exercise import Exercise from ExerciseUI import ExerciseUI class WindowUI(QWidget): def __init__(self): super(WindowUI, self).__init__() self.initUI(...
gwolfer/personal-trainer
WindowUI.py
WindowUI.py
py
2,221
python
en
code
1
github-code
36
29036460742
from pprint import pprint class FlatIterator: def __init__(self, list_of_list): self.list_of_list = list_of_list self.counter = -1 def __iter__(self): self.counter += 1 self.counter_values = 0 return self def __next__(self): if len(self.list_of_l...
ansor947/Homevork6
HW_old/HW_Iterators.py
HW_Iterators.py
py
1,161
python
en
code
0
github-code
36
27051867513
from django.urls import path, include from django.utils.translation import gettext_lazy as _ from .views import * app_name = 'buildings' urlpatterns = [ path('', BuildingListView.as_view(), name = 'building_list'), path(_('add/'), BuildingCreateView.as_view(), name = 'building_create'), path(_('<slug>/'),...
andywar65/buildings
urls.py
urls.py
py
3,877
python
en
code
4
github-code
36
72665245224
from chat import Chat from text import Text from plotter import Plotter def main(): reverse = False # Getting stats group = Chat() group_stats = group.get_group_stats(reverse = reverse) # Getting text and saving as txt and png text = Text(group_stats) txt = text.txt png = text.png(fon...
alexaucafe/telegram-chat-stats
main.py
main.py
py
776
python
en
code
0
github-code
36
39479689036
from django.core.management.base import BaseCommand, CommandError from cards.models import Card from cards.models import PhysicalCard from decks.models import Deck, DeckCard, Tournament, TournamentDeck, DeckCluster, DeckClusterDeck import re from optparse import make_option from datetime import datetime, timedelta ...
jcrickmer/mtgdbpy
decks/management/commands/loaddeckhierarchicalclusters.py
loaddeckhierarchicalclusters.py
py
1,967
python
en
code
0
github-code
36
23410231690
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime class Migration(migrations.Migration): dependencies = [ ('bar', '0322_auto_20161010_1636'), ] operations = [ migrations.AlterField( model_name='caja', ...
pmmrpy/SIGB
bar/migrations/0323_auto_20161013_1959.py
0323_auto_20161013_1959.py
py
1,192
python
en
code
0
github-code
36
22284525713
def min_max_normalize(lst) : normalized = [] for value in lst : normalized_num = (value - min(lst)) / (max(lst) - min(lst)) # 일정한 비율로 반환 normalized.append (normalized_num) return normalized a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 22, 24, 56, 74, 21, 11, 23, 52] b = min_max_norma...
lky473736/temp-repo
secbattery/9-2_min-max_normalization.py
9-2_min-max_normalization.py
py
354
python
en
code
0
github-code
36
31916197135
#!/usr/bin/env python # coding: utf-8 # # Technical test results for HEVA company # This notebook repeats the statement of the test. Under each activity you will find the code and the result produced. # You will find all the requirements to run this notebook in the requirements.md file. # ## Configuration # ### 1. ...
mdavid674/TEST_HEVA
main/result.py
result.py
py
14,008
python
en
code
0
github-code
36
15891304933
from cassandra.cqlengine.query import LWTException from sanic.views import HTTPMethodView from app.http import error_response, json_response from app.utils.request import check_uuid class ModelBaseView(HTTPMethodView): model = None @staticmethod async def _make_request(data, many=False): if not ...
Arthur264/music-new.chat
app/utils/view.py
view.py
py
2,024
python
en
code
0
github-code
36
475391220
# # Задача 34 import tkinter as tk from tkinter import messagebox def get_entry(): value = text_input.get() value = value.lower() value = value.split() vowel_count = list(map(lambda string_line: sum(map(lambda char: char in "аяуюэеыиоё", string_li...
KonstantinPotanin/DZpoPYTHON-7
Task34.py
Task34.py
py
1,290
python
en
code
0
github-code
36
25534524692
#how to import video in openCV import cv2 as cv2 import matplotlib.pyplot as plt import numpy as np cap = cv2.VideoCapture(0) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('outpu.avi',fourcc,20.0,(640,480)) while(cap.isOpened()): ret, frame = cap.read(0)#This code initiates an infinite loop #re...
CoolCoder31/Machine_learning_and_analyze
MY_START/OpenCV/OpenCV1.py
OpenCV1.py
py
677
python
en
code
0
github-code
36
23411321140
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('clientes', '0006_auto_20150918_2041'), ] operations = [ migrations.Alt...
pmmrpy/SIGB
clientes/migrations_1/0007_auto_20150918_2045.py
0007_auto_20150918_2045.py
py
1,037
python
en
code
0
github-code
36
17013150761
# -*- coding: UTF-8 -*- from __future__ import absolute_import, division, print_function import os os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # 这一行注释掉就是使用cpu,不注释就是使用gpu import pathlib import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf fr...
jiali1025/SMOTE-REG
code/nano_dl_keras_smote.py
nano_dl_keras_smote.py
py
6,754
python
en
code
0
github-code
36
6793509891
from django.db import models from model_utils.models import TimeStampedModel from ...conf import settings from ...managers.consultant_industry import ConsultantIndustryManager class ConsultantIndustry( TimeStampedModel ): consultant = models.ForeignKey( 'consultant.Consultant', related_n...
tomasgarzon/exo-services
service-exo-core/relation/models/consultant/industry.py
industry.py
py
771
python
en
code
0
github-code
36
43954237817
from Project6.BinarySearchTree import BinarySearchTree bst = BinarySearchTree() bst.insert(14) bst.insert(7) bst.insert(21) bst.insert(3) bst.insert(10) bst.insert(17) bst.insert(25) bst.remove(14) bst.remove(17) bst.remove(10) bst.remove(21) bst.remove(16) bst.remove(7) bst.remove(12) print(bst.r...
EthanClifford/CSE331_Projects
Project6/Test.py
Test.py
py
1,351
python
en
code
0
github-code
36
10663480983
#finally clause def divide(x,y): try: result = x/y except ZeroDivisionError: print("Division By zero!") else: print("Result is",result) finally: print("Executing finallly clause") divide(2,1) divide(2,0) divide("2","1") try: raise KeyboardInterrupt finally: pri...
santosh-potu/python-test
exceptions3.py
exceptions3.py
py
529
python
en
code
0
github-code
36
2946363350
#反转字符串中的单词: def reverse_str(input: str): input = list(input) left = 0 right = len(input) - 1 while left <= right: right_cnt = 0 left_cnt = 0 while right - right_cnt >= 0 and input[right - right_cnt] != ' ': right_cnt += 1 while left + left_cnt < len(input) a...
gpj10054211/guoDeveloper
reverse.py
reverse.py
py
1,331
python
en
code
0
github-code
36
43719618615
def hcf(n,m) : dn=list() dm=list() for i in range(1,n+1): if n%i==0 : dn.append(i) for j in range(1,m+1): if m%j==0 : dm.append(j) l=list() for i in dn : for j in dm : if i==j : l.append(i) print(max(l)) n,m=map(in...
SriramKavi/codemind-python
GCD_or_HCF.py
GCD_or_HCF.py
py
349
python
en
code
0
github-code
36
73583269545
import phunspell import inspect import unittest dicts_words = { "af_ZA": "voortgewoed", "an_ES": "vengar", "be_BY": "ідалапаклонніцкі", "bg_BG": "удържехме", "br_FR": "c'huñvderioù", "de_DE": "schilffrei", "en_GB": "indict", "es_MX": "pianista", "fr_FR": "zoomorphe", } # use cache ...
dvwright/phunspell
phunspell/tests/test_multi_load_cache.py
test_multi_load_cache.py
py
900
python
en
code
4
github-code
36
70441894503
import sys # Merge sort def mergesort(words: list) -> None: if len(words) > 1: partition_index = len(words) // 2 L = words[:partition_index] R = words[partition_index:] mergesort(L) mergesort(R) i = 0 p = 0 q = 0 ...
cjy13753/algo-solutions
baekjoon/1181/solution_1181.py
solution_1181.py
py
1,401
python
en
code
0
github-code
36
32635863663
# -*- coding:utf-8 -*- import os import cv2 import numpy as np import torch.utils.data as data kernel = np.ones((3, 3), np.uint8) infinite = 1e-10 INF = 1e-3 def make_dataset(root): imgs = [] count = 0 for i in os.listdir(root): count += 1 img = os.path.join(root, i) ...
1528219849/DFETS-Net
data_handle/dataset_eval.py
dataset_eval.py
py
1,048
python
en
code
0
github-code
36
70718371624
import os import sys import cv2 import subprocess from tkinter import Tk, Frame, Button, Label, Entry from tkinter import filedialog, colorchooser from math import sqrt from mosaic import MosaicGenerator class Window(Frame): """ The tkinter window and logic """ def __init__(self, parent): ""...
LFruth/MosaicGenerator
MosaicGenerator.py
MosaicGenerator.py
py
7,563
python
en
code
0
github-code
36
7305360310
import sys sys.path.insert(0, "..") import threading import time from opc_ua import opc_module from festofactory import FestoFactory class palette(threading.Thread): def __init__(self,numero_palette): threading.Thread.__init__(self) self.nbr_palette = numero_palette self.property = {'nbr':s...
CoRotProject/FOF-API
Agents/digital_twin_festo/palette.py
palette.py
py
1,474
python
en
code
0
github-code
36
41893805327
# pylint: disable=F0401 from dataclasses import dataclass from functools import reduce from itertools import chain, combinations, islice, tee from typing import Iterator, Optional, Union from utils import read_input @dataclass class SnailNode: val: Optional[int] = None left: Optional["SnailNode"] = None ...
hsherkat/AOC2021
day18.py
day18.py
py
5,244
python
en
code
0
github-code
36
15883213411
from tkinter import * from tkinter import messagebox from tkinter import ttk import tkinter.font as tf import mysql.connector as mc from mysql.connector import Error as mce import webbrowser as wb import os conn = mc.connect(user='your role name',password='your password',host='127.0.0.1',database='CAC_db') cur=conn.cu...
ineed-coffee/CAC-Code-Forces-Algorithm-Classifier-
CAC.py
CAC.py
py
2,270
python
en
code
0
github-code
36
16731252114
''' Table of Contents Functions and Interdependencies: proj orthogonalize - proj OLS EV pairwise_similarity best_permutation - pairwise_similarity self_similarity_pairwise - best_permutation ''' import numpy as np import scipy.optimize # import sklearn.decomposition ...
RichieHakim/basic_neural_processing_modules
bnpm/similarity.py
similarity.py
py
31,408
python
en
code
3
github-code
36
28808155062
import interface as bbox import theano import numpy as np import theano.tensor as T import lasagne import time def prepare_agent(in_state=None): net = lasagne.layers.InputLayer(shape=(1,n_features),input_var=in_state) net = lasagne.layers.DenseLayer(net,num_units=300,nonlinearity=lasagne.nonlinearities.tanh) ...
EladMichael/BlackBoxChallenge
testnet.py
testnet.py
py
2,956
python
en
code
0
github-code
36
9470051726
import os import numpy as np from os.path import isfile import torch import torch.nn.functional as F EPS = 1e-6 def assert_same_shape(t1, t2): for (x, y) in zip(list(t1.shape), list(t2.shape)): assert(x==y) def print_stats_py(name, tensor): print('%s (%s) min = %.2f, mean = %.2f, max = %.2f' % (name, ...
ayushjain1144/SeeingByMoving
frustum_pointnet/kitti/utils_basic.py
utils_basic.py
py
12,301
python
en
code
22
github-code
36
2544759801
from edc_metadata.constants import NOT_REQUIRED, REQUIRED from edc_metadata_rules import CrfRule, register from edc_metadata_rules import CrfRuleGroup from ..predicates import Predicates app_label = 'cancer_subject' pc = Predicates() @register() class OncologyTreatmentPlanRuleGroup(CrfRuleGroup): radiation_pl...
cancer-study/cancer-metadata-rules
cancer_metadata_rules/metadata_rules/oncology_treatment_plan_rulegroup.py
oncology_treatment_plan_rulegroup.py
py
607
python
en
code
0
github-code
36
18915731113
import pytest from src.unique_morse_code_words import Solution @pytest.mark.parametrize( "word,expected", [ ("gin", "--...-."), ("msg", "--...--."), ], ) def test_to_morse(word, expected): assert Solution().to_morse(word) == expected @pytest.mark.parametrize( "words,expected", ...
lancelote/leetcode
tests/test_unique_morse_code_words.py
test_unique_morse_code_words.py
py
501
python
en
code
3
github-code
36
39690456010
import server from atlas import Operation, Entity, Oplist # Apply to all entities that should take damage when hit. # Modifiers can be applied for various things. The damage value will be multiplied with the modifier. # To modify on the type of hit, apply a "__modifier_hit_type_*" modifier. # For example, if you want...
worldforge/cyphesis
data/rulesets/deeds/scripts/world/traits/Hittable.py
Hittable.py
py
1,546
python
en
code
95
github-code
36
40751308459
from pyrogram import Client, filters, enums from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from config import ADMIN @Client.on_message(filters.command("start") & filters.private) async def start_cmd(bot, msg): txt="ᴛʜɪs ɪs ᴘᴇʀsᴏɴᴀʟ ᴜsᴇ ʙᴏᴛ 🙏. ᴅᴏ ʏᴏᴜ ᴡᴀɴᴛ ʏᴏᴜʀ...
dor3Monbotz/CrownSimpleRenamerBot
main/start_text.py
start_text.py
py
3,663
python
en
code
0
github-code
36
26723585229
import allure import pytest from models.Enpoints import ReqresInEndpoint from models.Register import RegisterRequest, RegisterResponseSuccess, RegisterResponseError from models.Resource import Resource from models.User import User @pytest.mark.reqres_in @allure.suite( suite_name="Test-suite №1" ) @allure.severit...
eugenereydel99/pyrequests_api_automation_testing
test_reqres_in.py
test_reqres_in.py
py
3,511
python
en
code
0
github-code
36
36837926119
from __future__ import annotations import dataclasses import bson.json_util as json import seaborn as sns import pandas as pd from sklearn.metrics import r2_score from sklearn.linear_model import LinearRegression import statsmodels.api as sm from database_instance import DatabaseInstance import execution_tree as sbe im...
mongodb/mongo
buildscripts/cost_model/experiment.py
experiment.py
py
5,682
python
en
code
24,670
github-code
36
4686279397
import time from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import gdal from LRSMSingleVersion.CONST.CONST import * from LRSMSingleVersion.UILayer.Workbench.BorderItem import BorderItem class GraphicsView(QGraphicsView): CLICK_INVERT_TIME = 1.2 def __init__(self, parent=N...
yiyexingyu/LRSMSingleVersion
UILayer/Workbench/GraphicsView.py
GraphicsView.py
py
5,810
python
en
code
2
github-code
36
40969615571
def is_prime(n): if n==1: return False elif n==2 or n==3: return True elif (n % 2 == 0) or (n % 3 == 0): return False elif (n < 0): return False elif all(n % i != 0 for i in range(2, (int(n**0.5)+2))): return True else: return False ...
davidmurphy5456/eulerprojects
euler project 35.py
euler project 35.py
py
984
python
en
code
0
github-code
36
27473837054
"""A modern skeleton for Sphinx themes.""" __version__ = "1.0.0.dev2" from pathlib import Path from typing import Any, Dict from sphinx.application import Sphinx _THEME_PATH = (Path(__file__).parent / "theme" / "basic-ng").resolve() def setup(app: Sphinx) -> Dict[str, Any]: """Entry point for sphinx theming."...
pradyunsg/sphinx-basic-ng
src/sphinx_basic_ng/__init__.py
__init__.py
py
532
python
en
code
26
github-code
36
70003297066
import numpy as np import pandas as pd import tensorflow as tf def get_data(): train = pd.read_csv('/Users/josh/Downloads/train.csv') test = pd.read_csv('/Users/josh/Downloads/test.csv') age_norm = (train.Age - train.Age.mean()) / train.Age.std() fare_norm = (train.Fare - train.Fare.mean()) / train.Fa...
jlwirtner/BlockTrain
model.py
model.py
py
2,360
python
en
code
0
github-code
36
1701452870
from pathlib import Path class contextmanager: def __init__(self, filepath="", mode="r"): self.filepath=filepath self.mode=mode def __enter__(self): try: if self.mode not in ["w", "a", "r"]: raise ValueError except ValueError: self.mode=i...
love2kick/Learn_Python_Homeworks
HW7/01_fileworker.py
01_fileworker.py
py
1,222
python
en
code
0
github-code
36
15760657167
from datetime import datetime #Server File import time import socket import threading import sys import json from connection_obj import * from organisation import * from session import * # from Encryption import encrypt_message import re import random import string # from serverTest import * import base64 from casEncr...
casgaindustries/Project
bank.py
bank.py
py
6,574
python
en
code
0
github-code
36
2894204249
from typing import List from src.dialog.common.Dialog import Dialog from src.dialog.common.DialogContainer import DialogContainer from src.dialog.common.DialogFactory import DialogFactory from src.dialog.common.form_doc.FormDocFuncs import FormDocFuncs from src.docs_publisher.common.DocsPublisher import DocsPublisher ...
andreyzaytsev21/MasterDAPv2
src/dialog/common/form_doc/FormDocContainer.py
FormDocContainer.py
py
1,917
python
en
code
0
github-code
36
21952378118
# coding: utf-8 __title__ = "ЭлЦепи ЭОМ" __author__ = 'Kapustin Roman' __doc__ = '''''' from rpw import * from System import Guid from Autodesk.Revit.DB import * from pyrevit import script, forms from rpw.ui.forms import* from Autodesk.Revit.DB.Structure import StructuralType from System.Windows import Window from py...
bimkpln/Git_Repo_pyKPLN
pyKPLN_MEP/KPLN.extension/pyKPLN_MEP.tab/ЭОМ_СС.panel/ЭОМ.pushbutton/script.py
script.py
py
37,145
python
ru
code
2
github-code
36
12435354493
""" 104. Maximum Depth of Binary Tree Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 Example 2: Input: root = [1,...
ashishkssingh/Leetcode-Python
Algorithms/Easy/maximum_depth_of_binary_tree.py
maximum_depth_of_binary_tree.py
py
1,499
python
en
code
0
github-code
36
73444085223
from django import template register = template.Library() @register.simple_tag def get_months(): return [ (1, 'Enero'), (2, 'Febrero'), (3, 'Marzo'), (4, 'Abril'), (5, 'Mayo'), (6, 'Junio'), (7, 'Julio'), (8, 'Agosto'), (9, 'Septiembre'), ...
feldmatias/stockAmbosMG
Base/templatetags/get_months.py
get_months.py
py
403
python
es
code
1
github-code
36
12501592959
import numpy as np from src.pyVertexModel.Kg import kg_functions from src.pyVertexModel.Kg.kgContractility import KgContractility from src.pyVertexModel.Kg.kgSubstrate import KgSubstrate from src.pyVertexModel.Kg.kgSurfaceCellBasedAdhesion import KgSurfaceCellBasedAdhesion from src.pyVertexModel.Kg.kgTriAREnergyBarrie...
Pablo1990/pyVertexModel
src/pyVertexModel/newtonRaphson.py
newtonRaphson.py
py
7,835
python
en
code
0
github-code
36
9740902375
#  Tests for methods in heritageconnector.lookup from heritageconnector.entity_matching import lookup class TestUrlMethods: """ Test individual methods to extract Wikidata IDs from URLs. """ def test_from_wikipedia(self): qcode = lookup.wikidata_id.from_wikipedia( "https://en.wik...
TheScienceMuseum/heritage-connector
test/test_lookup.py
test_lookup.py
py
3,709
python
en
code
20
github-code
36
19739680799
from __future__ import absolute_import import socket try: import netifaces except ImportError: netifaces = None from pkg_resources import working_set from vigilo.common.logging import get_logger LOGGER = get_logger(__name__) from vigilo.common.gettext import translate _ = translate(__name__) from vigilo.vig...
vigilo/vigiconf
src/vigilo/vigiconf/lib/server/factory.py
factory.py
py
5,047
python
fr
code
3
github-code
36
73261011945
from math import * import numpy as np import matplotlib.pyplot as plt import scipy class DataGenerator: def __init__(self, Length=1000*1e3, Bandwith=10*1e9, power_loss_db=0.2, dispersion=17e-6, Gamma=1.27*1e-6, nsp=1, h=6.626*1e-34, lambda0=1.55*1e-6, T=65, N=2**11, number_symbols=3, p=0.5,M=16)...
hadifawaz1999/dnn-4-of
data.py
data.py
py
7,383
python
en
code
1
github-code
36
37309146962
import pyaudio import wave import sys import time ''' init初始化的时候,time:要录制的时间,path:保存音频的路径及名称 record_audio:运行一次录制一段时长为time的音频 play_time:运行一次播放一段音频, 这里注意也要传入一个路径 ''' class Audio: CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44100 @staticmethod def record_audio(time, path): ...
imppppp7/time
Training/Audio.py
Audio.py
py
2,408
python
en
code
0
github-code
36
31522034192
class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ # precheck d={} for i in xrange(len(board)): for j in xrange(len(board[0])): d[board[i][j]]=d.g...
szhu3210/LeetCode_Solutions
LC/79.py
79.py
py
1,489
python
en
code
3
github-code
36
25111441493
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division, print_function, unicode_literals __author__ = 'hendro' from tornado.web import RequestHandler from library.AutoVivification import AutoVivification from library.helpers import send_request, is_engine_activated, load_engi...
w33ladalah/news-crawler-engine
webapp/console.py
console.py
py
5,059
python
en
code
0
github-code
36
12573520960
# Collections module has already been imported. class BinaryTree: def __init__(self, root_node = None): self.root = root_node def validate_BST_Itr(self,root): # Return type should be Boolean queue = [root] while queue: node = queue.pop(0) ...
AG-Systems/programming-problems
firecode/Iterative-BST-Validation.py
Iterative-BST-Validation.py
py
683
python
en
code
10
github-code
36
32149183489
# invoer s = int(input('Geef een geheel aantal seconden : ')) # berekening m = s // 60 s = s % 60 u = m // 60 m = m % 60 d = u // 24 u = u % 24 # uivoer print(str(d) + 'd ' + str(u) + ':' + str(m) + ':' + str(s)) # langere variabelen
Milan9870/5WWIPython
04_Variabelen/secondje.py
secondje.py
py
237
python
nl
code
0
github-code
36
74408545383
from birdnetlib.watcher import DirectoryWatcher from birdnetlib.analyzer_lite import LiteAnalyzer from birdnetlib.analyzer import Analyzer import os from collections import namedtuple from mock import patch, Mock def test_watcher_complete(): analyzer = Analyzer() analyzer_lite = LiteAnalyzer() directory ...
joeweiss/birdnetlib
tests/test_watcher_both_analyzers.py
test_watcher_both_analyzers.py
py
2,567
python
en
code
19
github-code
36
4423364183
import tempfile from os import path, sep from django import forms from django.forms.util import ErrorList from django.conf import settings from django.template.loader import render_to_string from transhette import polib, poutil PO_PROJECT_BASE = 'po_project_base' class FormAdminDjango(forms.Form): def as_dja...
buriy/django-transhette
transhette/forms.py
forms.py
py
5,327
python
en
code
5
github-code
36
39062464656
import sqlite3 conn = sqlite3.connect('D:\pythonPRJ\kgitbankPython\sqliteTest\example.db') c = conn.cursor() data = [ ('2020-03-07','buy','rhat',100,35.14), ('2020-02-09','buy','net',80,24.95), ('2020-03-05','buy','com',54,220.55), ('2020-01-18','buy','rhat',210,35.14) ] sql = """insert...
Yun4e/mm
sqliteTest/sqliteTest4.py
sqliteTest4.py
py
410
python
en
code
0
github-code
36
3436381660
# Given a string and a non-negative int n, # we'll say that the front of the string is the first 3 chars, # or whatever is there if the string is less than length 3. # Return n copies of the front. text = str(input()) n = int(input()) prefix = "" ans = "" for i in range (0, min(3, len(text))): prefix += text[i]; for...
T0peerakarn/python-pratice
front_times.py
front_times.py
py
367
python
en
code
1
github-code
36
34589390018
from django.shortcuts import render, get_object_or_404 from django.http import Http404, HttpResponseRedirect, HttpResponse from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.views import generic from django.contrib.auth.models import User import nfldb import json from .models import T...
seniark/ppr_oracle
football/views.py
views.py
py
8,192
python
en
code
0
github-code
36
28797914331
# RachelPotter.py # A program that changes the lowercase names in a .txt file to uppercase and prints them to a new file def main(): infile_name = "Before.txt" outfile_name = "After.txt" infile = open(infile_name, "r") outfile = open(outfile_name, "w") for row in infile: for letter in row: ...
Eric-Wonbin-Sang/CS110Manager
2020F_hw4_submissions/potterrachel/RachelPotter.py
RachelPotter.py
py
612
python
en
code
0
github-code
36
137629276
from silence_tensorflow import silence_tensorflow import tensorflow as tf from tensorflow.keras import layers, Model, models, Input, regularizers, initializers from tensorflow.keras import backend as K import numpy as np import matplotlib.pyplot as plt import glob import imageio import os import time import datetime im...
shimihirouci/Improve_Imagination
Training_GAN.py
Training_GAN.py
py
23,218
python
en
code
7
github-code
36
70806934183
import sys sys.stdin = open('input.txt') # 가장 나중에 사용되거나 앞으로 사용하지 않을 숫자 반환 def get_far_num(arr): idxs = {} for p in plug: if p not in arr: return p else: k = arr.index(p) idxs[k] = p max_key = max(idxs.keys()) return idxs[max_key] # 입력 데이터 N, K = ...
unho-lee/TIL
CodeTest/Python/BaekJoon/1700.py
1700.py
py
1,052
python
ko
code
0
github-code
36
36477035716
import os from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from catVdog.models import IMG from Include.cnn.predict import predict # Create your views here. # 添加 index 函数,返回 index.html 页面 def index(request): return render(request, 'index.html') @csrf_exempt def u...
Missyanc/CatVsDog
catVdog/views.py
views.py
py
927
python
en
code
97
github-code
36
24849126049
import streamlit as st import pickle import numpy as np import pandas as pd model = pickle.load(open("model.pkl", "rb")) dt = pickle.load(open("dictionary_map.pkl", "rb")) st.header("Laptop Price Predictor!!!") val1 = st.selectbox( 'Company Name', (dt["company_name"].keys())) val2 = st.selectbox( 'Proce...
itsguptaaman/Flipkart_Laptop_Price_Prediction
app.py
app.py
py
1,188
python
en
code
0
github-code
36
28836397312
""" --------------------------------------------------------- Change Log Author Date: Change: Reason: --------------------------------------------------------- Python Scripting Activity For Instructor: Author: Ken Livesey --------------------------------------------------------- Activity 2: Si...
klivesey/KL_GH
Lesson4_2.py
Lesson4_2.py
py
1,529
python
en
code
0
github-code
36
7575877557
# lista = [] # baza = [20, -3, 12, -89, 22, -67] # # a = "dodatnie" # b = "ujemne" # # if a >= 1: # print("Są to liczby dodatnie") # elif b <= 1: # print("Są to liczby ujemne") # baza = [22, 34, 12, -3, -44, -34] dodatnie = 0 ujemne = 0 for liczba in baza: if liczba > 0: dodatnie += 1 elif l...
TworzeDoliny/bootcamp-08122018
kolekcje/zadanie_3.py
zadanie_3.py
py
605
python
pl
code
0
github-code
36
37753053291
# %% from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Flatten from tensorflow.keras.layers import Conv2D, MaxPooling2D, Activation, BatchNormalization from tensorflow.keras.layers import GlobalAveragePooling2D from tensorflow.keras.utils import to_categorical from tenso...
sofgutierrez6/Parcial-2-Machine
Proyecto2_Gutiérrez_Guatibonza.py
Proyecto2_Gutiérrez_Guatibonza.py
py
10,228
python
es
code
0
github-code
36
35300873562
import os import sys import argparse import logging from pyspark.sql.functions import col, when from pyspark.sql import SparkSession from table_mappings import get_schema_struct, get_column_name_diff, get_primary_key def _get_config(argv): parser = argparse.ArgumentParser() parser.add_argument('--host', dest='...
carlosborgesreis/CarlosBorges-data-coding-interview
challenge1/pyspark/load_dw.py
load_dw.py
py
2,969
python
en
code
0
github-code
36