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 |
|---|---|---|---|---|---|---|
torchlm/tools/_faceboxesv2.py | DefTruth/landmarksaug | 56 | 12779451 | <gh_stars>10-100
import os
import cv2
import torch
import numpy as np
import torch.nn as nn
from math import ceil
from pathlib import Path
from torch import Tensor
import torch.nn.functional as F
from itertools import product as product
from typing import Tuple, Union, List, Optional
from ..core import FaceDetBase
__... | 2.265625 | 2 |
tests/wrappers.py | blacksph3re/garage | 1,500 | 12779452 | """Test environment wrapper."""
import gym
class AutoStopEnv(gym.Wrapper):
"""Environment wrapper that stops episode at step max_episode_length."""
def __init__(self, env=None, env_name='', max_episode_length=100):
"""Create an AutoStepEnv.
Args:
env (gym.Env): Environment to be... | 3.125 | 3 |
setup.py | jgorset/django-respite | 2 | 12779453 | <reponame>jgorset/django-respite
from setuptools import setup
execfile('respite/version.py')
setup(
name = 'django-respite',
version = __version__,
description = "Respite conforms Django to Representational State Transfer (REST)",
long_description = open('README.rst').read(),
author = "<NAME>",
... | 1.296875 | 1 |
deciphon/output.py | EBI-Metagenomics/deciphon-py | 0 | 12779454 | <filename>deciphon/output.py
from __future__ import annotations
from typing import Type
from ._cdata import CData
from ._ffi import ffi, lib
from .dcp_profile import DCPProfile
__all__ = ["Output"]
class Output:
def __init__(self, dcp_output: CData):
self._dcp_output = dcp_output
if self._dcp_o... | 2.296875 | 2 |
nltk_vader.py | kritika58/A-Novel-Framework-Using-Neutrosophy-for-Integrated-Speech-and-Text-Sentiment-Analysis | 0 | 12779455 | from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from string import digits
import csv
# Create a SentimentIntensityAnalyzer object
file1 = open("DATASET\\LibriSpeech\\dev-clean\\84\\121123\\84-121123.trans.txt", 'r')
Lines = file1.readlines()
with open('vader_84_121123.csv', 'w', newline='') as ... | 3.125 | 3 |
oops_fhir/r4/value_set/list_mode.py | Mikuana/oops_fhir | 0 | 12779456 | from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.list_mode import ListMode as ListMode_
__all__ = ["ListMode"]
_resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json"))
class ListMode(ListMode_):
... | 1.90625 | 2 |
patterns/identify/management/commands/make_authorities.py | tomaszn/wq.db | 86 | 12779457 | from django.core.management.base import BaseCommand
from wq.db.patterns.identify.models import Authority
class Command(BaseCommand):
def handle(self, *args, **options):
Authority.objects.get_or_create(
name="This Site",
)
Authority.objects.get_or_create(
name="Wikip... | 2.140625 | 2 |
python/507.PerfectNumber.py | Wanger-SJTU/leetcode-solutions | 2 | 12779458 | import math
class Solution:
def checkPerfectNumber(self, num: int) -> bool:
res = 0
high = int(math.sqrt(num))
for i in range(high, 0,-1):
if num%i==0:
res+=i
res+= num//i if i != 1 else 0
res = res - high if high*high == num else res
... | 3.390625 | 3 |
polymer/filters.py | dwd/Polymer | 4 | 12779459 | #
# Copyright 2004,2005 <NAME> <<EMAIL>>
#
# This file forms part of Infotrope Polymer
#
# Infotrope Polymer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your optio... | 2.0625 | 2 |
tests/utils_test.py | yuxiaoguo/VVNet | 14 | 12779460 | <reponame>yuxiaoguo/VVNet
# import os
# import sys
#
# import tensorflow as tf
# import numpy as np
#
# from scripts import dataset
#
# VIS_OUT_DIR = os.path.join('/home', 'ig', 'Shared', 'yuxgu', 'visual')
# # TEST_DATA_ROOT = os.path.abspath(os.path.dirname(__file__))
# TEST_DATA_ROOT = os.path.join(os.environ['HOME'... | 2.140625 | 2 |
Dictionaries/word_synonyms.py | petel3/Softuni_education | 2 | 12779461 | <filename>Dictionaries/word_synonyms.py
n=int(input())
synonyms={}
for _ in range(n):
words=input()
synonym=input()
if words not in synonyms.keys():
synonyms[words]= []
synonyms[words].append(synonym)
for key,value in synonyms.items():
print(f'{key} - {", ".join(value)}') | 3.9375 | 4 |
website/registration/migrations/0011_auto_20200803_0137.py | CodeJosh723/thesis-review-system | 1 | 12779462 | <filename>website/registration/migrations/0011_auto_20200803_0137.py<gh_stars>1-10
# Generated by Django 3.0.7 on 2020-08-02 19:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('registration', '0010_auto_20200731_1428'),
]
operations = [
migra... | 1.398438 | 1 |
IncrementalKS/Pure Python/Treap.py | denismr/incremental-ks | 15 | 12779463 | from random import random
class Treap:
def __init__(self, key, value = 0):
self.key = key
self.value = value
self.priority = random()
self.size = 1
self.height = 1
self.lazy = 0
self.max_value = value
self.min_value = value
self.left = None
self.right = None
... | 3.09375 | 3 |
client/client.py | DrunyaGames/SeaBattle-Plus-Plus | 0 | 12779464 | from threading import Thread
import socket
import time
import json
offline = False
class Client(Thread):
address = ('localhost', 8957)
buffer_size = 8000
delimiter = b'\r\n'
def __init__(self):
super().__init__()
self.sock = None
self.make_socket()
self.handlers = ... | 2.9375 | 3 |
engine/engine.py | infostreams/webindex | 1 | 12779465 | import string
import pprint
import types
import sys
import os
# strangely enough, the following code is necessary to find modules in the parent-directory
# (despite what is said in http://www.python.org/doc/current/tut/node8.html)
# it adds the parent directory to the sys.path variable that determines w... | 2.71875 | 3 |
src/main.py | iwangjian/TG-ClariQ | 2 | 12779466 | <reponame>iwangjian/TG-ClariQ
# -*- coding: utf-8 -*-
import logging
import os
import sys
import torch
import random
import json
import argparse
import numpy as np
import pandas as pd
from torch.utils.data import DataLoader
from transformers import BertTokenizer
from field import TextField
from dataset import QueryData... | 2.15625 | 2 |
2021.4/run_command.py | henry1758f/Intel-Sales-Kit | 1 | 12779467 | <gh_stars>1-10
import subprocess
import re
#cmd = 'python3 /opt/intel/openvino/deployment_tools/tools/benchmark_tool/benchmark_app.py -m /mnt/openvino_models/public/yolo-v3-tf/FP16-INT8/yolo-v3-tf.xml -d CPU -api async -t 1'
fp = open('benchmark_models_cmds.txt', "r")
for cmd in iter(fp):
print("cmd:{}".format(c... | 1.984375 | 2 |
task2.py | romi-lab/Control_System_of_Multitask_Orientated_Miniature_Robot_Agents | 2 | 12779468 | import json
import numpy as np
import cv2
from numpy.core.records import array
import cv2.aruco as aruco
import socket
from urllib.request import urlopen
from get_img import get_img as gi
ADDRESS = ('', 10000)
central = None
conn_pool = []
central = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
central.setsockopt... | 2.484375 | 2 |
spock/backend/spaces.py | fidelity/spock | 58 | 12779469 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright FMR LLC <<EMAIL>>
# SPDX-License-Identifier: Apache-2.0
"""Handles classes/named tuples for holding class, field, and attribute value(s)"""
from collections import namedtuple
from typing import Type
from attr import Attribute
class ConfigSpace:
"""Class tha... | 3.296875 | 3 |
combinatorics.py | jrinconada/examen-tipo-test | 0 | 12779470 | <reponame>jrinconada/examen-tipo-test
from math import factorial
possibilities = 0
rightAnswers = [0]
answers = 4
questions = 1
# Initializes all the variables
def init(q, a):
global showPossibilites
global rightAnswers
global answers
global questions
questions = q
answers = len(a)
rightAn... | 3.5625 | 4 |
kmip/tests/integration/conftest.py | ondrap/PyKMIP | 179 | 12779471 | <reponame>ondrap/PyKMIP<filename>kmip/tests/integration/conftest.py<gh_stars>100-1000
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.... | 1.992188 | 2 |
read_mnist/check.py | your-diary/Playing-with-MNIST | 0 | 12779472 | import numpy as np
import sys
sys.path.append("./original_data");
from dataset.mnist import load_mnist
from PIL import Image
import pickle
#This line loads training images, training labels (in or not in one-hot representation), testing images and testing labels (in or not in one-hot representation).
(x_train, t_tra... | 3.265625 | 3 |
meiduo_mall/apps/meiduo_admin/views/user.py | kura-Lee/meiduo-mall | 1 | 12779473 | <filename>meiduo_mall/apps/meiduo_admin/views/user.py
"""
用户管理视图
"""
from rest_framework.generics import ListAPIView, ListCreateAPIView
from apps.meiduo_admin.serializers.user import UserSerializer
from apps.meiduo_admin.utils import PageNum
from apps.users.models import User
class UserAPIView(ListCreateAPIView):
... | 2.3125 | 2 |
core/modules/dataloaders/__init__.py | FelixFu520/DAO | 0 | 12779474 | # -*- coding: utf-8 -*-
# @Author:FelixFu
# @Date: 2021.4.14
# @GitHub:https://github.com/felixfu520
# @Copy From:
# dataset
from .datasets import MVTecDataset, ClsDataset, DetDataset, SegDataset
# classification
from .ClsDataloader import ClsDataloaderTrain, ClsDataloaderEval
# anomaly
from .AnomalyDataloader impor... | 1.320313 | 1 |
iThenticate/API/Treasure/documents.py | JorrandeWit/ithenticate-api-python | 3 | 12779475 | import base64
from ..Helpers import get_xml_as_string
from ..Object import Data
class Document(object):
def __init__(self, client):
self.client = client
def add(self, file_path, folder_id, author_first_name, author_last_name, title):
"""
Submit a new document to your iThenticate acco... | 2.78125 | 3 |
project/hijri_calendar_project/hijri_calendar_app/management/commands/get_hijri_json_from_csv.py | bilgrami/hijri-calendar | 1 | 12779476 | import csv
import json
import os
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
"""
pre-requisite:
sql:
drop table hijri_calendar_data_file CASCADE;
drop table hijri_calendar CASCADE;
drop table holiday CASCADE;
or
tru... | 2.34375 | 2 |
test/score_media.py | welcotravel/image-quality-assessment | 1 | 12779477 | import sys
import shutil
import os
import time
from image_quality.handlers.model_builder import Nima
from image_quality.evaluater.predict import fetch_model,score_media
fetch_model() # ensure model weights are local in image quality path
image_quality_path = '/tmp/image_quality/'
image_ranking_model_name ... | 2.125 | 2 |
src/tools/qca_net.py | Timokleia/QCANet | 26 | 12779478 | <filename>src/tools/qca_net.py
# -*- coding: utf-8 -*-
import chainer
from chainer import cuda, serializers
import csv
import sys
import time
import random
import copy
import math
import os
import numpy as np
import configparser
from argparse import ArgumentParser
from os import path as pt
import skimage.io as io
fro... | 1.914063 | 2 |
src/fhir_types/FHIR_Immunization.py | anthem-ai/fhir-types | 2 | 12779479 | <filename>src/fhir_types/FHIR_Immunization.py
from typing import Any, List, Literal, TypedDict
from .FHIR_Annotation import FHIR_Annotation
from .FHIR_boolean import FHIR_boolean
from .FHIR_code import FHIR_code
from .FHIR_CodeableConcept import FHIR_CodeableConcept
from .FHIR_date import FHIR_date
from .FHIR_dateTime... | 1.617188 | 2 |
src/losses.py | codestar12/pruning-distilation-bias | 1 | 12779480 | import torch
from torch.nn import Module
from geomloss import SamplesLoss
class SinkhornLoss(Module):
def __init__(self, blur=0.3, scaling=.8):
super(SinkhornLoss, self).__init__()
self.loss = SamplesLoss("sinkhorn", blur=blur, scaling=scaling)
def forward(self, *args):
x... | 2.75 | 3 |
exp/aeceou/ACL2022/modules/__init__.py | aeceou/OpenNMT-py-Exp | 1 | 12779481 | <filename>exp/aeceou/ACL2022/modules/__init__.py
""" Attention and normalization modules """
from exp.aeceou.ACL2022.modules.feldermodell import Feldermodell
from exp.aeceou.ACL2022.modules.embeddings import FlexibleEmbeddings
__all__ = ["Feldermodell", "FlexibleEmbeddings"]
| 1.039063 | 1 |
api/post.py | covid19database/grid_pg | 1 | 12779482 | import requests
example = {
"userid": 1,
"timestamp": "2020-04-04T12:17:00",
"feels_sick": False,
"location_trace": [
{
"start_time": "2020-04-03T00:00:00",
"end_time": "2020-04-03T04:00:00",
"geographic_location": {
"lat": 37.8123177,
... | 2.375 | 2 |
apps/notifier/notification_manager.py | caiosweet/notifier | 5 | 12779483 | import hassapi as hass
import datetime
import re
"""
Class Notification_Manager handles sending text to notfyng service
"""
__NOTIFY__ = "notify/"
SUB_NOTIFICHE = [(" +", " "), ("\s\s+", "\n")]
class Notification_Manager(hass.Hass):
def initialize(self):
self.text_last_message = self.args["tex... | 2.71875 | 3 |
03.list_names.py | arunkumarang/python | 0 | 12779484 |
names = ['Senthil', 'Natesh', 'Ashok', 'Rajasekar']
print(names[0])
print(names[1])
print(names[2])
print(names[3])
| 2.921875 | 3 |
libtrellis/examples/graph.py | Keno/prjtrellis | 256 | 12779485 | #!/usr/bin/env python3
"""
Testing the routing graph generator
"""
import pytrellis
import sys
pytrellis.load_database("../../database")
chip = pytrellis.Chip("LFE5U-45F")
rg = chip.get_routing_graph()
tile = rg.tiles[pytrellis.Location(9, 71)]
for wire in tile.wires:
print("Wire {}:".format(rg.to_str(wire.key()))... | 2.765625 | 3 |
test/unittests/test_Percolation.py | rajadain/gwlf-e | 0 | 12779486 | import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.Input.WaterBudget import Percolation
class TestPercolation(VariableUnitTest):
def test_Percolation_ground_truth(self):
z = self.z
np.testing.assert_array_almost_equal(
np.load(self.basepath + "/Percolation.n... | 2.703125 | 3 |
back-end/www/migrations/versions/cbbf822c6b4f_add_user_client_type.py | TUD-KInD/COCTEAU | 0 | 12779487 | """add user client type
Revision ID: cbbf822c6b4f
Revises: <KEY>
Create Date: 2021-06-21 18:23:43.202954
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cbbf822c6b4f'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### com... | 1.375 | 1 |
src/ttkbootstrap/dialogs/__init__.py | dmalves/ttkbootstrap | 2 | 12779488 | <filename>src/ttkbootstrap/dialogs/__init__.py
from ttkbootstrap.dialogs.dialogs import * | 1.210938 | 1 |
pyaztec/core.py | DGX2000/PyAztec | 0 | 12779489 | def decode():
# Step 1: detect symbol => crop+size
# Step 2: crop+size => np.array
# Step 3: np.array+Size => bitstring
# Step 4: bitstring => original text
return False
| 2.65625 | 3 |
molfunc/__init__.py | t-young31/molfunc | 24 | 12779490 | <reponame>t-young31/molfunc<gh_stars>10-100
from molfunc.molecules import print_combined_molecule
from molfunc.fragments import names as fragment_names
__all__ = ['print_combined_molecule',
'fragment_names']
| 1.328125 | 1 |
tests/relic_test.py | rloganiv/meercat-aux | 1 | 12779491 | <gh_stars>1-10
import transformers
import torch
from meercat.models import RelicModel, RelicConfig
tokenizer = transformers.AutoTokenizer.from_pretrained('bert-base-cased')
config = RelicConfig(vocab_size=28996)
model = RelicModel.from_pretrained('bert-base-cased', config=config)
model_inputs = tokenizer(
['I a... | 2.296875 | 2 |
pytest/broadcast.py | akkaze/rdc | 52 | 12779492 | #!/usr/bin/env
"""
demo python script of broadcast
"""
from __future__ import print_function
import os
rdc.init()
n = 3
rank = rdc.get_rank()
s = None
if rank == 0:
s = {'hello world':100, 2:3}
print('@node[%d] before-broadcast: s=\"%s\"' % (rank, str(s)))
s = rdc.broadcast(s, 0)
print('@node[%d] after-broadcast:... | 2.609375 | 3 |
src/app/graph/console/schema.py | green2cerberuz/db_vgames | 0 | 12779493 | import graphene
from app.schemas.console import ConsoleOutput
from .mutations import CreateConsole, DeleteConsole, UpdateConsole
from .resolvers import resolve_console
class ConsoleQuery(graphene.ObjectType):
"""Queries to get all console information."""
# consoles = graphene.List(graphene.relay.Node.Field... | 2.421875 | 2 |
Day Pogress - 18~100/Day 17/Quiz App/quiz.py | Abbhiishek/Python | 1 | 12779494 | class Quiz:
def __init__(self):
"""
this is a Quiz constructor
"""
def ask_question(self, questions, score):
# store a question item and one answer
# ask from the list
question = questions[score]["text"]
answer = questions[score]["answer"]
prin... | 3.9375 | 4 |
utils/smallmodel_functions.py | SilverEngineered/Quilt | 0 | 12779495 | <filename>utils/smallmodel_functions.py
from scipy.stats import mode
import warnings
import pennylane as qml
from pennylane import numpy as np
from pennylane.templates import AmplitudeEmbedding
import numpy
import operator
import os
warnings.filterwarnings('ignore')
warnings.filterwarnings('ignore')
def performance(... | 2.25 | 2 |
regolith/helper_gui_main.py | MichaelTrumbull/regolith | 7 | 12779496 | <reponame>MichaelTrumbull/regolith
"""The main CLI for regolith"""
from __future__ import print_function
import copy
import os
from regolith.database import connect
from regolith import commands
from regolith import storage
from regolith.helper import HELPERS
from regolith.runcontrol import DEFAULT_RC, load_rcfile, ... | 2.078125 | 2 |
k8s/tests/test_k8sclient_deploy.py | onap/dcaegen2-platform-plugins | 1 | 12779497 | <reponame>onap/dcaegen2-platform-plugins
# ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
# Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
# Copyright (c) 2020-2... | 1.390625 | 1 |
inheritance/lab/random_list.py | ivan-yosifov88/python_oop | 1 | 12779498 | from random import choice
class RandomList(list):
def get_random_element(self):
element = choice(self)
self.remove(element)
return element
# previous course and doesn't work
# def get_random_element(self):
# element_index = randint(0, len(self) - 1)
# element = se... | 3.578125 | 4 |
lifeAssistant/enums.py | tenqaz/lifeAssistant | 0 | 12779499 | <filename>lifeAssistant/enums.py
"""
@author: Jim
@project: lifeAssistant
@file: enums.py
@time: 2020/1/14 11:56
@desc:
枚举
"""
from enum import IntEnum, unique
@unique
class ArticleTypeEnum(IntEnum):
"""
文章的存储方式.
"""
SpiderKind = 0 # 爬虫存储
ManualKind = 1 # 手动存储
| 1.726563 | 2 |
src/probnum/linalg/linearsolvers/solutionbased.py | ralfrost/probnum | 0 | 12779500 | """
Solution-based probabilistic linear solvers.
Implementations of solution-based linear solvers which perform inference on the solution
of a linear system given linear observations.
"""
import warnings
import numpy as np
from probnum.linalg.linearsolvers.matrixbased import ProbabilisticLinearSolver
class Solutio... | 2.890625 | 3 |
settings.py | Enzodtz/snake-AI | 1 | 12779501 | #[Neural Network]
neural_network = {
'size': [24, 16, 3],
'activation function': 'sigmoid'
}
#[Snake Game]
snake_game = {
'steps to apple limit': 100,
'game size y': 10,
'game size x': 10
}
#[Population]
population = {
'population size': 1000
}
#[Genetic A... | 1.96875 | 2 |
gmn/src/d1_gmn/tests/test_revision_create_and_get.py | DataONEorg/d1_python | 15 | 12779502 | #!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | 2.046875 | 2 |
depth2mesh/config.py | taconite/MetaAvatar-release | 60 | 12779503 | import yaml
from yaml import Loader
from depth2mesh import data
from depth2mesh import metaavatar
method_dict = {
'metaavatar': metaavatar,
}
# General config
def load_config(path, default_path=None):
''' Loads config file.
Args:
path (str): path to config file
default_path (bool): wheth... | 2.421875 | 2 |
tests/loss/test_loss_orthogonal.py | lparolari/weakvtg | 0 | 12779504 | import torch
from weakvtg.loss import loss_orthogonal
def test_loss_orthogonal():
X = torch.tensor([1, -1, 1, -1, 0, 0, .236, -.751], dtype=torch.float),
y = torch.tensor([1, -1, -1, 1, -1, 1, -1, 1], dtype=torch.float)
assert torch.equal(
loss_orthogonal(X, y),
-1 * torch.tenso... | 2.609375 | 3 |
collaborative/settings.py | themarshallproject/django-collaborative | 88 | 12779505 | """
Django settings for collaborative project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os... | 1.867188 | 2 |
data/kinectics-400/split.py | ldf921/video-representation | 1 | 12779506 | <reponame>ldf921/video-representation
import argparse
import re
import os
import json
import numpy as np
import pickle as pkl
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--subset', type=lambda t : t.split(','), default=['train', 'valid'])
args = parser.parse_args()
... | 2.484375 | 2 |
python/ql/test/query-tests/Summary/my_file.py | timoles/codeql | 4,036 | 12779507 | """
module level docstring
is not included
"""
# this line is not code
# `tty` was chosen for stability over python versions (so we don't get diffrent results
# on different computers, that has different versions of Python).
#
# According to https://github.com/python/cpython/tree/master/Lib (at 2021-04-23) `tty`
# wa... | 2.390625 | 2 |
parser/parser.py | emhacker/decision_tree_visualizer | 0 | 12779508 | from lexer import lex
import lexer
IF_RULE = 1
ELSE_RULE = 2
PREDICT_RULE = 3
class Rule:
def __init__(self, rule_id, tokens):
self.id = rule_id
self.tokens = tokens
self.childes = list()
def __str__(self):
return ' '.join(map(lambda x: x.value, self.tokens))
def parse(toke... | 2.96875 | 3 |
apps/accounts/forms.py | pinkerltm/datacube-ui | 1 | 12779509 | <gh_stars>1-10
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.validators import RegexValidator
from django.contrib.auth.password_validation import validate_password
alphanumeri... | 2.4375 | 2 |
mathfuncs.py | Jeanne-Chris/DXCPythonBootcamp | 1 | 12779510 | def add(x, y=2):
return x + y
def multiply(x, y=2):
return x * y | 3.390625 | 3 |
analysis/std/map_metrics.py | abraker-osu/osu_analyzer | 0 | 12779511 | import numpy as np
#from ..utils import *
from ..metrics import Metrics
from .map_data import StdMapData
class StdMapMetrics():
"""
Class used for calculating pattern attributes and difficulty.
.. warning::
Undocumented functions in this class are not supported and are experimental.
"""
... | 2.96875 | 3 |
test/test_oss_util.py | LeonSu070/jira_bug_analysis | 2 | 12779512 | import datetime
import re
from unittest import TestCase
from module import storage_util
from module.oss_util import read_file_in_oss, copy_file, delete_file
from module.pyplot_util import generate_pie_chart
class TestOSSUtil(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
def ... | 2.40625 | 2 |
server/project/config.py | charlesfranciscodev/csgames-web-2018 | 0 | 12779513 | import os
class BaseConfig:
"""Base configuration"""
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = "<KEY>"
TOKEN_EXPIRATION_DAYS = 30
TOKEN_EXPIRATION_SECONDS = 0
class DevelopmentConfig(BaseConfig):
"""Development configuration"""
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE... | 2.171875 | 2 |
tests/test_invoices.py | zevaverbach/epcon | 0 | 12779514 | <reponame>zevaverbach/epcon<gh_stars>0
# coding: utf-8
import csv
import decimal
from datetime import date, datetime, timedelta
from decimal import Decimal
import random
import json
from django.http import QueryDict
from pytest import mark
from django.core.urlresolvers import reverse
from django.conf import setting... | 1.8125 | 2 |
accounts/forms.py | lfranceschetti/lyprox | 1 | 12779515 | <gh_stars>1-10
from django import forms
from django.contrib.auth.forms import AuthenticationForm, UsernameField
from django.forms import widgets
from .models import User
class CustomAuthenticationForm(AuthenticationForm):
"""Custom form that allows assignment of classes to widgets. Note that due
to the inher... | 3.03125 | 3 |
starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_software_management/tabs.py | MarioCarrilloA/gui | 0 | 12779516 | <gh_stars>0
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from starlingx_dashboard import api
from starlingx_dashboard.dashboards.dc_admin.dc_soft... | 1.882813 | 2 |
LeapOfThought/allennlp_models/dataset_readers/rule_reasoning_reader.py | alontalmor/TeachYourAI | 20 | 12779517 | <filename>LeapOfThought/allennlp_models/dataset_readers/rule_reasoning_reader.py<gh_stars>10-100
from typing import Dict, Any
import json
import logging
import random
import re
from overrides import overrides
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers.dataset_reader import D... | 2.109375 | 2 |
end2you/models/model.py | FedericoCozziVM/end2you | 0 | 12779518 | <gh_stars>0
from abc import ABCMeta, abstractmethod
class Model(metaclass=ABCMeta):
@abstractmethod
def create_model(*args, **kwargs):
pass
| 2.609375 | 3 |
convex_methods/lasso_regression.py | wavescholar/ds_devops | 0 | 12779519 | #%%
import cvxpy as cp
import numpy as np
import matplotlib.pyplot as plt
def loss_fn(X, Y, beta):
return cp.norm2(cp.matmul(X, beta) - Y)**2
def regularizer(beta):
return cp.norm1(beta)
def objective_fn(X, Y, beta, lambd):
return loss_fn(X, Y, beta) + lambd * regularizer(beta)
def mse(X, Y, beta):
... | 2.765625 | 3 |
_doc/examples/plot_bench_polynomial_features_partial_fit.py | googol-lab/pymlbenchmark | 0 | 12779520 | <reponame>googol-lab/pymlbenchmark
# coding: utf-8
"""
.. _l-bench-slk-poly:
Benchmark of PolynomialFeatures + partialfit of SGDClassifier
=============================================================
This benchmark looks into a new implementation of
`PolynomialFeatures <https://scikit-learn.org/stable/
modules/gener... | 1.984375 | 2 |
polyhedra/tools.py | Hand-and-Machine/polyhedra | 2 | 12779521 | import numpy as np
def stringify_vec(vec):
s = ""
for x in vec: s += str(x) + " "
return s
def distance(p1, p2):
pv1 = np.asarray(p1)
pv2 = np.asarray(p2)
return np.linalg.norm(pv1 - pv2)
def multireplace(arr, x, sub_arr):
new_arr = []
for entry in arr:
if (entry == x).all():
... | 2.921875 | 3 |
cdk/cdk_stack.py | ryangadams/python-lambda-advent | 1 | 12779522 | import aws_cdk.aws_lambda as _lambda
from aws_cdk import core
from aws_cdk.aws_apigatewayv2 import (
HttpApi,
HttpMethod,
)
from aws_cdk.aws_apigatewayv2_integrations import (
LambdaProxyIntegration,
)
from aws_cdk.aws_iam import PolicyStatement, Effect
class CdkStack(core.Stack):
def __init__(self, s... | 2.046875 | 2 |
tests/test_cook_board_ethics.py | pg/city-scrapers | 0 | 12779523 | <gh_stars>0
from datetime import datetime
from city_scrapers_core.constants import BOARD, PASSED
from freezegun import freeze_time
from tests.utils import file_response
from city_scrapers.spiders.cook_board_ethics import CookBoardEthicsSpider
test_response = file_response(
'files/cook_board_ethics.html',
url... | 2.59375 | 3 |
face_sync/video_facial_landmarks_norm.py | lilly9117/Cross-Cutting | 40 | 12779524 | <reponame>lilly9117/Cross-Cutting
#%%i
# USAGE
# python video_facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat
# python video_facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat --picamera 1
# 전체 참고
# https://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-ope... | 2.734375 | 3 |
library/tests/test_utils.py | SACGF/variantgrid | 5 | 12779525 | <gh_stars>1-10
from django.test import TestCase
from library.utils import format_significant_digits
class TestUtils(TestCase):
def test_sig_digits(self):
self.assertEqual("0", format_significant_digits(0))
self.assertEqual("1", format_significant_digits(1))
self.assertEqual("10000", form... | 2.53125 | 3 |
plotting/plot_BPM_01.py | JeffersonLab/HallC_FringeTracer | 0 | 12779526 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
colNames = ['x', 'y', 'z', 'particle.type', 'BPM no']
particleTypeNames = {
-1: 'other',
0: 'e-',
1: 'e+',
... | 2.390625 | 2 |
application_form/api/serializers.py | City-of-Helsinki/apartment-application-service | 1 | 12779527 | <filename>application_form/api/serializers.py
import logging
from enumfields.drf import EnumField
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from rest_framework.fields import CharField, IntegerField, UUIDField
from application_form.enums import ApartmentReservationStat... | 2.203125 | 2 |
cacahuate/mongo.py | tracsa/cacahuate | 3 | 12779528 | from datetime import datetime
import cacahuate.inputs
from cacahuate.jsontypes import MultiFormDict, Map
DATE_FIELDS = [
'started_at',
'finished_at',
]
def make_actor_map(execution_data):
actor_map = {}
for fg in execution_data['values']:
ref = fg['ref']
form_groups = []
fo... | 2.328125 | 2 |
lsrtm_1d/__init__.py | ar4/lsrtm_1d | 3 | 12779529 | """Least-squares Reverse Time Migration using 1D scalar wave equation.
"""
__version__ = '0.0.1'
| 1.054688 | 1 |
setup.py | mnurzia/frhdtools | 4 | 12779530 | #setup.py - Free Rider HD Installation script
#by maxmillion18
#http://www.github.com/maxmillion18
#http://www.freeriderhd.com/u/MaxwellNurzia
from setuptools import setup, find_packages
versionFile = "VERSION"
setup(name="frhdtools",
version=open(versionFile).read(),
description="Library to work with Free Ri... | 1.242188 | 1 |
sdk/python/pulumi_openstack/identity/role_assignment.py | pulumi/pulumi-openstack | 34 | 12779531 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 2.109375 | 2 |
src/routes.py | jkpawlowski96/TRD-client-api | 0 | 12779532 | from src import app, api
from flask_restful import Resource
from src.data import Data
from src.models import Pair, Interval
data = Data()
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
class Test(Resource):
def get(self):
return {'results':data.test()}
class History(Res... | 2.71875 | 3 |
nuscenes_flicker/transform_to_local.py | jianrenw/SOD-TGNN | 1 | 12779533 | <reponame>jianrenw/SOD-TGNN
#!/usr/bin/python
# @Author: <NAME>
# @Date: 2021-04-07
import numpy as np
import os
import os.path as osp
import json
import argparse
from pyquaternion import Quaternion
import copy
try:
from nuscenes import NuScenes
from nuscenes.utils import splits
from nuscenes.utils.data_... | 2.296875 | 2 |
python/datming/similarity/euclidean.py | Yuhan-Wg/massive-data-mining | 0 | 12779534 | """
LSH for euclidean distance.
"""
from pyspark import SparkContext, RDD
from datming.utils import join_multiple_keys
import numpy as np
__all__ = [
"EuclideanDistance"
]
class EuclideanDistanceLSH(object):
"""
Find item pairs between which Euclidean Distance is closed enough.
"""
def __init__... | 3.078125 | 3 |
papergit/utilities/dropbox.py | jameshruby/paper-to-git | 78 | 12779535 | <reponame>jameshruby/paper-to-git
__all__ = [
'dropbox_api'
]
def dropbox_api(function):
"""
Attach a global dropbox handler with the function.
"""
def func_wrapper(*args, **kws):
# Avoid circular imports.
from papergit.config import config
dbx = config.dbox.dbx
... | 2.171875 | 2 |
semseg/models/modules/common.py | Genevievekim/semantic-segmentation-1 | 196 | 12779536 | <reponame>Genevievekim/semantic-segmentation-1<filename>semseg/models/modules/common.py
import torch
from torch import nn, Tensor
class ConvModule(nn.Sequential):
def __init__(self, c1, c2, k, s=1, p=0, d=1, g=1):
super().__init__(
nn.Conv2d(c1, c2, k, s, p, d, g, bias=False),
nn.B... | 2.65625 | 3 |
aioarango/__init__.py | mirrorrim/aioarango | 10 | 12779537 | <gh_stars>1-10
import aioarango.errno as errno # noqa: F401
from aioarango.client import ArangoClient # noqa: F401
from aioarango.exceptions import * # noqa: F401 F403
from aioarango.http import * # noqa: F401 F403
| 1.398438 | 1 |
sheets/admin.py | LD31D/django_sheets | 0 | 12779538 | from django.contrib import admin
from .models import Sheet, Cell
@admin.register(Sheet)
class SheetAdmin(admin.ModelAdmin):
list_display = ('name', 'key', 'owner')
readonly_fields = ('key', )
search_fields = ('name', )
@admin.register(Cell)
class CellAdmin(admin.ModelAdmin):
pass
| 1.34375 | 1 |
autumn/projects/covid_19/victoria/victoria_2021/project.py | monash-emu/AuTuMN | 14 | 12779539 | <reponame>monash-emu/AuTuMN
import numpy as np
from autumn.tools.project import Project, ParameterSet, TimeSeriesSet, build_rel_path, use_tuned_proposal_sds
from autumn.tools.calibration import Calibration
from autumn.tools.calibration.priors import UniformPrior, TruncNormalPrior
from autumn.tools.calibration.targets ... | 1.734375 | 2 |
test/test_mapping.py | EngineerCoding/Data2DNA | 0 | 12779540 | from unittest import TestCase
from mapping import Mapping
from mapping import Value
class MappingTestCase(TestCase):
def setUp(self):
self.mapping = Mapping(Value.zero, Value.one, Value.two, Value.three)
def test_distinct_values_correct(self):
try:
Mapping(Value.zero, Value.one, Value.two, Value.three)
... | 3.71875 | 4 |
dank/dank.py | UltimatePancake/Pancake-Cogs | 5 | 12779541 | <gh_stars>1-10
from discord.ext import commands
class Dank:
"""Dank memes, yo."""
def __init__(self, bot):
self.bot = bot
self.base = "data/dank/"
@commands.command(pass_context=True)
async def dickbutt(self, ctx):
"""Dickbutt."""
await self.bot.send_file(ctx.message.... | 2.578125 | 3 |
2D_conv_diff.py | killacamron/CFDcourse21 | 0 | 12779542 | # =============================================================================
#
# Explicit Finite Difference Method Code
# Solves the 2D Temperature Convection-Diffusion Equation
# Assumes Tubular Plug-Flow-Reactor in Laminar Regime
# Assumes hagen poiseuille velocity profile
# Heat Source-Sink Included Uses ... | 2.78125 | 3 |
src/gpcsd/priors.py | natalieklein/gpcsd | 1 | 12779543 | """
Priors for GPCSD parameters.
"""
import autograd.numpy as np
from scipy.stats import invgamma, halfnorm
class GPCSDPrior:
def __init__(self):
pass
class GPCSDInvGammaPrior(GPCSDPrior):
def __init__(self, alpha=1, beta=1):
GPCSDPrior.__init__(self)
self.alpha = alpha
... | 2.53125 | 3 |
src/main/resources/resource/AndroidSpeechRecognition/AndroidSpeechRecognition.py | holgerfriedrich/myrobotlab | 179 | 12779544 | #########################################
# AndroidSpeechRecognition.py
# more info @: http://myrobotlab.org/service/AndroidSpeechRecognition
#########################################
# start the service
androidspeechrecognition = Runtime.start("androidspeechrecognition","AndroidSpeechRecognition")
# start mouth
mary... | 2.765625 | 3 |
rain/models.py | Ronyonka/rain-drop | 0 | 12779545 | from django.db import models
from .managers import GeneralManager
class Rain(models.Model):
amount = models.IntegerField()
date = models.DateField(auto_now=False)
objects = models.Manager()
my_query = GeneralManager()
class Meta:
ordering = ['date']
def __str__(self):
... | 2.21875 | 2 |
src/garage/torch/modules/cnn_module.py | blacksph3re/garage | 1,500 | 12779546 | """CNN Module."""
import warnings
import akro
import numpy as np
import torch
from torch import nn
from garage import InOutSpec
from garage.torch import (expand_var, NonLinearity, output_height_2d,
output_width_2d)
# pytorch v1.6 issue, see https://github.com/pytorch/pytorch/issues/42305
#... | 3.59375 | 4 |
nutsflow/function.py | maet3608/nuts-flow | 21 | 12779547 | """
.. module:: function
:synopsis: Nuts that perform functions on single stream elements.
"""
from __future__ import print_function
from __future__ import absolute_import
import time
import threading
from nutsflow.common import (shapestr, as_tuple, is_iterable, istensor,
print_type, c... | 3.4375 | 3 |
rpc/cmd_walletpassphrasechange.py | Adenium/Adenium | 7 | 12779548 | <reponame>Adenium/Adenium<filename>rpc/cmd_walletpassphrasechange.py<gh_stars>1-10
# import commands
import commands
# password helper
from getpass import getpass
# define 'walletpassphrasechange' command
def parse(cmd, arguments, connection):
if len(arguments) != 2:
print("error: '"+cmd.name+"' requires o... | 3.015625 | 3 |
DeepHyperion-BNG/core/individual.py | IharBakhanovich/DeepHyperion | 0 | 12779549 | from typing import Tuple
from numpy import mean
from core.member import Member
class Individual:
def __init__(self, m: Member):
self.m: Member = m
self.oob_ff: float = None
self.seed: Member = None
def clone(self) -> 'creator.base':
raise NotImplemented()
def evaluate(... | 2.96875 | 3 |
get_model.py | dzh19990407/LBDT | 0 | 12779550 | from models import LBDT_4
def get_model_by_name(model_name, *args, **kwargs):
model = eval(model_name).JointModel(*args, **kwargs)
return model
| 2.203125 | 2 |