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 |
|---|---|---|---|---|---|---|
tests/test_preempt_return.py | vpv11110000/pyss | 0 | 300 | <reponame>vpv11110000/pyss<gh_stars>0
# #!/usr/bin/python
# -*- coding: utf-8 -*-
# test_preempt_return.py
# pylint: disable=line-too-long,missing-docstring,bad-whitespace, unused-argument, too-many-locals
import sys
import os
import random
import unittest
DIRNAME_MODULE = os.path.dirname(os.path.dirname(os.path.di... | 1.898438 | 2 |
python/ray/rllib/ddpg2/ddpg_evaluator.py | songqing/ray | 1 | 301 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import ray
from ray.rllib.ddpg2.models import DDPGModel
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.optimizers import PolicyEvaluator
from ray.rllib.utils.filter import ... | 2.1875 | 2 |
python/sysmap/graph.py | harryherold/sysmap | 1 | 302 | <reponame>harryherold/sysmap
from graphviz import Digraph
from collections import namedtuple
class NetworkGraph:
''' Representation of the network connections.
This class contains the entities in the network e.g. hosts or switches.
And the connections between them.
'''
Vertex = namedtuple... | 2.984375 | 3 |
png/imageRecognition_Simple.py | tanthanadon/senior | 0 | 303 | from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from skimage import io
import matplotlib.pyplot as plt
image = io.imread("star.jpg")
image_gray = rgb2gray(image)
blobs_log = blob_log(image_gray, max_sigma=30, num_sigma=10, th... | 2.828125 | 3 |
indexof.py | gnuchev/homework | 0 | 304 | def indexof(listofnames, value):
if value in listofnames:
value_index = listofnames.index(value)
return(listofnames, value_index)
else: return(-1)
| 3.578125 | 4 |
Day22_Pong/ball.py | syt1209/PythonProjects | 1 | 305 | from turtle import Turtle
SPEED = 10
class Ball(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.color("white")
self.shape("circle")
self.move_speed = 0.1
self.y_bounce = 1
self.x_bounce = 1
def move(self):
new_x = self.xcor() ... | 3.6875 | 4 |
programs/combine/jry2/treedef.py | lsrcz/SyGuS | 1 | 306 | from jry2.semantics import Expr
class TreeNode:
pass
class TreeLeaf(TreeNode):
def __init__(self, term):
self.term = term
def getExpr(self):
return self.term
class TreeInnerNode(TreeNode):
def __init__(self, pred, left, right):
self.pred = pred
self.left = left
... | 3 | 3 |
src/sage/modular/dirichlet.py | hsm207/sage | 1 | 307 | # -*- coding: utf-8 -*-
r"""
Dirichlet characters
A :class:`DirichletCharacter` is the extension of a homomorphism
.. MATH::
(\ZZ/N\ZZ)^* \to R^*,
for some ring `R`, to the map `\ZZ/N\ZZ \to R` obtained by sending
those `x\in\ZZ/N\ZZ` with `\gcd(N,x)>1` to `0`.
EXAMPLES::
sage: G = DirichletGroup(35)
... | 2.40625 | 2 |
src/biotite/file.py | danijoo/biotite | 208 | 308 | <reponame>danijoo/biotite
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite"
__author__ = "<NAME>"
__all__ = ["File", "TextFile", "InvalidFileError"]
import abc
import io
import warnings
from .... | 2.90625 | 3 |
src/cms/views/push_notifications/push_notification_sender.py | mckinly/cms-django | 0 | 309 | """
Module for sending Push Notifications
"""
import logging
import requests
from django.conf import settings
from ...models import PushNotificationTranslation
from ...models import Region
from ...constants import push_notifications as pnt_const
logger = logging.getLogger(__name__)
# pylint: disable=too-few-public... | 2.4375 | 2 |
tests/functional/index/create/test_03.py | reevespaul/firebird-qa | 0 | 310 | #coding:utf-8
#
# id: functional.index.create.03
# title: CREATE ASC INDEX
# decription: CREATE ASC INDEX
#
# Dependencies:
# CREATE DATABASE
# CREATE TABLE
# SHOW INDEX
# tracker_id:
# min_versions: []
# versions: 1.0
# qm... | 1.804688 | 2 |
app/logic/httpcommon/Page.py | imvu/bluesteel | 10 | 311 | <filename>app/logic/httpcommon/Page.py<gh_stars>1-10
""" Page object file """
class Page():
""" Page object, it contains information about the pare we are refering, index, items per page, etc. """
page_index = 0
items_per_page = 0
def __init__(self, items_per_page, page_index):
""" Creates th... | 2.875 | 3 |
models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/PyTorch/pt_personreid-res18_market1501_176_80_1.1G_1.3/code/core/data_manager.py | guochunhe/Vitis-AI | 1 | 312 | # Copyright 2019 Xilinx Inc.
#
# 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, ... | 1.828125 | 2 |
PyBank/.ipynb_checkpoints/Pymain-checkpoint.py | yash5OG/PythonChallengeW3-Y5 | 0 | 313 | {
"cells": [
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [],
"source": [
"# Import libraries\n",
"import os, csv"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"#variables for the script\n",
... | 2.390625 | 2 |
xlib/api/win32/oleaut32/oleaut32.py | jkennedyvz/DeepFaceLive | 0 | 314 | <reponame>jkennedyvz/DeepFaceLive<gh_stars>0
from ctypes import POINTER, Structure
from ..wintypes import VARIANT, dll_import
@dll_import('OleAut32')
def VariantInit( pvarg : POINTER(VARIANT) ) -> None: ...
| 1.46875 | 1 |
azure-devops/azext_devops/vstsCompressed/service_hooks/v4_0/models/__init__.py | vijayraavi/azure-devops-cli-extension | 0 | 315 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.203125 | 1 |
pizdyuk/pzd_logging.py | DeathAdder1999/Pizdyuk | 1 | 316 | <filename>pizdyuk/pzd_logging.py<gh_stars>1-10
import datetime as date
from pzd_utils import datetime_to_str
class PizdyukLogger:
__logger = None
def __init__(self):
global __logger
if self.__logger:
raise RuntimeError("Logger instance already exists")
@staticmethod
d... | 2.78125 | 3 |
beta_reconstruction/crystal_relations.py | LightForm-group/beta-reconstruction | 0 | 317 | import numpy as np
from defdap.quat import Quat
hex_syms = Quat.symEqv("hexagonal")
# subset of hexagonal symmetries that give unique orientations when the
# Burgers transformation is applied
unq_hex_syms = [
hex_syms[0],
hex_syms[5],
hex_syms[4],
hex_syms[2],
hex_syms[10],
hex_syms[11]
]
cubi... | 2.453125 | 2 |
a2.py | Changhong-Jiang/test | 0 | 318 | print('222')
| 1.429688 | 1 |
app/api/v1/views/auth_views.py | emdeechege/Questionaire-API | 0 | 319 | <filename>app/api/v1/views/auth_views.py
from flask import jsonify, Blueprint, request, json, make_response
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
from ..utils.validators import Validation
from ..models.auth_models import Users
v1_auth_blueprint = Bluep... | 2.578125 | 3 |
pint/testsuite/test_definitions.py | s-avni/pint | 0 | 320 | # -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, print_function, absolute_import
from pint.util import (UnitsContainer)
from pint.converters import (ScaleConverter, OffsetConverter)
from pint.definitions import (Definition, PrefixDefinition, UnitDefinition,
Dime... | 2.359375 | 2 |
electrum/dnssec.py | Jesusown/electrum | 5,905 | 321 | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# 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 limitati... | 1.476563 | 1 |
specs/d3d11.py | ds-hwang/apitrace | 1 | 322 | ##########################################################################
#
# Copyright 2012 <NAME>
# 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 restricti... | 1.375 | 1 |
day08.py | Pil0u/adventofcode2020 | 0 | 323 | <filename>day08.py
from copy import deepcopy
def boot(seq):
index = 0
played_indices = set()
acc = 0
while True:
if index == len(seq):
return True, acc
if index in played_indices:
return False, acc
played_indices.add(index)
line = seq[index].... | 2.875 | 3 |
train_fcn.py | onlyNata/segModel | 3 | 324 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 16:34:21 2018
@author: LiHongWang
"""
import os
import tensorflow as tf
from model import fcn_vgg
from model import fcn_mobile
from model import fcn_resnet_v2
from data import input_data
slim = tf.contrib.slim
def main():
num_classes... | 2.34375 | 2 |
setup.py | xbabka01/filetype.py | 0 | 325 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
from setuptools import find_packages, setup
setup(
name='filetype',
version='1.0.7',
description='Infer file type and MIME type of any file/buffer. '
'No external dependencies.',
long_description=codecs.open('README.rst', 'r',... | 1.28125 | 1 |
demos/netmiko_textfsm.py | ryanaa08/NPA | 4 | 326 | # make sure templates are present and netmiko knows about them
# git clone https://github.com/networktocode/ntc-templates
# export NET_TEXTFSM=/home/ntc/ntc-templates/templates/
# see https://github.com/networktocode/ntc-templates/tree/master/templates
# for list of templates
from netmiko import ConnectHandler
import... | 2.21875 | 2 |
iap/validate_jwt.py | spitfire55/python-docs-samples | 4 | 327 | <gh_stars>1-10
# Copyright 2016 Google 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 by app... | 2.15625 | 2 |
examples/calc.py | manatlan/htag | 1 | 328 | <filename>examples/calc.py<gh_stars>1-10
import os,sys; sys.path.insert(0,os.path.dirname(os.path.dirname(__file__)))
from htag import Tag
"""
This example show you how to make a "Calc App"
(with physical buttons + keyboard events)
There is no work for rendering the layout ;-)
Can't be simpler !
"""
class Calc(Ta... | 3.265625 | 3 |
res/example1.py | tghira16/Giraphics | 1 | 329 | <filename>res/example1.py
from giraphics.graphing.graph import Graph
def func(x):
return (x-3)*(x+2)*x*0.2
g = Graph(800,600,8,6, 'example1.svg')
g.bg()
g.grid()
g.axes()
g.graph(func)
g.save()
g.display() | 2.890625 | 3 |
tools/data.py | seanys/2D-Irregular-Packing-Algorithm | 29 | 330 | from tools.geofunc import GeoFunc
import pandas as pd
import json
def getData(index):
'''报错数据集有(空心):han,jakobs1,jakobs2 '''
'''形状过多暂时未处理:shapes、shirt、swim、trousers'''
name=["ga","albano","blaz1","blaz2","dighe1","dighe2","fu","han","jakobs1","jakobs2","mao","marques","shapes","shirts","swim","trousers"]
... | 3.109375 | 3 |
src/trw/reporting/__init__.py | civodlu/trw | 3 | 331 | <reponame>civodlu/trw
#from trw.utils import collect_hierarchical_module_name, collect_hierarchical_parameter_name, get_batch_n, to_value, \
# safe_lookup, len_batch
from .export import as_image_ui8, as_rgb_image, export_image, export_sample, export_as_image
from .table_sqlite import TableStream, SQLITE_TYPE_PATTERN... | 1.195313 | 1 |
vframe_cli/commands/templates/image-mp.py | julescarbon/vframe | 1 | 332 | #############################################################################
#
# VFRAME
# MIT License
# Copyright (c) 2020 <NAME> and VFRAME
# https://vframe.io
#
#############################################################################
import click
@click.command('')
@click.option('-i', '--input', 'opt_dir_i... | 2.109375 | 2 |
src/learndash/api_resources/user.py | MarkMacDon/learndash-python | 0 | 333 | <filename>src/learndash/api_resources/user.py
import learndash
from learndash.api_resources.abstract import ListableAPIResource
from learndash.api_resources.abstract import RetrievableAPIResource
from learndash.api_resources.abstract import UpdateableAPIResource
from learndash.api_resources.abstract import NestedAPIRe... | 2.140625 | 2 |
lib/galaxy/tool_util/deps/container_resolvers/__init__.py | sneumann/galaxy | 1 | 334 | <filename>lib/galaxy/tool_util/deps/container_resolvers/__init__.py<gh_stars>1-10
"""The module defines the abstract interface for resolving container images for tool execution."""
from abc import (
ABCMeta,
abstractmethod,
abstractproperty,
)
import six
from galaxy.util.dictifiable import Dictifiable
@... | 2.359375 | 2 |
projects/eyetracking/gen_adhd_sin.py | nirdslab/streaminghub | 0 | 335 | <reponame>nirdslab/streaminghub
#!/usr/bin/env python3
import glob
import os
import pandas as pd
import dfs
SRC_DIR = f"{dfs.get_data_dir()}/adhd_sin_orig"
OUT_DIR = f"{dfs.get_data_dir()}/adhd_sin"
if __name__ == '__main__':
files = glob.glob(f"{SRC_DIR}/*.csv")
file_names = list(map(os.path.basename, files))... | 2.171875 | 2 |
dataProcessing.py | TauferLab/PENGUIN | 0 | 336 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import matplotlib.pyplot as plt
import CurveFit
import shutil
#find all DIRECTORIES containing non-hidden files ending in FILENAME
def getDataDirectories(DIRECTORY, FILENAME="valLoss.txt"):
directories=[]
for directory in os.scand... | 2.890625 | 3 |
algo_probs/newcoder/classic/nc52.py | Jackthebighead/recruiment-2022 | 0 | 337 | <filename>algo_probs/newcoder/classic/nc52.py
# 题意:给出一个仅包含字符'(',')','{','}','['和']',的字符串,判断给出的字符串是否是合法的括号序列。括号必须以正确的顺序关闭,"()"和"()[]{}"都是合法的括号序列,但"(]"和"([)]"不合法。
# @param s string字符串
# @return bool布尔型
#
class Solution:
def isValid(self , s ):
# write code here
if not s: return True
stack = ... | 3.328125 | 3 |
piecrust/processing/util.py | airbornemint/PieCrust2 | 0 | 338 | import os.path
import time
import logging
import yaml
from piecrust.processing.base import Processor
logger = logging.getLogger(__name__)
class _ConcatInfo(object):
timestamp = 0
files = None
delim = "\n"
class ConcatProcessor(Processor):
PROCESSOR_NAME = 'concat'
def __init__(self):
... | 2.421875 | 2 |
src/events/cell_pressed.py | ArcosJuan/Get-out-of-my-fucking-maze | 2 | 339 | from src.events import Event
class CellPressed(Event):
def __init__(self, position):
self.position = position
def get_position(self):
return self.position | 2.265625 | 2 |
TopQuarkAnalysis/TopJetCombination/python/TtSemiLepJetCombMaxSumPtWMass_cfi.py | ckamtsikis/cmssw | 852 | 340 | import FWCore.ParameterSet.Config as cms
#
# module to make the MaxSumPtWMass jet combination
#
findTtSemiLepJetCombMaxSumPtWMass = cms.EDProducer("TtSemiLepJetCombMaxSumPtWMass",
## jet input
jets = cms.InputTag("selectedPatJets"),
## lepton input
leps = cms.InputTag("selectedPatMuons"),
## ma... | 1.898438 | 2 |
xortool/__init__.py | runapp/xortool | 14 | 341 | <reponame>runapp/xortool<filename>xortool/__init__.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
__all__ = ["args", "colors", "libcolors", "routine"]
__version__ = "0.96"
| 1.210938 | 1 |
baopig/ressources/ressources.py | ChreSyr/baopig | 0 | 342 | <gh_stars>0
from baopig.pybao.objectutilities import Object
from baopig.pybao.issomething import *
class RessourcePack:
def config(self, **kwargs):
for name, value in kwargs.items():
self.__setattr__('_'+name, value)
class FontsRessourcePack(RessourcePack):
def __init__(self,
... | 2.4375 | 2 |
bufr_extract_unique_stations.py | glamod/glamod-misc | 0 | 343 | #!/usr/bin/python2.7
"""
Extract unique set of station locations (and names) along with number of obs
RJHD - Exeter - October 2017
"""
# ECMWF import defaults
import traceback
import sys
from eccodes import *
# RJHD imports
import cartopy
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotli... | 2.5625 | 3 |
libsaas/services/twilio/applications.py | MidtownFellowship/libsaas | 155 | 344 | <gh_stars>100-1000
from libsaas import http, parsers
from libsaas.services import base
from libsaas.services.twilio import resource
class ApplicationsBase(resource.TwilioResource):
path = 'Applications'
class Application(ApplicationsBase):
def create(self, *args, **kwargs):
raise base.MethodNotSu... | 2.578125 | 3 |
research/gnn/sgcn/postprocess.py | leelige/mindspore | 1 | 345 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 a... | 2.296875 | 2 |
pykeops/common/get_options.py | dvolgyes/keops | 1 | 346 | import re
import numpy as np
from collections import OrderedDict
import pykeops
import pykeops.config
############################################################
# define backend
############################################################
class SetBackend():
"""
This class is used to centralized the op... | 2.703125 | 3 |
prepare_features_vc.py | tkm2261/dnn-voice-changer | 13 | 347 | <filename>prepare_features_vc.py
"""Prepare acoustic features for one-to-one voice conversion.
usage:
prepare_features_vc.py [options] <DATA_ROOT> <source_speaker> <target_speaker>
options:
--max_files=<N> Max num files to be collected. [default: 100]
--dst_dir=<d> Destination directory [defau... | 2.375 | 2 |
lib/tests/streamlit/pydeck_test.py | zgtz/streamlit | 1 | 348 | <filename>lib/tests/streamlit/pydeck_test.py
# Copyright 2018-2021 Streamlit Inc.
#
# 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 ... | 2.59375 | 3 |
sdks/python/apache_beam/io/gcp/bigquery_tools.py | Doctusoft/beam | 0 | 349 | <filename>sdks/python/apache_beam/io/gcp/bigquery_tools.py
#
# 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 Ap... | 1.671875 | 2 |
VENV/lib/python3.6/site-packages/PyInstaller/hooks/hook-PyQt5.py | workingyifei/display-pattern-generator | 3 | 350 | #-----------------------------------------------------------------------------
# Copyright (c) 2005-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | 1.890625 | 2 |
tests/ast/nodes/test_from_node.py | upgradvisor/vyper | 1,471 | 351 | from vyper import ast as vy_ast
def test_output_class():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert isinstance(new_node, vy_ast.Int)
def test_source():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node... | 2.421875 | 2 |
generator/modules/opencv.py | dayta-ai/deepo | 1 | 352 | # -*- coding: utf-8 -*-
from .__module__ import Module, dependency, source, version
from .tools import Tools
from .boost import Boost
from .python import Python
@dependency(Tools, Python, Boost)
@source('git')
@version('4.0.1')
class Opencv(Module):
def build(self):
return r'''
RUN ln -fs /usr/sh... | 1.625 | 2 |
day16/solve16.py | jmacarthur/aoc2017 | 0 | 353 | #!/usr/bin/python
import sys
import copy
stage_length = 16
stage = map(chr, range(ord('a'),ord('a')+stage_length))
def spin(amount):
"""To save time, this function isn't used except at the end.
Normally, a counter marks the start of the stage and this changes
instead. """
global stage
stage = stag... | 3.390625 | 3 |
skimage/segmentation/tests/test_felzenszwalb.py | jaberg/scikits-image | 2 | 354 | <reponame>jaberg/scikits-image
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from nose.tools import assert_greater
from skimage.segmentation import felzenszwalb
def test_grey():
# very weak tests. This algorithm is pretty unstable.
img = np.zeros((20, 21))
img[:10, 10:] = 0... | 2.375 | 2 |
tests/middleware/test_csrf_middleware.py | w3x10e8/core | 0 | 355 | <filename>tests/middleware/test_csrf_middleware.py
from masonite.request import Request
from masonite.view import View
from masonite.auth.Csrf import Csrf
from masonite.app import App
from masonite.middleware import CsrfMiddleware
from masonite.testsuite.TestSuite import generate_wsgi
import pytest
from masonite.except... | 2.28125 | 2 |
phoible/views.py | ltxom/phoible | 31 | 356 | <reponame>ltxom/phoible
from pyramid.view import view_config
import os
@view_config(route_name='faq', renderer='faq.mako')
def faq_view(request):
dir_path = os.path.dirname(__file__)
faq_file = os.path.join(dir_path, 'static/faq_with_indexes.html')
with open(faq_file, 'r') as f:
faq_page = f.read(... | 2.234375 | 2 |
tests/restapi/test_routes.py | aiace9/aiida-core | 0 | 357 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 1.875 | 2 |
processmonitor.py | yletallec/processmonitor | 0 | 358 | <gh_stars>0
"""Process Monitor
Usage:
processmonitor.py <process_name> <overall_duration> [<sampling_interval>]
processmonitor.py -h|--help
processmonitor.py -v|--version
Options:
<process_name> Process name argument.
<overall_duration> Overall duration of the monitoring in seconds.
<sampling_i... | 2.8125 | 3 |
Projects/DeepLearningTechniques/MobileNet_v2/tiny_imagenet/data_loader.py | Tim232/Python-Things | 2 | 359 | <gh_stars>1-10
import os
import re
import numpy as np
from Projects.DeepLearningTechniques.MobileNet_v2.tiny_imagenet.constants import *
class DataLoader:
# todo train/test/validation => (클래스 당 500/50/50)
def __init__(self):
self.image_width = flags.FLAGS.image_width
self.image_height = flags... | 2.34375 | 2 |
MarkReport/MarkReport.py | dedukun/MarkReport | 0 | 360 | <filename>MarkReport/MarkReport.py
#!/usr/bin/env python3
# Command line flags
import os
import glob
import re
import pyinotify
import subprocess
from sys import stdout, stderr
from time import time, sleep
from tempfile import gettempdir
from distutils.dir_util import copy_tree
from shutil import copyfile
from weasyp... | 2.46875 | 2 |
DFS/13023.py | kjh9267/BOJ_Python | 0 | 361 | # https://www.acmicpc.net/problem/13023
import sys
sys.setrecursionlimit(999999999)
def dfs_all():
is_possible = [False]
for node in range(N):
visited = [False for _ in range(N)]
dfs(node, 0, visited, is_possible)
if is_possible[0]:
return 1
return 0
def dfs(cur, ... | 3.046875 | 3 |
experiments/bst/setup.py | bigchaindb/privacy-protocols | 68 | 362 | <reponame>bigchaindb/privacy-protocols
"""bst: BigchainDB Sharing Tools"""
from setuptools import setup, find_packages
install_requires = [
'base58~=0.2.2',
'PyNaCl~=1.1.0',
'bigchaindb-driver',
'click==6.7',
'colorama',
]
setup(
name='bst',
version='0.1.0',
description='bst: Bigchai... | 1.570313 | 2 |
polyaxon/db/admin/job_resources.py | elyase/polyaxon | 0 | 363 | <gh_stars>0
from django.contrib import admin
from db.models.job_resources import JobResources
admin.site.register(JobResources)
| 1.25 | 1 |
voting_ml/main.py | tommy-waltmann/voting-ml | 0 | 364 | <reponame>tommy-waltmann/voting-ml<filename>voting_ml/main.py
import numpy as np
import sklearn
import subprocess
from sklearn import model_selection, tree
import data
import feature_selection
import model_sel
import os
import matplotlib.pyplot as plt
import seaborn as sns
def main():
#parameter space
list_... | 3 | 3 |
src/the_tale/the_tale/game/heroes/tests/test_logic.py | al-arz/the-tale | 0 | 365 | <reponame>al-arz/the-tale
import smart_imports
smart_imports.all()
class HeroDescriptionTests(utils_testcase.TestCase):
def setUp(self):
super().setUp()
game_logic.create_test_map()
account = self.accounts_factory.create_account(is_fast=True)
self.storage = game_logic_storage... | 2.390625 | 2 |
tinylinks/tests/test_app/models.py | brad/django-tinylinks | 11 | 366 | <filename>tinylinks/tests/test_app/models.py<gh_stars>10-100
"""Dummy model needed for tests."""
pass
| 1.046875 | 1 |
postcipes/hydraulic_jump.py | timofeymukha/postcipes | 0 | 367 | # This file is part of postcipes
# (c) <NAME>
# The code is released under the MIT Licence.
# See LICENCE.txt and the Legal section in the README for more information
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .postcipe import Postcipe
import turbu... | 2.25 | 2 |
main/SimulationSettings/ScreenshotsSteppable/Simulation/screenshots_steppables.py | JulianoGianlupi/nh-cc3d-4x-base-tool | 0 | 368 | from cc3d.core.PySteppables import *
from cc3d import CompuCellSetup
from random import random
class ScreenshotSteppable(SteppableBasePy):
def __init__(self, frequency=10):
SteppableBasePy.__init__(self, frequency)
def step(self, mcs):
if mcs in [3, 5, 19,20, 23, 29, 31]:
self.req... | 2.328125 | 2 |
aesara/gpuarray/optdb.py | anirudhacharya/aesara | 1 | 369 | <filename>aesara/gpuarray/optdb.py
from aesara.compile import optdb
from aesara.graph.opt import GraphToGPULocalOptGroup, TopoOptimizer, local_optimizer
from aesara.graph.optdb import (
EquilibriumDB,
LocalGroupDB,
OptimizationDatabase,
SequenceDB,
)
gpu_optimizer = EquilibriumDB()
gpu_cut_copies = Eq... | 2.109375 | 2 |
jenkinsapi/node.py | imsardine/jenkinsapi | 0 | 370 | <reponame>imsardine/jenkinsapi<gh_stars>0
"""
Module for jenkinsapi Node class
"""
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.custom_exceptions import PostRequired
import logging
try:
from urllib import quote as urlquote
except ImportError:
# Python3
from urllib.parse import quote as u... | 2.328125 | 2 |
edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/gfe/textproducts/templates/product/GenericHazards.py | srcarter3/awips2 | 0 | 371 | ##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non... | 1.179688 | 1 |
virtualscreening/vina/spark/buried_areas.py | rodrigofaccioli/drugdesign | 3 | 372 | <filename>virtualscreening/vina/spark/buried_areas.py
from pyspark import SparkContext, SparkConf, SparkFiles
from pyspark.sql import SQLContext, Row
import ConfigParser as configparser
from subprocess import Popen, PIPE
from datetime import datetime
from vina_utils import get_directory_complex_pdb_analysis, get_files_... | 2.28125 | 2 |
oase-root/web_app/views/system/mail/action_mail.py | Masa-Yasuno/oase | 9 | 373 | <gh_stars>1-10
# Copyright 2019 NEC 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 applicable law or a... | 1.851563 | 2 |
queue/animal_queue.py | cozek/code-practice | 0 | 374 | #!/usr/bin/env python3
from typing import Any, Union
class Animal:
def __init__(self, name: str) -> None:
self.name = name
def set_order(self, order: int) -> None:
self.order = order
def peek_order(self) -> int:
return self.order
def __str__(self) -> str:
return f"{... | 3.734375 | 4 |
ophyd/areadetector/detectors.py | NSLS-II/ophyd | 16 | 375 | # vi: ts=4 sw=4
'''AreaDetector Devices
`areaDetector`_ detector abstractions
.. _areaDetector: https://areadetector.github.io/master/index.html
'''
import warnings
from .base import (ADBase, ADComponent as C)
from . import cam
__all__ = ['DetectorBase',
'AreaDetector',
'AdscDetector',
... | 2.0625 | 2 |
python/EXERCICIO 96 - FUNCAO QUE CALCULA A AREA.py | debor4h/exerciciosPython | 1 | 376 | def area(msg):#declaracao da funcao com o parametro msg
print(msg)#aqui msg e a area
print('Controle de Terrenos')
print('-' * 20)
l = float(input('Largura (m): '))
c = float(input('Comprimento (m): '))
area(f'A área do seu terreno {l}X{c} é de {l*c}m².')
| 3.609375 | 4 |
auth_iam/dashboard/auth/routes.py | santiher/dash-auth-example | 11 | 377 | import os
from functools import wraps
from os.path import join as join_path
from dash import Dash
from flask import make_response, render_template_string, redirect
excluded_resources_endpoints = (
'static', '_dash_assets.static', '/_favicon.ico', '/login', '/logout',
'/_user', '/auth')
def add_routes(app,... | 2.65625 | 3 |
amazon/model_api/migrations/0005_remove_order_datetimecreated_alter_order__id_and_more.py | gabrielkarras/SOEN341 | 3 | 378 | # Generated by Django 4.0.1 on 2022-04-07 01:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('model_api', '0004_remove_order_created_remove_order_id_and_more'),
]
operations = [
migrations.RemoveField(
model_name='order',
... | 1.640625 | 2 |
items/migrations/0001_initial.py | tony-joseph/livre | 1 | 379 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-21 12:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.... | 1.671875 | 2 |
compliance_suite/exceptions/user_config_exception.py | alextsaihi/rnaget-compliance-suite | 1 | 380 | <filename>compliance_suite/exceptions/user_config_exception.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""Module compliance_suite.exceptions.user_config_exception.py
This module contains class definition for user config file exceptions.
"""
class UserConfigException(Exception):
"""Exception for user config file-rel... | 2.328125 | 2 |
2021/day15/aoc-2021-d15.py | bbornstein/aoc | 0 | 381 | <reponame>bbornstein/aoc
#!/usr/bin/env python3
# Advent of Code 2021, Day 15 (https://adventofcode.com/2021/day/15)
# Author: <NAME>
import collections
import heapq
Point = collections.namedtuple('Point', ['x', 'y'])
Point.__add__ = lambda self, q: Point(self[0] + q[0], self[1] + q[1])
class RiskMap:
... | 3.328125 | 3 |
indico/modules/events/abstracts/compat.py | aiforrural/Digital-Events-Example | 1 | 382 | # This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import redirect
from indico.modules.events.abstracts.models.abstracts import Abstract
from ind... | 1.78125 | 2 |
src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/database_account_list_keys_result_py3.py | limingu/azure-cli-extensions | 2 | 383 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.96875 | 2 |
Google/google_books/scrape_google_books.py | dimitryzub/blog-posts-archive | 0 | 384 | from parsel import Selector
import requests, json, re
params = {
"q": "<NAME>",
"tbm": "bks",
"gl": "us",
"hl": "en"
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36",
}
html = requests.get("https://www... | 2.8125 | 3 |
Python/Higher-Or-Lower/hol/__init__.py | AustinTSchaffer/DailyProgrammer | 1 | 385 | <reponame>AustinTSchaffer/DailyProgrammer<filename>Python/Higher-Or-Lower/hol/__init__.py
r"""
Contains classes and methods that can be used when simulating the game
Higher-or-Lower and performing statistical analysis on different games.
"""
from hol import (
cards,
constants,
)
from hol._hol import (
g... | 2.640625 | 3 |
Lib/hTools2/dialogs/glyphs/slide.py | gferreira/hTools2 | 11 | 386 | # [h] slide selected glyphs
from mojo.roboFont import CurrentFont, CurrentGlyph, version
from vanilla import *
from hTools2 import hDialog
from hTools2.modules.fontutils import get_full_name, get_glyphs
from hTools2.modules.messages import no_font_open, no_glyph_selected
class slideGlyphsDialog(hDialog):
'''A di... | 2.703125 | 3 |
werobot/utils.py | lilac/WeRobot | 2 | 387 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import io
import json
import os
import random
import re
import string
import time
from functools import wraps
from hashlib import sha1
import six
try:
from secrets import choice
except ImportError:
from random import choice
str... | 2.203125 | 2 |
tensorflow/python/ops/standard_ops.py | ashutom/tensorflow-upstream | 8 | 388 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.632813 | 2 |
src/tango_scaling_test/TestDeviceServer/__main__.py | rtobar/sdp-prototype | 0 | 389 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test Tango device server for use with scaling tests."""
import sys
import time
import argparse
import tango
from tango.server import run
from TestDevice import TestDevice
def init_callback():
"""Report server start up times.
This callback is executed post ... | 2.484375 | 2 |
test/test_pipeline.py | ParikhKadam/haystack | 1 | 390 | from pathlib import Path
import pytest
from haystack.document_store.elasticsearch import ElasticsearchDocumentStore
from haystack.pipeline import TranslationWrapperPipeline, JoinDocuments, ExtractiveQAPipeline, Pipeline, FAQPipeline, \
DocumentSearchPipeline, RootNode
from haystack.retriever.dense import DensePas... | 2.25 | 2 |
src/telr/TELR_assembly.py | dominik-handler/TELR | 22 | 391 | <gh_stars>10-100
import sys
import os
import subprocess
import shutil
import time
import logging
from Bio import SeqIO
from multiprocessing import Pool
import pysam
from telr.TELR_utility import mkdir, check_exist, format_time
def get_local_contigs(
assembler,
polisher,
contig_dir,
vcf_parsed,
out... | 1.960938 | 2 |
pygmt/tests/test_clib.py | aliciaha1997/pygmt | 0 | 392 | # pylint: disable=protected-access
"""
Test the wrappers for the C API.
"""
import os
from contextlib import contextmanager
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
import xarray as xr
from packaging.version import Version
from pygmt import Figure, clib
from pygmt.clib.conversio... | 2.375 | 2 |
stubs/_pytest/_code.py | questioneer-ltd/scrut | 0 | 393 | <reponame>questioneer-ltd/scrut
"""Type stubs for _pytest._code."""
# This class actually has more functions than are specified here.
# We don't use these features, so I don't think its worth including
# them in our type stub. We can always change it later.
class ExceptionInfo:
@property
def value(self) -> Exc... | 1.882813 | 2 |
Prime Factorization/prime_factorization_II.py | rayvantsahni/Let-us-Math | 2 | 394 | def get_primes(n):
primes = [] # stores the prime numbers within the reange of the number
sieve = [False] * (n + 1) # stores boolean values indicating whether a number is prime or not
sieve[0] = sieve[1] = True # marking 0 and 1 as not prime
for i in range(2, n + 1): # loops over all the numbers to... | 4.21875 | 4 |
pandas/core/indexes/range.py | mujtahidalam/pandas | 2 | 395 | from __future__ import annotations
from datetime import timedelta
import operator
from sys import getsizeof
from typing import (
TYPE_CHECKING,
Any,
Callable,
Hashable,
List,
cast,
)
import warnings
import numpy as np
from pandas._libs import index as libindex
from pandas._libs.lib import no_... | 2 | 2 |
model.py | Hasanweight/pytorch-chatbot-master | 0 | 396 | import torch
import torch.nn as nn
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(NeuralNet, self).__init__()
self.l1 = nn.Linear(input_size, hidden_size)
self.l2 = nn.Linear(hidden_size, hidden_size)
self.l3 = nn.Linear(hidden_size, h... | 3.484375 | 3 |
jwql/utils/logging_functions.py | hover2pi/jwql | 0 | 397 |
""" Logging functions for the ``jwql`` automation platform.
This module provides decorators to log the execution of modules. Log
files are written to the ``logs/`` directory in the ``jwql`` central
storage area, named by module name and timestamp, e.g.
``monitor_filesystem/monitor_filesystem_2018-06-20-15:22:51.log`... | 2.84375 | 3 |
api/services/http.py | takos22/API-1 | 0 | 398 | from aiohttp import ClientSession
from typing import Optional
session: Optional[ClientSession] = None
__all__ = (session,)
| 1.476563 | 1 |
bcloud-snap/bcloud-3.9.1/bcloud/hasher.py | jiaxiaolei/my_snap_demo | 0 | 399 | <gh_stars>0
# Copyright (C) 2014-2015 LiuLang <<EMAIL>>
# Use of this source code is governed by GPLv3 license that can be found
# in http://www.gnu.org/licenses/gpl-3.0.html
import hashlib
import os
import zlib
CHUNK = 2 ** 20
def crc(path):
_crc = 0
fh = open(path, 'rb')
while True:
chunk = f... | 2.0625 | 2 |