max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
src/data.py | saattrupdan/danish-asr-models | 2 | 19500 | <gh_stars>1-10
'''Functions related to the data loading and processing'''
from transformers import (Wav2Vec2CTCTokenizer,
Wav2Vec2FeatureExtractor,
Wav2Vec2Processor)
from datasets import (load_dataset as ds_load_dataset,
Dataset,
... | 3.171875 | 3 |
etravel/urls.py | zahir1509/project-ap-etravel | 1 | 19501 | """etravel URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 2.703125 | 3 |
adet/data/video_data/yvos_annot_condinst.py | Tanveer81/BoxVOS | 4 | 19502 | <gh_stars>1-10
import json
import time
from glob import glob
from pathlib import Path
from adet.data.video_data.util import *
from PIL import Image, ImageFont, ImageDraw
import os
import random
categories = ['airplane', 'ape', 'bear', 'bike', 'bird', 'boat', 'bucket', 'bus', 'camel', 'cat',
'... | 2.09375 | 2 |
lookup_table.py | yishayv/lyacorr | 2 | 19503 | <reponame>yishayv/lyacorr
import numpy as np
def fast_linear_interpolate(f, x):
"""
:param f: array of evenly spaced function values
:param x: array of fractional positions to sample
:type f: np.multiarray.ndarray
:type x: np.multiarray.ndarray
:rtype: np.multiarray.ndarray
"""
x0 = ... | 2.59375 | 3 |
src/seedwork/domain/rules.py | pgorecki/python-ddd | 10 | 19504 | <reponame>pgorecki/python-ddd<gh_stars>1-10
from pydantic import BaseModel
class BusinessRule(BaseModel):
"""This is a base class for implementing domain rules"""
class Config:
arbitrary_types_allowed = True
# This is an error message that broken rule reports back
__message: str = "Business ... | 3 | 3 |
exs/mundo_2/python/067.py | QuatroQuatros/exercicios-CeV | 45 | 19505 | """
Desafio 067
Problema: Faça um programa que mostre a tabuada de vários números,
um de cada vez, para cada valor digitado pelo usuário.
O programa será interrompido quando o número solicitado
for negativo.
Resolução do problema:
"""
print('-' * 20)
print(f'{" Tabuada v3.0 ":~^20}')
pri... | 4.125 | 4 |
pyexcel_xlsx/__init__.py | pyexcel/pyexcel-xlsx | 101 | 19506 | <gh_stars>100-1000
"""
pyexcel_xlsx
~~~~~~~~~~~~~~~~~~~
The lower level xlsx file format handler using openpyxl
:copyright: (c) 2015-2019 by Onni Software Ltd & its contributors
:license: New BSD License
"""
from pyexcel_io.io import get_data as read_data
from pyexcel_io.io import isstream
from py... | 2.359375 | 2 |
GeneralTools/graph_funcs/generative_model_metric.py | frhrdr/MMD-GAN | 0 | 19507 | import numpy as np
import tensorflow as tf
from tensorflow.contrib import gan as tfgan
from GeneralTools.graph_funcs.my_session import MySession
from GeneralTools.math_funcs.graph_func_support import mean_cov_np, trace_sqrt_product_np
from GeneralTools.misc_fun import FLAGS
class GenerativeModelMetric(object):
d... | 2.34375 | 2 |
App/softwares_env/wizard/wsd/main.py | Wizard-collab/wizard | 0 | 19508 | <gh_stars>0
import yaml
class wsd():
def __init__(self, file, dict):
self.file = file
self.dict = dict
def write_sd(self):
with open(self.file, 'w') as f:
f.write(yaml.dump(self.dict)) | 2.75 | 3 |
loldib/getratings/models/NA/na_rengar/na_rengar_mid.py | koliupy/loldib | 0 | 19509 | <reponame>koliupy/loldib
from getratings.models.ratings import Ratings
class NA_Rengar_Mid_Aatrox(Ratings):
pass
class NA_Rengar_Mid_Ahri(Ratings):
pass
class NA_Rengar_Mid_Akali(Ratings):
pass
class NA_Rengar_Mid_Alistar(Ratings):
pass
class NA_Rengar_Mid_Amumu(Ratings):
pass
class NA_Renga... | 1.5 | 2 |
fixtures_browsers.py | aleksandr-kotlyar/python_tests_and_hacks | 9 | 19510 | import logging
import pytest
from selene import Browser, Config
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture(scope='function')
def browser_func(choose_driver):
"""Browser that closes after each test f... | 2.390625 | 2 |
evaluation/__init__.py | Luxios22/Dual_Norm | 0 | 19511 | <reponame>Luxios22/Dual_Norm
from .evaluation import evaluation | 0.863281 | 1 |
utils/file_utils.py | lkrmbhlz/MVSC_3D | 2 | 19512 | <reponame>lkrmbhlz/MVSC_3D
import open3d as o3d
import numpy as np
from pclpy import pcl
from tqdm import tqdm
import os
def o3d_meshes(dataset_name: str, path_to_data_folder='../../data'):
"""
Read in mesh (.ply, .stl, .off) files. The function assumes that each class of objects is in
a separate folder a... | 3 | 3 |
Program.py | aakash-lambton/project | 0 | 19513 | <reponame>aakash-lambton/project
import pymongo
import random
def create_database(db):
user_collection = db['users']
user_collection.drop()
user_collection = db['users']
post_collection = db['posts']
post_collection.drop()
post_collection = db['posts']
comment_collection = db['comments']... | 2.4375 | 2 |
Mundo 2/ex053.py | judigunkel/judi-exercicios-python | 0 | 19514 | """
Crie um programa que leia um a frase qualquer e diga se ela é um palíndromo,
desconsiderando os espaços.
ex:
apos a sopa
a sacada da casa
a torre da derrota
o lobo ama o bolo
anotaram a data da maratona
"""
frase = input('Digite uma frase (sem acentos): ').replace(' ', '').upper()
inverso = ''
for c in range(len(fr... | 4.28125 | 4 |
inferfuzzy/base_set.py | leynier/inferfuzzy | 3 | 19515 | from typing import Any, Callable
import matplotlib.pyplot as plt
from numpy import arange
from .membership import Membership
class BaseSet:
def __init__(
self,
name: str,
membership: Membership,
aggregation: Callable[[Any, Any], Any],
):
self.name = name
self.... | 2.71875 | 3 |
play/play_loop.py | wmloh/ChessAI | 1 | 19516 | import numpy as np
import chess
import chess.engine
from tkinter.filedialog import asksaveasfilename
from parsing.math_encode import tensor_encode, tensor_decode
from inference.infer_action import get_action
class PlayLoop:
__doc__ = '''
An interactive REPL environment for play with a trained chess AI
''... | 2.75 | 3 |
wave/synth/wave/wave/base/curve.py | jedhsu/wave | 0 | 19517 | <gh_stars>0
from dataclasses import dataclass
from typing import Generic, Mapping, TypeVar
__all__ = ["Curve"]
T = TypeVar("T")
U = TypeVar("U")
@dataclass
class _Curve(Generic[T, U]):
mapping: Mapping[T, U]
| 2.703125 | 3 |
src/jellyroll/providers/utils/anyetree.py | blturner/jellyroll | 3 | 19518 | """
Get an Etree library. Usage::
>>> from anyetree import etree
Returns some etree library. Looks for (in order of decreasing preference):
* ``lxml.etree`` (http://cheeseshop.python.org/pypi/lxml/)
* ``xml.etree.cElementTree`` (built into Python 2.5)
* ``cElementTree`` (http://effbot.org/zone/celem... | 2.46875 | 2 |
libs/dispatch/dispatcher.py | eeshakumar/hythe | 0 | 19519 | <gh_stars>0
from abc import abstractmethod, ABC
class Dispatcher(ABC):
def __init__(self, dispatch_dict=None):
self._dispatch_dict = dispatch_dict
self._process_list = []
return
def set_dispatch_dict(self, dispatch_dict):
self._dispatch_dict = dispatch_dict
@abstractmeth... | 3.046875 | 3 |
3_TT_FLIM.py | swabianinstruments/swabianinstruments-web-demo | 0 | 19520 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 11:01:41 2020
@author: liu
"""
from time import sleep
import plot_TT
from TimeTagger import createTimeTagger, freeAllTimeTagger, TimeDifferences
# create a Time Tagger instance
tagger = createTimeTagger()
tagger.reset()
# assign channe... | 2.6875 | 3 |
electroPyy/io/__init__.py | ludo67100/electroPyy_Dev | 0 | 19521 | <reponame>ludo67100/electroPyy_Dev<filename>electroPyy/io/__init__.py
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 14:54:51 2019
@author: Ludovic.SPAETH
"""
from electroPyy.io.BaseRawIO import BaseRawIO
from electroPyy.io.HdF5IO import HdF5IO
from electroPyy.io.NeuroExIO import NeuroExIO
from electroPy... | 0.910156 | 1 |
torch_geometric_temporal/signal/__init__.py | tforgaard/pytorch_geometric_temporal | 1,410 | 19522 | <filename>torch_geometric_temporal/signal/__init__.py
from .dynamic_graph_temporal_signal import *
from .dynamic_graph_temporal_signal_batch import *
from .static_graph_temporal_signal import *
from .static_graph_temporal_signal_batch import *
from .dynamic_graph_static_signal import *
from .dynamic_graph_static_sign... | 1.132813 | 1 |
sdks/python/apache_beam/examples/streaming_wordcount_debugging_test.py | aaltay/incubator-beam | 9 | 19523 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1.859375 | 2 |
rest_framework_bulk/__init__.py | xordoquy/django-rest-framework-bulk | 1 | 19524 | <gh_stars>1-10
__version__ = '0.1.3'
__author__ = '<NAME>'
try:
from .generics import *
from .mixins import *
except Exception:
pass
| 1.179688 | 1 |
random_forest_classifier.py | duongntbk/FashionMNIST | 0 | 19525 | # -*- coding: utf-8 -*-
import pickle
from sklearn.ensemble import RandomForestClassifier
from base_shallow_classifier import BaseShallowClassifier
class RFClassifier(BaseShallowClassifier):
'''
Image classification using random forest classifier (RFC).
Can reach 87.82% accuracy on test set of FashionM... | 3.296875 | 3 |
setup.py | mehta-lab/recOrder | 2 | 19526 | <filename>setup.py
import os.path as osp
from setuptools import setup, find_packages
# todo: modify as we decide on versions, names, descriptions. readme
MIN_PY_VER = '3.7'
DISTNAME = 'recOrder'
DESCRIPTION = 'computational microscopy toolkit for label-free imaging'
with open("README.md", "r") as fh:
LONG_DESCRIPT... | 1.703125 | 2 |
oscrypto/_openssl/_libssl_ctypes.py | frennkie/oscrypto | 1 | 19527 | <gh_stars>1-10
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import platform
import sys
from ctypes.util import find_library
from ctypes import CDLL, CFUNCTYPE, POINTER, c_void_p, c_char_p, c_int, c_size_t, c_long
from .. import _backend_config
from .._ffi import F... | 1.882813 | 2 |
etl/etl.py | amalshehu/exercism-python | 2 | 19528 | <reponame>amalshehu/exercism-python<gh_stars>1-10
# File: etl.py
# Purpose: To do the `Transform` step of an Extract-Transform-Load.
# Programmer: <NAME>
# Course: Exercism
# Date: Thursday 22 September 2016, 03:40 PM
def transform(words):
new_words = dict()
for point, letters in words... | 2.984375 | 3 |
codango/account/api.py | NdagiStanley/silver-happiness | 2 | 19529 | <reponame>NdagiStanley/silver-happiness
import psycopg2
from rest_framework import generics, permissions
# from serializers import UserSerializer, UserFollowSerializer, UserSettingsSerializer
from serializers import UserSerializer, UserFollowSerializer, UserSettingsSerializer
from serializers import AllUsersSerializer... | 2.265625 | 2 |
backend/app/apis/v1/resources.py | williamsyb/StockTick | 2 | 19530 | <gh_stars>1-10
# -*- coding:UTF-8 -*-
from flask import Blueprint, current_app, request
import pandas as pd
from app.protocol import serialize
from app.utils import Utils
from app.database.crud import db_mgr
from app.cache import redis_mgr
api_v1 = Blueprint('api_v1', __name__)
@api_v1.route('/show_raw_data', method... | 2.21875 | 2 |
report/api/hooks.py | Aaron-DH/openstack_sample_project | 0 | 19531 | from oslo_log import log
from oslo_config import cfg
from report import storage
from pecan import hooks
LOG = log.getLogger(__name__)
class RPCHook(hooks.PecanHook):
def __init__(self, rcp_client):
self._rpc_client = rcp_client
def before(self, state):
state.request.rpc_client = self._rpc_cl... | 2.109375 | 2 |
garageofcode/semantic/main.py | tpi12jwe/garageofcode | 2 | 19532 | def have(subj, obj):
subj.add(obj)
def change(subj, obj, state):
pass
if __name__ == '__main__':
main() | 2.03125 | 2 |
scholariumat/products/migrations/0012_auto_20181125_1221.py | valuehack/scholariumat | 0 | 19533 | # Generated by Django 2.0.9 on 2018-11-25 11:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0011_auto_20181123_1446'),
]
operations = [
migrations.RenameField(
model_name='item',
old_name='amount'... | 1.664063 | 2 |
setup.py | geickelb/hsip441_neiss_python | 0 | 19534 | <reponame>geickelb/hsip441_neiss_python<gh_stars>0
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.0.1',
description='compiling code for HSIP441 using python to explore the Neiss database',
author='<NAME>',
license='MIT',
)
| 1.40625 | 1 |
test.py | j178/spotlight | 5 | 19535 | from weibo import WeiboClient
from weibo.watchyou import fetch_replies
for r in fetch_replies(): # fetch_replies所依赖的weibo全局变量是在watchyou模块中存在的, 函数无法访问到这个模块中的全局变量
print(r['text'])
| 2.1875 | 2 |
tests/unit/test_db_config_options.py | feddovanede/cf-mendix-buildpack-heapdump | 0 | 19536 | <reponame>feddovanede/cf-mendix-buildpack-heapdump
import datetime
import json
import os
from unittest import TestCase, mock
from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
from buildpack.infrastructure.database import (
UrlDatabaseConfiguration,
get_config,
)
from cryptography import x509
f... | 1.984375 | 2 |
Computer & Information Science Core courses/2168/A*/graph.py | Vaporjawn/Temple-University-Computer-Science-Resources | 1 | 19537 | <filename>Computer & Information Science Core courses/2168/A*/graph.py
"""Implement the graph to traverse."""
from collections import Counter
class Node:
"""Node class."""
def __init__(self, value, x, y):
"""Initialize node."""
self.x = x
self.y = y
self.value = value
... | 4.3125 | 4 |
Projects/Python_Python2_json/main.py | LiuOcean/luban_examples | 44 | 19538 | import json
import gen.Types
def loader(f):
return json.load(open('../GenerateDatas/json/' + f + ".json", 'r'), encoding="utf-8")
tables = gen.Types.Tables(loader)
print(tables)
r = tables.TbFullTypes.getDataList()[0].__dict__
print(r)
| 2.375 | 2 |
rplugin/python3/defx/base/kind.py | kazukazuinaina/defx.nvim | 0 | 19539 | # ============================================================================
# FILE: kind.py
# AUTHOR: <NAME> <Shougo.Matsu at g<EMAIL>>
# License: MIT license
# ============================================================================
import json
import typing
from pathlib import Path
from defx.action import Ac... | 2.171875 | 2 |
shopify_listener/dispatcher.py | smallwat3r/shopify-webhook-manager | 6 | 19540 | <filename>shopify_listener/dispatcher.py
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2019-04-26 21:01:07
# @Last Modified by: <NAME>
# @Last Modified time: 2019-04-26 21:52:46
"""Dispatch webhook event to specific actions."""
import json
class Dispatcher:
"""Dispatch the different webhook events to th... | 2.3125 | 2 |
open_spiel/higc/bots/test_bot_fail_after_few_actions.py | higcompetition/tournament | 4 | 19541 | <reponame>higcompetition/tournament<filename>open_spiel/higc/bots/test_bot_fail_after_few_actions.py
# A bot that picks the first action from the list for the first two rounds,
# and then exists with an exception.
# Used only for tests.
game_name = input()
play_as = int(input())
print("ready")
while True:
print("... | 2.890625 | 3 |
python/hsfs/util.py | berthoug/feature-store-api | 0 | 19542 | <gh_stars>0
#
# Copyright 2020 Logical Clocks AB
#
# 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 applicab... | 2.015625 | 2 |
src/map_generation/map_parser.py | tbvanderwoude/matching-epea-star | 1 | 19543 | import os.path
from typing import List, Tuple
from mapfmclient import MarkedLocation, Problem
class MapParser:
def __init__(self, root_folder: str):
self.root_folder = root_folder
def parse_map(self, name: str) -> Problem:
with open(os.path.join(self.root_folder, name)) as file:
... | 3.390625 | 3 |
library/oci_api_key.py | AndreyAdnreyev/oci-ansible-modules | 0 | 19544 | #!/usr/bin/python
# Copyright (c) 2018, 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for ... | 1.546875 | 2 |
python_modules/dagster/dagster/core/types/builtin_enum.py | jake-billings/dagster | 1 | 19545 | <filename>python_modules/dagster/dagster/core/types/builtin_enum.py
import sys
if sys.version_info.major >= 3:
import typing
class BuiltinEnum:
ANY = typing.Any
BOOL = typing.NewType('Bool', bool)
FLOAT = typing.NewType('Float', float)
INT = typing.NewType('Int', int)
... | 2.765625 | 3 |
sallybrowse/extensions/document/__init__.py | XiuyuanLu/browse | 0 | 19546 | <filename>sallybrowse/extensions/document/__init__.py
#!/usr/bin/env python3
import sys, os, re, html
from flask import request, Response
from sallybrowse.extensions import BaseExtension
from subprocess import Popen, PIPE
class Extension(BaseExtension):
PATTERN = re.compile(r".*\.(pdf|xlsx|xls|docx|doc|ods|odt|xlt|p... | 2.25 | 2 |
Tests/testGalaxy.py | elsiehupp/traveller_pyroute | 12 | 19547 | <gh_stars>10-100
"""
Created on Nov 30, 2021
@author: CyberiaResurrection
"""
import unittest
import re
import sys
sys.path.append('../PyRoute')
from Galaxy import Galaxy
from Galaxy import Sector
class testGalaxy(unittest.TestCase):
"""
A very simple, barebones test to check that Verge and Reft end up i... | 2.46875 | 2 |
py_boot/test.py | davidcawork/Investigacion | 0 | 19548 | <filename>py_boot/test.py<gh_stars>0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Firefox()
driver.get('https://www.google.com')
time.sleep(60)
driver.close()
| 1.992188 | 2 |
tests/test_dlms_state.py | Layty/dlms-cosem | 1 | 19549 | import pytest
from dlms_cosem import enumerations, state
from dlms_cosem.exceptions import LocalDlmsProtocolError
from dlms_cosem.protocol import acse
from dlms_cosem.protocol.acse import UserInformation
from dlms_cosem.protocol.xdlms import Conformance, InitiateRequestApdu
def test_non_aarq_on_initial_raises_protoc... | 1.96875 | 2 |
sets-add.py | limeonion/Python-Programming | 0 | 19550 | <reponame>limeonion/Python-Programming
'''
f we want to add a single element to an existing set, we can use the .add() operation.
It adds the element to the set and returns 'None'.
Example
>>> s = set('HackerRank')
>>> s.add('H')
>>> print s
set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R'])
>>> print s.add('HackerRank')... | 4.0625 | 4 |
lesson_08/lesson_08_06.py | amindmobile/geekbrains-python-002 | 0 | 19551 | <gh_stars>0
# 6. Продолжить работу над вторым заданием. Реализуйте механизм валидации вводимых пользователем данных. Например, для
# указания количества принтеров, отправленных на склад, нельзя использовать строковый тип данных.
# Подсказка: постарайтесь по возможности реализовать в проекте «Склад оргтехники» максимум ... | 3.484375 | 3 |
epicteller/core/dao/credential.py | KawashiroNitori/epicteller | 0 | 19552 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
from epicteller.core import redis
from epicteller.core.model.credential import Credential
class CredentialDAO:
r = redis.pool
@classmethod
async def set_access_credential(cls, credential: Credential):
await cls.r.pool.set(... | 2.1875 | 2 |
models.py | drigobon/prep.gg | 0 | 19553 | <reponame>drigobon/prep.gg<gh_stars>0
class LeagueGame:
def __init__(self, data):
self.patch = data['patch']
self.win = data['win']
self.side = data['side']
self.opp = data['opp']
self.bans = data['bans']
self.vs_bans = data['vs_bans']
self.picks = data['picks']
self.vs_picks = data['vs_picks']
self.... | 2.515625 | 3 |
option.py | lotress/new-DL | 0 | 19554 | from common import *
from model import vocab
option = dict(edim=256, epochs=1.5, maxgrad=1., learningrate=1e-3, sdt_decay_step=1, batchsize=8, vocabsize=vocab, fp16=2, saveInterval=10, logInterval=.4)
option['loss'] = lambda opt, model, y, out, *_, rewards=[]: F.cross_entropy(out.transpose(-1, -2), y, reduction='none')... | 1.960938 | 2 |
Release/cyberbot-micropython/Examples/Terminal_DA_AD.py | parallaxinc/cyberbot | 4 | 19555 | # Terminal_DA_AD.py
# Circuit
# D/A0---A/D0, D/A1---A/D1,
# pot A---3.3V, potB---GND, pot wiper---A/D2
# Procedure
# Run, then open REPL and then CTRL + D
# Twist pot input while program runs to see ad2 vary
# Notes
# micro:bit ground is 0.4 V below cyber:bot board ground
# micro:bit 3.3 V = 3.245 V WRT ... | 2.515625 | 3 |
cinebot_mini_render_server/animation_routes.py | cheng-chi/cinebot_mini | 0 | 19556 | import bpy
from aiohttp import web
import numpy as np
from mathutils import Matrix, Vector
import asyncio
from cinebot_mini_render_server.blender_timer_executor import EXECUTOR
routes = web.RouteTableDef()
def delete_animation_helper(obj):
if not obj.animation_data:
return False
if not obj.animation_... | 2.1875 | 2 |
notebooks/_solutions/13-raster-processing32.py | jorisvandenbossche/DS-python-geospatial | 58 | 19557 | <reponame>jorisvandenbossche/DS-python-geospatial<filename>notebooks/_solutions/13-raster-processing32.py<gh_stars>10-100
roads_subset = roads[roads["frc_omschrijving"].isin(road_types)] | 1.523438 | 2 |
pade/tests/v1/script_2_revisado_local.py | AndreCrescenzo/multi-agents | 72 | 19558 | <filename>pade/tests/v1/script_2_revisado_local.py
# -*- encoding: utf-8 -*-
from utils import display_message, set_ams, start_loop, config_loop
#config_loop(gui=True)
from agent import Agent
from messages import ACLMessage
from aid import AID
from protocols import FipaContractNetProtocol
from filters import Filter
fr... | 2.390625 | 2 |
beta/dump/pbasis.py | addschile/pymctdh | 0 | 19559 | from copy import deepcopy
from numba import jit,njit
import numpy as np
import pymctdh.opfactory as opfactory
from pymctdh.cy.sparsemat import CSRmat#,matvec
@njit(fastmath=True)
def matvec(nrows,IA,JA,data,vec,outvec):
"""
"""
d_ind = 0
for i in range(nrows):
ncol = IA[i+1]-IA[i]
for... | 2.21875 | 2 |
handyrl/envs/kaggle/hungry_geese.py | HantianZheng/HandyRL | 1 | 19560 | # Copyright (c) 2020 DeNA Co., Ltd.
# Licensed under The MIT License [see LICENSE for details]
# kaggle_environments licensed under Copyright 2020 Kaggle Inc. and the Apache License, Version 2.0
# (see https://github.com/Kaggle/kaggle-environments/blob/master/LICENSE for details)
# wrapper of Hungry Geese environment... | 2.125 | 2 |
py files/normalization.py | kilarinikhil/ComputerVision | 0 | 19561 | <gh_stars>0
import numpy as np
def normalize(image):
mean = np.mean(image)
meanSubtractedImage = image - mean
return np.divide(meanSubtractedImage,np.power(np.sum(np.power(meanSubtractedImage,2)),0.5))
| 2.90625 | 3 |
server/migrations/versions/4a916694f1ba_add_initial_image_table.py | brodigan-e/capstone-POV | 2 | 19562 | <reponame>brodigan-e/capstone-POV<filename>server/migrations/versions/4a916694f1ba_add_initial_image_table.py
"""Add Initial Image Table
Revision ID: 4a916694f1ba
Revises:
Create Date: 2020-10-16 02:24:18.479608
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '... | 1.640625 | 2 |
skyoffset/multisimplex.py | jonathansick/skyoffset | 0 | 19563 | <gh_stars>0
import os
import logging
import platform
import time
import multiprocessing
import numpy
import pymongo
# Pure python/numpy
import simplex
from scalarobj import ScalarObjective
# Cython/numpy
import cyscalarobj
import cysimplex
class MultiStartSimplex(object):
"""Baseclass for multi-start recongergi... | 2.15625 | 2 |
netsuitesdk/api/custom_records.py | cart-com/netsuite-sdk-py | 0 | 19564 | <gh_stars>0
from netsuitesdk.internal.utils import PaginatedSearch
from .base import ApiBase
import logging
logger = logging.getLogger(__name__)
class CustomRecords(ApiBase):
def __init__(self, ns_client):
ApiBase.__init__(self, ns_client=ns_client, type_name='CustomRecordType')
def get_all_by_id(s... | 2.40625 | 2 |
Support/renameCNVNatorOutput.py | zhongmicai/SV_population | 18 | 19565 | <gh_stars>10-100
#!/usr/bin/env python3
import os
vcfdir='/home/matt/Plasmodium/Pf_SV/Data'
for ID in os.listdir(vcfdir):
nameID = '_'.join(ID.split('.')[0].split('_')[:-1])
coreID = nameID.split('_')[-1]
if coreID[:3] == 'ERR':
os.system('cp {0}.cnvs {1}_DEL.cnvs'.format(coreID, nameID))
os.system('cp {0}.cnv... | 2 | 2 |
string_1/hello_name.py | nhutnamhcmus/coding-bat-solutions | 1 | 19566 | # =======================================================================================================================================
# VNU-HCM, University of Science
# Department Computer Science, Faculty of Information Technology
# Authors: <NAME> (<NAME>)
# © 2020
"""
Given a string name, e.g. "Bob", return a g... | 3.5625 | 4 |
materials/ch_04/escape_str.py | epsilonxe/RMUTT_09090016 | 0 | 19567 | <reponame>epsilonxe/RMUTT_09090016
text1 = '''ABCDEF
GHIJKL
MNOPQRS
TUVWXYZ
'''
text2 = 'ABCDEF\
GHIJKL\
MNOPQRS\
TUVWXYZ'
text3 = 'ABCD\'EF\'GHIJKL'
text4 = 'ABCDEF\nGHIJKL\nMNOPQRS\nTUVWXYZ'
text5 = 'ABCDEF\fGHIJKL\fMNOPQRS\fTUVWXYZ'
print(text1)
print('-' * 25)
print(text2)
print('-' * 25)
print(text3)
print('... | 2.453125 | 2 |
pygears/cookbook/reduce2.py | Risto97/pygears | 0 | 19568 | from pygears import gear, Intf
from pygears.common import czip
from pygears.typing import Tuple, Uint, Union, Queue
from pygears.common import fmap, demux, decoupler, fifo, union_collapse
from pygears.cookbook import priority_mux, replicate
TCfg = Tuple[{'reduce_size': Uint['w_reduce_size'], 'init': 't_acc'}]
@gear
... | 2.078125 | 2 |
atcoder/abc166D_i_hate_factorization.py | da-edra/kyopro | 2 | 19569 | <reponame>da-edra/kyopro
# unihernandez22
# https://atcoder.jp/contests/abc166/tasks/abc166_d
# math, brute force
n = int(input())
for a in range(n):
breaked = True
for b in range(-1000, 1000):
if a**5 - b**5 == n:
print(a, b)
break;
else:
breaked = False
if break... | 2.921875 | 3 |
packages/grid/apps/worker/src/main/core/database/groups/groups.py | exityan/PySyft | 425 | 19570 | # grid relative
from .. import BaseModel
from .. import db
class Group(BaseModel):
__tablename__ = "group"
id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
name = db.Column(db.String(255))
def __str__(self):
return f"<Group id: {self.id}, name: {self.name}>"
| 2.53125 | 3 |
libraries/urx_python/urx_scripts/demo_apple_tree.py | giacomotomasi/tennisball_demo | 0 | 19571 | <gh_stars>0
import urx
import logging
import time
if __name__ == "__main__":
logging.basicConfig(level=logging.WARN)
#gripper_remove_pos = [0.0755, -0.2824, 0.3477, -0.0387, -3.0754, 0.4400] # rest position (good to place/remove gripper)
rob = urx.Robot("192.168.56.1")
#rob.set_tcp((0,0,0,0,0,0))
... | 1.984375 | 2 |
solution/data_structure2/1302/main.py | jungyoonoh/baekjoon-1 | 2,236 | 19572 | <reponame>jungyoonoh/baekjoon-1
# Authored by : gusdn3477
# Co-authored by : -
# Link : http://boj.kr/8adc986ae26b461eadd65abdff3cfba9
import sys
def input():
return sys.stdin.readline().rstrip()
N = int(input())
book = {}
for i in range(N):
name = input()
if name not in book:
book[name] = 1
e... | 3.1875 | 3 |
testflows/_core/utils/sort.py | testflows/TestFlows-Core | 3 | 19573 | # Copyright 2020 Katteli Inc.
# TestFlows.com Open-Source Software Testing Framework (http://testflows.com)
#
# 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/lice... | 2.359375 | 2 |
tests/build/test_flash.py | cyliangtw/mbed-tools | 39 | 19574 | #
# Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
import pathlib
import tempfile
from unittest import TestCase, mock
from mbed_tools.build.flash import flash_binary, _build_binary_file_path, _flash_dev
from mbed_tools.build.exceptions import Binary... | 2.03125 | 2 |
packettotal_sdk/search_tools.py | RogerDeng/HoneyBot | 67 | 19575 | import time
import typing
import requests
from sys import stderr
from datetime import datetime
from packettotal_sdk import packettotal_api
class SearchTools(packettotal_api.PacketTotalApi):
def __init__(self, api_key: str):
"""
:param api_key: An API authentication token
"""
sup... | 2.6875 | 3 |
actfw_core/v4l2/__init__.py | Idein/actfw-core | 2 | 19576 | <gh_stars>1-10
from . import types, video # noqa: F401
| 1.0625 | 1 |
xos/synchronizers/openstack/model_policies/model_policy_Sliver.py | xmaruto/mcord | 0 | 19577 | <gh_stars>0
def handle(instance):
from core.models import Controller, ControllerSlice, ControllerNetwork, NetworkSlice
networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)]
controller_networks = ControllerNetwork.objects.filter(network__in=networks,
... | 2.046875 | 2 |
tests/unit/test_s3.py | tejuafonja/SDGym | 19 | 19578 | from unittest.mock import Mock, patch
import pandas as pd
from sdgym.s3 import is_s3_path, parse_s3_path, write_csv, write_file
def test_is_s3_path_with_local_dir():
"""Test the ``sdgym.s3.is_s3_path`` function with a local directory.
If the path is not an s3 path, it should return ``False``.
Input:
... | 3.28125 | 3 |
vet_care/scripts/generate_from_history.py | neerajvkn/vet_care | 2 | 19579 | <reponame>neerajvkn/vet_care
import csv
import datetime
import frappe
# bench execute vet_care.scripts.generate_from_history.execute --args "['./data/important_data.csv']"
def execute(filename):
patient_activities = []
not_created = []
with open(filename, 'r') as csvfile:
reader = csv.DictReader(c... | 2.453125 | 2 |
aws_interface/cloud/auth/delete_sessions.py | hubaimaster/aws-interface | 53 | 19580 |
from cloud.permission import Permission, NeedPermission
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'session_ids': ['str'],
},
'output_format': {
'success': 'bool'
},
'description': 'Delete session... | 2.4375 | 2 |
plugin/autoWHUT.py | PPeanutButter/MediaServer | 2 | 19581 | # coding=<utf-8>
import requests
import re
import socket
import base64
import psutil
import pywifi
from pywifi import const
import subprocess
import os
import time
def get_host_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
ip = s.getsockname()[0... | 2.609375 | 3 |
active_subspaces/gradients.py | ftalbrecht/active_subspaces | 51 | 19582 | """Utilities for approximating gradients."""
import numpy as np
from utils.misc import process_inputs
from utils.simrunners import SimulationRunner
def local_linear_gradients(X, f, p=None, weights=None):
"""Estimate a collection of gradients from input/output pairs.
Given a set of input/output pairs, choo... | 3.203125 | 3 |
covidaid/tools/read_data.py | sabuj7177/CovidProject | 0 | 19583 | <gh_stars>0
# encoding: utf-8
"""
Read images and corresponding labels.
"""
import torch
from torch.utils.data import Dataset
from PIL import Image
import os
import random
class ChestXrayDataSetTest(Dataset):
def __init__(self, image_list_file, transform=None, combine_pneumonia=False):
"""
Create... | 3.015625 | 3 |
helper/evaluator.py | manipopopo/TC-ResNet | 185 | 19584 | import csv
import sys
from pathlib import Path
from abc import abstractmethod
import numpy as np
import tensorflow as tf
from tqdm import tqdm
import common.tf_utils as tf_utils
import metrics.manager as metric_manager
from common.model_loader import Ckpt
from common.utils import format_text
from common.utils import ... | 1.953125 | 2 |
src/sync.py | neybar/icloud-drive-docker | 0 | 19585 | <reponame>neybar/icloud-drive-docker<gh_stars>0
__author__ = '<NAME> (<EMAIL>)'
import datetime
import os
import re
import time
from pathlib import Path
from shutil import copyfileobj, rmtree
from pyicloud import PyiCloudService, utils, exceptions
from src import config_parser
from src import notify
def wanted_fil... | 2.234375 | 2 |
sphinx-sources/Examples/Interference/MultiSlit.py | jccmak/lightpipes | 0 | 19586 | <gh_stars>0
#! python3
import numpy as np
import matplotlib.pyplot as plt
from LightPipes import *
"""
MultiSlit.py
Demonstrates the RowOfFields command. Two wavelengths are used to show
the principles of a grating.
cc <NAME>, June 2020.
"""
wavelength=1000*nm
Dlambda=150*nm
size=11*mm
N=2000
N2=i... | 2.90625 | 3 |
genshimacro/__init__.py | trac-hacks/trac-GenshiMacro | 1 | 19587 | from genshi.template import MarkupTemplate
from trac.core import *
from trac.web.chrome import Chrome
from trac.wiki.macros import WikiMacroBase
class GenshiMacro(WikiMacroBase):
def expand_macro(self, formatter, name, text, args):
template = MarkupTemplate(text)
chrome = Chrome(self.env)
... | 1.898438 | 2 |
scripts/WIPS2015/WIPS_anydiag_time.py | eclee25/flu-SDI-exploratory-age | 3 | 19588 | <filename>scripts/WIPS2015/WIPS_anydiag_time.py
#!/usr/bin/python
##############################################
###Python template
###Author: <NAME>
###Date: 10/11/14
###Function: Any diagnosis per 100,000 population vs. week number for flu weeks (wks 40-20). Population size is from the calendar year of the week of c... | 1.929688 | 2 |
misc/src/scheduler_plugin.py | hivesolutions/colony_plugins | 1 | 19589 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... | 1.46875 | 1 |
source/vistas/ui/controls/gl_camera.py | VISTAS-IVES/pyvistas | 1 | 19590 | <filename>source/vistas/ui/controls/gl_camera.py
import os
import wx
from vistas.core.graphics.camera_interactor import *
from vistas.core.graphics.overlay import BasicOverlayButton
from vistas.core.paths import get_resources_directory
from vistas.ui.events import CameraChangedEvent
from vistas.ui.utils import get_ma... | 2.359375 | 2 |
src/_sever_qt4.py | Joy917/fast-transfer | 0 | 19591 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\SVNzhangy\fast-transfer\src\_sever.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attribut... | 1.570313 | 2 |
aleph/tests/test_documents_api.py | gazeti/aleph | 1 | 19592 | import json
from aleph.tests.util import TestCase
class DocumentsApiTestCase(TestCase):
def setUp(self):
super(DocumentsApiTestCase, self).setUp()
self.load_fixtures('docs.yaml')
def test_index(self):
res = self.client.get('/api/1/documents')
assert res.status_code == 200, r... | 2.28125 | 2 |
acropolis.py | andreasa13/Flask_WebApp_TripAdvisor | 0 | 19593 | <gh_stars>0
import json
import pandas as pd
from geopy.geocoders import Nominatim
def getAcropolisStatistics():
data = pd.read_csv("Analytics/demographics_old.csv")
ratings_acropolis = len(data)
gender = data.gender.str.lower().value_counts()
ages = data.age_group.value_counts()
return ratings_a... | 3.078125 | 3 |
share/pegasus/init/split/daxgen.py | fengggli/pegasus | 0 | 19594 | #!/usr/bin/env python
import os
import pwd
import sys
import time
from Pegasus.DAX3 import *
# The name of the DAX file is the first argument
if len(sys.argv) != 2:
sys.stderr.write("Usage: %s DAXFILE\n" % (sys.argv[0]))
sys.exit(1)
daxfile = sys.argv[1]
USER = pwd.getpwuid(os.getuid())[0]
# Create ... | 2.265625 | 2 |
lbrynet/wallet/ledger.py | ttkopec/lbry | 0 | 19595 | <gh_stars>0
import logging
from six import int2byte
from binascii import unhexlify
from twisted.internet import defer
from .resolve import Resolver
from lbryschema.error import URIParseError
from lbryschema.uri import parse_lbry_uri
from torba.baseledger import BaseLedger
from .account import Account
from .network ... | 1.757813 | 2 |
MATA37-ILP 2021.2/JUDE/Lista 3 e Prova 3 - Loop/lista3_D.py | jeffersonraimon/Programming-UFBA | 1 | 19596 | T = int(input())
P = int(input())
controle = 0 #Uso para guardar o valor maior que o limite
while P != 0:
P = int(input())
if P >= T:
controle = 1 #coloquei 1 so pra ser diferente de 0
if controle == 1:
print("ALARME")
else:
print("O Havai pode dormir tranquilo") | 3.75 | 4 |
dopamine/fetch_cam_train/fetch_cam/test/fetch_dis_error.py | kbehouse/dopamine | 0 | 19597 | <gh_stars>0
import numpy as np
import gym
import time
from matplotlib import pyplot as plt
from fetch_cam import FetchCameraEnv
from fsm import FSM
dis_tolerance = 0.0001 # 1mm
env = FetchCameraEnv()
obs = env.reset()
done = False
want_pos = (obs['eeinfo'][0]).copy()
ori_pos = (obs['eeinfo'][0]).copy()
print(... | 2.0625 | 2 |
pyHarvest_build_151223/pyHarvest_Analyse_Data_v1.py | bl305/pyHarvest | 0 | 19598 | <reponame>bl305/pyHarvest<filename>pyHarvest_build_151223/pyHarvest_Analyse_Data_v1.py
# coding=utf-8
from packages import *
import os
#SET PARAMETERS
myverbosity=-1
mymaxencode=5
TXT_filetypes=(
#simple text files
'txt','lst',
#config files
'ini','cfg',
#programming languages
'c','cpp',
#scripts
'vbs','py','pl')
XL... | 1.65625 | 2 |
functions/update_modeling_results.py | zheng-da/covid19-severity-prediction | 2 | 19599 | import numpy as np
import pandas as pd
from os.path import join as oj
import os
import pygsheets
import pandas as pd
import sys
import inspect
from datetime import datetime, timedelta
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path... | 2.359375 | 2 |