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/clic/cloud.py | NathanRVance/clic | 2 | 18000 | <reponame>NathanRVance/clic
#!/usr/bin/env python3
from clic import nodes
import time
import os
import logging as loggingmod
logging = loggingmod.getLogger('cloud')
logging.setLevel(loggingmod.WARNING)
def getCloud():
return gcloud()
class abstract_cloud:
def __init__(self):
pass
def makeImage(sel... | 2.125 | 2 |
HyperUnmixing/visualization.py | mdbresh/HyperUnmixing | 1 | 18001 | <gh_stars>1-10
import numpy as np
import pandas as pd
import ipywidgets as widgets
import matplotlib.pyplot as plt
from skimage.measure import label, regionprops, regionprops_table
from skimage.color import label2rgb
def Wav_2_Im(im, wn):
'''
Input a 3-D datacube and outputs a normalized slice at one wavenumber.
... | 2.578125 | 3 |
velocileptors/Utils/loginterp.py | kokron/velocileptors | 0 | 18002 | <filename>velocileptors/Utils/loginterp.py<gh_stars>0
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as interpolate
from scipy.misc import derivative
import inspect
def loginterp(x, y, yint = None, side = "both", lorder = 9, rorder = 9, lp = 1, rp = -2,
ldx = 1e-6, rdx = 1e... | 2.21875 | 2 |
src/modeling/calc_target_scale.py | pfnet-research/kaggle-lyft-motion-prediction-4th-place-solution | 44 | 18003 | <gh_stars>10-100
from typing import Tuple
import dataclasses
import numpy as np
import torch
from pathlib import Path
from l5kit.data import LocalDataManager, ChunkedDataset
import sys
import os
from tqdm import tqdm
sys.path.append(os.pardir)
sys.path.append(os.path.join(os.pardir, os.pardir))
from lib.evaluation.... | 1.773438 | 2 |
examples/solvers using low level utilities/interior_laplace_neumann_panel_polygon.py | dbstein/pybie2d | 11 | 18004 | <gh_stars>10-100
import numpy as np
import scipy as sp
import scipy.sparse
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.path
plt.ion()
import pybie2d
"""o solve an interior Modified Helmholtz problem
On a complicated domain using a global quadr
Demonstrate how to use the pybie2d package t... | 2.625 | 3 |
controllers/rcj_soccer_referee_supervisor/rcj_soccer_referee_supervisor.py | dbscoach/webots-soccer-sim-playground | 0 | 18005 | <filename>controllers/rcj_soccer_referee_supervisor/rcj_soccer_referee_supervisor.py
from math import ceil
from referee.consts import MATCH_TIME, TIME_STEP
from referee.referee import RCJSoccerReferee
referee = RCJSoccerReferee(
match_time=MATCH_TIME,
progress_check_steps=ceil(15/(TIME_STEP/1000.0)),
progr... | 2.3125 | 2 |
backend/app.py | CMU-IDS-2020/fp-profiler | 0 | 18006 | <filename>backend/app.py<gh_stars>0
from flask import Flask, request
import os
from subprocess import Popen, PIPE
import json
from prof_file_util import load_source, load_line_profile, load_graph_profile
from linewise_barchart import linewise_barchart
from valgrind import extract_valgrind_result
from mem_issue_visuali... | 2.1875 | 2 |
py/book/ShortestSubarrayLength.py | danyfang/SourceCode | 0 | 18007 | '''
Leetcode problem No 862 Shortest Subarray with Sum at Least K
Solution written by <NAME> on 1 July, 2018
'''
import collections
class Solution(object):
def shortestSubarray(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: int
"""
n = len(A)
B = [0]... | 3.34375 | 3 |
djangocms_baseplugins/contact/models.py | benzkji/djangocms-baseplugins | 2 | 18008 | <reponame>benzkji/djangocms-baseplugins<gh_stars>1-10
import time
from ckeditor.fields import RichTextField
from django.db import models
from django.utils.translation import ugettext_lazy as _
from requests import ConnectionError
from djangocms_baseplugins.baseplugin.models import AbstractBasePlugin
from djangocms_ba... | 1.914063 | 2 |
Level1/Lessons76501/minari-76501.py | StudyForCoding/ProgrammersLevel | 0 | 18009 | <filename>Level1/Lessons76501/minari-76501.py<gh_stars>0
def solution(absolutes, signs):
answer = 0
for i in range(len(absolutes)):
if signs[i] is True:
answer += int(absolutes[i])
else:
answer -= int(absolutes[i])
return answer
#1. for문 (len(absolutes)), ... | 3.640625 | 4 |
pyexcel/__init__.py | quis/pyexcel | 0 | 18010 | """
pyexcel
~~~~~~~~~~~~~~~~~~~
**pyexcel** is a wrapper library to read, manipulate and
write data in different excel formats: csv, ods, xls, xlsx
and xlsm. It does not support formulas, styles and charts.
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License, see LICE... | 1.632813 | 2 |
tests/resources/selenium/test_nfc.py | Avi-Labs/taurus | 1,743 | 18011 | # coding=utf-8
import logging
import random
import string
import sys
import unittest
from time import time, sleep
import apiritif
import os
import re
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.by import By
from seleniu... | 2.140625 | 2 |
src/onegov/search/dsl.py | politbuero-kampagnen/onegov-cloud | 0 | 18012 | <reponame>politbuero-kampagnen/onegov-cloud<filename>src/onegov/search/dsl.py
from elasticsearch_dsl import Search as BaseSearch
from elasticsearch_dsl.response import Hit as BaseHit
from elasticsearch_dsl.response import Response as BaseResponse
def type_from_hit(hit):
return hit.meta.index.split('-')[-2]
clas... | 2.4375 | 2 |
DistributedStorageBenchmarkTool/EchoHandler.py | shadoobie/dbench | 0 | 18013 | <filename>DistributedStorageBenchmarkTool/EchoHandler.py
from SocketServer import BaseRequestHandler, TCPServer
from DistributedStorageBenchmarkTool.StampyMcGetTheLog import StampyMcGetTheLog
# from sets import Set
import re
class EchoHandler(BaseRequestHandler):
name = None
server = None
chunkSizeWriteTi... | 2.359375 | 2 |
bitten/queue.py | SpamExperts/bitten | 0 | 18014 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010 Edgewall Software
# Copyright (C) 2005-2007 <NAME> <<EMAIL>>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://bitten.edgewall.... | 2.375 | 2 |
dynamic-programming/Python/0120-triangle.py | lemonnader/LeetCode-Solution-Well-Formed | 1 | 18015 | from typing import List
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
size = len(triangle)
if size == 0:
return 0
dp = [0] * size
for i in range(size):
dp[i] = triangle[size - 1][i]
for i in range(size - 2, - 1, -1):
... | 3.21875 | 3 |
regparser/tree/xml_parser/tree_utils.py | pkfec/regulations-parser | 26 | 18016 | <reponame>pkfec/regulations-parser
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from copy import deepcopy
from functools import wraps
from itertools import chain
from lxml import etree
from six.moves.html_parser import HTMLParser
from regparser.tree.priority_stack import PriorityStack
def prepen... | 2.875 | 3 |
aiida/orm/implementation/querybuilder.py | PercivalN/aiida-core | 1 | 18017 | <filename>aiida/orm/implementation/querybuilder.py
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 1.898438 | 2 |
qiskit/util.py | alejomonbar/qiskit-terra | 0 | 18018 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 1.164063 | 1 |
examples/plot_spirals.py | zblz/gammapy | 0 | 18019 | <reponame>zblz/gammapy<gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Plot Milky Way spiral arm models.
"""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from gammapy.astro.population.spatial import ValleeSpiral, FaucherSpiral
vallee_spiral =... | 2.25 | 2 |
pytc/fitters/bayesian.py | jharman25/pytc | 20 | 18020 | __description__ = \
"""
Fitter subclass for performing bayesian (MCMC) fits.
"""
__author__ = "<NAME>"
__date__ = "2017-05-10"
from .base import Fitter
import emcee, corner
import numpy as np
import scipy.optimize as optimize
import multiprocessing
class BayesianFitter(Fitter):
"""
"""
def __init__(sel... | 2.765625 | 3 |
code/taskB/models.py | nft-appraiser/nft-appraiser-api | 0 | 18021 | <gh_stars>0
from django.db import models
class TaskB_table(models.Model):
img = models.ImageField(upload_to='taskB/', default='defo')
pred_price = models. FloatField()
| 1.804688 | 2 |
DesignPatterns/FactoryPattern/SimpleFactory/autoFactory.py | Py-Himanshu-Patel/Learn-Python | 0 | 18022 | <filename>DesignPatterns/FactoryPattern/SimpleFactory/autoFactory.py
from inspect import isclass, isabstract, getmembers
import autos
def isconcrete(obj):
return isclass(obj) and not isabstract(obj)
class AutoFactory:
vehicles = {} # { car model name: class for the car}
def __init__(self):
... | 3.078125 | 3 |
Costa Rican Household Poverty Level Prediction/tens.py | hautan/train_tf | 0 | 18023 | # -*- coding: utf-8 -*-
# We must always import the relevant libraries for our problem at hand. NumPy and TensorFlow are required for this example.
# https://www.kaggle.com/c/costa-rican-household-poverty-prediction/data#_=_
import numpy as np
np.set_printoptions(threshold='nan')
import matplotlib.pyplot as plt
import... | 3.625 | 4 |
DTL_tests/unittests/test_api.py | rocktavious/DevToolsLib | 1 | 18024 | <filename>DTL_tests/unittests/test_api.py
import os
import time
import unittest
from DTL.api import *
class TestCaseApiUtils(unittest.TestCase):
def setUp(self):
apiUtils.synthesize(self, 'mySynthesizeVar', None)
self.bit = apiUtils.BitTracker.getBit(self)
def test_wildcardToRe(self)... | 2.53125 | 3 |
src/yellow_ball/src/ball.py | AndyHUI711/ELEC3210-Group7 | 1 | 18025 | <reponame>AndyHUI711/ELEC3210-Group7
#!/usr/bin/env python
import numpy as np
import cv2
import math
import rospy
from cv_bridge import CvBridge, CvBridgeError
from std_msgs.msg import Bool
from sensor_msgs.msg import Image
from geometry_msgs.msg import Twist
bridge = CvBridge()
laser_scan_on = True
def auto_mode_c... | 2.359375 | 2 |
dlkit/json_/authentication/queries.py | UOC/dlkit | 2 | 18026 | """JSON implementations of authentication queries."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allow... | 2.640625 | 3 |
PyStellar/stellar/Git/service/git_commit_service.py | psgstellar/Stellar | 3 | 18027 | <reponame>psgstellar/Stellar
import requests
import dateutil.parser
import pytz
from Git.dao.git_dao import GitOwnerRepo
class GitCommitCheckService:
"""Github Public 저장소 커밋 기록 가져오기"""
@classmethod
def git_public_request(cls, request):
"""Commit 기록 요청"""
owner = request.GET['owner']
... | 2.453125 | 2 |
apps/jetbrains/jetbrains.py | HansKlokkenspel/knausj_talon | 0 | 18028 | <reponame>HansKlokkenspel/knausj_talon
import os
import os.path
import requests
import time
from pathlib import Path
from talon import ctrl, ui, Module, Context, actions, clip
import tempfile
# Courtesy of https://github.com/anonfunc/talon-user/blob/master/apps/jetbrains.py
extendCommands = []
# Each IDE gets its ow... | 2.21875 | 2 |
be/model/db_conn.py | CharlesDDDD/bookstore | 0 | 18029 | <reponame>CharlesDDDD/bookstore<gh_stars>0
from be.table.user import User
from be.table.user_store import User_Store
from be.table.store import Store
class DBConn:
def user_id_exist(self, user_id):
row = User.query.filter(User.user_id == user_id).first()
if row is None:
return False
... | 2.5625 | 3 |
lib/roi_data_rel/fast_rcnn_rel.py | champon1020/TRACE | 34 | 18030 | # Adapted by <NAME>, 2019
#
# Based on Detectron.pytorch/lib/roi_data/fast_rcnn.py
# Original license text:
# --------------------------------------------------------
# Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | 1.734375 | 2 |
src/mysql/tables.py | katerina7479/sooty-shearwater | 0 | 18031 | import time
import re
from src.core.tables import Table, MigrationTable
from src.core.constraints import Index
class MysqlTable(Table):
@staticmethod
def _join_cols(cols):
'''Join and escape a list'''
return ', '.join(['`%s`' % i for i in cols])
@staticmethod
def _join_conditionals(r... | 2.671875 | 3 |
CvZoneCompetition.py | MoranLeven/CvZomeCompetition | 0 | 18032 | <reponame>MoranLeven/CvZomeCompetition<filename>CvZoneCompetition.py<gh_stars>0
import cv2
import numpy as np
from time import sleep
import random
length_min = 80 # Minimum length of retangle
height_min = 80 # Minimum height of the angle
offset = 6 #Error allowed between pixel
pos_linha = 550
delay = 60 #FPS of vi... | 2.390625 | 2 |
setup.py | jiinus/django-db-prefix | 11 | 18033 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import os.path
from distutils.core import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(
name='django-db-prefix',
version='1.0',
keywords='django database',
author=u'<NAME> <<EMAIL>>, ... | 1.53125 | 2 |
pyleecan/Methods/Slot/HoleUD/build_geometry.py | mjfwest/pyleecan | 1 | 18034 | # -*- coding: utf-8 -*-
from numpy import arcsin, arctan, cos, exp, array, angle, pi
from numpy import imag as np_imag
from scipy.optimize import fsolve
from ....Classes.Segment import Segment
from ....Classes.SurfLine import SurfLine
from ....Classes.Arc1 import Arc1
from ....Methods import ParentMissingError
from .... | 2.546875 | 3 |
tardis/tardis_portal/auth/localdb_auth.py | nrmay/mytardis | 0 | 18035 | '''
Local DB Authentication module.
.. moduleauthor:: <NAME> <<EMAIL>>
'''
import logging
from django.contrib.auth.models import User, Group
from django.contrib.auth.backends import ModelBackend
from tardis.tardis_portal.auth.interfaces import AuthProvider, GroupProvider, UserProvider
logger = logging.getLogger(_... | 2.765625 | 3 |
src/app.py | hubmapconsortium/search-api | 0 | 18036 | import os
import time
from pathlib import Path
from flask import Flask, jsonify, abort, request, Response, Request
import concurrent.futures
import threading
import requests
import logging
import ast
from urllib.parse import urlparse
from flask import current_app as app
from urllib3.exceptions import InsecureRequestWar... | 1.898438 | 2 |
wordpress/apps.py | 2e2a/django-wordpress | 1 | 18037 | <reponame>2e2a/django-wordpress
from django.apps import AppConfig
class WordpressAppConfig(AppConfig):
name = 'wordpress'
default_auto_field = 'django.db.models.AutoField' | 1.46875 | 1 |
libs/libgmp/libgmp.py | wrobelda/craft-blueprints-kde | 14 | 18038 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2018 <NAME> <<EMAIL>>
#
# 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, this list of ... | 1.390625 | 1 |
scluster/aws_create_resources.py | dorgun/ncluster | 0 | 18039 | #!/usr/bin/env python
#
# Creates resources
# This script creates VPC/security group/keypair if not already present
import logging
import os
import sys
import time
from . import aws_util as u
from . import util
DRYRUN = False
DEBUG = True
# Names of Amazon resources that are created. These settings are fixed across
... | 2.453125 | 2 |
ex005-antecessorSucessor/005.py | KaiqueCassal/cursoEmVideoPython | 1 | 18040 | <gh_stars>1-10
num = int(input('Digite um número inteiro: '))
print(f'O número: {num}'
f'\nO antecessor: {num - 1}'
f'\nO sucessor: {num + 1}')
| 3.640625 | 4 |
homeassistant/components/ihc/binary_sensor.py | jasperro/core | 7 | 18041 | <gh_stars>1-10
"""Support for IHC binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import CONF_TYPE
from . import IHC_CONTROLLER, IHC_INFO
from .const import CONF_INVERTING
from .ihcdevice import IHCDevice
def setup_platform(hass, config, add_entities,... | 2.421875 | 2 |
script/TuneLR.py | yipeiw/parameter_server | 0 | 18042 | <gh_stars>0
#!/usr/bin/env python
import os.path as path
import sys
tmpDir = '../config/tmp/'
logDir = '../config/tmp/log/'
conffile = sys.argv[1]
runfile=sys.argv[2]
lr = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]
fout = open(runfile, 'w')
fout.write("#!/bin/bash\n\n\n")
fws = {}
confname = path.splitext(path.base... | 2.234375 | 2 |
pc.py | Omar8345/tic-tac-toe | 0 | 18043 | <gh_stars>0
# Tic Tac Toe Game
# Original repository: (https://github.com/Omar8345/tic-tac-toe)
# Author: <NAME>
# Date: 08/02/2022
# Version: 1.0
# Description: Tic Tac Toe Game made using Python Tkitner (Open Source)
# This game is a simple game that can be played with two players
# and... | 3.75 | 4 |
nvtabular/utils.py | deepyaman/NVTabular | 0 | 18044 | #
# Copyright (c) 2020, NVIDIA 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 agreed ... | 1.90625 | 2 |
tests/segmentation/segmanagetest.py | j-h-m/Media-Journaling-Tool | 0 | 18045 | <reponame>j-h-m/Media-Journaling-Tool
import unittest
from maskgen import image_wrap
import numpy
from maskgen.segmentation.segmanage import select_region,segmentation_classification,convert_color
from tests.test_support import TestSupport
class SegManageTestCase(TestSupport):
def test_select_region(self):
... | 2.46875 | 2 |
aimacode/tests/test_text.py | juandarr/AIND-planning | 0 | 18046 | <reponame>juandarr/AIND-planning
import pytest
import os
import random
from text import * # noqa
from utils import isclose, DataFile
def test_unigram_text_model():
flatland = DataFile("EN-text/flatland.txt").read()
wordseq = words(flatland)
P = UnigramTextModel(wordseq)
s, p = viterbi_... | 2.421875 | 2 |
implementations/python3/pysatl/apdu_tool.py | sebastien-riou/SATL | 4 | 18047 | import re
import argparse
import os
import sys
import logging
import traceback
import pysatl
class EtsiTs101955(object):
COMMENT_MARKER = "REM"
COMMAND_MARKER = "CMD"
RESET_MARKER = "RST"
INIT_MARKER = "INI"
OFF_MARKER = "OFF"
def __init__(self, cmdHandler):
self._cmdHandler = cmdHandl... | 2.375 | 2 |
host-software/easyhid.py | kavka1983/key | 1 | 18048 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 <EMAIL>
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
import cffi
import ctypes.util
import platform
ffi = cffi.FFI()
ffi.cdef("""
struct hid_device_info {
char *path;
unsigned short vendor_id;
unsigned short product_id... | 2.0625 | 2 |
mqttVec.py | Hamlet3000/mqttVec | 0 | 18049 | #!/usr/bin/env python3
import anki_vector
import paho.mqtt.client as mqtt
import time
###############################################################################
def main():
voltage = 0
batlevel = 0
charging = 0
docked = 0
status = "error"
ltime = time.strftime("%d.%m.%Y %H:%M:%S"... | 2.9375 | 3 |
examples/scanner_ibeacon_example.py | hbcho/beacontools1 | 0 | 18050 | import time
from beacontools import BeaconScanner, IBeaconFilter
def callback(bt_addr, rssi, packet, additional_info):
print("<%s, %d> %s %s" % (bt_addr, rssi, packet, additional_info))
# scan for all iBeacon advertisements from beacons with the specified uuid
scanner = BeaconScanner(callback,
device_filter... | 2.9375 | 3 |
desafio61.py | rafarbop/Python | 0 | 18051 | # Desafio 61 Curso em Video Python
# By Rafabr
from estrutura_modelo import cabecalho, rodape
cabecalho(61, "Termos de uma Progressão Aritmética - II")
while True:
try:
p0 = float(input('Digite o Termo inicial da PA: '))
r = float(input('Digite a razão da PA: '))
except ValueError:
pr... | 3.84375 | 4 |
setup.py | leandron/steinlib | 4 | 18052 | from setuptools import setup
tests_require = [
'cov-core',
'mock',
'nose2',
]
setup(name='steinlib',
version='0.1',
description='Python bindings for Steinlib format.',
url='http://github.com/leandron/steinlib',
author='<NAME>',
author_email='<EMAIL>',
li... | 1.109375 | 1 |
usdzconvert/usdStageWithFbx.py | summertriangle-dev/usdzconvert-docker | 3 | 18053 | from pxr import *
import os, os.path
import numpy
import re
import usdUtils
import math
import imp
usdStageWithFbxLoaded = True
try:
imp.find_module('fbx')
import fbx
except ImportError:
usdUtils.printError("Failed to import fbx module. Please install FBX Python bindings from http://www.autodesk.com/fbx ... | 2.21875 | 2 |
modules/ghautoknit/EmbeddedConstraint.py | fstwn/ghautokn | 2 | 18054 | # PYTHON STANDARD LIBRARY IMPORTS ----------------------------------------------
from __future__ import absolute_import
from __future__ import division
# LOCAL MODULE IMPORTS ---------------------------------------------------------
from ghautoknit.StoredConstraint import StoredConstraint
# ALL LIST -----------------... | 2.5 | 2 |
vr/server/tests/test_build.py | isabella232/vr.server | 0 | 18055 | <filename>vr/server/tests/test_build.py<gh_stars>0
import tempfile
import pytest
from dateutil.relativedelta import relativedelta
from django.utils import timezone
from django.core.files import File
from vr.server import models
from vr.server.tests import randurl
from vr.common.utils import randchars
pytestmark = ... | 2.203125 | 2 |
apps/api/v1/pagination.py | asmuratbek/oobamarket | 0 | 18056 | from rest_framework.pagination import LimitOffsetPagination, PageNumberPagination
class CategoryLimitPagination(PageNumberPagination):
page_size = 20
page_size_query_param = 'page_size'
max_page_size = 40
class ProductLimitPagination(PageNumberPagination):
page_size = 20
page_size_query_param = ... | 2.375 | 2 |
GraphOfDocs_Representation/graph_algos.py | imis-lab/book-chapter | 0 | 18057 | <reponame>imis-lab/book-chapter<filename>GraphOfDocs_Representation/graph_algos.py<gh_stars>0
import time
import json
import traceback
import numpy as np
from statistics import mean
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticR... | 2.671875 | 3 |
Code/Components/Synthesis/testdata/current/simulation/synthregression/wtermtest.py | rtobar/askapsoft | 1 | 18058 | # regression tests with gridders taking w-term into account
# some fixed parameters are given in wtermtest_template.in
from synthprogrunner import *
def analyseResult(spr, checkWeights=True):
'''
spr - synthesis program runner (to run imageStats)
throws exceptions if something is wrong, otherwise just... | 2.046875 | 2 |
manage/fuzzytranslation.py | Acidburn0zzz/browser-update | 2 | 18059 | <reponame>Acidburn0zzz/browser-update
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 12 14:21:31 2016
@author: TH
"""
#%%
import polib
#%%
#old (translated) string
#new renamed string
pairs="""
An initiative by web designers to inform users about browser-updates
An initiative by websites to inform users to update the... | 2.484375 | 2 |
scripts/test_template.py | 1466899531/auto_api_test | 16 | 18060 | # -*- coding:utf-8 -*-
"""
@File : test_template
@Author : Chen
@Contact : <EMAIL>
@Date : 2021/1/20 20:09
@Desc :
"""
# 导包
import pytest
import requests
from time import sleep
from api.template_api import TemplateAPI
from tools.get_log import GetLog
from tools.read_file import read_json
import allure
# 获取日志器
log =... | 2.3125 | 2 |
dockerfilegenerator/generator.py | ccurcanu/aws-serverless-dockerfile-generator | 2 | 18061 | # -*- coding: utf-8 -*-
import botocore.exceptions
import logging
import dockerfilegenerator.lib.constants as constants
import dockerfilegenerator.lib.exceptions as exceptions
import dockerfilegenerator.lib.versions as versions
import dockerfilegenerator.lib.jsonstore as jsonstore
import dockerfilegenerator.lib.s3sto... | 1.929688 | 2 |
ajustes_UM/tesis/main/urls.py | abelgonzalez/ajustes | 1 | 18062 | <gh_stars>1-10
from django.conf.urls import patterns, url
from main import views
urlpatterns = patterns('',
url(r'^$', views.inicio, name='inicio'),
url(r'^acerca/', views.acerca, name='acerca'),
url(r'^contacto/', views.contacto, name='contacto'),... | 1.976563 | 2 |
python/0011. maxArea.py | whtahy/leetcode | 1 | 18063 | class Solution:
def maxArea(self, ls):
n = len(ls) - 1
v, left, right = [], 0, n
while 0 <= left < right <= n:
h = min(ls[left], ls[right])
v += [h * (right - left)]
while ls[left] <= h and left < right:
left += 1
while ls[right... | 2.984375 | 3 |
test/test_views.py | Nemoden/Simblin | 53 | 18064 | # -*- coding: utf-8 -*-
"""
Simblin Test Views
~~~~~~~~~~~~~~~~~~
Test the different views of the blogging application.
:copyright: (c) 2010 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import datetime
import flask
from simblin.extensions impor... | 2.265625 | 2 |
freeclimb/models/message_result.py | FreeClimbAPI/python-sdk | 0 | 18065 | # coding: utf-8
"""
FreeClimb API
FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site teleph... | 2.578125 | 3 |
blog/views.py | artkapl/django-blog-project | 0 | 18066 | <filename>blog/views.py
from django.shortcuts import render
from .models import Post
def home(request):
context = {
'posts': Post.objects.all()
}
return render(request=request, template_name='blog/home.html', context=context)
def about(request):
return render(request=request, template_name='... | 2.078125 | 2 |
az/private/common/utils.bzl | jullianoacqio/rules_microsoft_azure | 4 | 18067 | def _check_stamping_format(f):
if f.startswith("{") and f.endswith("}"):
return True
return False
def _resolve_stamp(ctx, string, output):
stamps = [ctx.info_file, ctx.version_file]
args = ctx.actions.args()
args.add_all(stamps, format_each = "--stamp-info-file=%s")
args.add(string, for... | 2.546875 | 3 |
hue.py | desheffer/hue-adapter | 0 | 18068 | from config import Config
import flask
import json
import os
from ssdp import SSDP
from threading import Thread
import urllib3
config = None
config_file_paths = [
os.path.dirname(os.path.realpath(__file__)) + "/config/default.cfg.local",
"/etc/hue-adapter/default.cfg.local",
]
for config_file_path in config_... | 2.296875 | 2 |
safe/geokdbush/kdbushTest.py | s-a-f-e/backend | 1 | 18069 | from kdbush import KDBush
# test data
points = [
[54,1],[97,21],[65,35],[33,54],[95,39],[54,3],[53,54],[84,72],[33,34],[43,15],[52,83],[81,23],[1,61],[38,74],
[11,91],[24,56],[90,31],[25,57],[46,61],[29,69],[49,60],[4,98],[71,15],[60,25],[38,84],[52,38],[94,51],[13,25],
[77,73],[88,87],[6,27],[58,22],[53,28... | 1.523438 | 2 |
buckit/compiler.py | martarozek/buckit | 0 | 18070 | <filename>buckit/compiler.py
#!/usr/bin/env python3
# Copyright 2016-present, Facebook, Inc.
# 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. An additional grant
# of patent rights can be found in the PATENTS file... | 1.9375 | 2 |
test/python/.dbwebb/test/suite.d/kmom06/analyzer/test_analyzer.py | AndreasArne/python-examination | 0 | 18071 | #!/usr/bin/env python3
"""
Contains testcases for the individual examination.
"""
import unittest
from io import StringIO
import os
import sys
from unittest.mock import patch
from examiner import ExamTestCase, ExamTestResult, tags
from examiner import import_module, find_path_to_assignment
FILE_DIR = os.path.dirname(... | 2.890625 | 3 |
olha_boca/infratores/admin.py | Perceu/olha-boca | 0 | 18072 | from django.contrib import admin
from olha_boca.infratores.models import Infratores
# Register your models here.
class InfratoresAdmin(admin.ModelAdmin):
list_display = ('nome', 'infracoes_a_pagar', 'total_infracoes', 'valor_a_pagar')
@admin.display(empty_value='???')
def total_infracoes(self, obj):
... | 1.960938 | 2 |
model.py | ogugugugugua/Cycle-Gan-Pytorch-Implementation | 0 | 18073 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import functools
import torch.nn as nn
from torch.nn import init
import torch.functional as F
from torch.autograd import Variable
print('ok')
def weights_init_normal(m):
classname = m.__class__.... | 2.484375 | 2 |
hansberger/analysis/migrations/0001_initial.py | 097475/hansberger | 1 | 18074 | # Generated by Django 2.0.13 on 2019-06-27 17:04
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('research', '0001_initial'),
('datasets', '0001_init... | 1.859375 | 2 |
src/DOMObjects/schema.py | villagertech/DOMObjects | 0 | 18075 | <gh_stars>0
__author__ = "<NAME> <<EMAIL>>"
__package__ = "DOMObjects"
__name__ = "DOMObjects.schema"
__license__ = "MIT"
class DOMSchema(object):
""" @abstract Structure object for creating more advanced DOM trees
@params children [dict] Default structure of children
@params dictgroups [dict] Def... | 2.203125 | 2 |
Python/6 - kyu/6 kyu - Detect Pangram.py | danielbom/codewars | 0 | 18076 | <gh_stars>0
# https://www.codewars.com/kata/detect-pangram/train/python
# My solution
import string
def is_pangram(text):
return len( {letter.lower() for letter in text if letter.isalpha()} ) == 26
# ...
import string
def is_pangram(s):
return set(string.lowercase) <= set(s.lower())
# ...
import s... | 3.84375 | 4 |
L1Trigger/L1TCalorimeter/python/customiseReEmulateCaloLayer2.py | pasmuss/cmssw | 0 | 18077 |
import FWCore.ParameterSet.Config as cms
def reEmulateLayer2(process):
process.load('L1Trigger/L1TCalorimeter/simCaloStage2Digis_cfi')
process.load('L1Trigger.L1TCalorimeter.caloStage2Params_2017_v1_7_excl30_cfi')
process.simCaloStage2Digis.towerToken = cms.InputTag("caloStage2Digis", "CaloTower")
... | 1.523438 | 2 |
lintcode/1375.2.py | jianershi/algorithm | 1 | 18078 | """
1375. Substring With At Least K Distinct Characters
"""
class Solution:
"""
@param s: a string
@param k: an integer
@return: the number of substrings there are that contain at least k distinct characters
"""
def kDistinctCharacters(self, s, k):
# Write your code here
n = len... | 3.796875 | 4 |
ex29_half.py | youknowone/learn-python3-thw-code-ko | 0 | 18079 | people = 20
cats = 30
dogs = 15
if people < cats:
print("고양이가 너무 많아요! 세상은 멸망합니다!")
if people > cats:
print("고양이가 많지 않아요! 세상은 지속됩니다!")
if people < dogs:
print("세상은 침에 젖습니다!")
if people > dogs:
print("세상은 말랐습니다!")
dogs += 5
if people >= dogs:
print("사람은 개보다 많거나 같습니다")
if people <= dogs:
p... | 3.828125 | 4 |
env/lib/python3.6/site-packages/traits/util/tests/test_import_symbol.py | Raniac/NEURO-LEARN | 8 | 18080 | <reponame>Raniac/NEURO-LEARN<gh_stars>1-10
""" Tests for the import manager. """
from traits.util.api import import_symbol
from traits.testing.unittest_tools import unittest
class TestImportSymbol(unittest.TestCase):
""" Tests for the import manager. """
def test_import_dotted_symbol(self):
""" imp... | 2.484375 | 2 |
cubecode/二阶段算法合集/python版/RubiksCube-TwophaseSolver-master/client_gui.py | YuYuCong/Color-recognition-of-Rubik-s-Cube | 11 | 18081 | <reponame>YuYuCong/Color-recognition-of-Rubik-s-Cube<filename>cubecode/二阶段算法合集/python版/RubiksCube-TwophaseSolver-master/client_gui.py
# ################ A simple graphical interface which communicates with the server #####################################
from tkinter import *
import socket
import face
import cubie
#... | 2.890625 | 3 |
bootcamp/wiki/core/compat.py | basiltiger/easy_bootcamp | 0 | 18082 | <filename>bootcamp/wiki/core/compat.py<gh_stars>0
"""Abstraction layer to deal with Django related changes in order to keep
compatibility with several Django versions simultaneously."""
from __future__ import unicode_literals
from django.conf import settings as django_settings
USER_MODEL = getattr(django_settings, 'A... | 2.09375 | 2 |
ethereum.py/ethereum/clients/ethereum.py | dixonwhitmire/connect-clients | 0 | 18083 | """
ethereum.py
ethereum.py contains an EthereumClient class that provides functions for interacting
with the Coverage.sol solidity contract on an Ethereum blockchain network.
"""
import asyncio
import datetime
import json
import logging
import os
from ethereum.clients.nats import get_nats_client
from ethereum.config ... | 2.59375 | 3 |
cli/actions/mc_combination_action.py | daneshvar-amrollahi/polar | 1 | 18084 | <reponame>daneshvar-amrollahi/polar
from argparse import Namespace
from .action import Action
from symengine.lib.symengine_wrapper import sympify
from termcolor import colored
from program.mc_comb_finder import MCCombFinder
from cli.common import prepare_program
class MCCombinationAction(Action):
cli_args: Namesp... | 2.328125 | 2 |
docker/gunicorn.py | admariner/madewithwagtail | 0 | 18085 | <filename>docker/gunicorn.py
import gunicorn
accesslog = "-"
errorlog = "-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "%({X-Forwarded-For}i)s"'
capture_output = True
forwarded_allow_ips = "*"
secure_scheme_headers = {"X-CLOUDFRONT": "yes"}
workers = 2
worker_class = "gthread"
wor... | 2.109375 | 2 |
Lista 2/Questao_1.py | flaviomelo10/Python-para-PLN | 0 | 18086 | <gh_stars>0
# -- encoding:utf-8 -- #
'''
Crie uma variável com a string “ instituto de ciências matemáticas e de computação” e faça:
a. Concatene (adicione) uma outra string chamada “usp”
b. Concatene (adicione) uma outra informação: 2021
c. Verifique o tamanho da nova string (com as informações adicionadas das questõe... | 4.1875 | 4 |
breadcrumbs/templatetags/breadcrumbs_tags.py | LinuxOSsk/Shakal-NG | 10 | 18087 | # -*- coding: utf-8 -*-
from django.shortcuts import resolve_url
from django.template.loader import render_to_string
from django_jinja import library
from jinja2 import contextfunction
@contextfunction
@library.global_function
def breadcrumb(context, contents, *args, **kwargs):
class_name = kwargs.pop('class', False... | 2.28125 | 2 |
contrib/opencensus-ext-datadog/opencensus/ext/datadog/transport.py | Flared/opencensus-python | 650 | 18088 | <reponame>Flared/opencensus-python
import platform
import requests
class DDTransport(object):
""" DDTransport contains all the logic for sending Traces to Datadog
:type trace_addr: str
:param trace_addr: trace_addr specifies the host[:port] address of the
Datadog Trace Agent.
"""
def __init_... | 2.734375 | 3 |
credsweeper/file_handler/analysis_target.py | ARKAD97/CredSweeper | 0 | 18089 | <reponame>ARKAD97/CredSweeper
from typing import List
class AnalysisTarget:
def __init__(self, line: str, line_num: int, lines: List[str], file_path: str):
self.line = line
self.line_num = line_num
self.lines = lines
self.file_path = file_path
| 2.546875 | 3 |
model/vgg_deeplab.py | ireina7/zero-shot-segmentation | 0 | 18090 | import torchvision
import torch
import torch.nn as nn
import torch.nn.functional as F
class Vgg_Deeplab(nn.Module):
def __init__(self,*args, **kwargs):
super(Vgg_Deeplab, self).__init__()
vgg16 = torchvision.models.vgg16()
layers = []
layers.append(nn.Conv2d(3, 64, kernel_size=3, ... | 2.640625 | 3 |
web/app.py | erberlin/themepark-times-API | 7 | 18091 | # -*- coding: utf-8 -*-
"""
This module defines a connexion app object and configures the API
endpoints based the swagger.yml configuration file.
copyright: © 2019 by <NAME>.
license: MIT, see LICENSE for more details.
"""
import connexion
app = connexion.App(__name__, specification_dir="./")
app.app.url_map.strict... | 1.71875 | 2 |
CLIMATExScience/air-pollution-index/data-visualization/pollutant-freq.py | MY-Climate-Observatory/myco-data | 0 | 18092 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
17 June 2020
Author: <NAME>
Visualizing the types of pollutants.
"""
import pandas as pd
from plotly.offline import plot
import plotly.graph_objects as go
# Get the file from us
df = pd.read_csv(https://www.dropbox.com/s/u0ymg0ufne0an60/api-20200713.csv?dl=1", sep = ";")
# M... | 3.28125 | 3 |
tests/bs3/test_block_fields.py | rpkilby/django-template-forms | 1 | 18093 |
from django import forms
from django.test import TestCase
from template_forms import bs3
def startswith_a(value):
if value.startswith('a'):
return value
raise forms.ValidationError('Value must start with "a".')
def not_now(value):
if value:
raise forms.ValidationError('I cannot let you... | 2.71875 | 3 |
bzt/modules/java.py | 3dgiordano/taurus | 1 | 18094 | <gh_stars>1-10
"""
Copyright 2017 BlazeMeter 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 wr... | 1.59375 | 2 |
various_modules/interface_segregation_principle.py | Neykah/design_patterns_python | 0 | 18095 | <gh_stars>0
"""
Maybe not so relevant in Python due to the possibility to use multiple inheritance...
"""
from abc import ABC, abstractmethod
class CloudHostingProvider(ABC):
@abstractmethod
def create_server(region):
...
@abstractmethod
def list_servers(region):
...
class CDNProvi... | 3.28125 | 3 |
SCSCons/Variables/PackageVariable.py | Relintai/pandemonium_engine | 1,403 | 18096 | <reponame>Relintai/pandemonium_engine
# MIT License
#
# Copyright The SCons Foundation
#
# 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 th... | 1.726563 | 2 |
tests/test_protocol.py | kwikiel/edgedb | 0 | 18097 | <gh_stars>0
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2020-present MagicStack Inc. and the EdgeDB authors.
#
# 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
... | 1.890625 | 2 |
210125/homework_re_3.py | shadowsmain/pyton-adv | 0 | 18098 | <filename>210125/homework_re_3.py<gh_stars>0
import re
RE_NUMBER_VALIDATOR = re.compile(r'^\d+[.,]\d+$')
def number_is_valid(number):
return RE_NUMBER_VALIDATOR.match(number)
assert number_is_valid('1.32')
assert number_is_valid('1,32')
assert not number_is_valid('asdasd1234')
assert not number_is_valid('22,a4... | 3.234375 | 3 |
shp_code/prec_reformat.py | anahm/inferring-population-preferences | 4 | 18099 | """
prec_reformat.py
Taking state data and having each line be a precinct's voting results and candidate
cf-scores (rather than each line be each candidate per precinct.
| prec_id | cf_score_0 | num_votes_0 | cf_score_1 | num_votes_1 |
"""
import math
import numpy as np
import pandas as pd
from prec_cd import prec_... | 2.859375 | 3 |