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 |
|---|---|---|---|---|---|---|
eva/views_data.py | aqutor/CE_Backend | 0 | 18900 | from rest_framework.views import APIView
from rest_framework import status
from eva.serializers import WorkSerializer, PageSerializer, WordSerializer, RadicalSerializer
from eva.models import Work, Page, Word, Radical
from rest_framework.response import Response
from django.http import Http404
class WorkView(APIView)... | 2.0625 | 2 |
program/appID3.py | trungvuong55555/FlaskAPI_ExpertSystem | 0 | 18901 | <gh_stars>0
from flask import Flask, request, render_template
import pickle
app = Flask(__name__)#khoi tao flask
model = pickle.load(open('modelID3.pkl', 'rb'))#unpicke model
@app.route('/',methods =["GET", "POST"])
def home():
if request.method == "POST":
#lay gia tri tu form
one= request.form.ge... | 2.734375 | 3 |
examples/deldup.py | rlan/pydmv | 0 | 18902 | <gh_stars>0
#!/usr/bin/python
import os
import sys
import argparse
#Auto-import parent module
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import voc
#from pydmv import voc
parser = argparse.ArgumentParser(description="Print VOC index file without duplicates")
parser.add_argument("file", help="Input index fil... | 2.984375 | 3 |
home_work/App/views.py | jianghaiming0707/python1806homework | 1 | 18903 | from django.shortcuts import render
from django.http import HttpResponse
from App.models import *
# Create your views here.
def search(seq):
myclass=Myclass.objects.all()
return render(seq,'test.html',context={'myclass':myclass})
def students(req):
students_id=req.GET.get('classid')
studentt=Student.ob... | 2.109375 | 2 |
Xiaomi_8/day_start/show_screen.py | Lezaza/hotpoor_autoclick_xhs | 1 | 18904 | <filename>Xiaomi_8/day_start/show_screen.py
import os
import cv2
import time
path = "C:/Users/lenovo/Documents/Sites/github/hotpoor_autoclick_xhs/Xiaomi_8/day_start/hotpoor_autoclick_cache"
cache = "hotpoor_autoclick_cache/screen.png"
def get_image():
os.system(f"adb shell screencap -p /sdcard/%s"%cache)
os.sy... | 2.734375 | 3 |
hknweb/events/views/event_transactions/show_event.py | jyxzhang/hknweb | 0 | 18905 | from django.shortcuts import render, redirect, reverse
from django.contrib import messages
from django.shortcuts import get_object_or_404
from django.core.paginator import Paginator
from hknweb.utils import markdownify
from hknweb.utils import allow_public_access
from hknweb.events.constants import (
ACCESSLEVEL_... | 2.109375 | 2 |
data_access_layer/abstract_classes/customer_dao.py | Alejandro-Fuste/python-bank-application | 0 | 18906 | <reponame>Alejandro-Fuste/python-bank-application
from abc import ABC, abstractmethod
from entities.customers import Customer
from typing import List
class CustomerDao(ABC):
@abstractmethod
def create_customer_entry(self, customer: Customer) -> Customer:
pass
@abstractmethod
def get_customer... | 3.546875 | 4 |
examples/make_sphere_graphic.py | itamar-dw/spherecluster | 186 | 18907 | import sys
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # NOQA
import seaborn # NOQA
from spherecluster import sample_vMF
plt.ion()
n_clusters = 3
mus = np.random.randn(3, n_clusters)
mus, r = np.linalg.qr(mus, mode='reduced')
kappas = [15, 15, 15]
num_points_per... | 2.1875 | 2 |
pointnet2/tf_ops/sampling/tf_sampling.py | ltriess/pointnet2_keras | 2 | 18908 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Furthest point sampling
Original author: <NAME>
Modified by <NAME>
All Rights Reserved. 2017.
Modified by <NAME> (2020)
"""
import os
import sys
import tensorflow as tf
from tensorflow.python.framework import ops
BASE_DIR = os.path.dirname(os.path.ab... | 2.6875 | 3 |
gql/resolvers/mutations/scope.py | apoveda25/graphql-python-server | 4 | 18909 | from ariadne import MutationType
from datetime import datetime as dt
from models.scope import Scope
from schemas.helpers.normalize import change_keys
from schemas.scope import ScopeCreate
mutations_resolvers = MutationType()
@mutations_resolvers.field("scopeCreate")
async def resolve_scope_create(_, info, scope) ->... | 2.0625 | 2 |
napari_subboxer/interactivity_utils.py | alisterburt/napari-subboxer | 3 | 18910 | from typing import Optional
import napari
import napari.layers
import numpy as np
from napari.utils.geometry import project_point_onto_plane
def point_in_bounding_box(point: np.ndarray, bounding_box: np.ndarray) -> bool:
"""Determine whether an nD point is inside an nD bounding box.
Parameters
---------... | 3.453125 | 3 |
src/attribute_generator.py | neutron101/cs231A-project | 0 | 18911 | <gh_stars>0
import numpy as np
class AttributeGenerator:
def __init__(self, RTs, Ks, Ps):
self._RTs = RTs
self._Ks = Ks
self._Ps = Ps
def generate(self):
self._update_intrinsics()
self._update_translation_and_rotation()
self._updateProjection()
def use_default_translation_and_rotation(self):
self.... | 2.171875 | 2 |
theDarkArtsClass.py | biechuyangwang/UniversalAutomaticAnswer | 2 | 18912 | # 分析黑魔法防御课界面
import cv2
import sys
sys.path.append(r"C:\\Users\\SAT") # 添加自定义包的路径
from UniversalAutomaticAnswer.conf.confImp import get_yaml_file
from UniversalAutomaticAnswer.screen.screenImp import ScreenImp # 加入自定义包
from UniversalAutomaticAnswer.ocr.ocrImp import OCRImp
from UniversalAutomaticAnswer.util.filter imp... | 2.328125 | 2 |
lt_104.py | fdzhonglin/trees | 0 | 18913 | <reponame>fdzhonglin/trees
# standard traversal problem
class Solution(object):
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
# leaf condition
if root == None:
return 0
# skeleton, since function has return, need to as... | 3.8125 | 4 |
src/anim.py | JovialKnoll/monsters | 2 | 18914 | <gh_stars>1-10
import pygame.mixer
from vec2d import Vec2d
from saveable import Saveable
class Anim(Saveable):
__slots__ = (
'func',
'time',
'pos',
'sound',
'positional_sound',
)
def __init__(self, func: str, time: int, x_or_pair, y=None,
sound: p... | 2.671875 | 3 |
nevermined_compute_api/workflow_utils.py | nevermined-io/compute-api | 0 | 18915 | <filename>nevermined_compute_api/workflow_utils.py
import os
from pathlib import Path
import json
from contracts_lib_py.utils import get_account
from common_utils_py.ddo.ddo import DDO
from nevermined_sdk_py import Nevermined, Config
import yaml
from configparser import ConfigParser
config_parser = ConfigParser()
con... | 2.265625 | 2 |
providers/scoop_mock_provider.py | prezesp/scoop-viewer | 86 | 18916 | <filename>providers/scoop_mock_provider.py
""" Module to interact with scoop. """
from subprocess import Popen, PIPE # nosec
import os
class ScoopMockProvider:
""" Module to interact with scoop. """
def __init__(self):
self.version = 'unknown'
def get_version(self):
pass
def __run_sc... | 2.3125 | 2 |
services/movies_streaming_converter/src/models/convertation.py | fuodorov/yacinema | 0 | 18917 | import datetime
import uuid
from typing import Optional
from models.base import CustomBaseModel
class ConvertVideoIn(CustomBaseModel):
source_path: str
destination_path: str
resolution: str
codec_name: Optional[str] = None
display_aspect_ratio: Optional[str] = None
fps: Optional[int] = None
... | 2.484375 | 2 |
flasc/circular_statistics.py | NREL/flasc | 3 | 18918 | <filename>flasc/circular_statistics.py
# Copyright 2021 NREL
# 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
# Unless required by applicable law or ... | 2.6875 | 3 |
src/cltl/backend/source/pyaudio_source.py | leolani/cltl-backend | 0 | 18919 | import logging
import uuid
from typing import Iterable
import numpy as np
import pyaudio
from cltl.backend.api.util import raw_frames_to_np
from cltl.backend.spi.audio import AudioSource
logger = logging.getLogger(__name__)
class PyAudioSource(AudioSource):
BUFFER = 8
def __init__(self, rate, channels, fr... | 2.390625 | 2 |
toolkit4nlp/optimizers.py | xv44586/toolkit4nlp | 94 | 18920 | <reponame>xv44586/toolkit4nlp
# -*- coding: utf-8 -*-
# @Date : 2020/7/6
# @Author : mingming.xu
# @Email : <EMAIL>
# @File : optimizers.py
import re
import numpy as np
import tensorflow as tf
from keras.optimizers import *
from toolkit4nlp.backend import keras, K, is_tf_keras, piecewise_linear
from toolkit4... | 2.421875 | 2 |
quadpy/triangle/_laursen_gellert.py | dariusarnold/quadpy | 0 | 18921 | <reponame>dariusarnold/quadpy
from sympy import Rational as frac
from ..helpers import article
from ._helpers import TriangleScheme, concat, s1, s2, s3
citation = article(
authors=["<NAME>", "<NAME>"],
title="Some criteria for numerically integrated matrices and quadrature formulas for triangles",
journal... | 2.4375 | 2 |
python2/examples/tutorial_threadednotifier.py | openEuler-BaseService/pyinotify | 1,509 | 18922 | # ThreadedNotifier example from tutorial
#
# See: http://github.com/seb-m/pyinotify/wiki/Tutorial
#
import pyinotify
wm = pyinotify.WatchManager() # Watch Manager
mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE # watched events
class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event):
... | 2.515625 | 3 |
VersionMonitorDeamonForPy/deamon/ZTest.py | xblia/Upgrade-service-for-java-application | 0 | 18923 | <filename>VersionMonitorDeamonForPy/deamon/ZTest.py
#coding=utf-8
'''/*
* Copyright 2015 lixiaobo
*
* VersionUpgrade project licenses this file to you 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:... | 1.476563 | 1 |
ROBOTIS/DynamixelSDK/python/tests/protocol2_0/sync_read_write.py | andy-Chien/timda_dual_arm | 3 | 18924 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2017 ROBOTIS CO., LTD.
#
# 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 cop... | 2.046875 | 2 |
models/globalsenti.py | movabo/newstsc | 3 | 18925 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# file: lcf_bert.py
# author: yangheng <<EMAIL>>
# Copyright (C) 2019. All Rights Reserved.
# The code is based on repository: https://github.com/yangheng95/LCF-ABSA
import torch
import torch.nn as nn
from models.lcf import LCF_BERT
class Global_LCF(nn.Module):
def __in... | 2.28125 | 2 |
analysis/outflows/__init__.py | lconaboy/seren3 | 1 | 18926 | def integrate_surface_flux(flux_map, r):
'''
Integrates a healpix surface flux to compute the total
net flux out of the sphere.
r is the radius of the sphere in meters
'''
import numpy as np
import healpy as hp
from scipy.integrate import trapz
from seren3.array import SimArray
... | 2.953125 | 3 |
evalution/composes/utils/matrix_utils.py | esantus/evalution2 | 1 | 18927 | <reponame>esantus/evalution2
import numpy as np
from composes.matrix.sparse_matrix import SparseMatrix
from composes.matrix.dense_matrix import DenseMatrix
from composes.matrix.matrix import Matrix
from scipy.sparse import issparse
from composes.utils.py_matrix_utils import is_array
from warnings import warn
def to_m... | 2.4375 | 2 |
cpu/pipeline/writeback_unit.py | tim-roderick/simple-cpu-simulator | 2 | 18928 | from .component import Component
from cpu.Memory import SCOREBOARD
from isa.Instructions import ALUInstruction as alu
class writeback_unit(Component):
def add_result(self, result):
result.finished = True
self.pipeline_register = self.pipeline_register + [result]
self.clean()
def clean(s... | 2.8125 | 3 |
ex026.py | juniorpedroso/Exercicios-CEV-Python | 0 | 18929 | <reponame>juniorpedroso/Exercicios-CEV-Python
frase = str(input('Digite uma frase: ').strip().upper())
print('A letra a aparece {} vezes'.format(frase.count('A')))
print('Sua primeira aparição é na posição {}'.format(frase.find('A') + 1))
print('Ela aparece pela última vez na posição {}'.format(frase.rfind('A') + 1))
| 4.03125 | 4 |
MyDataLoader.py | WynMew/WaifuLite | 22 | 18930 | <reponame>WynMew/WaifuLite
import glob
import io
import numpy as np
import re
import os
from io import BytesIO
import random
from uuid import uuid4
import torch
from PIL import Image
from torch.utils.data import Dataset
from torchvision.transforms import RandomCrop
from torchvision.transforms.functional import to_tenso... | 2.296875 | 2 |
model/get_data.py | qq1010903229/OIer | 0 | 18931 | <reponame>qq1010903229/OIer
f = open("OI_school.csv")
op = open("mdt.txt","w")
for i in f.readlines():
c = i.split('","')
op.write(c[-3]+','+c[-2]+','+"".join([i+',' for i in eval(c[1])])[:-1]+'\n')
| 2.4375 | 2 |
pythontabcmd2/parsers/global_options.py | playkazoomedia/tabcmd2 | 11 | 18932 | class GlobalOptions:
""" Class to evaluate global options for example: project path"""
@staticmethod
def evaluate_project_path(path):
""" Method to parse the project path provided by the user"""
first_dir_from_end = None
if path[-1] != "/":
path = path + "/"
new_p... | 3.09375 | 3 |
power_data_to_sat_passes/filtersatpowerfiles.py | abrahamneben/orbcomm_beam_mapping | 1 | 18933 | <filename>power_data_to_sat_passes/filtersatpowerfiles.py
#!/users/aneben/python/bin/python
import sys
import commands
import numpy as np
import string
np.set_printoptions(precision=3,linewidth=200)
months={'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06','Jul':'07','Aug':'08','Sept':'09','Oct':'10... | 2.59375 | 3 |
scripts/utils/prepare.py | Glaciohound/VCML | 52 | 18934 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : prepare.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 17.07.2019
# Last Modified Date: 03.12.2019
# Last Modified By : Chi Han
#
# This file is part of the VCML codebase
# Distri... | 2.078125 | 2 |
burst_paper/all_ds/plot_allband_ds.py | jackievilladsen/dynspec | 2 | 18935 | '''
plot_allband_ds.py - Load P,L,S band dynamic spectrum for a given epoch, bin to specified resolution, and plot to file
'''
import dynspec.plot
reload(dynspec.plot)
from dynspec import load_dict
from dynspec.plot import *
from pylab import *
import os, subprocess
import matplotlib.gridspec as gridspec
'''
def get... | 2.515625 | 3 |
src/utils.py | jungtaekkim/On-Uncertainty-Estimation-by-Tree-based-Surrogate-Models-in-SMO | 0 | 18936 | import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
def plot_1d(X_train, Y_train, X_test, Y_test, mean=None, std=None, str_figure=None, show_fig=True):
plt.rc('text', usetex=True)
fig = plt.figure(figsize=(8, 6))
ax = fig.gca()
ax.plot(X_test, Y_... | 2.421875 | 2 |
cocos-example.py | halflings/terrasim | 0 | 18937 |
import random
import cocos
from cocos.tiles import TileSet, RectCell, RectMapLayer
from cocos.director import director
from cocos.layer.scrolling import ScrollingManager
import pyglet
from game import Game
from views import WorldMap, CharacterView2
class MainLayer(cocos.layer.Layer):
is_event_handler = True
... | 2.46875 | 2 |
view.py | ykmoon04/2021-2-OSSP1-Smith-3 | 1 | 18938 | <reponame>ykmoon04/2021-2-OSSP1-Smith-3
from itertools import takewhile
from eunjeon import Mecab
import queue
from jamo import h2j, j2hcj
import numpy as np
import re
import json
import sys
from pkg_resources import VersionConflict
global script_table
global voice_table
global s_idx
global v_idx
script_table = []
vo... | 2.515625 | 3 |
rboard/board/__init__.py | joalon/rboard | 0 | 18939 | from flask import Blueprint
blueprint = Blueprint('board', __name__)
from rboard.board import routes
| 1.484375 | 1 |
examples/second_node.py | csunny/kademlia | 1 | 18940 | <reponame>csunny/kademlia
import logging
import asyncio
import sys
from kademlia.network import Server
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
log = logging.getLogger('kademlia')
log.addHandler(handler)
log... | 2.265625 | 2 |
src/commons/big_query/big_query_job_reference.py | Morgenz/bbq | 41 | 18941 | from src.commons.big_query.copy_job_async.result_check.result_check_request import \
ResultCheckRequest
from src.commons.big_query.copy_job_async.task_creator import TaskCreator
class BigQueryJobReference(object):
def __init__(self, project_id, job_id, location):
self.project_id = project_id
s... | 2.125 | 2 |
PyInstaller/hooks/hook-numpy.py | mathiascode/pyinstaller | 9,267 | 18942 | <reponame>mathiascode/pyinstaller
#!/usr/bin/env python3
# --- Copyright Disclaimer ---
#
# In order to support PyInstaller with numpy<1.20.0 this file will be duplicated for a short period inside
# PyInstaller's repository [1]. However this file is the intellectual property of the NumPy team and is
# under the terms ... | 1.554688 | 2 |
test_proj/blog/admin.py | Ivan-Feofanov/django-inline-actions | 204 | 18943 | from django.contrib import admin, messages
from django.shortcuts import render
from django.utils.translation import gettext_lazy as _
from inline_actions.actions import DefaultActionsMixin, ViewAction
from inline_actions.admin import InlineActionsMixin, InlineActionsModelAdminMixin
from . import forms
from .models im... | 1.945313 | 2 |
ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/macInMACv42_template.py | OpenIxia/ixnetwork_restpy | 20 | 18944 | <gh_stars>10-100
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class MacInMACv42(Base):
__slots__ = ()
_SDM_NAME = 'macInMACv42'
_SDM_ATT_MAP = {
'HeaderBDstAddress': 'macInMACv42.header.bDstAddress-1',
'HeaderBSrcAddress': 'macInMACv42.header.bSrcAddress-... | 1.789063 | 2 |
aries_cloudagent/commands/__init__.py | ldej/aries-cloudagent-python | 1 | 18945 | """Commands module common setup."""
from importlib import import_module
from typing import Sequence
def available_commands():
"""Index available commands."""
return [
{"name": "help", "summary": "Print available commands"},
{"name": "provision", "summary": "Provision an agent"},
{"nam... | 3.09375 | 3 |
AI/Lab 2/astar.py | abikoraj/CSIT | 9 | 18946 | gScore = 0 #use this to index g(n)
fScore = 1 #use this to index f(n)
previous = 2 #use this to index previous node
inf = 10000 #use this for value of infinity
#we represent the graph usind adjacent list
#as dictionary of dictionaries
G = {
'biratnagar' : {'itahari' : 22, 'biratchowk' : 30, 'rangeli': 2... | 3.4375 | 3 |
plio/io/io_controlnetwork.py | jlaura/plio | 11 | 18947 | <gh_stars>10-100
from enum import IntEnum
from time import gmtime, strftime
import warnings
import pandas as pd
import numpy as np
import pvl
import struct
from plio.io import ControlNetFileV0002_pb2 as cnf
from plio.io import ControlNetFileHeaderV0005_pb2 as cnh5
from plio.io import ControlPointFileEntryV0005_pb2 as... | 2.34375 | 2 |
resources.py | slowiklukasz/qgis-inventories | 0 | 18948 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x02\x05\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
... | 1.085938 | 1 |
pulsarpy_to_encodedcc/scripts/patch_r2_paired_with.py | yunhailuo/pulsarpy-to-encodedcc | 0 | 18949 | #!/usr/bin/env python
"""
Given one or more DCC experiment IDs, looks at all read2s that were submitted and updates each r2 file
object such that it's paired_with property points to the correct r1. This works by looking at the aliases
in the r2 file object to see if there is one with _R2_001 in it. If so, it sets pair... | 2.96875 | 3 |
ibsng/handler/bw/update_node.py | ParspooyeshFanavar/pyibsng | 6 | 18950 | <reponame>ParspooyeshFanavar/pyibsng
"""Update node API method."""
from ibsng.handler.handler import Handler
class updateNode(Handler):
"""Update node class."""
def control(self):
"""Validate inputs after setup method.
:return: None
:rtype: None
"""
self.is_valid(self... | 2.546875 | 3 |
make_mozilla/events/tests/test_paginators.py | Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c | 4 | 18951 | <filename>make_mozilla/events/tests/test_paginators.py<gh_stars>1-10
from django.utils import unittest
from nose.tools import eq_, ok_
from make_mozilla.events.paginators import results_page
sample_results = [1,2,3,4,5,6,7,8,9,0]
class TestResultsPage(unittest.TestCase):
def test_returns_page_1_if_page_unspecifi... | 2.34375 | 2 |
river/ensemble/test_streaming_random_patches.py | brcharron/creme | 1 | 18952 | import copy
import pytest
from river import utils
from river import ensemble
estimator = ensemble.SRPClassifier(
n_models=3, # Smaller ensemble than the default to avoid bottlenecks
seed=42)
@pytest.mark.parametrize('estimator, check', [
pytest.param(
estimator,
check,
id=f'{... | 2.140625 | 2 |
antlir/nspawn_in_subvol/plugin_hooks.py | lhl2617/antlir | 0 | 18953 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"The core logic of how plugins integrate with `popen_nspawn`"
import functools
import subprocess
from contextlib impor... | 2.171875 | 2 |
horseDB.py | maf-kakimoto/bet | 0 | 18954 | # -*- coding: utf-8 -*-
import time
import pandas as pd
# self-made
import manage_mysql
def horseDB(table,search):
con = manage_mysql.connect()
c = con.cursor()
column=[]
value=[]
for i in range(len(search)):
if i%2 == 0:
column.append(search[i])
else:
va... | 2.78125 | 3 |
maskrcnn_benchmark/data/datasets/__init__.py | lipengfeizju/Detection | 0 | 18955 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .coco import COCODataset
from .voc import PascalVOCDataset
from .concat_dataset import ConcatDataset
__all__ = ["COCODataset", "ConcatDataset", "PascalVOCDataset"]
# if isinstance(dataset, datasets.MyDataset):
# return coco_evaluation(**... | 1.757813 | 2 |
social/actions.py | raccoongang/python-social-auth | 1,987 | 18956 | from social_core.actions import do_auth, do_complete, do_disconnect
| 1.023438 | 1 |
src/alphazero/data.py | Whillikers/seldon | 1 | 18957 | """
Code for working with data.
In-memory format (as a list):
- board: Tensor (8, 8, 2) [bool; one-hot]
- move: Tensor (64,) [bool; one-hot]
- value: Tensor () [float32]
On-disk format (to save space and quicken loading):
- board: int64
- move: int64
- value: float32
"""
from typing import Dict, Tuple
import ... | 3.703125 | 4 |
Codechef Factorial.py | zoya-0509/Practice-codes | 0 | 18958 | t=int(input(""))
while (t>0):
n=int(input(""))
f=1
for i in range(1,n+1):
f=f*i
print(f)
t=t-1
| 3.578125 | 4 |
LC/263.py | szhu3210/LeetCode_Solutions | 2 | 18959 | class Solution(object):
def isUgly(self, num):
"""
:type num: int
:rtype: bool
"""
if num <= 0:
return False
for x in [2,3,5]:
while(num % x ==0):
num /= x
return num==1 | 3.65625 | 4 |
pkgcore/ebuild/errors.py | pombreda/pkgcore | 1 | 18960 | <gh_stars>1-10
# Copyright: 2005 <NAME> <<EMAIL>>
# License: GPL2/BSD
# "More than one statement on a single line"
# pylint: disable-msg=C0321
"""
atom exceptions
"""
__all__ = ("MalformedAtom", "InvalidVersion", "InvalidCPV", "ParseError")
from pkgcore.package import errors
class MalformedAtom(errors.InvalidDepe... | 2.46875 | 2 |
trainer/train_doc_ml.py | dainis-boumber/AA_CNN | 1 | 18961 | <reponame>dainis-boumber/AA_CNN
#! /usr/bin/env python
import datetime
import os
import time
import tensorflow as tf
from datahelpers import data_helper_ml_mulmol6_OnTheFly as dh
from evaluators import eval_pan_archy as evaler
from networks.cnn_ml_archy import TextCNN
def init_data(embed_dimension, do_dev_split=Fa... | 2.5625 | 3 |
releases/_version.py | Nicusor97/releases | 0 | 18962 | __version_info__ = (1, 6, 1)
__version__ = '.'.join(map(str, __version_info__))
| 1.484375 | 1 |
areaofrectangle.py | Ahmad-Aiman/Calculate-Area-of-Rectangle | 0 | 18963 | #Area of a rectangle = width x length
#Perimeter of a rectangle = 2 x [length + width#
width_input = float (input("\nPlease enter width: "))
length_input = float (input("Please enter length: "))
areaofRectangle = width_input * length_input
perimeterofRectangle = 2 * (width_input * length_input)
print ("\n... | 4.09375 | 4 |
python/src/main/python/pygw/store/rocksdb/options.py | Maxar-Corp/sh-geowave | 0 | 18964 | <gh_stars>0
#
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Vers... | 2.125 | 2 |
server/miscellaneous.py | dewancse/SMT-PMR | 0 | 18965 | <reponame>dewancse/SMT-PMR<filename>server/miscellaneous.py
import requests
from libcellml import *
import lxml.etree as ET
# pre-generated model recipe in JSON format
model_recipe = [
{
"med_fma": "http://purl.obolibrary.org/obo/FMA_84666",
"med_pr": "http://purl.obolibrary.org/obo/PR_P26433",
... | 1.945313 | 2 |
epg_grabber/sites/beinsports_id.py | akmalharith/epg-grabber | 1 | 18966 | from typing import List
import requests
from pathlib import Path
from datetime import date, datetime
from bs4 import BeautifulSoup
from helper.classes import Channel, Program
from helper.utils import get_channel_by_name, get_epg_datetime
TIMEZONE_OFFSET = "+0800"
PROGRAM_URL = "https://epg.beinsports.com/utctime_id.ph... | 2.875 | 3 |
C19/19-1_Blog/blogs/views.py | Triple-Z/Python-Crash-Course | 0 | 18967 | <gh_stars>0
from django.shortcuts import render
from .models import BlogPost
from django.http import HttpResponseRedirect, Http404
from django.urls import reverse
from .forms import BlogForm
from django.contrib.auth.decorators import login_required
from .auth import check_blog_author
def index(request):
blogs = B... | 2.1875 | 2 |
SmartAPI/__init__.py | Kreastr/SmartAPI-HEILA | 0 | 18968 | <reponame>Kreastr/SmartAPI-HEILA
import sys
import site
import os
| 0.949219 | 1 |
compiler/dna/components/DNASuitEdge.py | AnonymousDeveloper65535/libpandadna | 36 | 18969 | <gh_stars>10-100
class DNASuitEdge:
COMPONENT_CODE = 22
def __init__(self, startPoint, endPoint, zoneId):
self.startPoint = startPoint
self.endPoint = endPoint
self.zoneId = zoneId
def setStartPoint(self, startPoint):
self.startPoint = startPoint
def setEndPoint(self, ... | 2.171875 | 2 |
cpplint_junit.py | johnthagen/cpplint-junit | 5 | 18970 | #! /usr/bin/env python3
"""Converts cpplint output to JUnit XML format."""
import argparse
import collections
import os
import re
import sys
from typing import Dict, List
from xml.etree import ElementTree
from exitstatus import ExitStatus
class CpplintError(object):
def __init__(self, file: str, line: int, mes... | 3.171875 | 3 |
opennmt/tests/text_test.py | gcervantes8/OpenNMT-tf | 1,363 | 18971 | <reponame>gcervantes8/OpenNMT-tf<gh_stars>1000+
import tensorflow as tf
from parameterized import parameterized
from opennmt.data import text
class TextTest(tf.test.TestCase):
def _testTokensToChars(self, tokens, expected_chars):
expected_chars = tf.nest.map_structure(tf.compat.as_bytes, expected_chars)... | 2.34375 | 2 |
test/test_px_proxy.py | wizzard/perimeterx-python-3-wsgi | 1 | 18972 | import unittest
import requests_mock
from werkzeug.test import EnvironBuilder
from werkzeug.wrappers import Request
from perimeterx import px_constants
from perimeterx.px_config import PxConfig
from perimeterx.px_context import PxContext
from perimeterx.px_proxy import PxProxy
class Test_PXProxy(unittest.TestCase):... | 2.453125 | 2 |
PI/Events/Event.py | HotShot0901/PI | 0 | 18973 | <reponame>HotShot0901/PI
# This just shifts 1 to i th BIT
def BIT(i: int) -> int:
return int(1 << i)
# This class is equvalent to a C++ enum
class EventType:
Null, \
WindowClose, WindowResize, WindowFocus, WindowMoved, \
... | 2.828125 | 3 |
users.py | VinasRibeiro/DownStoriesInsta | 0 | 18974 | <filename>users.py
class Users:
usernamep = 'your_user_email'
passwordp = '<PASSWORD>'
linkp = 'https://www.instagram.com/stories/cznburak/'
| 1.539063 | 2 |
src/minerl/data/data_pipeline.py | imatge-upc/pixelcoordEDL | 1 | 18975 | import collections
import functools
import json
import logging
import multiprocessing
import os
import time
from collections import OrderedDict
from queue import PriorityQueue, Empty
from typing import List, Tuple, Any
from itertools import cycle, islice
import minerl.herobraine.env_spec
from minerl.herobraine.hero imp... | 2.25 | 2 |
composer/trainer/devices/device_cpu.py | IanWorley/composer | 0 | 18976 | # Copyright 2021 MosaicML. All Rights Reserved.
"""The CPU device used for training."""
from __future__ import annotations
import logging
from contextlib import contextmanager
from typing import Any, Dict, Generator, TypeVar, Union
import torch
from composer.core import Precision
from composer.trainer.devices.devi... | 2.234375 | 2 |
experiments/generate-pdf/process_hypercluster_data.py | parasailteam/coconet | 5 | 18977 | import os
import re
import json
import ast
import csv
import sys
import shutil
# ["allreduce-lambf16", "reducescatter-lamb-allgatherf16", "test-lambf16"] + \
# ["allreduce-adamf16", "reducescatter-adam-allgatherf16", "test-adamf16"] +\
all_binaries = ["adam-ar-c", "adam-rs-c-ag", "adam-fuse-rs-c-ag"] + \
["lamb-... | 1.984375 | 2 |
examples/pytorch/tgn/tgn.py | ketyi/dgl | 9,516 | 18978 | <gh_stars>1000+
import copy
import torch.nn as nn
import dgl
from modules import MemoryModule, MemoryOperation, MsgLinkPredictor, TemporalTransformerConv, TimeEncode
class TGN(nn.Module):
def __init__(self,
edge_feat_dim,
memory_dim,
temporal_dim,
... | 2.03125 | 2 |
pyinq/printers/__init__.py | Auzzy/pyinq | 0 | 18979 | """
Copyright (c) 2012-2013, <NAME> (<EMAIL>)
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL ... | 2.25 | 2 |
cassiopeia-diskstore/cassiopeia_diskstore/championgg.py | mrtolkien/cassiopeia-datastores | 3 | 18980 | from typing import Type, TypeVar, MutableMapping, Any, Iterable
from datapipelines import DataSource, DataSink, PipelineContext, Query, validate_query
from cassiopeia_championgg.dto import ChampionGGStatsListDto, ChampionGGStatsDto
from cassiopeia.datastores.uniquekeys import convert_region_to_platform
from .common i... | 2.015625 | 2 |
src/cogs/fun-commands.py | ShubhamPatilsd/johnpeter-discord | 1 | 18981 | <filename>src/cogs/fun-commands.py
import asyncio
import json
import os
import random
import re
import urllib
import urllib.request
from glob import glob
from os import getenv
from random import choice
import discord
from discord.ext import commands
from utils.cms import get_sponsor_intro, get_sponsor_audio
from util... | 2.328125 | 2 |
aluraflix/tests/test_serializer.py | bonetou/django-rest-tests-documentation | 0 | 18982 | <reponame>bonetou/django-rest-tests-documentation<filename>aluraflix/tests/test_serializer.py
from django.test import TestCase
from aluraflix.models import Programa
from aluraflix.serializers import ProgramaSerializer
class ProgramaSerializerTestCase(TestCase):
def setUp(self):
self.programa = Programa(
... | 2.6875 | 3 |
3_team/tests/unittest_sample_ng/sample.py | pyfirst/pymook-samplecode | 31 | 18983 | def add(m, n):
"""mとnを加算して返す"""
return m - n
| 2.75 | 3 |
src/pyseed/commands/gen.py | okosioc/pyseed | 0 | 18984 | <reponame>okosioc/pyseed
# -*- coding: utf-8 -*-
"""
gen
~~~~~~~~~~~~~~
Command gen.
:copyright: (c) 2021 by weiminfeng.
:date: 2021/9/1
"""
import argparse
import importlib.util
import json
import logging
import os
import re
import shutil
import sys
from typing import List
import inflection
fro... | 2.328125 | 2 |
logger/hum_test3.py | scsibug/Raspberry-Pi-Sensor-Node | 1 | 18985 | # this example came from http://www.raspberrypi.org/phpBB3/viewtopic.php?f=32&t=29454&sid=4543fbd8f48478644e608d741309c12b&start=25
import smbus
import time
b = smbus.SMBus(1)
d = []
addr = 0x27
b.write_quick(addr)
time.sleep(0.05)
d = b.read_i2c_block_data(addr, 0,4)
status = (d[0] & 0xc0) >> 6
humidity = (((d[0] & 0x... | 2.84375 | 3 |
vendor/python-pika/tests/frame_tests.py | suthat/signal | 1 | 18986 | """
Tests for pika.frame
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from pika import exceptions
from pika import frame
from pika import spec
class FrameTests(unittest.TestCase):
BASIC_ACK = ('\x01\x00\x01\x00\x00\x00\r\x00<\x00P\x00\x00\x00\x00\x00\x00'
'... | 2.8125 | 3 |
apps/users/views.py | RympeR/HypeFans | 0 | 18987 | import logging
from datetime import datetime, timedelta
import requests
from core.utils.customClasses import UserFilter
from core.utils.default_responses import (api_accepted_202,
api_bad_request_400,
api_block_by_policy_451,
... | 1.921875 | 2 |
powerline/commands/main.py | OSunday/powerline | 15 | 18988 | <gh_stars>10-100
# vim:fileencoding=utf-8:noet
# WARNING: using unicode_literals causes errors in argparse
from __future__ import (division, absolute_import, print_function)
import argparse
import sys
from itertools import chain
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.d... | 1.796875 | 2 |
hunter/mlops/experiments/experiment.py | akamlani/hunter-core | 0 | 18989 | <reponame>akamlani/hunter-core
import numpy as np
import os
import time
import shutil
import logging
logger = logging.getLogger(__name__)
class Experiment(object):
"""Create experiment directory structure, track, and store data.
To be used as a base class or derived `Experiment` classes.
"""
... | 2.3125 | 2 |
blousebrothers/confs/migrations/0044_subscriptions_bonus.py | sladinji/blousebrothers | 1 | 18990 | <reponame>sladinji/blousebrothers<gh_stars>1-10
from django.db import migrations
from decimal import Decimal
from dateutil.relativedelta import relativedelta
from datetime import date
def fix_subscription(apps, schema_editor):
Subscription = apps.get_model('confs', 'Subscription')
SubscriptionType = apps.get... | 2 | 2 |
NLP-Model/GraphGenerator.py | AdityaPrasadMishra/NLP--Project-Group-16 | 0 | 18991 | <reponame>AdityaPrasadMishra/NLP--Project-Group-16
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 24 22:03:42 2018
@author: aditya
"""
import codecs
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import re
import time
import random
training_errors= [2.880890389084816... | 1.828125 | 2 |
nc/tests/test_views.py | OpenDataPolicingNC/Traffic-Stops | 25 | 18992 | <gh_stars>10-100
from django.core.urlresolvers import reverse
from django.test import TestCase
from nc.tests import factories
class ViewTests(TestCase):
multi_db = True
def test_home(self):
response = self.client.get(reverse('nc:home'))
self.assertEqual(200, response.status_code)
def tes... | 2.40625 | 2 |
hitbloq_bot.py | PulseLane/hitbloq | 0 | 18993 | <gh_stars>0
import asyncio
import json
import time
import sys
import discord
from discord.utils import get
import create_action
from db import database
import beatsaver
from cr_formulas import curves
from general import full_clean
beatsaver_interface = beatsaver.BeatSaverInterface()
def read_f(path):
f = open(p... | 2.265625 | 2 |
GUI/preprocessing.py | muhammadtarek98/Graduation-project | 0 | 18994 | <reponame>muhammadtarek98/Graduation-project
import numpy as np
import cv2 as cv
import os
from PIL import Image
class preprocessing:
def __init__(self, axial_path, coronal_path, sagittal_path):
axial_path = axial_path[1:-1]
coronal_path = coronal_path[1:-1]
sagittal_path = sagittal_path[1:-... | 3.1875 | 3 |
examples/generate_og_predictions.py | dennlinger/sentence-transformers | 5 | 18995 | """
The system RoBERTa trains on the AGB dataset with softmax loss function.
At every 1000 training steps, the model is evaluated on the AGB dev set.
"""
from torch.utils.data import DataLoader
from sentence_transformers import models, losses
from sentence_transformers import SentencesDataset, LoggingHandler, Sentence... | 2.5 | 2 |
config/settings/defaults.py | lucaluca/palimpsest | 0 | 18996 | <filename>config/settings/defaults.py
"""
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (palimpsest/config/settings/base.py - 3 = palimpsest/)
APPS_DIR = ROOT_DIR.path('palimpsest')
env = environ.Env()
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_... | 2.109375 | 2 |
cognipy/edit.py | jswiatkowski/cognipy | 34 | 18997 | import ipywidgets as widgets
from traitlets import Unicode, Int, validate
import os
import json
from datetime import datetime,timedelta
from IPython.display import Javascript
from IPython.display import HTML
from cognipy.ontology import Ontology
from IPython.display import clear_output
_JS_initialized = False
def _In... | 2.296875 | 2 |
params_tuning/ls_iter_n/out_comparator.py | bleakTwig/ophs_grasp | 3 | 18998 | INSTANCES = 405
ITERS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 50, 100]
N_ITERS = len(ITERS)
# === RESULTS GATHERING ====================================================== #
# results_m is a [INSTANCES][N_ITERS] matrix to store every test result
results_m = [[0 for x in range(... | 2.859375 | 3 |
glim_extensions/jslint/jslint.py | aacanakin/glim-extensions | 2 | 18999 | import subprocess
import os
from glim.core import Facade
from glim import Log
from glim import paths
DEFAULT_CONFIG = {
'source': os.path.join(paths.APP_PATH, 'assets/js'),
}
class JSLint(object):
def __init__(self, config):
self.config = DEFAULT_CONFIG
for key, value in config.items():
self.config[key] = ... | 2.171875 | 2 |