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
37021992627
from django.core.exceptions import ObjectDoesNotExist from django.http import StreamingHttpResponse, HttpResponse from rest_framework.response import Response from .models import AudioSlice, Audio from .serializers import AudioSerializer, AudioSliceSerializer from rest_framework.decorators import api_view from rest_fra...
Choleor/choleor-audio-reboot
audio/views_old.py
views_old.py
py
8,450
python
en
code
0
github-code
6
26255854051
from MainA1 import Mainfun from unigramIndex import Linkedlist import string from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer import pickle class QueryProcess: def __init__(self): '''Attribute for each Query processing results...
prashant18360/Information-Retrieval-Assignment-1
Qprocessing.py
Qprocessing.py
py
10,931
python
en
code
0
github-code
6
4817137896
import cv2 import os import numpy as np import imutils def open_picture(image): """We open picture""" img = cv2.imread(image) return img def show_picture(name, image, mode, destroy): cv2.imshow(name, image) cv2.waitKey(mode) if mode == 1: time.sleep(0.2) ...
LeGrosLezard/qu-est-ce-qu-il-y-a-dans-une-salle-a-manger-
program/training/crop_object.py
crop_object.py
py
1,965
python
en
code
0
github-code
6
30777340619
from unittest import TestCase from mapper.file_mapper import FileMapper from container.file import File class TestFileMapper(TestCase): def test_get_files_from_diff_should_return_four_files(self): diff = '4\t0\t.gitignore\n' \ '8\t8\tIZIFarmaProm/build.gradle\n' \ '1\t1\tIZI...
farmapromlab/GITAG
test/test_fileMapper.py
test_fileMapper.py
py
1,191
python
en
code
1
github-code
6
20538043919
""" You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itse...
Amit258012/100daysofcode
Day14/add_two_numbers_linked_list.py
add_two_numbers_linked_list.py
py
1,871
python
en
code
0
github-code
6
31211286041
# -*- coding: utf-8 -*- """ Created on Wed Oct 28 07:07:43 2015 @author: RAHUL JAIN """ from xml.dom.minidom import parse import xml.dom.minidom DOMTree = xml.dom.minidom.parse("chemsep1.xml") compounds = DOMTree.documentElement compound = compounds.getElementsByTagName("compound") i = 1 for comp in comp...
RahulJain7/Openmodelica-Thermodynamic-Engine
PythonFiles/getComp.py
getComp.py
py
15,689
python
en
code
3
github-code
6
17609260691
# encoding: utf-8 import badgrlog import datetime from django.utils import timezone from rest_framework import permissions from rest_framework.response import Response from rest_framework import serializers from rest_framework import status from backpack.models import BackpackCollection, BackpackBadgeShare, Backpac...
reedu-reengineering-education/badgr-server
apps/backpack/api.py
api.py
py
16,711
python
en
code
2
github-code
6
7068326150
#!/usr/bin/env python # -*- coding=utf-8 -*- # Author: kaname # QQ: 1394041054 """ C4d analyzer """ # RUN: # 1. From C4Dloader.py to loading RBAnalzer.py to do it. # 2. AnalyzeC4d.py loading C4Dloader.py to do it. import os import sys import subprocess import string import logging import time import shutil ...
kRayvison/Pycharm_python36
new_render_data/input/p/script/abort/back20180419/CG/C4d/python34_bak/process/AnalyzeC4d_201712191500.py
AnalyzeC4d_201712191500.py
py
1,972
python
en
code
1
github-code
6
39732689560
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 7 10:43:00 2022 @author: Christopher Corbell """ from tttoe.board import Board class GameTree: """ A GameTree can generate a tree of tic tac toe Board nodes. The tree is generate as tiers of boards at each ply. Boards are labeled ...
ccorbell/gametheory
tttoe/gametree.py
gametree.py
py
7,352
python
en
code
0
github-code
6
3990110801
from functions import * from create_directory import * from Crypto.Cipher import AES import os import shutil import time home = user_home() if os.path.exists(home + "DataShareSecure") == False: print("\nNous vous prions de lire le fichier \"Readme.txt\" et de suivre ces consignes.\n") sys.exit() print("BIEN...
Su1M01/DataShareSecure
Receiver.py
Receiver.py
py
3,616
python
fr
code
0
github-code
6
26061079286
import nltk from nltk.tokenize import * import numpy as np #-------------------------------------------------------- alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] punctuation = ['?',',','!','.',':',';'] char_count= [0] * len(alphabet) punctuation_...
andresOchoaHernandez/AuthorshipRecognition
PythonPrototype/extract_features.py
extract_features.py
py
4,777
python
en
code
0
github-code
6
35374859965
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 8 22:42:38 2022 @author: sanggupark """ import numpy as np import traci from dataclasses import dataclass import math from shapely.geometry import LineString, Point from SimpleMath import create_vehicle_shape @dataclass(init = True) class Object...
sanggu-park/blaft_simulation
Sensing.py
Sensing.py
py
3,640
python
en
code
0
github-code
6
9169202815
from tkinter import * from tkinter.messagebox import * def sum(): r='' r=int(e.get()) if r=='': showinfo('messae','Enter the value') else: t=r*r l2.configure(bg='#209f49',text='Area of circle: {:.1f}'.format(t)) root=Tk() root.title('Calculate') root.geometry('280x220') root.co...
Devcoder980/twinkle
calculcircel.py
calculcircel.py
py
688
python
en
code
1
github-code
6
37957784515
''' eg> nodes value - key a - 5 b - 15 c - 3 d - 10 e - 25 in huffing tree: Each node is either a leaf with one of the key and value specified or has 2 children with value '*' and key with value addition of both children node. This important property will be exploited to make an easy tree There w...
vjg28/Huffman-Coding-ARM
tree.py
tree.py
py
3,009
python
en
code
1
github-code
6
35512343107
# ะ”ะฐะฝะพ: ะฟะพัะปะตะดะพะฒะฐั‚ะตะปัŒะฝะพัั‚ัŒ ัั‚ั€ะพะบ. # # ะ—ะฐะดะฐะฝะธะต: ะฒั‹ ะดะพะปะถะฝั‹ ะพะฑัŠะตะดะธะฝะธั‚ัŒ ัั‚ะธ ัั‚ั€ะพะบะธ ะฒ ะฑะปะพะบ ั‚ะตะบัั‚ะฐ, ั€ะฐะทะดะตะปะธะฒ ะธะทะฝะฐั‡ะฐะปัŒะฝั‹ะต ัั‚ั€ะพะบะธ ะทะฐะฟัั‚ั‹ะผะธ. # ะ’ ะบะฐั‡ะตัั‚ะฒะต ัˆัƒั‚ะบะธ ะฝะฐะด ะฟั€ะฐะฒะพั€ัƒะบะธะผะธ ั€ะพะฑะพั‚ะฐะผะธ, ะฒั‹ ะดะพะปะถะฝั‹ ะทะฐะผะตะฝะธั‚ัŒ ะฒัะต ะฒั…ะพะถะดะตะฝะธั ัะปะพะฒะฐ "right" ะฝะฐ ัะปะพะฒะฐ "left", # ะดะฐะถะต ะตัะปะธ ัั‚ะพ ั‡ะฐัั‚ัŒ ะดั€ัƒะณะพะณะพ ัะปะพะฒะฐ. ะ’ัะต ัั‚ั€ะพะบะธ ะดะฐะฝั‹ ะฒ ะฝะธะถะฝะตะผ ั€ะตะณะธัั‚ั€ะต. right:...
annapodl18/Command-flow
Left_hand.py
Left_hand.py
py
1,256
python
ru
code
0
github-code
6
71842718268
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable #autograd oops import torch.optim as optim # core code of TRADES # shhhhhh where does the author use l2-norm????? def squared_l2_norm(x): flattened = x.view(x.unsqueeze(0).shape[0], -1) return (flattened ** ...
yaoyugua/TRADES
TRADES-master/trades.py
trades.py
py
4,661
python
en
code
0
github-code
6
20493833703
import json d1 = { 'Pessoa 1': { 'nome:': 'Luiz Augusto', 'idade:': 25, }, 'Pessoa 2': { 'nome:': 'Adriano Santos', 'idade:': 30, }, } print() print(d1,'\n') d1_json = json.dumps(d1, indent=True) with open('arquivo.json', 'w+') as file: file.write(d1_json) print(...
Adriano1976/Curso-de-Python
Secao03-Programacao-Procedural/Aula087-Arquivos-Criar-ler-escrever-e-apagar/main.py
main.py
py
329
python
pt
code
0
github-code
6
71674830588
import genanki import functools import os TRUE_FALSE_MODEL_ID = 1803127777 @functools.lru_cache() def load_true_false_model(): data = {} for fname in ['fields.json', 'templates.yaml', 'cards.css']: path = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'true_false_model', fnam...
kerrickstaley/anatomyquestions
note.py
note.py
py
1,414
python
en
code
0
github-code
6
38696996514
# coding=utf-8 import requests from browse_airbnb import get_reviews from time import strftime from pablo import Pablo def get_all_reviews(logement_id): bdd = Pablo() insert_query = """INSERT INTO airbnb_review_global (review_id, author_id, listing_id, recipient_id, content, date_creation, la...
pablo-a/airbnb
get_all_reviews_listing.py
get_all_reviews_listing.py
py
1,585
python
en
code
1
github-code
6
33850641451
# ็ฌฌ 0002 ้ข˜๏ผš็”Ÿๆˆ็š„200ไธชๆฟ€ๆดป็ ไฟๅญ˜ๅœจmysqlๅ…ณ็ณปๅž‹ๆ•ฐๆฎๅบ“ไธญ import random, string import pymysql def get_string(num, length=10): codes = [] chars = string.ascii_uppercase + string.digits for i in range(num): one_code = random.sample(chars, length) codes.append(''.join(one_code)) return codes def save_code_mysql(): try: conn =...
akenYu/learnpy
showme/02/savemysql.py
savemysql.py
py
1,070
python
en
code
0
github-code
6
70167475709
#!/usr/bin/env python from setuptools import setup, Extension import os from os import popen from os.path import dirname, join class lazy_cythonize(list): def __init__(self, callback): self._list = None self.callback = callback def c_list(self): if self._list is None: sel...
bogdanbabych/paralex4cfields
tests/cwb-python/setup.py
setup.py
py
2,041
python
en
code
0
github-code
6
71969151547
from django.contrib import admin from django.urls import path, re_path from . import views urlpatterns = [ path('',views.index,name="words-index"), #index homePage path('words/',views.index,name="words-index"),#index homePage path('random/',views.get_random,name="random"), #Random word path('words/<str...
gystr/words
words/urls.py
urls.py
py
1,067
python
en
code
1
github-code
6
9963863734
import numpy as np import scipy.sparse as sp import torch import time import random from utils.tool import read_data, write_dic, dictionary, normalize, sparse_mx_to_torch_sparse_tensor def encoding_test(test_graph_path, test_fact_path, train_dataset = "fb237_v1"): """load test-graph and test-facts, and ...
shuwen-liu-ox/INDIGO
utils/utils_test_pattern.py
utils_test_pattern.py
py
9,170
python
en
code
22
github-code
6
40411376601
#!/usr/bin/env python3 """ Name: locator_led_status.py Description: NXAPI: display locator-led status for chassis, modules, fans Example output: % ./locator_led_status.py --vault hashicorp --devices cvd_bgw_1 --module 1,2 --fan 1,2 ip hostname status locator-led 192.168.11.110 cvd-1111-bgw ...
allenrobel/nxapi-netbox
scripts/locator_led_status.py
locator_led_status.py
py
5,240
python
en
code
0
github-code
6
36413210728
# --------------- # ParamCopy - Substance 3D Designer plugin # (c) 2019-2022 Eyosido Software SARL # --------------- from sd.api.sdpackage import SDPackage from sd.api.sdnode import SDNode from sd.api.sdgraph import SDGraph from sd.api.sdarray import SDArray from sd.api.sdproperty import SDPropertyCategory from sd.api...
eyosido/ParamCopy
src/paramcopy/pccore/pcstatemgr.py
pcstatemgr.py
py
5,587
python
en
code
9
github-code
6
22195221109
from __future__ import print_function from __future__ import division from __future__ import absolute_import import numpy as np from btk import btk import os import matplotlib import matplotlib.pyplot as plt from tkinter import * from tkinter.messagebox import * from tkinter import ttk # Label = strike / off ; con...
staufga0/DM_Project
Source/file.py
file.py
py
14,754
python
fr
code
0
github-code
6
2914350136
class Block: """ A block is the smallest unit of data in Meshcash A block includes a list of transactions and knowledge regarding the view of the creating miner """ def __init__(self): # The layer of which this block belongs to self.layerId = None # The public key o...
anon444/meshcash
src/DataSturcutres/Block.py
Block.py
py
3,265
python
en
code
0
github-code
6
8469582185
from calculations import get_standings, get_current_track_data from utils import get_player_name, get_telegram_name from plots import timedelta_to_string def info_about_current_weeks_ladder_changes(old_data, new_data): new_data = get_current_track_data(new_data) new_data = new_data[new_data["Origin"] == "Play...
Excidion/trackmania_nations_challenge_bot
messages.py
messages.py
py
2,399
python
en
code
1
github-code
6
45897381316
import os from PIL import Image class ImageUpscaler: def __init__(self, image_path, scale_factor): self.image_path = image_path self.scale_factor = scale_factor def upscale_image(self, image_file): # Open the image image = Image.open(image_file) # Calculate the new di...
huju-tub/visual-cryptography-generator
classes/image_upscaler.py
image_upscaler.py
py
1,598
python
en
code
0
github-code
6
21095535591
import torch import torch.nn as nn import numpy as np from torch.nn.functional import upsample, interpolate from Spa_downs import * import torch.nn.functional as F from torch.autograd import Variable import argparse from torch.nn import init import scipy.io as sio import os import random class ReshapeTo...
pyguan88/MDA-Net
function.py
function.py
py
6,689
python
en
code
8
github-code
6
39472033874
from paystackapi.paystack import Paystack from paystackapi.transaction import Transaction from paystackapi.verification import Verification paystack_secret_key = "sk_test_a18b4a0dcad6d60a03b5be78a47e14f8d28686ce" paystack_public_key = "pk_test_80c9e3e62c12dca2e7a51baaccf342279ffa8f1a" paystack = Paystack(secret_key=p...
gidex19/signacode
my_app/pay.py
pay.py
py
474
python
en
code
0
github-code
6
485113359
import pytest from graph_pkg.edit_cost.edit_cost_proteins_tu import EditCostProteinsTU from graph_pkg.graph.label.label_node_proteins_tu import LabelNodeProteinsTU from graph_pkg.graph.node import Node @pytest.mark.parametrize('coord1, e_cost, expected', [ ((1,),...
CheshireCat12/graph_project
tests/unit_edit_cost/test_edit_cost_proteins_tu.py
test_edit_cost_proteins_tu.py
py
2,168
python
en
code
1
github-code
6
16480507143
"""Original from https://github.com/yhenon/pytorch-retinanet""" import torch import torch.nn as nn import numpy as np import skimage.io import skimage.transform import skimage.color import skimage from PIL import Image def comptue_dim(dim, padding, kernel_size, stride): return np.floor((dim + 2*padding - kerne...
sebastiani/pytorch-attention-augmented-convolution
utils/utils.py
utils.py
py
7,137
python
en
code
18
github-code
6
27016970830
from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) from django.utils.translation import ugettext_lazy as _ from GameFeb19_intro.models import add_currency, add_tokens, TRNSL_ERR_MSG, translated_languages import csv import random aut...
TatianaMayskaya/oTree
GameFeb19_questions_cognitive/models.py
models.py
py
4,609
python
en
code
0
github-code
6
71669765628
cricketer = { "VinayKumar": [102, 5], "Yuzvendra Chahal": [89, 10], "Sandeep Sharma": [95, 8], "Umesh Yadav": [85, 6], "BhuvaneswarKumar": [106, 10], "Basil Thampi": [70, 5] } for player, stats in cricketer.items(): runs_conceded, wickets_taken = stats bowling_average = runs_conceded / ...
Rjeyyy/PythonProgramming
Dictionaries/program5.py
program5.py
py
483
python
en
code
0
github-code
6
17270713471
import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_regression from mpl_toolkits import mplot3d # Training phase/ Training the LR model/ Find optimal weights def fit(X, y): """ X: Feature matrix: (n_samples, n_features) y: y_true: (n_samples,1) Returns: weights wei...
princeyyadav/CB-DS-LV-May21
DS/S13-linear-regression/viz.py
viz.py
py
1,905
python
en
code
0
github-code
6
26459920205
from __future__ import absolute_import from __future__ import division from __future__ import print_function from ..nnutils import geom_utils from ..nnutils import loss_utils from ..nnutils import train_utils from ..nnutils import discriminators from ..nnutils.smr import SoftRenderer from ..nnutils import cub_mesh_s1 ...
NVlabs/UMR
experiments/train_s1.py
train_s1.py
py
17,158
python
en
code
223
github-code
6
43077970864
from typing import Any, Callable, Dict, Optional, Type, Union from fugue.execution.execution_engine import ExecutionEngine, SQLEngine from fugue.execution.native_execution_engine import NativeExecutionEngine from triad.utils.convert import to_instance from triad import assert_or_throw, ParamDict class _ExecutionEngi...
ofili/Wrangle-and-Analyze-Data
venv/Lib/site-packages/fugue/execution/factory.py
factory.py
py
15,192
python
en
code
0
github-code
6
70037278908
import math from cmath import exp import numpy as np import pandas as pd from Operators import Operator, Density_Matrix, Observable from Many_Body import tensor_product from Nuclear_Spin import Nuclear_Spin, Many_Spins def h_zeeman(spin, theta_z, phi_z, B_0): """ Computes the term of the Hamiltonian associa...
DavideCandoli/PULSEE
Code/Hamiltonians.py
Hamiltonians.py
py
14,405
python
en
code
1
github-code
6
1130853243
# Get all positions around given point within 2 km circle. # ZHOU Kunpeng, 14 Dec 2018 from model import models from controller import utils # Get all positions around 2km range centered at given point class GetPositionsAround(): # params: longitude (float), latitude(float) # returns: a list of positions with...
wangtong2015/EnjoyWideWorld
back-end/EnjoyWideWorld/controller/map/mapDAOs.py
mapDAOs.py
py
3,048
python
en
code
0
github-code
6
18823308841
import random DESCRIPTION = "Find the greatest common divisor of given numbers." def find_gcd(x, y): while x and y: if x > y: x = x % y else: y = y % x gcd = str(x + y) return gcd def get_question_and_answer(): a = random.randint(1, 100) b = random.randin...
QQpy3ko/project-lvl1-s566
brain_games/games/brain_gcd.py
brain_gcd.py
py
436
python
en
code
0
github-code
6
39201428004
import cv2 import time import os import HandTrackingModule as htm from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException import time import socket import math import argparse from pymavlink import mavutil from time import sleep import numpy as np ###############################################...
2ashishmohan/Hand-Gesture-Controlled-Quadcopter-UAV
HandTrackingDemo.py
HandTrackingDemo.py
py
6,355
python
en
code
0
github-code
6
70096829629
import sys """ ์ด๋ถ„ ํƒ์ƒ‰ ๊ธฐ๋ฐ˜ ํ’€์ด ์‹œ์ž‘ ์ง€์ ์ด end๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์•„์งˆ ๋•Œ ๊นŒ์ง€ ์ง„ํ–‰ ์‹œ์ž‘์„ 1, ๋์„ ๋ - ์‹œ์ž‘์œผ๋กœ ์ง„ํ–‰. ๋‘˜ ๊ฐ„์˜ ๊ฑฐ๋ฆฌ๋ฅผ ์ตœ๋Œ€๋กœ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” middle๋ณด๋‹ค ์ปค์•ผํ•œ๋‹ค. x๋ฅผ ๊ฐฑ์‹ ํ•ด์„œ ๊ณต์œ ๊ธฐ ์œ„์น˜๋ฅผ ์กฐ์ •ํ•œ๋‹ค. cnt๊ฐ€ c๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™์„ ๊ฒฝ์šฐ -> ๊ณต์œ ๊ธฐ๋ฅผ ๋งŽ์ด ์„ค์น˜ํ•œ ์ผ€์ด์Šค -> start ์—…๋ฐ์ดํŠธ ํ•˜๊ณ , ans๋ฅผ middle๋กœ ์„ค์ • cnt๊ฐ€ c๋ณด๋‹ค ์ ์„ ๊ฒฝ์šฐ -> ๊ณต์œ ๊ธฐ๋ฅผ ์ ๊ฒŒ ์„ค์น˜ํ•œ ์ผ€์ด์Šค -> end ์—…๋ฐ์ดํŠธ """ n, c = map(int, sys.stdin.readline().split(" ")) house...
YooGunWook/coding_test
๋ฐฑ์ค€/๋ฐฑ์ค€_2110๋ฒˆ.py
๋ฐฑ์ค€_2110๋ฒˆ.py
py
1,031
python
ko
code
0
github-code
6
10702973519
'''from math import prod a=int(input()) for i in range(10,10001): if prod(list(map(int,str(i))))==a: print(i) break else: print("Not Possible") ''' n=int(input()) a=[] for i in range(n): a+=[int(input())] if n<2: print("Invalid Input") else: a.sort() if n == a.c...
hariss0411/Python-Codes
tcs_digital.py
tcs_digital.py
py
408
python
en
code
0
github-code
6
33145366381
def read(): file = open("PuzzleInput_9.txt", "r") dict = [] line_count = 0 for x in file.readlines(): x = x.strip() x = int(x) dict.append(x) line_count += 1 file.close() return dict dict = read() for x in range(25, len(dict)): check = False for y in ...
ArviWasTaken/AdventOfCode
src/main/python/2020/DAY_09/Code_9.py
Code_9.py
py
1,063
python
en
code
1
github-code
6
18405151031
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 12 17:56:03 2020 @author: mints """ import logging import itertools import joblib import warnings import numpy as np from astropy.utils.exceptions import AstropyUserWarning from pandas.core.common import SettingWithCopyWarning from semiphore_public....
minzastro/semiphore_public
fit/complete_fit.py
complete_fit.py
py
7,837
python
en
code
0
github-code
6
7165513164
# Answer to almostIncreasingSequence # https://app.codesignal.com/arcade/intro/level-2/2mxbGwLzvkTCKAJMG def almostIncreasingSequence(sequence): droppped = False last = prev = min(sequence) - 1 for elm in sequence: if elm <= last: if droppped: return False ...
CompetitiveCode/CodeSignal
Arcade/Intro/Edge of the Ocean/almostIncreasingSequence.py
almostIncreasingSequence.py
py
648
python
en
code
1
github-code
6
72579481788
from flask import Flask, request, redirect, url_for from flask_jsonpify import jsonify from flask import render_template from flask import abort from flask import Response from flask_api import status import json from flaskext.mysql import MySQL import pandas as pd import requests from datetime import datetime, timedel...
cotraak/weather-app-flask
app.py
app.py
py
4,277
python
en
code
0
github-code
6
70373498108
from typing import Optional, Any, Union, Callable import torch from torch import Tensor import torch.nn.functional as F from torch.nn.modules import Module from .linear import Linear from .normalization import LayerNorm from .activation import MultiheadAttention from .dropout import Dropout class TransformerEncoder...
S-Lab-System-Group/Hydro
hydro/fuse_ops/transformer.py
transformer.py
py
12,254
python
en
code
18
github-code
6
2929688634
""" Python script, Python v 2.7 written 1/30/17 by James Novakowski This script was developed to summarize anonymized claims data for Radial Analytics as part of a coding assessment. To run the script, the script file should be in the same folder as the data file, called "data.csv". The script will generate an outpu...
jamesnovakowski/python_examples_rsg
State_Summary_and_Utilization_Range_Summary.py
State_Summary_and_Utilization_Range_Summary.py
py
4,569
python
en
code
0
github-code
6
15426226201
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), 'classes')) from classes import data_manager from sklearn.neural_network import MLPClassifier, MLPRegressor from sklearn.pipeline import Pipeline from sklearn.model_selection import GridSearchCV from sklearn.ensemble import RandomForestRegressor f...
JaapvDijk/PredictTaskImpactNLP
classes/prediction_models.py
prediction_models.py
py
14,556
python
en
code
0
github-code
6
28428365301
import os from app import create_app if __name__ == '__main__': verify_token = os.getenv("VERIFY_TOKEN", None) access_token = os.getenv("ACCESS_TOKEN", None) url = os.getenv("URL", None) if not verify_token: raise Exception("verify_token not set") if not access_token: raise Excepti...
lolney/messenger-gpt2-chatbot
server/app.py
app.py
py
619
python
en
code
1
github-code
6
18834111771
# -*- coding: utf-8 -*- # Author๏ผšsen # Date๏ผš9090/3/94 10:48 from typing import List from heapq import * class Solution: def majorityElement(self, nums: List[int]) -> int: from collections import Counter counter = Counter(nums) for item in counter.items(): # item: (ๅ…ƒ็ด , ๆ•ฐ้‡) if ite...
PandoraLS/CodingInterview
ProgrammingOJ/LeetCode_python/169_ๅคšๆ•ฐๅ…ƒ็ด .py
169_ๅคšๆ•ฐๅ…ƒ็ด .py
py
892
python
en
code
2
github-code
6
22248410521
""" Very simple HTTP server in python for logging requests Usage:: ./server.py [<port>] """ from http.server import BaseHTTPRequestHandler, HTTPServer from urllib import parse import os import logging class S(BaseHTTPRequestHandler): def _set_response(self): self.send_response(200) self.send_he...
jacquesCedric/newWWP-server
listener/Listener.py
Listener.py
py
2,426
python
en
code
0
github-code
6
4072987057
#Lokaverkefni For3 #Hรถfundur: Jรณn Benediktsson #dags: 27.12.2017 from ctypes import * from random import randint import color_console as cons import sys #linkar #Print here commandiรฐ #https://rosettacode.org/wiki/Terminal_control/Cursor_positioning#Python #litir #https://www.burgaud.com/bring-colors-...
Mergjunarhola/TextBasedDungeonCrawler-1
Dungeoncrawler/GamePlayerV1.py
GamePlayerV1.py
py
15,523
python
en
code
0
github-code
6
35412611474
# Ces programmes sont sous licence CeCILL-B V1. # Provisoire : il faudrait crรฉer en python l'รฉquivalent de la classe # Isn pour la gestion du graphisme. Mes connaissances graphiques sont # assez limitรฉes, je me suis contentรฉ pour l'instant de quelque chose # de simple. # # Guillaume from tkinter import Tk,Frame,Butto...
OCamlPro/ISN-OCaml
chap5/DessinRecursif.py
DessinRecursif.py
py
2,138
python
fr
code
4
github-code
6
43317278578
# Scrapy settings for sci_abs project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-middleware...
RayFromUiS/sci_abs_scraper
sci_abs/sci_abs/settings.py
settings.py
py
5,479
python
en
code
0
github-code
6
22218777486
import director.tasks.robottasks as rt taskLibrary = [ ['utils', [ [rt.PrintTask, {}], [rt.UserPromptTask, {}], [rt.DelayTask, {}], [rt.PauseTask, {}], [rt.QuitTask, {}], ]], ['perception sensors', [ [rt.WaitForMultisenseLidar, {}], [rt.SnapshotMultisensePointcloud, {}], [rt.Sna...
RobotLocomotion/director
src/python/director/tasks/descriptions/taskLibrary.py
taskLibrary.py
py
1,505
python
en
code
176
github-code
6
30503616911
# Author: Ron Jones # Date Created: 7-3-17 # Date Last Modified: 7-4-17 # Purpose: Check CDS Overlay Excel Sheet with Master Data Sheet # Status: Working perfectly with MDS and CDS_Overlay_Final2.xlsx as of July 4, 2017 '''Note: The "compare dicts function iterates through every correct combination of entries from the...
NISTBoard/data_validation
Classified_Info_Script.py
Classified_Info_Script.py
py
3,365
python
en
code
0
github-code
6
3238678172
"""Contains the class system_objects. Used to compute systems of thermal objects. """ import copy from .. import solvers from . import Object class SystemObjects: """System_objects class. This class creates a system of unidimensional thermal objects, establishes contact between them and computes the r...
djsilva99/heatrapy
heatrapy/dimension_1/objects/system.py
system.py
py
11,858
python
en
code
51
github-code
6
39654407914
import os import logging import yaml from typing import Dict, Any from yacs.config import CfgNode as _CfgNode BASE_KEY = "__BASE__" class CfgNode(_CfgNode): @staticmethod def load_yaml_with_base(filename: str, allow_unsafe: bool = False): with open(filename, 'r') as file: ...
lqxisok/llSeg
configs/base.py
base.py
py
3,491
python
en
code
2
github-code
6
9649531902
class Node: def __init__(self,value): self.value=value self.left=None self.right=None def find_max(node): max1=max2=0 if not node: return -1 else: res=node.value if node.left: max1=find_max(node.left) if node.right: max2=find_max(node.right) ...
babiswas2020/Python
tree_54.py
tree_54.py
py
651
python
ru
code
0
github-code
6
71927845947
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals import logging import sys import os import urlparse import xbmcgui import xbmcplugin import xbmcaddon from resources.lib import loghandler loghandler.config() LOG = logging.getLogger() PLUGIN_PATH = 'plu...
croneter/plugin.video.proof-of-concept
default.py
default.py
py
2,070
python
en
code
1
github-code
6
22514895256
#!/usr/bin/env python3 from fastapi import APIRouter, Body, Request, Response, HTTPException, status from bson.objectid import ObjectId from typing import List from lib.mongo import insert_one, find_one, find_many, update_one from models.prescription import Prescription, PrescriptionUpdate router = APIRouter() coll ...
Serlych/national-medical-record
routes/prescription.py
prescription.py
py
1,582
python
en
code
0
github-code
6
13126886716
from itertools import combinations def make_all_cases(user_info_array): all_cases_from_user = []; for i in range(5): combination_array = combinations([0,1,2,3],i) for combination in combination_array: case = "" #[] -> ---- for j in range(4): ...
39world/Today-Algorithm-Study-
old_test/al_pg_08.py
al_pg_08.py
py
2,005
python
en
code
0
github-code
6
41040069910
from tracemalloc import start import pyaudio import wave import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.ticker import * import numpy as np import struct import time from scipy import interpolate plt.style.use('gray-background') class Fourier: def __init__(self, scale, dt)...
MoeMatsuda-ai/SWVC
test/fft_live_test/inout_live.py
inout_live.py
py
3,531
python
en
code
0
github-code
6
31653995407
#!/usr/local/bin/python3 from priority_queue import * from graph_adt import * def dijkstra(G, s): """ Performs Dijktra's algorithm to find the shortest path from a single source to all other vertices in a weighted graph. Parameters: G - Graph represented with an adjacency list mapping the vertice...
ilee38/practice-python
graphs/dijkstra.py
dijkstra.py
py
2,316
python
en
code
0
github-code
6
20250267652
from mimetypes import init import requests import urllib.parse import json class MapBox: def __init__(self, access_token) -> None: self.root_url = "https://api.mapbox.com/geocoding/v5/mapbox.places/{}.json?types=place%2Caddress%2Cregion&access_token={}" self.access_token = access_token def get...
andrewhuang427/WashU-Athletics-Demographics
utils/MapBox.py
MapBox.py
py
1,369
python
en
code
0
github-code
6
35041229962
from toscaparser.imports import ImportsLoader from configuration_tool.common import utils from configuration_tool.common.configuration import Configuration from configuration_tool.common.tosca_reserved_keys import * from configuration_tool.providers.common.provider_configuration import ProviderConfiguration from conf...
sadimer/clouni_configuration_tool
configuration_tool/providers/common/tosca_template.py
tosca_template.py
py
22,563
python
en
code
0
github-code
6
32659197304
from werkzeug.exceptions import ClientDisconnected from flask import Flask, request from flask import current_app from flask_cache import Cache from mongoengine import connect from flask_superadmin import Admin from flask_mail import Mail from flaskext.markdown import Markdown from flask_restful import Api from rever...
JunctionAt/JunctionWWW
constructor.py
constructor.py
py
4,126
python
en
code
1
github-code
6
477748253
import torch as t import ipdb class AttentionPooling(t.nn.Module): def __init__(self, input_size, hidden_size, dropout): super(AttentionPooling, self).__init__() self.projection1 = t.nn.Linear(input_size, hidden_size, bias=True) self.dropout = t.nn.Dropout(dropout) self.projection2...
CNDPlab/MSMARCO_Reshaped
Predictor/ModelUtils/query_pooling.py
query_pooling.py
py
1,316
python
en
code
1
github-code
6
18716841287
#! /user/bin/env python # -*- coding:utf-8 -*- ''' ็ˆฌๅ–ๅˆ—่กจไฟกๆฏ ''' import json from scrapy.http import Request from scrapy.spiders import CrawlSpider from douyin.items import DouyinCategoryItem class categorySpider(CrawlSpider): name = 'categorySpider' redis_key = 'categorySpider' cursor_num = 0 coun...
gisShield/douyin
douyin/spiders/categoryspider.py
categoryspider.py
py
2,313
python
en
code
24
github-code
6
73027828029
import senticnet5 as sent_dict import pandas as pd import numpy as np from itertools import islice from sklearn.model_selection import train_test_split import re # returns numpy array def get_ratings(ratings_filename): return np.load(ratings_filename) # returns array of document arrays with words def get_review...
jgombac/RatingPredictor
simple_sentiment.py
simple_sentiment.py
py
4,427
python
en
code
0
github-code
6
41400484106
#!/usr/bin/env python3 __author__ = 'smw' __email__ = 'smw@ceh.ac.uk' __status__ = 'Development' import os import sys import arcpy import timeit start = timeit.default_timer() lcm_vector = r'E:\land-cover-map\data\LCM2015_GB.gdb\lcm2015gbvector' print('\n\nlcm_vector:\t\t{0}'.format(lcm_vector)) shp_folder = r'E:\...
smwCEH/land-cover-map-clipping
multi-clip.py
multi-clip.py
py
2,658
python
en
code
0
github-code
6
71177753467
from math import * from operator import concat from random import randint, random, choice, uniform import colorsys import pysvg.structure import pysvg.builders img_side = 1024 img_xmid = img_side/2 img_ymid = img_side/2 starting_rad = 128 class Circle: __slots__ = ('x', 'y', 'rad', 'depth') def __init__(self, ...
bitbanger/algoart
angletree.py
angletree.py
py
2,549
python
en
code
13
github-code
6
37226419252
N = int(input()) A = list(map(int, input().split())) MaxVal = 0 for l in range(N): for m in range(l+1, N+1): x = min(A[l:m]) * (m - l) if x > MaxVal: MaxVal = x print(MaxVal)
konamilk/atcoder-abc189
C.py
C.py
py
211
python
en
code
0
github-code
6
37392717665
import streamlit as st import requests,random,time from deta import Deta deta = Deta(st.secrets['key']) # Base key db= deta.Base("usernames") st.set_page_config(page_title="Github Shoutout",page_icon="images/githublogo.png",layout="centered",initial_sidebar_state="auto") # setting the page config def ver...
samadpls/Github-Shoutout
app.py
app.py
py
4,179
python
en
code
10
github-code
6
692617342
#!/usr/bin/python import keras_ocr import sys if __name__ == "__main__": image_filepath = sys.argv[0] recognizer = keras_ocr.recognition.Recognizer() recognizer.compile() recognizer.model.load_weights('./assets/dataset/trained_recognizer.h5') predicted = recognizer.recognize(image_filepath...
prakashsellathurai/ML-ASSIGNMENT-IDfy
predict.py
predict.py
py
358
python
en
code
0
github-code
6
29836585751
# #Unzip the test directory # !unzip drive/My\ Drive/CatVSDog/test1.zip # #Unzip the train directory # !unzip drive/My\ Drive/CatVSDog/train.zip # Plotting the images of dog import shutil from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import ModelCheckpoint from keras.layers import Dense ...
mcaupybugs/CatsVSDogs
catvsdog.py
catvsdog.py
py
4,994
python
en
code
0
github-code
6
25066459905
from django.contrib.auth import mixins from oauth2_provider.contrib.rest_framework import ( OAuth2Authentication as BaseOAuth2Authentication, ) from purplship.server.core.authentication import ( JWTAuthentication, TokenAuthentication, get_request_org, ) class OAuth2Authentication(BaseOAuth2Authentica...
danh91/purplship
insiders/server/iam/purplship/server/iam/authentication.py
authentication.py
py
1,109
python
en
code
null
github-code
6
4956999019
import sys def herdle(): puzzle_answer = [] puzzle_guess = [] def split_into_chars(string): res = [] for char in string: res.append(char) return res answer_as_oned = [] for _ in range(3): temp = sys.stdin.readline().strip() splitted = split_int...
jjliewie/usaco-jan-bronze-2022
herdle-answer.py
herdle-answer.py
py
1,116
python
en
code
3
github-code
6
29916785411
import unittest from livecli.plugins.vgtv import VGTV class TestPluginVGTV(unittest.TestCase): def test_can_handle_url(self): should_match = [ "http://ap.vgtv.no/webtv/video/114339/tempo-sport-motorsykkelen-som-gjenoppstod", "http://ap.vgtv.no/webtv#!/video/114339/tempo-sport-moto...
ariesw/livecli
tests/test_plugin_vgtv.py
test_plugin_vgtv.py
py
828
python
no
code
0
github-code
6
26632967906
import collections import math import socket DEF_MACADDR = ['2VTX', '2VR7', '2ZX7', '2VN8'] # This class read data from watches via UDP. class watchData(object): def __init__(self, ip, port, watch_num, watch_queue): self.ip = ip self.port = port self.sock = socket.socket(socket.AF_INET, s...
jianwuesp/Registration
watch.py
watch.py
py
1,108
python
en
code
0
github-code
6
34540343891
import argparse import sys from operator import add import os import shlex import shutil from subprocess import Popen, PIPE from pyspark import SparkContext, SparkConf import pyspark.serializers import subprocess import boto3 import re global parser_result if sys.version > "3.4": pyspark.serializers.protocol = 4 ...
VCCRI/Falco
source/spark_runner/run_pipeline_alignment.py
run_pipeline_alignment.py
py
15,126
python
en
code
37
github-code
6
43855241031
import os import matplotlib.pyplot as plt import numpy as np import torch from torch import nn import torch.optim as optim import torchvision from torchvision import transforms, models, datasets import imageio import time import warnings import random import sys import copy import json from PIL import Image #########...
harryjd/keras_dogs_vs_cats
ๅ›พๅƒ่ฏ†ๅˆซ_ไปฟๅ†™ๅ”ๅฎ‡่ฟช็š„ไพ‹ๅญ.py
ๅ›พๅƒ่ฏ†ๅˆซ_ไปฟๅ†™ๅ”ๅฎ‡่ฟช็š„ไพ‹ๅญ.py
py
14,465
python
en
code
0
github-code
6
8385118921
from __future__ import absolute_import from __future__ import print_function import os import sys import subprocess import optparse from collections import namedtuple if 'SUMO_HOME' in os.environ: tools = os.path.join(os.environ['SUMO_HOME'], 'tools') sys.path.append(tools) import sumolib # noqa else: ...
ngctnnnn/DRL_Traffic-Signal-Control
sumo-rl/sumo/tools/tlsCoordinator.py
tlsCoordinator.py
py
12,854
python
en
code
17
github-code
6
24337846458
# -*- coding: utf-8 -*- import os import sys import shutil import datetime import numpy as np from sklearn.model_selection import train_test_split from PIL import Image from keras import models from keras import layers from keras import optimizers from keras import regularizers from keras import backend...
jabez128/dl-trafficsigns-detection
classifier.py
classifier.py
py
5,975
python
en
code
3
github-code
6
22982145642
import sys import json import os import io import collections import argparse import logging from e2edutch import conll from e2edutch import minimize from e2edutch import util from e2edutch import coref_model as cm from e2edutch import naf import tensorflow.compat.v1 as tf logger = logging.getLogger('e2edutch') cl...
Filter-Bubble/e2e-Dutch
e2edutch/predict.py
predict.py
py
7,163
python
en
code
9
github-code
6
38684469232
# pylint: disable=attribute-defined-outside-init,wrong-import-order,redefined-outer-name,invalid-name import gc from configparser import ConfigParser from tempfile import TemporaryDirectory import magic import pytest from storage.binary_service import BinaryService from storage.db_interface_backend import BackEndDbI...
5am1i/Fact
src/test/integration/storage/test_binary_service.py
test_binary_service.py
py
2,626
python
en
code
0
github-code
6
26169526568
import argparse import json import os import time import torch from redsandt.encoder.bert_encoder import BERTEncoder from redsandt.framework.bag_re import BagRE from redsandt.selector.bag_attention import BagAttention # Pass arguments parser = argparse.ArgumentParser( description='Improving Distantly-Supervised ...
DespinaChristou/REDSandT
redsandt.py
redsandt.py
py
4,210
python
en
code
22
github-code
6
38827999454
import random import qrcode import qrcode.image.svg from io import BytesIO from django.shortcuts import render from django.views.generic import View class IndexView(View): def get(self, request, *args, **kwargs): template = 'index.html' return render( request, template, ...
AbrahamAdekunle/Bashir_abraham_ERP
bar_qr_code/views.py
views.py
py
1,087
python
en
code
0
github-code
6
25823990802
import numpy as np import pygame import constants class Driver(object): """ This class implements the car's driver: visibility, controls etc. """ def __init__(self, view_distance=constants.MAX_VIEW_DISTANCE, view_resolution=constants.VIEW_RESOLUTION, ...
vuolleko/FormulaPF
driver.py
driver.py
py
9,079
python
en
code
0
github-code
6
21216112261
import requests NEWS_ENDPOINT = "https://newsapi.org/v2/everything" NEWS_API_KEY = 'caa8a3621a5e481c96807e77fe1dfc91' news_params = { 'q': "Tesla Inc", 'apiKey': NEWS_API_KEY } response = requests.get(url=NEWS_ENDPOINT, params=news_params) response.raise_for_status() data = response.json()["articles"] articl...
myoaung99/Stock-news
eg.py
eg.py
py
390
python
en
code
0
github-code
6
16104415512
import RPI.GPIO as GPIO import os import time #GPIO mode (BOARD/BCM) GPIO.setup(GPIO.BOARD) TO_BUTTON = 32 FROM_BUTTON = 33 GPIO.setup(TO_BUTTON, GPIO.OUT) GPIO.setup(FROM_BUTTON, GPIO.IN) GPIO.output(TO_BUTTON, False) GPIO.output(FROM_BUTTON, False) while 1: GPIO.output(TO_BUTTON, True) #Ca...
iamjoelgeorge/AssistanceForTheBlind
Obstacle Detection/face_recog.py
face_recog.py
py
462
python
en
code
0
github-code
6
31266417589
import pygame import os from tkinter import messagebox import time import threading pygame.init() pygame.mixer.set_num_channels(20) width = 150 height = 151 channel = 0 stop_music = False fon_m = pygame.mixer.music fon_m.load(os.path.join("sounds", "fon_m.mp3")) fon_m.play() fon = pygame.image.load(os.path.join("imag...
solvalkon/python_study
my single monsters/my single monsters class.py
my single monsters class.py
py
26,982
python
en
code
0
github-code
6
29157621722
# -*- coding: utf-8 -*- import logging import aiogrpc class AsyncPluginManager: """ Connects to a running mavsdk server or starts one and manages plugins """ @classmethod async def create(cls, host, port=50051): self = AsyncPluginManager() self.host = host self.port = por...
mavlink/MAVSDK-Python
mavsdk/async_plugin_manager.py
async_plugin_manager.py
py
1,162
python
en
code
246
github-code
6
40607525974
''' ETTTP_Client_skeleton.py 34743-02 Information Communications Term Project on Implementation of Ewah Tic-Tac-Toe Protocol Skeleton Code Prepared by JeiHee Cho May 24, 2023 ''' import random import tkinter as tk from socket import * import _thread from ETTTP_TicTacToe import TTT, check_msg if...
seung-eon/TicTacToe
ETTTP_Client.py
ETTTP_Client.py
py
1,681
python
en
code
0
github-code
6
23065976802
import numpy as np import os, sys, math import pandas as pd import dash #import dash_core_components as dcc from dash import dcc #import dash_html_components as html from dash import html from dash.dependencies import Input, Output import plotly.graph_objs as go class Obstacle(): def __init__(self, ...
ArmanAstud/3D_detection_visualizer
scripts/utils.py
utils.py
py
4,363
python
en
code
0
github-code
6
35818166590
import sublime import os import platform import re import subprocess class MergedSettings(): def __init__(self): # This is a Sublime settings object. self.plugin = sublime.load_settings("GoTools.sublime-settings") # This is just a dict. self.project = sublime.active_window().active_view().settings()....
uraza/GoTools
gotools_settings.py
gotools_settings.py
py
4,663
python
en
code
null
github-code
6
25068490855
from typing import Tuple, List from asendia_us_lib.shipping_rate_request import ShippingRateRequest from asendia_us_lib.shipping_rate_response import ShippingRate from purplship.core.units import Packages, Services, Options from purplship.core.utils import Serializable, DP, NF from purplship.core.models import ( Ra...
danh91/purplship
sdk/extensions/asendia_us/purplship/providers/asendia_us/rate.py
rate.py
py
2,301
python
en
code
null
github-code
6