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
2403860193
from decimal import Decimal from django.test import TestCase from parameterized import parameterized from calculator.calculation import calculate_total_cost from calculator.exceptions import StateNotFound from calculator.repository import Repository from calculator.tests.common import fill_db class CalculateTotalCo...
SpiritD/tax_calculator
tom_project/calculator/tests/total_costs.py
total_costs.py
py
1,659
python
en
code
0
github-code
36
37402409097
from regression_tests import * class Test(Test): settings=TestSettings( tool='fileinfo', args='--json --verbose', input='564ee59caad056d98ed274c8c4f06e82' ) def test_fileinfo_succeeded(self): assert self.fileinfo.succeeded assert 'importTable' not in self.fileinfo.o...
avast/retdec-regression-tests
tools/fileinfo/bugs/macho-bad-alloc-2/test.py
test.py
py
326
python
en
code
11
github-code
36
16442682460
class Student: def __init__(self, id, fullname, birthdate, sex, address, phone, email): self._id = id self._fullname = fullname self._birthdate = birthdate self._sex = sex self._address = address self._phone = phone self._email = email
thanhtugn/python_core_thanhtugn
Big_assignment_01/student.py
student.py
py
302
python
en
code
1
github-code
36
35104869337
# -*- coding: utf-8 -*- import os import codecs import collections from six.moves import cPickle import numpy as np import re import itertools import pandas as pd from ts_FeatureCoding import Feature_Coding DATA_DIR = "data/events" class DataLoader(): def __init__(self, args): self.data_dir = args.data_di...
traderscience/market_transformer
tsutils/data_loader.py
data_loader.py
py
9,544
python
en
code
0
github-code
36
24490960551
TRUE_VALUES = ('T', 't', "true", "True", True, "yes", "Yes", "YES", "Y", "y") def q_filter(query=None, svc_field=None, node_field=None, group_field=None, app_field=None, user_field=None, db=db): q = None t = None if not auth_is_node() and "Manager" in user_groups(): manager = True ...
opensvc/collector
init/models/where.py
where.py
py
7,675
python
en
code
0
github-code
36
5468407661
import os import numpy as np import torch import torchvision import torch.nn as nn import torchvision.transforms as transforms import torch.optim as optim import matplotlib.pyplot as plt import torch.nn.functional as F from torchvision import datasets from torch.utils.data import DataLoader from torchvision.utils impo...
MAyaCohenCS/Experimental_CNN_3
image_posterior.py
image_posterior.py
py
3,724
python
en
code
0
github-code
36
21056220601
#!/usr/bin/python3 import requests, argparse parser = argparse.ArgumentParser() parser.add_argument("--rhost", "-rh", type=str, help="remote host (if not specified, 127.0.0.1 will be used)", default="127.0.0.1") parser.add_argument("--rport", "-rp", type=str, help="remote port (if not specified, 8500 will be used)", d...
GatoGamer1155/Scripts
Ambassador/privesc.py
privesc.py
py
1,409
python
en
code
33
github-code
36
27609918869
# -*- coding: utf-8 -*- """ Created on Thu May 27 19:43:26 2021 @author: estusaee2 """ """ i = 1 while i <= 20: print(i,end=", ") i = i + 1 """ decision = 1 while decision == 1 : decision = int(input("¿Desea terminar el programa\n 1: No \n 2: Si \n\n "))
Y-Avila/MisionTic-2022
Ciclo_1(Python)/2Semana/While.py
While.py
py
282
python
en
code
0
github-code
36
6765119466
from operator import itemgetter def carregar(arquivo): linhas = [] with open(arquivo) as f: f.readline() for linha in f.readlines(): data, abertura, alta, baixa, fechamento, volume = linha.strip().split(',') ano, mes, dia = data.split('-') linhas.append( ...
Larissapy/aula-remota-12
s12_t1/t1_q2.py
t1_q2.py
py
1,453
python
pt
code
0
github-code
36
74004428583
from flask import Flask, jsonify from apscheduler.schedulers.background import BackgroundScheduler app = Flask(__name__) #Sample data not acurate cancer_stats = { 'Total_infected': 1000, 'Active_cases': 500, 'Recovered': 400, 'Deaths': 200, 'Critical': 50, 'Mortality_rate': 20, 'deceased':...
Ceced20/SimpleCancerAPI
API.py
API.py
py
955
python
en
code
0
github-code
36
6672970825
# Licensed under a 3-clause BSD style license - see LICENSE.rst """``stsynphot`` configurable items. The default configuration heavily depends on STScI TRDS structure but it can be easily re-configured as the user wishes via `astropy.config`. ``PYSYN_CDBS`` must be a defined system environment variable for directorie...
spacetelescope/stsynphot_refactor
stsynphot/config.py
config.py
py
4,330
python
en
code
11
github-code
36
852394623
# -*- coding: utf-8 -*- import requests import json import csv import time import re from CrawlClient import Crawler from lxml import etree class ZOJCrawler(Crawler.Crawler): def __init__(self, max_try_cnt, url = 'http://acm.zju.edu.cn/onlinejudge'): self.try_cnt = 0 self.max_try_cnt = max_try_cnt ...
deepwzh/OJ-Crawers
CrawlClient/ZOJCrawler.py
ZOJCrawler.py
py
3,051
python
en
code
3
github-code
36
5491253992
import torch import torch.nn.functional as F import constants import numpy as np def gauss1D(window_size, sigma): center = window_size // 2 gauss = torch.Tensor([np.exp(-(x - center)**2 / (2*(sigma**2))) for x in range(window_size)]) gauss = gauss/gauss.sum() return gauss def create_window(win...
daoduyhungkaistgit/SRGAN
src/metrics.py
metrics.py
py
4,011
python
en
code
3
github-code
36
70878385064
from secrets import choice from asyncio import sleep import discord from discord.ext import tasks, commands from extras import constants from utils.audio import YoutubeHelper, YTDLSource from utils.docker import DockerLogger from utils import decorators class TiozaoZap(commands.Cog): ''' TiozaoZap Cogs ...
LombardiDaniel/Sebotiao
src/cogs/tiozao.py
tiozao.py
py
3,850
python
en
code
1
github-code
36
455748841
from astropy.io import fits import numpy as np hdulist=fits.open('/Users/dhk/work/cat/NGC_IC/VII_118.fits') tb=hdulist[1].data for x in range(0,len(tb)/1000+1): f=open("sha_quarry_batch_%d.txt" % (x),"w") f.write("COORD_SYSTEM: Equatorial\n") f.write("EQUINOX: J2000\n") f.write("NAME-RESOLVER: NED\n") for y in r...
DuhoKim/py_code_US
ngc_ic_cat.py
ngc_ic_cat.py
py
533
python
en
code
0
github-code
36
6774316642
import pickle import streamlit as st classifier_in=open("classifier.pkl","rb") clf=pickle.load(classifier_in) def predict_banknote(variance,skewness,kurtosis,entropy): pred=clf.predict([[variance,skewness,kurtosis,entropy]]) if(pred[0]>0.5): pred="Its a fake note" else: pred="It's a real b...
adamdavis99/Bank-Note-Authentication
streamlit_app.py
streamlit_app.py
py
645
python
en
code
0
github-code
36
27970752684
import shutil import tarfile from collections.abc import Sequence from pathlib import Path from typing import Callable, Generic, TypedDict, TypeVar import lightning.pytorch as pl import torch import torchaudio from einops import rearrange from torch import Tensor from torch.hub import download_url_to_file from torch.u...
int0thewind/s4-dynamic-range-compressor
s4drc/src/dataset.py
dataset.py
py
5,685
python
en
code
1
github-code
36
3746051837
# Standard Library import json import logging import urllib.parse # Third Party from fastapi import APIRouter, Depends, HTTPException, Query, status from fastapi_cache.decorator import cache # First Party from resc_backend.constants import ( CACHE_NAMESPACE_FINDING, DEFAULT_RECORDS_PER_PAGE_LIMIT, ERROR_M...
abnamro/repository-scanner
components/resc-backend/src/resc_backend/resc_web_service/endpoints/detailed_findings.py
detailed_findings.py
py
6,741
python
en
code
137
github-code
36
45138596236
from .base_options import BaseOptions class TrainOptions(BaseOptions): def initialize(self, parser): BaseOptions.initialize(self, parser) # for displays parser.add_argument('--save_epoch_freq', type=int, default=10, help='frequency of saving checkpoints at the end of epochs') parse...
HBX-hbx/CGAN_jittor_landscape
options/train_options.py
train_options.py
py
1,524
python
en
code
0
github-code
36
10456213892
import numpy as np from numpy.linalg import inv W = np.loadtxt("W.txt", dtype='int') W_inverse = inv(W) with open('InvW.txt', 'wb') as file: for line in W_inverse: np.savetxt(file, line, fmt='%f')
aditya059/MTP_Code
IBM_Work_On_Zhus_Paper/genInvW.py
genInvW.py
py
212
python
en
code
0
github-code
36
19950192198
import xdg.BaseDirectory import xdg.MenuEditor import gtk import gio import uxm.adapters as adapters from uxm.adapters import xdg_adapter def lookup_menu_files(filename): return [f for f in xdg.BaseDirectory.load_config_paths('menus/' + filename)] class MenuTreeModel(gtk.TreeStore): ( COLUMN_HIDE, ...
ju1ius/uxdgmenu
usr/lib/uxdgmenu/uxm/dialogs/editor/treemodel.py
treemodel.py
py
6,603
python
en
code
17
github-code
36
22355326575
import pathlib from contextlib import nullcontext as does_not_raise import pytest import mlrun.runtimes.generators @pytest.mark.parametrize( "strategy,param_file,expected_generator_class,expected_error,expected_iterations", [ ( "list", "hyperparams.csv", mlrun.run...
mlrun/mlrun
tests/runtimes/test_generators.py
test_generators.py
py
2,780
python
en
code
1,129
github-code
36
13490200231
class Personel(): def __init__(self,ad,soyad,yas,cinsiyet,maas): self.ad=ad self.soyad=soyad self.yas=yas self.cinsiyet=cinsiyet self.maas=maas def bilgileriYazdir(self): print(""" {} {} Bilgileri şunlardır : Yaşı : {} Cinsiyet : {} ...
AydinTokuslu/PythonTutorial
Ders_Konulari/Ders-18_Kalitim.py
Ders-18_Kalitim.py
py
1,084
python
tr
code
0
github-code
36
74051194023
#from apiclient.discovery import build from googleapiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import httplib2 #from oauth2client import client, file, tools import datetime import pytz import re import configparser # """ # timezone/DST correction: # """ # def get...
LabNeuroCogDevel/LNCDcal.py
LNCDcal/LNCDcal.py
LNCDcal.py
py
6,453
python
en
code
0
github-code
36
11936779128
#import ipdb import logging from typing import Optional, cast from rest_framework import serializers from rest_framework.exceptions import APIException, ErrorDetail, ValidationError from rest_flex_fields.serializers import FlexFieldsSerializerMixin from ..exception.unprocessable_entity import UnprocessableEntity f...
CloudReactor/task_manager
server/processes/serializers/workflow_serializer.py
workflow_serializer.py
py
10,948
python
en
code
0
github-code
36
12704443162
def pre_ordem(pont): if (pont != None): print(pont.valor) pre_ordem(pont.esq) pre_ordem(pont.dir) def em_ordem(pont): if (pont != None): em_ordem(pont.esq) print(pont.valor) em_ordem(pont.dir) def pos_ordem(pont): if (pont != None): pos_ordem(pont.esq) pos_ordem(pont.dir) pri...
GabrielReira/EDA-UFBA
09.py
09.py
py
830
python
pt
code
0
github-code
36
41357846970
"JIAHAO CHEN 89" class SNode: def __init__(self, e, next=None): self.elem = e self.next = next class MySList(): def __init__(self): self._head = None self._tail = None def __str__(self): """Returns a string with the elements of the list""" ###This functions...
J-H-C-037/Subject-EDA
EDA/partial1pastexamsEDA/partial_84.py
partial_84.py
py
5,172
python
en
code
0
github-code
36
20145975874
import torch.nn as nn # define small classifier class MlpClassifier(nn.Module): """ Simple classifier """ def __init__(self, args, n_classes, pretrain_stage_config): super(MlpClassifier, self).__init__() self.input_size = int(args['pretrain_output_size'] * args['seq_length']) self.hid...
antonior92/physionet-12ecg-classification
models/mlp.py
mlp.py
py
1,046
python
en
code
6
github-code
36
70887541225
#!/usr/bin/env python # coding: utf-8 # Leet Code problem: 19 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: ...
jwilliamn/trenirovka-code
leetc_19.py
leetc_19.py
py
1,536
python
en
code
0
github-code
36
73933034022
import sys import datetime import socket, time from PyQt5.QtWidgets import * from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtCore import * from PyQt5.QtCore import pyqtSlot from PyQt5.QtCore import QTimer, QTime from PyQt5.QtCore import pyqtSignal, QObject from PyQt5 import QtCore, QtGui, QtWidgets fro...
0sun-creater/golf_swing_coaching_program
python/GUI.py
GUI.py
py
17,024
python
en
code
0
github-code
36
74218356582
from PySide6.QtCore import QObject, Property, Slot, Signal, QTimer from typing import Optional from .qml_file_wrapper import QmlFileWrapper class MainController(QObject): main_content_qml_changed = Signal() def __init__(self, parent=None): super().__init__(parent) self._app = pare...
maldata/qml-error-test
errortest/main_controller.py
main_controller.py
py
1,733
python
en
code
0
github-code
36
18879607170
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Support for django-reversion on models with translatable fields and django-cms placeholder fields. """ from functools import partial from django.db.models.signals import post_save from cms.models.pluginmodel import CMSPlugin from reversion.revision...
aldryn/aldryn-reversion
aldryn_reversion/core.py
core.py
py
4,835
python
en
code
1
github-code
36
6217952013
""" Runs that functionality of the program, the flask app and the server that communicates with Walabot. """ from threading import Thread from meeting_room import app from FreeRoomsServer import FreeRoomsServer from config import HOST, PORT def main(): """ Start the server that communicates with Walabot and...
Walabot-Projects/Walabot-MeetingRoom
server/main.py
main.py
py
817
python
en
code
1
github-code
36
70862843305
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 15 14:41:09 2022 @author: bas """ #https://instaloader.github.io/as-module.html import instaloader from datetime import datetime from login import getMyUsername import random import pandas def login(L, username, filename='login_session'): if n...
Basdorsman/instagram-analysis
collect_data.py
collect_data.py
py
1,976
python
en
code
0
github-code
36
9710241755
import subprocess from datetime import datetime import tkinter as tk from tkinter import ttk from tkinter import messagebox from local import my_printer, printer_list # Ce programme imprime de petites étiquettes pour des tubes de type Eppendorf 1.5 ml # L'utilisateur dispose de 4 champs. # L'utilisateur peut décider d...
bermau/py_liq_dilutions
tk_label.py
tk_label.py
py
5,100
python
fr
code
0
github-code
36
6971950883
'''creating a form using flask to get username and password using html and displaying success on submitting''' from flask import Flask, redirect, render_template, request app = Flask(__name__) @app.route('/') def home(): return render_template("index.html") @app.route("/success", methods = ['POST...
R19R/Login_App_Using_Flask
may8th_ex1.py
may8th_ex1.py
py
590
python
en
code
0
github-code
36
24331960093
from argparse import ArgumentParser from ast import parse import os def handle_file(filename: str, blank: list[str]): with open(filename) as f: content = f.readlines() data = ['['] data.extend([f'"{x}",' for x in blank]) data.extend(['\n']) skip = True for line in content: # lin...
zeusops/mission-templates
limited-arsenal-factions/update.py
update.py
py
1,430
python
en
code
3
github-code
36
30249155883
import cv2 import os import numpy as np import PIL.Image from PIL import ImageEnhance # per ogni immagine presente nella cartella crea una foto più luminosa e una meno luminosa def imageBrightener(pathImmagine, pathContorno, pathSalvataggio, pathSalvataggioContorno): os.chdir(pathImmagine) files = os.listdir(...
ApulianGCC/TesiSegmentazionePinna
data_augmentation.py
data_augmentation.py
py
6,913
python
it
code
0
github-code
36
30692147773
from odoo.tests.common import TransactionCase class TestNlLocationNuts(TransactionCase): def setUp(self): super(TestNlLocationNuts, self).setUp() self.env['res.country.state'].create({ 'name': 'Noord-Brabant', 'code': 'NB', 'country_id': self.env.ref('base.nl'...
pscloud/l10n-netherlands
l10n_nl_location_nuts/tests/test_l10n_nl_location_nuts.py
test_l10n_nl_location_nuts.py
py
1,171
python
en
code
null
github-code
36
34998272866
# Import packages import cv2 import numpy as np from PIL import Image from pytesseract import pytesseract from pytesseract import Output if __name__ == "__main__": img = cv2.imread('shelf_for_rectangles.jpg') print(img.shape) # Print image shape cv2.imshow("original", img) # Cropping an ...
klarahi/Fuzzy_project
cropped_image.py
cropped_image.py
py
2,544
python
en
code
0
github-code
36
3325760856
from django.contrib import admin from .models import Review # Register your models here. class ReviewAdmin(admin.ModelAdmin): list_display = ( 'product', 'user', 'rating', 'title', 'description', 'review_date', ) ordering = ('product',) admin.site.registe...
mosull20/crushed-grapes-ms4
reviews/admin.py
admin.py
py
343
python
en
code
0
github-code
36
13565958708
# Author: Joshua Jackson # Date: 06/20/2020 # This file will contain the class which create Word2Vec file using gensim from gensim.models import Word2Vec from gensim.models.phrases import Phrases, Phraser from datetime import datetime # script to create word embeddings for Neural Network weight class word2vec: ...
jjacks95/sentiment-analysis-financial-news
financialTextProcessing/financialTextProcessing/createWord2Vec.py
createWord2Vec.py
py
1,730
python
en
code
3
github-code
36
41801368948
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 9 14:49:52 2023 @author: intern """ import cv2 kernel = np.ones((3, 3), dtype=np.uint8) erosion = cv2.erode(im0, kernel, iterations=1) plt.imshow( erosion[:,:,0:3]) #%% erosion = cv2.morphologyEx(im0, cv2.MORPH_OPEN, kernel, 1) plt.imshow( erosi...
xsmsh7/label-color
filterblackedge.py
filterblackedge.py
py
436
python
en
code
0
github-code
36
945909782
pkgname = "libsbsms" pkgver = "2.3.0" pkgrel = 0 build_style = "cmake" hostmakedepends = [ "cmake", "ninja", "pkgconf", ] pkgdesc = "Library for high quality time and pitch scale modification" maintainer = "psykose <alice@ayaya.dev>" license = "GPL-2.0-or-later" url = "https://github.com/claytonotey/libsbsm...
chimera-linux/cports
contrib/libsbsms/template.py
template.py
py
643
python
en
code
119
github-code
36
37662015618
from PyQt5.QtWidgets import QDialog, QComboBox, QPushButton, QRadioButton from pulse.utils import error from os.path import basename from PyQt5.QtGui import QIcon from PyQt5.QtCore import Qt from PyQt5 import uic import configparser class ElementTypeInput(QDialog): def __init__(self, *args, **kwargs): sup...
atbrandao/OpenPulse_f
pulse/uix/user_input/elementTypeInput.py
elementTypeInput.py
py
2,166
python
en
code
null
github-code
36
72416805225
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np def approach_angle_reward(roll,pitch): if np.abs(roll) + np.abs(pitch) < 0.174: return 100*np.exp((7.0*(0.174-np.abs(roll) - np.abs(pitch)))**1) if (np.abs(roll) + np.abs(pitch)<=1.55)and(np.abs(roll) + np.abs(pitch) >=0.174)...
Zbigor/DeepRL_UAV_landing
drl_landing/rl_pipeline/catkin_ws/src/hummingbird/scripts/plot_reward_functions.py
plot_reward_functions.py
py
2,384
python
en
code
2
github-code
36
10876940486
""" A Gopher Server written in Python author: Julia Connelly, Adante Ratzlaff, Jack Wines CS 331, Spring 2018 date: 12 April 2018 """ import sys import socket import os class GopherServer: def __init__(self, port=50000): self.port = port self.host = "" self.sock = socket.socket(socket.A...
connellyj/gopher
gopherServer.py
gopherServer.py
py
4,062
python
en
code
0
github-code
36
8559847117
#!/usr/bin/env python3.11 """ Video Command Invoker (Command Design Pattern) This Python script defines the `VideoInvoker` class, a central component in the Command design pattern for executing video-related commands. It manages the video generation process and serves as the invoker in the pattern. The `VideoInvoker...
thejackal360/tutgen
tutgen/video_invoker.py
video_invoker.py
py
4,840
python
en
code
0
github-code
36
30338835101
import marqo import pprint import requests import random import math # Test bug in pagination feature of OpenSearch # Create marqo index mq = marqo.Client(url='http://localhost:8882') try: mq.index("my-first-index").delete() except: pass # Index set number of documents # 100 random words mq....
vicilliar/public-code
pagination/os_from_tester.py
os_from_tester.py
py
2,920
python
en
code
0
github-code
36
70606154344
__all__ = ( 'Persistor', 'SQLPersistor', 'SQLitePersistor', ) try: import sqlite3 except Exception: sqlite3 = None class Persistor(object): """ Class providing methods for persisting input (persistence occurs when the `persist` method is called on a `Model` instance) """ def ...
jzaleski/formulaic
formulaic/persistors.py
persistors.py
py
9,411
python
en
code
1
github-code
36
13535976062
import csv import json from collections import OrderedDict def import_jsonfile_as_OrderedDict(json_filepath): f = open(json_filepath, "r") return json.loads(f.read(), object_pairs_hook = OrderedDict) def export_dict_to_jsonfile(dic, json_filepath, indent = 2, separators=(',', ': ')): outstr = json.dumps(d...
tyjyang/CampaignManager
lib/io_tools.py
io_tools.py
py
944
python
en
code
0
github-code
36
17848204772
#! /usr/bin/env python3 import os import re from azure.identity import DefaultAzureCredential from azure.mgmt.compute import ComputeManagementClient # Variables subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID") location = "eastus" publisher_name = "PaloAltoNetworks" # Acquire a credential object token_creden...
jamesholland-uk/pan-os-versions-in-public-cloud-providers
azure-processing.py
azure-processing.py
py
3,946
python
en
code
5
github-code
36
6742324568
# -*- coding: utf-8 -*- # file docbook2epub.py # This file is part of LyX, the document processor. # Licence details can be found in the file COPYING. # # \author Thibaut Cuvelier # # Full author contact details are available in file CREDITS # Usage: # python docbook2epub.py java_binary saxon_path xsltproc_path xsl...
cburschka/lyx
lib/scripts/docbook2epub.py
docbook2epub.py
py
7,833
python
en
code
33
github-code
36
74160112423
#!/bin/python3 import sys def icecreamParlor(m, arr): res = [] for first in range(len(arr) - 1): for second in range(first + 1, len(arr)): if (arr[first] + arr[second]) == m: res.append(first + 1) res.append(second + 1) return res ...
CodingProgrammer/HackerRank_Python
(Search)Ice_Cream_Parlor.py
(Search)Ice_Cream_Parlor.py
py
612
python
en
code
0
github-code
36
26741108051
import ROOT from xAH_config import xAH_config import sys, os sys.path.insert(0, os.environ['ROOTCOREBIN']+"/user_scripts/HTopMultilepAnalysis/") c = xAH_config() event_branches = ["EventNumber","RunNumber","mc_channel_number","isSS01","dilep_type","trilep_type", "is_T_T","is_T_AntiT","is_AntiT_T","...
mmilesi/HTopMultilepAnalysis
scripts/jobOptions_HTopMultilepNTupReprocesser.py
jobOptions_HTopMultilepNTupReprocesser.py
py
9,263
python
en
code
0
github-code
36
6200744085
import torch import torch.nn as nn from attention import NewAttention from language_model import ( WordEmbedding, QuestionEmbedding, TemporalConvNet, BertEmbedding, ) from classifier import SimpleClassifier from fc import FCNet class BaseModel(nn.Module): def __init__(self, w_emb, q_emb, v_att, q_...
cliziam/VQA_project_Demo
demo-vqa-webcam/base_model.py
base_model.py
py
2,732
python
en
code
0
github-code
36
28890245799
"""Score network module.""" import torch import copy import math from torch import nn from torch.nn import functional as F from openfold.utils.rigid_utils import Rigid, Rotation from data import utils as du from data import all_atom from model import ipa_pytorch from motif_scaffolding import twisting import functools a...
blt2114/twisted_diffusion_sampler
protein_exp/model/score_network.py
score_network.py
py
13,595
python
en
code
11
github-code
36
74060670184
import re from hashlib import sha256 from unittest import mock import pytest from aiohttp import web from sqlalchemy import and_, select from server.config import config from server.db.models import ban, friends_and_foes from server.exceptions import BanError, ClientError from server.game_service import GameService f...
FAForever/server
tests/unit_tests/test_lobbyconnection.py
test_lobbyconnection.py
py
34,970
python
en
code
64
github-code
36
36117885682
""" Revision ID: a93cd7e01a93 Revises: 6052d96d32f0 Create Date: 2020-06-28 16:58:12.857105 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'a93cd7e01a93' down_revision = '6052d96d32f0' branch_labels = None depends_on = None def upgrade(): # ### commands ...
lianjy357/vue-element-admin-fastapi
backend/app/alembic/versions/a93cd7e01a93_.py
a93cd7e01a93_.py
py
1,142
python
en
code
14
github-code
36
11939197341
from flask import ( Blueprint, flash, redirect, url_for, render_template, request, send_from_directory, ) from filenavi import model from .wrap import require_authentication from .error import MalformedRequest, Unauthorized, NotAuthenticated, NotAccessible INLINE_EXTENSIONS = ["txt", "pdf"...
lukaswrz/filenavi
filenavi/routing/storage.py
storage.py
py
7,605
python
en
code
0
github-code
36
15826968262
from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import str from builtins import range from builtins import * from past.utils import ol...
e-mission/e-mission-server
emission/analysis/modelling/user_model_josh/utility_model.py
utility_model.py
py
16,233
python
en
code
22
github-code
36
12835968022
import time from itertools import chain import email import imaplib import smtplib from readair import Log MY_NAME="Nile Walker" MY_ADDRESS = 'nilezwalker@gmail.com' PASSWORD = input('Enter the password for {}\n'.format(MY_ADDRESS)) MY_NUMBER='410-805-0012' SUBJECT="Google Housing Request" SERVER_ADDRESS="smtp.gmail.c...
NWalker4483/FlightRegister
main.py
main.py
py
2,831
python
en
code
0
github-code
36
40306764598
import numpy as np import pandas as pd from collections import OrderedDict def loss(h,y): return ( -y * np.log(h) - ( 1- y )*(np.log(1-y)) ).mean() def add_intercept(X): intercept = np.ones((X.shape[0],1)) X= np.reshape(X,(-1,1)) #print('intercept',intercept,X) return np.concatenate((intercept, X)...
guruprasaad123/ml_for_life
from_scratch/logistic_regression/Newtons method/hessian.py
hessian.py
py
2,333
python
en
code
4
github-code
36
5035742744
import os import sys from ase import io #color can be # - A color is specified either as a number between 0 and 1 (gray value), # three numbers between 0 and 1 (red, green, blue values or RGB), # or as a color name from the file /usr/lib/X11/rgb.txt (or similar). xbs_file = open("new_xbs.bs",'w') xbs_str="atom ...
Montmorency/imeall
imeall/tbe_tools/xyz_xbs.py
xyz_xbs.py
py
1,503
python
en
code
8
github-code
36
74050038184
import numpy as np from typing import Iterable, List from nltk.stem import PorterStemmer from parlai.crowdsourcing.utils.acceptability import ( AcceptabilityChecker, normalize_answer, ) import parlai.utils.logging as logging # Bad persona violations PERSONA_REPEATS_PROMPT = 'repeated the prompt text' ASKED_WI...
facebookresearch/ParlAI
parlai/crowdsourcing/projects/wizard_of_internet/acceptability.py
acceptability.py
py
7,697
python
en
code
10,365
github-code
36
36970594221
line = [x for x in input().split()] answer = 0 for i in range(len(line)): if line.count(line[i]) == 1: continue else: answer = 1 if answer == 0: print("yes") else: print("no")
jgpstuart/Kattis-Solutions
nodup.py
nodup.py
py
209
python
en
code
0
github-code
36
27941614537
from itertools import chain from itertools import islice from itertools import repeat from math import ceil import numpy as np from scipy.sparse import issparse from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels from sklearn.neighbors import kneighbors_graph f...
ohlerlab/SEMITONES
src/SEMITONES/_utils.py
_utils.py
py
4,987
python
en
code
8
github-code
36
29182985049
"""ShutIt module. See http://shutit.tk """ from shutit_module import ShutItModule class coreos_vagrant(ShutItModule): def build(self, shutit): # Some useful API calls for reference. See shutit's docs for more info and options: # # ISSUING BASH COMMANDS # shutit.send(send,expect=<default>) - Send a command...
ianmiell/shutit-coreos-vagrant
coreos_vagrant.py
coreos_vagrant.py
py
7,151
python
en
code
2
github-code
36
71079803305
import gzip import json import numpy as np import pandas as pd from tqdm.notebook import tqdm from datetime import datetime from sklearn.preprocessing import StandardScaler from sklearn.cluster import KMeans from collections import Counter #Funciones. def jl_to_list(fname): output = [] with gzip.open(fname, 'r...
estereotipau/meli_challenge_2020
simple_cluster_EG.py
simple_cluster_EG.py
py
6,186
python
en
code
4
github-code
36
14112986280
import os import allure import pytest import logging from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By import allure from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.chrome.options import Options clas...
nasretdinovs/tensor_autotest
common.py
common.py
py
2,451
python
en
code
0
github-code
36
42882353355
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Please refer the tutorial ":ref:`tutorial-parse_parser`". """ # pylint: disable=invalid-name, no-self-use __author__ = "Mu Yang <http://muyang.pro>" __copyright__ = "2018-2021 CKIP Lab" __license__ = "GPL-3.0" import re from wcwidth import wcswidth from ply.lex impo...
ckiplab/ehownet
ehn/parse/parser.py
parser.py
py
8,932
python
en
code
10
github-code
36
71938312423
# Definition of dictionary europe = {'spain': 'madrid', 'france': 'paris', 'germany': 'berlin', 'norway': 'oslo', 'italy': 'rome', 'poland': 'warsaw', 'austria': 'vienna'} # Iterate over europe for key, value in europe.items(): print("the capital of " + key + " is " + value) #Iterating over Dataframe ...
AlucarD980/d4t4-c4mp
Looping Data Structures.py
Looping Data Structures.py
py
1,187
python
en
code
0
github-code
36
30438808856
""" TFE - Chatbot Tifi - Technifutur by Nicolas Christiaens """ from datasets import Dataset from FineTuning import STSBTrainingModel from torch.utils.data import DataLoader import pandas as pd from Preprocessing import Preprocessing from transformers import AdamW,get_constant_schedule from transformers imp...
TheCricri/TFE_Chatbot_Tifi
CustomFineTuning.py
CustomFineTuning.py
py
4,735
python
en
code
0
github-code
36
36956009049
from helper_tiered import TieredConfigMixin, gen_tiered_storage_sources, get_conn_config from wtscenario import make_scenarios import fnmatch, os, wttest class test_tiered17(TieredConfigMixin, wttest.WiredTigerTestCase): tiered_storage_sources = gen_tiered_storage_sources() saved_conn = '' uri = "table:tes...
mongodb/mongo
src/third_party/wiredtiger/test/suite/test_tiered17.py
test_tiered17.py
py
3,276
python
en
code
24,670
github-code
36
495049737
import imp import importlib import inspect import os import sys import weakref from collections import namedtuple from enum import Enum from dagster import check from dagster.core.definitions.partition import RepositoryPartitionsHandle from dagster.core.definitions.pipeline import PipelineDefinition from dagster.core....
helloworld/continuous-dagster
deploy/dagster_modules/dagster/dagster/core/definitions/handle.py
handle.py
py
28,007
python
en
code
2
github-code
36
26921499285
import random import json import datetime from flask import Flask, request, render_template from flask_cors import CORS, cross_origin from nltk.chat.util import Chat, reflections app = Flask(__name__) cors = CORS(app) app.config["CORS_HEADERS"] = "Content-Type" current_date = datetime.datetime.now().strftime("%A, %B ...
sinde530/python
pino-chatbot/flask_test.py
flask_test.py
py
3,170
python
en
code
0
github-code
36
39753649325
import pandas as pd import numpy as np from datetime import date, datetime import pickle import warnings warnings.filterwarnings("ignore") def holiday(col): # Creamos una lista con los días festivos lista_holiday = ["01-01-2018", "16-01-2018", "20-02-2018", "31-03-2018", "29-05-2018", "04...
sanfermen/Modelo-Regresion-Alquiler-Bicicletas
prediccion/support.py
support.py
py
5,489
python
en
code
0
github-code
36
11580020473
import mysql.connector from tabulate import tabulate import getpass def login(): # This function is for establishing connection # between python and mysql database by taking # input of user id and password and host name # then it take the input of database from the # user and if the databa...
manavmittal05/InventoryManagement
ManavMittal_2021538_Master Stock-1.py
ManavMittal_2021538_Master Stock-1.py
py
18,424
python
en
code
0
github-code
36
17106921371
import os from dataclasses import dataclass, field from typing import List with open(os.path.join(os.path.dirname(__file__), "input"), "r") as inputFile: inputLines = [line.strip() for line in inputFile.readlines() if line] @dataclass class Signal: cycle: int register: int strength = 0 def __pos...
mmmaxou/advent-of-code
2022/day-10/answer.py
answer.py
py
2,140
python
en
code
0
github-code
36
33516010146
# -*- coding: utf-8 -*- from collective.es.index.interfaces import IElasticSearchClient from elasticsearch import Elasticsearch from zope.component import provideUtility from zope.interface import directlyProvides class ElasticSearchIngressConfFactory(object): def __init__(self, section): self.section = ...
collective/collective.es.index
src/collective/es/index/components.py
components.py
py
1,379
python
en
code
0
github-code
36
31064293035
from ..utils import Object class Photo(Object): """ Describes a photo Attributes: ID (:obj:`str`): ``Photo`` Args: has_stickers (:obj:`bool`): True, if stickers were added to the photoThe list of corresponding sticker sets can be received using getAttachedStickerSets ...
iTeam-co/pytglib
pytglib/api/types/photo.py
photo.py
py
1,177
python
en
code
20
github-code
36
17971188881
from pyrainbird.resources import RAIBIRD_COMMANDS def decode(data): if data[:2] in RAIBIRD_COMMANDS["ControllerResponses"]: cmd_template = RAIBIRD_COMMANDS["ControllerResponses"][data[:2]] result = {"type": cmd_template["type"]} for k, v in cmd_template.items(): if isinstance(v...
shun84/jeedom-plugin-rainbird
resources/pyrainbird/rainbird.py
rainbird.py
py
1,498
python
en
code
0
github-code
36
41643896349
from _GLOBAL_OPTIONS_ import factionsOptionMenu, addPremiumItems, addRevive, AddNightmareTickets, removeAds, unlockProfiles from _PROFILE_OPTIONS_ import addItemsMenu, changeUsername, addCash, setFreeSkillReset, setLevel, setBlackStronboxes, addBlackKeys, addAugmentCores, setSupportItems, addMultiplayerStats from _UT...
SWFplayer/SAS4Tool
_MAIN_.py
_MAIN_.py
py
8,232
python
en
code
0
github-code
36
31063179375
from ..utils import Object class GroupCallParticipantVideoInfo(Object): """ Contains information about a group call participant's video channel Attributes: ID (:obj:`str`): ``GroupCallParticipantVideoInfo`` Args: source_groups (List of :class:`telegram.api.types.groupCallVideoSour...
iTeam-co/pytglib
pytglib/api/types/group_call_participant_video_info.py
group_call_participant_video_info.py
py
1,336
python
en
code
20
github-code
36
40917483210
import requests import json import sys import os class PR(): def __init__(self, token, user, repo) -> None: self.token = token self.user = user self.repo = repo def raise_pr(self, title, head, base): url = "https://api.github.com/repos/"+ self.user +"/"+ self.repo+"/p...
ajayk007/UI_release
raise_pr.py
raise_pr.py
py
2,156
python
en
code
0
github-code
36
3204985173
''' TI INA260 Current Logging (I2C-register-based) Datasheet: http://www.ti.com/lit/ds/symlink/ina260.pdf?ts=1590430404379 I2C address: 0x44 ''' import smbus import time class INA260: # INA260 registers address __REG_CONFIG = 0x00 __REG_CURRENT = 0x01 __REG_BUS_VOLTAGE_ADDR = 0x...
rasisbuldan/ta-shop
data-acq/ina260/ina260.py
ina260.py
py
2,210
python
en
code
2
github-code
36
16140910097
""" Recognizes the mine board from screenshot. """ import os import sys import numpy as np from scipy.spatial.distance import cdist import cv2 from PIL import Image from solverutils import CID import pyautogui as pg IMGDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'imgs') # related to board cells...
kkew3/sat-minesweeper
vboard.py
vboard.py
py
20,542
python
en
code
6
github-code
36
21609680031
from contextlib import contextmanager import sys import os import tempfile from shutil import rmtree from os import getcwd, chdir from os.path import join, basename, dirname, isdir, abspath, sep import unittest import six from six.moves import reload_module from pylint import config, lint from pylint.lint import PyLi...
a0x8o/kafka
sdks/python/.tox/lint/lib/python2.7/site-packages/pylint/test/unittest_lint.py
unittest_lint.py
py
26,703
python
en
code
59
github-code
36
73119063784
import unittest.mock as mock def fun(service): service.show() service.name = "Hello" s = service.get() return s m = mock.Mock() m.get.return_value = 100 res = fun(m) assert(m.show.called is True) assert(res == 100)
IlyaOrlov/PythonCourse2.0_September23
Useful/for_lec_22/mock_simple_example.py
mock_simple_example.py
py
236
python
en
code
2
github-code
36
24272755981
# A string S of lowercase English letters is given. We want to partition this string into # as many parts as possible so that each letter appears in at most one part, and return # a list of integers representing the size of these parts. def partition_labels(S): last_index_dict = {c: i for i, c in enumerate(S)} ...
elainedo/python_practice
Array/PartitionLabels.py
PartitionLabels.py
py
646
python
en
code
0
github-code
36
1274170578
import csv def line_message(line): cs = line.rsplit(']', 1) return cs[1] def line_thread(line): cs = line.rsplit(']', 1) cols = cs[0].replace("]", "").split("[") if(len(cols)>=5): return cols[4] return "" def read_columns(lines): cols = set() for line in lines: cols.ad...
ChristofferGreen/Forsoning
src/tools/spdtocsv.py
spdtocsv.py
py
995
python
en
code
0
github-code
36
29500719773
import json from pyspark.sql import SparkSession from pyspark.sql.functions import concat, col, lit, split, to_date, date_format import os import time # Create a SparkSession spark = SparkSession.builder.getOrCreate() # Start the timer start_time = time.time() # Load the config file with open('config.json') as f: ...
hari01008/Extract-Transform-Load-With-Mysql-and-Pyspark
transform.py
transform.py
py
2,316
python
en
code
0
github-code
36
43163584792
from flask import Flask from flask_pymongo import PyMongo from operator import itemgetter from flask_login import LoginManager import sys # Initialize mongo db with app app = Flask(__name__) # mongodb_client = PyMongo(app, uri='mongodb://localhost:27017/todo_db') mongodb_client = PyMongo(app, uri='mongodb://mongo:2701...
rickyjorgensen2000/cse312
flaskr/db.py
db.py
py
4,316
python
en
code
0
github-code
36
3223594
numero = int(input('Digite um número para testar se é primo: ')) def e_primo(n): if n < 2: return False i=n//2 while i > 1: if n%i == 0: return False i -= 1 return True def imprimir_resultado(n): if e_primo(n): print(f'O número {n} é primo') else: ...
Medeiros000/Estacio_estudo
Estudo_Python/Alura/Basico/Modulo_03/Teste_14_Primo.py
Teste_14_Primo.py
py
396
python
pt
code
0
github-code
36
36627702709
import random import numpy as np import pickle # a copy of visualsnake.py but without the PyGame class LearnSnake: def __init__(self): self.screen_width = 600 self.screen_height = 400 self.snake_size = 10 self.snake_speed = 15 self.snake...
techtribeyt/snake-q-learning
snake_no_visual.py
snake_no_visual.py
py
5,834
python
en
code
1
github-code
36
29573142583
import tensorflow as tf from model import char_rnn from utils import build_dataset import numpy as np start_token = 'B' end_token = 'E' model_dir = 'result/poem' corpus_file = 'data/poems.txt' lr = 0.0002 def to_word(predict, vocabs): predict = predict[0] predict /= np.sum(predict) sample = np.random.ch...
yanqiangmiffy/char-rnn-writer
generate_poem.py
generate_poem.py
py
2,358
python
en
code
83
github-code
36
15856967243
from .worker import * class WorkerMoon(Worker): def __init__(self, conf): super().__init__(conf) def prepare_train(self): self._prepare_train() for i in range(self.models_buffer_len): self.models_buffer[i].to(self.device) def listen_to_master(self): # listen to...
CGCL-codes/FedGKD
pcode/workers/worker_moon.py
worker_moon.py
py
4,105
python
en
code
5
github-code
36
24347774605
import requests as req from lxml import html from tqdm import tqdm url = 'http://swf.com.tw/scrap/' page = req.get(url) dom = html.fromstring(page.text) images = dom.xpath('//img/@src') def download(url): filename = url.split('/')[-1] r = req.get(url, stream=True) with open(filename, 'wb...
theoyu13/python3
python程式設計入門/F9796/ch11/download_img.py
download_img.py
py
787
python
en
code
0
github-code
36
13840387121
from django.contrib import admin from django.urls import path, include from . import views urlpatterns = [ path('joueur/',views.joueur, name="Joueur"), path('club/',views.club,name="Club"), path('player/',views.player,name="Player"), path('',views.home, name="Home"), path('affiche/',views.affiche_...
2bFaycal/projet-django
foot/app/urls.py
urls.py
py
1,182
python
fr
code
0
github-code
36
7043720148
from keras.applications.inception_v3 import InceptionV3 from tensorflow.keras import layers, models, optimizers INPUT_SHAPE_300_300 = (300, 300, 3) def create_model(input_shape=INPUT_SHAPE_300_300, weights=None): if weights is not None: inception_base = InceptionV3( weights=None, include_top=...
SalmanRafiullah/garbage-classification
models/inception_v3.py
inception_v3.py
py
1,034
python
en
code
0
github-code
36