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 |
|---|---|---|---|---|---|---|
python/paddle/fluid/tests/unittests/dygraph_to_static/test_isinstance.py | zmxdream/Paddle | 17,085 | 25100 | # Copyright (c) 2020 PaddlePaddle Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 2.28125 | 2 |
dlf/core/registry.py | scheckmedia/dl-framework | 0 | 25101 | """ The task of the registry is to register complex objects
by an keyword/alias that you easily can build and instanciate
these objects with a single keyword. This allows it in a easy
manner to parse a yaml configuration file and use these values
to instanciate the available objects.
"""
import tensorflow as tf
from ... | 2.734375 | 3 |
project/dev/tuning.py | maple1eaf/data_mining_inf553 | 1 | 25102 | import os
import json
import rmse
TUNING_FILE = "/Users/markduan/duan/USC_course/USC_APDS/INF553/project/predict/tuning.json"
CORATED_LIMIT = [3, 5, 7, 10]
LONELY_THRESHOLD = [2, 3, 5, 7]
N_NEIGHBORS_ITEMBASED = [5, 7, 10, 12]
WEIGHT = [0.2, 0.4, 0.6, 0.8]
def writeRes(c, l, n, w, res):
with open(TUNING_FILE, 'a... | 2.390625 | 2 |
tests/test_weightings.py | matchup-ir/whooshy | 319 | 25103 | <reponame>matchup-ir/whooshy
from __future__ import with_statement
import inspect
from random import choice, randint
import sys
from whoosh import fields, query, scoring
from whoosh.compat import u, xrange, permutations
from whoosh.filedb.filestore import RamStorage
def _weighting_classes(ignore):
# Get all the ... | 2.125 | 2 |
Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/10_CubeClass/cubeProperties.py | jeffvswanson/CodingPractice | 0 | 25104 | <reponame>jeffvswanson/CodingPractice<filename>Python/Zelle/Chapter10_DefiningClasses/ProgrammingExercises/10_CubeClass/cubeProperties.py<gh_stars>0
# cubeProperties.py
# A program to calculate the volume and surface area of a cube.
"""Same as Chapter 10 Programming Exercise 9, but for a cube. The constructor
should ac... | 4.625 | 5 |
pharmrep/product/models.py | boyombo/pharmrep | 0 | 25105 | from __future__ import unicode_literals
from datetime import datetime, date
from django.db import models
from django.contrib.auth.models import User
from django.db.models.aggregates import Sum
AGE_LIMIT = 7 # 7 days age limit
class PriceTemplate(models.Model):
name = models.CharField(max_length=200)
def _... | 2.21875 | 2 |
src/apscheduler/datastores/async_/sqlalchemy.py | spaceack/apscheduler | 0 | 25106 | <reponame>spaceack/apscheduler
from __future__ import annotations
import json
import logging
from contextlib import AsyncExitStack, closing
from datetime import datetime, timedelta, timezone
from json import JSONDecodeError
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
from ... | 1.664063 | 2 |
financeiro/views.py | Antonio-Neves/Gestao-Escolar | 7 | 25107 | <reponame>Antonio-Neves/Gestao-Escolar<gh_stars>1-10
from django.shortcuts import render
from django.views.generic.base import TemplateView
class IndexFinanceiroView(TemplateView):
template_name = 'financeiro/index-financeiro.html'
| 1.117188 | 1 |
__init__.py | fleximus/pelican-fancyindex | 0 | 25108 | from .fancyindex import *
| 1.070313 | 1 |
SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/structural_variants.py | fanglab/6mASCOPE | 5 | 25109 | <gh_stars>1-10
"""
Structural Variants Report
"""
import os
import os.path as op
import logging
import sys
import json
import itertools
import collections
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.ticker as ticker
from matplotlib i... | 1.859375 | 2 |
logger.py | K-Molloy/nrdf-feed-python | 0 | 25110 | import logging
import os
from datetime import datetime
class Logger :
logger = None
def myLogger(self):
if None == self.logger:
self.logger=logging.getLogger('nrdf')
self.logger.setLevel(logging.DEBUG)
log_folder = r"logs/"
os.makedirs(os.path.dirname(lo... | 2.9375 | 3 |
rest_framework_auth0/models.py | robindebois/djangorestframework-auth0 | 107 | 25111 | # Just to keep things like ./manage.py test happy
from django.contrib.auth.models import AbstractUser
# class Group(models.Model):
# """
# Groups are a generic way of categorizing users to apply permissions, or
# some other label, to those users. A user can belong to any number of
# groups.
# A use... | 2.875 | 3 |
inference.py | quantori/prj-covid-scoring | 0 | 25112 | import os
import argparse
import cv2
import torch
import pandas as pd
from tqdm import tqdm
from pathlib import Path
import segmentation_models_pytorch as smp
from tools.datasets import InferenceDataset
from tools.models import CovidScoringNet, SegmentationModel
from tools.utils import extract_model_opts, get_list_of... | 2.15625 | 2 |
uproot/const.py | guiguem/uproot | 0 | 25113 | #!/usr/bin/env python
# Copyright (c) 2017, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list ... | 1.515625 | 2 |
LeetCode/LostBoy/771. Jewels and Stones.py | nikku1234/Code-Practise | 9 | 25114 | <filename>LeetCode/LostBoy/771. Jewels and Stones.py
#771. Jewels and Stones
class Solution:
def numJewelsInStones(self, jewels: str, stones: str) -> int:
# count = 0
# jewl = {}
# for i in jewels:
# if i not in jewl:
# jewl[i] = 0
# for j in stones:
... | 3.5 | 4 |
djblog/comments/admin.py | rewalkerof/microblog | 0 | 25115 | from django.contrib import admin
from .models import Comment
# Register your models here.
class CommentsAdmin(admin.ModelAdmin):
list_display = ['id', "user", "content", "timestamp"]
class Meta:
model = Comment
admin.site.register(Comment, CommentsAdmin)
| 1.96875 | 2 |
bot/audio_trial2.py | Nova-Striker/discord-bot | 1 | 25116 | <reponame>Nova-Striker/discord-bot
##incompleted yt tuitorial
##import discord
##import json
##import asyncio
##import youtube_dl
##import shell
##import os
##from discord.utils import get
##from discord.ext import commands
##
##@client.command(pass_context=True)
##async def join(ctx):
## global voic... | 2.46875 | 2 |
pyeem/augmentation/base.py | drewmee/PyEEM | 4 | 25117 | import itertools
import os
import random
import numpy as np
import pandas as pd
from tqdm import tqdm
def _get_steps():
hdf_subdir = "augmentation/"
steps = {"step_name": ["prototypical", "single_sources", "mixtures"]}
steps_df = pd.DataFrame(steps)
steps_df["hdf_path"] = hdf_subdir + steps_df["step_... | 2.546875 | 3 |
pgoapi/protos/POGOProtos/Networking/Responses/SetAvatarResponse_pb2.py | PogoHop/pgoapi-hsvr | 0 | 25118 | <reponame>PogoHop/pgoapi-hsvr
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Responses/SetAvatarResponse.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protob... | 1.257813 | 1 |
control/src/robocup/motion-control/VelocityKalmanTuner/dynamics.py | RRRekkitRalph/robocup-firmware | 26 | 25119 | <gh_stars>10-100
from abc import ABC, abstractmethod
class Dynamics(ABC):
"""
An abstract class which outlines the basic functionalities
that an object simulating dynamics should implement
"""
@abstractmethod
def step(self, dt):
pass
@abstractmethod
def get_state(self):
... | 3.125 | 3 |
algs4/max_pq.py | dumpmemory/algs4-py | 230 | 25120 | <reponame>dumpmemory/algs4-py
class MaxPQ:
def __init__(self):
self.pq = []
def insert(self, v):
self.pq.append(v)
self.swim(len(self.pq) - 1)
def max(self):
return self.pq[0]
def del_max(self, ):
m = self.pq[0]
self.pq[0], self.pq[-1] = self.pq[-1], s... | 2.78125 | 3 |
PP4E-Examples-1.4/Examples/PP4E/System/Threads/four-threads.py | AngelLiang/PP4E | 0 | 25121 | <filename>PP4E-Examples-1.4/Examples/PP4E/System/Threads/four-threads.py<gh_stars>0
"""
four different ways to run an action in a thread; all print 4294967296,
but prints should be synchronized with a mutex here to avoid overlap
"""
import threading, _thread
def action(i):
print(i ** 32)
# subclass with state
cl... | 3.171875 | 3 |
src/server_dgram/server.py | kn1m/LocalizationTDOA | 36 | 25122 | <filename>src/server_dgram/server.py
import logging
import socket
import numpy
import time
from cPickle import loads
from scipy import linalg
from matplotlib import pyplot
from multiprocessing import Array
from src.logic import helpers
from src.logic.parallel_process import ProcessParallel
from scipy import *
from nump... | 2.546875 | 3 |
tests/test_comparisons.py | opensafely/covid19-vaccine-coverage-tpp-emis | 0 | 25123 | import numpy as np
import pandas as pd
from pandas.testing import assert_series_equal
from analysis.comparisons import gt, gte, lt, lte
def test_comparisons():
# a | b | gt | gte | lt | lte
# ---+---+----+-----+----+-----
# 1 | 1 | F | T | F | T
# 1 | 2 | F | F | T | T
# 2 | 1 | T ... | 3 | 3 |
tests/conftest.py | Shaza-Is/Re-IDOL | 2 | 25124 | import pytest
import numpy as np
import os
import pyarrow as pa
import pyarrow.feather as feather
import pandas as pd
from app.services.preprocessor import PreProcessor
from typing import List
@pytest.fixture
def preprocessor() -> PreProcessor:
return PreProcessor("datasets/csvs/train.csv", "datasets/csvs/build... | 2.296875 | 2 |
color_histogram/results/hist_2d.py | waragai-katsunori/ColorHistogram | 73 | 25125 | <filename>color_histogram/results/hist_2d.py
# -*- coding: utf-8 -*-
# # @package color_histogram.results.hist_2d
#
# Compute 2D color histogram result.
# @author tody
# @date 2015/08/28
import os
import numpy as np
import matplotlib.pyplot as plt
from color_histogram.io_util.image import loadRGB
from... | 3.03125 | 3 |
tests/test_python.py | sfeltman/libsmf | 1 | 25126 | <filename>tests/test_python.py
import os
import unittest
import tempfile
from gi.repository import Smf
class Test(unittest.TestCase):
def setUp(self):
self.path = os.path.dirname(__file__)
def compare_smf_files(self, a, b):
self.assertEqual(a.format, b.format)
self.assertEqual(a.ppqn... | 2.625 | 3 |
ansible-devel/test/units/galaxy/test_role_requirements.py | satishcarya/ansible | 0 | 25127 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.pla... | 1.890625 | 2 |
argo/workflows/client/models/v1_pod_log_options.py | fvdnabee/argo-client-python | 35 | 25128 | <filename>argo/workflows/client/models/v1_pod_log_options.py
# coding: utf-8
"""
Argo
Python client for Argo Workflows # noqa: E501
OpenAPI spec version: master
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class V1Pod... | 1.796875 | 2 |
tests/test_html.py | unfoldingWord-dev/USFM-Utils | 4 | 25129 | import itertools
import unittest
from usfm_utils.elements.document import Document
from usfm_utils.elements.element_impls import FormattedText, Text, Paragraph, Footnote
from usfm_utils.elements.footnote_utils import AutomaticFootnoteLabel, CustomFootnoteLabel
from usfm_utils.html.html_visitor import HtmlVisitor, non_... | 2.46875 | 2 |
src/tokenization/train_tokenizer.py | saridormi/commits_dataset | 1 | 25130 | <filename>src/tokenization/train_tokenizer.py
import hydra
import os
import logging
from hydra.utils import instantiate, to_absolute_path
from omegaconf import DictConfig, OmegaConf
from tokenizers import Tokenizer
from src.tokenization.utils import Lexer
@hydra.main(config_path="configs", config_name="train_tokenize... | 2.328125 | 2 |
xfdnn/rt/xdnn_rt.py | jebtang/ml-suite | 1 | 25131 | #!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import tensorflow as tf
import numpy as np
from xfdnn_compiler_tensorflow import TFFrontend
#from xfdnn.tools.compile.frontends.frontend_caffe import CaffeFrontend
from tensorflow.python.platform import gfile
impo... | 2.171875 | 2 |
bot/cogs/personal.py | issuemeaname/rammus-discord-bot | 1 | 25132 | <reponame>issuemeaname/rammus-discord-bot<gh_stars>1-10
"""
This is a cog used for personal commands. For now they exist for people I know
but they will be removed eventually, as they hold no other use to the community
or other users of Rammus. Again, this is temporary and will be removed shortly.
Thank you for readin... | 2.59375 | 3 |
EducationalRound101/red_and_blue/red_and_blue_test.py | tqa236/codeforces | 0 | 25133 | import unittest
from red_and_blue import red_and_blue
class Test(unittest.TestCase):
def test_1(self):
self.assertEqual(red_and_blue([6, -5, 7, -3], [2, 3, -4]), 13)
def test_2(self):
self.assertEqual(red_and_blue([1, 1], [10, -3, 2, 2]), 13)
def test_3(self):
self.assertEqual(re... | 3.171875 | 3 |
benchmarks/Generators/Parser/SygusParser.py | yangdinglou/DryadSynth | 19 | 25134 | <gh_stars>10-100
# Generated from Sygus.g4 by ANTLR 4.7.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3%")
buf.write("\u01ca\4\2\t\2\... | 1.429688 | 1 |
keitaro/utils.py | Infvmous/keitaro | 1 | 25135 | import random
from string import ascii_letters, digits
from urllib.parse import urlparse
def list_to_string(list_items, separator='\n'):
"""
Converts list items to string with separator
"""
return separator.join(list_items)
def string_to_list(string, separator='\n'):
"""
Converts string wit... | 3.390625 | 3 |
examples/ADT.py | SophiaZhyrovetska/Music_analizer | 2 | 25136 | class Song:
"A class for representing a song"
def __init__(self, name, singer):
"""
Initialize a new song with it's name and singer
:param name: str
:param singer: str
"""
self.name = name
self.singer = singer
self.mood = self.mood()
def text... | 4.09375 | 4 |
tensorflow_1_x/7_kaggle/learntools/pandas/indexing_selecting_and_assigning.py | amitbcp/machine_learning_with_Scikit_Learn_and_TensorFlow | 11 | 25137 | <reponame>amitbcp/machine_learning_with_Scikit_Learn_and_TensorFlow
import pandas as pd
from learntools.core import *
reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0)
# 1
class SelectDescCol(EqualityCheckProblem):
_var = 'desc'
_expected = (
reviews.description... | 3.84375 | 4 |
openseis/sd5.py | whamlyn/openseis | 0 | 25138 | <reponame>whamlyn/openseis<gh_stars>0
"""
OpenSeis module
"""
import numpy as np
import os
import openseis as ops
try:
import h5py
except:
print('h5py package does not seem to be installed on this system.')
class Seis3D():
"""
OpenSeis class for 3D seismic datasets
"""
def __init__(self, sg... | 2.265625 | 2 |
Heaps: Find the Running Median/Heaps: Find the Running Median.py | chmielak90/HackerRank_Coding_Interview_Challenges | 1 | 25139 | <filename>Heaps: Find the Running Median/Heaps: Find the Running Median.py
# n = int(input().strip())
#
# a = []
# a_i = 0
#
# for a_i in range(n):
# a_t = int(input().strip())
# a.append(a_t)
#
# a = sorted(a, key=int)
#
# if len(a) % 2 == 0:
# print((a[int(len(a)/2)] + a[int(len(a)/2)-1])/2)
#... | 3.890625 | 4 |
gost/ui/commands/reporting.py | sixy6e/gost | 0 | 25140 | <reponame>sixy6e/gost
"""
Command line interface for creating the LaTeX documents.
"""
from pathlib import Path, PurePosixPath as PPath
from typing import Union
import click
import h5py # type: ignore
import pandas
import structlog # type: ignore
import geopandas # type: ignore
from wagl.hdf5 import read_h5_table ... | 2.234375 | 2 |
aws_lambda_typing/events/config.py | curekoshimizu/aws-lambda-typing | 0 | 25141 | #!/usr/bin/env python
import typing
class ConfigEvent(typing.TypedDict):
"""
MQEvent https://docs.aws.amazon.com/lambda/latest/dg/services-config.html
Attributes:
----------
invokingEvent: str
ruleParameters: str
resultToken: str
eventLeftScope: bool
executionRoleArn: str
... | 2.09375 | 2 |
Incident-Response/Tools/grr/grr/test/grr_response_test/end_to_end_tests/tests/timeline.py | sn0b4ll/Incident-Playbook | 1 | 25142 | #!/usr/bin/env python
# Lint as: python3
"""E2E tests for the timeline flow."""
import csv
import io
from typing import Sequence
from typing import Text
from absl.testing import absltest
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.util import temp
from grr_response_proto.api import timeline_... | 2.234375 | 2 |
app/tests/test_init.py | MerrybyPractice/flask-comics-api | 0 | 25143 | import sys
sys.path.append("flask-comics-api")
from app import app
def test_all_comics():
print(app)
assert False | 1.773438 | 2 |
metric/metric.py | wyu-du/MultiTurnDialogZoo | 145 | 25144 | <filename>metric/metric.py<gh_stars>100-1000
from nltk.translate.bleu_score import sentence_bleu, corpus_bleu
from nltk.translate.bleu_score import SmoothingFunction
from nltk.collocations import BigramCollocationFinder
from nltk.probability import FreqDist
from .bleu import Bleu
import argparse
import codecs
import nu... | 2.265625 | 2 |
distfromplane_demo.py | johnmgregoire/PythonCompositionPlots | 4 | 25145 | import pylab, numpy
from myquaternaryutility import QuaternaryPlot
q=QuaternaryPlot(211)
q2=QuaternaryPlot(212)
#t=numpy.linspace(0,1.,5)
#comps=[[a,b,c,d] for a in t for b in t for c in t for d in t if a+b+c+d==1.]
#comps=numpy.float32(comps)
t=numpy.linspace(0,1.,30)
comps=[[a,b,1.-a-b-(2.*a**2+b),2.*a**2+b] for a... | 1.867188 | 2 |
config/config.py | GeneralOrae/botrae | 0 | 25146 | <reponame>GeneralOrae/botrae
BOT_TOKEN: str = "<KEY>"
SPOTIFY_ID: str = ""
SPOTIFY_SECRET: str = ""
BOT_PREFIX = "$"
EMBED_COLOR = 0x4dd4d0 #replace after'0x' with desired hex code ex. '#ff0188' >> '0xff0188'
SUPPORTED_EXTENSIONS = ('.webm', '.mp4', '.mp3', '.avi', '.wav', '.m4v', '.ogg', '.mov')
MAX_SONG_PRELOAD ... | 2.125 | 2 |
fromage/utils/mol/_cell_operations.py | Yulin832/fromage | 0 | 25147 | from copy import deepcopy
import numpy as np
def complete_mol(self, labels):
"""
Take a cell and complete certain molecules
The objective is to end up with a unit cell where the molecules of interest
are complete. The rest of the atoms of the cell must remain intact. Note that
the input atoms are... | 3.359375 | 3 |
tests/test_pvpc.py | r-jordan/aiopvpc | 0 | 25148 | """Tests for aiopvpc."""
import logging
from asyncio import TimeoutError
from datetime import datetime, timedelta
from unittest.mock import patch
import pytest
from aiohttp import ClientError
from aiopvpc import ESIOS_TARIFFS, PVPCData, REFERENCE_TZ
from .conftest import MockAsyncSession, TZ_TEST
@pytest.mark.param... | 2.15625 | 2 |
validation.py | Jianxiang-Wang/Pytorch-code-for-time-series-classification | 2 | 25149 | from sklearn import metrics
import torch
from models import *
import torch.backends.cudnn as cudnn
import seaborn as sns
import matplotlib.pyplot as plt
from dataset import load
#define the net
device = 'cuda' if torch.cuda.is_available() else 'cpu'
net = LSTM(3, 10, 2, 3)
net = net.to(device)
if device == 'cuda':
... | 2.71875 | 3 |
mopidy_spotify_tunigo/__init__.py | trygveaa/mopidy-spotify-tunigo | 34 | 25150 | <gh_stars>10-100
from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '1.0.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-Spotify-Tunigo'
ext_name = 'spotify_tunigo'
version = __version__
def get_default_config(self):
conf_file = os.path.... | 2.109375 | 2 |
apps/log_search/tasks/project.py | yiqiwang-17/bk-log | 0 | 25151 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | 1.234375 | 1 |
hawkdet/dataset/transformers.py | itisianlee/hawk-facedet | 0 | 25152 | <reponame>itisianlee/hawk-facedet
import cv2
import numpy as np
import random
from ..lib.box_utils import matrix_iof
class RandomCrop:
def __init__(self, image_size=(640, 640), iof_factor=1.0, min_face=16):
self.image_size = image_size
self.iof_factor = iof_factor # iof(IoF(forgrand))
se... | 2.25 | 2 |
mwlib/utoken.py | pediapress/mwlib | 53 | 25153 | <filename>mwlib/utoken.py
#! /usr/bin/env python
# Copyright (c) 2007-2009 PediaPress GmbH
# See README.rst for additional licensing information.
# unified/universal token
import sys
import re
import _uscan as _mwscan
from mwlib.refine.util import resolve_entity, parseParams
def walknode(node, filt=lambda x: True)... | 2.28125 | 2 |
MaskDetection/video.py | fossabot/IoT_COVID19-Detector_CO-vision | 0 | 25154 | <filename>MaskDetection/video.py
#Data Set을 만들어서 학습.
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.models import load_model
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
import json
import requests
# 카카오톡 메시지 커스텀 템플릿 주소 : https://kapi.kakao.com/... | 2.59375 | 3 |
objects_detector.py | AlejandroGonzalR/image-object-detection | 0 | 25155 | <filename>objects_detector.py
import getopt
import sys
import cv2
import numpy as np
class_ids = []
confidences = []
boxes = []
min_confidence = 0.5
target_name = "truck"
def main(argv):
input_image = ''
try:
opts, args = getopt.getopt(argv, 'i:', ["input-file"])
except getopt.GetoptError:
... | 2.984375 | 3 |
pynmmso/listeners/trace_listener.py | wood-chris/pynmmso | 5 | 25156 | <gh_stars>1-10
from pynmmso.listeners.base_listener import BaseListener
class TraceListener(BaseListener):
"""
Listener used to trace the progress of the Nmmso algorithm.
Arguments
---------
level : int
The amount of detail to output in the trace. Level 1 is the least information and
... | 2.734375 | 3 |
spotify_dashboard/spotify/models.py | timmyomahony/spotify-picture-frame | 1 | 25157 | <filename>spotify_dashboard/spotify/models.py
import time
from django.db import models
from django.utils.timesince import timesince
class Track(models.Model):
id = models.CharField(max_length=30, primary_key=True)
artist = models.CharField(max_length=500)
album = models.CharField(max_length=500)
titl... | 2.171875 | 2 |
tests/test_controller.py | yehzhang/dscraper | 1 | 25158 | import unittest
import logging
import asyncio
import datetime
from pytz import timezone
import dscraper
from dscraper.utils import FrequencyController
logger = logging.getLogger(__name__)
from .utils import Test
EPS = 1e-6
class TestController(Test):
INVERTAL = 0.2
CONFIG_NONE = (0, 0, 0, EPS, None)
CO... | 2.53125 | 3 |
src/tools/dev/scripts/hooks/exceptions.py | cstatz/visit | 0 | 25159 | <reponame>cstatz/visit
#!/usr/bin/python
# (Small) Modification of some code from Cyrus which ensures we have a proper
# number of TRY/ENDTRY lines.
# There is some code here to search for invalid characters which isn't
# enabled/used right now.
import sys
import subprocess
import re
#
# Helper Methods
#
def parse_e... | 2.359375 | 2 |
mmdet/models/utils/__init__.py | dandelin/mmdetection | 0 | 25160 | <filename>mmdet/models/utils/__init__.py
from .conv_ws import conv_ws_2d, ConvWS2d
from .conv_module import build_conv_layer, ConvModule
from .norm import build_norm_layer
from .scale import Scale
from .weight_init import (
xavier_init,
normal_init,
uniform_init,
kaiming_init,
bias_init_with_prob,
)... | 1.460938 | 1 |
arghphot/arghphot.py | balbinot/arghphot | 1 | 25161 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
## temp imports
from matplotlib import pyplot as p
from matplotlib import cm
import tempfile
import numpy as np
from astropy.io import fits, ascii
from astropy.coordinates import SkyCoord
from astropy import units as u
from astropy import wcs
import aplpy
from pyraf impo... | 1.835938 | 2 |
core/domain/exp_domain_test.py | imrk51/oppia | 0 | 25162 | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 1.65625 | 2 |
Infection_vs_Inflammation/Code/Process_Data_V3.py | jdatascientist/Machine_Learning_4_MRI | 0 | 25163 | <gh_stars>0
# Import Modules as needed
import numpy as np
from mylocal_functions import *
import matplotlib.pyplot as plt
# ======== CEST============= #
CEST_list=get_ipython().getoutput('ls ../Study_03_CBA/*CEST.txt')
CEST_Int_matrix=np.zeros((len(CEST_list),4))
ppm=np.linspace(-8,8,101);
for i in range( len(CES... | 2.171875 | 2 |
LAMARCK_ML/metrics/__init__.py | JonasDHomburg/LAMARCK | 3 | 25164 | <reponame>JonasDHomburg/LAMARCK<gh_stars>1-10
from .implementations import Accuracy, \
FlOps, \
Nodes, \
TimeMetric, \
MemoryMetric, \
Parameters, \
LayoutCrossingEdges, \
LayoutDistanceX, \
LayoutDistanceY, \
CartesianFitness
from .interface import MetricInterface
| 0.925781 | 1 |
Confidence_Calibration/main.py | heatherwan/Automatic-Validation-of-Simulation-Results | 0 | 25165 | <filename>Confidence_Calibration/main.py
# Functions for Dirichlet parameter tuning main class for CIFAR-100
import numpy as np
import argparse
from calibration.calibration_functions import tune_dir_nn_heather, cal_TS_results
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-... | 2.703125 | 3 |
neutron/tests/functional/agent/l3/test_metadata_proxy.py | congnt95/neutron | 1,080 | 25166 | <filename>neutron/tests/functional/agent/l3/test_metadata_proxy.py
# 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. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/L... | 1.585938 | 2 |
ctrl/experimental/watch_remake_task_status.py | markmuetz/cosmic | 0 | 25167 | <reponame>markmuetz/cosmic
import sys
import logging
from watchdog.observers.polling import PollingObserver
from watchdog.events import FileSystemEventHandler
class RemakeTaskStatusEventHandler(FileSystemEventHandler):
def on_any_event(self, event):
super().on_any_event(event)
print(event)
if __... | 2.234375 | 2 |
flask_clacks.py | WilliamMayor/flask-clacks | 1 | 25168 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from functools import wraps
from flask import make_response
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '1.0.1'
class Clacks(object):
def __init__(self, app=None, names=None):
if names is None:
names = []
self.names = list(names) ... | 2.78125 | 3 |
utils/utils.py | wl-970925/DANN-MNIST | 0 | 25169 | # -*- coding: utf-8 -*-
# @Time : 2020/2/15 16:10
# @Author : <NAME>
# @Email : <EMAIL>
# @File : utils.py
# @Software: PyCharm
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.core.framework import summary_pb2
class AverageMeter(object):
def __init__(self):
self.re... | 2.953125 | 3 |
PyrogramBot/commands.py | Habdio/GROUP-AutoManageBot | 0 | 25170 | <gh_stars>0
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.types import CallbackQuery
import random
ALL_PIC = [
"https://telegra.ph/file/52b71d5a61c904c6a59d1.jpg",
"https://telegra.ph/file/28a00384a3be4f6c916ba.jpg",
"https://telegra.ph/fil... | 2.421875 | 2 |
graphs/finding_bridges.py | topguns837/Python-1 | 1 | 25171 | """
An edge is a bridge if, after removing it count of connected components in graph will
be increased by one. Bridges represent vulnerabilities in a connected network and are
useful for designing reliable networks. For example, in a wired computer network, an
articulation point indicates the critical computers and a b... | 4.03125 | 4 |
index.py | ReeLeeSama/Ticket-system | 1 | 25172 | import discord
import asyncio
import aiofiles
from discord.ext import commands
intents = discord.Intents.all()
client = commands.Bot(command_prefix=commands.when_mentioned_or('!'),intents=intents)
client.ticket_configs = {}
@client.command()
async def ping(ctx):
embed=discord.Embed(title="Bot Ping",description=... | 2.53125 | 3 |
tests/sample_runbooks/set_variable.py | tuxtof/calm-dsl | 37 | 25173 | """
Calm Runbook Sample for set variable task
"""
from calm.dsl.runbooks import read_local_file
from calm.dsl.runbooks import runbook, runbook_json
from calm.dsl.runbooks import RunbookTask as Task
from calm.dsl.runbooks import CalmEndpoint as Endpoint, basic_cred
CRED_USERNAME = read_local_file(".tests/runbook_tests... | 2.03125 | 2 |
CL_tools/build_cdf2.py | NLP2CT/norm-nmt | 13 | 25174 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import collections
import math
import numpy as np
def count_words(filename):
counter = collections.Counter()
wi... | 2.875 | 3 |
stubs.min/Autodesk/Revit/DB/__init___parts/BRepBuilderGeometryId.py | denfromufa/ironpython-stubs | 1 | 25175 | class BRepBuilderGeometryId(object,IDisposable):
"""
This class is used by the BRepBuilder class to identify objects it creates (faces,edges,etc.).
BRepBuilderGeometryId(other: BRepBuilderGeometryId)
"""
def Dispose(self):
""" Dispose(self: BRepBuilderGeometryId) """
pass
@staticmethod
def Inva... | 2.234375 | 2 |
tools/annotation/gPro_profile.py | hidelab/galaxy-central-hpc | 0 | 25176 | <reponame>hidelab/galaxy-central-hpc<filename>tools/annotation/gPro_profile.py
#!/usr/bin/env python
from anno_lib import gPro
import sys
##
# Runs the GOst profiler from g:Profiler
####
# jje 10152011
# <NAME>
# Bioinformatics Core
# Harvard School of Public Health
####
#term = "GO:0007050"
#gost_loc = "http://biit... | 2.234375 | 2 |
glue/core/exceptions.py | HPLegion/glue | 550 | 25177 | <gh_stars>100-1000
class IncompatibleAttribute(Exception):
pass
class IncompatibleDataException(Exception):
pass
class UndefinedROI(Exception):
pass
class InvalidSubscriber(Exception):
pass
class InvalidMessage(Exception):
pass
| 1.617188 | 2 |
deploy/proc_vector.py | loadwiki/insightface | 0 | 25178 | <gh_stars>0
import face_model
import argparse
import os
import cv2
import sys
import numpy as np
parser = argparse.ArgumentParser(description='face model test')
# general
parser.add_argument('--image-size', default='112,112', help='')
parser.add_argument('--enable-gpu', default=False, type=bool, help='enable to detect... | 2.53125 | 3 |
word2vec_model/BagCentroids.py | wingedRuslan/Sentiment-Analysis | 0 | 25179 |
def create_bag_of_centroids(wordlist, word_centroid_map):
"""
a function to create bags of centroids
"""
# The number of clusters is equal to the highest cluster index in the word / centroid map
num_centroids = max( word_centroid_map.values() ) + 1
# Pre-allocate the bag of centro... | 3.6875 | 4 |
build/lib/scripts/series_tools.py | nicolas998/ifis_tools | 3 | 25180 | # ---
# jupyter:
# jupytext:
# formats: jupyter_scripts//ipynb,scripts//py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 1.0.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s... | 3.09375 | 3 |
readthedocs/proxito/views/mixins.py | dojutsu-user/readthedocs.org | 0 | 25181 | <reponame>dojutsu-user/readthedocs.org<filename>readthedocs/proxito/views/mixins.py
import logging
import mimetypes
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.http import HttpResponse
from django.shortcuts import render
from django.utils.encoding import iri_to_... | 2.15625 | 2 |
helper.py | whs2k/googleAlerts | 0 | 25182 | <filename>helper.py
import requests
import pandas as pd
import tweepy #for twitter
import os
from bs4 import BeautifulSoup
import praw #for reddit
import requests
import requests.auth
def getTweets(search_terms=['counterfeit','amazonHelp']):
consumer_key = '6CM1Yqk0Qz6KUXsDQUS8xmahS'
consumer_secret = '<KEY>'
acc... | 3.109375 | 3 |
students/k3343/laboratory_works/Berezhnova_Marina/laboratory_work_1/django_project_flights/flights_app/models.py | TonikX/ITMO_ICT_-WebProgramming_2020 | 10 | 25183 | <gh_stars>1-10
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Companies(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return "{}".format(self.name)
class Gates(models.Model):
name = models.CharField(max_length=... | 2.46875 | 2 |
face_recognition/claudia/main_engine.py | hzitoun/TripletLossFace | 88 | 25184 | <reponame>hzitoun/TripletLossFace
import tensorflow as tf
import sys
import json
import numpy as np
import cv2
from tqdm import tqdm
sys.path.append("../")
from deep_learning.make_better_dataset_for_deepfake.main_data_creator import FaceExtractor
class Claudia:
def load_full(self, path):
image = tf.io.read_file(p... | 2.140625 | 2 |
django_test/articles/migrations/0008_auto_20200306_1955.py | MachineLearningIsEasy/python_lesson_22 | 1 | 25185 | <reponame>MachineLearningIsEasy/python_lesson_22
# Generated by Django 3.0.3 on 2020-03-06 19:55
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0007_auto_20200306_1946'),
]
operations = [
migrations.AlterFie... | 2.34375 | 2 |
models/002_auth.py | ecohealthalliance/sicki | 0 | 25186 | <gh_stars>0
from gluon.tools import Auth
auth = Auth(db, hmac_key=Auth.get_or_create_key())
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
auth.define_tables ()
admin_role = auth.id_group ("Admini... | 2.203125 | 2 |
utils/data_utils.py | a514514772/Hijackgan | 36 | 25187 | # +
import argparse
import os
import pickle
import sys
sys.path.append("..")
import numpy as np
import torchvision
import torchvision.transforms as T
import torch.utils.data as torch_data
from tqdm import tqdm
from models.classifiers import EvalCompoundResNet
# -
def parse_args():
parser = argparse.ArgumentPar... | 2.109375 | 2 |
membership/urls.py | kay-han/building-blog | 0 | 25188 | <gh_stars>0
from django.urls import path
from .views import UserRegisterView, UserEditView, PasswordsChangeView
from django.contrib.auth import views as auth_views #It allows using some of the views that come with the authentication system comes with django
from . import views
urlpatterns = [
path('registeration/... | 1.976563 | 2 |
numpan/pan03.py | jaywoong/python | 0 | 25189 | <reponame>jaywoong/python<filename>numpan/pan03.py
import pandas as pd;
import numpy as np;
data1 = ['A',2];
data2 = ['B',4];
df1 = pd.DataFrame([data1,data2]);
print(df1);
data = {'subject' : ['math', 'comp', 'phys', 'chem'],
'score': [100, 90, 85, 95],
'students': [94, 32, 83, 17]};
df2 = pd.DataFr... | 3.75 | 4 |
astrochem_ml/__init__.py | laserkelvin/astrochem_ml | 0 | 25190 | """Top-level package for Astrochem ML."""
from astrochem_ml import smiles, classes
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 1.085938 | 1 |
hexastore/bisect.py | alexchamberlain/mutant | 3 | 25191 | <reponame>alexchamberlain/mutant
"""Bisection algorithms."""
from typing import Callable, Optional, Sequence, TypeVar, cast
from .typing import Comparable
T = TypeVar("T")
U = TypeVar("U", bound=Comparable)
def bisect_left(
a: Sequence[T], x: T, lo: int = 0, hi: Optional[int] = None, key: Optional[Callable[[T]... | 3.5 | 4 |
tests/fdb.py | OriolOMM/fdb | 0 | 25192 | <filename>tests/fdb.py<gh_stars>0
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
from datetime import datetime
import time
import paho.mqtt.client as mqtt
def button_callback(channel):
print(str(datetime.now()) + "Button was pushed!")
trigger()
time.sleep(2)
# The callback for when the client... | 3.03125 | 3 |
test.py | eldinsahbaz/MetaheuristicOptimization | 1 | 25193 | <reponame>eldinsahbaz/MetaheuristicOptimization
import PSO
import numpy as np
from pprint import pprint
from functools import partial
# Define the details of the table design problem
def objective_one(x):
i = 0.001
return -((1/((2*np.pi)**0.5))*np.exp(-0.5*((((x[0]-1.5)*(x[0]-1.5)+(x[1]-1.5)*(x[1]-1.5))/0.5)*... | 2.640625 | 3 |
autokey/data/My Phrases/viniciusban/terminal/kubectl exec -it from clipboard.py | viniciusban/dotfiles | 0 | 25194 | # Enter script code
message = "kubectl exec -it <cursor> -- bash"
keyboard.send_keys("kubectl exec -it ")
keyboard.send_keys("<shift>+<ctrl>+v")
time.sleep(0.1)
keyboard.send_keys(" -- bash")
| 1.75 | 2 |
05. DiagonalDifference/solution.py | avishkar2001/AlgorithmHackerRank | 11 | 25195 | '''
Topic : Algorithms
Subtopic : Diagonal Difference
Language : Python
Problem Statement : Given a square matrix, calculate the absolute difference between the sums of its diagonals.
Url : https://www.hackerrank.com/challenges/diagonal-difference/problem
'''
#!/bin/python3
# Complete the 'diagonalD... | 3.953125 | 4 |
codeforces/dp动态规划/800/702A最大上升子列.py | yofn/pyacm | 0 | 25196 | <reponame>yofn/pyacm
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/702/A
#严格来说不能算DP?
_ = input()
l = list(map(int,input().split())) #https://codeforces.com/blog/entry/71884
maxL = 1
curL = 1
for i in range(1,len(l)):
if l[i]<=l[i-1]:
curL = 1
continue
curL += 1
if cu... | 2.921875 | 3 |
pyrobolearn/algos/fd.py | Pandinosaurus/pyrobolearn | 2 | 25197 | <filename>pyrobolearn/algos/fd.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provide the Finite-Difference (FD) method algorithm.
This FD method is a policy gradient algorithm that explores in the parameter space of the policy in an episodic way.
"""
import numpy as np
import torch
from pyrobolearn.envs import... | 3 | 3 |
example/rest/system_rest_example.py | bitcom-exchange/bitcom-python-api | 4 | 25198 | from bitcom.client.system_client import SystemClient
from bitcom.utils import *
from bitcom.constant import *
system_client = SystemClient(url=USER1_HOST, access_key=USER1_ACCESS_KEY, secret_key=USER1_SECRET_KEY)
timestamp_response = system_client.get_system_timestamp()
LogInfo.output("Get server timestamp: ", timesta... | 2.265625 | 2 |
gg_gui/gui/gg_start.py | ealcobaca/optimizer_pool | 1 | 25199 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/GG_start.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from utilGui import Names
class Ui_main_window(object):
def setupUi(self... | 2.15625 | 2 |