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 |
|---|---|---|---|---|---|---|
src/uwrov_cams/scripts/usb_cam.py | uwrov/nautilus_pi | 0 | 12775051 | #!/usr/bin/env python3
import rospy
import os
from sensor_msgs.msg import CompressedImage
import numpy as np
import cv2
def streaming(msg, rate, stream, image_pub):
while not rospy.is_shutdown():
_, frame = stream.read()
msg.header.stamp = rospy.Time.now()
msg.format = 'jpeg'
... | 2.828125 | 3 |
leetcode-63.py | comst007/myLeetCode | 0 | 12775052 | class Solution:
def dfs(self,row_cnt:int, col_cnt:int, i:int, j:int, obs_arr:list, solve_dict:dict):
if (i, j) in solve_dict:
return solve_dict[(i,j)]
right_cnt = 0
down_cnt = 0
#right
if i + 1 < row_cnt and not obs_arr[i + 1][j]:
if (i + 1, j) in sol... | 3.046875 | 3 |
mkdocs_typer/_exceptions.py | bruce-szalwinski/mkdocs-typer | 10 | 12775053 | class MkDocsTyperException(Exception):
"""
Generic exception class for mkdocs-typer errors.
"""
| 1.5625 | 2 |
AutomatedTesting/Gem/PythonTests/physics/C4044460_Material_StaticFriction.py | aaarsene/o3de | 1 | 12775054 | <gh_stars>1-10
"""
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C4044460
# Test Case Title : Verify the functionality of static friction
# f... | 2.03125 | 2 |
login/apps/user/serializers.py | LHW6688/login | 1 | 12775055 | # -*- coding: utf-8 -*-
'''
PROJECT_NAME:login
FILE:serializers
USERNAME: 李宏伟
DATE:2020/1/15
TIME:上午10:13
PRODUCT_NAME:PyCharm
'''
import re
from rest_framework import serializers
from .models import User
class CreateUserSerializer(serializers.ModelSerializer):
"""
创建用户序列化器
"""
password2 = serializers.Char... | 2.609375 | 3 |
mmdetection2.11-ShipRSImageNet/configs/ShipRSImageNet/_base_/datasets/ShipRSImageNet_Level2_detection.py | zzndream/ShipRSImageNet | 7 | 12775056 | <reponame>zzndream/ShipRSImageNet
dataset_type = 'ShipRSImageNet_Level2'
# data_root = 'data/Ship_ImageNet/'
data_root = './data/ShipRSImageNet/'
CLASSES = ('Other Ship', 'Other Warship', 'Submarine', 'Aircraft Carrier', 'Cruiser', 'Destroyer',
'Frigate', 'Patrol', 'Landing', 'Commander', 'Auxiliary Ships',... | 1.757813 | 2 |
pages/MainPage.py | yadavdeepa365/HUDL_PYTHON | 0 | 12775057 | <reponame>yadavdeepa365/HUDL_PYTHON
from selenium.webdriver.common.keys import Keys
from pages.BasePage import BasePage
from pages.LoginPage import LoginPage
#from pages.MainPage import MainPage
from utils.locators import *
# Page objects are written in this module.
# Depends on this Main page functionality we can ha... | 2.578125 | 3 |
models/imagenet/arch/tests/test_utils_fuse_utils.py | a1004123217/pytorch-mobile | 0 | 12775058 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import numpy as np
import torch
import mobile_cv.arch.fbnet_v2.basic_blocks as bb
import mobile_cv.arch.fbnet_v2.fbnet_builder as fbnet_builder
import mobile_cv.arch.utils.fuse_utils as fuse_utils
def run_... | 2.21875 | 2 |
django/BankAccount/BankAccount/settings_prod.py | akrysmalski/BankAccount | 0 | 12775059 | <reponame>akrysmalski/BankAccount
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.environ['DJANGO_SECRET']
DEBUG = False
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
X_FRAME_OPTIONS = 'DENY'
CSRF_C... | 1.929688 | 2 |
saved_models/Nb3d/nb_oxide_analysis.py | cassberk/xps_peakfit | 1 | 12775060 | <filename>saved_models/Nb3d/nb_oxide_analysis.py
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy as dc
import lmfit as lm
import XPyS
import XPyS.config as cfg
"""
Series of funcitons for analyzing thicknesses of the different oxides for NbOxides
"""
def transfer_func(depth,depth_bins,EAL,... | 2.25 | 2 |
scripts/2021-10-10_extract_data_montecarlo.py | wendong-wang/spinning_rafts_sim2 | 0 | 12775061 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 28 14:52:17 2020
@author: vimal
"""
"""
This is for the Monte Carlo simulation of the configuration of many rafts
The maximum characters per line is set to be 120.
"""
# import glob
import os
import sys
import shelve
import platform
imp... | 2.09375 | 2 |
popupcad_gazebo/__init__.py | popupcad/popupcad | 19 | 12775062 | <filename>popupcad_gazebo/__init__.py
# -*- coding: utf-8 -*-
"""
Written by <NAME> and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
from . import gazebo_controller
#import external modules
import PIL
import array
import lxml
import multiprocessing
import pygazebo
import trolliu... | 2.125 | 2 |
Code/nebulae/nebulae.py | DaveSeidel/QB_Nebulae_V2 | 40 | 12775063 | # Main Nebulae Source File
import sys
import os
from subprocess import Popen
import ctcsound
import controlhandler as ch
import conductor
import ui
import fileloader
import time
import logger
import neb_globals
cfg_path = "/home/alarm/QB_Nebulae_V2/Code/config/"
debug = False
debug_controls = False
class Nebulae(ob... | 2.171875 | 2 |
tests/test_magic.py | liranbg/nuclio-jupyter | 62 | 12775064 | # Copyright 2018 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 1.867188 | 2 |
code/ch20/20.1.1. 1284.minFlips.py | leetcode-pp/leetcode-pp1 | 22 | 12775065 | class Solution:
def minFlips(self, mat: List[List[int]]) -> int:
# 放到 flip 函数外面可以减少计算
mapper = {"0": "1", "1": "0"}
def flip(state: List[str], i: int) -> None:
state[i] = mapper[state[i]]
if i % n != 0:
state[i - 1] = mapper[state[i - 1]]
... | 3.109375 | 3 |
agsconfig/services/parcel_fabric_server_extension.py | DavidWhittingham/agsconfig | 1 | 12775066 | <filename>agsconfig/services/parcel_fabric_server_extension.py
"""This module contains the ParcelFabricServer extension class"""
# Python 2/3 compatibility
# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-order,wrong-import-position
from __future__ import (absolute_import, division, print_function... | 1.726563 | 2 |
setup.py | RockefellerArchiveCenter/rac_es | 0 | 12775067 | from setuptools import find_packages, setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='rac_es',
version='0.17.4',
description="Helpers for Rockefeller Archive Center's Elasticsearch implementation.",
long_description=long_description,
long_description_content_... | 1.304688 | 1 |
xcube/util/types.py | bcdev/xcube | 0 | 12775068 | # The MIT License (MIT)
# Copyright (c) 2022 by the xcube development team and contributors
#
# 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... | 2.21875 | 2 |
cronman/base.py | ryancheley/django-cronman | 17 | 12775069 | # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import unicode_literals
import logging
import platform
from cronman.monitor import Cronitor, Sentry, Slack
from cronman.utils import bool_param, config, ensure_dir, format_exception
logger = logging.getLogger("cronman.command")
class BaseCronObjec... | 2.09375 | 2 |
app/models/vehicle.py | MTES-MCT/mobilic-api | 0 | 12775070 | <gh_stars>0
import graphene
from app import db
from app.helpers.db import DateTimeStoredAsUTC
from app.helpers.graphene_types import BaseSQLAlchemyObjectType
from app.models.base import BaseModel
class Vehicle(BaseModel):
registration_number = db.Column(db.TEXT, nullable=False)
alias = db.Column(db.TEXT, nul... | 2.296875 | 2 |
tests/data/thirdParty/Four/csnFour.py | xplanes/CSnake | 4 | 12775071 | # Csnake project configuration
import csnCilab
from csnAll import three
four = csnCilab.CilabModuleProject("Four", "third party")
four.pathsManager.useFilePath = "%s/Four/UseFour.cmake" % four.GetBuildFolder()
four.pathsManager.configFilePath = "%s/Four/FourConfig.cmake" % four.GetBuildFolder()
four.AddProjects([three... | 1.46875 | 1 |
Chapter14/data_preprocessing.py | andriitugai/Learning-Python-data-structures | 202 | 12775072 |
import numpy as np
import pandas
from sklearn.preprocessing import MinMaxScaler, StandardScaler, Binarizer
#handle the missing values
data = pandas.DataFrame([
[4., 45., 984.],
[np.NAN, np.NAN, 5.],
[94., 23., 55.],
])
#print original data
print(data)
#fill the missing values with... | 3.359375 | 3 |
sentinel_backend/sentinel_backend/repository/MentionRepository.py | szymanskir/Sentinel | 0 | 12775073 | <reponame>szymanskir/Sentinel
import pandas as pd
from datetime import datetime
from sentinel_common.db_models import MentionDb, MentionDateIndex
from typing import List
from . import KeywordRepository
_KEYWORD_REPOSITORY = KeywordRepository()
class MentionRepository:
def get_mentions(
self, user: str, s... | 2.765625 | 3 |
socks.py | lik78/Gravy-Reloaded | 2 | 12775074 | """SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. 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. Redistributions of source code must retain the above copyright notice, ... | 1.921875 | 2 |
iron/utilities/explode_bam.py | jason-weirather/Au-public | 4 | 12775075 | <reponame>jason-weirather/Au-public
#!/usr/bin/python
import sys, argparse, re, os
from subprocess import Popen, PIPE
from SamBasics import is_header
from multiprocessing import cpu_count, Pool
def main():
parser = argparse.ArgumentParser(description="Break a bam into evenly sized chunks",formatter_class=argparse.Ar... | 2.421875 | 2 |
pytorch-version/train.py | bzantium/EA-LSTM | 16 | 12775076 | <gh_stars>10-100
import math
import torch
import torch.nn as nn
import torch.optim as optim
from utils import make_cuda
from sklearn.metrics import mean_squared_error, mean_absolute_error
def train(args, model, data_loader, initial=False):
MSELoss = nn.MSELoss(reduction='mean')
optimizer = optim.Adam(model.pa... | 2.234375 | 2 |
nydus/db/backends/redis.py | jusbrasil/nydus | 0 | 12775077 | <reponame>jusbrasil/nydus
"""
nydus.db.backends.redis
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
from redis import Redis as RedisClient, StrictRedis
from redis import ConnectionError, InvalidResponse... | 2.28125 | 2 |
pybda/bda_03a_ave.py | OxfordSKA/bda | 2 | 12775078 |
"""BDA with custom BDA code."""
import os
import sys
import subprocess
if __name__ == "__main__":
if len(sys.argv) - 1 < 1:
print 'Usage:'
print (' $ python bda/bda_03a_ave.py '
'<simulation dir>')
sys.exit(1)
sim_dir = sys.argv[-1]
if not os.path.isdir(sim_dir):... | 2.09375 | 2 |
scripts/integration_fail_file.py | Hrovatin/scib | 11 | 12775079 |
from snakemake.io import load_configfile
from pathlib import Path
if __name__=='__main__':
import argparse
parser = argparse.ArgumentParser(description='Create an empty output file for failed integration runs')
parser.add_argument('-c', '--config', help='Snakemake config file', required=True)
parser... | 2.296875 | 2 |
mongo/data_generator/models/models.py | svvladimir-ru/ugc_sprint_1 | 0 | 12775080 | from uuid import UUID, uuid4
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class BaseCollection(BaseModel):
id: Optional[UUID] = Field(alias='_id', default=uuid4())
created_at: Optional[datetime] = datetime.now()
collection: Optional[str]
def __init_... | 2.859375 | 3 |
src/m6_your_turtles.py | kaysm/01-IntroductionToPython | 0 | 12775081 | """
Your chance to explore Loops and Turtles!
Authors: <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, their colleagues, and <NAME>.
"""
########################################################################
# DONE: 1.
# On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name.
###########################... | 3.703125 | 4 |
canvas/core/model/statements.py | robinsax/canvas | 4 | 12775082 | # coding: utf-8
'''
Top-level statement objects.
'''
from .ast import deproxy, nodeify
from .joins import Join
# TODO: Constructor docs.
class Statement:
'''The top-level AST node type, which must facilitate value collection.'''
def write(self):
'''Return an SQL, value list tuple of this statement's serializati... | 2.546875 | 3 |
mmtbx/conformation_dependent_library/cdl_database.py | rimmartin/cctbx_project | 0 | 12775083 | from __future__ import division
version = "CDL v1.2"
cdl_database = {
"Gly_nonxpro" : {
(-180, -180) : ['B', 14, 120.86, 1.62, -1, -1, 110.42, 1.49, -1, -1, 121.63, 0.95, 114.72, 1.32, 123.61, 1.16, 1.327, 0.0115, 1.4508, 0.0113, -1, -1, 1.5117, 0.0124, 1.2356, 0.0123],
(-180, -170) : ['B', 7, 120.56, 1.42,... | 1.640625 | 2 |
parlaseje/models.py | VesterDe/parlalize | 1 | 12775084 | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from jsonfield import JSONField
from behaviors.models import Timestampable, Versionable
from parlalize.settings import API_OUT_DATE_FORMAT
from datetime import datetime
class PopoloDateTimeField(models.DateTi... | 2.109375 | 2 |
model/dnn.py | msamribeiro/deep-cca | 27 | 12775085 | <reponame>msamribeiro/deep-cca
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Parallel network and feedforward network.
Author: <NAME>
Date: 2017
"""
import numpy
import theano
import theano.tensor as T
from cca_layer import CCA
from layers import HiddenLayer, ConvPoolLayer
class DNN(object):
def __init_... | 3 | 3 |
Registration/ImageRegistration.py | yuzhounaut/SpaceM | 8 | 12775086 | <gh_stars>1-10
from skimage import transform as tf
from skimage import filters
from skimage import exposure
from scipy import ndimage
from scipy.optimize import basinhopping
from scipy import spatial
import os, gc, glob, spaceM
import numpy as np
import matplotlib.pyplot as plt
import tifffile as tiff
import spaceM.Ima... | 2.28125 | 2 |
cc_modes/mm_tribute.py | epthegeek/cactuscanyon | 10 | 12775087 | ## ____ _ ____
## / ___|__ _ ___| |_ _ _ ___ / ___|__ _ _ __ _ _ ___ _ __
## | | / _` |/ __| __| | | / __| | | / _` | '_ \| | | |/ _ \| '_ \
## | |__| (_| | (__| |_| |_| \__ \ | |__| (_| | | | | |_| | (_) | | | |
## \____\__,_|\___|\__|\__,_|___/ \____\__,_|_| |_|\__, |\___/|... | 2.421875 | 2 |
AlgorithmTest/PROGRAMMERS_PYTHON/Lv1/Prog_64061.py | bluesky0960/AlgorithmTest | 0 | 12775088 | <reponame>bluesky0960/AlgorithmTest
#https://programmers.co.kr/learn/courses/30/lessons/64061
# 크레인 인형뽑기
def solution(board, moves):
answer = 0
size = len(board[0])
a = []
for m in moves:
for i in range(size):
if board[i][m-1] != 0:
a.append(board[i][m-1])
... | 3.421875 | 3 |
Sea/adapter/materials/ViewProviderMaterial.py | FRidh/Sea | 2 | 12775089 | <reponame>FRidh/Sea<filename>Sea/adapter/materials/ViewProviderMaterial.py<gh_stars>1-10
from ..base import ViewProviderBase
class ViewProviderMaterial(ViewProviderBase):
pass | 1.203125 | 1 |
tests/Serial/test_multi-planet_serial.py | VirtualPlanetaryLaboratory/multiplanet | 0 | 12775090 | import subprocess
import numpy as np
import os
import pathlib
import multiprocessing as mp
import sys
def test_mp_serial():
#gets current path
path = pathlib.Path(__file__).parents[0].absolute()
sys.path.insert(1, str(path.parents[0]))
if not (path / "MP_Serial").exists():
subprocess.check_out... | 2.40625 | 2 |
nagare/services/create_root.py | nagareproject/core | 40 | 12775091 | <filename>nagare/services/create_root.py
# --
# Copyright (c) 2008-2021 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
from nagare.services import plugin
class RootService(... | 2.25 | 2 |
install.py | nikolhm/Pokus | 1 | 12775092 | import platform
import os
import sys
def install(package):
print("""Colorama er ikke installert. Du trenger Colorama for å spille Pokus med farger.
For å spille må du installere Colorama og starte spillet på nytt.""")
if input("Vil du installere colorama nå?\n> ").lower() in {"ja", "j"}:
osys = platfor... | 2.984375 | 3 |
ganimides_server/ganimides_database/xxx.py | leandrou-technology-forward/api_server | 0 | 12775093 | def dbapi_subscription(dbsession, action, input_dict, action_filter={}, caller_area={}):
_api_name = "dbapi_subscription"
_api_entity = 'SUBSCRIPTION'
_api_action = action
_api_msgID = set_msgID(_api_name, _api_action, _api_entity)
_process_identity_kwargs = {'type': 'api', 'module': module_id, 'na... | 1.859375 | 2 |
Code/Base_Models_and_MLR.py | IshanKuchroo/SuperStore_Sales_Forecast | 0 | 12775094 | from scipy import stats
from PreProcessing import *
#################################################################
# ------------------ Base Methods ------------------ #
################################################################
col = 'Sales'
method = ['Average', 'Naive', 'Drift', 'SES']
def base_methods(... | 2.734375 | 3 |
train/blocks.py | shi510/ffem-anti-spoofing | 0 | 12775095 | import tensorflow as tf
def attach_GNAP(x : tf.Tensor):
out = x
norm = tf.norm(out, ord=2, axis=3, keepdims=True)
norm = tf.math.maximum(norm, 1e-12)
mean = tf.math.reduce_mean(norm)
out = tf.keras.layers.BatchNormalization(scale=False)(out)
out = tf.math.divide(out, norm)
out = tf.multipl... | 2.484375 | 2 |
app.py | marcelgiglio/multiplicative-persistence | 0 | 12775096 | def recursiveCalc(n, counter=0, steps=''):
if n<10:
steps += 'Total Steps: ' + str(counter) + '.'
return steps, counter
counter+=1
result = calc(n)
steps += str(result)+', '
return recursiveCalc(result, counter, steps)
def calc(n):
result = 1
while (n>0):
mod = n % 1... | 3.703125 | 4 |
deploy/virenv/lib/python2.7/site-packages/haystack/mappings/rek.py | wangvictor2012/liuwei | 0 | 12775097 | # -*- coding: utf-8 -*-
"""
rekall backed memory_handler.
- rekallProcessMapping: a wrapper around rekall addresspace
- rekallProcessMapper: the memory_handler builder.
"""
import os
import sys
import logging
import struct
from functools import partial
from haystack.mappings import base
from haystack.abc import i... | 2.28125 | 2 |
accountifie/common/apiv1/__init__.py | imcallister/accountifie | 4 | 12775098 | <gh_stars>1-10
from .server_info import * | 1.28125 | 1 |
tests/test_lorwrapper.py | Victoraq/Riot-API-Wrapper | 0 | 12775099 | from riotwrapper.lor import LoRWrapper
from riotwrapper.const.lor_const import REGION_URL
import pytest
import re
@pytest.fixture
def environment():
import os
api_key = os.environ.get('API_KEY')
account_id = os.environ.get('ACCOUNT_ID')
env = {
'api_key': api_key,
'account_id': accou... | 2.53125 | 3 |
django_magnificent_messages/constants.py | NoNameItem/django-magnificent-messages | 0 | 12775100 | """
Constants and defaults values
"""
import datetime
import django
SECONDARY = 10
PRIMARY = 20
INFO = 30
SUCCESS = 40
WARNING = 50
ERROR = 60
DEFAULT_TAGS = {
SECONDARY: 'secondary',
PRIMARY: 'primary',
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'danger',
}
DEFAULT_LEVELS ... | 2.0625 | 2 |
setup.py | Colin-b/pyconfigparser | 4 | 12775101 | <filename>setup.py
import os
from setuptools import setup, find_packages
this_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_dir, 'README.md'), 'r') as f:
long_description = f.read()
setup(name='pyconfigparser',
version='0.1',
author='<NAME>',
maintainer='<NAME>',
... | 1.742188 | 2 |
test/EN.py | miaopei/deep_landmark | 327 | 12775102 | <reponame>miaopei/deep_landmark
#!/usr/bin/env python2.7
# coding: utf-8
"""
This file use Caffe model to predict landmarks and evaluate the mean error.
"""
import os, sys
import time
import cv2
import numpy as np
from numpy.linalg import norm
from common import getDataFromTxt, logger, processImage, getCNNs
TXT ... | 2.640625 | 3 |
GroupmeChatbot/bot.py | dgisolfi/marty-gruopme-chatbot | 0 | 12775103 | #!/usr/bin/python3
# 2019-05-29
import re
import requests
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
class Bot:
def __init__(self, name, bot_id, group_id, api_token):
self.name = name
self.bot_id = bot_id
self.group_id = group_id
self.api... | 3.03125 | 3 |
eggs/boto-2.5.2-py2.7.egg/boto/cloudsearch/document.py | bopopescu/phyG | 3 | 12775104 | # Copyright (c) 2012 <NAME> http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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 restri... | 1.828125 | 2 |
demo_project/urls.py | zmcddn/DRF-demo-user-creditcard | 0 | 12775105 | from django.contrib import admin
from django.urls import path, re_path, include, reverse_lazy
from rest_framework.routers import DefaultRouter
from users.views import LoginViewCustom
from accounts.views import CardSerializerViewSet
router = DefaultRouter()
router.register(r'card', CardSerializerViewSet)
urlpattern... | 1.8125 | 2 |
PythonLearn/opencv/synthesis.py | OKKyu/PythonLearn | 0 | 12775106 | #!python3
# -*- coding:utf-8 -*-
# 『Pythonで始めるOpenCV4プログラミング』
# 北山尚洋
import cv2
import sys, traceback
import numpy as np
def add(imgName1, imgName2):
try:
img1 = cv2.imread(imgName1)
img2 = cv2.imread(imgName2)
if img1 is None or img2 is None:
print("no file reading..... | 3.078125 | 3 |
zipline/currency.py | chalant/pluto | 1 | 12775107 | <reponame>chalant/pluto
from functools import partial, total_ordering
from iso4217 import Currency as ISO4217Currency
import numpy as np
_ALL_CURRENCIES = {}
def strs_to_sids(strs, category_num):
"""TODO: Improve this.
"""
out = np.full(len(strs), category_num << 50, dtype='i8')
casted_buffer = np.... | 2.65625 | 3 |
entity.py | Alberdi/rogueforce | 0 | 12775108 | import libtcodpy as libtcod
import cmath as math
NEUTRAL_SIDE = 555
class Entity(object):
def __init__(self, battleground, side=NEUTRAL_SIDE, x=-1, y=-1, char=' ', color=libtcod.white):
self.bg = battleground
self.x = x
self.y = y
self.side = side
self.char = char
self.original_char = char
... | 2.65625 | 3 |
pgxnclient/tar.py | ankane/pgxnclient | 0 | 12775109 | """
pgxnclient -- tar file utilities
"""
# Copyright (C) 2011-2020 <NAME>
# This file is part of the PGXN client
import os
import tarfile
from pgxnclient.i18n import _
from pgxnclient.errors import PgxnClientException
from pgxnclient.archive import Archive
import logging
logger = logging.getLogger('pgxnclient.tar... | 2.40625 | 2 |
bids/convert_log_to_events.py | Charestlab/caos | 0 | 12775110 | <filename>bids/convert_log_to_events.py
"""
Function to convert psychopy log to BIDS events file. See BIDS spec:
https://bids-specification.readthedocs.io/en/latest/04-modality-specific-files/05-task-events.html
https://bids-specification.readthedocs.io/en/latest/04-modality-specific-files/07-behavioral-experiments.ht... | 2.703125 | 3 |
tests/core/test_proxy.py | joewilliams/dd-agent | 11 | 12775111 | <gh_stars>10-100
# stdlib
from unittest import TestCase
# 3p
from requests.utils import get_environ_proxies
# project
from utils.proxy import set_no_proxy_settings
class TestProxy(TestCase):
def test_no_proxy(self):
"""
Starting with Agent 5.0.0, there should always be a local forwarder
... | 2.75 | 3 |
easy/110.Balanced_Binary_Tree.py | Leesoar/leetcode | 2 | 12775112 | <filename>easy/110.Balanced_Binary_Tree.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Question:
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as:
a binary tree in which the depth of the two subtrees of every node never differ by more th... | 4.3125 | 4 |
about.py | sjtrny/toomanyguns | 1 | 12775113 | <filename>about.py
from common import MarkdownApp
import flask
class About(MarkdownApp):
title = "About"
breadcrumbs = None
markdown = """
## About
----
This website shows ownership of firearms in NSW by postcode. This information has been made public thanks to the NSW Greens through a FOI request to NS... | 3.03125 | 3 |
mininet/exabgp-vip/topo.py | ljjjustin/stack-vagrants | 1 | 12775114 | #!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import Node
from mininet.log import setLogLevel, info
from mininet.cli import CLI
import time
import os
workdir = os.path.dirname(os.path.realpath(__file__))
class LinuxRouter( Node ):
"A Node with IP forwarding ena... | 2.390625 | 2 |
lab8-Mid-Course/code/app.py | MadCreeper/SJTU_ICE2602 | 0 | 12775115 | <reponame>MadCreeper/SJTU_ICE2602<filename>lab8-Mid-Course/code/app.py
# SJTU EE208
from flask import Flask, redirect, render_template, request, url_for
app = Flask(__name__)
@app.route('/form', methods=['POST', 'GET'])
def bio_data_form():
if request.method == "POST":
username = request.form['username'... | 2.953125 | 3 |
mistral/scheduler/scheduler_server.py | soda-research/mistral | 205 | 12775116 | <reponame>soda-research/mistral
# Copyright 2018 - Nokia Networks.
#
# 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 re... | 1.882813 | 2 |
quant/example/ex_binance.py | doubleDragon/QuantBot | 7 | 12775117 | <filename>quant/example/ex_binance.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function
from quant.brokers.broker_factory import create_brokers
pair_code = 'Binance_ZRX_ETH'
'''test broker'''
brokers = create_brokers([pair_code])
broker = brokers[pair_code]
'''sell o... | 2.34375 | 2 |
src/krpsim/parsing.py | arlaine4/Krp | 1 | 12775118 | import sys
from src.krpsim.utils import split_need_result_delay, build_process_dic
class Parser:
"""
Parsing Class, heart of the parsing is here.
-> stocks is a list of Stock class instances
-> content is a list of Process class instances
-> optimize is a list of Optimize class instances
-> de... | 3.015625 | 3 |
templatetags/myfilters.py | RoGryza/blog | 0 | 12775119 | <filename>templatetags/myfilters.py
from statik.templatetags import register
@register.filter(name='localized_date')
def localized_date(value, lang):
months = lang.months.split(',')
month = months[value.month - 1]
fmt = str(lang.date_format).replace('%b', month)
return value.strftime(fmt)
| 2.46875 | 2 |
project_code/topology_getter/tools.py | statnett/relevant_assets | 1 | 12775120 | import datetime
import pickle
from enum import Enum
from decorator import decorator
def time_this(fn):
"""
This decorator time the input function :func:`fn`
"""
def timed_fn(fn, *args, **kwargs):
time1 = datetime.datetime.now()
result = fn(*args, **kwargs)
calc_time = datetime... | 3.21875 | 3 |
src/flowket/machines/simple_conv_net_autoregressive_1D.py | vigsterkr/FlowKet | 21 | 12775121 | from .abstract_machine import AutoNormalizedAutoregressiveMachine
from ..deepar.layers import ToFloat32, DownShiftLayer, ExpandInputDim, WeightNormalization
from ..layers import VectorToComplexNumber
from tensorflow.keras.layers import Activation, Conv1D, ZeroPadding1D, Activation, Add
def causal_conv_1d(x, filters,... | 2.4375 | 2 |
fb4_example/bootstrap_flask/exampleapp.py | tholzheim/pyFlaskBootstrap4 | 0 | 12775122 | <filename>fb4_example/bootstrap_flask/exampleapp.py
# -*- coding: utf-8 -*-
import uuid
from fb4.app import AppWrap
from fb4.login_bp import LoginForm
from fb4.sqldb import db
from fb4.login_bp import LoginBluePrint
from fb4.sse_bp import SSE_BluePrint
from fb4.widgets import Link, Icon, Image, Menu, MenuItem, DropDow... | 2.25 | 2 |
docs/load_accessions.py | detrout/htsworkflow | 0 | 12775123 | <reponame>detrout/htsworkflow<gh_stars>0
"""We have many accessions for our libraries,
our data isn't really part of the htsworkflow project
so it seemed unnecessary to put it in the normal migrations
"""
from datetime import datetime
import os
import socket
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"h... | 1.890625 | 2 |
physionet-django/user/management/commands/loaddemo.py | T-CAIREM/physionet-build | 0 | 12775124 | """
Command to:
- load all fixtures named 'demo-*.*'
- create copy the demo media files
This should only be called in a clean database, such as after
`resetdb` is run. This should generally only be used in
development environments.
"""
import os
import shutil
from django.conf import settings
from django.core.managem... | 2.21875 | 2 |
common/replace-placeholders.py | dutradda/devtools | 1 | 12775125 | #!/usr/bin/env python3
import argparse
import re
def main(args):
with open(args.source) as file:
content = file.read()
for pattern, filename in re.findall(r'(\{!(.*)!\})', content):
with open(filename) as file:
match_content = file.read()
dest_content = re.sub(pattern, m... | 3.328125 | 3 |
python/codingame/practice/community/the_greatest_number_python2.py | TGITS/programming-workouts | 0 | 12775126 | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
# Write an action using print
# To debug: print >> sys.stderr, "Debug messages..."
n = int(raw_input())
dot = False
minus = False
numbers = []
characters = raw_input()
print >> sys.std... | 3.796875 | 4 |
tests/testapp/urls.py | niteshsinha17/openwisp-users | 0 | 12775127 | from django.urls import path
from . import views
urlpatterns = [
path('member_view', views.api_member_view, name='test_api_member_view'),
path('manager_view', views.api_manager_view, name='test_api_manager_view'),
path('owner_view', views.api_owner_view, name='test_api_owner_view'),
path('base_org_vie... | 1.71875 | 2 |
predict_helper.py | Emad2018/aipnd-project | 0 | 12775128 | import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms, datasets, models
from collections import OrderedDict
from PIL import Image
import matplotlib.pyplot as plt
import json
import argparse
def load_checkpoint(checkpoint_path, model):
chec... | 2.453125 | 2 |
main.py | larabetul/blm2010 | 0 | 12775129 | # Ad Soyad: <NAME> No: 180401041
#import numpy.matlib #Matrislerde kullanılabilir
from matrix_operations import matrix_transpose # gerekli matris işlemleri için fonksiyonların dahil edilmesi.
# D=A^T --> D= np.transpose(A) --> transpose kullanımı
from matrix... | 2.71875 | 3 |
codeforce_round_647/johnnt_and_ancient_computer.py | NamanMathur77/programming_questions | 0 | 12775130 | def ifPossible(a):
while a%2==0:
a/=2
return a
test=int(input())
while test:
a,b = input().split()
a=int(a)
b=int(b)
if a>b:
n=b
b=a
a=n
num=ifPossible(b)
ans=0
if num!=ifPossible(a):
print("-1")
else:
b/=a
while b>=8:
b/=8
ans+=1
if b>1:
ans+=1
print(ans)
test-=1
| 3.578125 | 4 |
migen/fomu.py | Freax13/fomu-workshop | 127 | 12775131 | <filename>migen/fomu.py
""" Fomu board definitions (mapping of I/O pins, clock, etc.) """
from migen import *
from migen.build.generic_platform import *
from migen.build.lattice import LatticePlatform
class FomuPvtPlatform(LatticePlatform):
""" Based on
https://github.com/litex-hub/litex-boards/blob/mast... | 2.09375 | 2 |
htdocs/plotting/auto/scripts100/p141.py | trentford/iem | 0 | 12775132 | """yieldfx plot"""
import calendar
from collections import OrderedDict
import datetime
import pandas as pd
from pyiem.meteorology import gdd
from pyiem.plot.use_agg import plt
from pyiem.datatypes import temperature, distance
from pyiem.util import get_autoplot_context
STATIONS = OrderedDict([
('ames', 'Centr... | 2.75 | 3 |
0x0B-python-input_output/13-student.py | johncoleman83/bootcampschool-higher_level_programming | 0 | 12775133 | #!/usr/bin/python3
class Student():
"""Student class with name and age"""
def __init__(self, first_name, last_name, age):
"""initializes new instance of Student"""
self.first_name = first_name
self.last_name = last_name
self.age = age
def to_json(self, attrs=None):
"... | 3.859375 | 4 |
TML/src/utils/load_data.py | Pepijnnn/MasterThesis | 0 | 12775134 | <gh_stars>0
import numpy as np
import sklearn.datasets as datasets
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
import string
from scipy.io import arff
import cv2
import torch
from torchvision import transforms
from torch.utils.data import DataLoader, Dataset, TensorDataset
... | 2.359375 | 2 |
routes/friends.py | Prouser123/xbl-web-api | 16 | 12775135 | from quart import jsonify
from providers.BlueprintProvider import BlueprintProvider
class Friends(BlueprintProvider):
def __craftSummary(self, data):
return jsonify(
{
"following": data.target_following_count,
"followers": data.target_follower_count,
... | 2.4375 | 2 |
api/tests/integration/tests/deco/deco_iter.py | f1nzer/Indigo | 0 | 12775136 | <filename>api/tests/integration/tests/deco/deco_iter.py
import sys
sys.path.append("../../common")
from env_indigo import *
#
# Prepare a molecule for printing out
#
def prepareStructure(mol):
for atom in mol.iterateAtoms():
atom.setXYZ(0, 0, 0)
for rg in mol.iterateRGroups():
if rg.iterateRG... | 2.234375 | 2 |
task_manager.py | technetbytes/Nested-Object-Serialization | 0 | 12775137 | from task import Task
from tasks import Tasks
from status import Status
import redis
import datetime
import json
from json_extension import check_update_list
from converter import datetime_converter
class TaskManager:
_redis = None
_task_management_key = None
def __redis():
server = "localhost"
... | 2.578125 | 3 |
getNBAStats.py | JasonG7234/NBA-Draft-Model-Hopefully- | 0 | 12775138 | from utils import *
import pandas as pd
import sys
import csv
GP = []
MPG = []
WS = []
WSP48 = []
BPM = []
VORP = []
PLUSMINUS = []
NBA_STATS = [GP, MPG, WS, WSP48, BPM, VORP, PLUSMINUS]
def main():
all = get_csv_file("add NBA stats? ")
all = populate_NBA_all_statistics(all)
addNBAStatsToMasterList(pd.rea... | 3.296875 | 3 |
app/backend-test/core_datasets/run01_create_dataset_from_config_v2.py | SummaLabs/DLS | 32 | 12775139 | <reponame>SummaLabs/DLS
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import sys
import glob
import numpy as np
import matplotlib.pyplot as plt
import skimage.io as skio
import app.backend.core.utils as dlsutils
from app.backend.core.datasets.dbbuilder import DBImage2DBuilder
##############... | 2.078125 | 2 |
w3testrunner/browsers/dummy.py | formido/browsercontrol | 0 | 12775140 | import logging
import urllib2
from w3testrunner.browsers.browser import Browser
log = logging.getLogger(__name__)
class DummyBrowser(Browser):
"""Extension of Browser that does nothing."""
name = "dummy"
nopath = True
def __init__(self, browser_info):
super(DummyBrowser, self).__init__(brow... | 2.65625 | 3 |
trane/core/labeler.py | FeatureLabs/Trane | 31 | 12775141 | <gh_stars>10-100
import logging
import time
import pandas as pd
from .prediction_problem_saver import prediction_problems_from_json_file
__all__ = ['Labeler']
class Labeler():
"""
Object for executing prediction problems on data in order
to generate labels for many prediction problems.
The execute ... | 2.96875 | 3 |
sona/create_sounds.py | jayfry1077/runeterra_audio_discord_bot | 0 | 12775142 | <filename>sona/create_sounds.py
from boto3 import Session
from botocore.exceptions import BotoCoreError, ClientError
from contextlib import closing
import os
import pydub
import sys
import subprocess
from tempfile import gettempdir
def text_to_audio(path_to_text=str, OGG_PATH=str, WAV_PATH=str, voice_id='Salli'):
... | 2.8125 | 3 |
trainer.py | safdark/AI-VUI-Capstone | 0 | 12775143 | from train_utils import train_model
from sample_models import custom_rnn_model
from keras.layers import SimpleRNN, GRU, LSTM
import argparse
import sys
import os
from os.path import join
if __name__ == '__main__':
from keras.backend.tensorflow_backend import set_session
import tensorflow as tf
config = tf... | 2.234375 | 2 |
pro.py | CMWENLIU/Fuzzy_text_matching | 0 | 12775144 | <reponame>CMWENLIU/Fuzzy_text_matching
import os
import time
import collections
import pandas as pd
import numpy as np
from collections import Counter
from google_images_download import google_images_download #importing the library
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
class Drug(object):
""... | 2.640625 | 3 |
livemelee/startup.py | wong-justin/melee-bot | 1 | 12775145 | '''Create entry point to init everything and start Dolphin.'''
import argparse
# import sys
from pathlib import Path
import melee
from .interact import LiveInputsThread
def start_game(ports, cmds={}, log=True):
'''Main method to fully start game.
Command-line first needs dolphin path and iso path, then game s... | 2.796875 | 3 |
APP/SpeechExtraction/speech_blueprint.py | Valuebai/Text-Auto-Summarization | 39 | 12775146 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@IDE :PyCharm
@Author :LuckyHuibo
@Date :2019/10/16 22:32
@Desc :
=================================================='''
from flask import request, render_template, jsonify, Blueprint
# from flask ... | 2.015625 | 2 |
rnaposerplugin/__init__.py | atfrank/RNAPosers | 7 | 12775147 | <gh_stars>1-10
from __future__ import absolute_import
from __future__ import print_function
# Avoid importing "expensive" modules here (e.g. scipy), since this code is
# executed on PyMOL's startup. Only import such modules inside functions.
def __init_plugin__(app=None):
from pymol.plugins import addmenuitemqt
... | 2.296875 | 2 |
offer_curves.py | ElisNycander/nordic_model | 1 | 12775148 | # -*- coding: utf-8 -*-
"""
Class for storing supply curves and calculating marginal costs
Created on Thu Feb 7 15:34:33 2019
@author: elisn
"""
import pickle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
class SupplyCurve():
""" Has panda dataframe with list of bids
One or ... | 3.421875 | 3 |
setup.py | jsfehler/pytest-packagetree | 0 | 12775149 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import codecs
from setuptools import setup
setup(
name='pytest-packagetree',
version='0.0.1',
author='<NAME>',
author_email='<EMAIL>',
maintainer='<NAME>',
maintainer_email='<EMAIL>',
license='MIT',
url='https://github.com/jsfehl... | 1.101563 | 1 |
eufySecurityApi/cli.py | Rihan9/uefiSecurityApi | 1 | 12775150 | <gh_stars>1-10
import click, logging, asyncio, time
from .api import Api
from .const import TWO_FACTOR_AUTH_METHODS
import asyncio
_logger = logging.getLogger(__name__)
logging.basicConfig(format='%(name)-10s %(levelname)-8s %(message)s')
uefyApi = None
#pylint: disable=no-value-for-parameter
try:
loop = asynci... | 2.3125 | 2 |