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
36840895879
from __future__ import absolute_import, print_function, unicode_literals import argparse import os import sys import yaml # Get relative imports to work when the package is not installed on the PYTHONPATH. if __name__ == "__main__" and __package__ is None: sys.path.append(os.path.dirname(os.path.dirname(os.path.a...
mongodb/mongo
buildscripts/validate_mongocryptd.py
validate_mongocryptd.py
py
2,966
python
en
code
24,670
github-code
36
24793074519
import subprocess import optparse def help(): print("COMMAND USE") print("help: Shows a list of options") print("list modules (-m) Shows a list of modules (-m gives more info)") print("exit: Exits the program") print("ip: I...
Calebh07/py-shell
pyshell/pyshell.py
pyshell.py
py
1,870
python
en
code
0
github-code
36
40252501760
import heapq import sys input = sys.stdin.readline # 무한을 의미하는 값으로 10억을 설정 INF = int(1e9) def dijkstra(start) : # 최단 거리 테이블을 모두 무한으로 초기화 distance = [INF] * (n + 1) q = [] # 시작 노드로 가기 위한 최단 거리는 0으로 설정하여 큐에 삽입 heapq.heappush(q, (0, start)) distance[start] = 0 # 큐가 비어있지 않다면 ...
parksjsj9368/TIL
ALGORITHM/BAEKJOON/SOURCE/10. Dijkstra(다익스트라)/4. 미확인 도착지.py
4. 미확인 도착지.py
py
2,071
python
ko
code
0
github-code
36
22782490438
# # @lc app=leetcode id=1200 lang=python3 # # [1200] Minimum Absolute Difference # # https://leetcode.com/problems/minimum-absolute-difference/description/ # # algorithms # Easy (67.26%) # Likes: 896 # Dislikes: 42 # Total Accepted: 82K # Total Submissions: 120.5K # Testcase Example: '[4,2,1,3]' # # Given an arr...
Zhenye-Na/leetcode
python/1200.minimum-absolute-difference.py
1200.minimum-absolute-difference.py
py
1,608
python
en
code
17
github-code
36
33103159641
from pico2d import * import server class Background: image = None def __init__(self, x=0, y=0, code=0): if Background.image is None: self.image = [load_image('map/mayreel_block_grass_1_400.png'), load_image('map/mayreel_block_grass_3_400.png'), ...
graybeeer/DRILL
MayreelRun2/background.py
background.py
py
2,241
python
en
code
0
github-code
36
34219146493
from __future__ import absolute_import, unicode_literals, division, print_function """Scrape contacts from a Google email account. Usage: - First, you need an OAuth2 access token. Run e.g. $ python2 oauth.py --client_id="..." --client_secret="..." --user=jdoe@example.com --generate_oauth2_token - Open the URL in a ...
kelleyk/imap-scripts
imap_scripts/get_correspondents.py
get_correspondents.py
py
6,133
python
en
code
0
github-code
36
29779906740
""" This program finds the smallest divisor of a given natural number n greater than 1. """ def lowest_divider(num): for symbol in range(num + 1, 1, -1): if num % symbol == 0: divider = symbol return divider number = int(input("Введите число: ")) lcd = lowest_divider(number) print(f"Наиме...
AfoninSV/python_scripts
smallest_divisor.py
smallest_divisor.py
py
411
python
ru
code
0
github-code
36
16521824851
###read training peptide input import sys, os, re from collections import OrderedDict def readtrainfile(length, trainfile_peptide): if os.path.exists(trainfile_peptide) == False: print('Error: "' + trainfile_peptide + '" does not exist.') sys.exit(1) upscaleAA = ['A', 'R', 'N', 'D', '...
17shutao/Anthem
bin/sware_j_newreadfiletrain.py
sware_j_newreadfiletrain.py
py
3,542
python
en
code
7
github-code
36
38382134162
import ctypes from libarsdkctrl_bindings import ( arsdk_ctrl_destroy, arsdk_ctrl_new, arsdk_ctrl_set_device_cbs, struct_arsdk_ctrl, struct_arsdk_ctrl_device_cbs, struct_pomp_loop, ) class ArsdkCtrl: def __init__(self, loop, device_handler): self._loop = ctypes.cast(loop, ctypes.PO...
Parrot-Developers/arsdk-ng
libarsdkctrl/python/internal/arsdkctrl.py
arsdkctrl.py
py
1,652
python
en
code
2
github-code
36
72717961063
#!/usr/bin/env python3 """ Experiment with different parameters the CNN training and collect accuracy Quick and dirty adaptation from train.py. Search `TUNING` in this code for hard coded parameters to try. [Code left as is, not cleaned, to explicit what I've tried...] """ import os import pickle import argpars...
jmg-74/exam
flowers/stats.py
stats.py
py
5,713
python
en
code
1
github-code
36
18672719269
import json import logging from selenium.webdriver.common.by import By from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.chrome.options import Options from selenium import webdriver from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.support.ui import WebD...
rnjacky777/automation_framework
core_framework/core_framework.py
core_framework.py
py
1,742
python
en
code
0
github-code
36
14263034544
from pwn import * """ How to: Unknown register??? Check here and keep in mind that anything below 32 means the last x (16,8,4) bits https://en.wikibooks.org/wiki/X86_Assembly/X86_Architecture Check the file for security features checksec --file=<binary> #Chec...
sparky23172/BinaryExploitation
ROP_Emporium/fluff/32/exploit.py
exploit.py
py
11,426
python
en
code
1
github-code
36
74050765224
import unittest import parlai.utils.testing as testing_utils WOW_OPTIONS = { 'task': 'wizard_of_wikipedia:Generator', 'prepend_gold_knowledge': True, 'model': 'image_seq2seq', 'model_file': 'zoo:dodecadialogue/wizard_of_wikipedia_ft/model', 'datatype': 'valid', 'batchsize': 16, 'inference'...
facebookresearch/ParlAI
tests/nightly/gpu/test_dodeca.py
test_dodeca.py
py
2,141
python
en
code
10,365
github-code
36
9587814547
import os import subprocess from plugin import LINUX, WINDOWS, plugin, require VALID_OPTIONS = ['status', 'vendor', 'energy', 'technology', 'remaining'] @require(platform=WINDOWS) @plugin('battery') def battery_WIN32(jarvis, s): """ Provides basic info about battery for win32 """ # https://stackover...
sukeesh/Jarvis
jarviscli/plugins/battery.py
battery.py
py
3,633
python
en
code
2,765
github-code
36
4611588859
from flask_assets import Bundle from webassets.filter import get_filter from app import assets ################ ### Landing ### ################ landing_js = Bundle( 'js/jquery.min.js', 'scripts/config-prod.js', 'scripts/landing.js', output='bundles/js/landing.js' ) logged_js = Bundle( ...
arslnb/tidystory
app/methods/bundles.py
bundles.py
py
496
python
en
code
0
github-code
36
31450587892
def sum (c): s = 0 for i in c: s= s+i return s def multi (d): x =1 for i in d: x = x*i return x print (sum ([1,2,3,4])) print (multi ([1,2,3,4]))
Bedoya1123/pycharm
5.py
5.py
py
188
python
en
code
0
github-code
36
38633646472
#imports import numpy as np import pandas as pd import matplotlib.pyplot as plt from main import number_of_pendulums class Plotting(): def __init__(self, pendulum_number, pendulum_list, dataframe, y): self.pendulum_number = pendulum_number self.pendulum_list = pendulum_list self.da...
EdwardTAllen/Damped-pendulum
plotting_methods.py
plotting_methods.py
py
1,213
python
en
code
0
github-code
36
2022759755
import logging as log import math from itertools import islice import torch from nltocode.dataset import EdgePathTransform from nltocode.grammar.grammargraphvisitor import GrammarGraphVisitor class BeamSearch(): def __init__(self, model, grammargraph, codegener...
SmartDataAnalytics/codeCAI
nl2codemodel/src/nltocode/beamsearch.py
beamsearch.py
py
13,758
python
en
code
4
github-code
36
27232603168
import curses from ..config import CORRECT_LETTER_COLOR_PAIR_INDEX, EXISTS_LETTER_COLOR_PAIR_INDEX, INCORRECT_LETTER_COLOR_PAIR_INDEX, NORMAL_LETTER_COLOR_PAIR_INDEX, TILE_SIZE from .screen import apply_color_pair, remove_color_pair def generate_game_element(letter, correct=False, exists_in_answer=False, incorrect=F...
Samoray-l337/terminal-wordle
src/utils/game.py
game.py
py
3,334
python
en
code
1
github-code
36
25985906594
import stanza import json from tqdm import tqdm import os def save_as_json(objects, fname): with open('data/'+fname, 'w') as output: json.dump(objects, output, indent=4) nlp = stanza.Pipeline(lang='en', processors='tokenize,mwt,pos,lemma', logging_level='DEBUG') fiction_list = [_ for _ in os.listdir("inpu...
scarletcho/coca-fiction-search
sentence-tokenize.py
sentence-tokenize.py
py
793
python
en
code
0
github-code
36
8012246671
from __future__ import absolute_import, print_function, division import numpy as np import random from math import ceil from collections import OrderedDict import tensorflow as tf from deepmedic.neuralnet.pathwayTypes import PathwayTypes as pt from deepmedic.neuralnet.pathways import NormalPathway, SubsampledPathway,...
ZerojumpLine/OverfittingUnderClassImbalance
DeepMedic/deepmedic/neuralnet/cnn3d.py
cnn3d.py
py
39,012
python
en
code
21
github-code
36
13987341918
class Trie: def __init__(self): self.child = dict() self.is_word = False def insert(self, word): if len(word) == 0: self.is_word = True else: c = word[0] if c not in self.child: self.child[c] = Trie() self.child[c]....
dariomx/topcoder-srm
leetcode/first-pass/facebook/implement-trie-prefix-tree/SolutionRec.py
SolutionRec.py
py
802
python
en
code
0
github-code
36
73478586985
from pprint import pformat from six import iteritems class PITimedValues(object): swagger_types = { 'items': 'list[PITimedValue]', 'units_abbreviation': 'str', 'web_exception': 'PIWebException', } attribute_map = { 'items': 'Items', 'units_abbreviation': 'UnitsAbbreviation', 'web_exception': 'WebExcep...
dcbark01/PI-Web-API-Client-Python
osisoft/pidevclub/piwebapi/models/pi_timed_values.py
pi_timed_values.py
py
2,018
python
en
code
39
github-code
36
34321829332
#-*- coding: utf-8 -*- from django.db import models from django.db.models import Max from .category import Category class Product(models.Model): category = models.ForeignKey(Category, related_name="products", null=True, blank=True, on_delete=models.SET_NULL) name = models.CharField(db_index=True, max_leng...
anttiranta/sirkkapelkonen.net-python
app/www/models/www/product.py
product.py
py
1,737
python
en
code
0
github-code
36
33197438917
from __future__ import print_function import sys import time from optparse import OptionParser import ezdxf __version__ = "0.1" class Stitcher(object): def __init__(self, input_name, output_name): self.old = ezdxf.readfile(input_name) self.new = ezdxf.new() self.output_name = output_nam...
thatch/dxf_fix
dxf_fix/__init__.py
__init__.py
py
7,096
python
en
code
1
github-code
36
70376883625
import requests from random import randrange from randomWalk import dateIncrease from olivier import find_arrival def chooseDestination_new (depart , budget , date , dayspercity=2 , country = 'CH' , currency = 'CHF', locale = 'en-GB' , destination = 'anywhere' ) : url = 'http://partners.api.skyscanner.net/apiservi...
ttreyer/Skyscanner-CONpagnons
newgetters.py
newgetters.py
py
4,427
python
en
code
0
github-code
36
27550324610
import datetime from imap_tools import EmailAddress DATA = dict( subject='Re: TESTテストテスト', from_='atsushi@example.com', to=('rudeboyjet@gmail.com',), cc=(), bcc=(), reply_to=('rudeboyjet@gmail.com',), date=datetime.datetime(2011, 8, 19, 10, 47, 17, tzinfo=datetime.timezone(datetime.timedelt...
ikvk/imap_tools
tests/messages_data/rfc2822/example14.py
example14.py
py
1,236
python
en
code
608
github-code
36
37662338422
import os import setuptools requirement_files = [] # walk the requirements directory and gather requirement files for root, dirs, files in os.walk('requirements'): for requirements_file in files: requirements_file_path = os.path.join(root, requirements_file) requirement_files.append(requirements_...
rackerlabs/poppy
setup.py
setup.py
py
874
python
en
code
null
github-code
36
36771356783
# -*- coding: utf-8 -*- """Training KGE models based on the sLCWA.""" import logging from typing import Any, Mapping, Optional, Type import torch from torch.optim.optimizer import Optimizer from pykeen.training.training_loop import TrainingLoop from pykeen.training.utils import apply_label_smoothing from pykeen.los...
migalkin/NodePiece
inductive_lp/loops/inductive_slcwa.py
inductive_slcwa.py
py
6,454
python
en
code
131
github-code
36
37432459091
import pygame as pg import sys from settings import * from player import * from world_object_manager import * from ray import * from ray_manager import * from object_renderer import * class Game: def __init__(self): pg.init() pg.mouse.set_visible(False) self.screen = pg.disp...
makaempffer/game_2d_DOS
Dawn_Of_The_system/src/main.py
main.py
py
1,826
python
en
code
0
github-code
36
23958671415
from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities.types import EVAL_DATALOADERS, TRAIN_DATALOADERS from torch.utils.data import DataLoader, Dataset class BasicDataModule(LightningDataModule): def __init__( self, train_dataset: Dataset, val_dataset: Dataset,...
adamcasson/minT5
mint5/datamodule.py
datamodule.py
py
1,165
python
en
code
0
github-code
36
44008043108
import pygame # import twitter from pygame.locals import * from io import BytesIO import urllib.request as ur pygame.init() alotfiles = "D:\\Users\\Charles Turvey\\Pictures\\Art\\Alots\\" alotpath = alotfiles + "Blank.png" alot = pygame.image.load_extended(alotpath) w = alot.get_width() h = alot.get_height() lft =...
ninjafrostpn/PythonProjects
Alotter.py
Alotter.py
py
3,066
python
en
code
0
github-code
36
36082506802
""" Gradient Penalty implementation for WGAN-GP """ import torch import torch.nn # Define the gradient penalty for Wasserstein GAN # Implementation as is in paper def gradient_penalty(critic, real, fake, device): BATCH_SIZE, C, H, W = real.shape epsilon = torch.rand((BATCH_SIZE, 1, 1, 1)).repeat(1, C, H, W)...
EoinM96/pokeGAN
utils.py
utils.py
py
885
python
en
code
1
github-code
36
30677005666
#--------------------import some mould-------------# from flask import Flask ,render_template,request,redirect,url_for,flash,session import os import mysql.connector db=mysql.connector.connect( host="localhost", user="root", password="1889", database="AirPort" ) #----------StartProject------------# #l...
zakariyae1889/AirportWeb
Views.py
Views.py
py
19,623
python
en
code
1
github-code
36
34398023581
import shutil import torch from dataset import * from utils import * from settings_benchmark import * from dataset import writer from torch.utils.tensorboard import SummaryWriter all_dataset = prepareDatasets() print(f"Models: {[name for name in models]}") print(f"Datasets: {[name for name in all_dataset]}") # 自检:...
nhjydywd/OCTA-FRNet
run_benchmark.py
run_benchmark.py
py
6,001
python
en
code
5
github-code
36
34338733292
# https://leetcode.com/problems/substring-with-concatenation-of-all-words/ class Solution(object): def findSubstring(self, s, words): """ :type s: str :type words: List[str] :rtype: List[int] """ if not words: return [] word_len = len(words[0]) ...
0x0400/LeetCode
p30.py
p30.py
py
944
python
en
code
0
github-code
36
19876279061
import sys import os from setuptools import setup, find_packages, Extension # Import setupext ONLY if you want custom triggers # If you only use prep_cmd, you only need to include setupext in the package # import setupext os.chdir(os.path.dirname(sys.argv[0]) or ".") ''' =============================================...
sundarnagarajan/setupext
setup.py
setup.py
py
4,594
python
en
code
1
github-code
36
39885722953
class Stack(object): def __init__(self,size): self.stack = [] self.size = size self.top = -1 def InStack(self,data): if self.Full(): print("The stack is Full") else: self.stack.append(data) self.top = self.top + 1 def OutStack(self,...
glinyang/Workfolder
Python小练习/Stack.py
Stack.py
py
965
python
en
code
0
github-code
36
3082899587
# import ast # reads each line from file into a list with open('protocol_test.txt') as f: # lines = [ast.literal_eval(line.rstrip()) for line in f] lines = [eval(line.rstrip()) for line in f] # print(lines) # print("\n") # can work on fixing pipette + tiprack assignment later labware = [ ("labware...
mi929lee/open-recipe
spring_2021/week_13/file_converter.py
file_converter.py
py
1,291
python
en
code
0
github-code
36
33981754058
# # https://www.youtube.com/watch?v=bD05uGo_sVI&list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU&index=36 # ''' # Generators - How to use them and the benefits you receive # Generator will not hold any value while printing hence it is good for performance - it is just holding current value from the loop # ''' import memory_pro...
techtolearn/Learning
Cory_Basic/Prg36_generatroPerfomance.py
Prg36_generatroPerfomance.py
py
1,634
python
en
code
0
github-code
36
13650180009
''' openweathermap.org api_key = f54b13c3c6ecf6d1d51c6be402b095dc https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key} ''' import requests APP_ID = "f54b13c3c6ecf6d1d51c6be402b095dc" # response = requests.get('https://google.com') # print(response) def getWeatherData(lat, lon): ...
moduchobo/mj_metrooo
MyApp/realtimeWeather 2.py
realtimeWeather 2.py
py
592
python
en
code
0
github-code
36
17096876917
# aula 3 Exercício 1 – Foram vendidas 50 peças de roupa. De cada peça #foram coletados os seguintes dados: tamanho (P,M ou G) e cor #(branco, preto ou azul). O programa deve ler os dados das peças #de roupas e organizá-los em uma lista de tuplas, onde cada tupla #é da forma (tamanho, cor). O programa deve ainda calcula...
pedroivoadv/Pucrs
logicaprogramacao01/aula08/atividadeaula5.py
atividadeaula5.py
py
1,181
python
pt
code
0
github-code
36
23111160181
from rest_framework.exceptions import APIException from django.db.models import Q from stock_maintain.models import PriceList, QuarterlyFinancial, DividendInformation from stock_setup_info.models import Stock, StockManagement def get_stock_by_code(query_params): """ Get stock by the stock code provided""" t...
Maxcutex/stockman_project
stock_setup_info/services.py
services.py
py
7,473
python
en
code
2
github-code
36
41019512289
import re from django.views.generic.base import TemplateView from natsort import humansorted from ..conf import settings from ..utils import get_branches from ..utils import get_tags regex_hotfix = re.compile(settings.RELEASE_DASHBOARD_FILTER_MRXXX) regex_mr = re.compile(r"^mr.+$") def _projects_versions( proj...
sipwise/repoapi
release_dashboard/views/__init__.py
__init__.py
py
1,627
python
en
code
2
github-code
36
1597831218
import numpy as np import astropy.units as u from astropy.time import Time from astropy.table import QTable import sys if '/home/serafinnadeau/Python/packages/scintillometry/' not in sys.path: sys.path.append('/home/serafinnadeau/Python/packages/scintillometry/') from numpy.lib.format import open_memmap import os...
Seraf-N/SinglePulseTasks
single_pulse_task/StreamSearch_utils.py
StreamSearch_utils.py
py
10,765
python
en
code
2
github-code
36
6070168800
# encoding=utf-8 ''' Author: Haitaifantuan Create Date: 2020-09-08 23:47:11 Author Email: 47970915@qq.com Description: Should you have any question, do not hesitate to contact me via E-mail. ''' import numpy as np import random import time class Q_Learning(object): def __init__(self): # 创建一个q函数,其实就是Q表格 ...
haitaifantuan/reinforcement_leanring
强化学习中的时间差分算法(含代码)-《强化学习系列专栏第3篇》/Q-Learning.py
Q-Learning.py
py
5,193
python
en
code
8
github-code
36
30478020917
from collections import OrderedDict, namedtuple from decimal import Decimal from string import ascii_uppercase def tabular(table, widths): def sandwich(delim, contents): return delim + delim.join(contents) + delim def cell(value, width): return ' ' + str(value).ljust(width - 2) def...
hzhamed/Fast-Food-Menu-Calculator
Menu.py
Menu.py
py
1,687
python
en
code
0
github-code
36
38115229575
from app import app from flask import jsonify, request from models import Host, HostSchema from scheduling import th @app.route('/api/1.0/test') def index(): return 'ok' @app.route('/api/1.0/host', methods=['POST']) def create_host(): if request.methods == 'POST': ip = (request.json['ip'])...
evgeneh/pinger_back_py
view.py
view.py
py
2,078
python
en
code
0
github-code
36
10019831327
import csv from django.http import HttpResponse from django.shortcuts import render from .models import account from .models import deposite from .models import withdraw # Create your views here. def showindex(request): return render(request,"Home.html") def head(request): return render(request,"Head.html") ...
prasadnaidu1/django
bankinfo/prasad/views.py
views.py
py
3,584
python
en
code
0
github-code
36
1107559956
import os import subprocess from docutils import nodes from docutils.parsers.rst import Directive from tutorials import tutorials import sphinx_material class Tutorials(Directive): def run(self): output = list() # General text intro = f""" <p> <b>viskex</b> is accompanied by a few tutorial...
viskex/viskex.github.io
_ext/ext.py
ext.py
py
8,064
python
en
code
0
github-code
36
19716823940
man = Actor("characterman") man.topright = 0, 10 WIDTH = 500 HEIGHT = man.height + 100 speed= 2 import random def draw(): screen.fill((128, 0, 0)) man.draw() def update(): global speed man.left = man.left + speed if man.left > WIDTH: speed = speed + .5 def on_mouse_down(pos): if ma...
IsabelF113642/game
pygame/click_game.py
click_game.py
py
610
python
en
code
0
github-code
36
39003004891
# Q.4 Write a python code to find the data distributions using box plot for Income.csv file # Code import matplotlib.pyplot as plt import pandas as pd import seaborn as sns dataframe = pd.read_csv("csv_data/income.csv") print(dataframe.head()) print(dataframe.isnull().values.any()) age = dataframe["age"] JobType = da...
ShubhamNagure/Assignments
AI_ML_KR/Assignment#2/question4.py
question4.py
py
795
python
en
code
0
github-code
36
467939918
import math from binance_api import Binance import config_trade import statistics as st import time import requests def SMA(data, period): if len(data) == 0: raise Exception("Empty data") if period <= 0: raise Exception("Invalid period") interm = 0 result = [] nan_in...
OGKuz/binance_shift_bot
shift_bot.py
shift_bot.py
py
7,247
python
en
code
1
github-code
36
6347303356
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def track2dicts(tracks, frame_idx, video_id, det_type="object", side=np.nan): track_dicts = [] for track in tracks: track_dict = dict( track_id=track.id, left=track.box[0], top=track.box[1], ...
hassony2/homan
homan/tracking/trackconv.py
trackconv.py
py
612
python
en
code
85
github-code
36
29515253943
import base64 from plugins.googleapi.Google import Create_Service from email.mime.text import MIMEText from sql_data.schemas import Mail def create_mail_service(user_id): CLIENT_SECRET_FILE = 'plugins/googleapi/Credentials/keys.json' API_SERVICE_NAME = 'gmail' API_VERSION = 'v1' SCOPES = ['https://ww...
r0king/EventOn-api
plugins/gmail/mail.py
mail.py
py
2,985
python
en
code
1
github-code
36
14853984504
import numpy as np def sgd(net,deltas,lrate = 0.05): new_ws = {} for i in net: if (i == 0): continue w = net[i].w for j in range(len(w)): for k in range(len(w[j])): w[j][k] += lrate * deltas[i][k] * net[i].input[j] new_ws[i]= w return new_ws
DreamsDragon/DLLib
src/Trainer/Update.py
Update.py
py
269
python
en
code
0
github-code
36
718879097
from crossref.restful import Works import requests import re class CrossRef: def __init__(self): self.works = Works() self.metadata = None def get_doi_metadata(self, doi: str) -> dict: try: self.metadata = self.works.doi(doi=doi) return self.metadata ...
jamino30/dandiset-metadata-filler
clients/crossref.py
crossref.py
py
2,780
python
en
code
0
github-code
36
2689293408
#========================================================================================#======================================================================================== # LIBRARIES #======================================================================================== import BH_Physics as BHP from fitool ...
sbustamante/Spinstractor
Subhalo_Color_Mass_Matcher.py
Subhalo_Color_Mass_Matcher.py
py
4,486
python
en
code
0
github-code
36
10358617907
from __future__ import annotations import math import os import pygame from pgbot import emotion EMOTIONS_PER_ROW = 2 NEGATIVE_EMOTIONS = {"bored": "exhausted", "happy": "sad"} EMOTION_COLORS = { "happy": (230, 28, 226), "sad": (28, 28, 230), "anger": (230, 36, 18), "bored": (230, 181, 18), "exh...
gresm/PygameCommunityBot
pgbot/commands/utils/vibecheck.py
vibecheck.py
py
6,443
python
en
code
null
github-code
36
42034957629
import sys import logging import gi gi.require_version('Gst', '1.0') from gi.repository import GObject, Gst, GLib Gst.init(None) class Pipeline: def __init__(self, export_dot, mainloop): self.mainloop = mainloop self.logger = logging.getLogger(__name__) self.pipeline = Gst.Pipeline("pipeli...
gscigala/packet-generation
fpm/test_sample/pipeline.py
pipeline.py
py
3,441
python
en
code
0
github-code
36
45138590856
import sys import argparse class BaseOptions(): def __init__(self): self.initialized = False def initialize(self, parser): # original arguments parser.add_argument("--epoch", type=int, default=0, help="epoch to start training from") parser.add_argument("--n_...
HBX-hbx/CGAN_jittor_landscape
options/base_options.py
base_options.py
py
4,573
python
en
code
0
github-code
36
14619387009
#画像処理_SURF #参考文献 #https://python-debut.blogspot.com/2020/02/blog-post_24.html #https://stackoverflow.com/questions/52305578/sift-cv2-xfeatures2d-sift-create-not-working-even-though-have-contrib-instal #opencvのバージョンを下げた import numpy as np import cv2 img = cv2.imread('dog.jpg') #特徴抽出するための箱を作る. surf = cv2.xfeatures2d.S...
mitanihayato/shinjinkadai
4_surf.py
4_surf.py
py
814
python
ja
code
0
github-code
36
902243019
import socket udpServer =socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udpServer.connect(("10.60.250.230",9999)) while True: data, addr =udpServer.recvfrom(1024) print("客户端说:",data.decode('utf-8'))
hughgo/Python3
基础代码/网络编程/客户端与服务端通信/UDP编程/server.py
server.py
py
222
python
en
code
10
github-code
36
32633364752
from aiogram.dispatcher.filters import state from aiogram.dispatcher import FSMContext from main import bot, dp from aiogram import types from aiogram.types import ParseMode from language_middleware import i18n from sql import SQL from config import DB_NAME dp.middleware.setup(i18n) _ = i18n.gettext database = SQL(f...
7Dany6/wave-me-bot
functions.py
functions.py
py
3,965
python
en
code
1
github-code
36
21143828586
import torch from ipdb import set_trace import torch.nn as nn import torch.nn.functional as F import logging from torch.nn.utils.rnn import pad_sequence from config import MyBertConfig from src.models.bert_model import BaseBert from src.models.flash import GAU from src.ner_predicate import vote, span_predicate from ...
KeDaCoYa/MKG-GC
entity_extraction/src/models/inter_bert_span.py
inter_bert_span.py
py
16,287
python
en
code
0
github-code
36
14899572028
import pandas as pd import altair as alt import joblib RECT_SIZE = 13 source = pd.read_json(snakemake.input[0]) df_sb = source.loc[source.Encoding == "zscale", :].copy(deep=True) df_sb.Encoding = "zzz" df_sb.F1 = "separator" dfs, names_imbalanced = [], [] for bf in sorted(source["bio_field"].unique()): df_tmp ...
spaenigs/peptidereactor
nodes/vis/mds_1_Overview/scripts/hm_bio.py
hm_bio.py
py
2,481
python
en
code
7
github-code
36
1289907080
__author__ = 'wangwei' # A dictionary of movie critics and their ratings of a small # set of movies critics = {'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5, 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5, 'The Night Listene...
Mayweiwang/RecommendationSys
recsystable.py
recsystable.py
py
6,200
python
en
code
0
github-code
36
71793784103
# -*- coding: utf-8 -*- """ API /api_part/formula_search - search API /api_part/contexts/<formula_id> - contexts for one formula (with span) """ from flask import Flask from flask_restful import Api from flask_cors import CORS from api_part.models import db from api_part.api import FormulaSearch, FormulaContexts app...
dkbrz/ice_site
api_part/app.py
app.py
py
854
python
en
code
0
github-code
36
41907938518
import os os.environ from PIL import Image from torchvision import transforms, models import torch import torch.nn as nn model = models.resnet50(pretrained=True) num_features = model.fc.in_features model.fc = nn.Linear(num_features, 8) model_path = './age_prediction_model/age_best_model.pth' model.load_state_dict(...
CSID-DGU/2022-2-SCS4031-EZ_SW
age_prediction_model/age_pred.py
age_pred.py
py
967
python
en
code
0
github-code
36
37196379470
from pwn import * #context.log_level= 'debug' #context.aslr = False io = process('./safenote') e = ELF('./safenote') libc = e.libc def add(size, buf): io.recvuntil('Exit\n') io.sendline('1') io.recvuntil(':\n') io.sendline(str(size)) io.recvuntil('cmd:\n') io.sendline(buf) def delete(id): i...
skyroot/pwn-collection
collection/heap_chunk_overlap_64/safenote/test.py
test.py
py
3,019
python
en
code
0
github-code
36
27786608731
# -*- coding: utf-8 -*- # * Credits: # * # * original Audio Profiles code by Regss # * updates and additions through v1.4.1 by notoco and CtrlGy # * updates and additions since v1.4.2 by pkscout import xbmc import json import os import sys from resources.lib.fileops import * from resources.lib.xlogger import Logge...
pkscout/script.audio.profiles
resources/lib/audioprofiles.py
audioprofiles.py
py
10,698
python
en
code
7
github-code
36
16822733733
import requests # Replace this value with your own Discord API token TOKEN = input("Enter your Discord API token: ") headers = { "Authorization": f"Bot {TOKEN}", "User-Agent": "MyBot/1.0", } # Send a GET request to the Discord API to retrieve the webpack chunk data response = requests.get("https://discordapp...
catgirlasn/discord
eavesdrop.py
eavesdrop.py
py
1,607
python
en
code
1
github-code
36
21743876125
from umqtt.simple import MQTTClient import mfrc522 from os import uname from machine import Pin from time import sleep_ms import machine import dht mqtt_server='192.168.12.45' client_id = 'esp8266' dht_data = b'/devices/esp8266/dht_data' switch_control = b'/devices/esp8266/switch' switch1_state = b'/devices/esp8266/sw...
lesinh97/the-node-is-red
ESP8266-MQTT-Client/main.py
main.py
py
1,535
python
en
code
1
github-code
36
10496870550
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2 from onnx_tf.backend import prepare as prepare_onnx_model import tensorflow as tf import argparse import onnx parser = argparse.ArgumentParser() parser.add_argument("--onnx_dir", type=str, help="Path where ONNX models...
chansoopark98/Tensorflow-Keras-Object-Detection
convert_onnx_to_tf.py
convert_onnx_to_tf.py
py
2,815
python
en
code
6
github-code
36
16402536741
import sqlite3 as s3 db_name = "/home/egws/ESCAPE_GAMES" def create_table(room): """Create Table for a room""" try: db = s3.connect(db_name) except: print("Connexion à la base " + db_name + " impossible") try: cursor = db.cursor() try: cursor.execute(""" ...
piment/egws
database.py
database.py
py
2,445
python
en
code
1
github-code
36
29808972190
import webapp2 import json import nltk_utils class MainHandler(webapp2.RequestHandler): def renderJSON(self, dictionary): dataJSON = json.dumps(dictionary) self.response.headers["Content-Type"] = "application/json; charset=UTF-8" self.response.write(dataJSON) def get(self): s...
sivu22/nltk-on-gae
GAE/main.py
main.py
py
1,183
python
en
code
1
github-code
36
3458547327
#O(n) + O(n) + O(n-k+1) class Solution: def slide_window(self, nums, k): length = len(nums) res = [] for i in range(length - k + 1): res.append(nums[i:i + k]) return res def findMaxAverage(self, nums, k: int) -> float: def avgWindows(nums): ret...
pi408637535/Algorithm
com/study/algorithm/daily/643. Maximum Average Subarray I.py
643. Maximum Average Subarray I.py
py
1,318
python
en
code
1
github-code
36
15991467145
import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layers import DropPath, trunc_normal_ import math import numpy as np from models.head import * up_kwargs = {'mode': 'bilinear', 'align_corners': False} def load_state_dict(module, state_dict, strict=False): """Load state_dict to...
zyxu1996/Efficient-Transformer
models/volo.py
volo.py
py
34,846
python
en
code
67
github-code
36
3650828458
from flask import Blueprint, request, send_from_directory, Response from config import IS_LOCALHOST import yaml import dotenv from os import getenv dotenv.load_dotenv() bp = Blueprint("plugin", __name__) print('localhost started? ', IS_LOCALHOST) AUTHO_CLIENT_URL = getenv('AUTHO_CLIENT_URL') AUTHO_AUTHORIZATION_URL ...
matthewlouisbrockman/the_one_plugin
backend/plugin/plugin_routes.py
plugin_routes.py
py
2,688
python
en
code
0
github-code
36
5392824044
import cv2 import os import pydicom import argparse from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('-t', '--type', type=str, required=True, choices=['train', 'test'], help='whether to convert train images or test images') args = vars(parser.parse_args()) if args['ty...
sovit-123/Pneumonia-Detection-using-Deep-Learning
dcm_to_jpg.py
dcm_to_jpg.py
py
1,011
python
en
code
9
github-code
36
7291178560
from pyramid.config import Configurator from sqlalchemy import engine_from_config from os import environ from api.models.sql_automap import DBSession, Base def main(global_config, **settings): sqlalchemy_url_value = environ.get('STR_CONNECTION', 'mysql://root:pass@172.17.0.3:3306/matomo') settings.update({'sq...
scieloorg/scielo-sushi-api
api/__init__.py
__init__.py
py
1,052
python
en
code
0
github-code
36
74774265705
import sys import treeswift as ts from sys import platform as _platform import tempfile from subprocess import Popen, PIPE import pkg_resources import time import logging def print_ident(tree): for i in tree.root.children: print(len(list(i.traverse_postorder())),) print("") def reestimate_backbone(opt...
balabanmetin/apples
apples/reestimateBackbone.py
reestimateBackbone.py
py
4,332
python
en
code
22
github-code
36
19053701211
#!/bin/python3 def max_common_child(s1: str, s2: str) -> int: """A string is said to be a child of a another string if it can be formed by deleting 0 or more characters from the other string. Letters cannot be rearranged. Given two strings of equal length, what's the longest string that can be constructe...
martinosecchi/practice-exercises
maximum_common_subsequence.py
maximum_common_subsequence.py
py
2,333
python
en
code
0
github-code
36
18046654139
import pandas as pd from konlpy.tag import Komoran import tensorflow as tf import numpy as np from keras.layers import Dense, Conv1D, GlobalMaxPooling1D, Embedding, Dropout from keras.models import Sequential from keras.layers import LSTM, Bidirectional from keras.models import Sequential, load_model from keras.metrics...
jaehyun1209/Deeplearning_AbuseFind
PreProcessAndModel.py
PreProcessAndModel.py
py
4,595
python
en
code
0
github-code
36
29465356973
## This module aims to compute the number and energy flux of DM particles from a supernova import numpy as np import matplotlib.pyplot as plt from ..Step1_Kinematics import Kinematics import scipy.integrate as integrate #Particle Property #Neutrino M_nu = 0.32 # Unit:eV/c2 E_total_nu = 3.6e53*6.24150913e11 ...
CrazyAncestor/DM_Neutrino_Flux
old_codes/one_direction/Steps/Step2_DM_Flux/DM_flux.py
DM_flux.py
py
2,634
python
en
code
0
github-code
36
43119912709
import numpy as np # Sigmoid function used for activation function def sigmoid(x): return 1.0 / (1 + np.exp(-x)) # Derivative of the sigmoid function, used during backpropagation def sigmoid_derivative(x): return x * (1.0 - x) # MLP Class class MLP: # Constructor of MLP class def __init__(self, x,...
claudiadmr/MD_PORTEFOLIO
P6_MLP/mlp.py
mlp.py
py
3,630
python
en
code
0
github-code
36
31932657319
from sympy import isprime import random import re class ElGammal: def __init__(self): self.p=0 self.alpha=0 self.private_a=0 self.beta=0 # self.p=11 # self.alpha=2 # self.private_a=3 # self.beta=8 def genKey(self): primes_list=[i for i ...
JuanDa14Sa/Cripto
Main/ElGammal.py
ElGammal.py
py
3,154
python
en
code
0
github-code
36
3532508808
import os os.system('cls') from math import sqrt from functools import reduce class chofer(): def __init__(self, nombreCompleto): self.__nombreCompleto = nombreCompleto def getNombreCompleto(self): return self.__nombreCompleto class camion(): def __init__(self, patente, lit...
IgnacioVelliz/Programa-Python
Parcial2.py
Parcial2.py
py
5,595
python
es
code
0
github-code
36
30481418388
""" Tests for bitarray Author: Ilan Schnell """ import os import sys import unittest import tempfile import shutil from random import randint is_py3k = bool(sys.version_info[0] == 3) # imports needed inside tests import copy import pickle import itertools try: import shelve, hashlib except ImportError: shel...
MLY0813/FlashSwapForCofixAndUni
FlashSwapForCofixAndUni/venv/lib/python3.9/site-packages/bitarray/test_bitarray.py
test_bitarray.py
py
78,361
python
en
code
70
github-code
36
3977246505
""" Utilities for searching a database of tests based on a query over tags provided by the tests. The resulting search becomes a test suite. """ import re class RegexQuery(object): """A query based on regex includes/excludes. TODO: Something more complicated, or link to actual MongoDB queries? """ ...
Tendenden/Draw_chat2
node_modules/mongo/mongodb-src-r3.0.4/buildscripts/smoke/suites.py
suites.py
py
3,222
python
en
code
0
github-code
36
24338300355
""" distributions Provides likelihood functions for distributions and a method to assign the most likely distribution to observed numeric data. discreteData used to determine whether data is discrete or not. """ import numpy as np from scipy import special as sp from scipy import stats import sys def discreteDat...
stevec12/Stat-Tools
StatsTools/distributions.py
distributions.py
py
4,438
python
en
code
0
github-code
36
38013843478
# # Author: Denis Tananaev # File: makeTFrecords.py # Date:9.02.2017 # Description: tool for the tfrecords convertion of the SUN3D dataset # import numpy as np import skimage.io as io import scipy.misc import tensorflow as tf def centered_crop(image,new_w,new_h): '''Make centered crop of the image''' height...
Dtananaev/DepthNet
tfCNN/data_processing/tools/makeTFrecords.py
makeTFrecords.py
py
2,914
python
en
code
2
github-code
36
42097373697
# Stock transaction # Program for stock transaction in a period # Anatoli Penev # 19.11.2017 # initial purchase shares_purchased = 1000 stock_price_per_share_bought = 32.87 payment_for_stock= shares_purchased*stock_price_per_share_bought commission = 0.02 commission_paid = commission*payment_for_stock # t...
tolipenev/pythonassignments
stocktransaction.py
stocktransaction.py
py
1,170
python
en
code
0
github-code
36
37897597748
""" practice advance read-write options & strategies with pandas """ import pandas as pd import matplotlib.pyplot as plt def start(): """set options for pandas""" options = { 'display': { 'max_columns': None, 'max_colwidth': 25, 'expand_frame_repr': False, # Don't ...
nguyentu1602/pyexp
pyexp/pandas_practice.py
pandas_practice.py
py
4,025
python
en
code
0
github-code
36
694104358
from .models import Event, Slot, SignUp from groups.methods import get_user_group_membership, group_to_json from authentication.methods import user_to_json from common.parsers import parse_datetime_to_epoch_time # Constants from common.constants import ( EVENT_ID, TITLE, DESCRIPTION, START_DATE_TIME, ...
cs3216-2021-a3-group12/slotify-backend
slotify/events/methods.py
methods.py
py
4,696
python
en
code
1
github-code
36
9246343257
from typing import Any from fastapi import APIRouter, HTTPException, status from tortoise.exceptions import DoesNotExist from project.app.src.suppliers.service import create from project.app.src.suppliers.service import delete from project.app.src.suppliers.service import get_all from project.app.src.suppliers.servic...
ademchenkov/wm
project/app/src/suppliers/router.py
router.py
py
3,086
python
en
code
0
github-code
36
15205290527
from rest_framework import permissions from rest_framework.views import Request, View, status from championships.models import Championship from teams.models import Team from datetime import datetime class IsChampionshipOwner(permissions.BasePermission): def has_object_permission( self, request: Request, ...
gamer-society-org/gamer-society
championships/permissions.py
permissions.py
py
4,861
python
en
code
0
github-code
36
37849511311
#!/usr/bin/env python # # lib.py # # Helper code for CLI for interacting with switches via console device # try: import click import re import swsssdk import subprocess import sys except ImportError as e: raise ImportError("%s - required module not found" % str(e)) DEVICE_PREFIX = "/dev/ttyUSB...
liang2biao/official_sonicbuild_201911_all
src/sonic-utilities/consutil/lib.py
lib.py
py
4,829
python
en
code
0
github-code
36
40612286632
from picamera import PiCamera from picamera.array import PiRGBArray import cv2 import time camera=PiCamera() camera.resolution=(800,600) camera.framerate=32 rawCaptures = PiRGBArray(camera,size=(800,600)) time.sleep(0.2) for rawCapture in camera.capture_continuous(rawCaptures,format="bgr",use_video_port=True): i...
sacrrie/people_finding
video-recording/record_by_frame_rgb.py
record_by_frame_rgb.py
py
486
python
en
code
0
github-code
36
27969617509
# type: ignore from flask import render_template, redirect, url_for, session from main import app, db from admin import admin from products.models import Product import os app.register_blueprint(admin) @app.route('/') def index(): products=Product.query.all() return render_template('index.html', produc...
muchirajunior/flask-ecommerce
routes.py
routes.py
py
904
python
en
code
1
github-code
36