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 |
|---|---|---|---|---|---|---|
figures/perception/randomwalk.py | patricknaughton01/RoboticSystemsBook | 116 | 36600 | <reponame>patricknaughton01/RoboticSystemsBook<filename>figures/perception/randomwalk.py<gh_stars>100-1000
import matplotlib.pyplot as plt
import numpy as np
from kalman import *
def kf_trace(F,g,P,H,j,Q,Xmean,Xvar,Z):
if not isinstance(F,np.ndarray): F = np.array([[F]])
if not isinstance(g,np.ndarray): g = np... | 2.4375 | 2 |
data/MuCo/MuCo.py | GUO-W/PI-Net | 2 | 36601 | ##
## Software PI-Net: Pose Interacting Network for Multi-Person Monocular 3D Pose Estimation
## Copyright Inria and UPC
## Year 2021
## Contact : <EMAIL>
##
## The software PI-Net is provided under MIT License.
##
#used in train for skeleton input
import os
import os.path as osp
import numpy as np
import math
from ut... | 1.914063 | 2 |
search/urls.py | Tariqalrehily/iShop | 0 | 36602 | <filename>search/urls.py<gh_stars>0
from django.conf.urls import url
from .views import do_search, filter
urlpatterns = [
url(r'^$', do_search, name='search'),
url(r'^filter/', filter, name='filter')
] | 1.875 | 2 |
examples/main.py | qenu/slash_util | 30 | 36603 | import discord
import slash_util
class SampleCog(slash_util.Cog):
@slash_util.slash_command(guild_id=123)
async def pog(self, ctx: slash_util.Context):
await ctx.send("pog", ephemeral=True)
@slash_util.message_command(guild_id=123)
async def quote(self, ctx: slash_util.Context, message: discor... | 2.359375 | 2 |
elkatip/elkatip.py | kompasim/elkatip | 8 | 36604 | # encoding=utf-8
# Elkatip
import os
import imp
# main class
class Elkatip():
api = None
gui = None
def __init__(self):
self.modulePath = os.path.dirname(__file__)
pass
def toExt(self, text):
if not self.api:
api = imp.load_source("api", self.modulePath + "/api.p... | 2.34375 | 2 |
src/model/hurdle_regression.py | SensorDX/rainqc | 1 | 36605 | from __future__ import absolute_import
from sklearn.exceptions import NotFittedError
from sklearn.neighbors import KernelDensity
from sklearn.linear_model import LinearRegression, LogisticRegression
import pickle
import os
import matplotlib.pylab as plt
from sklearn.externals import joblib
import numpy as np
from sklea... | 2.484375 | 2 |
mundo2/exercicio065.py | beatriznaimaite/Exercicios-Python-Curso-Em-Video | 0 | 36606 | """
Crie um programa que leia vários números inteiros pelo teclado. No final da execução, mostre a média entre
todos os valores e qual foi o maior e o menor valores lidos. O programa deve perguntar ao usuário se ele
quer ou não continuar a digitar valores.
"""
resposta = 'S'
cont = soma = maior = menor = media = 0
whi... | 4.3125 | 4 |
tpdata/templeplus/lib/templeplus/pymod.py | edoipi/TemplePlus | 0 | 36607 | import tpdp
class PythonModifier(tpdp.ModifierSpec):
def AddHook(self, eventType, eventKey, callbackFcn, argsTuple ):
self.add_hook(eventType, eventKey, callbackFcn, argsTuple)
def ExtendExisting(self, condName):
self.extend_existing(condName)
def AddItemForceRemoveHandler(self): # in charg... | 2.34375 | 2 |
utils/Network/base_Network_module.py | mohammedayub44/ObjectDetection | 0 | 36608 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
# --1.2.1
class one_conv(nn.Module):
def __init__(self, in_ch, out_ch, normaliz=False):
super(one_conv, self).__init__()
ops = []
ops += [nn.Conv2d(in_ch, out_ch, 3, padding=1)]
# ops += [nn.... | 2.8125 | 3 |
CTFd/constants/themes.py | nox237/CTFd | 3,592 | 36609 | <filename>CTFd/constants/themes.py
ADMIN_THEME = "admin"
DEFAULT_THEME = "core"
| 1.132813 | 1 |
mongodbhttpinterface/__main__.py | anrylu/mongodbhttpinterface | 0 | 36610 | <filename>mongodbhttpinterface/__main__.py
import json
from flask import Flask, request
from pymongo import MongoClient, ASCENDING, DESCENDING
from pymongo.errors import ConnectionFailure, ConfigurationError, OperationFailure, AutoReconnect
app = Flask(__name__)
mongo_connections = {}
@app.route('/_connect', methods=... | 2.90625 | 3 |
doc/examples/transform/plot_ransac.py | smheidrich/scikit-image | 1 | 36611 | """
=========================================
Robust line model estimation using RANSAC
=========================================
In this example we see how to robustly fit a line model to faulty data using
the RANSAC (random sample consensus) algorithm.
Firstly the data are generated by adding a gaussian noise to a ... | 3.4375 | 3 |
5 kyu/Memoized Fibonacci.py | mwk0408/codewars_solutions | 6 | 36612 | def fibonacci(n, res=[0,1]):
if len(res)<=n:
res.append(fibonacci(n-1)+fibonacci(n-2))
return res[n] | 3.75 | 4 |
crawler/crawler/spiders/all_591_cities.py | eala/tw-rental-house-data | 0 | 36613 | <reponame>eala/tw-rental-house-data<gh_stars>0
all_591_cities = [
{
"city": "台北市",
"id": "1"
},
{
"city": "新北市",
"id": "3"
},
{
"city": "桃園市",
"id": "6"
},
{
"city": "新竹市",
"id": "4"
},
{
"city": "新竹縣",
"id": "5"
},
{
"city": "基隆市",
"id": "2"
},
... | 1.40625 | 1 |
create_google_prior.py | AdrianNunez/zeroshot-action-recognition-action-priors | 3 | 36614 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
import os
import json
import logging
from googleapiclient.discovery import build
from tqdm import tqdm
from data import get_classes_ordered
logging.getLogger('googleapicliet.discovery_cache').setLevel(logging.ERROR)
variables_file = 'variables.json'
with open(variables_file) as f... | 2.421875 | 2 |
AoC2019/Day_2/Day_2.py | byarmis/AdventOfCode | 0 | 36615 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def part_1(program):
i = 0
while i < len(program):
opcode, a, b, dest = program[i:i+4]
i += 4
assert opcode in {1, 2, 99}, f'Unexpected opcode: {opcode}'
if opcode == 1:
val = program[a] + program[b]
elif opcod... | 3.421875 | 3 |
third_party/opencv_configs.bzl | zycv/edge-brain | 0 | 36616 | # Copyright 2021 Duan-JM, <NAME>
# 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,... | 1.25 | 1 |
treestructure.py | Mouedrhiri/Website-tree-structure | 1 | 36617 | <gh_stars>1-10
from bs4 import BeautifulSoup
import urllib.request
import xml.etree.ElementTree as ET
from tqdm import tqdm
from time import sleep
#Try With This Website http://igm.univ-mlv.fr/
LinksList = []
def progress(rang):
for i in tqdm(rang, desc ="Progress : "):
sleep(.1)
var=input(... | 2.984375 | 3 |
main.py | cecemel/fabbrikka-cart-service | 0 | 36618 | from flask import Flask, request, jsonify
import os, sys
import helpers, escape_helpers
import logging
import config
from rdflib.namespace import Namespace
##############
# INIT CONFIG
##############
CONFIG = config.load_config(os.environ.get('ENVIRONMENT', "DEBUG"))
app = Flask(__name__)
handler = logging.StreamHan... | 2.3125 | 2 |
pgmock/tests/test_examples.py | CloverHealth/pgmock | 54 | 36619 | """
This file illustrates a few examples of using pgmock with pytest.
A postgres testing database from pytest-pgsql (https://github.com/CloverHealth/pytest-pgsql)
is used and a fixture is created for using the mock context manager. This is the
preferred way of using pgmock, but it's also possible to render SQL yoursel... | 3 | 3 |
jsonserver.py | hellfyre/StratumsphereStatusBot | 0 | 36620 | # -*- coding: utf-8 -*-
__author__ = '<NAME> <<EMAIL>>'
import json
import BaseHTTPServer
import threading
from urlparse import parse_qs, urlparse
import status
callbacks = dict()
class JsonHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
print("path:", self.path)
if self.path ... | 2.5625 | 3 |
apps/permissions/views.py | yhkl-dev/JAutoOps | 0 | 36621 | from django.contrib.auth.models import Permission, Group
from rest_framework import viewsets, mixins, response, status
from rest_framework.generics import get_object_or_404
from .serializer import PermissionSerializer
from .common import get_permission_obj
from .filter import PermissionFilter
class PermissionsViews... | 2.078125 | 2 |
mrtarget/common/Redis.py | pieterlukasse/data_pipeline-1 | 0 | 36622 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import simplejson as json
from collections import Counter
import jsonpickle
from mrtarget.common import require_all
from mrtarget.common.connection import new_redis_client
jsonpickle.set_preferred_backend('simplejson')
import logging
import uuid
... | 2.0625 | 2 |
helpers/module_api_pages_manager.py | Maveo/Spark | 2 | 36623 | <filename>helpers/module_api_pages_manager.py
from typing import *
import discord
from helpers.exceptions import ModuleNotActivatedException
from webserver import Page
if TYPE_CHECKING:
from helpers.module_manager import ModuleManager
from helpers.spark_module import SparkModule
class ModuleApiPagesManager... | 2.21875 | 2 |
project/app/migrations/0006_housing_description.py | ryan-lam/hackupc2021 | 0 | 36624 | <gh_stars>0
# Generated by Django 3.2 on 2021-05-16 05:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0005_auto_20210515_1932'),
]
operations = [
migrations.AddField(
model_name='housing',
name='descri... | 1.578125 | 2 |
simpleml/utils/training/create_persistable.py | ptoman/SimpleML | 0 | 36625 | '''
Module with helper classes to create new persistables
'''
from abc import ABCMeta, abstractmethod
from simpleml.persistables.meta_registry import SIMPLEML_REGISTRY
from simpleml.datasets.base_dataset import Dataset
from simpleml.pipelines.base_pipeline import Pipeline
from simpleml.models.base_model import Model
fr... | 2.6875 | 3 |
drizzlepac/haputils/make_poller_files.py | check-spelling/drizzlepac | 28 | 36626 | #!/usr/bin/env python
"""Generates a poller file that will be used as input to runsinglehap.py, hapsequencer.py, runmultihap.py or
hapmultisequencer.py based on the files or rootnames listed user-specified list file.
USAGE
>>> python drizzlepac/haputils/make_poller_files.py <input filename> -[ost]
- input fil... | 2.46875 | 2 |
radloggerpy/tests/config/test_conf_fixture.py | Dantali0n/RadLoggerPy | 0 | 36627 | <gh_stars>0
# -*- encoding: utf-8 -*-
# Copyright (c) 2019 Dantali0n
#
# 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... | 2.234375 | 2 |
native/jni/external/selinux/python/sepolicy/sepolicy/templates/rw.py | Joyoe/Magisk-nosbin_magisk-nohide | 2 | 36628 | <reponame>Joyoe/Magisk-nosbin_magisk-nohide
# Copyright (C) 2007-2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# policygentool is a tool for the initial generation of SELinux policy
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Gene... | 1.085938 | 1 |
src/htmxl/compose/write/writer.py | schireson/htmxl | 2 | 36629 | <reponame>schireson/htmxl<filename>src/htmxl/compose/write/writer.py<gh_stars>1-10
"""A module dedicated to writing data to a workbook."""
import logging
from contextlib import contextmanager
import openpyxl.styles
from htmxl.compose.cell import Cell
from htmxl.compose.recording import Recording
from htmxl.compose.st... | 2.46875 | 2 |
punto/__init__.py | xu-hong/Punto | 0 | 36630 | """
Compartmentalize:
[ ascii art input ]
---------------
| maybe some |
| sort of auxillary |
| drawing program |
|
|
\ /
v
[ lex/parser ] --> [ translater ]
--------- ----------
| grammar | | notes literals|
| to numerical |
... | 1.492188 | 1 |
engine/tests/scenes/test_scenes.py | LloydTao/ecm3423-fur-effect | 0 | 36631 | import unittest
from ...scenes import Scene
class TestSceneMethods(unittest.TestCase):
def test_scene(self):
scene = Scene()
if __name__ == "__main__":
unittest.main()
| 2.09375 | 2 |
paper/F3/D_fixed_points.py | FedeClaudi/manyfolds | 3 | 36632 | <reponame>FedeClaudi/manyfolds<filename>paper/F3/D_fixed_points.py
import sys
import numpy as np
sys.path.append("./")
from vedo import screenshot
from vedo.shapes import Tube
from myterial import salmon
from manifold import embeddings, Plane
from manifold.visualize import Visualizer
from manifold import visualize
f... | 2.328125 | 2 |
everest/window/data/pile.py | rsbyrne/everest | 2 | 36633 | ###############################################################################
''''''
###############################################################################
from functools import cached_property
from collections import OrderedDict
from collections.abc import Sequence
from .channel import DataChannel
from .sp... | 2.21875 | 2 |
app/modules/entity/endpoint_entity.py | Clivern/Kevin | 2 | 36634 | <filename>app/modules/entity/endpoint_entity.py
"""
Endpoint Entity Module
"""
# Django
from django.contrib.auth.models import User
# local Django
from app.models import Endpoint
from app.models import Namespace
from app.models import Endpoint_Meta
from app.modules.util.helpers import Helpers
class Endpoint_Entity(... | 2.34375 | 2 |
src/krux/pages/home.py | odudex/krux | 0 | 36635 | <gh_stars>0
# The MIT License (MIT)
# Copyright (c) 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | 1.703125 | 2 |
src/main/python/main.py | ctmrbio/list_scanner | 0 | 36636 | <filename>src/main/python/main.py
#!/usr/bin/env python3.5
"""CTMR list scanner"""
__author__ = "<NAME>"
__date__ = "2018"
__version__ = "0.4.0b"
from datetime import datetime
from pathlib import Path
import sys
from fbs_runtime.application_context import ApplicationContext, cached_property
from PyQt5 import QtCore
f... | 2.140625 | 2 |
bento/loaders/noop.py | ARM-software/bento-linker | 20 | 36637 | <filename>bento/loaders/noop.py<gh_stars>10-100
#
# Default loader that doesn't do anything special
#
# Copyright (c) 2020, Arm Limited. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
from .. import loaders
import os
@loaders.loader
class NoOpLoader(loaders.Loader):
"""
A loader that does noth... | 2.3125 | 2 |
tests/cli/test_output_option.py | mohammad-sdsc/renku-python | 0 | 36638 | <filename>tests/cli/test_output_option.py
# -*- coding: utf-8 -*-
#
# Copyright 2019-2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License"... | 2.03125 | 2 |
backend/blog/util/config.py | o8oo8o/blog | 0 | 36639 | #!/usr/bin/evn python3
# coding=utf-8
import logging
import redis
from typing import Any
from conf import dev_conf as conf
from util import singleton
@singleton
class Config:
"""
根据指定的配置文件,把conf文件转换成字典
默认情况下使用 conf 中的配置
"""
def __init__(self):
self.config = conf
self.redis_db = N... | 2.25 | 2 |
rss/resources.py | victorchen796/reddit-submission-scraper | 0 | 36640 | import json
import os
script_path = os.path.abspath(__file__)
script_dir = os.path.split(script_path)[0]
def get_config():
rel_path = 'resources/config.json'
path = os.path.join(script_dir, rel_path)
with open(path, 'r') as f:
config = json.loads(f.read())
return config
def get_submissions... | 2.765625 | 3 |
tests/test/algorithms/convert/OsuToQua/test.py | Bestfast/reamberPy | 0 | 36641 | <reponame>Bestfast/reamberPy<filename>tests/test/algorithms/convert/OsuToQua/test.py
import unittest
from reamber.algorithms.convert.OsuToQua import OsuToQua
from reamber.osu.OsuMap import OsuMap
from tests.test.RSC_PATHS import *
# import logging
#
# logging.basicConfig(filename="event.log", filemode="w+", level=lo... | 2.34375 | 2 |
connection_events.py | Teplitsa/false-security-1 | 1 | 36642 | from flask import g
from flask_socketio import SocketIO, emit
from logic.game_manager import GameManager
from logic.player_manager import PlayerManager
from logic.player_logic import PlayerLogic
from globals import socketio, db
from session import SessionHelper, SessionKeys
from utils.response import Response
from uti... | 2 | 2 |
AgentsVisualization/Server/server.py | mateoglzc/TC2008B | 7 | 36643 | <reponame>mateoglzc/TC2008B<gh_stars>1-10
# TC2008B. Sistemas Multiagentes y Gráficas Computacionales
# Python flask server to interact with Unity. Based on the code provided by <NAME>.
# <NAME>. October 2021
from flask import Flask, request, jsonify
from RandomAgents import *
# Size of the board:
number_agents = 10
... | 2.828125 | 3 |
lrthubcore/ratings/admin.py | xrojan/lrthub-core | 0 | 36644 | from django.contrib import admin
from .models import Rating
# Register your models here.
@admin.register(Rating)
class RatingAdmin(admin.ModelAdmin):
date_hierarchy = 'created_on'
search_fields = ['user_id__username', 'value']
list_display = ('user_id', 'value',)
list_filter = ('user_id', 'value', 'is... | 1.710938 | 2 |
scitbx/math/tests/tst_gaussian.py | rimmartin/cctbx_project | 0 | 36645 | <reponame>rimmartin/cctbx_project
from __future__ import division
from scitbx.examples import immoptibox_ports
from scitbx.math import gaussian
from scitbx.array_family import flex
from libtbx.test_utils import approx_equal, eps_eq
from libtbx.utils import format_cpu_times
try:
import cPickle as pickle
except ImportE... | 1.867188 | 2 |
examples/application_commands/option_names.py | DiscPy/DiscPy | 2 | 36646 | import discpy
from discpy import commands
bot = commands.Bot(command_prefix='!')
# you can set "arg" keyword argument to the name of argument that represents the option in the command function
# and then change the option name as desired.
@bot.slash_command()
@discpy.application.option('sentence', arg='text', descrip... | 3.21875 | 3 |
huaweisms/api/monitoring.py | mcsarge/huawei-modem-python-api-client | 2 | 36647 | from huaweisms.api.common import get_from_url, ApiCtx
from .config import API_URL
def status(ctx: ApiCtx):
url = "{}/monitoring/status".format(API_URL)
return get_from_url(url, ctx)
| 2.25 | 2 |
accounts/migrations/0005_auto_20210104_0129.py | julesc00/CRM1 | 0 | 36648 | <reponame>julesc00/CRM1
# Generated by Django 3.1.4 on 2021-01-04 01:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_auto_20210103_1820'),
]
operations = [
migrations.RenameField(
model_name='order',
... | 1.671875 | 2 |
migrations/versions/221ccee39de7_add_role.py | MashSoftware/flux-api | 1 | 36649 | """add role
Revision ID: 221ccee39de7
Revises: <KEY>
Create Date: 2021-05-13 23:51:53.241485
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "221ccee39de7"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
... | 1.710938 | 2 |
httpclient.py | NErgezinger/CMPUT404-assignment-web-client | 0 | 36650 | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2016 <NAME>, https://github.com/tywtyw2002, and https://github.com/treedust
#
# 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:/... | 3.328125 | 3 |
xpdacq/devices.py | xpdAcq/xpdAcq | 3 | 36651 | """Wrappers for the ophyd devices."""
from ophyd import Device, Signal
from ophyd import Kind
from ophyd.device import Component as Cpt
class CalibrationData(Device):
"""A device to hold pyFAI calibration data."""
dist = Cpt(Signal, value=1., kind=Kind.config)
poni1 = Cpt(Signal, value=0., kind=Kind.confi... | 2.328125 | 2 |
tests/unit/model_selection/test_model_selection.py | ambader/hcrystalball | 139 | 36652 | import numpy as np
import pytest
from sklearn.dummy import DummyRegressor
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import Pipeline
from hcrystalball.metrics import get_scorer
from hcrystalball.model_selection import FinerTimeSplit
from hcrystalball.model_selection import get_best_not_fail... | 2.203125 | 2 |
ppci/cli/yacc.py | jsdelivrbot/ppci-mirror | 0 | 36653 | <filename>ppci/cli/yacc.py
""" Parser generator utility.
This script can generate a python script from a grammar description.
Invoke the script on a grammar specification file:
.. code::
$ ppci-yacc test.x -o test_parser.py
And use the generated parser by deriving a user class:
.. code::
import test_par... | 2.828125 | 3 |
imdb/imdb.py | santhoshse7en/IMDb | 1 | 36654 | <filename>imdb/imdb.py
# Movie Related Information
from imdb.parser.character.search_character_id import search_character_id
from imdb.parser.company.search_company_id import search_company_id
from imdb.parser.event.search_event_id import search_event_id
from imdb.parser.movie.company import company
from imdb.parser.mo... | 2.0625 | 2 |
authors/apps/profiles/migrations/0022_auto_20190123_1211.py | andela/ah-django-unchained | 0 | 36655 | <filename>authors/apps/profiles/migrations/0022_auto_20190123_1211.py
# Generated by Django 2.1.4 on 2019-01-23 12:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0021_auto_20190122_1723'),
]
operations = [
migrations.Alt... | 1.328125 | 1 |
squidpy/instruments/srs.py | guenp/squidpy | 0 | 36656 | from squidpy.instrument import Instrument
import visa
class SR830(Instrument):
'''
Instrument driver for SR830
'''
def __init__(self, gpib_address='', name='SR830'):
self._units = {'amplitude': 'V', 'frequency': 'Hz'}
self._visa_handle = visa.ResourceManager().open_resource(gpib_address... | 2.3125 | 2 |
src/hbcomp/app.py | zgoda/hbcomp | 0 | 36657 | import os
from logging.config import dictConfig
from typing import Optional
from flask import render_template, request, send_from_directory
from flask_babel import get_locale, lazy_gettext as _
from werkzeug.utils import ImportStringError
from .auth import auth_bp
from .comp import comp_bp
from .ext import babel, csr... | 1.945313 | 2 |
lib/taurus/external/test/test_qt.py | MikeFalowski/taurus | 0 | 36658 | # -*- coding: utf-8 -*-
##############################################################################
##
## This file is part of Taurus
##
## http://taurus-scada.org
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
## Taurus is free software: you can redistribute it and/or modify
## it under the te... | 1.695313 | 2 |
tools/stage2/infer_cam.py | yaoqi-zd/SGAN | 48 | 36659 | import os, pickle
import os.path as osp
import numpy as np
import cv2
import scipy.ndimage as nd
import init_path
from lib.dataset.get_dataset import get_dataset
from lib.network.sgan import SGAN
import torch
from torch.utils.data import DataLoader
import argparse
from ipdb import set_trace
import matplotlib.pyplot as... | 2.25 | 2 |
python/lib/behaviors/compute.py | newrelic-experimental/demo-pythontron | 0 | 36660 | <filename>python/lib/behaviors/compute.py
from random import seed, random
from math import sqrt, log, cos, pi, ceil
import time
import json
from . import behavior
from ..app_logging import AppLogging
MAX_KEY = "max"
MIN_KEY = "min"
class Compute(behavior.Behavior):
def __init__(self, value):
super().__init__("C... | 3.015625 | 3 |
tests/st/model_zoo_tests/ncf/test_ncf.py | ATestGroup233/mindspore | 1 | 36661 | <reponame>ATestGroup233/mindspore
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 1.726563 | 2 |
src/data/tests/test_osm_create_maps.py | j-t-t/crash-model | 0 | 36662 | import os
import shutil
from shapely.geometry import Polygon
from .. import osm_create_maps
from .. import util
TEST_FP = os.path.dirname(os.path.abspath(__file__))
def test_get_width():
assert osm_create_maps.get_width('15.2') == 15
assert osm_create_maps.get_width('') == 0
assert osm_create_maps.get_wi... | 2.296875 | 2 |
megnet/tests/test_losses.py | abdalazizrashid/megnet | 0 | 36663 | import unittest
import numpy as np
import tensorflow as tf
from megnet.losses import mean_squared_error_with_scale
class TestLosses(unittest.TestCase):
def test_mse(self):
x = np.array([0.1, 0.2, 0.3])
y = np.array([0.05, 0.15, 0.25])
loss = mean_squared_error_with_scale(x, y, scale=100)... | 2.96875 | 3 |
forbidden/forbidden.py | ukabes/forbidden | 0 | 36664 | <reponame>ukabes/forbidden
'''#The Forbidden module
---
The idea is simple;
1. Take a python data structure ( only dicts and lists for now )
and then return a serialized text format called *forbidden*.
2. Take an already serialized *forbidden* format and return the appropriate python data structure.
---
Examples:
---... | 2.765625 | 3 |
googledataprocauthenticator/tests/test_dataprocmagic.py | mollypi/dataprocmagic | 2 | 36665 | <filename>googledataprocauthenticator/tests/test_dataprocmagic.py
# 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
#
# https://www.apache.org/licenses/LICENSE-2... | 2.140625 | 2 |
p2p.py | barisser/hashfate | 0 | 36666 | import datetime
import requests
import socket
import random
import sys
import time
def now():
a=datetime.fromtimestamp(time.time())
return a.strftime("%H:%M:%S %Y-%m-%d")
def getmyip():
a=requests.get('http://checkip.dyndns.org')
a=a.content
b=a[76:89]
return b
class node:
def __init__... | 2.921875 | 3 |
odps/models/resource.py | nurikk/aliyun-odps-python-sdk | 0 | 36667 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1.953125 | 2 |
src/rust/iced-x86-py/src/iced_x86/CC_g.py | clayne/iced | 1,018 | 36668 | # SPDX-License-Identifier: MIT
# Copyright (C) 2018-present iced project and contributors
# ⚠️This file was generated by GENERATOR!🦹♂️
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
"""
Mnemonic condition code selector (eg. ``JG`` / ``JNLE``)
"""
import typing
if t... | 1.765625 | 2 |
python/foglamp/plugins/south/http_south/http_south.py | ashwinscale/FogLAMP | 0 | 36669 | <gh_stars>0
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
"""HTTP Listener handler for sensor readings"""
import asyncio
import copy
import sys
from aiohttp import web
from foglamp.common import logger
from foglamp.common.web import middleware
from foglamp.plugins.commo... | 2.109375 | 2 |
roberta/inference/run_classifier_infer_cv.py | LiRunyi2001/cnSoftBei | 1 | 36670 | <filename>roberta/inference/run_classifier_infer_cv.py
"""
This script provides an exmaple to wrap UER-py for classification inference (cross validation).
"""
import sys
import os
import argparse
import torch
import torch.nn as nn
import numpy as np
uer_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "... | 2.28125 | 2 |
uis/horsy_package.py | horsy-ml/horsy | 0 | 36671 | <filename>uis/horsy_package.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\RAZNOE\prgrming\horsy\Source\client\uis\horsy_package.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edi... | 2.09375 | 2 |
tiledb/tests/test_pandas_dataframe.py | Shelnutt2/TileDB-Py | 0 | 36672 | <reponame>Shelnutt2/TileDB-Py
from __future__ import absolute_import
try:
import pandas as pd
import pandas._testing as tm
import_failed = False
except ImportError:
import_failed = True
import unittest, os
import warnings
import string, random, copy
import numpy as np
from numpy.testing import assert... | 2.40625 | 2 |
day11/test_lib.py | heijp06/AoC-2021 | 0 | 36673 | <reponame>heijp06/AoC-2021<gh_stars>0
import pytest
from lib import flashing_neighbours, part1, part2
def test_part1():
assert part1(data) == 1656
def test_part2():
assert part2(data) == 195
@pytest.mark.parametrize("steps", range(1, 3))
def test_part1_small(steps):
assert part1(small, steps=1) == 9
... | 2.40625 | 2 |
data/external/repositories/178307/kaggle-otto-master/predictor.py | Keesiu/meta-kaggle | 0 | 36674 | <filename>data/external/repositories/178307/kaggle-otto-master/predictor.py
import pandas as pd
import numpy as np
from sklearn import ensemble, calibration, metrics, cross_validation
from sklearn import feature_extraction, preprocessing
import xgboost as xgb
import keras.models as kermod
import keras.layers.core as ke... | 2.578125 | 3 |
pyeem/instruments/horiba/__init__.py | drewmee/PyEEM | 4 | 36675 | <reponame>drewmee/PyEEM<filename>pyeem/instruments/horiba/__init__.py<gh_stars>1-10
from .aqualog import Aqualog
from .fluorolog import Fluorolog
name = "Horiba"
instruments = [Aqualog, Fluorolog]
| 1.171875 | 1 |
Model/Download2Mp3.py | BETRU21/DownloadToMp3 | 0 | 36676 | <gh_stars>0
import youtube_dl
class Download2Mp3:
def __init__(self, CallableHook=None):
self.hook = CallableHook
self.notDownloaded = []
self.setupDownloadParam()
# Public functions
def downloadMusicFile(self, url):
if type(url) is not str:
raise TypeError("ur... | 2.828125 | 3 |
src/Python/01_Interakcja_z_konsola/Zad7.py | djeada/Nauka-programowania | 3 | 36677 | <reponame>djeada/Nauka-programowania<filename>src/Python/01_Interakcja_z_konsola/Zad7.py
if __name__ == "__main__":
"""
Pobierz podstawe i wysokosc trojkata i wypisz pole.
"""
print("podaj podstawe i wysokosc trojkata:")
a = int(input())
h = int(input())
print(
"pole trojkata o p... | 3.359375 | 3 |
message/models.py | bopopescu/storyboard | 0 | 36678 | #!/usr/bin/env python
# encoding: utf-8
"""
models.py
Created by <NAME> on 2012-03-03.
Copyright (c) 2012 Close To U. All rights reserved.
"""
from django.db import models
from django.contrib.auth.models import User
# class Message(models.Model):
# key = models.AutoField(primary_key=True)
# title = models.Ch... | 2.21875 | 2 |
model_helpers.py | Dantistnfs/binerals-classification-task | 0 | 36679 | <gh_stars>0
"""
Helper functions for model training, loading, testing etc
"""
import pickle
import tqdm
import torch
import numpy as np
def train(t_model, optimizer, loss_function, train_dataset,
validation_dataset):
epoch = 0
while 1:
epoch += 1
train_loss = 0.0
train_accu ... | 2.5 | 2 |
camera/PIR_camera.py | jutako/raspi | 0 | 36680 | #!/usr/bin/python
import RPi.GPIO as GPIO
from picamera import PiCamera
import time
import datetime
PIN = 12
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIN, GPIO.IN)
camera = PiCamera()
camera.rotation = 180
camera.resolution = (1024, 576)
#camera.start_preview()
#sleep(20)
#camera.stop_preview()
while True:
time.s... | 3.1875 | 3 |
ca_node/scripts/ranking_controller.py | hidmic/create_autonomy | 0 | 36681 | <gh_stars>0
#!/usr/bin/env python
import rospy
import threading
from ca_msgs.msg import Bumper
from geometry_msgs.msg import Twist, Vector3
class StateMachine(object):
def __init__(self):
self.pub = rospy.Publisher("/cmd_vel", Twist, queue_size=10)
self.goal_queue = []
def rotate(self, ang_vel):
self... | 2.296875 | 2 |
LeetCode/python3/1025.py | ZintrulCre/LeetCode_Archiver | 279 | 36682 | class Solution:
def divisorGame(self, N: int) -> bool:
return True if N % 2 == 0 else False | 3.203125 | 3 |
gabbi/exception.py | scottwallacesh/gabbi | 145 | 36683 | #
# 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, software
# distributed under... | 1.6875 | 2 |
music/filename.py | JohanLi/uncharted-waters-2-research | 0 | 36684 | <gh_stars>0
import os
path = './converted/'
for filename in os.listdir(path):
newFilename = filename.lower().replace(' ', '-').replace('’', '')
os.rename(path + filename, path + newFilename.lower())
then = os.listdir(path)
print(then)
| 2.953125 | 3 |
django_rest_resetpassword/tests.py | fasfoxcom/django-rest-resetpassword | 4 | 36685 | from django.conf import settings
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework.test import APITestCase
class BaseAPITest(APITestCase):
def setUp(self, password=None) -> None:
self.user = User(username="John Smith", email="<EMAIL>")
self.user.set_pa... | 2.453125 | 2 |
day2/netmiko_ex1rudy.py | rudy5rudy/pynet-ons-feb19 | 0 | 36686 | #!/usr/bin/env python
"""Exercises using Netmiko"""
from __future__ import print_function
from getpass import getpass
from netmiko import ConnectHandler
#def save_file(filename, show_run):
# """Save the show run to a file"""
# with open(filename, "w") as f:
# f.write(show_run)
def main():
"""Exerci... | 3.21875 | 3 |
tests/test_pytorch.py | szymonmaszke/torchtraining | 3 | 36687 | """Core pytorch operations regarding optimization (optimize, schedule) are placed in general tests."""
import pytest
import torch
import torchtraining.pytorch as P
def test_backward():
backward = P.Backward()
x = torch.randn(10, requires_grad=True)
y = x ** 2
backward(y.sum())
assert x.grad is not... | 2.546875 | 3 |
tests/protein_test.py | LauraKaschnitz/advanced_python_2021-22_HD | 0 | 36688 | <gh_stars>0
import sys
from pathlib import Path
# -------- START of inconvenient addon block --------
# This block is not necessary if you have installed your package
# using e.g. pip install -e (requires setup.py)
# or have a symbolic link in your sitepackages (my preferend way)
sys.path.append(
str(Path(__file__)... | 2.25 | 2 |
src/treq/test/test_utils.py | chevah/treq | 20 | 36689 | <reponame>chevah/treq
import mock
from twisted.trial.unittest import TestCase
from treq._utils import default_reactor, default_pool, set_global_pool
class DefaultReactorTests(TestCase):
def test_passes_reactor(self):
mock_reactor = mock.Mock()
self.assertEqual(default_reactor(mock_reactor), moc... | 2.359375 | 2 |
pygments_lexer_solidity/lexer.py | veox/pygments-lexer-solidity | 2 | 36690 | <filename>pygments_lexer_solidity/lexer.py
# -*- coding: utf-8 -*-
"""
pygments.lexers.solidity
~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Solidity language.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer i... | 1.679688 | 2 |
challenge 10/Calculator.py | caroldf07/100daysofcode-python | 1 | 36691 | logo = """
_____________________
| _________________ |
| | Pythonista 0. | | .----------------. .----------------. .----------------. .----------------.
| |_________________| | | .--------------. || .--------------. || .--------------. || .--------------. |
| ___ ___ ___ ___ | | | ______ | || | ... | 1.78125 | 2 |
env/lib/python3.7/site-packages/materialx/emoji.py | ritchadh/docs-like-code-demo | 0 | 36692 | """
Emoji extras for Material.
Override the indexes with an extended version that includes short names for Material icons, FontAwesome, etc.
"""
import os
import glob
import copy
import codecs
import inspect
import material
import pymdownx
from pymdownx.emoji import TWEMOJI_SVG_CDN, add_attriubtes
import xml.etree.Ele... | 2.296875 | 2 |
2rd.py | chidanandpujar/Python_scripts | 0 | 36693 | <filename>2rd.py
fd = open('f',"r")
buffer = fd.read(2)
print("first 2 chars in f:",buffer)
fd.close()
| 2.734375 | 3 |
availability/__init__.py | Leader0721/ManyIP | 629 | 36694 | <gh_stars>100-1000
# -*- coding: UTF-8 -*-
import config
import gevent
import availability.check
from persistence import persister
import time
def crawl_worker(queue_verification, queue_persistence):
"""
爬取下来的代理检测可用性的进程
:param queue_verification: 待验证代理队列
:param queue_persistence: 已验证待保存代理队列
:retur... | 2.59375 | 3 |
tests/heuristics/test_dataset_id_heuristic.py | HPI-Information-Systems/TimeEval | 2 | 36695 | <reponame>HPI-Information-Systems/TimeEval<filename>tests/heuristics/test_dataset_id_heuristic.py
import unittest
import tests.fixtures.heuristics_fixtures as fixtures
from timeeval.heuristics import DatasetIdHeuristic
class TestDatasetIdHeuristic(unittest.TestCase):
def test_heuristic(self):
heuristic =... | 2.328125 | 2 |
src/grokcore/component/tests/adapter/importedmodel.py | zopefoundation/grokcore.component | 1 | 36696 | <reponame>zopefoundation/grokcore.component
"""
Imported model and adapter won't be grokked:
>>> import grokcore.component as grok
>>> grok.testing.grok(__name__)
>>> from grokcore.component.tests.adapter.adapter import IHome
>>> cave = Cave()
>>> home = IHome(cave)
Traceback (most recent call last):
.... | 1.828125 | 2 |
tools/intogen/runtime/pyenv/lib/python2.7/site-packages/wok/core/utils/proxies.py | globusgenomics/galaxy | 1 | 36697 | # from http://www.voidspace.org.uk/python/weblog/arch_d7_2007_03_17.shtml#e664
def ReadOnlyProxy(obj):
class _ReadOnlyProxy(object):
def __getattr__(self, name):
return getattr(obj, name)
def __setattr__(self, name, value):
raise AttributeError("Attributes can't be set on t... | 2.421875 | 2 |
donkeycar/parts/pigpio_enc.py | asepnh/donkeycar | 0 | 36698 | import pigpio
import time
class OdomDist(object):
"""
Take a tick input from odometry and compute the distance travelled
"""
def __init__(self, mm_per_tick, debug=False):
self.mm_per_tick = mm_per_tick
self.m_per_tick = mm_per_tick / 1000.0
self.meters = 0
self.last_time... | 3.53125 | 4 |
huaweicloud-sdk-iotda/huaweicloudsdkiotda/v5/model/action_smn_forwarding.py | wuchen-huawei/huaweicloud-sdk-python-v3 | 1 | 36699 | # coding: utf-8
import pprint
import re
import six
class ActionSmnForwarding:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the valu... | 2.3125 | 2 |