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 |
|---|---|---|---|---|---|---|
test/some-old-test-cases.py | scramjetorg/framework-python | 16 | 44900 | <filename>test/some-old-test-cases.py
#!/bin/env python3
import asyncio
import sys
from pprint import pprint
import random
import pyfca
import scramjet.utils as utils
from scramjet.ansi_color_codes import *
log = utils.LogWithTimer.log
fmt = utils.print_formatted
random.seed('Pyfca')
# Use to change delays mocking ... | 2.28125 | 2 |
pdistcc/tests/test_server.py | asheplyakov/pdistcc | 0 | 44901 | <filename>pdistcc/tests/test_server.py
import subprocess
from unittest.mock import MagicMock
from .fakeops import (
FakeFileOpsFactory,
FakeSocket,
FakeTempFileFactory,
)
from ..server import (
Distccd
)
def test_distccd_normal():
source = b'int f(int x,int y){return x+y;}'
job = b''.join(... | 2.25 | 2 |
examples/rl/train/play.py | ONLYA/RoboGrammar | 156 | 44902 | <reponame>ONLYA/RoboGrammar
import sys
import os
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
sys.path.append(base_dir)
sys.path.append(os.path.join(base_dir, 'rl'))
import numpy as np
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim... | 1.960938 | 2 |
corere/main/migrations/0012_auto_20210730_1522.py | Xarthisius/dataverse-corere | 9 | 44903 | # Generated by Django 3.2.5 on 2021-07-30 15:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0011_auto_20210729_2147'),
]
operations = [
migrations.AddField(
model_name='curation',
name='needs_verifica... | 1.5625 | 2 |
DTM/main.py | boomsbloom/dtm-fmri | 4 | 44904 | <reponame>boomsbloom/dtm-fmri
'''
==============================================
====== DYNAMIC TOPIC MODELING FOR FMRI =======
==============================================
Assumes subject timeseries have been
processed through:
1) binning
2) text creation (corr matrix as docs)
===========... | 2.234375 | 2 |
learning_python/lesson7/exercise4.py | fallenfuzz/pynet | 528 | 44905 | <filename>learning_python/lesson7/exercise4.py
#!/usr/bin/env python
"""
Take the YAML file and corresponding data structure that you defined in exercise3b:
{'interfaces': {
'Ethernet1': {'mode': 'access', 'vlan': 10},
'Ethernet2': {'mode': 'access', 'vlan': 20},
'Ethernet3': {'mode': 'trunk',
... | 3.28125 | 3 |
finance_ml/model_selection/__init__.py | BTETON/finance_ml | 446 | 44906 | from .kfold import PurgedKFold, CPKFold, generate_signals
from .score import cv_score
from .pipeline import Pipeline
from .hyper import clf_hyper_fit
from .distribution import LogUniformGen, log_uniform
from .utils import evaluate | 0.957031 | 1 |
utils/helper.py | kirk86/calibration | 24 | 44907 | import tensorflow as tf
def touch(fname: str, times=None, create_dirs: bool = False):
import os
if create_dirs:
base_dir = os.path.dirname(fname)
if not os.path.exists(base_dir):
os.makedirs(base_dir)
with open(fname, 'a'):
os.utime(fname, times)
def touch_dir(base_di... | 2.578125 | 3 |
setup.py | KieberLab/indCAPS | 1 | 44908 | <gh_stars>1-10
#!/usr/bin/env python2
from setuptools import setup
setup(name='indCAPS',
version='0.1',
description='OpenShift App',
author='<NAME>',
author_email='<EMAIL>',
# install_requires=['Flask==0.10.1'],
) | 1.164063 | 1 |
sparse_decomposition/decomposition/decomposition.py | bdpedigo/sparse_matrix_analysis | 2 | 44909 | # Some of the implementation inspired by:
# REF: https://github.com/fchen365/epca
import time
from abc import abstractmethod
import numpy as np
from factor_analyzer import Rotator
from sklearn.base import BaseEstimator
from sklearn.preprocessing import StandardScaler
from sklearn.utils import check_array
from graspo... | 2.28125 | 2 |
guess_a_number.py | peterhogan/python | 0 | 44910 | import maths
import random
print "Let's guess a number."
bottom = input("Pick a range; bottom number: ")
top = input("Pick a top number? ")
guess_range = range(bottom, top+1)
ans = random.randint(bottom, top)
games = 0
average_guesses = []
again = 'y'
while again == 'y':
ans = random.randint(bottom, top)
games += 1... | 3.953125 | 4 |
pycqed/instrument_drivers/meta_instrument/inspire_dependency_graph.py | nuttamas/PycQED_py3 | 60 | 44911 | <gh_stars>10-100
###########################################################################
# AutoDepGraph for Quantum Inspire
###########################################################################
"""
Third version of Graph Based Tuneup designed specifically for the Quantum
Inspire project. Includes only routine... | 2.453125 | 2 |
scripts/edinburgh.py | LibrariesHacked/mobilelibraries-data | 0 | 44912 | <filename>scripts/edinburgh.py<gh_stars>0
"""Web scrapes Edinburgh mobile library pages """
from urllib.parse import quote
from datetime import datetime
import json
import os
import csv
import requests
import re
from bs4 import BeautifulSoup
from _common import create_mobile_library_file
WEBSITE = 'https://www.edinbu... | 3.265625 | 3 |
alipay/aop/api/domain/MiniAppDeployResponse.py | antopen/alipay-sdk-python-all | 213 | 44913 | <filename>alipay/aop/api/domain/MiniAppDeployResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MiniAppDeployResponse(object):
def __init__(self):
self._android_client_max = None
self._android_client_min = None
... | 1.765625 | 2 |
tests/test_routex/mospp_test.py | alan-turing-institute/urbanroute | 2 | 44914 | <gh_stars>1-10
import pytest
import json
from graph_tool.all import load_graph, Graph
from routex import mospp
with open("./tests/test_routex/large_solution.json", "r") as read_file:
data = json.load(read_file)
def test_mospp_large():
G = load_graph("./tests/test_graphs/Trafalgar.gt")
G.list_properties()... | 2.28125 | 2 |
tests/conftest.py | ewjoachim/python-coverage-comment-action | 2 | 44915 | import datetime
import functools
import io
import os
import zipfile
import httpx
import pytest
from coverage_comment import coverage as coverage_module
from coverage_comment import github_client, settings
@pytest.fixture
def base_config():
def _(**kwargs):
defaults = {
# GitHub stuff
... | 2.03125 | 2 |
xvision/ops/functional.py | jimmysue/xvision | 3 | 44916 | from .emd_loss import emd_loss
| 1.039063 | 1 |
test_lambda.py | unbiased-coder/python-aws-lambda-guide | 0 | 44917 | <reponame>unbiased-coder/python-aws-lambda-guide
import os
import json
def lambda_handler(event, context):
first_name = event['first_name']
last_name = event['last_name']
country = os.environ['COUNTRY']
return {
'statusCode': 200,
'body': json.dumps('Hello I am %s %s ... | 2.453125 | 2 |
src/com/runner/InputService.py | avijit90/tic-tac-toe | 0 | 44918 | from colorama import Fore, Style
from Player import Player
class InputService:
def __init__(self):
self.game_board = ['#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
self.available_tiles = list(range(1, 10))
@staticmethod
def get_player_names():
player_1_name_input = input("Pl... | 3.3125 | 3 |
bin/MLEout2tab_NA.py | gaofeng21cn/IDP-fusion | 5 | 44919 | #!/usr/bin/python
import sys
import os
if len(sys.argv) >= 2 :
exp_filename = sys.argv[1]
else:
print("usage: ")
print("or ")
sys.exit(1)
################################################################################
exp_dt = {}
exp_file = open(exp_filename,'r')
i=0
for line in exp_file:
ls = lin... | 2.734375 | 3 |
fulltext/routes.py | arXiv/arxiv-fulltext | 18 | 44920 | """Provides the blueprint for the fulltext API."""
from typing import Optional, Callable, Any, List
from flask import request, Blueprint, Response, make_response
from werkzeug.exceptions import NotAcceptable, BadRequest, NotFound
from flask.json import jsonify
from arxiv import status
from arxiv.users.domain import Se... | 2.65625 | 3 |
bandit/algorithms/Softmax.py | MarcoAlmada/bandit-panda | 6 | 44921 | from math import exp, log
from random import random
from pandas import DataFrame
from BaseBanditAlgorithm import BaseBanditAlgorithm
class Softmax(BaseBanditAlgorithm):
"""
Implementation of the Softmax algorithm for Multi-Armed Bandit
"""
def __init__(self, temperature=0.1, annealing=False, cou... | 3.203125 | 3 |
tensorflow-example/tensor_placeholder.py | dinkar1708/machine-learning-examples | 0 | 44922 | <reponame>dinkar1708/machine-learning-examples
import numpy as np
import tensorflow as tf
# placeholder - Inserts a placeholder for a tensor that will be always fed.
# Example1-
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
adder_node = a + b
sess = tf.Session()
print(sess.run(adder_node, {a: [1, 2],... | 3.765625 | 4 |
ABC066/ABC066a.py | VolgaKurvar/AtCoder | 0 | 44923 | # ABC066a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
bell = tuple(map(int, input().split()))
print(sum(bell)-max(bell))
| 2.3125 | 2 |
validator/checks/md.py | KeepSafe/content-validator | 1 | 44924 | <reponame>KeepSafe/content-validator<gh_stars>1-10
import re
from typing import Type
from sdiff import diff, renderer, MdParser
from markdown import markdown
from ..errors import MdDiff, ContentData
LINK_RE = r'\]\(([^\)]+)\)'
def save_file(content, filename):
with open(filename, 'w') as fp:
fp.write(c... | 2.5625 | 3 |
build/lib/apicount/__main__.py | vadivelmurugank/apicount | 0 | 44925 | <reponame>vadivelmurugank/apicount
#!/usr/bin/env python
"""
apiparse
Parse API and API groups from sources. List the API occurences from all
directories and sub directories
"""
# Main Routine
if __name__ == "__main__":
import apicount
f = apicount.apicount.funcnode()
f.showapis()
| 1.992188 | 2 |
sanskrit_parser/generator/test/test_list.py | avinashvarna/sanskrit_parser | 54 | 44926 | <reponame>avinashvarna/sanskrit_parser
# flake8: noqa
from sanskrit_parser.generator.pratyaya import *
from sanskrit_parser.generator.dhatu import *
from sanskrit_parser.generator.pratipadika import *
from sanskrit_parser.base.sanskrit_base import SLP1, DEVANAGARI
from sanskrit_parser.generator.sutras_yaml import sutra... | 2.078125 | 2 |
src/plottoolbox/skill_metrics/pc_bias.py | timcera/plottoolbox | 5 | 44927 | <filename>src/plottoolbox/skill_metrics/pc_bias.py
# -*- coding: utf-8 -*-
import numpy as np
from . import utils
def pc_bias(simulated, observed):
"""
Calculate the percent bias between simulated and observed.
B = 100.0*sum(s-o)/sum(o)
where s is the simulated values, and o is the observed values.... | 3.046875 | 3 |
cli/commands/cli_testcase.py | MatthewLiHW/functest | 0 | 44928 | <gh_stars>0
#!/usr/bin/env python
#
# <EMAIL>
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
import click
import os
impor... | 2 | 2 |
update-URIs.py | ruthtillman/subjectreconscripts | 6 | 44929 | <filename>update-URIs.py
#!/usr/bin/env python
# Why does this script exist? This script exists so that we can work separately with ASpace data, create a spreadsheet (CSV) of the IDs of subjects which should be updated to include any authority_id but really probably a URI.
# This script connects to ASpace It then opens... | 3.375 | 3 |
src/conversations/migrations/0001_initial.py | earth-emoji/august | 0 | 44930 | # Generated by Django 2.2.12 on 2020-05-21 03:10
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('accounts', '0002_auto_20200501_0524'),
('classifications', '0001_initial'),
]
... | 1.742188 | 2 |
slurm_jupyter_kernel/__main__.py | mawigh/slurm_jupyter_kernel | 1 | 44931 | <reponame>mawigh/slurm_jupyter_kernel<gh_stars>1-10
from slurm_jupyter_kernel.start_kernel import slurm_jupyter_kernel;
slurm_jupyter_kernel();
| 1.257813 | 1 |
plenum/test/logging/test_logging_txn_state.py | steptan/indy-plenum | 0 | 44932 | <gh_stars>0
import functools
from stp_core.loop.eventually import eventually
from plenum.common.constants import STEWARD, DOMAIN_LEDGER_ID
from plenum.test.pool_transactions.conftest import looper, stewardAndWallet1, \
steward1, stewardWallet, client1, clientAndWallet1, client1Connected
from plenum.test.pool_tra... | 1.710938 | 2 |
output/dfg_mix/mix_rotate_chains.py | tmcclintock/fit_mass_functions | 0 | 44933 | <filename>output/dfg_mix/mix_rotate_chains.py
"""
Instead of rotating the chains in the entire parameter space,
just rotate all the intercepts together and then all the slopes together.
"""
import numpy as np
import corner, sys
import matplotlib.pyplot as plt
old_labels = [r"$d0$",r"$d1$",r"$f0$",r"$f1$",r"$g0$",r"$g1... | 2.390625 | 2 |
spreadsheetconverter/scripts/__init__.py | gumi/spreadsheetconverter | 4 | 44934 | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
| 0.976563 | 1 |
py_script/utilities.py | Tagliacollo/PFinderUCE-SWSC-EN | 0 | 44935 | <filename>py_script/utilities.py
import os
from pathlib2 import Path
from Bio import AlignIO, SeqIO, SeqUtils
from itertools import combinations
import numpy as np
from math import factorial
from Bio.Nexus import Nexus
def check_taxa(matrices):
'''Checks that nexus instances in a list [(name, instance)...] have
... | 2.65625 | 3 |
lambda/test_main.py | mkhanal1/lambda-runcommand-configuration-management | 76 | 44936 | <reponame>mkhanal1/lambda-runcommand-configuration-management
"""
Unit Tests for trigger_run_command Lambda function
"""
import pytest
import boto3
from botocore.exceptions import ClientError
from mock import MagicMock, patch
from main import find_artifact
from main import ssm_commands
from main import codepipeline_suc... | 2.125 | 2 |
rplugin/python3/denite/source/junkfile.py | hironei/junkfile.vim | 23 | 44937 | # ============================================================================
# FILE: junkfile.py
# AUTHOR: <NAME> <Shougo.Matsu at gmail.<EMAIL>>
# License: MIT license
# ============================================================================
from .base import Base
from time import strftime
from denite.util imp... | 2.390625 | 2 |
Room/api/migrations/0002_auto_20210129_1554.py | zarif007/Club-Room | 1 | 44938 | # Generated by Django 3.1.5 on 2021-01-29 09:54
import api.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | 1.921875 | 2 |
scalyr_agent/util.py | GitSullied/scalyr-agent-2 | 0 | 44939 | # Copyright 2014 Scalyr Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 2.546875 | 3 |
apps/setup.py | nlantoing/Astrarium | 0 | 44940 | <filename>apps/setup.py
from setuptools import find_packages, setup
setup(
name='Astrarium',
version='0.0.1',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=[
'Flask',
'SQLAlchemy',
'flask_sqlalchemy',
'flask_migrate',
... | 1.242188 | 1 |
capsules/__init__.py | yuranusduke/DynamicRoutingCapsule | 0 | 44941 | <gh_stars>0
from .CapsNet import CapsNet | 1.0625 | 1 |
app/views/user.py | Unixeno/PicMe | 1 | 44942 | <reponame>Unixeno/PicMe
from flask import Blueprint, request, render_template, url_for, session
from flask import redirect, jsonify, current_app, g
from ..util.storage import storage_factory
from ..models import Images, User
from ..util.helper import bytes_to_human
bp = Blueprint('user', __name__, url_prefix='/user')
... | 2.421875 | 2 |
src/twitter_db_updater/skeleton.py | lraulin/twitter-db-updater | 0 | 44943 | #!/usr/bin/env python
# pylint: disable=wrong-import-position
# -*- coding: utf-8 -*-
"""
To run this script uncomment the following lines in the
[options.entry_points] section in setup.cfg:
console_scripts =
fibonacci = dbupdater.skeleton:run
Then run `python setup.py install` which will install the com... | 1.804688 | 2 |
rindowApp/vendor/loader.py | rindow/skeleton-mini-webapp2 | 0 | 44944 | import sys,os
for path in [
'rindow/framework/lib',
]:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), path)))
| 1.773438 | 2 |
catpointer/game.py | stsewd/cat-pointer-game | 0 | 44945 | <filename>catpointer/game.py<gh_stars>0
import copy
import random
from os import path
import pyxel
from .models import Cat, Point
base_path = path.dirname(__file__)
class App:
max_jump = 12 # Needs to be even
max_wait = 20
ceiling = 50
floor = 85
def __init__(self):
pyxel.init(300, 1... | 2.5 | 2 |
registrobrepp/contact/orgtype.py | ivcmartello/registrobrepp | 0 | 44946 | from enum import Enum
class OrgType(Enum):
NORMAL = 'normal'
NIR = 'nir'
PROVIDER = 'provider'
NIR_PROVIDER = 'nir-provider'
| 2.28125 | 2 |
scripts/download_grid_images.py | edwardoughton/taddle | 9 | 44947 | """
Generate download locations within a country and download them.
Written by <NAME>.
5/2020
"""
import os
import configparser
import math
import pandas as pd
import numpy as np
import random
import geopandas as gpd
from shapely.geometry import Point
import requests
import matplotlib.pyplot as plt
from PIL import Ima... | 3.0625 | 3 |
lib/python3.8/site-packages/django_elasticsearch_dsl_drf/filter_backends/filtering/geo_spatial.py | ervinpepic/Kodecta_media_catalog | 0 | 44948 | <gh_stars>0
"""
Geo spatial filtering backend.
Elasticsearch supports two types of geo data:
- geo_point fields which support lat/lon pairs
- geo_shape fields, which support points, lines, circles, polygons,
multi-polygons etc.
The queries in this group are:
- geo_shape query: Find document with geo-shapes which ... | 2.796875 | 3 |
autokey/data/MacOS/newtab.py | ankur-gupta/keyboard | 1 | 44949 | # Enter script code
import re
winClass = window.get_active_class()
isTerminalWin1 = re.search("konsole\\.konsole", winClass)
isTerminalWin2 = re.search("x+terminal.*", winClass)
if isTerminalWin1 or isTerminalWin2:
keyboard.send_keys("<ctrl>+<shift>+t")
else:
keyboard.send_keys("<ctrl>+t")
| 2.5625 | 3 |
IRIS/neural_network_classifier.py | Jackson-Y/Machine-Learning | 4 | 44950 | # -*- coding: utf-8 -*-
""" The Neural Network classifier for IRIS. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import urllib
import numpy as np
import tensorflow as tf
# Data sets
IRIS_TRAINING = "IRIS_data/iris_training.csv"
IRIS_TRAINI... | 3.296875 | 3 |
challenges/consecutive-numbers/solutions/python/function/solution.py | Divlo/programming-challenges | 6 | 44951 | from typing import List
import sys
input_values: List[str] = []
for value in sys.stdin:
input_values.append(value.rstrip('\n'))
def consecutive_numbers(numbers: List[int], couple_length: int) -> List[List[int]]:
result: List[List[int]] = []
numbers_length = len(numbers)
for index in range(numbers_len... | 3.765625 | 4 |
tests/test_utils.py | photosynthesis-team/photosynthesis.metrics | 36 | 44952 | <reponame>photosynthesis-team/photosynthesis.metrics
import torch
import pytest
import numpy as np
from piq.utils import _validate_input, _reduce, _parse_version
@pytest.fixture(scope='module')
def tensor_1d() -> torch.Tensor:
return torch.rand(1)
@pytest.fixture(scope='module')
def tensor_2d() -> torch.Tenso... | 2.09375 | 2 |
wildlifecompliance/migrations/0219_auto_20190611_1047.py | preranaandure/wildlifecompliance | 1 | 44953 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-06-11 02:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0218_auto_20190611_102... | 1.578125 | 2 |
TorPool/tor_method.py | SUN-PEI-YUAN/TorPool | 1 | 44954 | <filename>TorPool/tor_method.py
# coding: utf-8
import subprocess
import shutil
import sys
import os
class TorMethod(object):
'''tor 代理伺服器製作
:::參數說明:::
torrc_dir: torrc要儲存的位置(必要)
tordata_dir: torrc內DataDirectory的資訊(必要)
__process: tor的process控制器, 可以使用TorMethod.get_process取得
__torname: torrc檔案和資料... | 2.890625 | 3 |
hdcs_manager/source/hsm/hsm/db/sqlalchemy/api.py | isabella232/HDCS | 0 | 44955 | <filename>hdcs_manager/source/hsm/hsm/db/sqlalchemy/api.py<gh_stars>0
import warnings
from sqlalchemy.orm import joinedload
from sqlalchemy.sql.expression import literal_column
from hsm.db.sqlalchemy import models
from hsm.db.sqlalchemy.session import get_session
from hsm import exception
from hsm import flags
from ... | 2.046875 | 2 |
smartlinks/tests/management/__init__.py | ixc/glamkit-smartlinks | 3 | 44956 | <filename>smartlinks/tests/management/__init__.py
from commands import * | 1.140625 | 1 |
stage.py | jon2718/ipycool_2.0 | 0 | 44957 | from drift import *
from hard_edge_transport import *
from hard_edge_sol import *
from accel import *
import sys
class Stage(HardEdgeTransport):
"""
A final cooling stage comprises:
HardEdgeTransport with transport field comprising:
(1) Drift (d1)
(2) HardEdgeSol
(3) Drift (d2)
(4) Acc... | 2.265625 | 2 |
Scripts/396.py | zzz0906/LeetCode | 17 | 44958 | class Solution:
def maxRotateFunction(self, nums: List[int]) -> int:
sums = sum(nums)
index = 0
res = 0
for ele in nums:
res += index*ele
index += 1
ans = res
for i in range(1,len(nums)):
res = res + sums - (len(nums))*nums[len(nums... | 2.875 | 3 |
tests/test_req_parser.py | sbidoul/pip-deepfreeze | 19 | 44959 | <filename>tests/test_req_parser.py
import pytest
from pip_deepfreeze.req_parser import get_req_name, get_req_names
@pytest.mark.parametrize(
"requirement,expected",
[
("pkga", "pkga"),
("PkgA", "pkga"),
("pkga @ https://e.c/pkga.tgz", "pkga"),
("./pkga.tgz", None),
("g... | 2.453125 | 2 |
ai.py | nip403/Boids | 0 | 44960 | <reponame>nip403/Boids
import numpy as np
import random
# general
MAXSPEED = 20
MINSPEED = 5
EYESIGHT = 75
# separation
SEPARATION_FACTOR = 0.05
MIN_DIST = 20
# alignment
ALIGNMENT_FACTOR = 0.05
# cohesion
COHESION_FACTOR = 0.005
# bounds
MARGIN = 50
TURNFACTOR = 1
def dist(a: float, b: floa... | 2.828125 | 3 |
utilities/vector.py | fietensen/raytracer | 0 | 44961 | import math
class Vec3:
def __init__(self, x=.0, y=.0, z=.0):
self.x = float(x)
self.y = float(y)
self.z = float(z)
def __str__(self):
return "Vector(%.4f, %.4f, %.4f)" % (self.x, self.y, self.z)
def __add__(self, vec):
return Vec3(self.x+vec.x,... | 3.625 | 4 |
core/management/commands/gendoc.py | klebed/esdc-ce | 97 | 44962 | import os
import re
import shutil
from ._base import DanubeCloudCommand, CommandOption, CommandError, lcd
class Command(DanubeCloudCommand):
help = 'Generate documentation files displayed in GUI.'
DOC_REPO = 'https://github.com/erigones/esdc-docs.git'
DOC_TMP_DIR = '/var/tmp/esdc-docs'
options = (
... | 2.203125 | 2 |
caption_vae/scripts/plot_nonzero_weights_kde.py | jiahuei/test-caption-actions | 3 | 44963 | # -*- coding: utf-8 -*-
"""
Created on 09 Nov 2020 22:25:38
@author: jiahuei
cd caption_vae
python -m scripts.plot_nonzero_weights_kde --log_dir x --id y
/home/jiahuei/Documents/1_TF_files/prune/mscoco_v3
word_w256_LSTM_r512_h1_ind_xu_REG_1.0e+02_init_5.0_L1_wg_60.0_ann_sps_0.975_dec_prune_cnnFT/run_01_sparse
/home/... | 1.523438 | 2 |
analytics_management/models.py | mattiolato98/reservation-ninja | 1 | 44964 | from django.contrib.auth import get_user_model
from django.db import models
class Log(models.Model):
"""
Model that describe a Log object, it contains information about daily
executions.
"""
execution_time = models.FloatField()
users = models.IntegerField()
lessons = models.IntegerField()
... | 2.6875 | 3 |
src/python/grapl_e2e_tests/tests.py | hxnyk/grapl | 0 | 44965 | import logging
from typing import Any, Dict, List
from unittest import TestCase
import pytest
from grapl_analyzerlib.nodes.lens import LensQuery, LensView
from grapl_tests_common.clients.engagement_edge_client import EngagementEdgeClient
from grapl_tests_common.clients.graphql_endpoint_client import GraphqlEndpointCli... | 1.953125 | 2 |
test/util_test.py | sbienkow/eg | 1,389 | 44966 | import json
import os
from eg import config
from eg import substitute
from eg import util
from mock import Mock
from mock import patch
PATH_UNSQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_unsqueezed.md'
)
PATH_SQUEEZED_FILE = os.path.join(
'test',
'assets',
'pwd_squeezed.md'
)
def _cr... | 2.28125 | 2 |
manage/items/CommunicationInfo.py | isKEKE/AC03 | 0 | 44967 | <gh_stars>0
# _*_ coding: utf-8 _*_
import multiprocessing
class CommunicationInfo(object):
def __init__(self):
# 爬虫子进程和解析子进程通讯`链接数据`队列对象
self.linkQueue = multiprocessing.Queue()
# 爬虫子进程和解析子进程通讯`响应数据`队列对象
self.dataQueue = multiprocessing.Queue()
# 管理主进程和爬虫子进程通讯管道对象
s... | 2.578125 | 3 |
card_identifier/cardutils.py | adelq/card_identifier | 14 | 44968 | def format_card(card_num):
"""
Formats card numbers to remove any spaces, unnecessary characters, etc
Input: Card number, integer or string
Output: Correctly formatted card number, string
"""
import re
card_num = str(card_num)
# Regex to remove any nondigit characters
return re.sub(... | 4.28125 | 4 |
src/sage/symbolic/constant.py | UCD4IDS/sage | 1,742 | 44969 | <reponame>UCD4IDS/sage<filename>src/sage/symbolic/constant.py<gh_stars>1000+
from sage.misc.lazy_import import lazy_import
lazy_import('sage.symbolic.expression', 'PynacConstant', deprecation=32386)
| 0.941406 | 1 |
examples/s2_extensions.py | ChubV/oop-di | 0 | 44970 | from abc import ABC, abstractmethod
from oop_di import ContainerDefinition, Extension
# #############Mailer bounded context###############
class MailerInterface(ABC):
@abstractmethod
def send_mail(self):
...
class Mailer(MailerInterface):
def __init__(self, from_email):
self.from_email... | 3 | 3 |
Week 1/grok/samples/1b/21.mean of sets of fits file.py | anandprabhakar0507/Assignments-Data-Driven-Astronomy-from-University-of-sydney-on-coursera- | 4 | 44971 | <gh_stars>1-10
from astropy.io import fits
import numpy as np
def mean_fits(files):
n = len(files)
if n > 0:
hdulist = fits.open(files[0])
data = hdulist[0].data
hdulist.close()
for i in range(1, n):
hdulist = fits.open(files[i])
data += hdulist[0].data
hdu... | 2.71875 | 3 |
module10-modules.and.packages/deepcloudlabs/utils.py | deepcloudlabs/dcl160-2021-jun-28 | 0 | 44972 | <reponame>deepcloudlabs/dcl160-2021-jun-28
def is_even(n):
return n % 2 == 0
def is_odd(n):
return not is_even(n)
lost_numbers = (4, 8, 15, 16, 23, 42)
| 3.5625 | 4 |
src/rbx2/rbx2_vision/nodes/nearest_cloud_with_pose.py | fujy/ROS-Project | 9 | 44973 | #!/usr/bin/env python
"""
nearest_cloud.py - Version 1.0 2013-07-28
Compute the COG of the nearest object in x-y-z space and publish as a PoseStamped message.
Relies on PCL ROS nodelets in the launch file to pre-filter the
cloud on the x, y and z dimensions.
Based on the follower app... | 2.734375 | 3 |
datasets/hcp1200.py | NBCLab/niconn | 0 | 44974 | <reponame>NBCLab/niconn
import os
import os.path as op
def hcp1200_download(hcp_data_dir=None):
from datalad.api import install
if hcp_data_dir is None:
raise Exception('A valid directory is required for downloading HCP data!')
if not op.isdir(hcp_data_dir):
os.mkdir(hcp_data_dir)
os... | 2.296875 | 2 |
LeetCode/Algorithms/Math/2. Add Two Numbers.py | WatsonWangZh/CodingPractice | 11 | 44975 | <filename>LeetCode/Algorithms/Math/2. Add Two Numbers.py
# You are given two non-empty linked lists representing two non-negative integers.
# The digits are stored in reverse order and each of their nodes contain a single digit.
# Add the two numbers and return it as a linked list.
# You may assume the two numbers do... | 3.9375 | 4 |
cmsplugin_svg/migrations/0001_initial.py | parthenon/cmsplugin-svg | 0 | 44976 | <reponame>parthenon/cmsplugin-svg<filename>cmsplugin_svg/migrations/0001_initial.py
# Generated by Django 3.1.13 on 2021-08-03 22:33
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
initial = True
dependencies = [
... | 1.695313 | 2 |
5-gui.py | theseana/pesteh | 1 | 44977 | <reponame>theseana/pesteh
from tkinter import *
root = Tk()
root.config(bg='yellow')
l1 = Label(root, text='Hello World!', bg='magenta')
l1.pack(side=LEFT)
b1 = Button(root, text='Click Me Please!', bg='cyan')
b1.pack(side=LEFT)
l2 = Label(root, text='Ta-Da!', bg='green')
l2.pack(side=LEFT)
root.main... | 3.40625 | 3 |
src/utils/overpass_wrapper/__init__.py | Informatik-HS-KL/BEGGEL-SP-Map-Matcher-WS19 | 1 | 44978 | from .client_side import OverpassWrapperClientSide
from .server_side import OverpassWrapperServerSide
from .overpass_wrapper import OverpassWrapper
| 1.132813 | 1 |
haas_lib_bundles/python/docs/examples/smart_panel/esp32/code/environment.py | wstong999/AliOS-Things | 0 | 44979 | import lvgl as lv
import utime
# RESOURCES_ROOT = "S:/Users/liujuncheng/workspace/iot/esp32/solution/HaaSPython/solutions/smart_panel/"
RESOURCES_ROOT = "S:/data/pyamp/"
def drawOver(e):
global g_clickTime
if (g_clickTime != 0):
currentTime = utime.ticks_ms()
print("create Environment page us... | 2.25 | 2 |
anchor/__init__.py | olgabot/modish | 0 | 44980 | # -*- coding: utf-8 -*-
from .model import ModalityModel
from .estimator import BayesianModalities
from .predict import ModalityPredictor
from .simulate import add_noise
from .visualize import MODALITY_TO_COLOR, MODALITY_ORDER, MODALITY_PALETTE,\
MODALITY_TO_CMAP, ModalitiesViz, violinplot, barplot
__author__ = '<... | 2.140625 | 2 |
venv/lib/python3.6/site-packages/ansible_collections/google/cloud/plugins/modules/gcp_redis_instance.py | usegalaxy-no/usegalaxy | 7 | 44981 | <reponame>usegalaxy-no/usegalaxy
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** ... | 1.539063 | 2 |
persistent_list_kata/day_5.py | Alex-Diez/python-tdd-katas | 0 | 44982 | <reponame>Alex-Diez/python-tdd-katas
import unittest
class PersistentList(object):
def __repr__(self):
return ''
def prepend(self, item):
return _Node(item, self)
def head(self):
pass
def tail(self):
return self
def __eq__(self, other):
return isinstance... | 3.625 | 4 |
tests/test_blogs.py | MichelAtieno/Personal-Blog | 0 | 44983 | <reponame>MichelAtieno/Personal-Blog
import unittest
from app.models import BlogPost
from app import db
class CommentTest(unittest.TestCase):
def setUp(self):
self.new_blog = BlogPost(title='New Blog',blog_post='This is the content')
def tearDown(self):
db.session.delete(self.new_blog)
... | 3 | 3 |
numero_parole.py | mecroby/test_pi_learning | 0 | 44984 | <reponame>mecroby/test_pi_learning
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 15 20:33:49 2017
@author: roby
"""
#dato un numero n, restituisce le prime n parole più usate
import sys
from collections import Counter
try:
num_words=int(sys.argv[1])
except:
print "usage: nomefile.py numero_paro... | 2.9375 | 3 |
scripts/getpopup.py | spyysalo/jensenlab-extract | 0 | 44985 | <reponame>spyysalo/jensenlab-extract
#!/usr/bin/env python3
from __future__ import print_function
import os
import sys
import requests
from logging import error
DEFAULT_URL = 'http://tagger.jensenlab.org/ExtractPopup'
ENTITY_TYPES = [
'0', # Genes/proteins
'-1', # PubChem Compound identifiers
... | 1.976563 | 2 |
src/legacy/graph-study/MatrixP.py | konstantin-ogulchansky/pfe | 0 | 44986 | <filename>src/legacy/graph-study/MatrixP.py
import matplotlib.pylab as plt
import numpy as np
import json
import seaborn as sns
import pandas as pd
import os
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.ticker as ticker
from matplotlib.patches import Rectangle
import seaborn as sns
'''... | 2.78125 | 3 |
python/leetcode/easy/ex0205.py | vilisimo/ads | 0 | 44987 | # Given two strings s and t, determine if they are isomorphic.
# Two strings s and t are isomorphic if the characters in s can be replaced to
# get t.
# All occurrences of a character must be replaced with another character while
# preserving the order of characters. No two characters may map to the same
# character,... | 3.796875 | 4 |
backend/src/tools/exceptions/predict.py | robersh0/flask_gunicorn | 0 | 44988 | <gh_stars>0
from src.tools.exceptions.base import GunicornFlaskBaseException
class PredictException(GunicornFlaskBaseException):
def __init__(self, tag=None):
self.tag = tag
super().__init__(tag=tag)
| 1.984375 | 2 |
a2t/legacy/topic_classification/__init__.py | zhuowenzheng/Ask2Transformers | 63 | 44989 | <gh_stars>10-100
from .mlm import MLMTopicClassifier
from .mnli import NLITopicClassifierWithMappingHead, NLITopicClassifier
from .nsp import NSPTopicClassifier
from .babeldomains import BabelDomainsClassifier
from .wndomains import WNDomainsClassifier
__all__ = [
"NLITopicClassifierWithMappingHead",
"NLITopic... | 1.164063 | 1 |
nodes/swagger_server/models/job_simulator_opts.py | rdbox-intec/r2s2_for_rostest | 0 | 44990 | <filename>nodes/swagger_server/models/job_simulator_opts.py<gh_stars>0
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class JobSi... | 1.820313 | 2 |
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test23.py | YangHao666666/hawq | 450 | 44991 | 'doc'
class X:
'doc'
def __init__(self):
self.fff = 0
def x(self):
pass
def y(self):
'should generate a warning'
if self.x:
pass
if self.x and globals():
pass
if globals() and self.x:
pass
def z(self):
's... | 3.0625 | 3 |
code/CCU004-2-run-models-[4].py | BHFDSC/CCU004_02 | 0 | 44992 | # Databricks notebook source
# MAGIC %md
# MAGIC **Description** This notebook runs the model analysis pipeline for CCU004-2
# MAGIC
# MAGIC **Project(s)** CCU004-2 - A nationwide deep learning pipeline to predict stroke and COVID-19 death in atrial fibrillation
# MAGIC
# MAGIC **Author(s)** <NAME>
# MAGIC
# MAGI... | 2.375 | 2 |
deepy/layers/prelu.py | uaca/deepy | 260 | 44993 | <reponame>uaca/deepy<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import NeuralLayer
from conv import Convolution
class PRelu(NeuralLayer):
"""
Probabilistic ReLU.
- http://arxiv.org/pdf/1502.01852v1.pdf
"""
def __init__(self, input_tensor=2):
super(PRelu, self).... | 2.96875 | 3 |
great_expectations/datasource/dbt_source.py | scarrucciu/great_expectations | 0 | 44994 | <reponame>scarrucciu/great_expectations
import os
import time
import logging
import errno
from ruamel.yaml import YAML
from .sqlalchemy_source import SqlAlchemyDatasource
from great_expectations.datasource.generator.batch_generator import BatchGenerator
yaml = YAML(typ='safe')
logger = logging.getLogger(__name__)
t... | 2.28125 | 2 |
hanibal/crm_gestion_faces/report/cheques_gir_no_cob_reporte.py | Christian-Castro/castro_odoo8 | 0 | 44995 | # -*- encoding: utf-8 -*-
from openerp.report import report_sxw
import openerp.pooler
class conciliacion_bancaria_c(report_sxw.rml_parse):
ESTADOS = {
'draft':'Borrador',
'proforma':'Pro-Forma',
'posted':'Contabilizado',
'cancel':'Cancelado',
'open... | 1.984375 | 2 |
images/migrations/0002_auto_20180226_2100.py | andykimchris/Unsplash | 0 | 44996 | <reponame>andykimchris/Unsplash
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-02-26 18:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
migratio... | 1.367188 | 1 |
repository.github/lib/service.py | ponchofcult/Turning-Japanese | 4 | 44997 | import logging
import os
import threading
from xml.etree import ElementTree # nosec
import xbmc
from lib import routes # noqa
from lib.httpserver import threaded_http_server
from lib.kodi import ADDON_PATH, get_repository_port, set_logger
def update_repository_port(port, xml_path=os.path.join(ADDON_PATH, "addon.x... | 2.3125 | 2 |
user_login.py | AlainChomik/football | 0 | 44998 | Mein neuer Code...
Neue zeite Codezeile ...
| 1.179688 | 1 |
utils.py | sahngmin/IMK_Keyboard | 0 | 44999 | import torch
from data import get_diff
import editdistance
import re
from data import chars
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import matplotlib.pyplot as plt
from matplotlib import pylab
import numpy as np
char_to_idx = {ch: i for i, ch in enumerate(chars)}
device = torch.device... | 2.328125 | 2 |