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 |
|---|---|---|---|---|---|---|
mc66c.py | tcoenraad/micropython-multical66c | 0 | 12784251 | <reponame>tcoenraad/micropython-multical66c
from machine import UART
from umqtt.robust import MQTTClient
import uos
from time import sleep
MQTT_HOST = "192.168.1.8"
UART_ID = 0
def fetch_standard_data():
device = UART(UART_ID, baudrate=300, bits=7,
parity=0, stop=2, timeout=3000)
device.wri... | 2.71875 | 3 |
fincorpy/__init__.py | Fincor-Blockchain/fincorpy | 0 | 12784252 | <reponame>Fincor-Blockchain/fincorpy
from hdwallets import BIP32DerivationError as BIP32DerivationError # noqa: F401
from fincorpy._transaction import Transaction as Transaction # noqa: F401
from fincorpy._wallet import generate_wallet as generate_wallet # noqa: F401
from fincorpy._wallet import privkey_to_address ... | 1.554688 | 2 |
tests/test_visitors/test_ast/test_iterables/test_unpacking.py | Kvm99/wemake-python-styleguide | 1 | 12784253 | <reponame>Kvm99/wemake-python-styleguide
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
IterableUnpackingViolation,
)
from wemake_python_styleguide.visitors.ast.iterables import (
IterableUnpackingVisitor,
)
args_unpacking_in_call = 'f(*args)'
spread_list_... | 2.328125 | 2 |
mpsci/distributions/t.py | WarrenWeckesser/mpsci | 7 | 12784254 | <filename>mpsci/distributions/t.py
"""
Student's t distribution
------------------------
"""
import mpmath
__all__ = ['pdf', 'logpdf', 'cdf', 'sf', 'invcdf', 'invsf', 'entropy']
def logpdf(x, df):
"""
Logarithm of the PDF of Student's t distribution.
"""
if df <= 0:
raise ValueError('df mus... | 2.796875 | 3 |
scripts/UtilitiesConvertCharacter.py | CrackerCat/pwndra | 524 | 12784255 | # Convert an operand to characters
#@author b0bb
#@category Pwn
#@keybinding shift r
#@menupath Analysis.Pwn.Utilities.Convert to Char
#@toolbar
import ghidra.app.cmd.equate.SetEquateCmd as SetEquateCmd
import ghidra.program.util.OperandFieldLocation as OperandFieldLocation
import ghidra.program.model.lang.OperandTyp... | 2.375 | 2 |
invenio_assets/filters.py | pazembrz/invenio-assets | 1 | 12784256 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Filters for webassets."""
from __future__ import absolute_import, print_function
... | 2.03125 | 2 |
aha/controller/translation.py | Letractively/aha-gae | 0 | 12784257 | # -*- coding: utf-8 -*-
##############################################################################
#
# translation.py
# Module defining bunch of function to be used for i18n transration
#
# Copyright (c) 2010 Webcore Corp. All Rights Reserved.
#
#####################################################################... | 2.203125 | 2 |
carpark_agent/detect_cars.py | fetchai/carpark_agent | 10 | 12784258 | <filename>carpark_agent/detect_cars.py<gh_stars>1-10
import os
ROOT_DIR = os.path.abspath("../src/Mask_RCNN/")
MODEL_DIR = os.path.abspath("../src/coco/")
COCO_MODEL_PATH = os.path.join(MODEL_DIR, "mask_rcnn_coco.h5")
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
matplot... | 2.265625 | 2 |
tests/test_websocket.py | schnitzelbub/bocadillo | 0 | 12784259 | from contextlib import suppress
import pytest
from bocadillo import WebSocket, API, WebSocketDisconnect
from bocadillo.constants import WEBSOCKET_CLOSE_CODES
# Basic usage
def test_websocket_route(api: API):
@api.websocket_route("/chat")
async def chat(ws: WebSocket):
async with ws:
as... | 2.140625 | 2 |
anemoi/__init__.py | davidkyle210/anemoi | 18 | 12784260 | from ._version import __version__
from anemoi.mast import MetMast
import anemoi
import anemoi.io.database
import anemoi.io.read_data
import anemoi.io.write_data
import anemoi.io.references
import anemoi.utils.mast_data
import anemoi.utils.gis
import anemoi.analysis.weibull
import anemoi.analysis.wind_rose
im... | 0.976563 | 1 |
custom_components/arpansa_uv/pyarpansa.py | joshuar/ha_arpansa_uv | 0 | 12784261 | """ARPANSA """
from cProfile import run
from multiprocessing.connection import Client
from bs4 import BeautifulSoup
import lxml
import aiohttp
import asyncio
from .const import ARPANSA_URL
class Arpansa:
"""Arpansa class fetches the latest measurements from the ARPANSA site"""
def __init__(
self,sess... | 2.984375 | 3 |
API/src/main.py | DeVinci-Innovation-Center/SMART-INVENTORY-DB-API | 0 | 12784262 | import os
import crud, models, schemas
from database import SessionLocal
from fastapi import FastAPI, Depends, HTTPException, Request, Form
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session
from typing import List
app = FastAPI(root_path=... | 2.34375 | 2 |
tests/tests.py | penzance/student_locations | 1 | 12784263 | from unittest import TestCase
from mock import patch, ANY, DEFAULT, Mock, MagicMock
from django.test import RequestFactory
from django_auth_lti import const
from student_locations.views import index, lti_launch, main
@patch.multiple('student_locations.views', render=DEFAULT)
class TestMapView(TestCase):
longMessag... | 2.296875 | 2 |
exhaust/tests/posts/test_sitemaps.py | lewiscollard/exhaust | 0 | 12784264 | from datetime import timedelta
from xml.etree import ElementTree
from django.test import TestCase
from django.urls import reverse
from django.utils.timezone import now
from exhaust.tests.factories import CategoryFactory, PostFactory
class SitemapsTestCase(TestCase):
def test_posts_sitemap(self):
PostFac... | 2.3125 | 2 |
exonum_client/proofs/list_proof/list_proof.py | aleksuss/exonum-python-client | 5 | 12784265 | """Proof Verification Module for Exonum `ProofListIndex`."""
from typing import Dict, List, Tuple, Any, Callable
import itertools
from logging import getLogger
from exonum_client.crypto import Hash
from ..utils import is_field_hash, is_field_int, calculate_height
from ..hasher import Hasher
from .key import ProofList... | 2.734375 | 3 |
rllab/envs/mujoco/hill/terrain.py | RussellM2020/maml_gps | 1,838 | 12784266 | from scipy.stats import multivariate_normal
from scipy.signal import convolve2d
import matplotlib
try:
matplotlib.pyplot.figure()
matplotlib.pyplot.close()
except Exception:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
# the colormap should assign light colors to low ... | 2.59375 | 3 |
test/parOimparTestCase.py | uip-pc3/numero-par-impar-ArielLK | 0 | 12784267 | <filename>test/parOimparTestCase.py
import unittest
from app.parOimpar import verificar
class PoIC(object):
pass
class parOimparTestCase(unittest.TestCase):
# IMPAR = FALSE , PAR = TRUE
def test_impar(self):
retorno = self.PoIC = verificar(15)
self.assertEquals(retorno, False... | 2.6875 | 3 |
gui/fonts/font14.py | seelpro/micropython-micro-gui | 37 | 12784268 | <gh_stars>10-100
# Code generated by font_to_py.py.
# Font: FreeSans.ttf Char set: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~£¬°Ωαβγδθλμπωϕ
# Cmd: ./font_to_py.py -x -k extended FreeSans.ttf 23 font14.py
version = '0.33'
def height():
return 23
def baseline():
... | 1.960938 | 2 |
src/c3nav/mapdata/migrations/0016_auto_20161208_2023.py | bate/c3nav | 1 | 12784269 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-08 20:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0015_auto_20161208_2020'),
]
operations = [
migrations.Re... | 1.476563 | 1 |
output/process.py | googlx/lasertagger | 1 | 12784270 | <filename>output/process.py
import os
import pandas as pd
from tqdm import tqdm
names = ['text', 'decoded', 'reference']
df = pd.read_csv('pred.tsv', sep='\t', header=None, names=names)
df['text'] = df['text'].apply(lambda x: ' '.join(list(x)))
df['reference'] = df['reference'].apply(lambda x: ' '.join(list(x)))
cha... | 2.53125 | 3 |
lisa/training.py | mjirik/lisa | 22 | 12784271 | <reponame>mjirik/lisa
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © %YEAR% <>
#
# Distributed under terms of the %LICENSE% license.
"""
Training module. Default setup makes nothing. Use --all to make all
"""
from loguru import logger
# logger = logging.getLogger()
import argparse
... | 2.03125 | 2 |
6/solution.py | thesketh/advent-of-code-2021 | 0 | 12784272 | <filename>6/solution.py
"""
Solution to the sixth challenge, calculating the proliferation of
lanternfish.
"""
from collections import Counter
from os import PathLike
from pathlib import Path
from typing import Sequence, Iterable
ROOT = Path(__file__).absolute().parent
LanternFish = int
"""A lanternfish, represente... | 3.921875 | 4 |
FaceTime/frida/replay.py | googleprojectzero/Street-Party | 226 | 12784273 | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
import frida
import sys
import os
vid_index=0
aud_index = 0
d... | 1.828125 | 2 |
esimulation/eobjects/test/test_electricity_provider.py | brunoknittel/python-epower-simulation | 1 | 12784274 | # Copyright 2020 <NAME> <<EMAIL>>
# 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... | 2.171875 | 2 |
tutorials/W2D3_DecisionMaking/solutions/W2D3_Tutorial1_Solution_be044152.py | liuxiaomiao123/NeuroMathAcademy | 2 | 12784275 |
sigma = 3.95
num_repeats = 500 # number of simulations to run for each error rate
alpha_list = np.power(10,list(range(-5,0)) + np.linspace(-0.9,-0.1,9).tolist()) # list of error rates
threshold_list = list(map(threshold_from_errorrate, alpha_list))
def simulate_accuracy_vs_speed(sigma, threshold_list, num_sampl... | 3.203125 | 3 |
tests/test_module_path_finder.py | swinkels/skempy | 0 | 12784276 | <reponame>swinkels/skempy
import unittest
from skempy.module_path_finder import ModulePathFinder
from utils import get_abs_path
class TestModulePathFinder(unittest.TestCase):
def test_python_file_in_non_package_directory(self):
test_file_path = get_abs_path("source_code.py", __file__)
module_pa... | 2.65625 | 3 |
bin/apache-hive-3.1.2-bin/lib/py/thrift/__init__.py | ptrick/hdfs-hive-sql-playground | 0 | 12784277 | version https://git-lfs.github.com/spec/v1
oid sha256:4483dc4e2110743c7c39245cfd5626a1e46f9b4007e129bbf2b7c923d52056ea
size 817
| 0.769531 | 1 |
databricksapi/SQLEndpoints.py | lotnikov/databricks_api | 0 | 12784278 | from . import Databricks
class SQLEndpoints(Databricks.Databricks):
def __init__(self, url, token=None):
super().__init__(token)
self._url = url
self._api_type = 'sql'
def createEndpoint(self, name, cluster_size, min_num_clusters=1, max_num_clusters=1, auto_stop_mins=10, spot_instance_policy=None,
... | 2.28125 | 2 |
src/node_read_item_forecast.py | clarify/data-science-tutorials-orchest | 0 | 12784279 | from datetime import datetime, timedelta
from pyclarify import APIClient
import orchest
import pandas as pd
import numpy as np
from merlion.utils import TimeSeries
from merlion.models.forecast.prophet import Prophet, ProphetConfig
from merlion.transform.base import Identity
def pipeline_data(times, values, new_id,new... | 2.796875 | 3 |
test/rql_test/drivers/driver_test.py | zadcha/rethinkdb | 21,684 | 12784280 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from driver import bag, compare, err, err_regex, partial, uuid
class PythonTestDriverTest(unittest.TestCase):
def compare(self, expected, result, options=None):
self.assertTrue(compare(expected, result, options=options))
def compareFals... | 2.96875 | 3 |
xinshuo_io/google_api_io.py | xinshuoweng/cv_ml_tool | 31 | 12784281 | <reponame>xinshuoweng/cv_ml_tool
# Author: <NAME>
# email: <EMAIL>
# this file includes functions for google gpi, such as google sheet
import os, httplib2
from oauth2client import client, tools
from oauth2client.file import Storage
from googleapiclient import discovery
from xinshuo_miscellaneous import isstring, isli... | 2.453125 | 2 |
src/dataset/normalizers.py | mug-auth/ssl-chewing | 0 | 12784282 | <reponame>mug-auth/ssl-chewing<filename>src/dataset/normalizers.py
from abc import ABC, abstractmethod
import numpy as np
from dataset.template.commons import PureAbstractError
class BaseNormalizer(ABC):
"""
Base class for normalizers.
"""
@abstractmethod
def normalize(self, x: np.ndarray) -> n... | 2.84375 | 3 |
compare_hosts_lists.py | ayumi-cloud/hosts | 0 | 12784283 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import argparse
import os.path
from collections import namedtuple
from HostsTools import hosts_tools
class HostList(namedtuple('HostList', 'filename set')):
pass
def parse_args() -> sys.argv:
parser = argparse.ArgumentParser()
parser.add_argumen... | 2.875 | 3 |
src/ffmeta/__init__.py | stephen-bunn/ffmeta | 0 | 12784284 | # -*- encoding: utf-8 -*-
# Copyright (c) 2021 st37 <<EMAIL>>
# ISC License <https://choosealicense.com/licenses/isc>
"""FFMeta.
Tool to write media metadata using ffmpeg.
"""
| 0.914063 | 1 |
tests/test_middleware.py | TheNeonProject/trivia-game-dialogflow | 0 | 12784285 | <filename>tests/test_middleware.py
import os
import unittest
from middleware import is_token_valid
class MiddlewareTestCase(unittest.TestCase):
def setUp(self):
os.environ.setdefault('TOKEN', 'token')
def test_is_token_valid_empty_token(self):
is_valid = is_token_valid(None)
self.as... | 3.109375 | 3 |
infer.py | kevakil/mesh-transformer-jax | 0 | 12784286 | <reponame>kevakil/mesh-transformer-jax
import os
import requests
from jax.config import config
colab_tpu_addr = os.environ['COLAB_TPU_ADDR'].split(':')[0]
url = f'http://{colab_tpu_addr}:8475/requestversion/tpu_driver0.1_dev20210607'
requests.post(url)
# The following is required to use TPU Driver as JAX's backend.
... | 2.046875 | 2 |
tests/test_champion_rates.py | Canisback/solari | 16 | 12784287 | from solari import Leona
from solari.stats import ChampionPickrate, ChampionWinrate, ChampionPickCount, ChampionBanrate, ChampionPresenceRate, ChampionBanCount
def test_champion_pickrate(match_set_2):
l = Leona([
ChampionPickrate()
])
for m in match_set_2:
l.push_match(m)
... | 2.4375 | 2 |
_scripts/paste/getdecoproperties.py | Son-Guhun/Titan-Land-Lands-of-Plenty | 12 | 12784288 | """Gets properties from all decorations a .ini database and generates code to be used in the
UnitTypeDefaultValues library. This code is copied to the clipboard and can be pasted in a text
editor or inside the World Editor.
"""
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
#__________________... | 2.296875 | 2 |
labml/internal/tracker/writers/screen.py | conanjm/labml | 1 | 12784289 | <reponame>conanjm/labml<gh_stars>1-10
from typing import Dict
import numpy as np
from labml import logger
from .. import Writer, Indicator
from ..indicators.artifacts import Artifact
from ..indicators.numeric import NumericIndicator
from labml.logger import Text
class ScreenWriter(Writer):
def __init__(self):
... | 2.34375 | 2 |
tests/unit/test_order.py | Aspire1Inspire2/td-ameritrade-python-api | 610 | 12784290 | <gh_stars>100-1000
import unittest
import td.enums as td_enums
from unittest import TestCase
from configparser import ConfigParser
from td.orders import Order
from td.orders import OrderLeg
from td.client import TDClient
from td.stream import TDStreamerClient
class TDSession(TestCase):
"""Will perform a unit t... | 2.859375 | 3 |
tests/test_utils.py | afonsobspinto/pyecore | 1 | 12784291 | import pytest
from pyecore.ecore import *
from pyecore.utils import DynamicEPackage
@pytest.fixture(scope='module')
def simplemm():
A = EClass('A')
B = EClass('B')
Root = EClass('Root')
pack = EPackage('pack', nsURI='http://pack/1.0', nsPrefix='pack')
pack.eClassifiers.extend([Root, A, B])
ret... | 2.15625 | 2 |
custom_layers.py | martinpilat/RBFolutionalLayer | 3 | 12784292 | import tensorflow as tf
import numpy as np
class RBFolution(tf.keras.layers.Layer):
def __init__(self, filters, kernel_size=(1, 3, 3, 1), padding="VALID", strides=(1, 1, 1, 1), name="RBFolution",
dilation_rate=(1,1),
ccs_initializer=tf.keras.initializers.RandomUniform(0,1),
... | 2.4375 | 2 |
main.py | StanislavPetrovV/Advanced_RayMarching | 11 | 12784293 | <gh_stars>10-100
import moderngl_window as mglw
class App(mglw.WindowConfig):
window_size = 1600, 900
resource_dir = 'programs'
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.quad = mglw.geometry.quad_fs()
self.program = self.load_program(vertex_shader='vertex.glsl'... | 2.15625 | 2 |
listener.py | vinhquevu/angora | 0 | 12784294 | <reponame>vinhquevu/angora
"""
Angora Queue
"""
import socket
from typing import Dict, Optional
import kombu # type: ignore
class Queue:
"""
An object representing a queue in RabbitMQ.
A listener can listen to one or more queues and have one or more
callbacks. Consumer expects a sequence of queues... | 3.265625 | 3 |
components/services/appengine/stub/beaker/exceptions.py | appcelerator-archive/entourage | 1 | 12784295 | <filename>components/services/appengine/stub/beaker/exceptions.py
class BeakerException(Exception):
pass
class InvalidCacheBackendError(BeakerException):
pass
class MissingCacheParameter(BeakerException):
pass
class LockError(BeakerException):
pass
| 1.6875 | 2 |
ilias2nbgrader/preprocessors/createfolderstructure.py | DigiKlausur/ilias2nbgrader | 4 | 12784296 | import os
from .preprocessor import Preprocessor
from traitlets import Unicode
from shutil import move
import glob
class CreateFolderStructure(Preprocessor):
directory = Unicode('restructured', help='Subfolder where processed files go')
def __init__(self):
super(CreateFolderStructure, self).__ini... | 2.53125 | 3 |
ms/collect_figures.py | yoavram/Milpitas | 0 | 12784297 | <gh_stars>0
# import tempfile
import shutil
import os.path
from os.path import join as join_path
from os.path import split as split_path
import re
from zipfile import ZipFile
if __name__ == '__main__':
ms_dir = '../ms'
figures_dir = '../figures'
ms_figures_dir = join_path(ms_dir, 'figures')
zip_fname = '/Users/yoa... | 2.640625 | 3 |
resources/mechanics_lib/Fulcrum.py | PRECISE/ROSLab | 7 | 12784298 | from api.component import Component
class Fulcrum(Component):
def defComponents(self):
# Subcomponents used in this assembly
self.addSubcomponent("stem", "Hinge")
self.addSubcomponent("left", "RectBeam")
self.addSubcomponent("right", "RectBeam")
self.addSubcomponent("t", "TJoint")
def defParam... | 2.5625 | 3 |
poc/db_schema.py | fabienleite/IOMMU-dumper | 0 | 12784299 | #!/bin/false
# -*- coding: utf-8 -*-
import os
import sys
from sqlalchemy import Column, ForeignKey, Integer, String, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class Device(Base):
__tablena... | 2.75 | 3 |
guide/train_operator_ppo_ray.py | jgori-ouistiti/interaction-agents | 0 | 12784300 | <reponame>jgori-ouistiti/interaction-agents<gh_stars>0
from pointing.envs import SimplePointingTask
from pointing.assistants import ConstantCDGain
from pointing.users import CarefulPointer
from coopihc.policy import Policy
from coopihc.bundle import PlayUser, Train
from gym.wrappers import FlattenObservation
from c... | 2.265625 | 2 |
tests/data/test_bo_remove_user_from_group.py | c17r/TagTrain | 0 | 12784301 | import pytest
from . import db
from .db import database
from tagtrain import data
def test_unknown_owner(database):
with pytest.raises(data.Group.DoesNotExist):
group = data.by_owner.remove_user_from_group('non-existent', db.GROUP_NAME, 'doesnt-matter')
def test_unknown_group(database):
with pytest... | 2.421875 | 2 |
psite/urls.py | jrrobertson/psite | 0 | 12784302 | <reponame>jrrobertson/psite
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from django.views.generic import RedirectView
from resume import views
urlpatterns = [
path('', RedirectView.as_view(url='resume/')),
pa... | 1.875 | 2 |
elderflower/task.py | NGC4676/minister | 1 | 12784303 | <reponame>NGC4676/minister
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import warnings
import numpy as np
from pathlib import Path
from functools import partial
from astropy.io import fits
from astropy.table import Table
from .io import logger
from .io import find_keyword_header, check_save_pa... | 2.109375 | 2 |
tmp/httprunner/debugtalk2.py | hanzhichao/runnerz | 0 | 12784304 | <gh_stars>0
def add(a,b):
return a+b
def setup(request):
print('setup')
print(request)
def teardown(response):
print('teardown')
# print(response.resp_obj.text) # 原始请求文本 | 2.171875 | 2 |
0Leetcode Solutions/0053 Maximum Subarray.py | DonghaoQiao/Python | 1 | 12784305 | <reponame>DonghaoQiao/Python
'''
https://leetcode.com/problems/maximum-subarray/
53. Maximum Subarray
Easy
Given an integer array nums, find the contiguous subarray (containing at least one number)
which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanatio... | 4.03125 | 4 |
src/optimizer.py | mirefek/GeoModelBuilder | 0 | 12784306 | <reponame>mirefek/GeoModelBuilder<filename>src/optimizer.py
from abc import ABC, abstractmethod
import math
import pdb
import collections
import itertools
import tensorflow.compat.v1 as tf
import random
from tqdm import tqdm
from instruction import *
from primitives import Line, Point, Circle, Num
from util import is_... | 2.421875 | 2 |
slm_lab/agent/algorithm/policy_util.py | achao2013/SLM-Lab | 1 | 12784307 | '''
Action policy methods to sampling actions
Algorithm provides a `calc_pdparam` which takes a state and do a forward pass through its net,
and the pdparam is used to construct an action probability distribution as appropriate per the action type as indicated by the body
Then the prob. dist. is used to sample action.
... | 2.96875 | 3 |
test/unit/test_cli.py | pgiraud/temboard-agent | 0 | 12784308 | <gh_stars>0
from __future__ import unicode_literals
import pytest
def test_ok():
from temboardagent.cli import cli
@cli
def main(argv, environ):
assert 'TESTVALUE' in argv
return 0xcafe
with pytest.raises(SystemExit) as ei:
main(argv=['TESTVALUE'])
assert 0xcafe == ei.v... | 2.109375 | 2 |
battleship/battleship.py | johncoleman83/codewars | 0 | 12784309 | <reponame>johncoleman83/codewars<gh_stars>0
#!/usr/bin/env python3
def ship_size(row, i):
size = 0
if 0 <= i < 10 and row[i] == 1:
row[i] = 0
size += 1 + ship_size(row, i + 1) + ship_size(row, i - 1)
return size
def check_diagonals(f):
coords = {}
for r in range(10):
for c ... | 3.21875 | 3 |
corehq/warehouse/migrations/0003_userstagingtable.py | kkrampa/commcare-hq | 1 | 12784310 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-29 08:39
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('warehouse', '0002_domainstagingtable_groupstagingtabl... | 1.75 | 2 |
setup.py | KyleKing/not-on-pypi | 0 | 12784311 | """Setup File."""
from pathlib import Path
from setuptools import setup
from setuptools.command.install import install
# ✓ PACKAGE_NAME = 'common_app'
# ✓ PACKAGE_NAME = 'cn_smtp_sink_server'
# ✓ PACKAGE_NAME = 'common_bootstrap'
# ✓ PACKAGE_NAME = 'common_dash'
# ✓ PACKAGE_NAME = 'common_img'
# ✓ PACKAGE_NAME = 'com... | 2.546875 | 3 |
src/coalescenceml/cli/hidden.py | bayoumi17m/CoalescenceML | 1 | 12784312 | <gh_stars>1-10
import time
import click
from coalescenceml.cli.cli import cli
import coalescenceml.cli.utils as cli_utils
from coalescenceml.constants import console
from coalescenceml.logger import get_logger
@cli.command(name="over", help="Funny joke...hehe", hidden=True)
def print_deez_nutz_joke()->None:
dee... | 1.945313 | 2 |
Domains/Python/04 - Sets/No Idea!/solution.py | abhinavgunwant/hackerrank-solutions | 1 | 12784313 | n,m = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
A = set([int(i) for i in input().split()])
B = set([int(i) for i in input().split()])
happiness = 0
for i in arr:
if i in A:
happiness += 1
elif i in B:
happiness -= 1
print(happiness) | 2.96875 | 3 |
preprocessing/hdf5/opflow_hdf5.py | sbrodeur/CREATE-dataset | 0 | 12784314 | <filename>preprocessing/hdf5/opflow_hdf5.py<gh_stars>0
#!/usr/bin/env python
# Copyright (c) 2018, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code ... | 1.523438 | 2 |
gethouse/urls.py | Alvin-21/patanyumba | 0 | 12784315 | from django.urls import path, re_path
from . import views
urlpatterns = [
re_path(r'^$', views.index, name='homepage'),
re_path(r'^ajax/subscription/$', views.subscription, name='subscription'),
re_path(r'^search/', views.search_results, name='search_results'),
re_path(r'^accomodation/(\d+)', views.acc... | 1.890625 | 2 |
pyble/const/characteristic/body_sensor_location.py | bgromov/PyBLEWrapper | 14 | 12784316 | NAME="Body Sensor Location"
UUID=0x2A38
| 1.070313 | 1 |
libs/gradiusnlp/old/gradius_nlp.py | gradiuscypher/internetmademe | 0 | 12784317 | import praw
import elasticsearch
import string
import random
from nltk import word_tokenize, pos_tag
class GradiusNlp:
def __init__(self):
self.elastic = elasticsearch.Elasticsearch()
def get_reddit_data(self, subreddit, post_count):
r = praw.Reddit(user_agent="https://github.com/gradiuscyph... | 2.78125 | 3 |
reply.py | Asdvamp/CEH-python-Scripts | 0 | 12784318 | <reponame>Asdvamp/CEH-python-Scripts<filename>reply.py<gh_stars>0
while True:
message = input("Send -> ")
with open("log.txt", "w") as file:
file.write(message) | 2.484375 | 2 |
insect/models/__init__.py | Kradukman/beesUlb | 0 | 12784319 | from . import super_family
from . import family
from . import sub_family
from . import tribe
from . import genus
from . import specie
from . import sub_specie
from . import wizard | 1.28125 | 1 |
nanopores/py4gmsh/__init__.py | mitschabaude/nanopores | 8 | 12784320 | from basic import *
from extra import *
| 1.28125 | 1 |
examples/traveltime_straight_channel.py | wrightky/dorado | 19 | 12784321 | """Example case for particle travel times in a straight channel."""
import numpy as np
import matplotlib.pyplot as plt
import dorado.particle_track as pt
# fix the random seed so it stays the same as weights change
np.random.seed(1)
# create synthetic domain and flow field
domain = np.zeros((100, 50))
depth = np.zero... | 3.078125 | 3 |
descwl_shear_sims/randsphere.py | aguinot/descwl-shear-sims | 5 | 12784322 | import numpy as np
import esutil as eu
def randcap(*,
rng,
nrand,
ra,
dec,
radius,
get_radius=False,
dorot=False):
"""
Generate random points in a sherical cap
parameters
----------
nrand:
The number of r... | 3.375 | 3 |
sandbox/advect_microbes_llc.py | ali-ramadhan/lagrangian-microbes | 6 | 12784323 | import os
from datetime import datetime, timedelta
import numpy as np
import xarray as xr
import parcels
import matplotlib
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import cartopy
import cartopy.util
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONG... | 1.929688 | 2 |
project_euler/051-100/75.py | floppp/programming_challenges | 0 | 12784324 | '''
It turns out that 12 cm is the smallest length of wire that can be bent to
form an integer sided right angle triangle in exactly one way, but there are
many more examples.
12 cm: (3,4,5)
24 cm: (6,8,10)
30 cm: (5,12,13)
36 cm: (9,12,15)
40 cm: (8,15,17)
48 cm: (12,16,20)
In contrast, some lengths of wire, like 20... | 4.28125 | 4 |
src/pyasys/__init__.py | heewoonkim2020/pyasys | 0 | 12784325 | <filename>src/pyasys/__init__.py
"""
The official Pyasys Python library!
Please check README.md for more information on how to set up Pyasys for your next project.
"""
class Pyasys:
def __init__(self, import_name, author):
"""
Sets up a basic project class where project data can be stored.
... | 3 | 3 |
quilldelta/types.py | mariocesar/quill-delta-py | 2 | 12784326 | <filename>quilldelta/types.py
from collections import namedtuple
from functools import partial
from typing import Any, Dict, Union
from quilldelta import utils as _
__all__ = ['Insert', 'Retain', 'Delete', 'OperationType',
'is_retain', 'is_insert', 'is_delete',
'it_insert_text', 'load_operation'... | 2.3125 | 2 |
03_ThreeWayAndTkinter/main.py | faizovboris/PythonDevelopment2021 | 0 | 12784327 | <reponame>faizovboris/PythonDevelopment2021
import random
import tkinter as tk
import tkinter.messagebox
class Game():
def __init__(self):
self.root = tk.Tk();
self.root.title("Game 15")
self.root.rowconfigure(0, weight=1)
self.root.columnconfigure(0, weight=1)
self.frame ... | 3.4375 | 3 |
gunicorn.conf.py | jience/flask_gunicorn_nginx | 1 | 12784328 | <reponame>jience/flask_gunicorn_nginx
"""
gunicorn WSGI server configuration.
https://docs.gunicorn.org/en/latest/index.html
"""
import multiprocessing
loglevel = "debug"
bind = "unix:/tmp/gunicorn.sock"
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = "gevent"
max_requests = 1000
pidfile = "gunicorn.pid"... | 1.9375 | 2 |
gists/process_data.py | snafis/Utils | 3 | 12784329 | <gh_stars>1-10
# coding: utf-8
import os
import warnings
import pandas as pd
import numpy as np
import click
import pathlib
from src.utils.io.get_absolute_fpath import get_absolute_fpath
from src.utils.io.python_config_dict import config_dict_from_python_fpath
# Silence C dtype mapping warnings
warnings.filterwarnings... | 2.609375 | 3 |
search.py | wifijanitor/Search | 0 | 12784330 | <reponame>wifijanitor/Search<filename>search.py<gh_stars>0
#!/usr/bin/env python3
import os
import sys
import re
version = 2.0
part = sys.argv[1]
file = open(os.path.expanduser('~/Cisco/price.txt'))
rgx = re.compile(part, re.I)
for line in file:
if re.search(rgx, line):
print(line)
file.close()
| 2.875 | 3 |
terrainbento/boundary_handlers/not_core_node_baselevel_handler.py | alexmitchell/terrainbento | 18 | 12784331 | <gh_stars>10-100
# coding: utf8
# !/usr/env/python
"""**NotCoreNodeBaselevelHandler** modifies elevation for not-core nodes."""
import os
import numpy as np
from scipy.interpolate import interp1d
class NotCoreNodeBaselevelHandler(object):
"""Control the elevation of all nodes that are not core nodes.... | 2.515625 | 3 |
new_network/spw_network_new_brian2.py | andrisecker/KOKI_sharp_waves | 0 | 12784332 | <filename>new_network/spw_network_new_brian2.py
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
creates PC (adExp IF) and BC (exp IF) population in Brian2, loads in recurrent connection matrix for PC population
runs simulation and checks the dynamics
(updated network, parameters are/should be closer to the experimental da... | 2.15625 | 2 |
a01_gui_main.py | CyabbageRoll/Schedule_Manager | 0 | 12784333 | # %% =======================================================================
# import libraries
#===========================================================================
# default
import os
import datetime
import hashlib
# conda
import pandas as pd
import PySimpleGUI as sg
# user
from b01_schedule_class_base imp... | 1.882813 | 2 |
OOP-PythonBackend/sensor_db.py | mrmareksvk/Project3 | 0 | 12784334 | import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
class Sensor_DB:
def __init__(self, host="127.0.0.1", database="postgres", user="postgres", password=""):
self.__DBconnection = psycopg2.connect(
host=host, database="postgres", user=user, password=password
)
... | 3.25 | 3 |
tests/test_log.py | Yusadolat/bottery | 0 | 12784335 | <reponame>Yusadolat/bottery
import logging
from testfixtures import LogCapture
from bottery.log import DEFAULT_LOGGING, ColoredFormatter
def test_ColoredFormatter():
'''Test if logs are being colored'''
logging.config.dictConfig(DEFAULT_LOGGING)
with LogCapture(names='bottery') as logs:
logger... | 2.765625 | 3 |
tests/guinea-pigs/unittest/subtest_failure.py | djeebus/teamcity-python | 0 | 12784336 | <gh_stars>0
import unittest
from teamcity.unittestpy import TeamcityTestRunner
class TestXXX(unittest.TestCase):
def testSubtestFailure(self):
with self.subTest(i=0):
pass
with self.subTest(i="abc.xxx"):
assert 1 == 0
unittest.main(testRunner=TeamcityTestRunner)
| 2.328125 | 2 |
refex/python/syntactic_template.py | ssbr/refex | 11 | 12784337 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.21875 | 2 |
core/polyaxon/polyboard/processors/logs_processor.py | admariner/polyaxon | 3,200 | 12784338 | <filename>core/polyaxon/polyboard/processors/logs_processor.py
# !/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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.ap... | 1.914063 | 2 |
opt/lib/local_lib_color.py | MeF0504/basic_setup | 4 | 12784339 | <gh_stars>1-10
#! /usr/bin/env python3
from __future__ import print_function
BG = {'k':'\033[40m','w':'\033[47m','r':'\033[41m','g':'\033[42m','b':'\033[44m','m':'\033[45m','c':'\033[46m','y':'\033[43m'}
FG = {'k':'\033[30m','w':'\033[37m','r':'\033[31m','g':'\033[32m','b':'\033[34m','m':'\033[35m','c':'\033[36m','y'... | 2.46875 | 2 |
wp/setup_posts.py | positiondev/offset | 3 | 12784340 | from subprocess import check_output
from os import system
system ("wp post delete 1")
system("wp post create --post_title='A first post' --post_status=publish --post_date='2014-10-01 07:00:00' --post_content=\"This is the content\" --post_author=1")
system("wp post create --post_title='A second post' --post_status=pu... | 2.375 | 2 |
xmeos/models/old/master_orig.py | aswolf/xmeos | 1 | 12784341 | import numpy as np
import scipy as sp
from abc import ABCMeta, abstractmethod
from scipy import integrate
import scipy.interpolate as interpolate
import matplotlib.pyplot as plt
#====================================================================
# xmeos: Xtal-Melt Equation of State package
# models - librar... | 2.265625 | 2 |
scripts/venv/lib/python2.7/site-packages/cogent/parse/fastq.py | sauloal/cnidaria | 3 | 12784342 | <reponame>sauloal/cnidaria
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
def MinimalFastqParser(data, strict=True):
"""yi... | 2.734375 | 3 |
lib/id3c/cli/utils.py | UWIT-IAM/uw-redcap-client | 21 | 12784343 | """
CLI utilities.
"""
import click
def running_command_name() -> str:
"""
Returns the current CLI command name as a space-separated string, or
``id3c`` if not running under any command.
"""
appname = None
context = click.get_current_context(silent = True)
if context:
appname = co... | 2.71875 | 3 |
components/mgmtworker/scripts/start.py | cloudify-cosmo/cloudify-manager-blueprints | 35 | 12784344 | #!/usr/bin/env python
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
runtime_props = ctx.instance.runtime_properties
SERVICE_NAME = runtime_props['service_name']
HOME_DIR = runtime_pr... | 1.921875 | 2 |
backup/Version 0.7/EvaClientU.py | gabrieloandco/BB84py | 0 | 12784345 | <gh_stars>0
# Copyright (c) 2016 <NAME> (<<EMAIL>>)
#
# 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, merg... | 2.046875 | 2 |
src/fhir_types/FHIR_ClaimResponse.py | anthem-ai/fhir-types | 2 | 12784346 | from typing import Any, List, Literal, TypedDict
from .FHIR_Attachment import FHIR_Attachment
from .FHIR_ClaimResponse_AddItem import FHIR_ClaimResponse_AddItem
from .FHIR_ClaimResponse_Adjudication import FHIR_ClaimResponse_Adjudication
from .FHIR_ClaimResponse_Error import FHIR_ClaimResponse_Error
from .FHIR_ClaimRe... | 1.710938 | 2 |
python_scripts/nand/legacyftl.py | slango20/iphone-dataprotection | 19 | 12784347 | <filename>python_scripts/nand/legacyftl.py
from carver import NANDCarver
from construct.core import Struct
from construct.macros import ULInt32, ULInt16, Array, ULInt8, Padding
from pprint import pprint
from structs import SpareData
from util import hexdump
from vfl import VFL
import plistlib
"""
openiboot/p... | 1.945313 | 2 |
labugr/integrate/__init__.py | lserraga/labUGR | 1 | 12784348 | from .quadpack import quad, dblquad, tplquad, nquad
excluded = ['excluded', 'quadpack']
__all__ = [s for s in dir() if not ((s in excluded)or s.startswith('_'))]
from labugr.testing.utils import PytestTester
test = PytestTester(__name__)
del PytestTester | 2.03125 | 2 |
src/rollit/ast/util.py | russells-crockpot/roll-with-it | 2 | 12784349 | <filename>src/rollit/ast/util.py
"""
"""
import re
from contextlib import suppress
from .elements import StringLiteral, BinaryOp, Negation, SpecialReference, OneSidedOperator, \
TwoSidedOperator, OverloadOnlyOperator
from ..util import is_valid_iterable, ensure_tuple
__all__ = [
'was_evaluated',
'flat... | 2.640625 | 3 |
RadarDataProcessAlg/Mp4ToGif.py | CaptainEven/PyScripts | 5 | 12784350 | <gh_stars>1-10
# encoding=utf-8
import argparse
import os
import cv2
import imageio
# name of the video file to convert
input_path = os.path.abspath('./output.mp4')
# targetFormat must be .gif
def ToGif(input_path,
target_format,
num_frames=60, # max frame number
out_size=(1600, 797... | 2.90625 | 3 |