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 |
|---|---|---|---|---|---|---|
app/api/v2/models/user_model.py | MbuguaCaleb/Questioner-V2-API | 0 | 27400 | <reponame>MbuguaCaleb/Questioner-V2-API<gh_stars>0
from ....db_conn import initialize_db
from psycopg2.extras import RealDictCursor
from werkzeug.security import generate_password_hash,check_password_hash
con = initialize_db()
cur = con.cursor(cursor_factory=RealDictCursor)
class User(object):
table = 'users'
... | 3.0625 | 3 |
Python/17.letter-combinations-of-a-phone-number.py | Dxyk/LeetCode | 0 | 27401 | from typing import Dict, List
class Solution:
DIGIT_TO_LETTER: Dict[str, List[str]] = {
"1": [],
"2": ["a", "b", "c"],
"3": ["d", "e", "f"],
"4": ["g", "h", "i"],
"5": ["j", "k", "l"],
"6": ["m", "n", "o"],
"7": ["p", "q", "r", "s"],
"8": ["t", "u", ... | 4.21875 | 4 |
django-backend/mission/settings_dev_dummy.py | isystematics/SoarCast | 2 | 27402 | from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'mission',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
DEBUG = True
VAULT_HOST = 'http://127.0.0.1:8200'
VAULT_ROOT_PATH = 'mis... | 1.515625 | 2 |
src/moodlews/service.py | pystardust/Welearn-bot | 0 | 27403 | from requests import Session
import urllib.parse
import json
class ServerFunctions:
SITE_INFO = "core_webservice_get_site_info"
ALL_COURSES = "core_course_get_courses_by_field"
USER_COURSES = "core_enrol_get_users_courses"
COURSE_CONTENTS = "core_course_get_contents"
ASSIGNMENTS = "mod_assign_get_a... | 2.71875 | 3 |
agents/wann_agent.py | Miffyli/policy-supervectors | 17 | 27404 | import numpy as np
from gym import spaces
from agents import SimpleAgentClass
# Create agents for the CMA-ES, NEAT and WANN agents
# defined in the weight-agnostic paper repo:
# https://github.com/google/brain-tokyo-workshop/tree/master/WANNRelease/
# ---------------------------------------------------------------... | 3.234375 | 3 |
imagr_users/admin.py | sazlin/cfpydev-imagr | 0 | 27405 | <reponame>sazlin/cfpydev-imagr<gh_stars>0
from django.contrib import admin
from models import ImagrUser, Relationship
# Register your models here.
class ImagrUserAdmin(admin.ModelAdmin):
fields = ('username',
'first_name',
'last_name',
'email',
)
searc... | 1.617188 | 2 |
src/scripts/ia.py | BureauTech/BTAlert-AI | 1 | 27406 | <reponame>BureauTech/BTAlert-AI
import os
import warnings
from datetime import datetime, timedelta
from typing import Tuple
import matplotlib.pyplot as plt
import pandas as pd
from dotenv import load_dotenv
from prometheus_api_client import MetricSnapshotDataFrame, PrometheusConnect
from prometheus_api_client.utils im... | 2.59375 | 3 |
data_loaders/anime_loader.py | dchenam/AnimeGAN | 1 | 27407 | import os
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from PIL import Image
class Anime_Dataset(Dataset):
def __init__(self, config, transform):
self.config = config
self.transform = transform
self.lines = open(config.... | 2.75 | 3 |
bitwarden_pyro/controller/cache.py | apetresc/bitwarden-pyro | 7 | 27408 | <filename>bitwarden_pyro/controller/cache.py
import os
import json
import stat
import time
from bitwarden_pyro.util.logger import ProjectLogger
from bitwarden_pyro.settings import NAME
class CacheMetadata:
"""Model class containing cache metadata"""
def __init__(self, time_created=None, count=None):
... | 2.65625 | 3 |
library/render_partial.py | pythononwheels/diary | 0 | 27409 | <filename>library/render_partial.py
#
# One Tornado UIModule to render them all ;)
#
import tornado.web
class RenderPatialModule(tornado.web.UIModule):
def render(self, partial=None):
return "<h1>Hello, world!</h1><p>" + str(partial) + "</p>" | 2.421875 | 2 |
doc/source/isphx/objpull.py | flying-sheep/sphobjinv | 55 | 27410 | # Quickie script for refreshing the local objects.inv cache
# OVERWRITES EXISTING FILES, WITH PRE-DELETION
def pullobjs():
import os
import urllib.request as urlrq
import certifi
# Open conf.py, retrieve content and compile
with open(os.path.join(os.pardir, 'conf.py'), 'r') as f:
confc... | 2.453125 | 2 |
python-client/cloudera/director/v8/models/__init__.py | daanknoope/director-sdk | 24 | 27411 | <reponame>daanknoope/director-sdk
# coding: utf-8
# flake8: noqa
"""
Licensed to Cloudera, Inc. under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. Cloudera, Inc. licenses this file
to you under the Apache License,... | 0.710938 | 1 |
wagtailshowsimilar/views.py | ongchi/wagtail-showsimilaritems | 0 | 27412 | <filename>wagtailshowsimilar/views.py
from django.apps import apps
from django.views.decorators.http import require_GET
from django.http import JsonResponse
from django.urls import reverse
from wagtail.search.backends import get_search_backend
from wagtail.core.models import Page
backend = get_search_backend()
@requ... | 2.234375 | 2 |
views.py | zhoubogao/hhlyDevops | 0 | 27413 | <reponame>zhoubogao/hhlyDevops
#-*-coding:utf-8-*-
from flask import url_for, redirect, request, current_app
from flask_admin.contrib.sqla import ModelView
from flask_admin import AdminIndexView, helpers, expose
from werkzeug.security import generate_password_hash
from flask_login import current_user, login_user, logou... | 2.0625 | 2 |
unittests/validators.py | lspestrip/stdb2 | 1 | 27414 | <gh_stars>1-10
# -*- encoding: utf-8 -*-
VALID_REPORT_EXTENSIONS = [
'.pdf',
'.doc',
'.docx',
'.html',
'.htm',
'.xsl',
'.xslx',
'.md',
'.rst',
'.zip',
]
def validate_report_file_ext(value):
import os
from django.core.exceptions import ValidationError
ext = os.path... | 2.375 | 2 |
python/demo_confidence_map.py | doublechenching/UltrasondConfienceMap | 13 | 27415 | <filename>python/demo_confidence_map.py
#encoding: utf-8
from __future__ import print_function
from skimage import io
from confidence_map import confidence_map3d, confidence_map2d
import numpy as np
import pydicom
from skimage.external.tifffile import imshow
import time
from matplotlib import pyplot as plt
from skimage... | 2.34375 | 2 |
src/ui/pgUI.py | yuj09161/MoneyManager | 0 | 27416 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'pg.ui'
##
## Created by: Qt User Interface Compiler version 6.0.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
########################... | 1.984375 | 2 |
pyqt_tag_manager/qt_market/animations.py | Nevolutionize/pyqt_tag_manager | 0 | 27417 | <reponame>Nevolutionize/pyqt_tag_manager
# Import external modules.
from pyqt_tag_manager import QtCore
from pyqt_tag_manager import QtGui
from pyqt_tag_manager import QtWidgets
class FailColorAnimation(QtCore.QPropertyAnimation):
"""Property animation to indicate errors.
Displays a color transition as the co... | 2.421875 | 2 |
img.py | NavneetSurana/Animal-Classification-Using-ResNet | 2 | 27418 | import os,sys
import shutil
import pandas as pd
data=pd.read_csv('D:/MachineLearning/AnimalClassification/train.csv')
Im_id=data['Image_id']
Animal=data['Animal']
dic_data=dict()
for i in range(0,len(Im_id)):
dic_data[Im_id[i].strip()]=Animal[i].strip()
source_dir='D:/MachineLearning/AnimalClassification/Images/trai... | 2.5625 | 3 |
tests/test_mgxs_library_ce_to_mg/test_mgxs_library_ce_to_mg.py | scopatz/openmc | 0 | 27419 | #!/usr/bin/env python
import os
import sys
import glob
import hashlib
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from input_set import PinCellInputSet
import openmc
import openmc.mgxs
class MGXSTestHarness(PyAPITestHarness):
def _build_inputs(self):
# Set the input set to ... | 1.960938 | 2 |
setup.py | random1st/cloudwatch-metrics | 1 | 27420 | import os
from setuptools import setup, find_packages
from cloudwatch_metrics.version import VERSION
with open(os.path.join(os.path.dirname(__file__),
'README.md')) as readme:
README = readme.read()
setup(
name='cloudwatch_metrics',
version=VERSION,
description='The Cloudwatch... | 1.414063 | 1 |
app/ref/test-ttyP.py | lucid281/pyEfi | 7 | 27421 | from .. app.pyefi.ttyp import ttyP
ttyP(0, "0 - ttyP test")
ttyP(1, "1 - header")
ttyP(2, "2 - bold")
ttyP(3, "3 - okblue")
ttyP(4, "4 - okgreen")
ttyP(5, "5 - underline")
ttyP(6, "6 - warning")
ttyP(7, "7 - fail")
| 1.546875 | 2 |
src/dirbs/dimensions/duplicate_threshold.py | bryang-qti-qualcomm/DIRBS-Core | 0 | 27422 | <gh_stars>0
"""
DIRBS dimension function for duplicate threshold within a time period.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided ... | 2.140625 | 2 |
scripts/common/__init__.py | Innixma/kaggle2017 | 0 | 27423 | import matplotlib.pyplot as plt
from skimage import measure, morphology
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
import pandas as pd
def plot_slice(img, slice=80):
# Show some slice in the middle
plt.imshow(img[slice])
plt.show()
def plot_3d(image, threshold=-100):
#... | 2.296875 | 2 |
host/Productivity.py | chehansivaruban/Cyber---SDGP | 1 | 27424 | <filename>host/Productivity.py
class Productivity:
def __init__(self, irradiance, hours,capacity):
self.irradiance = irradiance
self.hours = hours
self.capacity = capacity
def getUnits(self):
print(self.irradiance)
totalpower = 0
print(totalpower)
... | 2.96875 | 3 |
sample/all_methods/setNoteApplicationDataEntry.py | matthewayne/evernote-sdk-python | 3 | 27425 | # Import the Evernote client
from evernote.api.client import EvernoteClient
# Define access token either:
# Developer Tokens (https://dev.evernote.com/doc/articles/dev_tokens.php)
# or OAuth (https://dev.evernote.com/doc/articles/authentication.php)
access_token = "insert dev or oauth token here"
# Setup the client
c... | 2.546875 | 3 |
setup.py | davidcarboni/cryptolite-python | 0 | 27426 | <gh_stars>0
from setuptools import setup, find_packages
import os
import unittest
def test_suite():
loader = unittest.TestLoader()
suite = loader.discover('tests', pattern='test_*.py')
return suite
def readme():
"""
Utility function to read the README file.
Used for the long_description. It... | 2.1875 | 2 |
final_project/machinetranslation/tests.py | cabrera-carlos/xzceb-flask_eng_fr | 0 | 27427 | import unittest
from translator import french_to_english, english_to_french
class TestFrenchToEnglish(unittest.TestCase):
def test1(self):
self.assertEqual(french_to_english("Bonjour"), "Hello") # test when "Bonjour" is given as input the output is "Hello".
with self.assertRaises(ValueE... | 3.84375 | 4 |
augur/metrics/platform/routes.py | Nayan-Das/augur | 1 | 27428 | <reponame>Nayan-Das/augur<filename>augur/metrics/platform/routes.py
def create_platform_routes(server):
metrics = server._augur.metrics
| 1.398438 | 1 |
dataset.py | DerryHub/the-TaobaoLive-Commodity-Identify-Competition | 4 | 27429 | import os
import torch
import numpy as np
from tqdm import tqdm
import json
from torch.utils.data import Dataset, DataLoader
from arcface.resnet import ResNet
from arcface.googlenet import GoogLeNet
from arcface.inception_v4 import InceptionV4
from arcface.inceptionresnet_v2 import InceptionResNetV2
from arcface.densen... | 2.125 | 2 |
WebMirror/util/StatusUpdater/Updater.py | awesome-archive/ReadableWebProxy | 193 | 27430 |
if __name__ == "__main__":
import logSetup
logSetup.initLogging()
import pickle
from common import database
import config
import common.LogBase
import WebMirror.rules
from WebMirror.OutputFilters.util.MessageConstructors import pack_message
import WebMirror.TimedTriggers.TriggerBase
import common.get_rpyc
# impo... | 1.976563 | 2 |
dynamic_databases/__init__.py | sligodave/dynamic_databases | 4 | 27431 | <reponame>sligodave/dynamic_databases
__version__ = '0.1.7'
default_app_config = 'dynamic_databases.apps.DynamicDatabasesConfig'
| 1.101563 | 1 |
Practica3PR3/PYTHON/PartitionProblemBruteForceRecursive.py | Prashant-JT/PartitionProblem | 0 | 27432 | <filename>Practica3PR3/PYTHON/PartitionProblemBruteForceRecursive.py
import time
import argparse
import sys
class Auxiliar:
vector = []
found = False
s = 0
combination = []
size = 0
def readFile(v):
try:
file = args.folder
except Exception as e:
print(e)
sys.exit("Directory Not Found, for he... | 3.703125 | 4 |
sasquatch/error/exec.py | tmacro/s4 | 6 | 27433 | from .base import SQError, BaseErrorHelper
from .context import ContextAwareError
class ExecutionError(SQError):
'''raised when an error is encountered during script execution'''
class ExecErrorHelper(BaseErrorHelper):
_default = ExecutionError
@staticmethod
def throw(cls = ExecutionError, **kwargs):
if 'ctx' i... | 2.875 | 3 |
Pr_LandMarkDetection_pix2pixArc+HeatMap.py | mohaEs/Train-Predict-Landmarks-by-Autoencoder | 0 | 27434 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 30 13:44:34 2018
@author: Moha-Thinkpad
"""
from tensorflow.keras import optimizers
from tensorflow.keras.models import Model
import datetime
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow.keras
import argpa... | 2.578125 | 3 |
pydsge/tests/export_getting_started_to_pkl.py | florabudianto/pydsge | 2 | 27435 | """This file contains functions for converting and storing jupyter notebooks."""
import nbformat
import pickle
import numpy as np
import os
from nbconvert import PythonExporter
from pathlib import Path # for windows-Unix compatibility
def nbconvert_python(path):
"""Use nbconvert to convert jupyter notebook to py... | 3.640625 | 4 |
tests/test_entrez.py | ckrusemd/meta-analysis-tool | 0 | 27436 | <filename>tests/test_entrez.py<gh_stars>0
import requests
from loguru import logger
def test_entrez_query():
json_ = { "query": "kruse eiken vestergaard", "email": "<EMAIL>" }
response = requests.post("http://api:8080/entrez/query", json = json_)
assert response.status_code == 200
assert response.j... | 2.53125 | 3 |
src/tools/cluster/cluster.py | uct-cbio/galaxy-tools | 0 | 27437 | <reponame>uct-cbio/galaxy-tools<filename>src/tools/cluster/cluster.py
#!/usr/bin/python
# EST clustering
# Currently clustering are done using the wcd clustering algorithm. Other algorithms will later be supported.
# The wcd program does not use qual score for clustering. If seq qual scores are specified the
# wcd ... | 2.453125 | 2 |
source/sent_classif.py | blazejdolicki/LASER | 0 | 27438 | <gh_stars>0
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate mu... | 2.21875 | 2 |
pandas/tests/scalar/timestamp/test_arithmetic.py | BenRussert/pandas | 1 | 27439 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import pytest
import numpy as np
import pandas.util.testing as tm
from pandas.compat import long
from pandas.tseries import offsets
from pandas import Timestamp, Timedelta
class TestTimestampArithmetic(object):
def test_overflow_offset(self):
... | 2.390625 | 2 |
utlts/uniprot_api.py | proteins247/proteomevis_scripts | 1 | 27440 | import urllib, urllib2
from parse_data import taxid
#UniProt column names are found at
#https://www.uniprot.org/help/uniprotkb_column_names
class UniProtAPI():
def __init__(self, columns):
self.columns = columns
self.url = 'https://www.uniprot.org/uniprot/'
self.batch_size = 350 #491 is limit
self.raw_dat... | 2.875 | 3 |
ditto/flickr/__init__.py | garrettc/django-ditto | 54 | 27441 | default_app_config = "ditto.flickr.apps.DittoFlickrConfig"
| 1.132813 | 1 |
cartes/dataviz/markers/__init__.py | xoolive/cartes | 20 | 27442 | import json
from pathlib import Path
import numpy as np
from matplotlib import path
current_dir = Path(__file__).parent
__all__ = list(p.stem for p in current_dir.glob("*.json"))
def __getattr__(name: str) -> path.Path:
file_path = current_dir / (name + ".json")
if file_path.exists():
data = json.lo... | 2.796875 | 3 |
flash/text/seq2seq/core/input.py | dudeperf3ct/lightning-flash | 1 | 27443 | <reponame>dudeperf3ct/lightning-flash<filename>flash/text/seq2seq/core/input.py
# Copyright The PyTorch Lightning team.
#
# 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.apac... | 2.359375 | 2 |
pymitblod/gender.py | slimcdk/pymitblod | 0 | 27444 | <reponame>slimcdk/pymitblod<filename>pymitblod/gender.py
'''
All model classes for pymitblod
'''
from __future__ import annotations
from typing import Callable
class Gender():
'''
Class representing an institution.
'''
def __init__(
self,
id:int,
name:str,
... | 2.453125 | 2 |
findtime/utils.py | MattCCS/FindTime | 0 | 27445 | <filename>findtime/utils.py<gh_stars>0
def day_of_year(dt):
return dt.timetuple().tm_yday
| 1.773438 | 2 |
tools/merge-inputs.py | dice-project/DICE-deployment-service | 2 | 27446 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import json
import argparse
class ArgParser(argparse.ArgumentParser):
"""
Argument parser that displays help on error
"""
def error(self, message):
sys.stderr.write("error: {}\n".format(message))
self.print_help()
sys.exit(2)
d... | 3.546875 | 4 |
carpyncho/migrations/versions/a169bf8b211d_lightcurve_to_npy.py | toros-astro/carpyncho3 | 1 | 27447 | <filename>carpyncho/migrations/versions/a169bf8b211d_lightcurve_to_npy.py
"""lightcurve_to_npy
Revision ID: <KEY>
Revises: 423507fdb18e
Create Date: 2017-09-09 22:32:17.558901
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '423507fdb18e'
branch_labels = None
depends_on = None
from a... | 1.671875 | 2 |
core/window_manager.py | kennethnym/Subliminal | 0 | 27448 | import asyncio
import os
import subprocess
from threading import Thread
from typing import Dict, Set
from .plugin_settings import PluginSettings
from .rpc.api.daemon import DaemonConnectedEvent
from .project import CurrentProject
from .rpc import FlutterRpcProcess, FlutterRpcClient
from .env import Env
import sublime... | 1.867188 | 2 |
tests/context.py | eyal0/lcovparse | 2 | 27449 | #!/usr/bin/env python2
"""Context for all tests."""
from __future__ import absolute_import
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)) + "../lcovparse"))
import lcovparse # pylint: disable=wrong-import-position,unused-import
| 1.328125 | 1 |
stellarisdashboard/game_info.py | Akuukis/stellaris-dashboard | 97 | 27450 | <reponame>Akuukis/stellaris-dashboard<gh_stars>10-100
PHYSICS_TECHS = {
"tech_databank_uplinks",
"tech_basic_science_lab_1",
"tech_curator_lab",
"tech_archeology_lab",
"tech_physics_lab_1",
"tech_physics_lab_2",
"tech_physics_lab_3",
"tech_global_research_initiative",
"tech_administr... | 1.351563 | 1 |
web/misc/webapi_client/__init__.py | procool/mygw | 0 | 27451 | <filename>web/misc/webapi_client/__init__.py<gh_stars>0
import re
from flaskcbv.conf import settings
from misc.httpclient import httpClient
re_session = re.compile(r"session=(.*?);")
class webapiClient(httpClient):
host = settings.WEBAPI_HOST
port = settings.WEBAPI_PORT
def __check_session(self, r):
... | 2.265625 | 2 |
starfish/pipeline/filter/gaussian_high_pass.py | Xiaojieqiu/starfish | 1 | 27452 | import argparse
from functools import partial
from numbers import Number
from typing import Callable, Union, Tuple, Optional
import numpy as np
from skimage import img_as_uint
from starfish.errors import DataFormatWarning
from starfish.image import ImageStack
from starfish.pipeline.filter.gaussian_low_pass import Gau... | 2.5 | 2 |
WDJN/eval/svm_eval_acc.py | silverriver/Stylized_Dialog | 21 | 27453 | <reponame>silverriver/Stylized_Dialog<filename>WDJN/eval/svm_eval_acc.py
import torch
import torch.nn as nn
import sklearn
from sklearn import svm
from sklearn import metrics
from sklearn.externals import joblib
import numpy as np
from text import Vocab
import random
import os
import json
from tqdm import tqdm, trange
... | 1.914063 | 2 |
factom_core/blockchains/base.py | sourcery-ai-bot/factom-core | 0 | 27454 | from typing import Any, List
import factom_core.blocks as blocks
from factom_core.db import FactomdLevelDB
from .pending_block import PendingBlock
class BaseBlockchain:
"""The base class for all Blockchain objects"""
network_id: bytes = None
vms: List[Any] = None
data_path: str = None
db: Fact... | 2.921875 | 3 |
bot/plugins/bongo.py | Preocts/twitch-chat-bot | 62 | 27455 | <filename>bot/plugins/bongo.py
from __future__ import annotations
from typing import Match
from bot.config import Config
from bot.data import command
from bot.data import esc
from bot.data import format_msg
@command('!bongo')
async def cmd_bongo(config: Config, match: Match[str]) -> str:
_, _, rest = match['msg... | 2.21875 | 2 |
sensorsproject/settings/dev_edwin.py | edwinsteele/sensorsproject | 0 | 27456 | __author__ = 'esteele'
# Common settings
from .base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sensors',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
}
DEBUG = True
TEMPLATE_DEBUG = DEBUG
... | 1.507813 | 2 |
EduRec/meta/__init__.py | tswsxk/EduRec | 2 | 27457 | # coding: utf-8
# 2021/2/10 @ tongshiwei
from .MeasurementModel import MeasurementModel
from .SLM import SLM
| 0.910156 | 1 |
load_model.py | zhfeing/cifar-10-test | 0 | 27458 | import keras
import os
def load_model(version, new_model, retrain=False, *args):
"""
:param version: model version
:param new_model: method for call to get a new model e.g. my_ResNet.my_ResNet
:param retrain: True: load new model
:return:
"""
create_new_model = False
# load model
i... | 2.78125 | 3 |
src/bioplottemplates/cli_labeldots.py | joaomcteixeira/python-bioplottemplates | 0 | 27459 | import argparse
from bioplottemplates.libs import libcli, libio
from bioplottemplates.plots import label_dots
ap = libcli.CustomParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
ap.add_argument(
'data_csv',
help='The CSVs files to plot',
nargs='+',
)
... | 2.421875 | 2 |
tadataka/feature/__init__.py | IshitaTakeshi/Tadataka | 54 | 27460 | <reponame>IshitaTakeshi/Tadataka
from tadataka.feature.feature import (
extract_features, empty_match, Features, Matcher
)
| 1.085938 | 1 |
class/cls_006.py | rpoliselit/python-for-dummies | 0 | 27461 | <filename>class/cls_006.py<gh_stars>0
# Custom errors in classes.
class TooManyPagesReadError(ValueError):
pass
class Book:
def __init__(self, title, page_count):
self.title = title
self.page_count = page_count
self.pages_read = 0
def __repr__(self):
return (
f... | 3.59375 | 4 |
data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/test_stanford_nltk.py | Keesiu/meta-kaggle | 0 | 27462 | <reponame>Keesiu/meta-kaggle<gh_stars>0
#!/usr/bin/env python
import sys, bz2
sys.path.insert(0, '/Users/timpalpant/Documents/Workspace/corenlp-python')
import nltk
from nltk.tree import Tree
from corenlp import StanfordCoreNLP
from remove_random_word import remove_random_word
print "Booting StanfordCoreNLP"
nlp = St... | 2.09375 | 2 |
parsifal/library/models.py | reeta1234/parsifal | 0 | 27463 | # coding: utf-8
from django.db import models
from django.contrib.auth.models import User
from django.utils.text import slugify
class SharedFolder(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(max_length=255, null=True, blank=True)
users = models.ManyToManyField(User, throu... | 2.109375 | 2 |
getkills/mongoconn.py | namrak/pyzkillredisq | 0 | 27464 | <reponame>namrak/pyzkillredisq
from pymongo import MongoClient, errors
import tstp
from mdb import creds
def connect(logfile):
"""connect to mongodb"""
try:
client = MongoClient(creds['ip'], int(creds['port']))
db = client.fpLoss
db.authenticate(creds['un'], creds['pw'])
return ... | 2.5 | 2 |
test.py | richardfergie/ForecastGA | 30 | 27465 | <reponame>richardfergie/ForecastGA<filename>test.py
# Libraries
import pandas as pd
import numpy as np
import re
from datetime import datetime
from dateutil.rrule import rrule, MONTHLY
import matplotlib.pyplot as plt
import json
import forecastga
import forecastga.googleanalytics as ga
# Logging
import logging
log... | 2.453125 | 2 |
Simulation/Simulation/intervention.py | anoppa/Proyecto-IA-Sim-Comp | 1 | 27466 | <filename>Simulation/Simulation/intervention.py
from .agent import Agent
from typing import List
from .activation_rule import ActivationRule
class Intervention(Agent):
def __init__(
self,
name: str,
activation_rules: List[ActivationRule],
efect_time: int,
repetition: int,
... | 3.171875 | 3 |
xanalysis_groundstate_paper_figs.py | kseetharam/genPolaron | 0 | 27467 | <gh_stars>0
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from matplotlib.lines import Line2D
import matplotlib.colors as colors
from matplotlib.animation import writers
from matplotlib.patches import Connectio... | 1.9375 | 2 |
demo/onlyuserrole/demo/urls.py | tangdyy/onlyuserclient | 2 | 27468 | <filename>demo/onlyuserrole/demo/urls.py
from django.conf.urls import url
from django.urls import path,include
from rest_framework import routers
from .views import RoleViewSet
router = routers.DefaultRouter()
router.register(r'roles', RoleViewSet, basename='role')
urlpatterns = [
url(r'^', include(router.urls)... | 1.804688 | 2 |
data_structures/heap/heap_using_heapq.py | ruler30cm/python-ds | 1,723 | 27469 | <reponame>ruler30cm/python-ds
"""
Heap in python using heapq library function
Note: by default, heapq creates a min-heap. To make it a
max-heap, add items after multiplying them by -1
"""
from heapq import heappop, heappush, heapify
heap = []
heapify(heap)
heappush(heap, 10)
heappush(heap, 11)
heappush(heap, 2)
he... | 3.84375 | 4 |
paracept.py | andrinethomas/Tensorflow-vehicle-detection-using-camera-and-db-accessing-mysql | 1 | 27470 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 2 17:55:47 2018
@author: tensorflow-cuda
"""
import numpy as np
import os
import sys
import tensorflow as tf
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import pytesseract
from custom_plate import allo... | 2.03125 | 2 |
test/test_words.py | dubmix3105/pysh | 7 | 27471 | import sys
import pytest
from pysh import shwords, shwords_f
def test_conversions():
with pytest.raises(ValueError):
shwords('{:{}}', 1, 2)
assert '{:{}}'.format(1, 2) == ' 1' # by contrast
def test_multiword():
assert shwords('touch {!@}', ['a', 'b']) \
== ['touch', 'a', 'b']
with pytest.raises(... | 2.78125 | 3 |
slender/tests/dictionary/test_contain.py | torokmark/slender | 1 | 27472 | from unittest import TestCase, skip
from expects import *
from slender import Dictionary
class TestContain(TestCase):
def setUp(self):
self.key = 'a'
def test_contain_if_dictionary_is_empty(self):
d1 = Dictionary[str, int]({})
expect(self.key in d1).to(be_false)
def test_contai... | 2.90625 | 3 |
Python/0263_ugly_number.py | codingyen/CodeAlone | 2 | 27473 | # Time: O(logn) = O(1)
# Space: O(1)
class Solution:
def isUgly(self, num):
if not num:
return False
while num % 2 == 0:
num = num / 2
while num % 3 == 0:
num = num / 3
while num % 5 == 0:
num = num / 5
return num == 1:
... | 3.5625 | 4 |
execute_sweep.py | kinoai/skyhacks2020 | 0 | 27474 | import wandb
import main
# Load project config
config = main.load_config()
# Initialize wandb
wandb.init()
# Replace project config hyperparameters with the ones loaded from wandb sweep server
sweep_hparams = wandb.Config._as_dict(wandb.config)
for key, value in sweep_hparams.items():
if key != "_wandb":
... | 1.921875 | 2 |
setup.py | paoloelena15/gutenberg | 0 | 27475 | <gh_stars>0
"""Library installer."""
from __future__ import absolute_import, unicode_literals
from platform import system
from sys import version_info
import codecs
from setuptools import find_packages
from setuptools import setup
install_requires = [
'future>=0.15.2',
'rdflib>=4.2.0',
'requests>=2.5.1'... | 1.53125 | 2 |
deep_sdf_prior.py | nicolaihaeni/shapenet-pyrender | 0 | 27476 | # Top of main python script
import os
os.environ["PYOPENGL_PLATFORM"] = "egl"
import sys
import random
import argparse
import numpy as np
import trimesh
import imageio
import open3d as o3d
from mathutils import Matrix
import h5py
import json
from mesh_to_sdf import get_surface_point_cloud
import pyrender
import uti... | 1.734375 | 2 |
wiki-preparation/dump_topn.py | bertrandlalo/piaf-code | 8 | 27477 | <gh_stars>1-10
import struct
import pickle
import sys
class DataInputStream:
"""
Reading from Java DataInputStream format.
"""
def __init__(self, stream):
self.stream = stream
def read_boolean(self):
return struct.unpack('?', self.stream.read(1))[0]
def read_byte(self):
... | 3.078125 | 3 |
dzdp-server/app/source/job_creator.py | Onekki/dzdp | 0 | 27478 | from fetcher.source.fetcher import Fetcher
from fetcher.source.managers.notification import FetcherException
def fetch(config_dict):
f = Fetcher(config_dict)
f.start()
return "Job has been finished"
| 1.960938 | 2 |
users/forms.py | shyam999/Django-blog | 13 | 27479 | from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import UserProfile
class UserRegistrationForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super(UserRegistrationForm, self).__init__(*args, **kwargs)
... | 2.578125 | 3 |
StatementExample/urls.py | linkhub-sdk/popbill.example.django | 0 | 27480 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
# Index Page
url(r'^$', views.index, name='index'),
# 전자명세서 발행
url(r'^CheckMgtKeyInUse$', views.checkMgtKeyInUse, name='CheckMgtKeyInUse'),
url(r'^RegistIssue$', views.registIssue, name='RegistIssue'),
... | 1.75 | 2 |
setup.py | enricobacis/timeme | 1 | 27481 | from setuptools import setup
with open('README.rst') as README:
long_description = README.read()
long_description = long_description[long_description.index('Description'):]
setup(name='timeme',
version='0.1.1',
description='Decorator that prints the running time of a function',
long_descript... | 1.546875 | 2 |
tests/interface/test_cli.py | annakasprzik/qualle | 0 | 27482 | <filename>tests/interface/test_cli.py
# Copyright 2021 ZBW – Leibniz Information Centre for Economics
#
# 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/licen... | 1.757813 | 2 |
lale/lib/lale/smac.py | ksrinivs64/lale | 0 | 27483 | <reponame>ksrinivs64/lale<gh_stars>0
# Copyright 2019 IBM Corporation
#
# 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 app... | 1.617188 | 2 |
org.beerware.empty.app/assets/axp.py | pmp-p/projects | 0 | 27484 |
from android import *
print(widget.Button)
from android.widget import TextView
| 1.5 | 2 |
app/routes/student/subjects.py | roshnet/Electron-Server | 0 | 27485 | <gh_stars>0
from app import app
from app.database import db
from app.database.models.student_subject_map import StudentSubjectMap
from app.database.models.subjects import Subjects
from fastapi import Depends, Response, status
from fastapi_jwt_auth import AuthJWT
@app.get("/students/{student_id}/subjects")
async def s... | 2.40625 | 2 |
examples/runner/parallel/pipedream.py | nox-410/Hetu | 0 | 27486 | <gh_stars>0
import hetu as ht
import os
import sys
import time
import argparse
import numpy as np
def fc(x, shape, name, with_relu=True):
weight = ht.init.random_normal(shape, stddev=0.1, name=name+'_weight')
bias = ht.init.random_normal(shape[-1:], stddev=0.1, name=name+'_bias')
x = ht.matmul_op(x, weigh... | 2.3125 | 2 |
chapter100/mongodb_04.py | thiagola92/learning-databases-with-python | 0 | 27487 | import time
from pymongo import MongoClient
from datetime import datetime
from threading import Thread, Lock
start = datetime.now()
client = MongoClient("mongodb://username:password@127.0.0.1")
database = client["database_name"]
collection = database["collection_name"]
threads_count = 0
lock = Lock()
package = []
... | 2.8125 | 3 |
Arrays/trapping_rain_water.py | lakshyarawal/pythonPractice | 0 | 27488 | """ Trapping rain water: Given an array of non negative integers, they are height of bars.
Find how much water can you collect between there bars """
"""Solution: """
def rain_water(a) -> int:
n = len(a)
res = 0
for i in range(1, n-1):
lmax = a[i]
for j in range(i):
lmax ... | 3.71875 | 4 |
billing/models/pin_models.py | litchfield/merchant | 0 | 27489 | from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
class PinCard(models.Model):
token = models.CharField(max_length=32, db_index=True, editable=False)
display_n... | 2.34375 | 2 |
4 - Late Fusion Networks/Perf_Hard_and_Soft_Voting_Prep.py | pcasabianca/Acoustic-UAV-Identification | 1 | 27490 | <reponame>pcasabianca/Acoustic-UAV-Identification
import os
import json
import librosa
import tensorflow as tf
import numpy as np
from termcolor import colored
# Read and save parameters.
DATASET_PATH = "Unseen Testing" # Path of testing dataset.
SAMPLE_RATE = 22050
DURATION = 1 # Measured in seconds (chan... | 2.546875 | 3 |
contact_test.py | Njihia413/contact-list | 0 | 27491 | import unittest #Importing the unittest module
from contact import Contact #Importing the contact class
#import pyperclip #Pyperclip will allow us to copy and paste items to our clipboard
class TestContact(unittest.TestCase):
def setUp(self):
self.new_contact = Contact("Lyn","Muthoni","0796654066","<EMAIL>... | 3.671875 | 4 |
back_end/celery_tasks/main.py | 22014471/malonghui_Django | 1 | 27492 | from celery import Celery
import os
# 为celery设置django默认配置
if not os.getenv('DJANGO_SETTINGS_MODULE'):
os.environ['DJANGO_SETTINGS_MODULE'] = 'mlh.settings.dev'
# 创建对象,命名为meiduo,并指明broker
celery_app = Celery('mlh',broker='redis://127.0.0.1:6379/15')
# 自动注册任务
celery_app.autodiscover_tasks(['celery_tasks.sms',]) | 1.546875 | 2 |
holobot/extensions/crypto/__init__.py | rexor12/holobot | 1 | 27493 | <gh_stars>1-10
from .alert_manager_interface import AlertManagerInterface
from .alert_manager import AlertManager
from .crypto_updater import CryptoUpdater
| 1.140625 | 1 |
tests/unittest/parser/test_basic_parser.py | alessandrome/pywiktionary | 4 | 27494 | import unittest
from pywiktionary.parsers import basic_parser
def get_pizza_html_extract():
with open('tests/file/html-responses/pizza-it.html', 'r', encoding='utf-8') as pizza_html_file:
pizza_html = pizza_html_file.read()
return pizza_html
class BasicParseTestCase(unittest.TestCase):
def test_... | 3.15625 | 3 |
snuggle/web/processing/events.py | halfak/snuggle | 2 | 27495 | import logging, traceback, time
from bottle import request
from snuggle import configuration
from snuggle import mediawiki
from snuggle import errors
from snuggle.data import types
from snuggle.web.util import responses, user_data
logger = logging.getLogger("snuggle.web.processing.users")
class Events:
def __init__... | 2.390625 | 2 |
S2.Surface_Normal/regNormalNet/regNormalNet.py | leoshine/Spherical_Regression | 133 | 27496 | <filename>S2.Surface_Normal/regNormalNet/regNormalNet.py<gh_stars>100-1000
# coding: utf8
"""
@Author : <NAME>
"""
import os
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from torch.autograd import Variable
import torch
from basic.common import rdict
import numpy as np
from easydict import Ea... | 2.09375 | 2 |
oscar_support/forms/widgets.py | snowball-one/django-oscar-support | 14 | 27497 | <reponame>snowball-one/django-oscar-support<gh_stars>10-100
from django.forms.util import flatatt
from django.template import loader, Context
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.template.loader import render_to_string
from django.forms.widgets imp... | 2.0625 | 2 |
projectname/tests/__init__.py | Casokaks/light-python-template | 0 | 27498 | """
Test init module
==================================
Author: Casokaks (https://github.com/Casokaks/)
Created on: Aug 15th 2021
"""
| 0.964844 | 1 |
presenterserver/facial_recognition/src/facial_recognition_server.py | niuiic/face_recognition | 1 | 27499 | # =======================================================================
#
# Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1 Redistrib... | 1.367188 | 1 |