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
39956836499
# -*- coding: utf-8 -*- """ Created on Wed Oct 19 14:11:57 2022 @author: Saskia Hustinx """ import re import gpt_2_simple as gpt2 import tensorflow as tf import json import tweepy import random import time ### NLP SECTION ### def words_in_string(word_list, a_string): return set(word_list).intersection(a_string.s...
sHustinx/nlp-fortune-cookie-bot
respond-dms.py
respond-dms.py
py
2,664
python
en
code
0
github-code
6
21098037404
# -*- coding: utf-8 -*- from flask import Blueprint, g, request, redirect, url_for, current_app import os from invenio.ext.template.context_processor import \ register_template_context_processor, template_args from invenio.base.decorators import templated from invenio.modules.formatter import format_record from...
cjhak/b2share
invenio/b2share/modules/main/views.py
views.py
py
2,867
python
en
code
null
github-code
6
39735748017
class BankAccount: # Class attributes number = 1 all_accounts = [] # Constructor def __init__(self, int_rate=0.05, balance=0, acc_id=number): self.int_rate = int_rate self.balance = balance self.id = acc_id BankAccount.all_accounts.append(self) BankAccount.nu...
r-lutrick/Coding-Dojo
Python/Fundamentals/OOP/Users_with_Bank_Accounts/users_with_bank_accounts.py
users_with_bank_accounts.py
py
3,006
python
en
code
1
github-code
6
33626981361
from flask import Flask, request import requests import tkinter as tk from tkinter import simpledialog import pdfrw import json from flask_cors import CORS import io import base64 app = Flask(__name__) CORS(app) @app.route("/") def hello_world(): ROOT = tk.Tk() ROOT.withdraw() # the input dialog # USE...
MHSiles/yoloco-be
other/main-2.py
main-2.py
py
4,824
python
en
code
0
github-code
6
16907993758
import numpy as np from .sigmoid import sigmoid def predict(Theta1, Theta2, X): '''้š่—ๅฑ‚''' m = X.shape[0] num_labels = Theta2.shape[0] a1 = np.vstack((np.ones(m), X.T)).T a2 = sigmoid(np.dot(a1, Theta1.T)) a2 = np.vstack((np.ones(m), a2.T)).T a3 = sigmoid(np.dot(a2, Theta2.T)) return ...
2332256766/python_test
MachineL_The_4_week_practise/predict.py
predict.py
py
348
python
en
code
0
github-code
6
73268001788
# Uncomment the next two lines to enable the admin: from django.conf.urls import patterns, include, url from productes import views urlpatterns = patterns('', url(r'^$', views.llistarProductes, name='llistarProductes'), url(r'^llistarCategories/$', views.llistarCategories, name='llistarCategories'), url(r'...
kimpa2007/restoGestio
tpv/productes/urls.py
urls.py
py
938
python
en
code
0
github-code
6
2088985509
#!/usr/bin/env python """@namespace IMP.pmi.tools Miscellaneous utilities. """ from __future__ import print_function, division import IMP import IMP.algebra import IMP.isd import IMP.pmi import IMP.pmi.topology try: from collections.abc import MutableSet # needs Python 3.3 or later except ImportError: fro...
salilab/pmi
pyext/src/tools.py
tools.py
py
60,875
python
en
code
12
github-code
6
43970042116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ AUTHOR Pedro Cerqueira github: @pedrorvc DESCRIPTION This script serves to create xml files contaning the information necessary for the execution of BRIG (Blast Ring Image Generator), reducing the time performing the tedious task of setting u...
TAMU-CPT/galaxy-tools
tools/genome_viz/brigaid.py
brigaid.py
py
36,126
python
en
code
5
github-code
6
28895134213
apuntador = None class Nodo(object): def __init__(self, data): self.data = data self.next = None def push(self): global apuntador apuntador.next = self apuntador = self print("Se ha ingresado: "+self.data) opcion = 0 raiz = Nodo("raiz") apuntador ...
RamirezNOD/EstructurasNOD
Practica17-ListasPush.py
Practica17-ListasPush.py
py
896
python
es
code
0
github-code
6
5592159173
from .http import * from .abc import User, Channel from .channels import DMChannel import asyncio as aio class Client: """ Base class for interacting with discord """ def __init__(self, token: str): self.http = HTTPClient(token) self.event_loop = aio.new_event_loop() aio.set_...
ledanne/descapede
diswrap/client.py
client.py
py
2,060
python
en
code
1
github-code
6
27627859074
#!/usr/bin/python3 def add_tuple(tuple_a=(), tuple_b=()): # use slice to get the first two element a = tuple_a[:2] b = tuple_b[:2] # fill the missing element with 0 while len(a) < 2: a += (0,) while len(b) < 2: b += (0,) # get the sum of the tuple sum_tuple = (a[0] + b[0...
Hovixen/alx-higher_level_programming
0x03-python-data_structures/7-add_tuple.py
7-add_tuple.py
py
357
python
en
code
0
github-code
6
39400883437
import boto3 import pickle from typing import Any, Tuple import logging from re import sub import pandas as pd import numpy as np from sklearn.metrics import average_precision_score from sklearn.model_selection import StratifiedShuffleSplit import xgboost as xgb # ----- Class for uploading and downloading Python ob...
YangWu1227/python-for-machine-learning
tree_based/projects/telco_churn_sagemaker/src/custom_utils.py
custom_utils.py
py
4,461
python
en
code
0
github-code
6
33627877063
#Exercice 2 Mascaro Matteo import math limit = 100 limit = str(limit) print('Welcome palindromiques numbers put any multipliation with 2 numbers in each side :') print("Rentrez la multiplication ex : (91 * 99) ") A = input("Rentrez la valeur A = ") B = input("Rentrez la valeur B = ") """ print(A) J'arrive pas ร  faire...
m4skro/programmation-securisee
TP1/Palindromiques.py
Palindromiques.py
py
542
python
fr
code
null
github-code
6
70126940349
def build_profile(first_name: str, last_name: str, **user_info: str) -> dict: """Build a dictionary containing everything we know about a user""" user_info["first_name"] = first_name user_info["last_name"] = last_name return user_info user_profile = build_profile( "albert", "einstein", location="p...
paulr909/python-snippets
python-various/functions/build_dict_with_function.py
build_dict_with_function.py
py
369
python
en
code
0
github-code
6
28427006920
list1 = [1, 3, 5, 7, 100] # ้€š่ฟ‡ๅพช็Žฏ็”จไธ‹ๆ ‡้ๅކๅˆ—่กจๅ…ƒ็ด  for a in range(len(list1)): # range() ๆ–นๆณ• print(a, list1[a], " ", end='') print() # ้€š่ฟ‡forๅพช็Žฏ้ๅކๅˆ—่กจๅ…ƒ็ด  for elem in list1: print(elem, " ", end="") print() # ้€š่ฟ‡enumerateๅ‡ฝๆ•ฐๅค„็†ๅˆ—่กจไน‹ๅŽๅ†้ๅކๅฏไปฅๅŒๆ—ถ่Žทๅพ—ๅ…ƒ็ด ็ดขๅผ•ๅ’Œๅ€ผ for index, elem in enumerate(list1): # enumerate๏ผˆ๏ผ‰ๅŒๆ—ถๅˆ—ๅ‡บๆ•ฐๆฎๅ’Œๆ•ฐๆฎไธ‹ๆ ‡๏ผŒ print(index, el...
sunhuimoon/Python100Days
day07/day0704.py
day0704.py
py
776
python
zh
code
0
github-code
6
21929473251
import re from sys import argv #Steven A #THE "CORRECT" REGEX: #([^,]*),"(.*)",([^,]*),\[(.*)\],\[(.*)\],"(.*)",\[(.*)\],\[(.*)\],\[(.*)\],"(.*)" #id ,"name",release_year,[developers],[publishers],"image",[src],[genres],[consoles],"description" #this program merges entries based of GID #please do not use this to ove...
schoolfromage/RetroSounding
backend/scrapers/csv_limited_merger.py
csv_limited_merger.py
py
2,464
python
en
code
1
github-code
6
32108920209
import json from typing import List import mlflow import pandas from pandas import DataFrame class SpambugInference(mlflow.pyfunc.PythonModel): """ Inference code copied from MLFlow bugs.py """ def __init__(self, extraction_pipeline, clf, le): self.extraction_pipeline = extraction_pipeline ...
mozilla/mlops-platform-spike-library
bugbug/mlflow/bugbug/trackers/spambug_inference.py
spambug_inference.py
py
1,839
python
en
code
0
github-code
6
35383876896
import json from random import randint import discord from discord.ext import tasks, commands def getData(): with open("data.json", "r") as levelsFile: return json.loads(levelsFile.read()) def setData(_dict): with open("data.json", "w") as levelsFile: levelsFile.write(json.dumps(_dict)) l...
JONKKKK/Codes
2MS2A/dnd.py
dnd.py
py
7,250
python
en
code
0
github-code
6
69952730427
#!/usr/bin/env python3 import rospy from sebot_service.srv import GetImage, SetGoal class Sebot: def __init__(self): rospy.init_node('sebot_server') self.image_msg = None self.img_srv = rospy.Service("get_image", GetImage, self.get_image) while not rospy.is_shutdown(): ...
JiHwonChoi/TEAM_B
sebot_service/src/sebot_server.py
sebot_server.py
py
465
python
en
code
3
github-code
6
28156207354
import torch from projects.thre3ingan.singans.networks import Thre3dGenerator from torch.backends import cudnn cudnn.benchmark = True device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def test_thre3d_generator() -> None: batch_size = 1 random_input = torch.randn(batch_size, 128, 64, 64,...
akanimax/3inGAN
projects/thre3ingan/singans/tests/test_networks.py
test_networks.py
py
491
python
en
code
3
github-code
6
27259802510
"""We are the captains of our ships, and we stay 'till the end. We see our stories through. """ """513. Find Bottom Left Tree Value [Two Passes] """ from collections import deque class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None class Solution: ...
asperaa/back_to_grind
Trees/bottom_left_tree.py
bottom_left_tree.py
py
890
python
en
code
1
github-code
6
7983714433
import random random.seed(2023) # Dividir los datos de test en oraciones en espaรฑol e inglรฉs data_es = [] data_en = [] with open('Bicleaner AI/Full/Paracrawl.AIFull.shortPhrases.threshold05_shuffled.txt', 'r', encoding='utf-8') as file: for line in file: columns = line.strip().split('\t') ...
jairosg/TFM
scripts/genTest.py
genTest.py
py
1,515
python
en
code
0
github-code
6
1008711212
'''Problem 22: Names scores''' import time t1 = time.time() #first get "alphabetical value" of each letter ALPHA = 'abcdefghijklmnopqrstuvwxyz'.upper() ALPHA = {c:i+1 for i,c in enumerate(ALPHA)} def alphaValue(name): '''adds up alpha values for letters''' sum1= 0 for letter in name: ...
hackingmath/Project-Euler
euler22.py
euler22.py
py
913
python
en
code
0
github-code
6
6153769301
from django.shortcuts import render from . models import Department, Employee, User, Phone, Book, Store from django.http import HttpResponse # Create your views here. def index(request): # without relationship: user = User.objects.get(pk=1) phone = Phone.objects.get(user_id=user) #...
oruchkin/biteofpithon
django relationships/relation/core/views.py
views.py
py
3,072
python
en
code
0
github-code
6
31127201950
# to run, execute this command in the command line: # python create_plots.py pagecounts-20160802-150000.txt pagecounts-20160803-150000.txt import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt filename1 = sys.argv[1] filename2 = sys.argv[2] data1 = pd.read_table(filename1, sep=' ',...
tomliangg/Plotting_Wikipedia_Page_Views
create_plots.py
create_plots.py
py
1,324
python
en
code
0
github-code
6
28114724866
import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['Microsoft YaHei'] # ๆ•ฐๆฎ sizes = ["0.5x0.5", "2x2", "5x5", "7x7"] postgres = [2, 10, 94, 153] accumulo = [8, 15, 22, 41] # ็ป˜ๅ›พ plt.plot(sizes, postgres, label="PostgreSQL") plt.plot(sizes, accumulo, label="Accumulo") plt.xlabel("Extent(kmยฒ)") plt.ylabe...
KiktMa/gdal_tiff
shange/paintsd.py
paintsd.py
py
386
python
en
code
0
github-code
6
3981685761
from django.test import TestCase from django import forms from parameterized import parameterized from MDM.forms import ItemGroupForm from MDM.bootstrap import INPUT class ItemGroupFormTest(TestCase): @parameterized.expand([ ('description', 'Descriรงรฃo do Grupo de Item'), ]) def test_form_labels(...
tiagomend/flow_erp
MDM/tests/test_item_group_form.py
test_item_group_form.py
py
1,264
python
en
code
0
github-code
6
27742958751
""" POO * Elaborar un Programa el cual calcule el costo de produccion, nesecitaras conocer: - Costo de la materia prima. - Costo de la mano de obra. - Cantidad de unidades producidas. * Mostrar el: - Costo de produccion total. - Precio de produccion por unidad. - El precio del producto al mercado(El doble del ...
proyecto3erpacial/proyecto3erpacial
eje4.py
eje4.py
py
1,340
python
es
code
0
github-code
6
70111562109
import requests def run(): api_key = 'f258ca5a16d84339a5f6cdb4c7700756' query_map = {} url = 'http://api.weatherbit.io/v2.0/current' query_map['lat'] = 39.757 query_map['lon'] = -75.742 query_map['key'] = api_key query_map['lang'] = 'en' response = requests.get(url,params=query_map).js...
cthacker-udel/Raspberry-Pi-Scripts
py/getcurrweather.py
getcurrweather.py
py
441
python
en
code
7
github-code
6
38386704949
import connections import time import ubinascii import struct import math def byte_to_info(uuid): gas_res_d = 0 name = uuid[0:3] name_text = ''.join(chr(t) for t in name) if name_text == "PyN": sensor_id = uuid[7] mac = ubinascii.hexlify(uuid[10:16]) press = ubinasc...
MatiasRaya/IoT-PS
Proyecto/EXPOTRONICA/PYTRACK/airq.py
airq.py
py
1,275
python
en
code
1
github-code
6
38997636297
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- from getpass import getpass from utility_classes import ( check_version, get_coin_selection, get_user_choice, get_user_number, UATOM, UKUJI, ULUNA, UOSMO, UserConfig, UUSD, Wallets, Wallet, WETH, ) from utility_constan...
geoffmunn/utility-scripts
swap.py
swap.py
py
12,915
python
en
code
1
github-code
6
18964566006
#coding: utf-8 #Crispiniano #Unidade 6: Quanto Tempo def quanto_tempo(horario1,horario2): h1 = int(horario1[0] + horario1[1]) m1 = int(horario1[3] + horario1[4]) minutos_totais_1 = h1 * 60 + m1 h2 = int(horario2[0] + horario2[1]) m2 = int(horario2[3] + horario2[4]) minutos_totais_2 = h2 * 60 + m2 diferenca ...
almirgon/LabP1
Unidade-6/tempo.py
tempo.py
py
532
python
pt
code
0
github-code
6
42433734628
import pytest import random from torchrl.envs import make_gym_env, TransitionMonitor @pytest.mark.parametrize('spec_id', [ 'Acrobot-v1', 'CartPole-v1', 'MountainCar-v0', 'MountainCarContinuous-v0', 'Pendulum-v0', ]) def test_transition_monitor(spec_id: str): env = TransitionMonitor(make_gym_env...
activatedgeek/torchrl
torchrl/envs/test_wrappers.py
test_wrappers.py
py
968
python
en
code
110
github-code
6
811926906
'''Find Leaves of Binary Tree - https://leetcode.com/problems/find-leaves-of-binary-tree/ Given the root of a binary tree, collect a tree's nodes as if you were doing this: Collect all the leaf nodes. Remove all the leaf nodes. Repeat until the tree is empty. Example 1: Input: root = [1,2,3,4,5] Output: [[4,5,3],[2...
Saima-Chaity/Leetcode
Tree/Find Leaves of Binary Tree.py
Find Leaves of Binary Tree.py
py
1,265
python
en
code
0
github-code
6
70384349309
import numpy as np import scipy import cv2 import matplotlib.pyplot as plt from matplotlib.colors import LightSource def rotate_and_crop(arr, ang): """Array arr to be rotated by ang degrees and cropped afterwards""" arr_rot = scipy.ndimage.rotate(arr, ang, reshape=True, order=0) shift_up = np.ceil(np.arcs...
openearth/vcl
vcl/data.py
data.py
py
6,478
python
en
code
2
github-code
6
29476131174
#! /usr/bin/env python # -*- coding: utf-8 -*- """Fine tune CTC network (CSJ corpus, for dialog).""" import os import sys import time import tensorflow as tf from setproctitle import setproctitle import yaml import shutil import tensorflow.contrib.slim as slim sys.path.append('../') sys.path.append('../../') sys.pat...
hirofumi0810/tensorflow_end2end_speech_recognition
examples/csj/fine_tuning/finetune_ctc_dialog.py
finetune_ctc_dialog.py
py
20,860
python
en
code
312
github-code
6
34294677016
from django.contrib import admin from django.urls import path from final import views urlpatterns = [ path("", views.index, name="root"), path("about/", views.about, name="about"), path("signup/", views.signup, name="signup"), path("login/", views.loginUser, name="login"), path("contact/", views.co...
supratim531/useless-django-app
final/urls.py
urls.py
py
455
python
en
code
0
github-code
6
18467755288
import random import pandas as pd #This is where the wagon class will be. class Wagon(): #One weird variable here may be wagonStructure. This variable is a boolean variable which will if set to #true means the wagon can move. If it is set to false the wagon cannot move. def __init__(self, ration, health, w...
ravenusmc/trail
wagon.py
wagon.py
py
4,906
python
en
code
0
github-code
6
8516167540
import numpy as np import matplotlib.pyplot as plt import h5py path_Lf3D = "/mn/stornext/d19/RoCS/alma/emissa_sim/linfor3D/outhdf/" f = {"500nm" : h5py.File(path_Lf3D + "d3t57g44c_v000G_n019_it000_05000_mu1_00_linfor_3D_2.hdf", "r"), "1mm" : h5py.File(path_Lf3D + "d3t57g44c_v000G_n019_it000_01mm_mu1_00_linfor_...
jonasrth/MSc-plots
mean_CF.py
mean_CF.py
py
1,183
python
en
code
0
github-code
6
17559223931
import unittest from sudoku import Sudoku class TestUtilities(unittest.TestCase): def setUp(self): """ Init a completed sudoku for testing """ self.grid = [[1, 3, 9, 5, 7, 6, 8, 4, 2], [2, 5, 8, 4, 9, 3, 1, 6, 7], [7, 4, 6, 2, 8, 1, 9, 5,...
ArttuLe/ot-harjoitustyo
src/tests/utilities_test.py
utilities_test.py
py
2,040
python
en
code
0
github-code
6
38137944576
import dash from dash import html, dcc from dash.dependencies import Input, Output import plotly.graph_objs as go from plotly.subplots import make_subplots import pandas as pd # Load data df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv") # Create subplots fig = make...
TIIIIIIW/SOFTWARE-DEVELOPMENT-2
ML/Data/TestDash.py
TestDash.py
py
2,975
python
en
code
1
github-code
6
6951725407
import turtle import time import random delay = 0.1 #Score score =0 highScore=0 #Setting up the screen window = turtle.Screen() window.title("Snake Game by Lexiang Pan and Ryan Shen") window.bgcolor("green") window.setup(width=600, height = 600) window.tracer(0) #Head of the snake: head = turtle.Turtle() head.speed...
RyanSh3n/ICS3U1
CPT/SnakeGame.py
SnakeGame.py
py
3,567
python
en
code
0
github-code
6
43133597312
# This script is developed by Team 11 CIS 3760 # Parser - to parse the plain text file into json file import sys import re import json import os sys.path.insert(1, os.path.join(sys.path[0], '..')) import course_util uOCourseCodeIsolatedPat = re.compile(r'^\w{3}[ ]?\d{4}$') uOCourseCodePat = re.compile(r'...
jessendasilva1/UniveristySearch
graphing/util/parser/ottawaCourseParser.py
ottawaCourseParser.py
py
11,463
python
en
code
0
github-code
6
22168670744
from odoo import models, api from odoo.addons.l10n_ar.models.account_fiscal_position import AccountFiscalPosition @api.model def _get_fiscal_position(self, partner, delivery=None): company = self.env.company if company.country_id.code == "AR": self = self.with_context( company_code='AR', ...
ingadhoc/odoo-argentina
l10n_ar_ux/models/account_fiscal_position.py
account_fiscal_position.py
py
2,196
python
en
code
89
github-code
6
36011166018
# encoding: utf8 # Import local files: import rois as ROIS import gui_functions as GUIF import structure_set_functions as SSF from tkinter import messagebox # Clinical Goal class class ClinicalGoal(object): def __init__(self, name, criteria, type, tolerance, value, priority): self.name = name self.criter...
dicom/raystation-scripts
rt_classes/clinical_goal.py
clinical_goal.py
py
4,341
python
en
code
40
github-code
6
25911867612
from Solution import Solution class P004(Solution): def is_palindromic(self, number): number_as_string = str(number) reverse = number_as_string[::-1] if reverse == number_as_string: return True else: return False def solve(self): self.problem_num...
TalaatHarb/project-euler-100
python-project-euler-100/p004.py
p004.py
py
783
python
en
code
2
github-code
6
2768054561
# add is O(1) because it appends which doesnt take any time. # Remove is O(1) because if stack_1 is empty, returns empty queue # It appends popped values from stack_1 to stack_2 and returns popped value of stack_2 class QueueStack: def __init__(self): self.stack_1 = [] self.stack_2 = [] def a...
CarlBorillo/CECS-274
CECS 274 PROJ 1/CECS 274 PROJ 1/1_5_queue.py
1_5_queue.py
py
1,148
python
en
code
0
github-code
6
34398796086
from typing import List import docx from .IngestorInterface import IngestorInterface from .QuoteModel import QuoteModel class DocxIngestor(IngestorInterface): allowed_extensions = ['docx'] @classmethod def parse(cls, path: str) -> List[QuoteModel]: if not cls.can_ingest(path): raise ...
KosziDrimi/Meme-Generator-project
QuoteEngine/DocxIngestor.py
DocxIngestor.py
py
800
python
en
code
0
github-code
6
12138793296
from dataclasses import fields from pyexpat import model import django from django import forms from django.db.models import fields from django.contrib.auth.forms import UserCreationForm,AuthenticationForm from django.forms import ModelForm from .models import * class CustomUserCreationForm(UserCreationForm): clas...
baadhira/shopify-ecommerce
adminapp/forms.py
forms.py
py
4,635
python
en
code
0
github-code
6
27615702847
""" Get 10 titles of the most popular movies/series etc. by each genre. ะŸะพะปัƒั‡ะธั‚ะต 10 ะฝะฐะธะผะตะฝะพะฒะฐะฝะธะน ัะฐะผั‹ั… ะฟะพะฟัƒะปัั€ะฝั‹ั… ั„ะธะปัŒะผะพะฒ/ัะตั€ะธะฐะปะพะฒ ะธ ั‚. ะด. ะฒ ะบะฐะถะดะพะผ ะถะฐะฝั€ะต. title.basics.tsv.gz title.ratings.tsv.gz """ from pyspark import SparkConf from pyspark.sql import SparkSession import pyspark.sql.types as t import pyspark.sql.func...
Tetyana83/spark
task8.py
task8.py
py
2,591
python
en
code
0
github-code
6
42242066819
from random import Random from torch.utils.data import DataLoader from torchvision import transforms, datasets class Partition: def __init__(self, data, index): self.data = data self.index = index def __len__(self): return len(self.index) def __getitem__(self, idx): data_...
DragonChen-TW/torch_DDP
data_partition.py
data_partition.py
py
1,832
python
en
code
1
github-code
6
36551632681
import matplotlib.pyplot as plt from DataHandler import DataHandler from LinearClassifier import LinearClassifier if __name__ == '__main__': #generating a normal distributed data (1000 samples per class) data_handler = DataHandler() class0Dataset = data_handler.get2DGaussian(1000, [-2, -2]) cla...
Mustapha-Belkacim/Linear-classifier
main.py
main.py
py
1,623
python
en
code
0
github-code
6
40113246551
import os import sys import ruamel.yaml as yaml import llnl.util.tty as tty import llnl.util.lang import spack.repo import spack.cmd.common.arguments as arguments from spack.cmd import display_specs from spack.filesystem_view import filter_exclude from spack.build_systems.python import PythonPackage import spack.ut...
tomdele/spack
lib/spack/spack/cmd/export.py
export.py
py
5,533
python
en
code
null
github-code
6
9378129688
import operator import pandas as pd def segmentation(dataset: pd.DataFrame, rfm: list, d: int): """ Sort RFM Segmentation function :param dataset: given dataset :param rfm: a list of three column name R, F, M :param d: number of delimiters to divide data based on each factor :return: dataset w...
smh997/Audiobook-Customer-Segmentation-and-Purchase-Prediction
Customer Segmentation/RFM/sort_segmentation.py
sort_segmentation.py
py
1,371
python
en
code
1
github-code
6
72650143867
cod1,num1,valor1 = input().split() cod1,num1,valor1 = int(cod1),int(num1),float(valor1) cod2,num2,valor2 = input().split() cod2,num2,valor2 = int(cod2),int(num2),float(valor2) peca1 = num1*valor1 peca2 = num2*valor2 total = peca1 + peca2 print(f'VALOR A PAGAR: R$ {total:.2f}')
hpalermoemerick/Exercicios-do-Beecrowd
1010_Calculo_Simples.py
1010_Calculo_Simples.py
py
279
python
pt
code
0
github-code
6
26536074156
def regresiva(n): while n > 0: yield n n -= 1 for x in regresiva(10): print(x, end=" ") list(regresiva(10)) #%% def filematch(filename, substr): with open(filename, 'r') as f: for line in f: if substr in line: yield line for line in open('Data/cam...
francosbenitez/unsam
10-generadores-e-iteradores/tests.py
tests.py
py
442
python
en
code
0
github-code
6
75137098747
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import Permission from .models import Organization, OrganizationUser class OrganizationBackend(ModelBackend): supports_object_permissions = True def authenticate(self, organization=None, username=None, password=None): ...
avidal/django-organizations
organizations/backends.py
backends.py
py
6,718
python
en
code
1
github-code
6
12091024325
from typing import List, Iterator import torch from torch.utils.data.sampler import Sampler from nltk import Tree from nltk.tokenize.treebank import TreebankWordTokenizer class TokenizedLengthSampler(Sampler[List[int]]): """ PyTorch DataLoader - compatible sampler class that batchify sentences with the most ...
jinulee-v/bert_diora
bert_diora/utils.py
utils.py
py
1,470
python
en
code
0
github-code
6
21929427517
# Trial project - Number guessing import time import random random_number = random.randint(1,100) player_point = 0 attempt_counter = 0 print("Welcome to number guessing challenge. You will get 10 chance to guess the correct number!\n") while attempt_counter <=10: print(f"Currect time : {time.asctime()}") use...
MahbinAhmed/Learning
Python/Python Practice/number_guessing.py
number_guessing.py
py
941
python
en
code
0
github-code
6
41211802240
#import cv2 from keras.applications.vgg16 import VGG16 from keras.preprocessing import image from keras.applications.vgg16 import preprocess_input, decode_predictions import numpy as np import os import sys import json from PIL import Image # import Image import requests from io import BytesIO import urllib3 import h5p...
ming19956/PFE
information-retrival-search-engine/informationRetrival/vgg16_p/newvgg.py
newvgg.py
py
9,112
python
en
code
2
github-code
6
71839302589
import unittest, os from pre_requirements import BASE_FOLDER from budget_system import PurchaseList from budget_system.settings.Config import ConfigBudget from pandas.core.frame import DataFrame from numpy import float64 class PurchaseListTest(unittest.TestCase): def setUp(self) -> None: os....
carlosmperilla/budget-system
tests/test_purchaselist.py
test_purchaselist.py
py
1,997
python
en
code
2
github-code
6
22218524626
''' Convienence methods on VTK routines only ''' import director.vtkAll as vtk import director.vtkNumpy as vnp from director.shallowCopy import shallowCopy import numpy as np def thresholdPoints(polyData, arrayName, thresholdRange): assert(polyData.GetPointData().GetArray(arrayName)) f = vtk.vtkThresholdPoin...
RobotLocomotion/director
src/python/director/filterUtils.py
filterUtils.py
py
4,630
python
en
code
176
github-code
6
22781339759
import IMP import IMP.pmi import IMP.pmi.macros import RMF import matplotlib.pyplot as plt import seaborn as sns import sys import numpy as np import argparse ######### # PARSER ######### p = argparse.ArgumentParser( description="Align selected RMF files. \n" "Example of usage: alig...
Altairch95/ExocystDYN
scripts/align_rmf.py
align_rmf.py
py
5,528
python
en
code
0
github-code
6
12028632350
import tkinter from tkinter import messagebox from src.game.minesweeper import Minesweeper from src.game.minesweeper import CellStatus from src.game.minesweeper import GameStatus from datetime import datetime import platform class MineweeperUI: def __init__(self, root): self.ui_window = root self.ui_window.t...
PriscillaRoy/MinesweeperGame
src/gui/minesweeper_ui.py
minesweeper_ui.py
py
3,636
python
en
code
0
github-code
6
13530263096
n, m = map(int, input().split()) S = [] strings = [] for _ in range(n): S.append(input()) for _ in range(m): strings.append(input()) answer = 0 for i in strings: if i in S: answer += 1 print(answer)
zooonsp/Baekjoon_zooonsp
๋ฐฑ์ค€/Silver/14425.โ€…๋ฌธ์ž์—ดโ€…์ง‘ํ•ฉ/๋ฌธ์ž์—ดโ€…์ง‘ํ•ฉ.py
๋ฌธ์ž์—ดโ€…์ง‘ํ•ฉ.py
py
243
python
en
code
0
github-code
6
25390435322
import logging import requests import pandas as pd import time from .sqlite import Orders from .sqlite import Balances class BitMex(): def pull_bitmex_orderbooks(symbol, limit, mode='live'): # Tracking execution time start_ts = time.time() * 1000 # Get request request = requests.get('https://www.b...
noqcks/bmex-algo
src/bitmex.py
bitmex.py
py
8,025
python
en
code
0
github-code
6
30821160760
import pandas data = pandas.read_csv("Squirrel_Data.csv") #the begining and the end of the first and last lines #gray_squirrels = data[data["Primary Fur Color"] == "Gray"] #print(gray_squirrels) gray_squirrels_count = len(data[data["Primary Fur Color"] == "Gray"]) red_squirrels_count = len(data[data["Primary Fur Color...
d3cod3d/notes
pandas_cheat_sheet.py
pandas_cheat_sheet.py
py
1,312
python
en
code
0
github-code
6
22837983090
import pandas as pd import networkx as nx # def splitDataFrameList(df,target_column,separator): # ''' df = dataframe to split, # target_column = the column containing the values to split # separator = the symbol used to perform the split # returns: a dataframe with each entry for the target column separated, with...
brooksjaredc/podcast_network_analysis
analyzing_functions/set_node_attr.py
set_node_attr.py
py
2,988
python
en
code
1
github-code
6
23142628393
# Neuon AI - PlantCLEF 2020 import tensorflow as tf from preprocessing import inception_preprocessing slim = tf.contrib.slim import numpy as np import cv2 from nets.inception_v4 import inception_v4 from nets import inception_utils from PIL import Image from six.moves import cPickle import pandas as pd from sklearn.met...
NeuonAI/plantclef2020_challenge
validate_image.py
validate_image.py
py
9,376
python
en
code
1
github-code
6
32509221733
import numpy as np import matplotlib.pyplot as plt import scipy.stats as sc import csv def myAnova(Matrice, pvalue_crit): # Initialisation : H = 0 F = 0 var_intra = 0 var_inter = 0 obs_moy = 0 eff_tot = 0 # Moyenne des classes : for i in range(len(Matrice)): obs_moy = sum(Ma...
Varelafv/TD6.py
TD2-EXO2.py
TD2-EXO2.py
py
5,319
python
fr
code
0
github-code
6
7874070036
import random r,p,s = "Rock", "Paper","Scissor" words = ("Rock", "Paper","Scissor") cpu = random.choice(words) me = input("Rock, Paper or Scissor: \n\n") print(f"{cpu} \n") if me == cpu: print("Game Draw!!") elif me == "Rock": if cpu == "Scissor": print("You Won!!") elif cpu == "Paper": pri...
Sheham30/Python
RockPaperScissor/01.py
01.py
py
586
python
en
code
0
github-code
6
35226848142
import torch import torch.nn.functional from .calculate_ssim import ssim from .utils import fspecial_gauss def ms_ssim(image1: torch.Tensor, image2: torch.Tensor, filter_weight: torch.Tensor) -> float: """ Multi scale structural similarity Args: image1 (np.array): Original tensor picture. im...
avacaondata/SpainAI_Hackaton_ComputerVision
ESRGAN-PyTorch/esrgan_pytorch/utils/image_quality_assessment/calculate_mssim.py
calculate_mssim.py
py
1,882
python
en
code
1
github-code
6
2018426878
import unittest import sys import os import tempfile import shutil from appliapps.flow.branch import Branch from appliapps.flow.collate import Collate from appliapps.flow.merge import Merge from appliapps.flow.split import Split class Test(unittest.TestCase): @classmethod def setUpClass(cls): cls.tdi...
lcb/applicake
tests/test_flow.py
test_flow.py
py
1,454
python
en
code
1
github-code
6
74077927228
from PyQt5.QtCore import QFile, QTextStream, QIODevice class StyleLoader: def __init__(self, variables_path: str = None): self._variables = {} self._stylesheets = {} self._init_variables(variables_path) def get_merged_stylesheets(self, names: list): return self._merge_stylesh...
lennertsoffers/KeyCursor
key_cursor_config/model/StyleLoader.py
StyleLoader.py
py
1,926
python
en
code
1
github-code
6
19459348473
import os import csv def find_duration(indexlist, index, f): index = index + 1 if 'LOG:' in f[index].split(): indexlist.append(index) else: find_duration(indexlist, index, f) location = '/Users/karinstaring/thesis/script/finally/Karin_Staring_Geomatics_Thesis/results/queries/quer...
kjstaring/scripts
results/queries/log_file_analysis.py
log_file_analysis.py
py
1,810
python
en
code
0
github-code
6
2248378771
import random Kaarten = ("2","3","4","5","6","7","8","9","10","boer","vrouw","heer","aas") Kleur = ("harten ","klaveren ","schoppen ","ruiten ") Deck = [] teller = 0 for x in Kleur[0:4]: for i in Kaarten[0:13]: Deck.append (x + i) Deck.append ("Joker1") Deck.append ("Joker2") for y in range(7): RandomKa...
MaxQutimu/leren-programmeren
Leren Programmeren/M-04-Lijstjes en Samenstellingen/Deck.py
Deck.py
py
420
python
en
code
0
github-code
6
32463868402
import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torch import torchvision import torchvision.transforms as transforms class DataLoader: def __init__(self, batch_size = 4): ''' num_workers should be 0...
jindeok/XAI_torch_captum
XAI_torch/utils.py
utils.py
py
2,051
python
en
code
0
github-code
6
32562155548
from django.conf.urls.defaults import * from django.conf import settings from gallery.feeds import Photos, Videos, Tags, TagContents, Comments try: import django_openidconsumer except ImportError: django_openidconsumer = None feeds = { 'comments': Comments, 'photos': Photos, 'videos': Videos, ...
ginking/Gallery-1
urls.py
urls.py
py
2,422
python
en
code
0
github-code
6
8915382368
from datetime import datetime from astral import Astral from pyHS100 import Discover, SmartPlug, SmartBulb import time, socket, requests, pytz, simplejson #Used to determine daylight status, occupancy status, and does the things #if the things are needed based on prior info class SmartSwitchControl(): a = Astr...
bradyjibanez/Voyager
occupantInference/smartSwitchControl.py
smartSwitchControl.py
py
2,417
python
en
code
0
github-code
6
24604094520
# Packages import time import selenium from selenium import webdriver import NameExtractor app_names = [] element_web = [] k = 0 count = 1 def decompiler(path, file_path): global app_names, driver driver = webdriver.Chrome(path) driver.maximize_window() app_names = NameExtractor.n...
Neilnarnaware/Privacy-Detection-of-Android-Application
Decompiler.py
Decompiler.py
py
2,296
python
en
code
0
github-code
6
16106180145
#!/usr/bin/env python3 if __name__ == "__main__": import argparse import os import benj ap = argparse.ArgumentParser() ap.add_argument("-i", "--input", dest="h5ad", required=True) ap.add_argument("-o", "--output", required=True) ap.add_argument("--labels", requir...
KellisLab/benj
scripts/integrate_and_train.py
integrate_and_train.py
py
1,676
python
en
code
2
github-code
6
11735575748
"""Add File table Revision ID: 3822d04489a0 Revises: Create Date: 2021-06-26 16:18:52.167545 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '3822d04489a0' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gen...
retroherna/rhinventory
alembic/versions/3822d04489a0_add_file_table.py
3822d04489a0_add_file_table.py
py
1,531
python
en
code
1
github-code
6
33696612007
from __future__ import print_function from seq import * from parentSeq import * from ore_algebra import * import time def test1(): R,n = ZZ['n'].objgen() A,Sn = OreAlgebra(R, 'Sn').objgen() a1 = Sn**2 - Sn - 1 init1 = [0,1] range_ = 1000 sum_ = 0 for _ in range (range_): begin ...
Kiskuit/SuitesPRecursives
src/test.py
test.py
py
1,087
python
en
code
0
github-code
6
26822225482
import hashlib import base64 import os import sys from Crypto.Cipher import AES from hashlib import md5 from PyQt4 import QtGui, QtCore import collections from eclib import EC from eclib import DiffieHellman class MainWindow(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) global ...
iCHAIT/Elliptical-Curve-Cryptography
gui.py
gui.py
py
6,704
python
en
code
24
github-code
6
21158960410
#!/usr/bin/env python # Remove bootstrap solutions from a list of mss from __future__ import print_function import sys import pyrap.tables as pt def remove_columns(mslist_name,colnames=['SCALED_DATA']): if mslist_name.endswith('.ms'): mslist=[mslist_name] else: mslist=[s.strip() for s in open...
mhardcastle/ddf-pipeline
utils/remove_bootstrap.py
remove_bootstrap.py
py
955
python
en
code
22
github-code
6
5145788640
import enum from ocrdgen.font.font import FontManager from ocrdgen.image.background import BgManager from pathlib import Path import numpy as np from PIL import ImageDraw, Image from ocrdgen.ops import boxes_ops import cv2 as cv from collections import OrderedDict from .base import BaseDrawer from ocrdgen import model...
nunenuh/ocrdgen
ocrdgen/drawer/word.py
word.py
py
3,432
python
en
code
0
github-code
6
13842222350
import cv2 import numpy as np import math from numpy import random as nr import sys def lines(code=None, step=12): l = np.zeros((h, w, 3), np.uint8) l[:] = 255 if code == 0: # - horizontal for i in range(0, h, step): l = cv2.line(l, (0, i), (w, i), black) elif code == 1: # | hor...
ZZ76/filters
crosshatching.py
crosshatching.py
py
3,968
python
en
code
4
github-code
6
25145519000
from dataclasses import dataclass from typing import Any from msg.serializers import BaseExpenseCreationSerializer, BaseExpensePropertySerializer @dataclass class ExpenseCreationHelper: data: dict def __call__(self, *args: Any, **kwds: Any) -> Any: if not self._parse_data(): return ...
enamsaraev/tg_api
msg/helpers.py
helpers.py
py
1,000
python
en
code
0
github-code
6
38081298604
import asyncio import threading from sqlalchemy.orm import Query from ConsumerService.consumer.persistence import db from ConsumerService.consumer.business import manage_event_data from aio_pika import connect, ExchangeType from flask import Flask, request, jsonify, Response app = Flask(__name__) @app.route('/getPa...
oran1980/clewMedical
application-assignment/ConsumerService/consumer/main.py
main.py
py
3,890
python
en
code
1
github-code
6
26113020545
__authors__ = ["T. Vincent"] __license__ = "MIT" __date__ = "03/04/2017" # TODO # keep aspect ratio managed here? # smarter dirty flag handling? import datetime as dt import math import weakref import logging import numbers from typing import Optional, Union from collections import namedtuple import numpy from ......
silx-kit/silx
src/silx/gui/plot/backends/glutils/GLPlotFrame.py
GLPlotFrame.py
py
42,835
python
en
code
106
github-code
6
5589205557
import re import plac import ujson as json from utils import load_jsonl_file, dumps_jsonl regex_ws = re.compile(r'\s+') def load_corpus(path): documents = json.load(open(path, 'r')) return documents def hydrate(parses, relation): doc = parses.get(relation['DocID']) text = doc.get('text', '') if d...
rknaebel/bbc-discourse
hydrate.py
hydrate.py
py
1,089
python
en
code
1
github-code
6
1059675909
""" This module defines the interface for the Server. .. autoclass:: Server :members: :undoc-members: :show-inheritance: """ import atexit import base64 import logging import os import threading from functools import partial, wraps import pluginbase import tornado.httpserver import tornado.web from flask im...
OPSORO/OS
src/opsoro/server/__init__.py
__init__.py
py
7,251
python
en
code
9
github-code
6
73831952826
from odoo import api, models, fields, _ from odoo.exceptions import UserError import logging _logger = logging.getLogger(__name__) class LgpsPartner(models.Model): _inherit = 'res.partner' client_type = fields.Selection( [ ('new', _('New')), ('aftersales', _('After Sales')), ...
intralix/odoo-addons
lgps/models/custom_partner.py
custom_partner.py
py
2,580
python
en
code
0
github-code
6
2721867306
""" api.py ~~~~~~ This file define simple REST APi for a Machine Learning Model """ from os import environ as env from joblib import load from flask import abort, Flask, jsonify, make_response, request from pandas import DataFrame service_name = env['SERVICE_NAME'] version = env['API_VERSION'] model = load('data/m...
repodevs/flask-machine-learning-service
api.py
api.py
py
846
python
en
code
0
github-code
6
10806067701
from itertools import count from random import choice chance = ['h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 't'] works = 0 for i in range(100000): outcomes = [] for x in range(10): outcomes.append(choice(chance)) if outcomes.count('h') >= 3: works += 1 print(works)
Theeran-SK/Miscellaneous
bmc.py
bmc.py
py
297
python
en
code
0
github-code
6
32500164614
""" ื›ืชื‘ื• ืชื•ื›ื ื™ืช ื”ืžืงื‘ืœืช 10 ืžืกืคืจื™ื ืžื”ืžืฉืชืžืฉ ื•ืžื“ืคื™ืกื” ืืช ื”ื’ื“ื•ืœ ื‘ื™ื•ืชืจ. """ def age_in_month(user_age): while True: age = user_age * 12 print(f"your AGE in month is {age}") break while True: try: age_in_month(int(input("Hello user,Please enter your AGE\n"))) except Va...
eehud738/python-
Section 2/HW2.py
HW2.py
py
500
python
he
code
0
github-code
6
1419172936
"""scene.py module""" # Michael Gresham # CPSC 386-01 # 2021-11-29 # greshammichael@csu.fullerton.edu # @Michael-Gresham # # Lab 03-00 # # My scene class # Holds all the scenes that are present in snek game. import pygame from pygame.constants import SCRAP_SELECTION from random import randint import os import pickle fr...
Michael-Gresham/Portfolio
cpsc-386-04-snake-Michael-Gresham-main/scene.py
scene.py
py
19,048
python
en
code
0
github-code
6
35023516423
import cv2 import time from base_camera import BaseCamera from Process import Process global sess class Camera(BaseCamera): video_source = 0 process = Process() @staticmethod def set_video_source(source): Camera.video_source = source # @staticmethod def frames(self): camera =...
Micbetter/ISense-flow
camera_opencv.py
camera_opencv.py
py
3,981
python
en
code
0
github-code
6
41728763711
import os import datetime import time # requires import of opencv through pip # pip install opencv-python import cv2 # requires import of PIL pillow through pip # python -m pip install pillow from PIL import Image, ImageTk import sys import tkinter def my_VidFunction(vid_name): cap = cv2.VideoCapture(vid_name) #c...
icommonscrc/Looney-Toon
OpenVideoAtTimeV8.py
OpenVideoAtTimeV8.py
py
2,716
python
en
code
0
github-code
6
23225332326
import copy import six from lxml import etree from ems.exceptions import SchemaException from ems.exceptions import ValidationException from ems.exceptions import XMLException from ems.schema import fields def parse_meta(name, bases, dct): """ Parse the _META_ attribute from a schema definition. """ ...
ceramyq/python-ems
ems/schema/base.py
base.py
py
7,670
python
en
code
0
github-code
6