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 |
|---|---|---|---|---|---|---|
exporters/contrib/writers/odo_writer.py | scrapinghub/exporters | 41 | 2300 | import six
import json
import gzip
from exporters.default_retries import retry_long
from exporters.writers.base_writer import BaseWriter
class ODOWriter(BaseWriter):
"""
Writes items to a odo destination. https://odo.readthedocs.org/en/latest/
Needed parameters:
- schema (object)
sc... | 2.421875 | 2 |
x7/geom/needs_test.py | gribbg/x7-geom | 0 | 2301 | <reponame>gribbg/x7-geom
"""
Simple file to validate that maketests is working. Call maketests via:
>>> from x7.shell import *; maketests('x7.sample.needs_tests')
"""
def needs_a_test(a, b):
return a+b
| 1.3125 | 1 |
python/SHA3_hashlib_based_concept.py | feketebv/SCA_proof_SHA3-512 | 1 | 2302 | '''
Written by: <NAME> <EMAIL> <EMAIL>
Last updated: 29.01.2021
'''
# the concept is to generate a side channel resistant initialisation of the hashing function based on
# one secret key and several openly known initialisation vectors (IV) in a manner that the same input
# is not hashed too more than two times,... | 2.921875 | 3 |
graphstar/utils.py | pengboomouch/graphstar | 0 | 2303 | """
graphstar.utils
~~~~~~~~~~~~~~~
<NAME>
A simple bedirectional graph with A* and breadth-first pathfinding.
Utils are either used by the search algorithm, or when needed :)
Pretty self explainatory (I hope)
For more information see the examples and tests folder
"""
def smooth_path(p):
# If the path is o... | 3.609375 | 4 |
design_patterns/pubsub/simple_events/__init__.py | JASTYN/pythonmaster | 3 | 2304 | <filename>design_patterns/pubsub/simple_events/__init__.py
class Event:
def __init__(self):
self.handlers = set()
def subscribe(self, func):
self.handlers.add(func)
def unsubscribe(self, func):
self.handlers.remove(func)
def emit(self, *args):
for func in self.handlers... | 2.6875 | 3 |
jinchi/demo/foobar.py | jiz148/py-test | 0 | 2305 | import os
def check_env(env_var_name):
"""
Check and return the type of an environment variable.
supported types:
None
Integer
String
@param env_var_name: environment variable name
@return: string of the type name.
"""
try:
val = os.getenv(env_var_name)
... | 3.484375 | 3 |
sound/serializers.py | Anirudhchoudhary/ApnaGanna__backend | 0 | 2306 | from .models import Sound , Album
from rest_framework import serializers
class SoundSerializer(serializers.ModelSerializer):
class Meta:
model = Sound
fields = ["name" , "song_image" , "pk" , "like" , "played" , "tag" , "singer" , "upload_date"]
class SoundDetailSerializer(seriali... | 2.546875 | 3 |
tracking/utils.py | WGBH/django-tracking | 0 | 2307 | from datetime import datetime
from django.conf import settings
import pytz
def check_tracker(obj, simple=True):
if simple:
if obj.status > 0:
return True
return False
# we have a gatekeeper
now = datetime.now(pytz.utc)
if obj.tracker_publish_status < 0:
... | 2.546875 | 3 |
devtools/api/health.py | ankeshkhemani/devtools | 0 | 2308 | import datetime
from fastapi import APIRouter
router = APIRouter()
@router.get("", tags=["health"])
async def get_health():
return {
"results": [],
"status": "success",
"timestamp": datetime.datetime.now().timestamp()
}
| 2.546875 | 3 |
computation/Tests/Jetson/TF_model.py | y-x-c/Heliot | 4 | 2309 | import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
import json
import time
im... | 2.296875 | 2 |
frappe/patches/v13_0/update_date_filters_in_user_settings.py | chentaoz/frappe | 3 | 2310 | from __future__ import unicode_literals
import frappe, json
from frappe.model.utils.user_settings import update_user_settings, sync_user_settings
def execute():
users = frappe.db.sql("select distinct(user) from `__UserSettings`", as_dict=True)
for user in users:
user_settings = frappe.db.sql('''
select
* f... | 2.109375 | 2 |
miniproject/train.py | peguerosdc/ml4phy-quantum-oscillators | 0 | 2311 | import BoltzmannMachine as bm
import QHO as qho
import numpy as np
import datetime
# Visualization imports
from IPython.display import clear_output
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['figure.dpi']=300
def sigmoid(x):
return .5 * (1 + np.tanh(x / 2.))
# Set t... | 2.84375 | 3 |
Tests/Marketplace/prepare_public_index_for_private_testing.py | diCagri/content | 799 | 2312 | import time
import os
import sys
import shutil
import json
import argparse
from zipfile import ZipFile
from contextlib import contextmanager
from datetime import datetime
from Tests.private_build.upload_packs_private import download_and_extract_index, update_index_with_priced_packs, \
extract_packs_artifacts
from T... | 2.03125 | 2 |
ARMODServers/Apps/ARExperiences/apps.py | Phantomxm2021/ARMOD-Dashboard | 1 | 2313 | from django.apps import AppConfig
class ArexperiencesConfig(AppConfig):
name = 'Apps.ARExperiences'
| 1.148438 | 1 |
configs/_base_/datasets/flyingchairs_320x448.py | zhouzaida/mmflow | 1 | 2314 | <filename>configs/_base_/datasets/flyingchairs_320x448.py<gh_stars>1-10
dataset_type = 'FlyingChairs'
data_root = 'data/FlyingChairs_release'
img_norm_cfg = dict(mean=[0., 0., 0.], std=[255., 255., 255.], to_rgb=False)
global_transform = dict(
translates=(0.05, 0.05),
zoom=(1.0, 1.5),
shear=(0.86, 1.16),
... | 1.765625 | 2 |
plaidml2/edsl/__init__.py | ZhouXiaolin/plaidml | 4,535 | 2315 | <gh_stars>1000+
# Copyright 2019 Intel Corporation.
import logging
from collections import namedtuple
import numpy as np
import six
from plaidml2 import DType
from plaidml2.core import TensorShape, Buffer
from plaidml2.ffi import ForeignObject, ffi, ffi_call, lib
logger = logging.getLogger(__name__)
def __init():... | 2.15625 | 2 |
pytorch_toolkit/face_recognition/model/common.py | AnastasiaaSenina/openvino_training_extensions | 1 | 2316 | <reponame>AnastasiaaSenina/openvino_training_extensions
"""
Copyright (c) 2018 Intel 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
... | 1.25 | 1 |
src/dataclay/util/logs.py | kpavel/pyclay | 1 | 2317 | <reponame>kpavel/pyclay
""" Class description goes here. """
import json
import logging
class JSONFormatter(logging.Formatter):
"""Simple JSON formatter for the logging facility."""
def format(self, obj):
"""Note that obj is a LogRecord instance."""
# Copy the dictionary
ret = dict(o... | 2.875 | 3 |
python/orthogonal_test.py | davxy/numeric | 2 | 2318 | <reponame>davxy/numeric<gh_stars>1-10
# Orthogonal linear system solver tests
from math import sqrt
import numpy as np
from orthogonal import orthogonal
################################################################################
# 2x2 orthogonal matrix
A = np.matrix('1 1;'
'1 -1', float)
A = A*1... | 2.828125 | 3 |
src/autonlp/project.py | adbmd/autonlp | 1 | 2319 | import os
import shutil
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List, Optional
from huggingface_hub import Repository
from loguru import logger
from prettytable import PrettyTable
from .splits import TEST_SPLIT, TRAIN_SPLIT, VALID_SPLIT
from .tasks import TASKS
from .u... | 2.296875 | 2 |
backend/services/apns_util.py | xuantan/viewfinder | 645 | 2320 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Apple Push Notification service utilities.
Original copyright for this code: https://github.com/jayridge/apnstornado
TokenToBinary(): converts a hex-encoded token into a binary value
CreateMessage(): formats a bin... | 2.40625 | 2 |
demonstrations/tutorial_kernels_module.py | jamesellis1999/qml | 216 | 2321 | r"""Training and evaluating quantum kernels
===========================================
.. meta::
:property="og:description": Kernels and alignment training with Pennylane.
:property="og:image": https://pennylane.ai/qml/_images/QEK_thumbnail.png
.. related::
tutorial_kernel_based_training Kernel-based tr... | 3.890625 | 4 |
main.py | scottkaz/PyLoopover | 0 | 2322 | #!/usr/bin/python3
import pygame
import random
import time
##VARIABLES TO CHANGE
width = 500
height = 500
stats_height = 150
board_size = 5
window_name = "PyLoopover "+str(board_size)+"x"+str(board_size)
scramble_turns = 50
t_round = 3
FPS = 30
##DONT CHANGE THESE BOIS
WHITE = (255,255,255)
BLACK = (0,0,0)
GREEN = (3... | 3.140625 | 3 |
test3_05.py | yoojunwoong/python_review01 | 0 | 2323 | # for문에서 continue 사용하기, continue = skip개념!!!
for i in range(1,11):
if i == 6:
continue;
print(i);
print(i);
print(i);
print(i);
print(i);
| 3.515625 | 4 |
csmpe/core_plugins/csm_install_operations/exr/package_lib.py | anushreejangid/csmpe-main | 0 | 2324 | <gh_stars>0
# =============================================================================
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistribution... | 1.046875 | 1 |
megaboat.py | xros/megaboat | 4 | 2325 | <reponame>xros/megaboat
# -*- coding: utf-8 -*-
# Copyright to <NAME>.
# Any distrubites of this copy should inform its author. If for commercial, please inform the author for authentication. Apr 2014
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from lxml import etree
import time
import json
import urllib
im... | 2.375 | 2 |
root/converter/__init__.py | thasmarinho/root-image-editor | 2 | 2326 | from .color_converter import ColorConverter
from .scale_converter import ScaleConverter
| 1.109375 | 1 |
chirun/plastex/color/__init__.py | sthagen/chirun-ncl-chirun | 5 | 2327 | <filename>chirun/plastex/color/__init__.py
from plasTeX import Command, Environment
def ProcessOptions(options, document):
colors = {}
document.userdata.setPath('packages/color/colors', colors)
colors['red'] = latex2htmlcolor('1,0,0')
colors['green'] = latex2htmlcolor('0,1,0')
colors['blue'] = lat... | 1.976563 | 2 |
ex035A11.py | gabrieleliasdev/python-cev | 0 | 2328 | <reponame>gabrieleliasdev/python-cev
print('\033[0;33;44mTeste\033[m')
print('\033[4;33;44mTeste\033[m')
print('\033[1;35;43mTeste\033[m')
print('\033[7;32;40mTeste\033[m')
print('\033[7;30mTeste\033[m')
print(" - - - Testando os 40 - - -")
print("\033[0;37;40mPreto\033[m")
print("\033[0;30;41mVermelho\033[m")
print("... | 2.671875 | 3 |
tg/release.py | TurboGears/tg2 | 812 | 2329 | """TurboGears project related information"""
version = "2.4.3"
description = "Next generation TurboGears"
long_description="""
TurboGears brings together a best of breed python tools
to create a flexible, full featured, and easy to use web
framework.
TurboGears 2 provides an integrated and well tested set of tools for... | 1.835938 | 2 |
swm-master/swm-master/calc/mean_e_calc.py | m2lines/subgrid | 1 | 2330 | <filename>swm-master/swm-master/calc/mean_e_calc.py
## PRODUCE MEAN CALCULATIONS AND EXPORT AS .NPY
from __future__ import print_function
path = '/home/mkloewer/python/swm/'
import os; os.chdir(path) # change working directory
import numpy as np
from scipy import sparse
import time as tictoc
from netCDF4 import Dataset... | 2.328125 | 2 |
bogglesolver.py | gammazero/pybogglesolver | 0 | 2331 | <reponame>gammazero/pybogglesolver
"""
Module to generate solutions for Boggle grids.
<NAME> 22 Dec. 2009
"""
from __future__ import print_function
import os
import sys
import collections
import trie
if sys.version < '3':
range = xrange
class BoggleSolver(object):
"""
This class uses an external words ... | 2.828125 | 3 |
tests/manage/monitoring/pagerduty/test_ceph.py | MeridianExplorer/ocs-ci | 0 | 2332 | <gh_stars>0
import logging
import pytest
from ocs_ci.framework.testlib import (
managed_service_required,
skipif_ms_consumer,
tier4,
tier4a,
)
from ocs_ci.ocs import constants
from ocs_ci.utility import pagerduty
log = logging.getLogger(__name__)
@tier4
@tier4a
@managed_service_required
@skipif_ms_... | 2.15625 | 2 |
STANchap7.py | phineas-pta/Bayesian-Methods-for-Hackers-using-PyStan | 1 | 2333 | # -*- coding: utf-8 -*-
import numpy as np, pandas as pd, arviz as az, prince, matplotlib.pyplot as plt, seaborn as sns
from cmdstanpy import CmdStanModel
#%% load data
data = pd.read_csv("data/overfitting.csv", index_col = 'case_id')
data.columns
data.info()
feature_names = data.columns.str.startswith("... | 2.59375 | 3 |
watcher.py | factabulous/matgrindr | 1 | 2334 | # -*- coding: utf-8 -*-
import json
import threading
import os
import time
import mats
import sys
import requests
import traceback
import re
from util import debug, error
class MatsLoader(threading.Thread):
"""
Fire and forget loader for materials - will queue a 'mats' event or
an 'error' event if the lo... | 2.625 | 3 |
luoxia/pipelines.py | pighui/luoxia | 2 | 2335 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import os
from scrapy import Request
from scrapy.pipelines.images import ImagesPipeline
from luoxia import settings
class L... | 2.796875 | 3 |
aws_sagemaker_studio/frameworks/tensorflow_mnist/mnist.py | jpmarques19/tensorflwo-test | 5 | 2336 | <reponame>jpmarques19/tensorflwo-test<filename>aws_sagemaker_studio/frameworks/tensorflow_mnist/mnist.py<gh_stars>1-10
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the L... | 2.203125 | 2 |
common/util/autoware_debug_tools/scripts/stop_reason2pose.py | loop-perception/AutowareArchitectureProposal.iv | 12 | 2337 | #! /usr/bin/env python3
# Copyright 2020 Tier IV, 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 la... | 2.203125 | 2 |
aiounittest/case.py | tmaila/aiounittest | 55 | 2338 | import asyncio
import unittest
from .helpers import async_test
class AsyncTestCase(unittest.TestCase):
''' AsyncTestCase allows to test asynchoronus function.
The usage is the same as :code:`unittest.TestCase`. It works with other test frameworks
and runners (eg. `pytest`, `nose`) as well.
AsyncTes... | 3.390625 | 3 |
US Flag.py | Code-Master1234/Turtle_Flags_File_Hub | 0 | 2339 | <reponame>Code-Master1234/Turtle_Flags_File_Hub<gh_stars>0
import turtle as t
def rectangle(horizontal, vertical, color):
t.pendown()
t.pensize(1)
t.color(color)
t.begin_fill()
for counter in range(2):
t.forward(horizontal)
t.right(90)
t.forward(vertical)
... | 2.96875 | 3 |
linked-list/delete_zero_sum_nodes.py | bryanlimy/technical-interview | 3 | 2340 | <reponame>bryanlimy/technical-interview<filename>linked-list/delete_zero_sum_nodes.py
# Given a linked list, remove consecutive nodes that sums up to zero
# https://www.careercup.com/question?id=5717797377146880
from util import *
def remove_zero_sum(head):
start = head
new = None
root = None
while st... | 3.703125 | 4 |
src/azure-cli/azure/cli/command_modules/maps/custom.py | psignoret/azure-cli | 1 | 2341 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.28125 | 2 |
examples/wsdm2022/run_seqreco_B.py | Leavingseason/wsdm2022-seqrecsys | 0 | 2342 | import sys
import os
from tempfile import TemporaryDirectory
import numpy as np
import tensorflow.compat.v1 as tf
tf.get_logger().setLevel('ERROR') # only show error messages
from recommenders.utils.timer import Timer
from recommenders.utils.constants import SEED
from recommenders.models.deeprec.deeprec_utils import ... | 1.742188 | 2 |
ctypesgen/ctypedescs.py | fgrie/ctypesgen | 0 | 2343 | #!/usr/bin/env python
"""
ctypesgen.ctypedescs contains classes to represent a C type. All of them
classes are subclasses of CtypesType.
Unlike in previous versions of ctypesgen, CtypesType and its subclasses are
completely independent of the parser module.
The most important method of CtypesType and its subclasses ... | 2.875 | 3 |
pytouch/elements.py | Krai53n/pytouch | 0 | 2344 | <gh_stars>0
from random import randint
import pyxel
from constants import Screen
import cursors
class Text:
def __init__(self, text):
self._text = text
self._symbol_len = 3
self._padding_len = 1
def _count_text_len(self):
return (
self._symbol_len + self._padding... | 2.953125 | 3 |
app/volume/admin_process.py | cleve/varidb | 0 | 2345 | <reponame>cleve/varidb<filename>app/volume/admin_process.py
from pulzarutils.utils import Utils
from pulzarutils.utils import Constants
from pulzarutils.messenger import Messenger
from pulzarcore.core_db import DB
class AdminProcess:
"""Handle admin operations from manage
"""
def __init__(self, logger):
... | 1.890625 | 2 |
tests/ssg_test_suite/profile.py | fduthilleul/scap-security-guide | 0 | 2346 | #!/usr/bin/env python2
from __future__ import print_function
import atexit
import logging
import sys
import ssg_test_suite.oscap
import ssg_test_suite.virt
from ssg_test_suite.rule import get_viable_profiles
from ssg_test_suite.virt import SnapshotStack
logging.getLogger(__name__).addHandler(logging.NullHandler())
... | 2.015625 | 2 |
lib/wtforms/ext/appengine/fields.py | solidaritreebiz/Solidaritree | 43 | 2347 | <filename>lib/wtforms/ext/appengine/fields.py
import decimal
import operator
import warnings
from wtforms import fields, widgets
class ReferencePropertyField(fields.SelectFieldBase):
"""
A field for ``db.ReferenceProperty``. The list items are rendered in a
select.
:param reference_class:
A d... | 2.515625 | 3 |
mtrainsimulator.py | trevor-wieland/MTrainAI | 0 | 2348 | import mtrain
import numpy as np
import pandas as pd
import random
def simulate_games(num_players=4, domino_size=12, num_games=250, collect_data=True,
debug=False, players=["Random", "Greedy", "Probability", "Neural"],
file_name="PlayData/data4_12_250"):
"""
Runs the m... | 3.4375 | 3 |
dml/errors.py | RGBCube/dml | 2 | 2349 | <reponame>RGBCube/dml
__all__ = ("DottedMarkupLanguageException", "DecodeError")
class DottedMarkupLanguageException(Exception):
"""Base class for all exceptions in this module."""
pass
class DecodeError(DottedMarkupLanguageException):
"""Raised when there is an error decoding a string."""
pass
| 2.40625 | 2 |
licenseplates/dataset.py | VaranRohila/apn | 0 | 2350 | ##############################################################################
#
# Below code is inspired on
# https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/pascal_voc.py
# --------------------------------------------------------
# Detectron2
# Licensed under the Apache 2.0 license... | 2.265625 | 2 |
docs/examples/pytorch/resnet50/scripts/test_read_speed.py | RogerChern/DALI | 0 | 2351 | import glob
import time
import random
filelist = glob.glob('/mnt/lustre/chenyuntao1/datasets/imagenet/train/*/*')
random.shuffle(filelist)
begin = time.time()
for i, f in enumerate(filelist):
if i == 10000:
break
with open(f, "rb") as fin:
result = fin.read()
end = time.time()
print("%.1f im... | 2.484375 | 2 |
ocellaris/solver_parts/boundary_conditions/dirichlet.py | TormodLandet/Ocellaris | 1 | 2352 | # Copyright (C) 2015-2019 <NAME>
# SPDX-License-Identifier: Apache-2.0
import dolfin
from . import register_boundary_condition, BoundaryConditionCreator
from ocellaris.utils import (
CodedExpression,
OcellarisCppExpression,
OcellarisError,
verify_field_variable_definition,
)
class OcellarisDirichletB... | 2.1875 | 2 |
count_split_inversions/test_count_split_inversions.py | abaldwin/algorithms | 0 | 2353 | import unittest
from count_split_inversions import count_inversions
class TestCountSplitInversions(unittest.TestCase):
def test_count_inversions(self):
input = [1, 3, 5, 2, 4, 6]
result = count_inversions(input)
self.assertEqual(result, 3)
if __name__ == '__main__':
unittest.main()
| 3.3125 | 3 |
python/chronos/test/bigdl/chronos/forecaster/tf/test_seq2seq_keras_forecaster.py | Forest216/BigDL | 0 | 2354 | <filename>python/chronos/test/bigdl/chronos/forecaster/tf/test_seq2seq_keras_forecaster.py
#
# Copyright 2016 The BigDL 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
#
# http:/... | 2.390625 | 2 |
examples/SubOrbitalFlight.py | nicolaikd/sl-ksp | 7 | 2355 | import time
import krpc
conn = krpc.connect(name='Sub-orbital flight')
vessel = conn.space_center.active_vessel
vessel.auto_pilot.target_pitch_and_heading(90, 90)
vessel.auto_pilot.engage()
vessel.control.throttle = 1
time.sleep(1)
print('Launch!')
vessel.control.activate_next_stage()
fuel_amount = conn.get_call(ve... | 2.5 | 2 |
part02/part02-e11_rows_and_columns/src/rows_and_columns.py | davide-butera/data-analysis-with-python | 0 | 2356 | <gh_stars>0
#!/usr/bin/env python3
import numpy as np
def get_rows(a):
return list(a)
def get_columns(a):
return list(a.T)
def main():
np.random.seed(0)
a=np.random.randint(0,10, (4,4))
print("a:", a)
print("Rows:", get_rows(a))
print("Columns:", get_columns(a))
if __name__ == "__main__"... | 2.8125 | 3 |
ramp-database/ramp_database/tools/leaderboard.py | kegl/ramp-board | 0 | 2357 | from distutils.version import LooseVersion
from itertools import product
import numpy as np
import pandas as pd
from ..model.event import Event
from ..model.event import EventTeam
from ..model.submission import Submission
from ..model.team import Team
from .team import get_event_team_by_name
from .submission import... | 2.4375 | 2 |
projects/boring_stuff/03_functions/ZigZag.py | SavantLogics/Visual_Studio_Python_Scripts-master | 0 | 2358 | #Automate the Boring Stuff with Python
import time, sys
indent = 0 # How many spaces to indent
indent_Increasing = True # Whether the indentation is increasing or not
try:
while True: # The main program loop
print(' ' * indent, end='')
print('********')
time.sleep(0.1) # Pause for 1/10th o... | 3.859375 | 4 |
examples/add_compensation_to_sample.py | whitews/ReFlowRESTClient | 0 | 2359 | import getpass
import sys
import json
from reflowrestclient.utils import *
host = raw_input('Host: ')
username = raw_input('Username: ')
password = <PASSWORD>('Password: ')
token = get_token(host, username, password)
if token:
print "Authentication successful"
print '=' * 40
else:
print "No token for you... | 2.796875 | 3 |
accountifie/toolkit/urls.py | imcallister/accountifie | 4 | 2360 | from django.conf import settings
from django.conf.urls import url, static
from . import views
from . import jobs
urlpatterns = [
url(r'^choose_company/(?P<company_id>.*)/$', views.choose_company, name='choose_company'),
url(r'^cleanlogs/$', jobs.cleanlogs, name='cleanlogs'),
url(r'^primecache/$', job... | 1.640625 | 2 |
setup.py | sequentialchaos/i3-workspace-swap | 0 | 2361 | <gh_stars>0
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="i3-workspace-swap",
description='A python utility swap the content of two workplaces in i3wm',
long_description=long_description,
long_description_content_type="text/markdown",
... | 1.59375 | 2 |
ROS/fprime_ws/src/genfprime/src/genfprime/generate_modmk.py | genemerewether/fprime | 5 | 2362 | <gh_stars>1-10
#
# Copyright 2004-2016, by the California Institute of Technology.
# ALL RIGHTS RESERVED. United States Government Sponsorship
# acknowledged. Any commercial use must be negotiated with the Office
# of Technology Transfer at the California Institute of Technology.
#
# This software may be subj... | 1.773438 | 2 |
tests/test_compare.py | fool65c/jupytext | 1 | 2363 | import pytest
from nbformat.v4.nbbase import new_notebook, new_markdown_cell, new_code_cell, new_raw_cell
from jupytext.compare import compare_notebooks, NotebookDifference, test_round_trip_conversion as round_trip_conversion
def test_raise_on_different_metadata():
ref = new_notebook(metadata={'kernelspec': {'lan... | 2.140625 | 2 |
Cogs/Actions.py | MrAngelDo6pa/MedBotS | 2 | 2364 | import asyncio
import discord
import random
import datetime
from discord.ext import commands
from Cogs import DisplayName
from Cogs import Nullify
def setup(bot):
# Add the bot
bot.add_cog(Actions(bot))
class Actions(commands.Cog):
## class that handles storing and computing action messages
class actionable... | 2.984375 | 3 |
marltoolbox/examples/tune_function_api/lola_pg_official.py | tobiasbaumann1/amd | 0 | 2365 | <reponame>tobiasbaumann1/amd<filename>marltoolbox/examples/tune_function_api/lola_pg_official.py
##########
# Additional dependencies are needed:
# Follow the LOLA installation described in the tune_class_api/lola_pg_official.py file
##########
import os
import ray
from ray import tune
import marltoolbox.algos.lola.e... | 2.15625 | 2 |
src/cut_link/utils.py | true7/srt | 0 | 2366 | <gh_stars>0
import string
import random
import json
from calendar import month_name
from django.conf import settings
SHORTLINK_MIN = getattr(settings, "SHORTLINK_MIN", 6)
def code_generator(size=SHORTLINK_MIN):
chars = string.ascii_letters + string.digits
return ''.join(random.choice(chars) for _ in range(si... | 2.515625 | 3 |
lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py | blankenberg/galaxy-data-resource | 0 | 2367 | #!/usr/bin/python
import argparse
import ConfigParser
import os
import sys
new_path = [ os.path.join( os.getcwd(), "lib" ) ]
new_path.extend( sys.path[1:] )
sys.path = new_path
from galaxy import eggs
eggs.require( "SQLAlchemy >= 0.4" )
import galaxy.webapps.tool_shed.model.mapping as tool_shed_model
from sqlalchemy.... | 2.1875 | 2 |
moto/dynamodbstreams/responses.py | jonnangle/moto-1 | 3 | 2368 | <reponame>jonnangle/moto-1<gh_stars>1-10
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import dynamodbstreams_backends
from six import string_types
class DynamoDBStreamsHandler(BaseResponse):
@property
def backend(self):
return dynamodbstreams_back... | 2.234375 | 2 |
tools/mo/openvino/tools/mo/front/mxnet/zeros_ext.py | ytorzuk-altran/openvino | 1 | 2369 | <reponame>ytorzuk-altran/openvino
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from openvino.tools.mo.ops.const import... | 2.015625 | 2 |
tools/jslib_builder.py | Jumpscale/jumpscale_portal8 | 0 | 2370 |
from JumpScale import j
class builder():
# @property
# def buildDir(self):
# return j.sal.fs.joinPaths(j.dirs.tmpDir, "jsbuilder")
@property
def cuisine(self):
return j.tools.cuisine.local
# ALL NOT NEEDED ANY LONGER USE bower
# def angular(self):
# version = "1.5... | 2.140625 | 2 |
SimpleSimulator/samuelator.py | Anindya-Prithvi/CO_M21_Assignment | 3 | 2371 | <gh_stars>1-10
import sys
import warnings
import matplotlib.pyplot as plt
from parsets import IMACC, IMG, PROGC, REGFLPC, ExecE, plot
warnings.filterwarnings("ignore")
MEM = IMACC(sys.stdin.read()) # Load memory from stdin
PC = PROGC(0) # Start from the first instruction
RF = REGFLPC() # initialize register and f... | 2.53125 | 3 |
utils/converters.py | LiReNa00/JDBot | 0 | 2372 | <filename>utils/converters.py<gh_stars>0
import discord
import re
import emoji
import contextlib
import typing
import datetime
from discord.ext import commands
from discord.http import Route
class BetterMemberConverter(commands.Converter):
async def convert(self, ctx, argument):
try:
user = aw... | 2.421875 | 2 |
kissim/cli/encode.py | AJK-dev/kissim | 15 | 2373 | """
kissim.cli.encode
Encode structures (generate fingerprints) from CLI arguments.
"""
import numpy as np
from kissim.api import encode
from kissim.cli.utils import configure_logger
def encode_from_cli(args):
"""
Encode structures.
Parameters
----------
args : argsparse.Namespace
CLI ... | 2.71875 | 3 |
distanceProfile.py | ZiyaoWei/pyMatrixProfile | 29 | 2374 | import numpy as np
from util import *
def naiveDistanceProfile(tsA, idx, m, tsB = None):
"""Return the distance profile of query against ts. Use the naive all pairs comparison algorithm.
>>> np.round(naiveDistanceProfile(np.array([0.0, 1.0, -1.0, 0.0]), 0, 4, np.array([-1, 1, 0, 0, -1, 1])), 3)
array([[ 2... | 2.65625 | 3 |
test_0000.py | theo-dim/cash-gels-thesis | 0 | 2375 | import pyplot as plt
import numpy as np
from sklearn import linear_model
| 1.203125 | 1 |
vnTrader/uiMainWindow.py | bttt123/TradeSim | 0 | 2376 | # encoding: UTF-8
from builtins import str
import psutil
# import sys
# PyQt 4/5 compatibility
try:
from PyQt4.QtGui import QMainWindow, QDialog, QDockWidget, QAction, QHeaderView, QMessageBox, QLabel, QVBoxLayout
from PyQt4 import QtCore
except ImportError:
from PyQt5.QtWidgets import QMainWindow, QDial... | 1.96875 | 2 |
line_notify_core.py | ficgra/PChome-alertor | 1 | 2377 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import requests
import json
import re
from flask import Flask, request, abort
import mysql.connector as mariadb
from mysql.connector import Error
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatur... | 2.078125 | 2 |
sfc_models/examples/scripts/intro_X_XX_sim_multiplier.py | MachineLP/SFC_models | 21 | 2378 | <reponame>MachineLP/SFC_models<gh_stars>10-100
# coding=utf-8
from sfc_models.objects import *
from sfc_models.examples.Quick2DPlot import Quick2DPlot
register_standard_logs('output', __file__)
mod = Model()
country = Country(mod, 'CO')
Household(country, 'HH')
ConsolidatedGovernment(country, 'GOV')
FixedMarginBusine... | 2.15625 | 2 |
auth_framework/settings.py | DrChai/django-auth-framework | 0 | 2379 | from importlib import import_module
from django.conf import settings
from django.core.signals import setting_changed
SOCIALACCOUNT_MODEL = getattr(settings, "REST_AUTH_SOCIALACCOUNT_MODEL", "auth_framework.SocialAccount")
DEFAULTS = {
'UNIQUE_EMAIL': True,
'RESET_PASSWORD_BY': 'pin', # 'url'| 'pin'
'SER... | 1.90625 | 2 |
shorty/models.py | gkiserpong/shorty | 0 | 2380 | <filename>shorty/models.py
from django.db import models
from shorty.manager import UrlManager
class Url(models.Model):
long_url = models.URLField()
short_id = models.SlugField()
counter = models.IntegerField(default=0)
def __str__(self):
return "%s -- %s" % (self.long_url, self.short_id)
... | 2.390625 | 2 |
test/sec_full.py | time-track-tool/time-track-tool | 0 | 2381 | security = """
New Web users get the Roles "User,Nosy"
New Email users get the Role "User"
Role "admin":
User may access the rest interface (Rest Access)
User may access the web interface (Web Access)
User may access the xmlrpc interface (Xmlrpc Access)
User may create everything (Create)
User may edit everything ... | 1.78125 | 2 |
CodeChef/problems/IMDB/main.py | object-oriented-human/competitive | 1 | 2382 | <filename>CodeChef/problems/IMDB/main.py
tc = int(input())
while tc:
tc -= 1
best = 0
n, x = map(int, input().split())
for i in range(n):
s, r = map(int, input().split())
if x >= s:
best = max(best, r)
print(best) | 3.34375 | 3 |
tests/test_sqlite_wrapper.py | Privex/python-db | 1 | 2383 | <gh_stars>1-10
"""
Tests related to :class:`.SqliteWrapper` / :class:`.ExampleWrapper`
"""
# from unittest import TestCase
from tests.base import *
class TestSQLiteWrapper(PrivexDBTestBase):
def test_tables_created(self):
w = self.wrp
self.assertEqual(w.db, ':memory:')
tables = w.list... | 2.515625 | 3 |
var/spack/repos/builtin/packages/strumpack/package.py | robertodr/spack | 9 | 2384 | <gh_stars>1-10
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Strumpack(CMakePackage, CudaPackage):
"""STRUMPACK -- STRUctured Matrix PAC... | 1.710938 | 2 |
actionserver/actions/action_feedbackform.py | Ajju2211/frendy-bot | 0 | 2385 | from typing import Any, Text, Dict, List, Union
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormAction
from rasa_sdk.events import UserUtteranceReverted, UserUttered, FollowupAction
# from rasa_core.events import (UserUtteranceReverted, UserUttered... | 2.125 | 2 |
dash/graphs.py | fuzzylabs/wearable-my-foot | 5 | 2386 | import plotly.graph_objs as go
class GraphsHelper:
template = "plotly_dark"
'''
Generate a plot for a timeseries
'''
def generate_timeseries_plot(self, dataframe):
pressure_plots = []
for sensor in ["p1", "p2", "p3"]:
series = dataframe[sensor]
scatter = go.... | 3.140625 | 3 |
azure-mgmt-web/azure/mgmt/web/models/app_service_certificate_resource.py | JonathanGailliez/azure-sdk-for-python | 1 | 2387 | <reponame>JonathanGailliez/azure-sdk-for-python
# 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 M... | 2.40625 | 2 |
telethon/tl/functions/stickers.py | polisitni1/DogeClickBot | 0 | 2388 | """File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLRequest
from typing import Optional, List, Union, TYPE_CHECKING
import os
import struct
if TYPE_CHECKING:
from ...tl.types import TypeInputStickerSet, TypeInputUser, TypeInputStickerSetItem, TypeInputDocument
cl... | 2.3125 | 2 |
applications/ChimeraApplication/tests/chimera_analysis_base_test.py | lkusch/Kratos | 778 | 2389 | <gh_stars>100-1000
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as UnitTest
import KratosMultiphysics.ChimeraApplication
from KratosMultiphysics.ChimeraApplication.fluid_chimera_analysis import FluidChimeraAnalysis
class ChimeraAnalysisBaseTest(UnitTest.TestCase):
def setUp(self):
# ... | 2.15625 | 2 |
parsers/rss10.py | side-beach-city/SBCLinkCopyTool | 0 | 2390 | <filename>parsers/rss10.py
import urllib.request
import xml.etree.ElementTree
class RSS10Parser:
def __init__(self, url: str) -> None:
self.url = url
def getlist(self) -> list[dict[str, str]]:
ENTRY = r"{http://www.w3.org/2005/Atom}"
MEDIA = r"{http://search.yahoo.com/mrss/}"
YOUTUBE = r"{http://w... | 3.09375 | 3 |
examples/laser.py | MPI-IS/reactive_pepper | 0 | 2391 | <gh_stars>0
import math,time,random
import pepper_interface
IP = "192.168.0.147"
PORT = 9559
simulation = False
with pepper_interface.get(IP,PORT,simulation) as pepper:
time.sleep(1.0)
values,time_stamp = pepper.laser.get()
print
print "Front"
print values["Front"]
print
print "Left"
... | 2.5 | 2 |
exercises/pt/exc_01_03_01.py | Jette16/spacy-course | 2,085 | 2392 | # Importar a classe da língua inglesa (English) e criar um objeto nlp
from ____ import ____
nlp = ____
# Processar o texto
doc = ____("I like tree kangaroos and narwhals.")
# Selecionar o primeiro token
first_token = doc[____]
# Imprimir o texto do primeito token
print(first_token.____)
| 3.296875 | 3 |
tests/integration/mci/test_happy_path.py | qateam123/eq | 0 | 2393 | from tests.integration.create_token import create_token
from tests.integration.integration_test_case import IntegrationTestCase
class TestHappyPath(IntegrationTestCase):
def test_happy_path_203(self):
self.happy_path('0203', '1')
def test_happy_path_205(self):
self.happy_path('0205', '1')
... | 2.421875 | 2 |
src/transformers/models/hubert/modeling_tf_hubert.py | OllieBroadhurst/transformers | 1 | 2394 | <gh_stars>1-10
# coding=utf-8
# Copyright 2021 The Fairseq Authors and the HuggingFace Inc. team. 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.apach... | 1.734375 | 2 |
600/unit-1/recursion/problem-set/mit-solutions/ps2_hangman_sol1.py | marioluan/mit-opencourseware-cs | 0 | 2395 | # 6.00 Problem Set 2
#
# Hangman
# Name : Solutions
# Collaborators : <your collaborators>
# Time spent : <total time>
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
import random
import string
WO... | 4.125 | 4 |
top/api/rest/FenxiaoRefundMessageAddRequest.py | forestsheep/middleman | 0 | 2396 | <reponame>forestsheep/middleman
'''
Created by auto_sdk on 2016.04.13
'''
from top.api.base import RestApi
class FenxiaoRefundMessageAddRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.image = None
self.message_content = None
self.sub_order_id = ... | 1.742188 | 2 |
image-generation/slegan/args.py | AaratiAkkapeddi/nnabla-examples | 228 | 2397 | <filename>image-generation/slegan/args.py
# Copyright 2021 Sony Corporation.
# Copyright 2021 Sony Group 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... | 2.375 | 2 |
day1/files_ex1.py | grenn72/pynet-ons-feb19 | 0 | 2398 | <gh_stars>0
#!/usr/bin/env python
from __future__ import print_function
# READ ####
f = open("my_file.txt")
print("\nLoop directly over file")
print("-" * 60)
for line in f:
print(line.strip())
print("-" * 60)
f.seek(0)
my_content = f.readlines()
print("\nUse readlines method")
print("-" * 60)
for line in my_cont... | 3.671875 | 4 |
test/integration_tests/test_integration_datasets_client.py | self-host/selfhost-python-client | 0 | 2399 | import uuid
from typing import List, Dict, Any
import unittest
from selfhost_client import SelfHostClient, DatasetType
class TestIntegrationDatasetsClient(unittest.TestCase):
"""
Run these tests individually because Self-Host will return HTTP 429 Too Many Requests otherwise.
"""
@classmethod
de... | 2.71875 | 3 |