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 |
|---|---|---|---|---|---|---|
tf_idf.py | ricosr/retrieval_chatbot | 16 | 12300 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import pickle
import os
import jieba
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.externals import joblib
from sklearn.metrics.pairwise import cosine_similarity
class TfIdf:
def __init__(self, config):
self.config = config
sel... | 2.375 | 2 |
d373c7/pytorch/models/classifiers.py | t0kk35/d373c7 | 1 | 12301 | <gh_stars>1-10
"""
Module for classifier Models
(c) 2020 d373c7
"""
import logging
import torch
import torch.nn as nn
from .common import PyTorchModelException, ModelDefaults, _History, _ModelGenerated, _ModelStream
from .encoders import GeneratedAutoEncoder
from ..layers import LSTMBody, ConvolutionalBody1d, Attention... | 2.15625 | 2 |
qklnn/plots/hyperpar_scan.py | cambouvy/BSc-Thesis-Project | 1 | 12302 | <filename>qklnn/plots/hyperpar_scan.py
import re
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.use("pdf")
import matplotlib.pyplot as plt
from matplotlib import gridspec
from peewee import AsIs, JOIN, prefetch, SQL
from IPython import embed
from bokeh.layouts import row, column
from bokeh.plott... | 2.40625 | 2 |
py3canvas/tests/shared_brand_configs.py | tylerclair/py3canvas | 0 | 12303 | <filename>py3canvas/tests/shared_brand_configs.py
"""SharedBrandConfigs API Tests for Version 1.0.
This is a testing template for the generated SharedBrandConfigsAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.shared_brand_configs import SharedBrandConfigsAPI
from py3canvas.apis.share... | 2.375 | 2 |
apps/cars/tests/api/abstract/abstract_base_api_test.py | agorsk1/car-rating-app | 1 | 12304 | from abc import ABC, abstractmethod
from django.test import TestCase
from rest_framework.generics import GenericAPIView
from rest_framework.test import APIRequestFactory
from apps.cars.factory import UserFactory
class AbstractBaseTest(object):
class AbstractBaseApiTestCase(TestCase, ABC):
"""
A... | 2.53125 | 3 |
templating-tool.py | salayatana66/vw-serving-flask | 4 | 12305 | """
A simple templating tool for Dockerfiles
"""
import sys
import os
import click
import jinja2
import yaml
@click.group()
def cli():
""" @Unimplemented """
pass
@cli.command()
@click.argument("template", required=True, type=str)
@click.option("-y", "--yaml_file", required=True,
help="Yaml ... | 2.875 | 3 |
verbforms.py | wmcooper2/Clean-Code-English-Tests | 0 | 12306 | """File for holding the different verb forms for all of the verbs in the Total
English book series."""
verb_forms = {
'become' :
{
'normal' : 'become',
'present' : ['become','becomes'],
'past' : 'became',
'past participle' : 'become',
'gerund' : 'becoming',
},
'be':
{
'n... | 2.578125 | 3 |
bokeh/themes/__init__.py | quasiben/bokeh | 0 | 12307 | <reponame>quasiben/bokeh
''' Provides API for loading themes
'''
from __future__ import absolute_import
from os.path import join
from .theme import Theme
default = Theme(json={})
del join
| 1.179688 | 1 |
files/spam-filter/tracspamfilter/captcha/keycaptcha.py | Puppet-Finland/puppet-trac | 0 | 12308 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 <NAME> <<EMAIL>>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software con... | 2.1875 | 2 |
app/model/causalnex.py | splunk/splunk-mltk-container-docker | 20 | 12309 | #!/usr/bin/env python
# coding: utf-8
# In[18]:
# this definition exposes all python module imports that should be available in all subsequent commands
import json
import numpy as np
import pandas as pd
from causalnex.structure import DAGRegressor
from sklearn.model_selection import cross_val_score
from sklear... | 2.765625 | 3 |
Assignment1/Q4/q4.py | NavneelSinghal/COL774 | 0 | 12310 | import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
matplotlib.use('Agg')
import math
import numpy as np
import sys
from os.path import join, isfile
import warnings
warnings.filterwarnings("ignore")
def gda(x, y):
x = x.T
y = y.T
# phi = P(y = 1)
# mu[i] = mea... | 3.0625 | 3 |
var/spack/repos/builtin/packages/bcache/package.py | milljm/spack | 0 | 12311 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bcache(MakefilePackage):
"""Bcache is a patch for the Linux kernel to use SSDs to cache ot... | 1.703125 | 2 |
core/migrations/0010_wagtailsitepage_screenshot.py | admariner/madewithwagtail | 0 | 12312 | <filename>core/migrations/0010_wagtailsitepage_screenshot.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 23:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0009_wagtail112upgrade'),
]
operations = [
migrations... | 1.632813 | 2 |
circuitpython/schedule.py | Flameeyes/birch-books-smarthome | 0 | 12313 | # SPDX-FileCopyrightText: © 2020 The birch-books-smarthome Authors
# SPDX-License-Identifier: MIT
BOOKSTORE_GROUND_FLOOR = 0x0007
BOOKSTORE_FIRST_FLOOR = 0x0008
BOOKSTORE_TERRARIUM = 0x0010
BOOKSTORE_BEDROOM = 0x0020
HOUSE_BASEMENT = 0x0040
HOUSE_GROUND_FLOOR = 0x0380
HOUSE_BEDROOM_LIGHT = 0x0400
HOUSE_BEDROOM_LAMP = ... | 1.304688 | 1 |
imdb/utils.py | rinkurajole/imdb_sanic_app | 0 | 12314 | import bcrypt
salt = bcrypt.gensalt()
def generate_hash(passwd, salt=salt):
return str(bcrypt.hashpw(passwd, salt))
def match_password(req_pwd, db_pwd):
db_pwd = db_pwd.replace('b\'','').replace('\'','').encode('utf-8')
return db_pwd == bcrypt.hashpw(req_pwd, db_pwd)
| 2.921875 | 3 |
test/test_modules/test_math.py | dragonteros/unsuspected-hangeul | 62 | 12315 | from test.test_base import TestBase
class TestMath(TestBase):
def test_isclose(self):
_test = self._assert_execute
_test('ㄹ (ㄱㅇㄱ ㄱㅇㄱ ㄴㄱ ㅅㅎㄷ ㄱㅎㄷ ㄴ (ㅂ ㅅ ㄱ ㅂㅎㄹ)ㅎㄷㅎ)ㅎㄴ', 'True')
_test('ㅂ ㅅ ㅂ ㅂㅎㄹ (ㄱㅇㄱ ㄱㅇㄱ ㄴㄱ ㅅㅎㄷ ㄱㅎㄷ ㄴ (ㅂ ㅅ ㄱ ㅂㅎㄹ)ㅎㄷㅎ)ㅎㄴ', 'True')
_test('ㅂ ㅅ ㅈ ㅂㅎㄹ (ㄱㅇㄱ ㄱㅇㄱ ㄴㄱ ㅅㅎㄷ ㄱㅎㄷ ㄴ (ㅂ... | 2.578125 | 3 |
services/smtp.py | sourceperl/docker.mqttwarn | 0 | 12316 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright 2014 <NAME>'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
import smtplib
from email.mime.text import MIMEText
def plugin(srv, item):
srv.logging.debug("... | 2.375 | 2 |
xknx/knxip/disconnect_request.py | Trance-Paradox/xknx | 0 | 12317 | """
Module for Serialization and Deserialization of a KNX Disconnect Request information.
Disconnect requests are used to disconnect a tunnel from a KNX/IP device.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from xknx.exceptions import CouldNotParseKNXIP
from .body import KNXIPBody
from ... | 2.625 | 3 |
src/database_setup.py | liuchanglilian/crowdsourcing-text-msg | 0 | 12318 | from src.sqlite_helper import create_message_table, drop_message_table
"""
This script will create a SQLite table for you, and should be one time setup
The table name is message which will store all the Post message
"""
create_message_table()
"""
If you need to drop the message table, un-comment the following code ... | 3 | 3 |
home/pedrosenarego/zorba/zorba1.0.py | rv8flyboy/pyrobotlab | 63 | 12319 | <gh_stars>10-100
from java.lang import String
import threading
import random
import codecs
import io
import itertools
import time
import os
import urllib2
import textwrap
import socket
import shutil
#############################################################
# This is the ZOrba
#
#################################... | 2.453125 | 2 |
pocs/tests/test_state_machine.py | zacharyt20/POCS | 1 | 12320 | <reponame>zacharyt20/POCS
import os
import pytest
import yaml
from pocs.core import POCS
from pocs.observatory import Observatory
from pocs.utils import error
@pytest.fixture
def observatory():
observatory = Observatory(simulator=['all'])
yield observatory
def test_bad_state_machine_file():
with pytes... | 2.125 | 2 |
code/BacDup/scripts/gff_parser.py | JFsanchezherrero/TFM_UOC_AMoya | 2 | 12321 | <reponame>JFsanchezherrero/TFM_UOC_AMoya
#!/usr/bin/env python3
##############################################################
## <NAME> & <NAME> ##
## Copyright (C) 2020-2021 ##
##############################################################
'''
Created on 2... | 2.296875 | 2 |
PAL/Cross/client/sources-linux/build_library_zip.py | infosecsecurity/OSPTF | 2 | 12322 | <filename>PAL/Cross/client/sources-linux/build_library_zip.py<gh_stars>1-10
import sys
from distutils.core import setup
import os
from glob import glob
import zipfile
import shutil
sys.path.insert(0, os.path.join('resources','library_patches'))
sys.path.insert(0, os.path.join('..','..','pupy'))
import pp
import addit... | 2.0625 | 2 |
conans/test/functional/old/short_paths_test.py | Manu343726/conan | 0 | 12323 | <gh_stars>0
import os
import platform
import unittest
from conans.model.ref import ConanFileReference
from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient
class ShortPathsTest(unittest.TestCase):
@unittest.skipUnless(platform.system() == "Windows", "Requires Windows")
def inconsistent_cach... | 2.34375 | 2 |
data_collection/json2mongodb.py | kwond2/hedgehogs | 9 | 12324 | <reponame>kwond2/hedgehogs
#-*- coding: utf-8 -*-
# import os
# from optparse import OptionParser
# from pymongo import MongoClient, bulk
# import json
# import collections
# import sys
from import_hedgehogs import *
HOST = '172.16.17.32'
PORT = 27017
DB = 'SEC_EDGAR'
class OrderedDictWithKeyEscaping(collections.Or... | 2.34375 | 2 |
scripts/convert_to_singlehead.py | Lollipop321/mini-decoder-network | 1 | 12325 | <filename>scripts/convert_to_singlehead.py
import torch
import math
import time
import struct
import argparse
import numpy as np
from collections import OrderedDict
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-model', required=True, help="trained model prefix, also includ... | 2.375 | 2 |
tests/integration/frameworks/test_detectron2_impl.py | francoisserra/BentoML | 1 | 12326 | import typing as t
from typing import TYPE_CHECKING
import numpy as np
import torch
import pytest
import imageio
from detectron2 import model_zoo
from detectron2.data import transforms as T
from detectron2.config import get_cfg
from detectron2.modeling import build_model
import bentoml
if TYPE_CHECKING:
from det... | 2.125 | 2 |
molecule/default/tests/test_default.py | escalate/ansible-influxdb-docker | 0 | 12327 | """Role testing files using testinfra"""
def test_config_directory(host):
"""Check config directory"""
f = host.file("/etc/influxdb")
assert f.is_directory
assert f.user == "influxdb"
assert f.group == "root"
assert f.mode == 0o775
def test_data_directory(host):
"""Check data directory""... | 2.140625 | 2 |
ZIP-v0.01/Serial_to_MQTT.py | JittoThomas/IOT | 0 | 12328 | <gh_stars>0
#!/usr/bin/env python
import cayenne.client, datetime, time, serial
# import random
#Delay Start
#print "Time now = ", datetime.datetime.now().strftime("%H-%M-%S")
#time.sleep(60)
#print "Starting now = ", datetime.datetime.now().strftime("%H-%M-%S")
# Cayenne authentication info. This should be obtained ... | 2.828125 | 3 |
test/test_slimta_queue_proxy.py | nanojob/python-slimta | 141 | 12329 | <reponame>nanojob/python-slimta<filename>test/test_slimta_queue_proxy.py<gh_stars>100-1000
import unittest
from mox3.mox import MoxTestBase, IsA
from slimta.queue.proxy import ProxyQueue
from slimta.smtp.reply import Reply
from slimta.relay import Relay, TransientRelayError, PermanentRelayError
from slimta.envelope i... | 2.171875 | 2 |
tests/potential/EamPotential/Al__born_exp_fs/test____init__.py | eragasa/pypospack | 4 | 12330 | import pytest
from pypospack.potential import EamPotential
symbols = ['Al']
func_pair_name = "bornmayer"
func_density_name = "eam_dens_exp"
func_embedding_name = "fs"
expected_parameter_names_pair_potential = []
expected_parameter_names_density_function = []
expected_parameter_names_embedding_function = []
expected_... | 2.375 | 2 |
backend/bin/main/enrichers/enricher.py | anjo-ba/PCAP-Analyzer | 4 | 12331 | from typing import Dict
from main.helpers.print_helper import PrintHelper
class Enricher(object):
def __init__(self, enricher_type: str, header: str) -> None:
self.enricher_type = enricher_type
self.header = header
def get_information(self, packet: Dict[str, str], information_dict) -> None:
... | 2.671875 | 3 |
Modulo_5/proyecto/presentacion/form_ubicacion/formAUbicacion_designer.py | AutodidactaMx/cocid_python | 0 | 12332 | <reponame>AutodidactaMx/cocid_python
import tkinter as tk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from pandastable import Table
import util.generic as utl
class FormUbicacionDesigner(tk.Toplevel):
def __init__(self):
super().__init__()
... | 2.625 | 3 |
injector/__init__.py | vnepomuceno/kafka-events-injector | 0 | 12333 | import coloredlogs
coloredlogs.install()
custom_logger = logging.getLogger(name)
coloredlogs.install(level="INFO", logger=custom_logger)
| 1.710938 | 2 |
setup.py | Lcvette/qtpyvcp | 71 | 12334 | <reponame>Lcvette/qtpyvcp
import os
import versioneer
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
if os.getenv('DEB_BUILD') == 'true' or os.getenv('USER') == 'root':
"/usr/share/doc/linuxcnc/examples/sample-configs/sim"
# list of (destinatio... | 1.539063 | 2 |
hidparser/UsagePage.py | NZSmartie/PyHIDParser | 22 | 12335 | from enum import Enum as _Enum
class UsageType(_Enum):
CONTROL_LINEAR = ()
CONTROL_ON_OFF = ()
CONTROL_MOMENTARY = ()
CONTROL_ONE_SHOT = ()
CONTROL_RE_TRIGGER = ()
DATA_SELECTOR = ()
DATA_STATIC_VALUE = ()
DATA_STATIC_FLAG = ()
DATA_DYNAMIC_VALUE = ()
DATA_DYNAMIC_FLAG = ()
... | 2.640625 | 3 |
sandbox/lib/jumpscale/JumpscaleLibs/tools/legal_contracts/LegalDoc.py | threefoldtech/threebot_prebuilt | 2 | 12336 | from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate, Paragraph
class LegalDoc:
def __init__(self, path):
self.path = path
styles = getSampleStyleSheet()
... | 2.578125 | 3 |
tests/outcome/test_outcome_models.py | ConnorBarnhill/kf-api-dataservice | 6 | 12337 | from datetime import datetime
import uuid
from sqlalchemy.exc import IntegrityError
from dataservice.api.study.models import Study
from dataservice.api.participant.models import Participant
from dataservice.api.outcome.models import Outcome
from dataservice.extensions import db
from tests.utils import FlaskTestCase
... | 2.640625 | 3 |
sapextractor/utils/fields_corresp/extract_dd03t.py | aarkue/sap-meta-explorer | 2 | 12338 | def apply(con, target_language="E"):
dict_field_desc = {}
try:
df = con.prepare_and_execute_query("DD03T", ["DDLANGUAGE", "FIELDNAME", "DDTEXT"], " WHERE DDLANGUAGE = '"+target_language+"'")
stream = df.to_dict("records")
for el in stream:
dict_field_desc[el["FIELDNAME"]] = e... | 2.453125 | 2 |
app/forms/fields/month_year_date_field.py | ons-eq-team/eq-questionnaire-runner | 0 | 12339 | import logging
from werkzeug.utils import cached_property
from wtforms import FormField, Form, StringField
logger = logging.getLogger(__name__)
def get_form_class(validators):
class YearMonthDateForm(Form):
year = StringField(validators=validators)
month = StringField()
@cached_property... | 2.4375 | 2 |
inf_classif_analysis/descriptive_analysis.py | Marco-Ametrano/myocardal_infarction_class | 0 | 12340 | #AFTER PREPROCESSING AND TARGETS DEFINITION
newdataset.describe()
LET_IS.value_counts()
LET_IS.value_counts().plot(kind='bar', color='c')
Y_unica.value_counts()
Y_unica.value_counts().plot(kind='bar', color='c')
ZSN.value_counts().plot(kind='bar', color='c')
Survive.value_counts().plot(kind='bar', color='c')
| 1.65625 | 2 |
src/service/eda_service.py | LiuYuWei/service-data-eda-analysis | 0 | 12341 | <reponame>LiuYuWei/service-data-eda-analysis
"""Confusion matrix calculation service."""
# coding=utf-8
# import relation package.
from pandas_profiling import ProfileReport
import pandas as pd
import datetime
import json
# import project package.
from config.config_setting import ConfigSetting
class EdaService:
... | 2.578125 | 3 |
google/cloud/bigquery_v2/types/__init__.py | KoffieLabs/python-bigquery | 0 | 12342 | <filename>google/cloud/bigquery_v2/types/__init__.py
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | 1.585938 | 2 |
blurr/core/store.py | ddrightnow/blurr | 0 | 12343 | from abc import abstractmethod, ABC
from datetime import datetime, timezone
from typing import Any, List, Tuple, Dict
from blurr.core.base import BaseSchema
from blurr.core.store_key import Key, KeyType
class StoreSchema(BaseSchema):
pass
class Store(ABC):
""" Base Store that allows for data to be persiste... | 2.890625 | 3 |
seamless/core/cache/tempref.py | sjdv1982/seamless | 15 | 12344 | import time, copy
import asyncio
class TempRefManager:
def __init__(self):
self.refs = []
self.running = False
def add_ref(self, ref, lifetime, on_shutdown):
expiry_time = time.time() + lifetime
self.refs.append((ref, expiry_time, on_shutdown))
def purge_all(self):
... | 2.640625 | 3 |
lib/python27/Lib/site-packages/wx-2.8-msw-ansi/wx/tools/Editra/src/eclib/choicedlg.py | bo3b/iZ3D | 27 | 12345 | <gh_stars>10-100
###############################################################################
# Name: choicedlg.py #
# Purpose: Generic Choice Dialog #
# Author: <NAME> <<EMAIL>> #
#... | 2.09375 | 2 |
shopyo/__init__.py | rehmanis/shopyo2 | 2 | 12346 | <reponame>rehmanis/shopyo2
version_info = (4, 0, 1)
__version__ = ".".join([str(v) for v in version_info])
| 1.585938 | 2 |
check_digit_calc.py | zhoffm/Check-Digit-Calculator | 1 | 12347 | <reponame>zhoffm/Check-Digit-Calculator
from random import randint
import pandas as pd
def random_11_digit_upc():
upc_string = ''.join(["%s" % randint(0, 9) for num in range(0, 11)])
print(upc_string)
return upc_string
# Class to calculate the check digit for 11 digit UPC's
class CheckDigitCalculations... | 3.921875 | 4 |
test/test_load.py | ramsdalesteve/forest | 0 | 12348 | import yaml
import forest
from forest import main
def test_earth_networks_loader_given_pattern():
loader = forest.Loader.from_pattern("Label", "EarthNetworks*.txt", "earth_networks")
assert isinstance(loader, forest.earth_networks.Loader)
def test_build_loader_given_files():
"""replicate main.py as clos... | 2.53125 | 3 |
tournaments/binarySearch/binarySearch.py | gurfinkel/codeSignal | 5 | 12349 | def binarySearch(inputArray, searchElement):
minIndex = -1
maxIndex = len(inputArray)
while minIndex < maxIndex - 1:
currentIndex = (minIndex + maxIndex) // 2
currentElement = inputArray[currentIndex]
if currentElement < searchElement:
minIndex = currentIndex
... | 3.8125 | 4 |
swagger_server/models/rule.py | Capping-WAR/API | 0 | 12350 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class Rule(Model):
"""NOTE: This class is auto generated by the swagger code g... | 2.296875 | 2 |
Project1/mazes/gen_sparses.py | VFerrari/MC906 | 0 | 12351 | <filename>Project1/mazes/gen_sparses.py
import os
import re
import numpy as np
# WARNING: this function overrides the mazes in sparse directory; don't run it
# as the idea is that everyone test the same mazes
def gen_sparses(dir_path):
''' Randomly remove points from dense instances '''
pattern = re.compile('^([... | 3.09375 | 3 |
cryomem/cmtools/lib/jjivarray2.py | bebaek/cryomem | 1 | 12352 | <reponame>bebaek/cryomem<filename>cryomem/cmtools/lib/jjivarray2.py
"""
Analyze JJ IV curve array (core) v.2
BB, 2016
"""
import numpy as np
from . import jjiv2 as jjiv
import sys
def fit2rsj_arr(iarr, varr, **kwargs):
"""Fit IV array to 2 Ic RSJ model and return arrays of fit params, error.
Keyword argumen... | 2.078125 | 2 |
python/0122.py | garywei944/LeetCode | 0 | 12353 | from leetcode_tester import Tester
from typing import Optional, List
class Solution:
def maxProfit(self, prices: List[int]) -> int:
r = 0
for i in range(1, len(prices)):
if prices[i] > prices[i - 1]:
r += prices[i] - prices[i - 1]
return r
if __name__ == '__m... | 3.359375 | 3 |
dataset.py | songrotek/wechat_jump_end_to_end_train | 26 | 12354 | import torch
import json
import os
from torch.utils.data import DataLoader,Dataset
import torchvision.transforms as transforms
from PIL import Image
import numpy as np
data_folder = "./dataset/images"
press_times = json.load(open("./dataset/dataset.json"))
image_roots = [os.path.join(data_folder,image_file) \
... | 2.609375 | 3 |
grafana_backup/create_snapshot.py | Keimille/grafana-backup-tool | 515 | 12355 | import json
from grafana_backup.dashboardApi import create_snapshot
def main(args, settings, file_path):
grafana_url = settings.get('GRAFANA_URL')
http_post_headers = settings.get('HTTP_POST_HEADERS')
verify_ssl = settings.get('VERIFY_SSL')
client_cert = settings.get('CLIENT_CERT')
debug = setting... | 2.5 | 2 |
examples/keras_ssd_example.py | jiayunhan/perceptron-benchmark | 38 | 12356 | """ Test case for Keras """
from perceptron.zoo.ssd_300.keras_ssd300 import SSD300
from perceptron.models.detection.keras_ssd300 import KerasSSD300Model
from perceptron.utils.image import load_image
from perceptron.benchmarks.brightness import BrightnessMetric
from perceptron.utils.criteria.detection import Targ... | 2.609375 | 3 |
math/470.ImplementRand10UsingRand7.py | bzd111/leetcode | 0 | 12357 | <reponame>bzd111/leetcode
import sys
def rand7() -> int:
...
class Solution:
def rand10(self) -> int:
index = sys.maxsize
while index > 40:
index = 7 * (rand7() - 1) + rand7() - 1
return index % 10 + 1
| 2.953125 | 3 |
segmentation/data/transforms/__init__.py | RajasekharChowdary9/panoptic-deeplab | 506 | 12358 | <gh_stars>100-1000
from .build import build_transforms
from .pre_augmentation_transforms import Resize
from .target_transforms import PanopticTargetGenerator, SemanticTargetGenerator
| 1.109375 | 1 |
plasmapy/diagnostics/proton_radiography.py | MarikinPaulina/PlasmaPy | 0 | 12359 | """
Routines for the analysis of proton radiographs. These routines can be broadly
classified as either creating synthetic radiographs from prescribed fields or
methods of 'inverting' experimentally created radiographs to reconstruct the
original fields (under some set of assumptions).
"""
__all__ = [
"SyntheticPr... | 2.625 | 3 |
polyengine/switch_start.py | AkanshDivker/polyengine | 5 | 12360 | # switch_start.py
# Adding another switch statement
# Authors : <NAME>
import string
import random
class Switch_Start:
def __init__(self, str):
self.string = str
def insert_switch(self, str):
#generate random variable
_LENGTH = 11
string_pool = string.ascii_lette... | 3.75 | 4 |
focal_mech/demo/test6.py | blasscoc/FocalMechClassifier | 12 | 12361 | from numpy import array, rad2deg, pi, mgrid, argmin
from matplotlib.pylab import contour
import matplotlib.pyplot as plt
import mplstereonet
from obspy.imaging.beachball import aux_plane
from focal_mech.lib.classify_mechanism import classify, translate_to_sphharm
from focal_mech.io.read_hash import read_demo, read_h... | 1.992188 | 2 |
gigantumcli/changelog.py | fossabot/gigantum-cli | 0 | 12362 | <filename>gigantumcli/changelog.py
# Copyright (c) 2017 FlashX, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, co... | 2.328125 | 2 |
main_old/understanding_smoothing_microsoft.py | benjaminleroy/smooth_rf | 3 | 12363 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sklearn.ensemble
import sklearn.metrics
import sklearn
import progressbar
import sklearn.model_selection
from plotnine import *
import pdb
import sys
sys.path.append("smooth_rf/")
import smooth_base
import smooth_level
# function
def aver... | 2.703125 | 3 |
AER/Experiments/Metrics.py | LeBenchmark/Interspeech2021 | 48 | 12364 | <reponame>LeBenchmark/Interspeech2021
import numpy as np
def CCC(y_true, y_pred):
"""
Calculate the CCC for two numpy arrays.
"""
x = y_true
y = y_pred
xMean = x.mean()
yMean = y.mean()
xyCov = (x * y).mean() - (xMean * yMean)
# xyCov = ((x-xMean) * (y-yMean)).mean()
xVar = x.va... | 2.96875 | 3 |
myo/device_listener.py | ehliang/myo-unlock | 1 | 12365 | <filename>myo/device_listener.py
# Copyright (c) 2015 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | 2.203125 | 2 |
utilities/poisson.py | lukepinkel/pylmm | 0 | 12366 | <reponame>lukepinkel/pylmm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 12 13:34:49 2020
@author: lukepinkel
"""
import numpy as np
import scipy as sp
import scipy.special
def poisson_logp(x, mu, logp=True):
p = sp.special.xlogy(x, mu) - sp.special.gammaln(x + 1) - mu
if logp==False... | 2.109375 | 2 |
iotest.py | AaltoRSE/ImageNetTools | 1 | 12367 | '''
Created on Sep 29, 2021
@author: thomas
'''
import ImageNetTools
import sys
import getopt
def main(argv):
try:
opts, args = getopt.getopt(argv,"hd:",["dataset="])
except getopt.GetoptError:
printHelp()
sys.exit(2)
for opt, arg in opts:
if opt in... | 2.4375 | 2 |
sagas/tests/sinkers/test_results_render.py | samlet/stack | 3 | 12368 | <filename>sagas/tests/sinkers/test_results_render.py<gh_stars>1-10
"""
$ pytest -s -v test_results_render.py
"""
import logging
import pytest
from sagas.nlu.results_render import ResultsRender
def test_descriptor():
import sagas.nlu.results_render
sagas.nlu.results_render.logger.setLevel(logging.DEBUG)
... | 2.203125 | 2 |
equatation.py | asteinig4018/mhacks19 | 1 | 12369 | import json
import math
from HistoricalTweetDataFetcher import getHistoricalData
joelsarray = getHistoricalData(0)
arrs = []
arrm = []
arrp = []
arrsTotal = 0
arrmTotal = 0
ncount = 0
ccount = 0
lcount = 0
time = joelsarray[0]["h"]
for dictionary in joelsarray:
arrs.append(dictionary["s"])
arrm... | 2.671875 | 3 |
oscar/apps/offer/models.py | endgame/django-oscar | 0 | 12370 | from decimal import Decimal as D, ROUND_DOWN, ROUND_UP
import math
import datetime
from django.core import exceptions
from django.template.defaultfilters import slugify
from django.db import models
from django.utils.translation import ungettext, ugettext as _
from django.utils.importlib import import_module
from djang... | 1.96875 | 2 |
htk-lite/commandlist/help.py | otherbeast/hackers-tool-kit | 393 | 12371 | <reponame>otherbeast/hackers-tool-kit
#!/usr/local/bin/python
# coding: latin-1
#if you use this code give me credit @tuf_unkn0wn
#i do not give you permission to show / edit this script without my credit
#to ask questions or report a problem message me on instagram @tuf_unkn0wn
"""
██░ ██ ▄▄▄ ▄████▄ ██ ▄█▀... | 2.21875 | 2 |
scripts/core/soldier.py | whackashoe/entwinement | 1 | 12372 | d_soldiers = []
class Soldier:
def __init__(self, id, name, team):
self.id = id
self.name = name
self.team = team
self.x = 0
self.y = 0
self.xVelo = 0
self.yVelo = 0
self.kills = 0
self.deaths = 0
self.alive = 'true'
self.driving = 'false'
self.gun = 0
self.ammo = 0
self.reloading = 'fa... | 2.953125 | 3 |
dzTraficoBackend/dzTrafico/BusinessLayer/Statistics/DataVisualizationController.py | DZAymen/dz-Trafico | 0 | 12373 | <reponame>DZAymen/dz-Trafico<filename>dzTraficoBackend/dzTrafico/BusinessLayer/Statistics/DataVisualizationController.py
from dzTrafico.BusinessEntities.Simulation import Simulation
import lxml.etree as etree
class DataVisualizationController(object):
def __init__(self, simulation):
# Initialize necessary... | 2.453125 | 2 |
bunkai/algorithm/lbd/custom_tokenizers.py | megagonlabs/bunkai | 149 | 12374 | #!/usr/bin/env python3
import collections
import logging
import os
import typing
import unicodedata
from janome.tokenizer import Tokenizer
from transformers.file_utils import cached_path
from transformers.models.bert.tokenization_bert import BertTokenizer, WordpieceTokenizer, load_vocab
import bunkai.constant
"""
T... | 2.5625 | 3 |
tests/exchanges_tests.py | tomwalton78/Crypto-Exchange-API-Aggregator | 0 | 12375 | <reponame>tomwalton78/Crypto-Exchange-API-Aggregator<filename>tests/exchanges_tests.py
import unittest
from datetime import datetime
import os
import sys
from api.exchanges.exchange import ExchangeAPICallFailedException
from api.exchanges.gdax_exchange import GdaxExchange
from api.exchanges.kraken_exchange import Krak... | 2.171875 | 2 |
stats/clustering.py | KNSI-Golem/assets-generation | 0 | 12376 | <gh_stars>0
from sklearn.cluster import KMeans
import image_processing
import numpy as np
import some_analysis
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from autoencoder import ConvAutoencoder
input_path = './bin'
output_shape = (32, 48)
processing_output = './processed/results_processing'
data... | 2.484375 | 2 |
CursoEmVideo/Aula22/ex109/ex109.py | lucashsouza/Desafios-Python | 0 | 12377 | <gh_stars>0
"""
Modifique as funções que foram criadas no desafio 107 para
que elas aceitem um parametro a mais, informando se o valor
retornado por elas vai ser ou não formatado pela função
moeda(), desenvolvida no desafio 108.
"""
from Aula22.ex109 import moeda
from Aula22.ex109.titulo import titulo
preco = float(... | 3.34375 | 3 |
mocu/graphical_model/mocu/scripts/visualizetoysystem.py | exalearn/oded | 0 | 12378 | <reponame>exalearn/oded
from mocu.utils.toysystems import *
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def make_rhs_full_system(a,b,k,c,lam,psi,theta):
def rhs_full_system(y,t):
C = c(a,b,k,y[0],psi,theta)
y1_dot = lam[0] * (y[0] - 1)
y2_dot = lam[1] * (y[1] - C) *... | 2.234375 | 2 |
sbm/stochastic_block_model.py | pmacg/pysbm | 1 | 12379 | """
Several methods for generating graphs from the stochastic block model.
"""
import itertools
import math
import random
import scipy.sparse
import numpy as np
def _get_num_pos_edges(c1_size, c2_size, same_cluster, self_loops, directed):
"""
Compute the number of possible edges between two clusters.
:pa... | 3.453125 | 3 |
py_include/__init__.py | mauro-balades/py-include | 2 | 12380 | #!/usr/bin/python3
"""
| --------------------- Py include <Mauro Baladés> ---------------------
| ___ _ _ _ __ _ _ ___ ____
| | |_) \ \_/ | | | |\ | / /` | | | | | | | \ | |_
| |_| |_| |_| |_| \| \_\_, |_|__ \_\_/ |_|_/ |_|__
| -----------------------------------------... | 1.828125 | 2 |
src/scripts/load_data.py | murphycj/agfusionweb-react | 1 | 12381 | <filename>src/scripts/load_data.py
import pyensembl
import sys
import sqlite3
import boto3
import pickle
dynamodb = boto3.resource('dynamodb')
table_agfusion_gene_synonyms = dynamodb.Table('agfusion_gene_synonyms')
table_agfusion_genes = dynamodb.Table('agfusion_genes')
table_agfusion_sequences = dynamodb.Table('agfus... | 2.296875 | 2 |
google-cloud-sdk/lib/third_party/cloud_ml_engine_sdk/dataflow/io/multifiles_source.py | bopopescu/searchparty | 0 | 12382 | <gh_stars>0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the... | 1.625 | 2 |
eureka/S5_lightcurve_fitting/s5_fit.py | evamariaa/Eureka | 15 | 12383 | <reponame>evamariaa/Eureka
import numpy as np
import matplotlib.pyplot as plt
import glob, os, time
from ..lib import manageevent as me
from ..lib import readECF as rd
from ..lib import sort_nicely as sn
from ..lib import util, logedit
from . import parameters as p
from . import lightcurve as lc
from . import models as... | 2.078125 | 2 |
model_compression_toolkit/common/graph/graph_matchers.py | eladc-git/model_optimization | 0 | 12384 | # Copyright 2021 Sony Semiconductors Israel, Inc. 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 b... | 2.375 | 2 |
initialize_app_db.py | daniel-julio-iglesias/microblog | 0 | 12385 | <filename>initialize_app_db.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The next steps use just in case to recreate the already existing DB
Backup and Delete the folder "migrations"
Backup and Delete the file "app.db"
Execute the next console commands
Linux
(venv) $ export FLASK_APP=microblog.py
... | 2.8125 | 3 |
gpytorch/kernels/rbf_kernel.py | techshot25/gpytorch | 1 | 12386 | <reponame>techshot25/gpytorch
#!/usr/bin/env python3
from .kernel import Kernel
from ..functions import RBFCovariance
def postprocess_rbf(dist_mat):
return dist_mat.div_(-2).exp_()
class RBFKernel(Kernel):
r"""
Computes a covariance matrix based on the RBF (squared exponential) kernel
between input... | 2.9375 | 3 |
src/dependenpy/finder.py | gitter-badger/dependenpy | 10 | 12387 | # -*- coding: utf-8 -*-
"""dependenpy finder module."""
from importlib.util import find_spec
from os.path import basename, exists, isdir, isfile, join, splitext
class PackageSpec(object):
"""Holder for a package specification (given as argument to DSM)."""
def __init__(self, name, path, limit_to=None):
... | 2.625 | 3 |
pearsonr/beta.py | rkhullar/pearsonr-pure-python | 0 | 12388 | import math
def contfractbeta(a: float, b: float, x: float, itmax: int = 200) -> float:
# https://malishoaib.wordpress.com/2014/04/15/the-beautiful-beta-functions-in-raw-python/
# evaluates the continued fraction form of the incomplete Beta function; incompbeta()
# code translated from: Numerical Recipes ... | 3.15625 | 3 |
hisim/components/generic_pv_system.py | FZJ-IEK3-VSA/HiSim | 12 | 12389 | <reponame>FZJ-IEK3-VSA/HiSim
# Generic/Built-in
import datetime
import math
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pvlib
from dataclasses_json import dataclass_json
from typing import Optional
from dataclasses import dataclass
from functools import lru_cache
from hisim.... | 1.976563 | 2 |
gQuant/plugins/hrp_plugin/greenflow_hrp_plugin/__init__.py | t-triobox/gQuant | 0 | 12390 | <filename>gQuant/plugins/hrp_plugin/greenflow_hrp_plugin/__init__.py<gh_stars>0
"""
////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) NVIDIA Corporation. All rights reserved.
//
// NVIDIA Sample Code
//
// Please refer to the NVIDIA end user license agreement (EULA... | 1.328125 | 1 |
pythran/tests/rosetta/greatest_subsequential_sum.py | davidbrochart/pythran | 1,647 | 12391 | <gh_stars>1000+
#from http://rosettacode.org/wiki/Greatest_subsequential_sum#Python
#pythran export maxsum(int list)
#pythran export maxsumseq(int list)
#pythran export maxsumit(int list)
#runas maxsum([0, 1, 0])
#runas maxsumseq([-1, 2, -1, 3, -1])
#runas maxsumit([-1, 1, 2, -5, -6])
def maxsum(sequence):
"""Retu... | 2.921875 | 3 |
src/binwalk/__init__.py | dotysan/binwalk | 1 | 12392 | __all__ = ["Binwalk"]
import os
import re
import time
import magic
from binwalk.compat import *
from binwalk.config import *
from binwalk.update import *
from binwalk.filter import *
from binwalk.parser import *
from binwalk.plugins import *
from binwalk.plotter import *
from binwalk.hexdiff import *
from binwalk.entr... | 2.453125 | 2 |
dodo.py | Ublimjo/nwt | 1 | 12393 | <reponame>Ublimjo/nwt
def task_clean_junk():
"""Remove junk file"""
return {
'actions': ['rm -rdf $(find . | grep pycache)'],
'clean': True,
}
| 1.867188 | 2 |
greedy_algorithms/6_maximum_salary/largest_number.py | Desaiakshata/Algorithms-problems | 0 | 12394 | <reponame>Desaiakshata/Algorithms-problems
#Uses python3
import sys
def largest_number(a):
#write your code here
res = ""
while len(a)!=0:
maxa = a[0]
for x in a:
if int(str(x)+str(maxa))>int(str(maxa)+str(x)):
maxa = x
res += str(maxa)
a.remove(... | 3.8125 | 4 |
screenblankmgr.py | nsw42/pijuui | 1 | 12395 | <filename>screenblankmgr.py
import logging
import subprocess
class PlayingState:
Inactive = 0
Active = 1
class ProfileBase:
def __init__(self):
raise NotImplementedError()
def on_start_playing(self):
raise NotImplementedError()
def on_stop_playing(self):
raise NotImplem... | 2.3125 | 2 |
warmmail/subscribe/tasks_send.py | sahilsakhuja/warmmail | 0 | 12396 | # -*- coding: utf-8 -*-
import os
import urllib.parse
from datetime import date, datetime
from functools import partial
from urllib.parse import quote_plus
import pandas as pd
import plotly.express as px
import pytz
from csci_utils.luigi.requires import Requirement, Requires
from csci_utils.luigi.target import Target... | 2.390625 | 2 |
cno/chrutils.py | CherokeeLanguage/cherokee-audio-data | 2 | 12397 | #!/usr/bin/env python3
def test():
cedTest = ["U²sgal²sdi ạ²dv¹ne²³li⁴sgi.", "Ụ²wo²³dị³ge⁴ɂi gi²hli a¹ke²³he³²ga na ạ²chu⁴ja.",
"Ạ²ni²³tạɂ³li ạ²ni²sgạ²ya a¹ni²no²hạ²li²³do³²he, ạ²hwi du¹ni²hyọ²he.",
"Sa¹gwu⁴hno ạ²sgạ²ya gạ²lo¹gwe³ ga²ne²he sọ³ɂị³hnv³ hla².",
"Na³hnv³ gạ... | 1.710938 | 2 |
molo/usermetadata/tests/test_tags.py | praekelt/molo.usermetadata | 0 | 12398 | <reponame>praekelt/molo.usermetadata<filename>molo/usermetadata/tests/test_tags.py
import pytest
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from molo.core.tests.base import MoloTestCaseMixin
from molo.core.models import Main, SiteLanguageRelation, Languages
from molo.usermeta... | 1.796875 | 2 |
app/db_con.py | bmugenya/Zup | 0 | 12399 | import psycopg2
url = "dbname='da43n1slakcjkc' user='msqgxzgmcskvst' host='ec2-54-80-184-43.compute-1.amazonaws.com' port=5432 password='<PASSWORD>'"
class database_setup(object):
def __init__(self):
self.conn = psycopg2.connect(url)
self.cursor = self.conn.cursor()
def destroy_tables(self):... | 2.78125 | 3 |