max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
velkoz_web_application_django/stock_dashboard/apps.py
MatthewTe/velkoz-airflow-pipeline
0
50500
<gh_stars>0 from django.apps import AppConfig class StockDashboardConfig(AppConfig): name = 'stock_dashboard'
1.046875
1
pyglesys/email.py
emjemj/pyglesys
0
50501
<reponame>emjemj/pyglesys class Email: client = None optional_arguments = [ "antispamlevel", "antivirus", "autorespond", "autorespondsaveemail", "autorespondmessage", "password", "quota" ] def __init__(self, client): self.client = client def overview(self): return self.client.get("/email/overv...
2.765625
3
terrascript/resource/drarko/mssql.py
mjuenema/python-terrascript
507
50502
# terrascript/resource/drarko/mssql.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:21:59 UTC) import terrascript class mssql_login(terrascript.Resource): pass __all__ = [ "mssql_login", ]
1.453125
1
metaprogramming/practice_code/special_methods.py
kmad1729/python_notes
0
50503
<reponame>kmad1729/python_notes class MyArray: def __init__(self, *args): self.elems = list(args) def __repr__(self): return str(self.elems) def __getitem__(self, index): return self.elems[index] def __setitem__(self, index, value): self.elems[index] = value def _...
3.78125
4
optimization/quantization/core/utils.py
AICryptoGroup/TorchSlim
5
50504
<reponame>AICryptoGroup/TorchSlim from enum import Enum, EnumMeta from typing import Any, Optional import torch class _QuantLiteralEnumMeta(EnumMeta): def __contains__(cls, item): try: cls(item) except ValueError: return False return True class _QuantLiteralEnum(E...
2.265625
2
surround/django/context_cache.py
sniegu/django-surround
1
50505
from functools import wraps from contextlib import contextmanager from threading import local thread_local = local() from surround.django.logging import setupModuleLogger setupModuleLogger(globals()) class LocalCacheBackend(object): def __init__(self): self.backend = {} def get(self, key): r...
2.265625
2
setup.py
blacKitten13/plyades
25
50506
<filename>setup.py #! /usr/bin/env python from distutils.core import setup setup(name="Plyades", version="0.0.1", description="A Python Astrodynamics Library", author="<NAME>", author_email="<EMAIL>", url="https://github.com/helgee/plyades", packages=["plyades", "plyades.tests"], ...
1.007813
1
LTSINT_vot.py
QUVA-Lab/Long-term-Siamese-Tracker
4
50507
# -------------------------------------------------------- # Copyright (c) 2018 University of Amsterdam # Written by <NAME> # -------------------------------------------------------- import sys import os import numpy as np import math from PIL import Image, ImageOps, ImageDraw import torch import torch.nn as nn imp...
2.4375
2
tools/perf/report_create.py
ldorau/rpma-lgtm
2
50508
<reponame>ldorau/rpma-lgtm #!/usr/bin/env python3 # # SPDX-License-Identifier: BSD-3-Clause # Copyright 2021, Intel Corporation # # # report_create.py # """Generate a performance report (EXPERIMENTAL) Before running this script you definitely should check `report_bench` and `report_figures`. Recreate the `lib.bench...
2.46875
2
lib/corekit/serializers.py
hdknr/django-corekit
1
50509
# encoding: utf-8 from django.forms.models import model_to_dict from django.db.models import Model from django.core.files import File from django.db.models.fields.files import FieldFile from rest_framework import serializers, relations, fields as rest_fields from datetime import datetime from enum import Enum from core...
1.992188
2
vspreview/toolbars/scening/dialog.py
wwww-wwww/vs-preview
0
50510
<reponame>wwww-wwww/vs-preview<filename>vspreview/toolbars/scening/dialog.py from __future__ import annotations from PyQt5.QtCore import Qt, QModelIndex, QItemSelection, QItemSelectionModel from PyQt5.QtWidgets import QDialog, QPushButton, QVBoxLayout, QLineEdit, QTableView, QHBoxLayout from ...models import SceningL...
1.703125
2
doit/getTotalPage.py
chhee66/TIL
0
50511
# getTotalPage.py # 06-3 게시판 페이징하기 (나의 풀이_한 번에 성공!) # divmod를 사용해서 몫과 나머지를 한 번에 구했다는 점, # 그리고 그 결과는 튜플이라 리스트처럼 인덱싱했다는 점! result = 0 # 총 페이지 (output) m = 0 # 게시물의 총 건수 (input) n = 0 # 한 페이지에 보여줄 게시물 수 (input) def getTotalPage(m, n): page = divmod(m, n) if not page[1]==0: result = page[0]+1 else: ...
3.21875
3
functions exerscise/04. Odd and Even Sum.py
nrgxtra/fundamentals
0
50512
n = input() def odd_even(a): odd = 0 even = 0 for i in range(len(a)): if int(a[i]) % 2 == 0: even += int(a[i]) else: odd += int(a[i]) return (f'Odd sum = {odd}, Even sum = {even}') print(odd_even(n))
3.890625
4
Flask API/post_test.py
exodustw/NYCU-E3-CAPTCHA-Autowrite
0
50513
<filename>Flask API/post_test.py import requests url = 'http://1172.16.17.32:5000/e3autologin' files = {'file': open('0009.png', 'rb')} rq = requests.post(url, files=files) print(rq.text)
2.3125
2
old-notes/old-ai/dl/datasets/p1-diabetes/e1diabeteskeras.py
mithi/algorithm-playground
85
50514
<filename>old-notes/old-ai/dl/datasets/p1-diabetes/e1diabeteskeras.py # --- # Goal # --- # Create and train a simple neural network to predict whether # a person has had an onset of diabetes given eight medical attributes # This data set of 768 samples is from the UCI machine learning repository # See associated text f...
3.359375
3
ouroboros/cmath.py
mewbak/ouroboros
205
50515
<reponame>mewbak/ouroboros<filename>ouroboros/cmath.py """ A pure python implementation of the standard module library cmath. """ import math " These are constants from float.h" _FLT_RADIX = 2 _DBL_MIN = 2.2250738585072014e-308 _DBL_MAX = 1.7976931348623157e+308 _DBL_EPSILON = 2.2204460492503131e-16 _DBL_MANT_DIG = 5...
2.65625
3
darwin/engine/executors/htcondor.py
R3bs/darwin
0
50516
import classad import collections import concurrent import datetime import htcondor import logging import os import sys import time from configparser import NoSectionError, NoOptionError from . import Executor logger = logging.getLogger(__name__) # context in strategy pattern class HTCondor(Executor): def __in...
2.0625
2
scripts/management/commands/load_languages.py
paxenarius/ajiragis-api
0
50517
<filename>scripts/management/commands/load_languages.py<gh_stars>0 from django.core.management.base import BaseCommand from ...language_loader import load_languages class Command(BaseCommand): def handle(self, *args, **options): load_languages()
1.742188
2
smart_alarm_clock/news_api.py
kfb19/Smart-Alarm-Clock
0
50518
<gh_stars>0 """this module collects current news headlines from the API""" import logging import requests from extract_json import get_key from extract_json import get_location from extract_json import get_urls logging.basicConfig(filename='pysys.log',level=logging.INFO, format='%(asctime)s %(levelname)-8s %(...
3.078125
3
download_bars2.py
rolangom/rx_ibapi_fetch
0
50519
#!/usr/bin/env python3 import os import sys import argparse import logging from typing import List, Optional, Union, Dict, Tuple from datetime import datetime, timedelta from sqlalchemy import create_engine import rx import rx.operators as ops from rx.subject import AsyncSubject, Subject, BehaviorSubject, ReplaySubje...
2.1875
2
common/xrd-ui-tests-python/tests/xroad_edit_token_friendly_name/kc_management.py
ria-ee/XTM
3
50520
# coding=utf-8 from selenium.webdriver.common.by import By from helpers import auditchecker from view_models import sidebar, keys_and_certificates_table, popups, messages, log_constants def test_edit_conf(case, ssh_host=None, ssh_username=None, ssh_password=None): ''' UC SS_22: Edit the Friendly Name of a To...
2.6875
3
src/cortexpy/test/expectation/graph.py
karljohanw/cortexpy
2
50521
<filename>src/cortexpy/test/expectation/graph.py import logging import attr logger = logging.getLogger(__name__) @attr.s(slots=True) class KmerGraphsExpectation(object): graph_list = attr.ib() def has_n_graphs(self, n): assert n == len(self.graph_list) return self def has_nodes(self, *...
2.359375
2
Exercicios/Resposta-EstruturaDeRepeticao/Exerc_4.py
ThaisAlves7/Exercicios_PythonBrasil
0
50522
<filename>Exercicios/Resposta-EstruturaDeRepeticao/Exerc_4.py # Suponho que a população de um país A seja da ordem de 80000 habiteantes com uma taxa anual de crescimento de 3% e que # a população B seja 200000 habitantes com uma taxa de crescimento de 1.5%. Faça um programa que calcule e escreva o numero # de a...
3.140625
3
5-semester/programming/lab1-tests.py
Rakleed/rgpu
0
50523
import squareseqdigit def test_squareseqdigit_1(): assert squareseqdigit.square_sequence_digit(1) == 1, " square_sequence_digit(1) == 1 " def test_squareseqdigit_2(): assert squareseqdigit.square_sequence_digit(2) == 4, " square_sequence_digit(2) == 4 " def test_squareseqdigit_3(): assert squareseqdig...
2.78125
3
featureflow/database_iterator.py
jayvdb/featureflow
7
50524
from .extractor import Node class DatabaseIterator(Node): def __init__(self, needs=None, func=None): super(DatabaseIterator, self).__init__(needs=needs) self._func = func def _process(self, data): for _id in data.iter_ids(): try: yield self._func(_id) ...
2.5
2
src/motor_controllers/stepper_motor/stepper_motor/steering_node.py
utahrobotics/usr_ws_2020
0
50525
""" This node is the communication layer betweeen the USR Ros subsystem and the stepper motor controllers. """ #TODO: add recieving info from the stepper controller import rclpy from rclpy.node import Node import yaml import serial, time from enum import Enum from motion_controller_msgs.msg import Mobility class Co...
2.78125
3
modules/sed.py
sammdot/circa
1
50526
<filename>modules/sed.py import re import string from util.esc import unescape """ The 'tr' implementation was based on github:ikegami-yukino/python-tr. """ all = [chr(i) for i in range(256)] def mklist(src): src = src.replace("\\/", "/") \ .replace("[:upper:]", string.ascii_uppercase) \ .replace("[:lower:]", ...
3.265625
3
core/solver.py
ongmingyang/some-max-cut
3
50527
<reponame>ongmingyang/some-max-cut import logging as log from cliqueIntersectionGraph import CliqueIntersectionGraph from cliqueTree import CliqueTree import beliefPropagation as bp class Solver: # # @param edges An iterator containing edges # def __init__(self, edges): self.edges = edges # iterator ...
2.421875
2
powerline/matchers/vim.py
Tuxdude/powerline
0
50528
<gh_stars>0 # vim:fileencoding=utf-8:noet from __future__ import absolute_import import os from powerline.bindings.vim import getbufvar def help(matcher_info): return str(getbufvar(matcher_info['bufnr'], '&buftype')) == 'help' def cmdwin(matcher_info): name = matcher_info['buffer'].name return name and os.path...
2
2
testdir/TestDatautils.py
mhassan1900/MHut
0
50529
#!/usr/bin/env python2.7 # Run as: # python setup.py install --user # -- Standard boilerplate header - begin import unittest as ut import sys, os from os.path import abspath, dirname from os.path import join as osjoin cdir = dirname(abspath(__file__)) # sys.argv[0])) = # testdir pdir = dirname(cdir) ...
2.265625
2
policies/actor.py
siekmanj/apex
0
50530
import torch import torch.nn as nn import torch.nn.functional as F from torch import sqrt from policies.base import Net class Actor(Net): def __init__(self): super(Actor, self).__init__() def forward(self): raise NotImplementedError def get_action(self): raise NotImplementedError class Linear_Ac...
2.734375
3
cal_tools/model.py
JasonCozens/CalTools
0
50531
"""Model: A python model of RFC 5545. ===================================== """ __author__ = 'Jason' import datetime from icalendar import Calendar from icalendar import Event ARG_TYPE_INCORRECT = 'Argument should be of type {0}' REQ_PROP_MISSING = 'Required property {0} is missing' class CalendarModel(): """R...
2.3125
2
modules/common/DownloadResource.py
opentargets/platform-input-support
4
50532
import datetime import urllib.request, urllib.parse, urllib.error import logging import threading import subprocess # Common packages from typing import Dict from modules.common.TqdmUpTo import TqdmUpTo # Decorator for the threading parameter. def threaded(fn): def wrapper(*args, **kwargs): thread = thr...
2.703125
3
ScanInPlex.py
danrahn/ScanInPlex
2
50533
import argparse import os import ScanInPlexCommon as Common from ScanInPlexConfiguration import Configure from ScanInPlexUninstaller import Uninstall from ScanInPlexScanner import Scanner class ScanInPlexRouter: def __init__(self): self.valid = True if os.name.lower() != 'nt': self.vali...
2.71875
3
hume/hint/procedures/command_library.py
open-home-iot/hume
2
50534
import json import logging from rabbitmq_client import RMQProducer, QueueParams from util import get_arg from defs import CLI_HUME_UUID, HINTCommand LOGGER = logging.getLogger(__name__) HINT_MASTER_COMMAND_QUEUE = "hint_master" _producer: RMQProducer _hint_queue_params = QueueParams(HINT_MASTER_COMMAND_QUEUE, durab...
2.28125
2
pygame/main.py
tableClothed/rock-paper-scissors
0
50535
import pygame from pygame.locals import * import cv2 import numpy as np import sys import os from time import sleep import random import tensorflow as tf from utils import visualization_utils as viz_utils class RockPaperScissors(): def __init__(self): pygame.init() # TENSORFLOW MODEL self.detect_fn = tf.sav...
2.5
2
__WXFB_BLR_LMGR.py
daakru/BLReLM
0
50536
# -*- coding: utf-8 -*- ########################################################################### ## Python code generated with wxFormBuilder (version 3.10.0-35-gd79d7781) ## http://www.wxformbuilder.org/ ## ## PLEASE DO *NOT* EDIT THIS FILE! ##########################################################################...
1.632813
2
models/world.py
matheuspb/igs
1
50537
""" This module contains the World class. """ from copy import deepcopy import numpy as np from models.object import Window class World: """ Contains all objects that are supposed to be drawn in the viewport. In this class comments, the actual slice of the world that is being shown, is r...
3.296875
3
tests/test_users.py
Squad002/GoOutSafe-Monolith
0
50538
<reponame>Squad002/GoOutSafe-Monolith<filename>tests/test_users.py<gh_stars>0 from .fixtures import app, client, db from . import helpers # TODO access only a single user! def test_health_authority_can_access_users(client): helpers.create_health_authority(client) helpers.login_authority(client) res = get_...
2.515625
3
poem.py
hvoort/mashup
0
50539
from lights import * open_car() horn() start_engine() stop_engine()
1.101563
1
src/deprecated/autoencoder.py
yulinliu101/DeepTP
46
50540
import os from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D from keras.models import Model from keras import backend as K def model(): input_img = Input(shape=(6, 20, 20)) x = Conv2D(filters = 32, kernel_size = (3, 3), strides = (1,1), padding = 'same', activation='relu')(input_i...
3.265625
3
anchore/cli/common.py
berez23/anchore
401
50541
<reponame>berez23/anchore<gh_stars>100-1000 import os import click import json import yaml import logging import sys from anchore import anchore_utils from anchore.cli import logs from anchore.util import contexts plain_output = False def extended_help_option(extended_help=None, *param_decls, **attrs): """ B...
2.703125
3
demo/live_img.py
625135449/SSD-Pytorch
1
50542
<filename>demo/live_img.py from __future__ import print_function import torch from torch.autograd import Variable import cv2 import time # from imutils.video import FPS, WebcamVideoStream import argparse import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from data import...
2.171875
2
Taller_secuencias_de_control/Ejercicio_6.py
willingtonino/Algoritmos_programacion_C4G2
0
50543
<reponame>willingtonino/Algoritmos_programacion_C4G2<filename>Taller_secuencias_de_control/Ejercicio_6.py """ Entradas numero_hombres-->int-->p_h numero_mujeres-->int-->p_m salidas Porcentaje de hombres-->float-->p_h Porcentaje de mujeres-->float-->p_m """ numero_hombres=int(input("digite total de hombres: ")) numero_...
3.546875
4
2382.py
ShawonBarman/URI-Online-judge-Ad-Hoc-level-problem-solution-in-python
1
50544
import math l, a, p, r = map(int, input().split()) dia = math.sqrt((l*l)+(a*a)+(p*p)) if dia <= 2*r: print("S") else: print("N")
3.21875
3
tools/scaleout.py
chrfrenning/ironviper
2
50545
<reponame>chrfrenning/ironviper<filename>tools/scaleout.py<gh_stars>1-10 #!/usr/bin/env python2.7 import os import toml import sys import requests import json # ##################################################################### # # Increases active converter containers by one # # Enumerates all containers in the re...
2.125
2
SRCTF/SRCTF/django_reuse/reuse/migrations/0004_ctf_info_config_path.py
yinyueacm/work-uga
1
50546
<filename>SRCTF/SRCTF/django_reuse/reuse/migrations/0004_ctf_info_config_path.py # -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-29 14:58 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reuse', '000...
1.507813
2
superfamily_dbtool.py
SaierLaboratory/deuterocol
0
50547
<reponame>SaierLaboratory/deuterocol #!/usr/bin/env python3 import re, json import argparse def parse_txtdump(f): superfamilies = {} lastsuperfam = '' mode = 2 for l in f: if not l.strip(): continue print(l, mode) if mode == 2: if re.match('[0-9]+\.[A-Z]+\.[0-9]+ - ', l): superfamilies[lastsuperfa...
2.90625
3
apps/watch/main.py
cr0mbly/TTGO-esp32-micropython-watch
6
50548
<filename>apps/watch/main.py<gh_stars>1-10 from st7789 import BLACK, WHITE import vga1_8x8 as font from apps.utils import BaseApp SECOND_TO_TRIGGER_DISPLAY_UPDATE = 59 SECOND_TO_RESET_DISPLAY_UPDATE = 0 class WatchDisplay(BaseApp): has_already_updated = False def setup(self): self.lcd_display.enab...
2.78125
3
internal/jsweet_ts_lib/jsweet_ts_lib.bzl
chrismatix/rules_jsweet
1
50549
load("//internal/jsweet_transpile:jsweet_transpile.bzl", "jsweet_transpile","TRANSPILE_ATTRS") load("@npm_bazel_typescript//:index.bzl", "ts_library") JWSEET_TRANSPILE_KEYS = TRANSPILE_ATTRS.keys() def jsweet_ts_lib(name, **kwargs): transpile_args = dict() for transpile_key in JWSEET_TRANSPILE_KEYS: i...
1.882813
2
comments.py
HackGT/reddit-crawler
0
50550
import praw import prawcore import requests import pprint import json import time from crawler_lib import send_message, keyword_match import ConfigParser config = ConfigParser.ConfigParser() config.read('/etc/reddit-crawler/config.ini') reddit = praw.Reddit(user_agent=config.get('reddit','user_agent'), ...
2.828125
3
recipes/Python/577826_Yet_Another_Ordered_Dictionary/recipe-577826.py
tdiprima/code
2,023
50551
# ordereddict.py # A dictionary that remembers insertion order # Tested under Python 2.7 and 2.6.6 only # # Copyright (C) 2011 by <NAME> <lukius at gmail dot com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
2.484375
2
Games/Mab Libs/Mab Lib 1.py
Kittex0/Python-Games
0
50552
import time Q1 = input("Who do you like: ") Q2 = input("Who do you hate: ") Answer = f"I love {Q2} but hate {Q1}" print(Answer) time.sleep(3)
3.796875
4
app/services/environment_variable_service.py
paullegranddc/gello
44
50553
# -*- coding: utf-8 -*- # # Unless explicitly stated otherwise all files in this repository are licensed # under the Apache 2 License. # # This product includes software developed at Datadog # (https://www.datadoghq.com/). # # Copyright 2018 Datadog, Inc. # """EnvironmentVariableService""" from os import environ fro...
2.234375
2
obsidion/__main__.py
Darkflame72/Minecraft-Discord
1
50554
"""Initialise and run the bot.""" import logging from discord import Activity from discord import ActivityType from discord import AllowedMentions from discord import Intents from discord_slash import SlashCommand from obsidion import _update_event_loop_policy from obsidion.core import get_settings from obsidion.core....
2.46875
2
TopInterviewQuestions/EasyCollection/03_LinkedList/MergeTwoSortedLists.py
seokg/leetcode2021
0
50555
<filename>TopInterviewQuestions/EasyCollection/03_LinkedList/MergeTwoSortedLists.py # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: ...
3.890625
4
SpaceRecorder.py
Kei-141/SpaceRecorder
0
50556
<reponame>Kei-141/SpaceRecorder import os import json import requests import time import datetime import schedule import tweepy import subprocess import psutil import pprint from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from selenium import webdriver from selenium.webdriver.comm...
2.484375
2
tests/tests.py
AmirSbss/python-gsearch
0
50557
<reponame>AmirSbss/python-gsearch # -*- coding: utf-8 -*- import unittest import time from random import randint from gsearch.googlesearch import search class TestSearch(unittest.TestCase): def setUp(self): time.sleep(randint(15,20)) def test_results_count(self): res = search('<NAME>', num_results=30) sel...
3.203125
3
aws/scripts/sqstest.py
bdastur/notes
4
50558
<reponame>bdastur/notes<filename>aws/scripts/sqstest.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest import boto3 import botocore class SQS(unittest.TestCase): def setUp(self): env = os.environ.get('PROFILE_NAME', 'default') if env == "default": print "Using...
2.359375
2
tests/compilation/yaml/test_yaml_load_datetime.py
lasta/preacher
0
50559
from datetime import datetime, timezone, timedelta from io import StringIO from pytest import mark, raises from preacher.core.value import ValueContext, RelativeDatetime from preacher.compilation.yaml import YamlError, load def test_given_datetime_that_is_offset_naive(): stream = StringIO('2020-04-01 01:23:45')...
2.140625
2
proxmoxbalancer/__init__.py
kcl-nmssys/python-proxmoxbalancer
7
50560
import os from datetime import datetime from .proxmoxbalancer import ProxmoxBalancer def balance(): print("Started at %s" % datetime.now().strftime("%Y-%m-%d %H:%M:%S")) if "https_proxy" in os.environ: del os.environ["https_proxy"] balancer = ProxmoxBalancer() balancer.balance() print("...
2.421875
2
broadinstitute_psp/utils/separate_gct.py
cmap/psp
8
50561
<gh_stars>1-10 """ separate_gct.py Separates a gct into several gcts. """ import logging import sys import os import argparse import broadinstitute_psp.utils.setup_logger as setup_logger import cmapPy.pandasGEXpress.subset_gctoo as sg import cmapPy.pandasGEXpress.parse as parse import cmapPy.pandasGEXpress.write_gct...
2.40625
2
web/sales_app/apps/home/models.py
iabok/sales-tracker
163
50562
"""Base models"""
1.09375
1
aj-accountant.py
Llona/aj-accountant
0
50563
# -*- coding: UTF-8 -*- import openpyxl import shutil import os import const_define # active sheet name # print(workbook.active) # load excel file workbook = openpyxl.load_workbook(const_define.DETAILED_LEDGER_FULL_PATH, data_only=True) # get all sheet name # worksheets = workbook.get_sheet_names() worksheets = tupl...
2.703125
3
app/scripts/populate_db.py
spiros-m2/books-rest-api
0
50564
<gh_stars>0 from django.db import transaction # from books import models from datetime import datetime @transaction.atomic def populate_authors(): print("Adding authors...") authors = [ models.Author( id=1, first_name="Kurt", last_name="Vonnegut", birthd...
2.390625
2
src/wikidocs/1_tensor_control/tensor_basic.py
837477/PyTorch_study
1
50565
import numpy as np ''' !! 기본적인 개념 1차원 = 벡터 2차원 = 행렬 3차원 = 텐서 4차원 부터는 우리는 3차원의 세상에서 살고 있기 때문에 4차원 이상부터는 머리로 생각하기 어렵다. 2차원 텐서 2차원 텐서를 행렬이라고 말한다. |t| = (batch size, dim) batch size = "행" / dim = "열" 3차원 텐서 3차원 텐서는 그냥 텐서라고 부른다. |t| = (batch size, width, height) batch size = "세로" / width = "가로" / height = "높이" (입체적인 부분) ...
2.984375
3
progressbarupload/urls.py
mehdipourfar/django-progressbarupload
73
50566
# -*- coding: utf-8 -*- from django.conf.urls import url from progressbarupload.views import upload_progress urlpatterns = [ url(r'^upload_progress$', upload_progress, name="upload_progress"), ]
1.34375
1
core/management/commands/reset_webhooks.py
mpyrev/lunchegram
1
50567
<reponame>mpyrev/lunchegram<filename>core/management/commands/reset_webhooks.py from urllib.parse import urljoin from django.conf import settings from django.core.management.base import BaseCommand from django.urls import reverse from lunchegram import bot class Command(BaseCommand): help = 'Resets Telegram web...
2.203125
2
celery-demo/celery_app/tasks.py
twtrubiks/docker-django-celery-tutorial
45
50568
import time from celery import chain from celery_app import app @app.task def add(x, y): return x + y ''' ref. http://docs.celeryq.org/en/latest/userguide/tasks.html#avoid-launching-synchronous-subtasks ''' def chain_demo(x, y): # add_demo -> mul_demo -> insert_db_demo chain(add_demo.s(x, y), mul_d...
2.6875
3
integration_tests.py
TRIP-Lab/itinerum-mobile-api
4
50569
<filename>integration_tests.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # <NAME>, 2016-2018 # # Tests and dummy data uploading functions for mobile API from datetime import datetime, timedelta import dateutil.parser from faker import Factory import json import pytz from pprint import pprint import ra...
2.171875
2
RLAnIntro/RLAnIntro_Chap6_MaxBias.py
HuangJingGitHub/PracMakePert_py
2
50570
<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import copy STATE_A = 0 STATE_B = 1 STATE_TERMINAL = 2 STATE_START = STATE_A ACTION_A_RIGHT = 0 ACTION_A_LEFT = 1 EPSILON = 0.1 ALPHA = 0.1 GAMMA = 1 # take 10 actions in B ACTIONS_B = range(0, 10) STATE_ACTIO...
2.578125
3
Python/first-unique-character-in-a-string.py
xiaohalo/LeetCode
9
50571
# Time: O(n) # Space: O(n) # Given a string, find the first non-repeating character in it and # return it's index. If it doesn't exist, return -1. # # Examples: # # s = "leetcode" # return 0. # # s = "loveleetcode", # return 2. # Note: You may assume the string contain only lowercase letters. from collections impor...
3.71875
4
scripts/postrender_dataset.py
youngwoon/d4rl
4
50572
<gh_stars>1-10 import argparse import d4rl import gym import numpy as np import h5py if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--env_name', type=str, default='maze2d-hardexp-v2') args = parser.parse_args() env = gym.make(args.env_name) render_env = gym.mak...
2.234375
2
log_async/stats.py
stevelr/python-log-async
0
50573
<reponame>stevelr/python-log-async<gh_stars>0 # stat counters for logging handlers try: from prometheus_client import Counter, Gauge except ImportError: # to avoid a forced dependency on prometheus_client, # use a super-minimalist implementation of counter. # since these are used within same thread, no...
2.359375
2
__explorations__/2020_29/mnist4.py
tyoc213/blog
1
50574
<reponame>tyoc213/blog<filename>__explorations__/2020_29/mnist4.py<gh_stars>1-10 #%% ### %%heat #import pdb print("---------------------------------------------------------- START") import torch #import torch_xla.core.xla_model as xm #tpu_device = xm.xla_device() tpu_device = torch.device('cuda:0') #torch.cuda.device(...
2.3125
2
tests/test_model.py
Markovvn1/swipio-file-storage
29
50575
<gh_stars>10-100 from file_storage.model import Model def test_user(model: Model): model.create_user('test01', 'kjhni3j') assert model.get_user_id('test01', 'kjhni3j') == 1 assert model.get_user_id('test01', 'kjhni3u') is None
2.296875
2
Models/nn/DiagLayer.py
ianxmason/Fewshot_Learning_of_Homogeneous_Human_Locomotion_Styles
25
50576
<gh_stars>10-100 import numpy as np import theano import theano.tensor as T from theano.tensor.shared_randomstreams import RandomStreams from Layer import Layer class DiagLayer(Layer): def __init__(self, weights_shape, rng=np.random, gamma=0.01): assert weights_shape[-2] == 1 # Diagonal weight matrix is...
2.34375
2
my_csv_reader.py
mayaraalvesc/class4-homework
0
50577
<reponame>mayaraalvesc/class4-homework<gh_stars>0 import os file_path = './wine.data' if os.path.isfile(file_path): print("I have a file to process!!!") else: print("Boo, no file for me") file = open('wine.data') corrected_file = [] for line in file.readlines(): clean_line = line.replace(' ', ' ').replace(...
3.015625
3
listexp.py
kentdlee/GenComp
2
50578
import listexpscanner import listexpparser import sys def main(): if (len(sys.argv)) != 2: print("usage: listexp filename") print(" listexp will interpret/compile the expression in the file named") print(" filename and print its result to standard output") return ...
3.359375
3
bin/ufits-OTU_cluster_ref.py
zhongmicai/ITS_clustering
1
50579
<filename>bin/ufits-OTU_cluster_ref.py<gh_stars>1-10 #!/usr/bin/env python #This script runs reference based OTU clustering #written by <NAME> <EMAIL> import sys, os, argparse, subprocess, inspect, csv, re, logging, shutil, multiprocessing from Bio import SeqIO currentdir = os.path.dirname(os.path.abspath(inspect.get...
2.296875
2
example.py
MilesCranmer/Eureqa.jl
35
50580
import numpy as np X = 2 * np.random.randn(100, 5) y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5 from pysr import PySRRegressor model = PySRRegressor( niterations=40, binary_operators=["+", "*"], unary_operators=[ "cos", "exp", "sin", "inv(x) = 1/x", # Custom operator...
2.828125
3
grodddroid/AcfgTools/acfg_tools/builder/main.py
demirdagemir/thesis
0
50581
#!/usr/bin/env python3 """ Perform some operations on Android method CFGs to output a more comprehensive global app graph. """ import argparse import os.path import logging from acfg_tools.builder.cfg_analyser import CfgAnalyser DESCRIPTION = "Create a global app graph from CFGs" log = logging.getLogger("branchexp"...
2.703125
3
tests/test_MLdata.py
masterdoors/kernel_trees
1
50582
<filename>tests/test_MLdata.py # coding: utf-8 ''' Created on 21 мая 2016 г. @author: keen ''' from sklearn import datasets import CO2_tree as co2t import CO2_forest as co2f import pickle from scipy.sparse import csr_matrix from sklearn import preprocessing from numpy import ndarray from numpy import asarray from n...
2.46875
2
tests/utils/test_visualization_engine.py
chrisochoatri/dgp
0
50583
import json import os import cv2 import numpy as np from dgp.datasets.synchronized_dataset import SynchronizedScene from dgp.utils.visualization_engine import visualize_dataset_3d, visualize_dataset_2d, visualize_dataset_sample_3d, visualize_dataset_sample_2d from tests import TEST_DATA_DIR def dummy_caption(datase...
2.5
2
tesseractXplore/diff_stdout.py
JKamlah/tesseractXplore
15
50584
<reponame>JKamlah/tesseractXplore<filename>tesseractXplore/diff_stdout.py from functools import partial import difflib from kivymd.uix.button import MDFlatButton from kivymd.uix.dialog import MDDialog from kivymd.uix.list import MDList, OneLineListItem from tesseractXplore.app import alert, get_app from tesseractXplo...
2.046875
2
caption/datasets/language_modeling.py
Unbabel/caption
3
50585
# -*- coding: utf-8 -*- from test_tube import HyperOptArgumentParser from .lazy_dataset import LineByLineTextDataset def load_mlm_dataset(hparams: HyperOptArgumentParser, train=True, val=True, test=True): """ This dataset loader is used for loading data for language modeling. :param hparams: HyperOptArg...
2.703125
3
src/app.py
ebina4yaka/flask-get-main-color-api
1
50586
<reponame>ebina4yaka/flask-get-main-color-api import os from flask import Flask, request, jsonify from flask_cors import CORS import base64 from src.get_main_colors import get_main_colors app = Flask(__name__) CORS(app) @app.route('/', methods=['GET']) def it_works(): return "it works!" @app.route('/api/uploa...
2.453125
2
Math/C01_Geometry_basics/Programs/S01/Point_of_concurrency_image.py
Polirecyliente/SGConocimiento
0
50587
#T# the following code shows how to draw a point of concurrency #T# to draw a point of concurrency, the pyplot module of the matplotlib package is used import matplotlib.pyplot as plt #T# create the figure and axes fig1, ax1 = plt.subplots(1, 1) #T# set the aspect of the axes ax1.set_aspect('equal', adjustable = 'bo...
3.65625
4
src/webex-teams/create-membership.py
fernando28024/git-clone-https-github.com-CiscoDevNet-devasc-code-examples
43
50588
<reponame>fernando28024/git-clone-https-github.com-CiscoDevNet-devasc-code-examples<filename>src/webex-teams/create-membership.py # Fill in this file with the code to create a room membership from the Webex Teams exercise
1.804688
2
vectornav.py
fdcl-gwu/python-vectornav
0
50589
import numpy as np import serial import struct import threading import time from array import array from datetime import datetime class ImuData: def __init__(self, t=0.0, freq=0, ypr=np.zeros(3), a=np.zeros(3), \ W=np.zeros(3)): self.t = t self.freq = freq self.ypr = ypr ...
2.703125
3
assopy/migrations/0007_add_customer_to_invoice.py
zevaverbach/epcon
40
50590
<filename>assopy/migrations/0007_add_customer_to_invoice.py from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('assopy', '0006_add_bank_to_payment_options'), ] operations = [ migrations.AddField( model_name='invoice', ...
1.648438
2
python/ml4ir/applications/ranking/tests/test_ranklib_to_ml4ir.py
ducouloa/ml4ir
70
50591
import unittest import os import warnings from ml4ir.base.data import ranklib_helper import pandas as pd warnings.filterwarnings("ignore") INPUT_FILE = "ml4ir/applications/ranking/tests/data/ranklib/train/sample.txt" OUTPUT_FILE = "ml4ir/applications/ranking/tests/data/ranklib/train/sample_ml4ir.csv" QUERY_ID_NAME =...
3.109375
3
PopUpClasses.py
AIEMMU/MiTSegmentor
0
50592
from tkinter import filedialog from tkinter import * from PIL import Image, ImageTk from tkinter.messagebox import showinfo class InfoWindow(object): def __init__(self,master): top=self.top=Toplevel(master) self.infoLabel=Label(top,text="Please Enter file resoltuion with ; to separate values") ...
3.0625
3
metrics/webnlg_challenge_2017/evaluator.py
HKUNLP/UnifiedSKG
191
50593
<gh_stars>100-1000 # encoding=utf8 import os from third_party.dart import extract_score_webnlg def evaluate_webnlg_challenge_2017(references_s, preds): """ The evaluation of the webnlg_challenge_2017, we use the evaluate shell that DART dataset provided. :param references_s: ACTUALLY, refer...
2.828125
3
packages/w3af/w3af/core/controllers/extrusion_scanning/server/extrusionServer.py
ZooAtmosphereGroup/HelloPackages
3
50594
<filename>packages/w3af/w3af/core/controllers/extrusion_scanning/server/extrusionServer.py """ extrusionServer.py Copyright 2006 <NAME> This file is part of w3af, http://w3af.org/ . w3af is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the F...
2.3125
2
hufscoops/haksik_db_to.py
JunKiBeom/HUFormation-kakao
5
50595
<filename>hufscoops/haksik_db_to.py import sqlite3 import random import datetime #from django.shortcuts import render def db_send(cafeteria, dates): if dates == 'today': today = datetime.date.today() today_date = today.strftime('%m월 %d일') con = sqlite3.connect("./DB/haksik_data.d...
2.421875
2
brave/datasets/fixtures.py
deepmind/brave
26
50596
<reponame>deepmind/brave<gh_stars>10-100 # Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
2.140625
2
model_zoo/models/vram/generate_dram.py
forsyth2/lbann
0
50597
#!/usr/bin/env python import sys import os import subprocess import functools import collections # Parameters lbann_dir = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).strip() lbann_proto_dir = lbann_dir + "/src/proto/" work_dir = lbann_dir + "/model_zoo/models/vram" template_proto = l...
2.359375
2
gui.py
krkruk/SerialDataRecorderAndPlayer
2
50598
<gh_stars>1-10 from tkinter import ttk from tkinter import * import tkinter.filedialog as tkd from pandas.core.ops import _TimeOp import serial_server as ss import multiprocessing as mp class CommandRunnable: def __init__(self): self.commands = {} def exec_command(self, key, *args, **kwargs): ...
2.46875
2
Strings/Triple_Quoted_Strings.py
obareau/python_travaux_pratiques
1
50599
<reponame>obareau/python_travaux_pratiques text = """first row second row third row""" print(text)
1.460938
1