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 |
|---|---|---|---|---|---|---|
examples/django/015_deploy_app/project/example/views.py | HalfBottleOfMind/website | 12 | 14800 | <filename>examples/django/015_deploy_app/project/example/views.py
from rest_framework import viewsets
from .models import Label
from .serizalizers import LabelSerializer
class LabelViewSet(viewsets.ModelViewSet):
queryset = Label.objects.all().order_by('id')
serializer_class = LabelSerializer
| 1.53125 | 2 |
src/olympia/github/tests/test_views.py | gijsk/addons-server | 0 | 14801 | import json
from django.utils.http import urlencode
import mock
import requests
from olympia.amo.tests import AMOPaths, TestCase
from olympia.amo.urlresolvers import reverse
from olympia.files.models import FileUpload
from olympia.github.tests.test_github import (
GithubBaseTestCase, example_pull_request)
clas... | 2.265625 | 2 |
exopy_qm/tasks/tasks/GetIOValuesTask.py | rassouly/exopy_qm | 0 | 14802 | <reponame>rassouly/exopy_qm
from exopy.tasks.api import (InstrumentTask)
from atom.api import Unicode, Bool, set_default
import sys
from exopy_qm.utils.dynamic_importer import *
class GetIOValuesTask(InstrumentTask):
""" Gets the IO values
"""
get_io_1 = Bool(True).tag(pref=True)
get_io_2 = Bool(Tru... | 2.171875 | 2 |
src/ns_web_api/web/ptx/thsr.py | steny138/PyNintendoEPrice | 0 | 14803 | import requests
import logging
from .auth import Auth
domain = "https://ptx.transportdata.tw/MOTC/v2/Rail/THSR/"
default_limit_count = 20
logger = logging.getLogger('flask.app')
auth = Auth()
def get_station():
"""GET /v2/Rail/THSR/Station 取得車站基本資料
Returns:
[dict] -- 車站基本資料
"""
action = "... | 2.90625 | 3 |
src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_PNET_Container_d.py | pnkfb9/gem5_priority | 0 | 14804 | <gh_stars>0
# Authors: <NAME>
from m5.params import *
from m5.proxy import *
from BasicRouter import BasicRouter
class GarnetRouter_PNET_Container_d(BasicRouter):
type = 'GarnetRouter_PNET_Container_d'
cxx_class = 'Router_PNET_Container_d'
cxx_header = "mem/ruby/network/garnet/fixed-pipeline/Router_PNET_C... | 2 | 2 |
Wrappers/Python/Testing/MasterTest.py | gregmedlock/roadrunnerwork | 0 | 14805 | <reponame>gregmedlock/roadrunnerwork<filename>Wrappers/Python/Testing/MasterTest.py
import os
location = os.path.join(os.path.dirname(__file__), 'Functions\\')
#location = 'Tests\\'
execfile(location + 'getVersion.py')
execfile(location + 'writeSBML.py')
#execfile(location + 'computeSteadyStateValues.py')
e... | 1.898438 | 2 |
condition/models.py | SamusChief/myth-caster-api | 0 | 14806 | <gh_stars>0
""" Models for Conditions app """
from django.db import models
from common.models import OwnedModel
class Condition(OwnedModel):
""" Condition model """
name = models.CharField(unique=True, max_length=255, db_index=True)
description = models.TextField()
def __str__(self):
return ... | 2.4375 | 2 |
curriculum/experiments/goals/point_nd/goal_point_nd_trpo.py | coco-robotics/rllab-curriculum | 115 | 14807 | <filename>curriculum/experiments/goals/point_nd/goal_point_nd_trpo.py
from curriculum.utils import set_env_no_gpu, format_experiment_prefix
set_env_no_gpu()
import argparse
import math
import os
import os.path as osp
import sys
import random
from multiprocessing import cpu_count
import numpy as np
import tensorflow a... | 1.984375 | 2 |
pyNastran/bdf/bdf_interface/encoding.py | ACea15/pyNastran | 293 | 14808 | <gh_stars>100-1000
def decode_lines(lines_bytes, encoding: str):
if isinstance(lines_bytes[0], bytes):
lines_str = [line.decode(encoding) for line in lines_bytes]
elif isinstance(lines_bytes[0], str):
lines_str = lines_bytes
else:
raise TypeError(type(lines_bytes[0]))
return line... | 2.953125 | 3 |
health_reminder.py | carlkho-cvk/tbe_discord | 0 | 14809 | # Fitness monday variables
morning_1 = "10:00"
morning_2 = "8:00"
afternoon_1 = "13:00"
afternoon_2 = "14:30"
afternoon_3 = "15:30"
afternoon_4 = "17:55"
evening_1 = "20:30"
evening_2 = "21:10"
date_announce = [1, 2, 3, 4, 5]
image_file_list = [
'Exercise_Three.png',
'Exercise_Two_2.png'
]
... | 3.234375 | 3 |
Image_Content_Analysis/deeplab-pytorch-master/labelImsTest.py | PonceLab/as-simple-as-possible | 1 | 14810 | <filename>Image_Content_Analysis/deeplab-pytorch-master/labelImsTest.py
#!/usr/bin/env python
# coding: utf-8
#
# Author: <NAME>
# URL: https://kazuto1011.github.io
# Date: 07 January 2019
from __future__ import absolute_import, division, print_function
import click
import cv2
import matplotlib
impor... | 2.21875 | 2 |
setup.py | kvietcong/md-tangle | 14 | 14811 | <reponame>kvietcong/md-tangle<filename>setup.py<gh_stars>10-100
import setuptools
import md_tangle
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name=md_tangle.__title__,
version=md_tangle.__version__,
license=md_tangle.__license__,
author=md_tangle.__author__,
... | 1.554688 | 2 |
src/dvi/bayes_models.py | luoyan407/predict_trustworthiness | 5 | 14812 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .bayes_layers import VariationalLinearCertainActivations, VariationalLinearReLU
from .variables import GaussianVar
class MLP(nn.Module):
def __init__(self, x_dim, y_dim, hidden_size=None):
super(MLP, self).__init__()
self.siz... | 2.15625 | 2 |
rondgang/models.py | eternallyBaffled/rondgang | 0 | 14813 | <filename>rondgang/models.py
from datetime import date
from django.db import models
# Create your models here.
class Gemeente(models.Model):
naam_text = models.CharField(max_length=50)
deelgemeente_text = models.CharField(max_length=50)
class Segment(models.Model):
gemeente = models.CharField(max_length=... | 2.234375 | 2 |
code_examples/Python/app_debugger/test_client/test_debugger.py | VPoser/docs-and-training | 0 | 14814 | <reponame>VPoser/docs-and-training
#!/usr/bin/env python
"""Simple test client to call the debugger SOAP service"""
import os
import sys
import base64
import getpass
from suds.client import Client
from suds.cache import NoCache
from suds import WebFault, MethodNotFound
from clfpy import AuthClient
auth_endpoint = '... | 2.65625 | 3 |
bai01/keocatgiay.py | YtalYa/CSx101-A1-2021-02 | 0 | 14815 | #!/usr/bin/python3
# from time import time
# from math import sqrt
# with open("inp.txt", "r") as f:
# a, b = list(i for i in f.read().split())
a, b = input().split()
# print(a,b,c, type(a), type(int(a)))
a = int(a)
b = int(b)
# st = time()
# -----
s1 = a * (a - 1) // 2
cuoi = b - 2
dau = b - a
s2 = (dau + cuoi) *... | 3.234375 | 3 |
data_manager/acs/gui_ACS_sched_blocks_script_0.py | IftachSadeh/ctaOperatorGUI | 3 | 14816 | <reponame>IftachSadeh/ctaOperatorGUI
# import tcs
# import daqctrl, inspect
# ------------------------------------------------------------------
# install the script by:
# cd $INTROOT/config/scripts
# ln -s $guiInstalDir/ctaOperatorGUI/ctaGuiBack/ctaGuiBack/acs/guiACS_schedBlocks_script0.py
# ---------------------... | 1.992188 | 2 |
msort/check/age.py | leighmacdonald/msort | 4 | 14817 | <filename>msort/check/age.py
"""
Module to scan for empty folders and directories
"""
from time import time
from msort.check import BaseCheck, CheckSkip
class AgeCheck(BaseCheck):
"""
A simple checker which will validate a file or folders age.
"""
def __call__(self, section, path):
if self.con... | 3.234375 | 3 |
AtC_Beg_Con_081-090/ABC089/B.py | yosho-18/AtCoder | 0 | 14818 | <gh_stars>0
n = int(input())
a = input().split()
a = [str(m) for m in a]
for i in a:
if i == "Y":
print("Four")
exit()
print("Three") | 3.359375 | 3 |
scripts/component_graph/server/fpm/package_manager.py | winksaville/Fuchsia | 3 | 14819 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""PackageManager provides an interface to the JSON FPM API.
The PackageManager interface provides a simple way to retri... | 2.5625 | 3 |
D01/main.py | itscassie/advent-of-code-2021 | 0 | 14820 | """ Solve 2021 Day 1: Sonar Sweep Problem """
def solver_problem1(inputs):
""" Count the number of increasement from given list """
num_increased = 0
for i in range(1, len(inputs)):
if inputs[i] > inputs[i - 1]:
num_increased += 1
return num_increased
def solver_problem2(... | 3.90625 | 4 |
tests/test_power_converter.py | LauWien/smooth | 5 | 14821 | <filename>tests/test_power_converter.py<gh_stars>1-10
from smooth.components.component_power_converter import PowerConverter
import oemof.solph as solph
def test_init():
power_converter = PowerConverter({})
params = {"efficiency": 0, "output_power_max": 100}
power_converter = PowerConverter(params)
as... | 2.484375 | 2 |
compecon/demos/demapp06.py | daniel-schaefer/CompEcon-python | 23 | 14822 | from demos.setup import np, plt
from compecon import BasisChebyshev, BasisSpline
from compecon.tools import nodeunif
__author__ = 'Randall'
# DEMAPP06 Chebychev and cubic spline derivative approximation errors
# Function to be approximated
def f(x):
g = np.zeros((3, x.size))
g[0], g[1], g[2] = np.exp(-x),... | 3.109375 | 3 |
v3_inc_mem_dropout_dqn_model.py | kucharzyk-sebastian/aigym_dqn | 2 | 14823 | import random
import gym
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.optimizers import Adam
import tensorflow as tf
import os
import logging
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
logging.getLogger('tensorflow').disabled = Tr... | 2.609375 | 3 |
phlcensus/acs/percapitaincome.py | PhiladelphiaController/phlcensus | 0 | 14824 | from .core import ACSDataset
import collections
__all__ = ["PerCapitaIncome"]
class PerCapitaIncome(ACSDataset):
"""
PER CAPITA INCOME IN THE PAST 12 MONTHS (IN 2018 INFLATION-ADJUSTED DOLLARS)
"""
AGGREGATION = None
UNIVERSE = "total population"
TABLE_NAME = "B19301"
RAW_FIELDS = coll... | 2.296875 | 2 |
card-games/lists.py | vietanhtran2710/python-exercism | 0 | 14825 | <reponame>vietanhtran2710/python-exercism
"""
Card games exercise
"""
def get_rounds(number):
"""
:param number: int - current round number.
:return: list - current round and the two that follow.
"""
return [i + number for i in range(3)]
def concatenate_rounds(rounds_1, rounds_2):
"""... | 3.90625 | 4 |
stock_quantity_history_location/tests/test_stock_quantity_history_location.py | NextERP-Romania/addons_extern | 0 | 14826 | <reponame>NextERP-Romania/addons_extern
# Copyright 2019 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
class TestStockQuantityHistoryLocation(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestStockQuantityHistoryLo... | 1.898438 | 2 |
viterbi_tagging.py | cryingmiso/Natural-Language-Processing | 0 | 14827 | # -*- coding:utf-8 -*-
states = ("B","M","E","S")
test_input = "BBMESBMEBEBESSMEBBME"
observations = [obs for obs in test_input]
#시작확률
start_prob = {"B":0.4,"M":0.2,"E":0.2,"S":0.2}
#전이확률
transit_prob = {"B": {"B": 0.1, "M": 0.4, "E": 0.4, "S": 0.1},
"M": {"B": 0.1, "M": 0.4, "E": 0.4, "S": 0.1},
... | 2.125 | 2 |
src/haddock/core/cns_paths.py | sverhoeven/haddock3 | 0 | 14828 | """
Path to CNS-related files.
Most paths are defined by dictionaries that gather several related
paths. Here, instead of defining the dictionaries with static paths, we
have functions that create those dict-containing paths dynamically. The
default values are defined by:
- axis
- tensors
- translation_vectors
- wate... | 2.859375 | 3 |
src/reanalysis_dbns/utils/__init__.py | azedarach/reanalysis-dbns | 0 | 14829 | """
Provides helper routines for reanalysis DBNs study.
"""
# License: MIT
from __future__ import absolute_import
from .computation import (calc_truncated_svd, downsample_data,
meridional_mean,
pattern_correlation, select_lat_band,
select... | 1.828125 | 2 |
output/models/ms_data/regex/re_k14_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 14830 | <reponame>tefra/xsdata-w3c-tests<filename>output/models/ms_data/regex/re_k14_xsd/__init__.py
from output.models.ms_data.regex.re_k14_xsd.re_k14 import (
Regex,
Doc,
)
__all__ = [
"Regex",
"Doc",
]
| 1 | 1 |
generator/src/googleapis/codegen/utilities/json_expander.py | romulobusatto/google-api-php-client-services | 709 | 14831 | #!/usr/bin/python2.7
# Copyright 2012 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 requi... | 3.015625 | 3 |
pyeventbus/tests/IO_performance_testing.py | n89nanda/EventBus | 24 | 14832 | <reponame>n89nanda/EventBus
from pyeventbus import *
from timeit import default_timer as timer
import numpy
import sys
from os import getcwd
import json
class Events:
class IOHeavyTestEvent:
start = 0
finish = 0
duration = 0
def __init__(self):
pass
def setStart(... | 2.46875 | 2 |
book/migrations/0006_alter_book_cover_img.py | KhudadadKhawari/the-library | 0 | 14833 | # Generated by Django 4.0 on 2021-12-15 09:04
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('book', '0005_alter_book_rented_count'),
]
operations = [
migrations.AlterField(
model_name='book',
... | 1.671875 | 2 |
hrsxrate.py | fabiovitoriano7/pythoncourse | 0 | 14834 | <reponame>fabiovitoriano7/pythoncourse
hrs = input("Enter Hours:")
rate=2.75
print ("Pay: " + str(float(rate) * hrs))
| 3.890625 | 4 |
main5.py | LinXueyuanStdio/MyTransE | 0 | 14835 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _thread
import sys
import time
from math import exp
from random import random
from typing import List, Tuple, Set
from scipy import spatial
import numpy as np
import torch
from torch import nn
from torc... | 1.84375 | 2 |
cogs/profiles.py | Greenfoot5/BattleBot | 2 | 14836 | import discord
import time
import random
import datetime
import asyncio
import json
import config
from discord.ext import commands
from data.data_handler import data_handler
from itertools import chain
from collections import OrderedDict
def gainedRP(player, gained_rp):
if player['Level']['timeOfNextEarn'] > time... | 2.625 | 3 |
blender/.blender/scripts/uvcalc_follow_active_coords.py | visnz/sketchfab_download | 41 | 14837 | #!BPY
"""
Name: 'Follow Active (quads)'
Blender: 242
Group: 'UVCalculation'
Tooltip: 'Follow from active quads.'
"""
__author__ = "<NAME>"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0 2006/02/07"
__bpydoc__ = """\
This script sets the UV mapping and image of selected faces from adjacent unselected fa... | 2.15625 | 2 |
bloom/editor/ror_constants.py | thomasrogers03/bloom | 9 | 14838 | <reponame>thomasrogers03/bloom
# Copyright 2020 <NAME>
# SPDX-License-Identifier: Apache-2.0
LOWER_LINK_TAG = 6
UPPER_LINK_TAG = 7
UPPER_WATER_TAG = 9
LOWER_WATER_TAG = 10
UPPER_STACK_TAG = 11
LOWER_STACK_TAG = 12
UPPER_GOO_TAG = 13
LOWER_GOO_TAG = 14
LOWER_LINK_TYPES = {LOWER_LINK_TAG, LOWER_WATER_TAG, LOWER_STAC... | 1.359375 | 1 |
tests/validation/tests/v3_api/test_sbx_custom_filter.py | sambabox/rancher | 0 | 14839 | <reponame>sambabox/rancher<filename>tests/validation/tests/v3_api/test_sbx_custom_filter.py
from .common import * # NOQA
import requests
AUTH_PROVIDER = os.environ.get('RANCHER_AUTH_PROVIDER', "")
'''
Prerequisite:
Enable SBX without TLS, and using testuser1 as admin user.
Description:
In this test, we are testin... | 2.109375 | 2 |
CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/DynamicsMetaBlock.py | MaximeBaudette/PyCIM | 58 | 14840 | # Copyright (C) 2010-2011 <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 limitation the
# rights to use, copy, modify, merge, publish, distrib... | 1.820313 | 2 |
official/cv/ADNet/export_model.py | leelige/mindspore | 77 | 14841 | # 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 agreed to... | 1.90625 | 2 |
pyradex/tests/setup_package_data.py | SpacialTree/pyradex | 12 | 14842 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
def get_package_data():
paths_test = [os.path.join('data', '*.out')]
return {'pyradex.tests': paths_test}
| 1.390625 | 1 |
ipaqe_provision_hosts/backend/loader.py | apophys/idm-prepare-hosts | 1 | 14843 | <reponame>apophys/idm-prepare-hosts
# Author: <NAME>, 2017
"""Backend entry point manipulation"""
import logging
from pkg_resources import iter_entry_points
RESOURCE_GROUP = "ipaqe_provision_hosts.backends"
log = logging.getLogger(__name__)
def load_backends(exclude=()):
"""Load all registered modules"""
... | 2.109375 | 2 |
cfpland_bot/exceptions/__init__.py | jonatasbaldin/cfpland-telegram-bot | 3 | 14844 | <filename>cfpland_bot/exceptions/__init__.py
from .exceptions import ( # noqa: F401
MissingCFPAttributes,
MissingEnvironmentVariable,
)
| 1.273438 | 1 |
main_tmp.py | tiffanydho/chip2probe | 0 | 14845 | <filename>main_tmp.py
import urllib.request
import os
import subprocess
import pandas as pd
from tqdm import tqdm
import sys
sys.path.append("probefilter")
sys.path.append("probefilter/libsvm-3.23/python")
from sitesfinder.imads import iMADS
from sitesfinder.imadsmodel import iMADSModel
from sitesfinder.plotcombiner ... | 1.835938 | 2 |
7 kyu/Complete The Pattern 2.py | mwk0408/codewars_solutions | 6 | 14846 | <filename>7 kyu/Complete The Pattern 2.py
def pattern(n):
res=""
for i in range(n,0,-1):
for j in range(i):
res+=str(n-j)
res+="\n"
return res[:-1] | 3.46875 | 3 |
src/dagos/platform/__init__.py | DAG-OS/dagos | 0 | 14847 | <reponame>DAG-OS/dagos
import dagos.platform.platform_utils as platform_utils
from .command_runner import CommandRunner
from .command_runner import ContainerCommandRunner
from .command_runner import LocalCommandRunner
from .platform_domain import CommandNotAvailableIssue
from .platform_domain import OperatingSystem
fro... | 1.0625 | 1 |
scripts/find_guids_without_referents.py | DanielSBrown/osf.io | 1 | 14848 | """Finds Guids that do not have referents or that point to referents that no longer exist.
E.g. a node was created and given a guid but an error caused the node to
get deleted, leaving behind a guid that points to nothing.
"""
import sys
from modularodm import Q
from framework.guid.model import Guid
from website.app ... | 2.625 | 3 |
test/test_app.py | IoT-Partners/Platform | 0 | 14849 | """
This script is for testing/calling in several different ways
functions from QRColorChecker modules.
@author: <NAME>
@mail: <EMAIL>
"""
import unittest
import hashlib
import dateutil
from chalicelib.server import Server
import sys
import json
from datetime import datetime
sys.path.append('../chalicelib')
clas... | 2.46875 | 2 |
test/test_config.py | beremaran/spdown | 2 | 14850 | #!/usr/bin/env python
import os
import json
import unittest
from collections import OrderedDict
from spdown.config import Config
TEST_CONFIG_PATHS = OrderedDict([
('local', 'config.json'),
('home', os.path.join(
os.path.expanduser('~'), '.config',
'spdown', 'config'
))
])
TEST_CONFIG = {
... | 2.46875 | 2 |
external/emulation/tests/test_config.py | ai2cm/fv3net | 1 | 14851 | from emulation._emulate.microphysics import TimeMask
from emulation.config import (
EmulationConfig,
ModelConfig,
StorageConfig,
_load_nml,
_get_timestep,
_get_storage_hook,
get_hooks,
)
import emulation.zhao_carr
import datetime
def test_EmulationConfig_from_dict():
seconds = 60
m... | 2.203125 | 2 |
sorting/insertion_sort.py | src24/algos | 0 | 14852 | from typing import List
# O(n^2)
def insertion_sort(arr: List[int], desc: bool = False) -> None:
for i, item in enumerate(arr):
if i == 0:
continue
j: int = i - 1
while j >= 0 and (arr[j] > item) ^ desc:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = it... | 3.859375 | 4 |
tests/test_client.py | ocefpaf/pystac-client | 0 | 14853 | <gh_stars>0
from datetime import datetime
from urllib.parse import urlsplit, parse_qs
from dateutil.tz import tzutc
import pystac
import pytest
from pystac_client import Client
from pystac_client.conformance import ConformanceClasses
from .helpers import STAC_URLS, TEST_DATA, read_data_file
class TestAPI:
@pyt... | 2.609375 | 3 |
setup.py | mattpatey/text2qrcode | 1 | 14854 | <reponame>mattpatey/text2qrcode
from setuptools import (
find_packages,
setup,
)
setup(
name="text2qrcode",
version="1.0-a1",
description="Render a QR code image from input text",
author="<NAME>",
packages=find_packages(),
install_requires=["qrcode", "pillow"],
entry_points={
... | 1.5625 | 2 |
test/test_image.py | arkagogoldey/cloud_coverage_image_analysis | 1 | 14855 | <gh_stars>1-10
import numpy as np
import random
from proyecto2.image import Image
class TestImage:
def test_pixels(self):
for _ in range(5):
x = random.randrange(1920, 4368, 1)
y = random.randrange(1080, 2912, 1)
matrix = np.random.rand(y, x)
image = Image(m... | 2.609375 | 3 |
test_autolens/unit/pipeline/phase/point_source/test_phase_point_source.py | agarwalutkarsh554/PyAutoLens | 0 | 14856 | from os import path
import numpy as np
import pytest
import autofit as af
import autolens as al
from autolens.mock import mock
pytestmark = pytest.mark.filterwarnings(
"ignore:Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of "
"`arr[seq]`. In... | 2.328125 | 2 |
convert.py | lfe999/xenforo-scraper | 2 | 14857 | <gh_stars>1-10
formats = {"KiB": 1024, "KB": 1000,
"MiB": 1024**2, "MB": 1000**2,
"GiB": 1024**3, "GB": 1000**3,
"TiB": 1024**4, "TB": 1000**4}
# Converts shorthand into number of bytes, ex. 1KiB = 1024
def shortToBytes(short):
if short is not None:
try:
for fo... | 2.84375 | 3 |
old/pro/src/GUI/lofarBFgui.py | peijin94/LOFAR-Sun-tools | 0 | 14858 | <filename>old/pro/src/GUI/lofarBFgui.py
# The UI interface and analysis of the lofar solar beam from
import sys
# insert at 1, 0 is the script path (or '' in REPL)
sys.path.insert(1, '..')
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon
from PyQt5.uic import loadUi
from PyQt5.QtCore import Qt
import matp... | 2.265625 | 2 |
otter/api.py | sean-morris/otter-grader | 0 | 14859 | <reponame>sean-morris/otter-grader
"""
"""
__all__ = ["export_notebook", "grade_submission"]
import os
import sys
import shutil
import tempfile
from contextlib import redirect_stdout
try:
from contextlib import nullcontext
except ImportError:
from .utils import nullcontext # nullcontext is new in Python 3.7... | 1.921875 | 2 |
taurex/data/profiles/pressure/arraypressure.py | ucl-exoplanets/TauREx3_public | 10 | 14860 | from .pressureprofile import PressureProfile
import numpy as np
class ArrayPressureProfile(PressureProfile):
def __init__(self, array, reverse=False):
super().__init__(self.__class__.__name__, array.shape[-1])
if reverse:
self.pressure_profile = array[::-1]
else:
... | 3.203125 | 3 |
bin/check_samplesheet.py | ggabernet/vcreport | 1 | 14861 | <reponame>ggabernet/vcreport
#!/usr/bin/env python
# This script is based on the example at: https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv
import os
import sys
import errno
import argparse
def parse_args(args=None):
Description = "Reformat ... | 2.828125 | 3 |
mltraining.py | krumaska/FTIFTC | 0 | 14862 | <gh_stars>0
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import random
lol = pd.read_csv('./data/sample_SilverKDA.csv')
lol... | 2.6875 | 3 |
timeboard.py | jtbarker/hiring-engineers | 0 | 14863 | from datadog import initialize, api
options = {
'api_key': '16ff05c7af6ed4652a20f5a8d0c609ce',
'app_key': 'e6a169b9b337355eef90002878fbf9a565e9ee77'
}
initialize(**options)
title = "Mymetric timeboard"
description = "Mymetric Timeboard"
graphs = [
{
"definition": {
"events": [],
... | 1.976563 | 2 |
tests/python/rlview/test-run.py | JonathanLehner/korali | 43 | 14864 | #! /usr/bin/env python3
from subprocess import call
r = call(["python3", "-m", "korali.rlview", "--help"])
if r!=0:
exit(r)
r = call(["python3", "-m", "korali.rlview", "--dir", "abf2d_vracer1", "--test"])
if r!=0:
exit(r)
r = call(["python3", "-m", "korali.rlview", "--dir", "abf2d_vracer1", "--maxObservations", ... | 2.140625 | 2 |
cmake/build_defs.bzl | benjaminp/upb | 0 | 14865 |
def generated_file_staleness_test(name, outs, generated_pattern):
"""Tests that checked-in file(s) match the contents of generated file(s).
The resulting test will verify that all output files exist and have the
correct contents. If the test fails, it can be invoked with --fix to
bring the checked-in... | 2.921875 | 3 |
tests/transform_finding_test.py | aws-samples/aws-security-hub-analytic-pipeline | 7 | 14866 | from assets.lambdas.transform_findings.index import TransformFindings
import boto3
from moto import mock_s3
def __make_bucket(bucket_name: str):
bucket = boto3.resource('s3').Bucket(bucket_name)
bucket.create()
return bucket
@mock_s3
def test_fix_dictionary():
bucket = __make_bucket('tester')
tr... | 1.976563 | 2 |
Breeze18/Breeze/migrations/0006_auto_20180110_2205.py | Breeze18/Breeze | 0 | 14867 | <filename>Breeze18/Breeze/migrations/0006_auto_20180110_2205.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-10 16:35
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrat... | 1.492188 | 1 |
plugin.video.rebirth/resources/lib/modules/libtools.py | TheWardoctor/wardoctors-repo | 1 | 14868 | # -*- coding: utf-8 -*-
################################################################################
# | #
# | ______________________________________________________________ #
# | :~8a.`~888a:::::::::::::::88......88:::::::::... | 1.679688 | 2 |
frappe/website/page_renderers/template_page.py | sersaber/frappe | 0 | 14869 | <filename>frappe/website/page_renderers/template_page.py
import io
import os
import click
import frappe
from frappe.website.page_renderers.base_template_page import BaseTemplatePage
from frappe.website.router import get_base_template, get_page_info
from frappe.website.utils import (
cache_html,
extract_comment_tag,... | 2.125 | 2 |
mistral/db/v2/sqlalchemy/models.py | mail2nsrajesh/mistral | 0 | 14870 | # Copyright 2015 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# Unl... | 1.890625 | 2 |
haskell/private/packages.bzl | andyscott/rules_haskell | 0 | 14871 | <reponame>andyscott/rules_haskell
"""Package list handling"""
load(":private/set.bzl", "set")
def pkg_info_to_ghc_args(pkg_info):
"""
Takes the package info collected by `ghc_info()` and returns the actual
list of command line arguments that should be passed to GHC.
"""
args = [
# In compi... | 2.078125 | 2 |
get_repo/git.py | florian42/get-repo | 0 | 14872 | <gh_stars>0
import subprocess
def clone(url: str, target_directory: str) -> None:
print(f'Cloning {url} into {target_directory} ...')
subprocess.run(
['git', 'clone', url, target_directory], capture_output=True
)
| 2.296875 | 2 |
tests/test_models/test_state.py | adrian-blip/AirBnB_clone_v2 | 0 | 14873 | <reponame>adrian-blip/AirBnB_clone_v2
#!/usr/bin/python3
"""
===============================================================================
████████╗███████╗███████╗████████╗ ██████╗ █████╗ ███████╗███████╗███████╗
╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝ ██╔════╝██╔══██╗██╔════╝██╔════╝██╔════╝
██║ █████... | 2.28125 | 2 |
src/generatorse/EESG_1.7.x.py | WISDEM/GeneratorSE | 0 | 14874 | """EESG.py
Created by <NAME>, <NAME>.
Copyright (c) NREL. All rights reserved.
Electromagnetic design based on conventional magnetic circuit laws
Structural design based on McDonald's thesis """
from openmdao.api import Group, Problem, Component,ExecComp,IndepVarComp,ScipyOptimizer,pyOptSparseDriver
from openmd... | 2.296875 | 2 |
haiku/_src/integration/numpy_inputs_test.py | timwillhack/dm-haikuBah2 | 1,647 | 14875 | <reponame>timwillhack/dm-haikuBah2
# Copyright 2020 DeepMind Technologies Limited. 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/... | 2.140625 | 2 |
OldStreamingExperiments/NeighbourReducerCounter.py | AldurD392/SubgraphExplorer | 0 | 14876 | #!/usr/bin/env python
"""A more advanced Reducer, using Python iterators and generators."""
from itertools import groupby
from operator import itemgetter
import sys
def read_mapper_output(file, separator='\t'):
for line in file:
yield line.rstrip().split(separator, 1)
def main(separator='\t'):
data... | 3.40625 | 3 |
tests/programs/lists/member_isin.py | astraldawn/pylps | 1 | 14877 | <reponame>astraldawn/pylps
from pylps.core import *
initialise(max_time=5)
create_actions('say(_, _)', 'say_single(_)')
create_events('member(_, _)')
create_facts('inp(_, _)')
create_variables('X', 'Y', 'F', 'Item', 'List', 'Tail')
inp([], [[]])
inp('z', ['a', 'b', 'c', 'd', 'e'])
inp('a', ['b', 'c', 'a'])
inp(['b',... | 1.929688 | 2 |
fastface/dataset/base.py | mdornseif/fastface | 72 | 14878 | import copy
import logging
import os
from typing import Dict, List, Tuple
import checksumdir
import imageio
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
from ..adapter import download_object
logger = logging.getLogger("fastface.dataset")
class _IdentitiyTra... | 2.28125 | 2 |
clevr_video/params.py | jiaqi-xi/slot_attention | 0 | 14879 | <reponame>jiaqi-xi/slot_attention<filename>clevr_video/params.py
from typing import Optional
from typing import Tuple
import attr
@attr.s(auto_attribs=True)
class SlotAttentionParams:
lr: float = 0.0004
batch_size: int = 64
val_batch_size: int = 64
resolution: Tuple[int, int] = (128, 128)
num_slo... | 1.875 | 2 |
sources/car.py | amaurylrd/banlieu_drift | 1 | 14880 | import pygame
import math
coef_turn = 0.3
coef_drift = 0.07 # adhérence au sol
coef_vel = 10
class Car:
def __init__(self):
self.dir_target = -1
self.dir = -1
self.posx = 0
self.velx = -1
self.w = 50
self.h = 100
def update(self, dt):
self.dir += dt * ... | 3.125 | 3 |
test/test_static.py | fjarri/grunnur | 1 | 14881 | <reponame>fjarri/grunnur
import pytest
import numpy
from grunnur import (
cuda_api_id, opencl_api_id,
StaticKernel, VirtualSizeError, API, Context, Queue, MultiQueue, Array, MultiArray
)
from grunnur.template import DefTemplate
from .mock_base import MockKernel, MockDefTemplate, MockDefTemplate
from .mock... | 2 | 2 |
stat_ip_in_hash_woker_table.py | ligang945/pyMisc | 0 | 14882 | <reponame>ligang945/pyMisc
def sortedDict(adict):
keys = adict.keys()
keys.sort()
return map(adict.get, keys)
ipint2str = lambda x: '.'.join([str(x/(256**i)%256) for i in range(3,-1,-1)])
ipstr2int = lambda x:sum([256**j*int(i) for j,i in enumerate(x.split('.')[::-1])])
src_ip = dict()
dst_ip = dict()
i ... | 2.796875 | 3 |
platform/winrt/detect.py | bdero/godot | 24 | 14883 |
import os
import sys
import string
def is_active():
return True
def get_name():
return "WinRT"
def can_build():
if (os.name=="nt"):
#building natively on windows!
if (os.getenv("VSINSTALLDIR")):
return True
return False
def get_opts():
return []
def get_flags():
return []
def configure(env):
... | 2.203125 | 2 |
monasca-log-api-2.9.0/monasca_log_api/tests/test_role_middleware.py | scottwedge/OpenStack-Stein | 0 | 14884 | # Copyright 2015-2017 FUJITSU LIMITED
#
# 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... | 1.953125 | 2 |
app/LOGS/logger_.py | innovationb1ue/XMU_HealthReport | 2 | 14885 | import logging
class NewLogger:
def __init__(self, log_abs_path:str):
self.logger = logging.getLogger()
handler = logging.FileHandler(log_abs_path)
handler.setLevel(logging.ERROR)
self.logger.addHandler(handler)
def log(self, msg:str):
self.logger.log(logging.ERROR, m... | 3.046875 | 3 |
route/link.py | moluwole/Bast_skeleton | 3 | 14886 | from bast import Route
route = Route()
route.get('/', 'HelloController.index')
| 1.578125 | 2 |
paradrop/daemon/paradrop/core/config/wifi.py | VegetableChook/Paradrop | 1 | 14887 | <reponame>VegetableChook/Paradrop
from paradrop.base.output import out
from paradrop.lib.utils import uci
from . import configservice, uciutils
def getOSWirelessConfig(update):
"""
Read settings from networkInterfaces for wireless interfaces.
Store wireless configuration settings in osWirelessConfig.
... | 2.53125 | 3 |
xixi.py | niushuqing123/final-project | 9 | 14888 | <gh_stars>1-10
import taichi as ti
import numpy as np
from functools import reduce
# from sph_base import SPHBase
# ti.init(arch=ti.cpu)
# Use GPU for higher peformance if available
ti.init(arch=ti.gpu, device_memory_GB=4, packed=True)
# 因为邻居搜索的网格不会做,所以尺寸数据只好也沿用助教的写法
# res = (720,720)
res = (512,512)
... | 2.09375 | 2 |
pexen/factory/module.py | comps/pexen | 1 | 14889 | import inspect
from fnmatch import fnmatchcase
from ..sched import meta
from .base import BaseFactory
class ModuleFactory(BaseFactory):
"""
Takes an imported module object and extracts callable objects from it.
A valid callable is any object that can be called and has pexen.sched
metadata.
Argum... | 2.703125 | 3 |
Python/zzz_training_challenge/Python_Challenge/solutions/ch07_recursion_advanced/solutions/ex07_water_jugs.py | Kreijeck/learning | 0 | 14890 | # Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by <NAME>
def solve_water_jugs(size1, size2, desired_liters):
return __solve_water_jugs_rec(size1, size2,
desired_liters, 0, 0, {})
def __solve_water_jugs_rec(size1, size2, desired_liters,
... | 3.828125 | 4 |
cancat/vstruct/defs/elf.py | kimocoder/CanCat | 2 | 14891 | import vstruct
from vstruct.primitives import *
EI_NIDENT = 4
EI_PADLEN = 7
class Elf32(vstruct.VStruct):
def __init__(self, bigend=False):
vstruct.VStruct.__init__(self)
self.e_ident = v_bytes(EI_NIDENT)
self.e_class = v_uint8()
self.e_data = v_uint8()
s... | 1.867188 | 2 |
Acquire/Identity/_useraccount.py | openghg/acquire | 1 | 14892 | <reponame>openghg/acquire
__all__ = ["UserAccount"]
_user_root = "identity/users"
def _encode_username(username):
"""This function returns an encoded (sanitised) version of
the username. This will ensure that the username
is valid (must be between 3 and 50 characters).
The sanitised username is the e... | 3.1875 | 3 |
saharaclient/api/job_binaries.py | openstack/python-saharaclient | 34 | 14893 | # Copyright (c) 2013 Mirantis 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 writ... | 1.992188 | 2 |
tests/test_translator.py | Attsun1031/schematics | 1,430 | 14894 | # -*- coding: utf-8 -*-
import pytest
def test_translator():
def translator(string):
translations = {'String value is too long.': 'Tamanho de texto muito grande.'}
return translations.get(string, string)
from schematics.translator import register_translator
register_translator(translator... | 2.578125 | 3 |
1014 Trie Tree/test.py | SLAPaper/hihoCoder | 0 | 14895 | <reponame>SLAPaper/hihoCoder
# generate 900k word and 900k query to test the runtime
from main import TrieTree
import time
import random
vocal = list(range(26))
trie = TrieTree()
words = [[random.choice(vocal) for _ in range(random.randrange(1, 11))] for _ in range(100000)]
queries = [[random.choice(vocal) for _ in... | 2.8125 | 3 |
tools/mo/openvino/tools/mo/front/onnx/mean_variance_normalization_ext.py | pazamelin/openvino | 1 | 14896 | <reponame>pazamelin/openvino
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.ops.mvn import MVNOnnx
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.f... | 1.640625 | 2 |
enemy.py | KasiaWo/Rabbit_Bobble | 0 | 14897 | """
Module for managing enemies.
"""
import random
import constants as const
import pygame
import random
import platforms
from spritesheet_functions import SpriteSheet
class Enemy(pygame.sprite.Sprite):
# -- Methods
def __init__(self, x_cord, y_cord,level, x_speed=2, char_type=0):
""" Constructor ... | 3.46875 | 3 |
schicluster/_hicluster_internal.py | zhoujt1994/scHiCluster | 27 | 14898 | <reponame>zhoujt1994/scHiCluster
import argparse
import inspect
import logging
import sys
from .__main__ import setup_logging
log = logging.getLogger()
DESCRIPTION = """
hic-internal is used for automation, not intend to be used by end user.
Use hicluster instead.
"""
EPILOG = ''
def impute_chromosome_internal_s... | 2.296875 | 2 |
tests/test_host_resolver.py | mssaleh/aioatomapi | 0 | 14899 | <reponame>mssaleh/aioatomapi<filename>tests/test_host_resolver.py<gh_stars>0
import asyncio
import socket
import pytest
from mock import AsyncMock, MagicMock, patch
import aioatomapi.host_resolver as hr
from aioatomapi.core import APIConnectionError
@pytest.fixture
def async_zeroconf():
with patch("zeroconf.asy... | 1.992188 | 2 |