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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
2747520302 | from payment.models import Payment, DepositTransaction, Transaction
from users.models import User
from vpn.models import VPN, Subscription
from django.conf import settings
import logging
import requests
from payment.consts import TRONSCAN_API
from django.db.models import Sum
import uuid
logger = logging.getLogger(__na... | amirshabanics/vpn-hiddify-telegram-bot | payment/utils.py | utils.py | py | 4,171 | python | en | code | 4 | github-code | 13 |
73705864657 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('analysis', '0028_auto_20190228_1113'),
]
operations = [
migrations.AddField(
model_name='tweetdetails',
name='first_saved',
field=models.DateTimeField(au... | emilymcgivern/tweetanalysisandvisualisation | tweetanalysis/tweetanalysis/analysis/migrations/0029_tweetdetails_first_saved.py | 0029_tweetdetails_first_saved.py | py | 366 | python | en | code | 1 | github-code | 13 |
16822708684 | import itertools
import logging
import math
import time
from selection.candidate_generation import (
candidates_per_query,
syntactically_relevant_indexes,
)
from selection.index import Index, index_merge
from selection.selection_algorithm import DEFAULT_PARAMETER_VALUES, SelectionAlgorithm
from selection.utils... | hyrise/index_selection_evaluation | selection/algorithms/anytime_algorithm.py | anytime_algorithm.py | py | 6,681 | python | en | code | 68 | github-code | 13 |
40927696553 | __doc__ = """
Evaluations for experimental data
"""
__all__ = ['ground_truth', 'accuracy']
from ground_truth import GroundTruth
class Evaluator(object):
def __init__(self):
pass
def fbeta(self, precision, recall, beta=1):
"""
F1: for bata = 0.5, also called f1 score
F2: for ... | speed-of-light/pyslider | lib/exp/evaluator/__init__.py | __init__.py | py | 2,046 | python | en | code | 2 | github-code | 13 |
4346475237 | ##############################################################################
# Developed by: Matthew Bone
# Last Updated: 30/07/2021
# Updated by: Matthew Bone
#
# Contact Details:
# Bristol Composites Institute (BCI)
# Department of Aerospace Engineering - University of Bristol
# Queen's Building - University Walk
#... | m-bone/AutoMapper | LammpsSearchFuncs.py | LammpsSearchFuncs.py | py | 8,820 | python | en | code | 8 | github-code | 13 |
72321967698 | from datetime import datetime, timedelta
from django.test import TestCase
from event.libs import event_queries
from event.models import Event
class TestEventQueries(TestCase):
def test_get_all_week_events(self) -> None:
event_1 = Event.objects.create(
name="WOD", start=datetime.now(), end=da... | AngoGG/EasyWod | event/tests/unit/test_event_queries.py | test_event_queries.py | py | 1,672 | python | en | code | 0 | github-code | 13 |
19152966914 | name="ahmed mohamed abd el mntaser"
age=23
town="10th of ramadan"
Grade=3.5
exp=2
Mymoney=322242342353254325453452
ali="ali"
mohamed="mohamed"
ahmed="ahmed"
# print("I am {:s} .My age is {} .I am living in {} .My Grade is {:.1f} .I have experience {} days .\nI have in the bank {:_d} $".format(name,age,... | ahmedmohamedabdlmntasr/pythonAnalogautomation | stringFormatnewWay.py | stringFormatnewWay.py | py | 547 | python | en | code | 0 | github-code | 13 |
29196983065 | """
Given an array of intervals where intervals[i] = [starti, endi], merge all
overlapping intervals, and return an array of the non-overlapping intervals
that cover all the intervals in the input.
Example 1:
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals... | sunank200/DSA | Booking.com/merged_intervals.py | merged_intervals.py | py | 1,223 | python | en | code | 0 | github-code | 13 |
29033977134 | import boto3
import openpyxl
from openpyxl import load_workbook
import pandas as pd
from pandas import ExcelWriter
import io
# global variable
bucket = ''
aws_access_key_id = ''
aws_secret_access_key = ''
s3 = boto3.resource('s3')
conn = boto3.client('s3', aws_access_key_id='aws_access_key_id', aws_secret_access_key... | lanhoter/S3sync | upload.py | upload.py | py | 2,940 | python | en | code | 2 | github-code | 13 |
29540856522 | from celery import Celery
from flask_cors import CORS
from flask_migrate import Migrate
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
import ai_redditor_service.template_filters as template_filters
db = SQLAlchemy()
cors = CORS()
migrate = Migrate(db=db)
celery = Celery(
'ai_redditor_... | galacticglum/ai-redditor | web_service/ai_redditor_service/extensions.py | extensions.py | py | 1,620 | python | en | code | 14 | github-code | 13 |
3532516102 | from evaluate import logger, EvaluatorBase
class Evaluator(EvaluatorBase):
def __init__(self, parser, tagger):
EvaluatorBase.__init__(self)
self.parser = parser
self.tagger = tagger
# This is to avoid problem in spark mode
if tagger is not None:
wv = {}
... | sfu-natlang/glm-parser | src/evaluate/parser_evaluator.py | parser_evaluator.py | py | 1,153 | python | en | code | 28 | github-code | 13 |
33219014470 | msg = "we will be seeing the horizon"
words = msg.split()
print(words)
words = msg.split('e')
print(words)
#Replace
update_msg = msg.replace('seeing','viewing')
print(update_msg)
#Join
path = ['aman','avinash','mypc']
content = '/'.join(path)
print(content)
#Strip()
name =' Avinash '
cleaned_name = nam... | avi4907/nash | basics/string_funtion1.py | string_funtion1.py | py | 724 | python | en | code | 0 | github-code | 13 |
30416101913 | # ***********
# ¿HAY STOCK?
# ***********
def run(stock: dict, merch: str, amount: int) -> bool:
item_stock = stock.get(merch, 0)
available = item_stock >= amount
""" if item_stock == None or amount > item_stock:
available = False """
return available
if __name__ == "__main__":
run({"pe... | adrianhrb/1DAW | pro/Contents/UD3/dict/order_stock.py | order_stock.py | py | 366 | python | en | code | 0 | github-code | 13 |
74816572176 | import unittest
numbers = [99, 46, 6, 2, 1, 5, 63, 87, 283, 4, 0]
def bubbleSort(array):
if not isinstance(array, list):
raise TypeError
for idx1 in range(len(array)):
for idx in range(0, len(array) - idx1 - 1):
if array[idx] > array[idx + 1]:
array[idx], array[idx + 1] = array[idx + 1], array[idx]
r... | valentinesamuel/EssentialOrigin | algos/bubble_sort.py | bubble_sort.py | py | 650 | python | en | code | 0 | github-code | 13 |
13500633901 | from collections import Counter
# a) Het sorteren van een dictionary
D = {'c':1, 'b':2, 'a':3, 'e':1, 'd':3}
for k in sorted(D.keys()):
print(k, D[k])
# b) Alleen items met unieke waarden
D = {'a':1, 'b':2, 'c':3, 'd':1, 'e':3}
c = Counter(D.values())
result = {}
for k,v in D.items():
if c[v] == 1:
re... | RedFoxNL/Python | Python week opdrachten/Week2/Opgave 3.py | Opgave 3.py | py | 970 | python | nl | code | 0 | github-code | 13 |
71947366418 | from tkinter import filedialog, messagebox
import tkinter as tk
import xlsxwriter
import pandas as pd
from app.v1.schema.chart_schema import Chart
from app.v1.schema.table_schema import Table
from app.v1.utils.exceptions import custom_exception
from app.v1.utils.hour_helper import get_datetime
from app.v1.utils.set... | marianamartineza/kunaisoft-interface-tkinter | app/v1/utils/file_management.py | file_management.py | py | 6,314 | python | en | code | 0 | github-code | 13 |
43403150223 | import edm.dnnlib as dnnlib
import pickle
from datasets.mri_dataloaders import get_mvue
from problems.fourier_multicoil import MulticoilForwardMRINoMask
import torch
import numpy as np
from tqdm import tqdm
def normalize(x, x_min, x_max):
"""
Scales x to appx [-1, 1]
"""
out = (x - x_min) / (x_max - x... | Sriram-Ravula/MRI_Sampling_Diffusion | algorithms/dps.py | dps.py | py | 4,601 | python | en | code | 4 | github-code | 13 |
17899335544 | import base64
import re
HEADER_FROM = 14
HEADER_TO = 15
HEADER_SUBJECT = 16
HEADER_DATE = 17
def getParamFromHeader(messageHeaders,nameOfParam):
for header in messageHeaders:
if header['name'] == nameOfParam:
return header['value']
return None
class email:
sender = None
subject =... | EkrlDev/TradingViewTrader | extractedEmail.py | extractedEmail.py | py | 2,799 | python | en | code | null | github-code | 13 |
32083374586 | import datetime
import os
import random
import time
import cv2
import matplotlib.image as mpimg
import numpy as np
import scipy.misc
import skimage as sk
# Brightness
BRIGHTNESS_PERCENT_LOWER = 0.4
BRIGHTNESS_PERCENT_HIGHER = 1.2
# Blur
KERNEL_SIZE_POSSIBILITIES = [7, 13, 15]
SIGMA_X_LOWER = 0
SIGMA_X_UPPER = 5
SIGM... | matdziu/BeerAI-Data | ImageGenerator.py | ImageGenerator.py | py | 4,606 | python | en | code | 0 | github-code | 13 |
3249891441 | #########################################################################
## 2021
## Authors: David Richter and Ricardo A. Calix, Ph.D.
## Paper:
## Deep Q AP for X-Plane 11
##
#########################################################################
import tensorflow as tf
from tensorflow.keras import Input
from tens... | rcalix1/Deep-learning-ML-and-tensorflow | ReinforcementLearning/DeepQAP/DeepQAP2.0/DeepQLearn.py | DeepQLearn.py | py | 5,724 | python | en | code | 79 | github-code | 13 |
33164049891 | from collections import defaultdict
inpDict = defaultdict(int)
with open('input.txt') as f:
inp_list = f.readline().split('\t')
for i,x in enumerate(inp_list):
inpDict[i] = int(x)
def get_state(inpDic: dict):
return [i for i in inpDic.values()]
def distro_nodes(inpDict: dict, start_key: int, no... | cbalusekslalom/advent_of_code | 2017/Day6/Day6.py | Day6.py | py | 996 | python | en | code | 0 | github-code | 13 |
26532425084 | """empty message
Revision ID: d077c781c0f9
Revises: ba0cb1f6b183
Create Date: 2018-03-03 15:37:02.865610
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd077c781c0f9'
down_revision = 'ba0cb1f6b183'
branch_labels = None
depends_on = None
def upgrade():
# ... | gadjimuradov/stpol | migrations/versions/d077c781c0f9_.py | d077c781c0f9_.py | py | 803 | python | en | code | 0 | github-code | 13 |
34140084109 | # یک عدد صحیح از کابر بگیرید و میانگین اعدا از صفر تا آن عدد را محاسبه کنید (از حلقه استفاده کنید)
number = int(input( 'Number : ' ))
# 0 + 1 + 2 + 3 + ... + number
firstNum = 0
for i in range(number+1):
firstNum += i
miangin = firstNum / number
print(miangin)
| mariiansiimon/Practices | 7_3_J3_miangin.py | 7_3_J3_miangin.py | py | 361 | python | fa | code | 0 | github-code | 13 |
34507325599 | from django.db import models
from NGO.models import NGO, Children
class Invoice(models.Model):
select_ngo = models.ForeignKey(NGO, default=1)
child_name = models.ForeignKey(Children, default=1)
donor_id = models.CharField(max_length=100)
invoice = models.FileField(blank=True)
donation_mon... | Shankar1994/See4Children | superadmin/models.py | models.py | py | 800 | python | en | code | 0 | github-code | 13 |
4327524191 | from rest_framework import serializers
from entities.models import (
Client,
Contact,
Department,
ClientToDepartment,
Entity
)
class ContactSerializer(serializers.ModelSerializer):
class Meta:
model = Contact
fields = (
"id",
"get_type_display",
... | Domodomko/traffic-light-test-task | entities/serializers.py | serializers.py | py | 2,305 | python | en | code | 0 | github-code | 13 |
25660563807 | from flask import Flask,render_template,redirect,request,url_for,flash, jsonify
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from setupDB import Post, Base, User
from flask import session as login_session
import random, string
from oauth2client.client import flow_from_clientsecret... | rahulbanerjee26/Blog-It | __init__.py | __init__.py | py | 14,425 | python | en | code | 0 | github-code | 13 |
6365067379 | ## below function help us to run simple sentiment analysis on fakenews statement
## IDEA: below code help us to list out the topics that what is mainly about fake news
## and find out the sentiment of those topics in the fake news statement
## possible extended idea: extract all nouns/verbs/adj/adv.. in th... | aalvar76/cs-521-project | source/CS-521-PROJECT/tmp/sentimentAnaly_fakeNews.py | sentimentAnaly_fakeNews.py | py | 1,304 | python | en | code | 1 | github-code | 13 |
23159191987 | """JuegosChaco URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | Lsege/JuegosChaco | JuegosChaco/JuegosChaco/urls.py | urls.py | py | 1,284 | python | en | code | 2 | github-code | 13 |
18314921520 | from django.contrib.auth.models import User
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from django.utils.encoding import force_bytes, force_text
from django.views import View
from . import forms
from .forms import UserRegisterForm, LoginForm, ContactForm
from .mod... | Bobur-oiligarh/user-register-with-email-confirmation | LearnLogin/register/views.py | views.py | py | 2,800 | python | en | code | 0 | github-code | 13 |
71329032337 | from pickle import FALSE, TRUE
from random import randint
from time import sleep
import pytest
from tools.sec_loader import SecretLoader
from tools.config_loader import ConfigLoader
from tools.innodrive import InnoDrive
from tools.logger import Logger
import time, os, io, json
class TestInoDrv():
inodrv = InnoDri... | eslywadan/dataservice | tests/test_innodrive.py | test_innodrive.py | py | 10,207 | python | en | code | 0 | github-code | 13 |
39481961238 | import streamlit as st
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
# Increase the width of the Streamlit app
st.set_option('deprecation.showPyplotGlobalUse', False)
st.set_page_config(layout="wide")
# Load data
df = pd.read_csv("test.csv")
df... | RiskSimplifier/AML_Txn_Monitoring_ML_App | test/test1.py | test1.py | py | 767 | python | en | code | 0 | github-code | 13 |
37130357863 | import argparse
import os
import shutil
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.nn.parallel import DistributedDataParallel
from torch.utils.data.distributed import DistributedSampler
from data.dataset import PoisonLabelDataset
from data.utils impo... | SCLBD/DBD | supervise.py | supervise.py | py | 9,668 | python | en | code | 23 | github-code | 13 |
14276771536 | import bpy
from bpy.props import *
from bpy.types import Panel
class AUTOMIRROR_PT_panel(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Tools'
bl_label = "Auto Mirror"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return bpy.context.object
def draw(self, con... | Tilapiatsu/blender-custom_config | scripts/addon_library/local/auto_mirror_ex/ui/ui_panel.py | ui_panel.py | py | 3,716 | python | en | code | 5 | github-code | 13 |
39766124963 | import wikipediaapi
import wikipedia
wiki_html = wikipediaapi.Wikipedia(
language='ru',
extract_format=wikipediaapi.ExtractFormat.HTML
)
wikipedia.set_lang("ru")
def get_summary(object):
"""Return summary of the object page.
Args:
object ('string'): title of wiki-object.
... | aerozhkova/travelathome | wiki.py | wiki.py | py | 1,003 | python | en | code | 0 | github-code | 13 |
7457339273 | from django.shortcuts import render
from django.http import HttpResponse
from .models import haga_su_pedido, tipo_de_postre, tipo_de_relleno
from .forms import haga_su_pedidoForm, tipo_de_postreForm, tipo_de_rellenoForm
def mostrar_index(request):
return render(request, 'index.html')
def mostrar_pedido(request):
... | Nicolas-Amato/PRIMERA-ENTREGA-DEL-PROYECTO-FINAL | MiApp/views.py | views.py | py | 2,566 | python | es | code | 1 | github-code | 13 |
7832556523 | # -.- coding:latin1 -.-
# @author: Nicolas
"""Ce programme calcule la trajectoire de neutrons ayant été lancés à
travers une plaque solide amorphe selon certains paramètres de départ.
Le programme transmet ensuite la proportion de ces neutrons ayant été
émis, la proportion des neutrons ayant été réfléchis et la pr... | dslap0/Universite-Python | PHY1234/Laboratoire6-codesQ2.py | Laboratoire6-codesQ2.py | py | 6,339 | python | fr | code | 0 | github-code | 13 |
32270068553 | """
Examples using foramt with names
"""
def main():
txt = 'Foo Bar'
num = 42.12
print('The user {name} was born {age} years ago.'.format(name = txt, age = num))
if __name__ == '__main__':
main()
| sara-kassani/1000_Python_example | 03_formatted_printing/03_format_names.py | 03_format_names.py | py | 237 | python | en | code | 1 | github-code | 13 |
35770920732 | import csv
import lxml.etree
import lxml.builder
def convert(filenames):
E = lxml.builder.ElementMaker()
DOC = E.DOC
DOCNO = E.DOCNO
TEXT = E.TEXT
f = open("./data/tweets.xml", 'w')
for filename in filenames:
with open(filename, 'rb') as csvfile:
spamreader = c... | namrata-simha/Slug-MovieBot | DataExtractionAndPreprocess/convertCSV_XML.py | convertCSV_XML.py | py | 689 | python | en | code | 0 | github-code | 13 |
71544546579 | # 加载 推理
import onnxruntime as ort
import torch
import time
import onnx
from PIL import Image
import cv2
import os
import numpy as np
from torchvision import transforms
from torch.utils.data import DataLoader
import albumentations as alb
import torch.utils.data
# import os.path as osp
os.environ["CUDA_VISIBLE_DEVICES... | bashendixie/ml_toolset | 案例56 unet + pytorch 数据科学碗2018/inference_onnx.py | inference_onnx.py | py | 5,755 | python | en | code | 9 | github-code | 13 |
41767608702 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def f(self, root):
if root:
if root.val == self.val:
self.ans =... | ritwik-deshpande/LeetCode | 700-search-in-a-binary-search-tree/700-search-in-a-binary-search-tree.py | 700-search-in-a-binary-search-tree.py | py | 700 | python | en | code | 0 | github-code | 13 |
4215633641 | import os
def find(download_path: str, range=300):
""" Returns a list of the most recently downloaded files. Uses the range variable to check for
multiple consecutive downloads. The default range is five minutes. When several file are
downloaded within five minutes of each other they are all added to the o... | NickTooth96/move-latest-download | src/most_recent.py | most_recent.py | py | 1,547 | python | en | code | 0 | github-code | 13 |
22500101638 | from titlecase import titlecase
class Cleaners:
def resident_weapon_used(val):
weapons_used = {
"Suspect - Handgun": "Handgun",
"Suspect - Knife" : "Knife",
"Suspect - Misc Weapon": "Misc Weapon",
"Suspect - Rifle" : "Rifle",
"Suspect - Unarmed": ... | webmaven/comport | comport/data/cleaners.py | cleaners.py | py | 2,142 | python | en | code | 0 | github-code | 13 |
14906495343 | """
Write
=====
"""
import struct
from espresso import print_ as print
import gc
########################################################################
class Write:
""""""
# ----------------------------------------------------------------------
def __init__(self, buffer, font):
"""Initializ... | BradenM/micropy-stubs | packages/esp32_LoBo/frozen/display/write.py | write.py | py | 3,386 | python | en | code | 26 | github-code | 13 |
7597264810 | items_component_outer_ring_excavations = [
{"item_name": "Inherent Implants 'Highwall' Mining MX-1003", "id": 22534},
{"item_name": "Limited Social Adaptation Chip - Beta", "id": 14299},
{"item_name": "Mining Foreman Mindlink", "id": 22559},
{"item_name": "Shield Command Mindlink", "id": 21888},
{"i... | A1ekseyN/Eve_Trade_Parser | lp_store_items_outer_ring_excavations.py | lp_store_items_outer_ring_excavations.py | py | 9,702 | python | en | code | 0 | github-code | 13 |
11612165133 | from botocore.vendored import requests
import os
def get_access_token():
""" Get client API Service Authorization token and store into sessionAttributes"""
access_token_request_data = {
"clientId": os.environ['CLIENT_SERVICE_ID'],
"clientSecret": os.environ['CLIENT_SERVICE_SECRET']
}
a... | fibonascii/cloud-automation | lambda/alexa-skill-lod-rest/client_service_requests.py | client_service_requests.py | py | 1,898 | python | en | code | 0 | github-code | 13 |
42062220189 | from nose.tools import *
from bin.app import app
from tests.tools import assert_response
from castlecrawler.map import Room
from castlecrawler.bedroom import Bedroom
from castlecrawler.armory import Armory
def test_room():
gold = Room("GoldRoom",
""" This room has gold in it that you can collect.
T... | shirleylberry/python-practice | projects/castlecrawler/tests/map_tests.py | map_tests.py | py | 1,279 | python | en | code | 0 | github-code | 13 |
9876883788 | # task 9 - defensive programming
# code offers users basic calculation functions or retrieval of previous calculations
# global variable used to format certain outputs for clarity
seperator_string = "---------------------------------------------------"
# prints welcome message only when first starting the program
pr... | neoreuvenla/hyperion-data-sci | basic concepts/10 defensive programming.py | 10 defensive programming.py | py | 4,215 | python | en | code | 0 | github-code | 13 |
2960982667 | """Habitat patterns."""
from spacy import registry
from traiter.patterns.matcher_patterns import MatcherPatterns
from odonata.pylib.const import CATEGORY, REPLACE
HABITAT = MatcherPatterns(
'habitat',
on_match='odonata.habitat.v1',
decoder={
'habitat': {'ENT_TYPE': 'habitat'},
},
patterns... | rafelafrance/traiter_odonata | odonata/patterns/habitat.py | habitat.py | py | 600 | python | en | code | 0 | github-code | 13 |
24313218215 | from django.conf.urls import url, include, patterns
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^about/$', views.about, name='about'),
url(r'^news/$', views.xxx, name='xxx'),
url(r'^articles/(?P<article_id>[0-9]+)/$', views.show_article, name='article'),
url(r'^p... | mushroom2/laserSite | blog/urls.py | urls.py | py | 623 | python | en | code | 2 | github-code | 13 |
40836680400 | from ctypes import *
import math
import random
# add
import numpy as np
from PIL import Image, ImageDraw, ImageFont
import colorsys
# box colors
box_colors = None
def sample(probs):
s = sum(probs)
probs = [a/s for a in probs]
r = random.uniform(0, 1)
for i in range(len(probs)):
r = r - probs[i... | manjWu/darknet-python | darknet.py | darknet.py | py | 7,219 | python | en | code | 0 | github-code | 13 |
4810387154 | from datetime import datetime
class dota_match:
def __init__(self, tournament, game_format, date_time, team1, team2, t1_odds, t2_odds, t1_score, t2_score):
self.team1 = team1
self.team2 = team2
self.t1_odds = t1_odds
self.t2_odds = t2_odds
self.tournament = tournament
self.date_time = date_time
self.g... | Chenesss/predict_dota | dota_objects.py | dota_objects.py | py | 1,156 | python | en | code | 0 | github-code | 13 |
20885854243 | from __future__ import division
import numpy as np
import logging
import csv
import time as tm
import file_length
import pandas as pd
from simple_progress_bar import update_progress
from cosine_similarity import cos_similarity
datetime = tm.localtime()
date = '{0:}-{1:}-{2:}'.format(datetime.tm_mon, datetime.tm_mda... | USC-CSSL/DDR | ddr/get_loadings.py | get_loadings.py | py | 2,636 | python | en | code | 26 | github-code | 13 |
1043201052 | import supervision as sv
import numpy as np
import cv2
from ultralytics import YOLO
model = YOLO("./yolov8m.pt")
def callback(x: np.ndarray) -> sv.Detections:
result = model(x, verbose=False, conf=0.25)[0]
return sv.Detections.from_ultralytics(result)
image = cv2.imread("./1.png")
slicer = sv.InferenceSlicer... | songjiahao-wq/MY-YOLOv8 | tools/shia.py | shia.py | py | 562 | python | en | code | 1 | github-code | 13 |
24559272319 | class Action:
def __init__(self, rateConstant, reactants, products):
allStoich = list(reactants.items()) + list(products.items())
for molecule, stoich in allStoich:
if stoich <= 0 or stoich > 2:
message = "Invalid stoichiometry for {0}: {1}".\
fo... | kehlert/tau_leaper | action.py | action.py | py | 1,350 | python | en | code | 0 | github-code | 13 |
39709995421 | from manimlib.imports import *
import math
class Graphing(GraphScene):
CONFIG = {
"x_min": -5,
"x_max": 5,
"y_min": -4,
"y_max": 4,
"graph_origin": ORIGIN,
"function_color": WHITE,
"axes_color": BLUE
}
def construct(self):
#Make graph
... | advayk/Manim-CalcII-Project | trial_graph.py | trial_graph.py | py | 2,041 | python | en | code | 0 | github-code | 13 |
34909588011 | ################################################
# File Name: Pong.py
# Creator Name: Mr. Acosta
# Date Created: 1-28-2020
# Date Modified: 1-28-2020
################################################
# Making Pong
#################################################
import pygame, sys, time, random
from pygame.locals impo... | EAcosta2584/Programming-for-Video-Games-Resources | Pong.py | Pong.py | py | 1,295 | python | en | code | 1 | github-code | 13 |
18116356479 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 11 15:17:00 2020
@author: kshitij
"""
import numpy as np
import os
import glob
from tqdm import tqdm
import argparse
import time
from utils import get_similarity,get_similarity_from_rdms
list_of_tasks = 'autoencoder curvature denoise edge2d edge3d \
keypoint2d keypoin... | cvai-roig-lab/duality-diagram-similarity | computeDDS_pascal.py | computeDDS_pascal.py | py | 7,696 | python | en | code | 9 | github-code | 13 |
73482736016 | import tensorflow as tf
class SVGD():
def __init__(self,joint_log_post,num_particles = 250,num_iter=1000, dtype=tf.float32):
self.dtype = dtype
self.num_particles = num_particles
self.num_latent = 2
self.lr = 0.003
self.alpha = .9
self.fudge_factor = 1e-6
self... | GeorgeLiang3/Hessian-paper | Geophysics/models/SVGD.py | SVGD.py | py | 2,626 | python | en | code | 0 | github-code | 13 |
2553636056 | """
Allows to add `ControllerAgent` (with unknown parameters) to the model, which enables user to
change `tau` during the `_fit` method.
`parameters` is a dict with four fields:
Fields
------
reg_name: str
The name of regularizer. We want to change the tau coefficient of it during training
Note that only one... | machine-intelligence-laboratory/TopicNet | topicnet/cooking_machine/cubes/controller_cube.py | controller_cube.py | py | 23,218 | python | en | code | 138 | github-code | 13 |
27875880921 | import tensorflow as tf
import numpy as np
import NetworkSelector as NetSelect
import Inference_NetworkConfiguration as Net
import cifar10_input as DataSet
DataSetFileName = "../Dataset_CIFAR/cifar-10-batches-py/"
fileName = []
netType = []
augment = []
resultsTrain = []
resultsTest = []
# Determine ne... | DiversisAI/Deep-Optimizer-Framework | Codes/EvalNetwork.py | EvalNetwork.py | py | 2,818 | python | en | code | 2 | github-code | 13 |
271136084 | from bs4 import BeautifulSoup as bs
import unicodedata
import urllib
import csv
import sys
filepath = '../../data/joke-db.csv'
f = open(filepath, 'a')
writer = csv.writer(f, quoting=csv.QUOTE_NONNUMERIC)
writer.writerow( ('ID', 'Joke') )
prefix = 'http://www.joke-db.com/c/all/clean/page:'
totaljokes = 0
for i in xran... | amoudgl/short-jokes-dataset | scripts/scrapers/joke-db.com.py | joke-db.com.py | py | 1,072 | python | en | code | 259 | github-code | 13 |
31539574946 | #teams = 3
#participants_per_team = 4
#attempts_per_participant = 3
#points range from 1 to 60
attemps = 3
max_score = 60
min_score = 1
team_yellow = {
"camilo" : [],
"paula" : [],
"liz" : [],
"chloe" : []
}
team_blue = {
"ricardo" : [],
"sammy" : [],
"edilma" : [],
"x" : []
}
team... | caoh29/epam | IT-fundamentals/recursive.py | recursive.py | py | 1,665 | python | en | code | 0 | github-code | 13 |
3384028208 | import boto3
from boto3.dynamodb.conditions import Key
from botocore.exceptions import ClientError
def update_type_table(table, crystal_type, last_sale):
try:
update_type_response = table.update_item(
Key={"crystal_type": crystal_type},
UpdateExpression="set #ls.#w=:a, #ls.#p=:b, #... | rohanbansal12/testing | updating/util/aws_util.py | aws_util.py | py | 1,390 | python | en | code | 0 | github-code | 13 |
372118497 | import spacy
from neo4j import GraphDatabase
import argparse, sys
import dbbuilder
nlp = spacy.load('en_core_web_sm')
uri = "bolt://localhost:7687"
d = GraphDatabase.driver(uri, auth=("neo4j", "password"))
tx = d.session()
parser = argparse.ArgumentParser()
parser.add_argument('--author', help='Do the bar option')
p... | bleepul/writing | DBMaker.py | DBMaker.py | py | 750 | python | en | code | 0 | github-code | 13 |
22491988491 | import requests
class YaUploader:
def __init__(self, token: str):
self.token = token
def upload(self, file_path: str):
"""Метод загружает файлы по списку file_list на яндекс диск"""
url = 'https://cloud-api.yandex.net/v1/disk/resources/upload'
headers = {'Content-Type': 'applic... | julija9531/Requests-DZ2 | main.py | main.py | py | 921 | python | en | code | 0 | github-code | 13 |
70599905619 |
import numpy as np
import librosa
import torch
import numpy as np
import os
import sys
from torch._C import device
import cls_data_generator
import seldnet_model
import parameters
import torch
from IPython import embed
import matplotlib
def main(argv):
use_cuda = torch.cuda.is_available()
device = torch.de... | balajiiitg/AED_mon0channel | inference_code.py | inference_code.py | py | 4,263 | python | en | code | 0 | github-code | 13 |
17042931004 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMarketingVoucherdetailListQueryModel(object):
def __init__(self):
self._open_id = None
self._page_num = None
self._page_size = None
self._template_id = None
... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayMarketingVoucherdetailListQueryModel.py | AlipayMarketingVoucherdetailListQueryModel.py | py | 2,817 | python | en | code | 241 | github-code | 13 |
31727786074 | import os
from django.http import Http404, FileResponse, JsonResponse
from mini_backend import settings
import utils.response
def image(request):
if request.method == 'GET':
md5 = request.GET.get('md5')
img_file = os.path.join(settings.IMAGE_DIR, md5 + '.jpeg')
if not os.path.exists(img_... | gsy13213009/mini_backend | apis/views/image.py | image.py | py | 1,089 | python | en | code | 0 | github-code | 13 |
20829738149 | import unittest
from models.abc import db
from server import server
from repositories import ChannelRepository
from util import test_client
class TestCors(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.client = test_client(server)
def setUp(self):
db.create_all()
def tear... | fibasile/ticket-gateway | test/test_cors.py | test_cors.py | py | 755 | python | en | code | 0 | github-code | 13 |
36569872151 | from datetime import datetime
from conta import Conta
class Transferidor:
def __init__(self, de_conta, para_conta, valor):
self.de_conta = de_conta
self.para_conta = para_conta
self.valor = valor
self.data_transacao = datetime.now()
| ltakuno/arquivos | python/cleanArch/ex01/app/entities/transferidor.py | transferidor.py | py | 273 | python | pt | code | 0 | github-code | 13 |
42999198219 | import copy
from geometry_msgs.msg import Pose, PoseArray, PoseStamped
import numpy as np
import tf
def compute_eef_offset(frame_1, frame_2):
"""
Compute the offset (transfromation matrix) from frame_1 to frame_2.
Adapted from:
https://answers.ros.org/question/229329/what-is-the-right-way-to-inv... | MatthewVerbryke/rse_dam | deliberative/tactics/adapter.py | adapter.py | py | 4,091 | python | en | code | 0 | github-code | 13 |
6080661748 | tree = {}
vc = [[set()]*3 for i in range(1005000)]
with open('vertex_1m.txt', 'r') as file:
for line in file:
line_new = line.split(': ')
child = list(map(int, line_new[1].split()))
tree[int(line_new[0])] = child
YES = 1
NO = 0
MAYBE = 2
def sum_child(children, status):
return_set = s... | divanyh/tugas-eksperimen-daa | TE2/vc.py | vc.py | py | 933 | python | en | code | 0 | github-code | 13 |
8588680645 | from bilevel_imaging_toolbox import cuda_solvers
from bilevel_imaging_toolbox import solvers
from bilevel_imaging_toolbox import image_utils
### Testing dual rof model
# Loading image
image = image_utils.load_image('../examples/images/Playing_Cards_3.png')
# Convert it to grayscale
image = image_utils.convert_to_gray... | dvillacis/BilevelImagingToolbox | tests/test_cuda_tvl1_solvers.py | test_cuda_tvl1_solvers.py | py | 991 | python | en | code | 2 | github-code | 13 |
13103867074 | # https://school.programmers.co.kr/learn/courses/30/lessons/92343
def solution(info, edges):
N = len(info)
answer = 0
tree = [[] for _ in range(N)]
for a, b in edges:
tree[a].append(b)
def dfs(node, sheep, wolves, next_list):
nonlocal answer
if info[node] == 0:... | olwooz/algorithm-practice | practice/2023_01/230126_Programmers_SheepAndWolves/230126_Programmers_SheepAndWolves.py | 230126_Programmers_SheepAndWolves.py | py | 703 | python | en | code | 0 | github-code | 13 |
32270821941 | from django.urls import path
from . import views
urlpatterns = [
path('', views.PostList.as_view(), name='home'),
path('profile/', views.profile_private, name='profile'),
path('update_profile/', views.update_profile, name='update_profile'),
path('category/<str:category>/', views.category_view, nam... | SamuelUkachukwu/storyBase | novella/urls.py | urls.py | py | 850 | python | en | code | 1 | github-code | 13 |
5705051662 | import random
from faker import Faker
from sqlalchemy.exc import IntegrityError
from app import db
from app.models import Tag, Category, Post
fake = Faker()
def fake_categories(count=10):
category = Category(cname='Default')
db.session.add(category)
for i in range(count):
category = Category(cn... | 0akarma/0aK | 0ak/app/fakes.py | fakes.py | py | 1,053 | python | en | code | 2 | github-code | 13 |
1286272147 | # coding=utf8
# -*- coding: utf8 -*-
# vim: set fileencoding=utf8 :
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import BACKEND_SESSION_KEY, HASH_SESSION_KEY, SESSION_KEY
from django.contrib.auth.models import User
from django.contrib.sessions.backends.db import Se... | raphaelgyory/django-rest-messaging-centrifugo | tests/test_integration.py | test_integration.py | py | 7,739 | python | en | code | 11 | github-code | 13 |
71544097299 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator, PercentFormatter
from cycler import cycler
def aaa():
oldcycler = plt.rcParams['axes.prop_cycle']
plt.rcParams['axes.facecolor'] = '#0057b8' # blue
plt.rcParams['axes.prop_cycle'] = cycler(col... | bashendixie/ml_toolset | tabular-playground-series-mar-2022/observer.py | observer.py | py | 1,640 | python | en | code | 9 | github-code | 13 |
25299665333 | from typing import List
"""
Given an array of integers `nums` and an integer `val`,
remove all occurrences of `val` in `nums` in-place.
Do not allocate space for another array.
"""
def test_removeElement1():
got = removeElement([3,2,2,3],3)
want = 2
assert got == want
def test_removeElement2():
got = removeE... | oktober/python-practice | leet-code/arrays/in-place-removeElement.py | in-place-removeElement.py | py | 1,986 | python | en | code | 0 | github-code | 13 |
16429409061 | from .imports import *
## base DATASET class
class Dataset:
id:str=''
url:str = ''
path:str = ''
cols:list = []
cols_sep:list = []
cols_rename:dict = {}
sep:str = ';'
fillna:object = ''
cols_q:list = []
filter_data:dict = {}
cols_pref:list = []
def __init__(self, path:... | Princeton-CDH/geotaste | geotaste/datasets.py | datasets.py | py | 23,315 | python | en | code | 0 | github-code | 13 |
36590964440 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 1 19:53:08 2020
@author: michael
"""
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import csv
def numtoClass(input_file, output_file):
with open((output_file),'w',newline='') as csvfile:
emgwriter=csv.writer(csvfil... | mgpritchard/labelstoClass | labelstoClassEMG.py | labelstoClassEMG.py | py | 3,145 | python | en | code | 0 | github-code | 13 |
43062695754 | import requests
from urllib.parse import quote
import _thread
import time
import threading
import sys
threadLock = threading.Lock()
def oprint(*args):
log = '[' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ']\t' + ' '.join([str(x) for x in args])
print(log)
def thread_send_log(url, content, nam... | songzijiang/jacksung | jacksung/utils/log.py | log.py | py | 2,419 | python | en | code | 1 | github-code | 13 |
30883131556 | def find_parent():
return 0
def solution(commands):
answer = []
gr = [[[] for i in range(51)] for j in range(51)]
mer = [[[0] for i in range(51)] for j in range(51)]
mer_num = [[] for j in range(51)]
num=1
voc = dict() # voca는 일반 딕셔너리
for c in commands:
temp = c.split(... | weeeeey/programmers | 표 병합.py | 표 병합.py | py | 2,338 | python | en | code | 0 | github-code | 13 |
45739942374 | # PYTHON configuration file for class: OffsetAnalysis
# Author: C. Harrington
# Date: 19 - January - 2015
import FWCore.ParameterSet.Config as cms
process = cms.Process("Ana")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.maxEvents = cms.unt... | cihar29/OffsetAnalysis | run_offset.py | run_offset.py | py | 4,443 | python | en | code | 0 | github-code | 13 |
21374398503 | import unittest
from project.hardware.hardware import Hardware
from project.hardware.power_hardware import PowerHardware
from project.hardware.heavy_hardware import HeavyHardware
from project.software.light_software import LightSoftware
from project.software.express_software import ExpressSoftware
class TestHardware(... | StanShishmanov/Python-Courses | Python OOP Exercises/14. Exam/tests/test_hardware.py | test_hardware.py | py | 7,368 | python | en | code | 0 | github-code | 13 |
22409209126 | from flask import jsonify
from flask_restful import reqparse, Resource
import json
from app import session
import app.const as const
from common.utils import AlchemyEncoder
from model.movie import Movie, create_movie
from common.spider import Spider
from common.template import err_res, success_res
# RESTful API 的参数解析
... | chenwangji/douban_movie_top250_server | handler/hd_movie.py | hd_movie.py | py | 1,544 | python | en | code | 1 | github-code | 13 |
24533209100 | import sys
with open('prime_list_comma.csv', 'r') as f:
overall_list_string = f.readline().split(',')
small = 56002 # the ans is bigger than this
prime_list = [int(elem) for elem in overall_list_string if 1000000 > int(elem) > small]
prime_set = set(prime_list)
def is_triple(n):
"""
:param n: integer... | hiparkgss/Project_Euler_coding_practice | problem_51.py | problem_51.py | py | 2,273 | python | en | code | 0 | github-code | 13 |
3929162085 | # import imp
from typing import final
from jmespath import search
from transformers import TopKLogitsWarper
from graphservice.neoservice import neoconnection
from sentence_transformers import SentenceTransformer, util
# import torch
import json
import pandas as pd
import numpy as np
from evaluation.calculate_metrics im... | ikonstas-ds/Resume2Skill-SE | evaluation/evaluation_setup.py | evaluation_setup.py | py | 6,910 | python | en | code | 0 | github-code | 13 |
21547516045 | test_list = input("Введите числа через запятую")
if (len(test_list)) in range(1, 500):
new_list = test_list.split(",")
for i in range(0, len(new_list)):
new_list[i] = int(new_list[i])
else:
print("Объем заказов не может быть меньше 0 и большее 500")
days = int(input("Введите количество дней: "))
if... | nikolayparfianovich/nikolayparfianovich | First_Task/test_one.py | test_one.py | py | 629 | python | ru | code | 0 | github-code | 13 |
30568743272 | from uuid import UUID, uuid4
from orjson import dumps, loads
from pydantic import BaseModel as PydanticBaseModel
from pydantic import Field
def orjson_dumps(v, *, default) -> str:
return dumps(v, default=default).decode()
class BaseModelAPI(PydanticBaseModel):
class Config:
json_loads = loads
... | SamMeown/billing_service | app/models/_base.py | _base.py | py | 631 | python | en | code | 0 | github-code | 13 |
26522891814 | from flask import make_response
import json
from json2html import *
def response_OK(query_json, status_code):
res_json = json.dumps(query_json, indent=4)
response = make_response(res_json, status_code)
return response
def response_OK_created(query_json, status_code):
res_json = json.dumps(query_json, ... | chenste-osu/truckerapi | response.py | response.py | py | 5,719 | python | en | code | 1 | github-code | 13 |
36137465601 | """
Identity management
Scenario usage:
Logging in
def login(request):
# ... verify username/password or whatever
request.identity.set(real_id, actor_id)
Retrieving actor
def display_name(request):
if not request.identity.is_set():
return HTTPForbidden("No idea who you are?")
user... | redspider/Basis-pot | netl/lib/identity.py | identity.py | py | 3,969 | python | en | code | 1 | github-code | 13 |
30685214893 | from django.urls import path
from staff import views
urlpatterns = [
path('department/list', views.StaffRoleListView.as_view(), name='staffrole_list'),
path('department/<int:pk>/', views.StaffRoleDetailView.as_view(), name='staffrole_detail'),
path('department/create', views.StaffRoleCreateView.as_view(),... | namanhnatuli/django_hotel_management_system | staff/urls.py | urls.py | py | 940 | python | en | code | 0 | github-code | 13 |
31018613402 | import os, datetime
import subprocess, re
import socket
from colorama import Fore, Style
from time import sleep
try:
batteryH = open("/sys/class/power_supply/battery/capacity","r").read().replace("\n", '')
ip = socket.gethostbyname(socket.gethostname())
date = datetime.datetime.now().strftime("%H:%M:... | Eric-M1/termux-ub | code_all.py | code_all.py | py | 1,517 | python | en | code | 0 | github-code | 13 |
19038071636 | import json
from api_handlers.polygon_api import Polygon_api
from macro import Macro_analysis
import configparser
def main():
#config = read_config()
#Polygon_api.initiate_api(config["API_Polygon"])
#------------------------------
#Macro data
Two_Prev_GDP = 2094 #GDP 2 quarters ago
Prev_GD... | ditariab/ditari_app | __init__.py | __init__.py | py | 1,252 | python | en | code | 0 | github-code | 13 |
20322525205 | from collections import deque
with open('12-input.txt') as f:
lines = [x for x in f.read().strip().split('\n')]
#Create a grid depending on the data's length and width
G = [list(line) for line in lines]
R = len(G) #rows
C = len(G[0]) #columns
E = [[0 for _ in range(C)] for _ in range(R)]
DIR = [(-1,0),(0,1),(1,0... | TrlRizu/Advent_of_code | Day 12/12-Hill_climbing_algorithm_c.py | 12-Hill_climbing_algorithm_c.py | py | 1,657 | python | en | code | 0 | github-code | 13 |
23133053154 | import os
import random
from src.neko.crypto.mersenne_twister import untemper, calc_prev_state, W, N, UPPER_MASK
def test_calc_prev_state():
state_len = N * 4
state0_bytes = os.urandom(state_len)
# 32bitの整数列
state0 = tuple(int.from_bytes(state0_bytes[i:i + 4], "big") for i in range(0, state_len, 4))
... | minaminao/neko | tests/crypto/test_mersenne_twister.py | test_mersenne_twister.py | py | 1,082 | python | en | code | 1 | github-code | 13 |
30315143330 | from flask import jsonify, request
from flask_babel import lazy_gettext as l_
from wazo_ui.helpers.menu import menu_item
from wazo_ui.helpers.view import BaseIPBXHelperView, NewHelperViewMixin
from wazo_ui.helpers.classful import (
LoginRequiredView,
extract_select2_params,
build_select2_response,
)
from... | wazo-platform/wazo-ui | wazo_ui/plugins/sip_template/view.py | view.py | py | 3,666 | python | en | code | 4 | github-code | 13 |
43202137197 | import numpy as np
import matplotlib.pyplot as plt
import math
x = np.arange(0, math.pi*2, 0.05)
y = np.sin(x)
#symbols : - , –, -., , . , , , o , ^ , v , < , > , s , + , x , D , d , 1 , 2 , 3 , 4 , h , H , p ,| , _
#colors : b, g, r, c, m, y, k, w
plt.plot(x, y, 'g4')
plt.xlabel("angle")
plt.ylabel("Sine")
plt.tit... | baponkar/my-python-programms | matplotlib/sine_plot.py | sine_plot.py | py | 349 | python | uk | code | 0 | github-code | 13 |
11311754193 |
def remove_duplicates_sorted_array(a):
end = len(a)
i = 0
while i < end:
number = a[i]
j = i + 1
while j < end and a[j] == number:
a[end -1],a[j] = a[j],a[end -1]
end -= 1
| cyrustabatab/leetcode | remove_duplicates_sorted_array.py | remove_duplicates_sorted_array.py | py | 266 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.