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/datasets/imagenet_r.py | mmatena/wise-ft | 79 | 46400 | import os
import torch
import torchvision.datasets as datasets
from .imagenet import ImageNetSubsample, ImageNetSubsampleValClasses
import numpy as np
CLASS_SUBLIST = [
1, 2, 4, 6, 8, 9, 11, 13, 22, 23, 26, 29, 31, 39, 47, 63, 71, 76, 79, 84, 90, 94, 96, 97, 99, 100, 105, 107,
113, 122,
125, 130, 132, 14... | 2.390625 | 2 |
src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/a/lib.py | alex729/RED | 375 | 46401 | <filename>src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/a/lib.py<gh_stars>100-1000
def kw1():
pass | 1 | 1 |
HujiBot/extendblock.py | PersianWikipedia/fawikibot | 12 | 46402 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot retreives a list of long term IP blocks on the wiki and tries to
identify if any of them are proxies. If so, it extends the block for another
year.
"""
#
# (C) User:<NAME>, 2019
# (C) User:Huji, 2019
#
# Distributed under the terms of the CC-BY-SA license.
#
from _... | 2.390625 | 2 |
src/backend/main.py | fellowmate/docs-storage | 0 | 46403 | from backend.create_app import create_app
application = create_app()
| 1.1875 | 1 |
Module2/myprg1.py | vishalnalwa/DAT210x-master---Old | 0 | 46404 | <reponame>vishalnalwa/DAT210x-master---Old
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 17:14:36 2017
@author: m037382
"""
import pandas as pd
df = pd.read_html('http://www.espn.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2')
df1 = pd.concat(df)
df1.columns = ['RK', 'PLAYER', 'TEAM'... | 2.515625 | 3 |
tests/basic_test.py | LE-LOY/socialsims | 0 | 46405 | <gh_stars>0
# from ..sims.deprecated.cat_mouse import data_visualizer as cat_mouse_vis
# from ..sims.deprecated.route_choice import data_visualizer as route_choice_vis
# from ..sims.deprecated.simple_migration import data_visualizer as simple_mig_vis
"""
@pytest.mark.skip(reason="deprecated")
def test_cat_mouse_visual... | 1.640625 | 2 |
loldib/getratings/models/NA/na_pantheon/na_pantheon_bot.py | koliupy/loldib | 0 | 46406 | from getratings.models.ratings import Ratings
class NA_Pantheon_Bot_Aatrox(Ratings):
pass
class NA_Pantheon_Bot_Ahri(Ratings):
pass
class NA_Pantheon_Bot_Akali(Ratings):
pass
class NA_Pantheon_Bot_Alistar(Ratings):
pass
class NA_Pantheon_Bot_Amumu(Ratings):
pass
class NA_Pantheon_Bot_Anivia(... | 1.359375 | 1 |
backend/tests/unit/client/models/test_utils.py | sdediego/blockchain | 0 | 46407 | # encoding: utf-8
from unittest.mock import Mock, patch
from src.client.models import utils
from src.exceptions import WalletError
from tests.unit.logging import LoggingMixin
class ClientUtilsTest(LoggingMixin):
def setUp(self):
self.data = {'test_data_key': 'test_data_value'}
def test_get_utcnow_... | 2.40625 | 2 |
assemblyline/al_ui/apiv3/hash_search.py | dendisuhubdy/grokmachine | 46 | 46408 | from flask import request
from assemblyline.common.concurrency import execute_concurrently
from assemblyline.common.importing import module_attribute_by_name
from al_ui.api_base import api_login, make_api_response
from al_ui.apiv3 import core
from al_ui.config import LOGGER, config
from assemblyline.al.datasource.comm... | 1.742188 | 2 |
Plugins/Aspose-Slides-Java-for-Jython/asposeslides/WorkingWithPresentation/Zoom.py | tienph91/Aspose.Slides-for-Java | 27 | 46409 | from asposeslides import Settings
from com.aspose.slides import Presentation
from com.aspose.slides import SaveFormat
from com.aspose.slides import XpsOptions
class Zoom:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithPresentation/Zoom/'
# Create an instance of Pres... | 2.890625 | 3 |
lidardet/models/trajectory_predictor/header.py | Jiaolong/trajectory-prediction | 6 | 46410 | <gh_stars>1-10
import torch
from torch import nn
from .mtp import MTP
from .covernet import CoverNet
from .backbone import conv3x3
class Header(nn.Module):
def __init__(self, cfg):
super(Header, self).__init__()
self.cfg = cfg
self.use_bn = cfg.use_bn
self.with_attention = cfg.wit... | 2.0625 | 2 |
lib/gen_robot_valid.py | hyche/openbmc-test-automation | 0 | 46411 | #!/usr/bin/env python
r"""
This file contains functions useful for validating variables in robot.
"""
import gen_robot_print as grp
import gen_valid as gv
from robot.libraries.BuiltIn import BuiltIn
from robot.api import logger
def rvalid_value(var_name,
invalid_values=[],
valid_v... | 3.296875 | 3 |
python/common/fileIO/pcsPath.py | CountZer0/PipelineConstructionSet | 21 | 46412 | <filename>python/common/fileIO/pcsPath.py
'''
Author: Jason.Parks
Created: April 17, 2012
Module: common.fileIO.Path
Purpose: custom Path class wrapper
'''
from common.fileIO.path import *
import os, stat
import sys
class Path(path):
'''
PipelineConstructionSet sub-class of pymel's path class (which came from Jason... | 2.734375 | 3 |
server.py | Tythos/tox | 0 | 46413 | import cherrypy
import os
hostIp = "127.0.0.1"
portNumber = 1337
class ImpulseServer(object):
def get_path(self, data_path):
return os.path.dirname(os.path.realpath(__file__)) + os.sep + data_path
@cherrypy.expose
def index(self):
main_path = self.get_path('main.html')
with open(main_path, "r") as f:
ret... | 2.46875 | 2 |
BacklogPy/api/stars.py | koxudaxi/BacklogPy | 4 | 46414 | # coding: utf-8
"""
This file was created by Backlog APIGenerator
"""
from __future__ import unicode_literals, absolute_import
from BacklogPy.base import BacklogBase, SUFFIX_JP
class Stars(BacklogBase):
def __init__(self, space_id, api_key, suffix=SUFFIX_JP):
super(Stars, self).__init__(space_id, ... | 2.265625 | 2 |
Projects/Continuous_Control/data_handling.py | whiterabbitobj/udacity-deep-reinforcement-learning | 1 | 46415 | # -*- coding: utf-8 -*-
import sys
import numpy as np
import time
from utils import print_bracketing, check_dir
import argparse
import torch
import os.path
import re
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
class Saver():
"""
Handles the saving of checkpoints a... | 2.65625 | 3 |
ariadne_django/__init__.py | drewsynan/ariadne_django | 34 | 46416 | <reponame>drewsynan/ariadne_django<filename>ariadne_django/__init__.py
import django
if django.VERSION < (3, 2):
default_app_config = "ariadne_django.apps.AriadneDjangoConfig"
| 1.5 | 2 |
extension/__init__.py | Gilgamesh666666/Dgr-ncnet | 0 | 46417 | <filename>extension/__init__.py
from extension.knn import knnModule
from extension.sms import soft_mutual_score_Module
from extension.sms_On import soft_mutual_score_Module_On | 1.171875 | 1 |
pytorch_forecasting/metrics/__init__.py | smetam/pytorch-forecasting | 0 | 46418 | """
Metrics for (mulit-horizon) timeseries forecasting.
"""
from pytorch_forecasting.metrics.base_metrics import (
DistributionLoss,
Metric,
MultiHorizonMetric,
MultiLoss,
MultivariateDistributionLoss,
convert_torchmetric_to_pytorch_forecasting_metric,
)
from pytorch_forecasting.metrics.distrib... | 1.5625 | 2 |
0x11-python-network_1/8-json_api.py | coding-max/holbertonschool-higher_level_programming | 1 | 46419 | <gh_stars>1-10
#!/usr/bin/python3
"""sends a POST request to http://0.0.0.0:5000/search_user
with a passed letter as a parameter"""
from sys import argv
from requests import post
if __name__ == '__main__':
q = ""
if len(argv) == 2:
q = argv[1]
try:
request = post('http://0.0.0.0:5000/se... | 3.390625 | 3 |
tests/events/test_consumer.py | promulo/pinga | 0 | 46420 | import json
from unittest.mock import ANY, MagicMock, call, patch
from pinga.events.consumer import Consumer
@patch("pinga.events.consumer.get_db_conn")
@patch("pinga.events.consumer.save_event")
@patch("pinga.events.consumer.get_logger")
@patch(
"pinga.events.consumer.KafkaConsumer",
return_value=[
... | 2.53125 | 3 |
data_processing.py | husmen/NaiveBayesClassifier | 0 | 46421 | <gh_stars>0
""" DOCSTRING """
import os
import re
import io
# Simport math as calc
#from itertools import izip, islice, tee
from random import randint
import sys
import jpype
from snowballstemmer import stemmer
#import nltk
from nltk.util import ngrams
sys.path.append('./turkish-stemmer-python')
from TurkishStemmer i... | 2.578125 | 3 |
pydebloatx/app.py | space9bug/PyDebloatX | 0 | 46422 | from PySide6.QtCore import Qt, QThread, Signal, QPoint, QRect, QLocale, QTranslator, QCoreApplication, QThreadPool, \
QObject, QRunnable
from PySide6.QtGui import QCursor, QPixmap, QIcon, QFont
from PySide6.QtWidgets import QApplication, QMessageBox
from gui_about import Ui_AboutWindow
from gui_main import Ui_MainW... | 2.109375 | 2 |
bot/channel_class.py | CodeM01/Discordio | 0 | 46423 | import json_and_dictionary_constructor
class Channel:
def __init__(self, user, channel_id):
self.channel_id = channel_id
self.user = user
async def send(self, message):
http_template = dictionary_templates.http_load
message_template = dictionary_templates.new_message
... | 2.671875 | 3 |
software/python/addons/remote_console/server_demo.py | ltstein/SCUTTLE | 0 | 46424 | # This file is just a basic example of the server comunication structure to a client program.
# The server is run on the embedded computer and passes data to a client on your local pc
# over a direct wifi connection. This can be used to display telemetry.
import time
import json
import socket
def current_time(start_... | 3.4375 | 3 |
session.py | unidavemeyer/web-adventure | 0 | 46425 | # session-related machinery (tracks player state)
import collections
import glob
import hashlib
import os
import random
import secrets
import server
import yaml
class Session:
"""Information about the state for a single player"""
s_cIterHash = 100000
s_algoHash = 'sha256'
def __init__(self):
... | 2.734375 | 3 |
src/f451_comms/providers/mailgun.py | mlanser/f451-comms | 0 | 46426 | <reponame>mlanser/f451-comms<filename>src/f451_comms/providers/mailgun.py
"""Mailgun (email) class for f451 Communications module.
This module adds an abstraction layer for the Mailgun email services and the main
purpose is to provide a standard interface for some core methods for sending
emails (with or without attac... | 2.53125 | 3 |
q1pulse/lang/loops.py | sldesnoo-Delft/q1pulse | 1 | 46427 | <gh_stars>1-10
from numbers import Number
from .math_expressions import get_dtype
from .register import Register
from .exceptions import Q1ValueError, Q1TypeError
class LoopVar(Register):
def __init__(self, name, loop, **kwargs):
super().__init__(name, **kwargs)
self._loop = loop
class Loop:
... | 2.5 | 2 |
modules/lib/colors.py | OSSSP/pyrecon | 2 | 46428 | #!/usr/bin/python3
class colors:
"""Colored terminal outputs"""
# Colors can be added and they will be loaded throughout the program
# To output "test" in green:
# print(colors.GREEN + "test" + colors.RESET)
# print({1}test{0}.format(colors.RESET, colors.GREEN))
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\0... | 3.546875 | 4 |
cloudrail/knowledge/context/aws/networking_config/inetwork_configuration.py | my-devops-info/cloudrail-knowledge | 0 | 46429 | from abc import abstractmethod
from typing import List
from cloudrail.knowledge.context.aws.networking_config.network_configuration import NetworkConfiguration
class INetworkConfiguration:
@abstractmethod
def get_all_network_configurations(self) -> List[NetworkConfiguration]:
pass
| 2.078125 | 2 |
apis/betterself/v1/signout/views.py | jeffshek/betterself | 98 | 46430 | <filename>apis/betterself/v1/signout/views.py
from django.contrib.auth import logout
from django.views.generic import RedirectView
class SessionLogoutView(RedirectView):
"""
A view that will logout a user out and redirect to homepage.
"""
permanent = False
query_string = True
pattern_name = 'h... | 2.46875 | 2 |
mayan/apps/common/tests/test_classes.py | atitaya1412/Mayan-EDMS | 343 | 46431 | from django.db import models
from mayan.apps.testing.tests.base import BaseTestCase
from ..classes import QuerysetParametersSerializer
class QuerysetParametersSerializerTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.TestModelParent = self._create_test_model(
model_name... | 2.125 | 2 |
exp_figure/figure_2(grey).py | qqxx6661/LDSM | 4 | 46432 | import matplotlib.pyplot as plt
import numpy as np
def autolabel(rects):
for rect in rects:
height = rect.get_height()
plt.text(rect.get_x()+rect.get_width()/2., 1.03*height, "%s" % float(height))
text = ["10.65x", "57.62x", "54.44x"]
def autolabel_user(rects):
for i, rect in enumerate(rects... | 3.421875 | 3 |
benchmarks/benchmark_functions/machine_learning.py | PennyLaneAI/benchmark | 2 | 46433 | <reponame>PennyLaneAI/benchmark
# Copyright 2018-2021 Xanadu Quantum Technologies 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
# Unle... | 2.546875 | 3 |
service_catalog/tables/global_hook_tables.py | LaudateCorpus1/squest | 112 | 46434 | from django_tables2 import TemplateColumn
from service_catalog.models import GlobalHook
from Squest.utils.squest_table import SquestTable
class GlobalHookTable(SquestTable):
state = TemplateColumn(template_name='custom_columns/global_hook_state.html')
actions = TemplateColumn(template_name='custom_columns/gl... | 2.09375 | 2 |
tests/console/input/testinput.py | LowieHuyghe/scriptcore | 0 | 46435 | <reponame>LowieHuyghe/scriptcore
from scriptcore.testing.testcase import TestCase
from scriptcore.console.input.input import Input
import mock
import sys
class TestInput(TestCase):
def test_default(self):
"""
Test default input
:return: void
"""
description = self.ran... | 2.8125 | 3 |
django/axf/app/migrations/0004_remove_usermodel_ticket.py | zhang15780/web_project | 0 | 46436 | <filename>django/axf/app/migrations/0004_remove_usermodel_ticket.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-08 01:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0003_usermodel_ticket'),
... | 1.429688 | 1 |
keras/layers/reshaping/up_sampling1d.py | itsraina/keras | 0 | 46437 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.984375 | 3 |
app/User/index.py | OpenHill/OpenHi | 0 | 46438 | <reponame>OpenHill/OpenHi
from app.models.DB.mainDB import Post, User
from . import user
from flask import render_template
@user.route("/")
def n():
postlist = Post.query.filter().first()
print(postlist.user.nikename)
userlist = User.query.filter().first()
print(userlist.post)
return "app"
| 2.078125 | 2 |
gfg/hashing/print_tree_vertically.py | rrwt/daily-coding-challenge | 1 | 46439 | <filename>gfg/hashing/print_tree_vertically.py<gh_stars>1-10
"""
Given a binary tree, print it vertically. e.g.
1
/ \
2 3
/ \ / \
4 5 6 7
/ \
8 9
The output of print this tree vertically will be:
4
2
1 5 6
3 8
7
9
"""
f... | 4.1875 | 4 |
main.py | NilaiVemula/empty-my-fridge | 0 | 46440 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Main script for Empty My Fridge project. Provides a CLI for the Spoonacular API.
"""
import requests
from rich.console import Console
import config
def get_missing_ingredients(available_ingredients, amount_recipes):
"""
:param available_ingredients: comma ... | 3.328125 | 3 |
tests/test_mparser.py | Dih5/zadeh | 2 | 46441 | <reponame>Dih5/zadeh
import zadeh
import os
def test_parse():
"""Load an external .fis file"""
fis = zadeh.FIS.from_matlab(os.path.join(os.path.dirname(os.path.abspath(__file__)), "data", "tipper.fis"))
assert isinstance(fis.get_crisp_output({"food": 5, "service": 5}), float)
| 2.296875 | 2 |
rest/availability.py | DITAS-Project/DUE-VDC | 0 | 46442 | import json
from flask import Blueprint
from metrics import availability as avail
from metrics import utils as ut
from elasticsearch.exceptions import ConnectionError
avail_page = Blueprint('availability', __name__)
QUERY_CONTENT = '*'
@avail_page.route('/')
def hello():
return ut.json_response_formatter({'msg'... | 2.328125 | 2 |
src/main/python/format-thresh-grid.py | utcompling/textgrounder | 40 | 46443 | #!/usr/bin/env python
from nlputil import *
import fileinput
import re
switch_thresh_and_grid = True
errdists = dictdict()
for line in fileinput.input():
line = line.strip()
m = re.match(r'.*thresh: ([0-9.]*), grid: ([0-9.]*),.*true error distance.*\(([0-9.]*) km.*', line)
if not m:
errprint("Can't parse ... | 2.78125 | 3 |
instructions/docker_build.py | gnubyte/publicServerAutomator | 0 | 46444 | <reponame>gnubyte/publicServerAutomator<gh_stars>0
# @Author: <NAME>
# @Date 4-13-2018
# ----------------
import server
dockerInstructions = [
"apt-get update -y",
"apt-get install apt-transport-https -y",
"apt-get install software-properties-common -y",
"apt-get install curl -y",
"apt-get insta... | 2.078125 | 2 |
.github/workflows/scripts/check_java_version.py | cezary986/hello-github-actions | 0 | 46445 | import sys
import os
import re
import json
import base64
REFERENCE_BRANCH_NAME = 'master'
GRADLE_FILE_PATH = './build.gradle'
GET_GRADLE_COMMAND = f'git show {REFERENCE_BRANCH_NAME} HEAD:{GRADLE_FILE_PATH}'
class Version:
def __init__(self, version_string: str):
parts = version_string.split('.')
if le... | 2.46875 | 2 |
core/model.py | vab9/is-projekt-2016 | 0 | 46446 | <filename>core/model.py
from sqlalchemy.dialects.postgresql import JSONB
from serious_game import db
from flask import json
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
vorname = db.Column(db.String(32), nullable=False)
nachname = db.Column(db.String(32), ... | 2.96875 | 3 |
Chapter 07/Chap07_Example7.96.py | bpbpublications/Programming-Techniques-using-Python | 0 | 46447 | myfruits = {"Apple", "Banana", "Grapes", "Litchi", "Mango"}
myfruits.remove('Guava')
| 2.359375 | 2 |
code/flask-final-project/toy_recommender.py | NargesEl/montessory_toy_recommender | 0 | 46448 | from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
import numpy as np
cs = cosine_similarity
df=pd.read_csv("df_final.csv")
def get_recommender(user_input):
""" This function produces the 5 top recommendations depending on user_input.
The user_input is the age group and skills selecte... | 3.40625 | 3 |
config/context_processors.py | YaroslavChyhryn/WeatherReminder | 0 | 46449 | from django.conf import settings
def from_settings(request):
return {
'ENVIRONMENT_NAME': settings.ENVIRONMENT_NAME,
'ENVIRONMENT_COLOR': settings.ENVIRONMENT_COLOR,
}
| 1.734375 | 2 |
evaluation/bin/utils/time_utils.py | ckorzen/pdf-text-extraction-benchmark | 34 | 46450 | <reponame>ckorzen/pdf-text-extraction-benchmark
from datetime import datetime
time_pattern = "%H:%M:%S.%f (%Y-%m-%d)"
def time_in_ms():
return int(round(datetime.now().timestamp() * 1000))
def format_time(time_in_ms):
"""
Formats the given time to human readable string.
"""
return datetime.from... | 2.75 | 3 |
UmrConf.py | pzia/useful-meeting-reminder | 2 | 46451 | # -*- coding: utf-8 -*-
#config
import configparser
#sys & os
import sys
import os.path
#set logging
import logging
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'umr.log'),level=logging.DEBUG)
#Set locale
#FIXME : force French, should be in conf ?
import locale
locale.set... | 2.328125 | 2 |
booking/models.py | thanderoy/HotelBookingSys | 0 | 46452 | from django.db import models
from django.conf import settings
from django.urls import reverse
# Create your models here.
class Room(models.Model):
ROOM_CATEGORIES = (
('BZS', 'BUSINESS SUITE'),
('TNS', 'TWIN SUITE'),
('EXS', 'EXECUTIVE SUITE'),
('SGB', 'SINGLE BED'),
)
room_... | 2.375 | 2 |
openstack-congress-9.0.0/congress/tests/datasources/test_datasource_utils.py | scottwedge/OpenStack-Stein | 50 | 46453 | <filename>openstack-congress-9.0.0/congress/tests/datasources/test_datasource_utils.py
# Copyright (c) 2018 Canonical 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
#
# ... | 1.992188 | 2 |
src/HABApp/openhab/connection_logic/connection.py | DerOetzi/HABApp | 44 | 46454 | from HABApp.openhab.connection_handler import http_connection
from ._plugin import on_connect, on_disconnect, setup_plugins
log = http_connection.log
def setup():
from HABApp.runtime import shutdown
# initialize callbacks
http_connection.ON_CONNECTED = on_connect
http_connection.ON_DISCONNECTED = on... | 2.328125 | 2 |
src/operations/mouse.py | kbiters/infram | 19 | 46455 | <filename>src/operations/mouse.py
import json
from random import randint, uniform
from time import sleep
import pyautogui
from src.service.constants import Config, Data, Message
from src.service.translator import translate
def find_image_click(paths, x_min=0, x_max=0, y_min=0, y_max=0, notification=False):
vali... | 2.5625 | 3 |
userbot/plugins/Gban.py | techyminati/DeOXy | 1 | 46456 | #Imported to DeOXy
from userbot import bot, BOTLOG_CHATID, ALIVE_NAME, CMD_LIST
import asyncio
from telethon import events
from telethon.tl.functions.channels import EditBannedRequest
from telethon.tl.types import (PeerChat, PeerChannel,ChannelParticipantsAdmins, ChatAdminRights,ChatBannedRights, MessageEntityMentionN... | 2.03125 | 2 |
bspider/parser/item.py | littlebai3618/bspider | 3 | 46457 | class Item(object):
"""
item对象,
"""
def __init__(self, schema=None, **kwargs):
"""
:param schema: 建表语句,要求有建表权限
:param kwargs: 要存储的数据
"""
self.capacity = kwargs
self.schema = schema
# 增加元素
def __setitem__(self, key, value):
self.capacity[k... | 3.109375 | 3 |
tensorflow/10_cnn_mnist.py | zyf668/ml_code | 98 | 46458 | <reponame>zyf668/ml_code
# -*- coding: utf-8 -*-
# convolutional neural network
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# create weights
def weight_variable(shape):
initial = tf.truncated_normal(s... | 3.0625 | 3 |
main.py | jojotrujillo/in-office-light | 0 | 46459 | import bluetooth
import time
import RPi.GPIO as GPIO
from bt_rssi import BluetoothRSSI
search_time = 10
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
THRESHOLD = (-13, 38)
# You can hardcode the desired device ID here as a string to skip the discovery stage
addr = "F4:AF:E7:72:CB:19"
b = BluetoothRSSI(addr=addr)
pr... | 3.59375 | 4 |
mtuq/dataset/sac.py | junxie01/mtuq | 1 | 46460 | <filename>mtuq/dataset/sac.py
import glob
import os
import warnings
import numpy as np
import obspy
import mtuq.dataset.base
from copy import deepcopy
from os.path import join
from obspy.core import Stream
from obspy.core.event import Origin
from obspy.geodetics import gps2dist_azimuth
from mtuq.util.signal import c... | 2.09375 | 2 |
clockngpn/cli/server.py | junquera/c-lock | 13 | 46461 | import clockngpn.totp as totp
from clockngpn.proc_worker import Event, Broker, ProcWorkerEvent
from clockngpn.ttp import TocTocPorts, TocTocPortsWorker
from queue import Queue
import time
import os
import logging
from clockngpn.bidi import OTPBidi
import signal
import argparse
log = logging.getLogger(__name__)
def... | 2.125 | 2 |
mopidy_frontend_for_adafruit_charlcdplate/Frontend.py | 9and3r/mopidy-frontend-for-adafruit-charlcdplate | 0 | 46462 | import threading
from time import sleep
from mopidy import core
from MainScreen import MainScreen
from InputManager import InputManager
from DisplayObject import DisplayObject
import pykka
class FrontendAdafruitCharLCDPlate(pykka.ThreadingActor, core.CoreListener):
def __init__(self, config, core):
s... | 2.234375 | 2 |
tests/test_record.py | slacAWallace/pytmc | 0 | 46463 | <gh_stars>0
from pytmc.record import EPICSRecord
from pytmc.linter import lint_db
def test_epics_record_render():
kwargs = {'pvname': 'Tst:pv',
'record_type': 'ai',
'fields': {'ZNAM': 'Out',
'ONAM': 'In'}}
ec = EPICSRecord(**kwargs)
record = ec.render(... | 2.421875 | 2 |
mine.gyp | indutny/mine.uv | 6 | 46464 | <gh_stars>1-10
{
"targets": [{
"target_name": "mine.uv",
"type": "executable",
"dependencies": [
"mine.uv-lib",
],
"sources": [
"src/main.c",
],
}, {
"target_name": "mine.uv-lib",
"type": "<(library)",
"include_dirs": [ "src" ],
"dependencies": [
"deps/uv/uv... | 1.070313 | 1 |
mlflow/google/aiplatform/cli.py | htappen/mlflow | 2 | 46465 | """
CLI for azureml module.
"""
import json
import click
from mlflow.google.aiplatform import register_model as do_register_model
from mlflow.utils import cli_args
from mlflow.utils.annotations import experimental
@click.group("google")
def commands():
"""
Serve models on Google Cloud AI Platform. **These c... | 2.765625 | 3 |
transformer-xl/utils/midi_utils.py | froggie901/aws-deepcomposer-samples | 1 | 46466 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from music21 import midi
import pypianoroll
from pypianoroll import Multitrack
from texttable import Texttable
import os
from pprint import pprint
def play_midi(input_midi):
'''Takes path ... | 2.609375 | 3 |
data_util/config.py | potsawee/pointer_sum1 | 0 | 46467 | <gh_stars>0
import os
root_dir = os.path.expanduser("~")
#train_data_path = os.path.join(root_dir, "ptr_nw/cnn-dailymail-master/finished_files/train.bin")
# train_data_path = os.path.join(root_dir, "/home/alta/summary/pm574/data/cnn_dm/finished_files/chunked/train_*")
# eval_data_path = os.path.join(root_dir, "/home/... | 1.71875 | 2 |
spar_python/report_generation/ta1/ta1_section_performance_percentiles.py | nathanawmk/SPARTA | 37 | 46468 | # *****************************************************************
# Copyright 2013 MIT Lincoln Laboratory
# Project: SPAR
# Authors: SY
# Description: Section class
#
#
# Modifications:
# Date Name Modification
# ---- ---- ... | 2.046875 | 2 |
data_structures/binary_search_tree/test_breadth_first_traversal.py | zarkle/data-structures-and-algorithms | 1 | 46469 | from .breadth_first_traversal import breadth_first_traversal
from .bst import BST
def test_breadth_first_traversal():
"""Test breadth-first traversal."""
tree = BST([2, 1, 3])
assert breadth_first_traversal(tree) == [2, 1, 3]
def test_breadth_first_traversal_balanced(balanced_bst):
"""Test breadth-f... | 3.171875 | 3 |
slm_service.py | BinaryCobrasTeam/http.server_service | 0 | 46470 | #-*- encoding: utf-8 -*-
"""
About : Code to run as a linux daemon service, interface with it via REST POST
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__company__ = ""
__copyright__ = "Copyright (C) 2020 {a}".format(a=__author__)
__credits__ = ""
__license__ = "MIT"
__version__ = 0.03
__lastdate__ = "2020-04-13"... | 2.203125 | 2 |
module/duplicates.py | aiskov/storekeeper | 0 | 46471 | import os
from hashlib import sha224
def search_duplicates(target, options=None):
digests = dict()
for root, dirs, files in os.walk(target):
for item in files:
path = '%s/%s' % (root, item)
hash_digest = _create_digest(path)
if hash_digest not in digests:
... | 2.953125 | 3 |
tests/structure/test_causal.py | jwllee/podspy | 1 | 46472 | <gh_stars>1-10
#!/usr/bin/env python
"""This is the unit test module for the causal matrix module.
"""
import pandas as pd
import numpy as np
from podspy.structure import CausalMatrix
class TestCausalMatrix:
def test_build_from_logtable(self, simple_log_table):
# sort activities
cmat = Causal... | 2.734375 | 3 |
examples/algorithms/gauss/gauss_algo.py | frzfrsfra4/phylanx | 83 | 46473 | <gh_stars>10-100
# Copyright (c) 2017 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# Code samples taken from...
#
# http://www.math.umbc.edu/~campbell/Computers/Python/linalg.html#LinAlg-SolveSys
impo... | 2.46875 | 2 |
src/micropython/microbit/__model/compass.py | julianrendell/vscode-python-devicesimulator | 151 | 46474 | <gh_stars>100-1000
from common import utils
from common.telemetry import telemetry_py
from common.telemetry_events import TelemetryEvent
class Compass:
# The implementation is based off of https://microbit-micropython.readthedocs.io/en/v1.0.1/compass.html.
def calibrate(self):
"""
This functio... | 2.78125 | 3 |
gemmforge/vm/lexic/cuda_lexic.py | ravil-mobile/gemmforge | 0 | 46475 | <reponame>ravil-mobile/gemmforge<gh_stars>0
from .lexic import Lexic
class CudaLexic(Lexic):
def __init__(self, underlying_hardware):
super().__init__(underlying_hardware)
self.thread_idx_y = "threadIdx.y"
self.thread_idx_x = "threadIdx.x"
self.thread_idx_z = "threadIdx.z"
self.block_idx_x = "b... | 2.15625 | 2 |
nasergame/main.py | nfearnley/nasergame | 0 | 46476 | <filename>nasergame/main.py
import math
import pygame
import pygame.gfxdraw
from pygame.locals import K_q, K_w, K_e, K_a, K_s, K_d, K_f, K_LSHIFT, K_MINUS, K_EQUALS, K_LCTRL, K_SPACE
from digicolor import colors
from nasergame import __version__
from nasergame import scaleddisplay
from nasergame.lib import models
fro... | 2.65625 | 3 |
Game/migrations/0005_auto_20181108_1248.py | rusito-23/InvestSimulator | 0 | 46477 | # Generated by Django 2.1.2 on 2018-11-08 12:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Game', '0004_auto_20181106_1255'),
]
operations = [
migrations.CreateModel(
name='Loan',
... | 1.648438 | 2 |
posts/tests.py | Code-Institute-Submissions/Dermomurphy-MS4-DJ-ecomSite_MayResub | 0 | 46478 | <gh_stars>0
from django.test import TestCase
from posts.models import Posts
from datetime import datetime
# Create your tests here.
class PostTestCase(TestCase):
def setUp(self):
Posts.objects.create(title='Test1', body='Test text',created_on=datetime.now)
| 1.992188 | 2 |
genoplot/individual.py | ddnewell/genoplot | 0 | 46479 | <reponame>ddnewell/genoplot<filename>genoplot/individual.py
# Copyright (c) 2016 by Welded Anvil Technologies (<NAME>). All Rights Reserved.
# This software is the confidential and proprietary information of
# Welded Anvil Technologies (<NAME>) ("Confidential Information").
# You shall not disclose such Confidential In... | 2.328125 | 2 |
trojai_rl/modelgen/config.py | trojai/trojai_rl | 3 | 46480 | <gh_stars>1-10
import logging
import os
import re
import uuid
from typing import Any
import torch.nn as nn
from .optimizer_interface import RLOptimizerInterface
from ..datagen.environment_factory import EnvironmentFactory
from .utils import is_jsonable
logger = logging.getLogger(__name__)
SUPPORTED_TRAINING_ALGOS = ... | 2.25 | 2 |
tests_manual/db_connection_3_FROM_CONFIG.py | BrainAnnex/brain-annex | 0 | 46481 | <reponame>BrainAnnex/brain-annex<filename>tests_manual/db_connection_3_FROM_CONFIG.py
# Test of ability to connect to the Neo4j database from the credentials
# in config file(s) variables NEO4J_HOST, NEO4J_USER, NEO4J_PASSWORD
from configparser import ConfigParser
from BrainAnnex.modules.neo_access.neo_access import N... | 2.5625 | 3 |
hopper_speech/src/battery_status_monitor.py | CreedyNZ/Hopper_ROS | 36 | 46482 | #!/usr/bin/env python
from __future__ import division
import rospy
from std_msgs.msg import String
from hopper_msgs.msg import ServoTelemetry, HexapodTelemetry
from sensor_msgs.msg import BatteryState
def mean(numbers):
return sum(numbers) / max(len(numbers), 1)
SERVO_COUNT = 18
MAX_VOLTAGE = 12.5
MIN_VOLTAGE ... | 2.359375 | 2 |
app_control/migrations/0002_initial_app_control.py | bkstudy/bk_kb_1 | 4 | 46483 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... | 1.734375 | 2 |
run.py | KirtusJ/BirdBot | 0 | 46484 | <gh_stars>0
from src import app
try:
app.bot.run(app.env['token'], bot=True, reconnect=True)
except Exception as e:
print(e) | 1.46875 | 1 |
integration_tests/test_mv_index.py | GispoCoding/datacube-ows | 0 | 46485 | import pytest
from datacube.utils.geometry import box
from datacube_ows.cube_pool import cube
from datacube_ows.ogc_utils import local_solar_date_range
from datacube_ows.ows_configuration import get_config
from datacube_ows.mv_index import MVSelectOpts, mv_search_datasets
def test_full_layer():
cfg = get_config... | 1.9375 | 2 |
statics/scripts/ansible_api.py | sivarki/hjarnuc | 0 | 46486 | # coding:utf-8
# @Time : 2019-01-14 15:22
# @Author : 小贰
# @FileName: ansible_sync_hosts.py
# @function: ansible for python 3.x
import json
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager
from ansible.inventory.manager import In... | 2.125 | 2 |
kakaoautomsgsender/main.py | leeeju/R.O.S- | 2 | 46487 | <reponame>leeeju/R.O.S-
#-*- coding: utf-8 -*-
import sys
import pyautogui
import time
import pyperclip
import os
import random
def send_msg(my_msg, repeat_number):
for i in range(int(repeat_number)):
time_wait = random.uniform(3, 5)
print('Repeat Number : ', i + 1)
print(' // Time wait : ... | 2.90625 | 3 |
tests/test_location.py | enthought/supplement | 1 | 46488 | <reponame>enthought/supplement<filename>tests/test_location.py
from .helpers import pytest_funcarg__project
def test_function_node_location(project):
m = project.create_module('test', '''
def test():
pass
''')
line, filename = m['test'].get_location()
assert line == 1
assert fil... | 2.609375 | 3 |
15.py | ednl/aoc2017 | 0 | 46489 | <reponame>ednl/aoc2017
def duel1(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
b = b * 48271 % 2147483647
k += a & 0xffff == b & 0xffff
return k
def duel2(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
while a & 0x3:
... | 2.46875 | 2 |
todos/models.py | DastanArysbay/TodoAppProject | 0 | 46490 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Todo(models.Model):
# user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
content = models.TextField() | 1.875 | 2 |
tests/docs/test_swportal.py | Saanidhyavats/dffml | 3 | 46491 | <gh_stars>1-10
import pathlib
import unittest
import platform
from dffml import AsyncTestCase
from dffml.util.testing.consoletest.cli import main as consoletest
@unittest.skipIf(
platform.system() in ["Windows", "Darwin"],
f"Does not work on {platform.system()}",
)
class TestSWPortal(AsyncTestCase):
asyn... | 2.0625 | 2 |
alipay/create_direct_pay_by_user/dpn/models.py | freeyoung/django-alipay3 | 0 | 46492 | # -*- coding:utf-8 -*-
from django.db import models
from alipay import conf
from alipay.models import AliPayBaseModel
from alipay.create_direct_pay_by_user.dpn.signals import alipay_dpn_flagged, alipay_dpn_successful
class AliPayDPN(AliPayBaseModel):
"""
AliPay DPN
"""
gmt_close = models.DateTimeFiel... | 2.109375 | 2 |
app/api/v2/views/user_views.py | MbuguaCaleb/Questioner-V2-API | 0 | 46493 | <filename>app/api/v2/views/user_views.py
from flask import jsonify, request
from ...v2 import version_2 as v2
from ..schemas.user_schema import UserSchema
from ..models.user_model import User
db = User()
@v2.route('/', methods=['GET'])
@v2.route('/welcome', methods=['GET'])
def index():
return jsonify({'status': ... | 2.796875 | 3 |
digit_clf_model.py | petejadhav/cam-sudoku | 0 | 46494 | import numpy as np
import pandas as pd
import time
mnist = pd.read_csv("../input/train.csv")
mnist.head()
y_train = mnist.label.values
x_train = mnist.drop('label',axis=1)
x_train = (x_train / 255.0).values
x_train = np.reshape(x_train,(42000,1,28,28))
x_train.shape
from keras.models import Sequential
from keras.l... | 3.09375 | 3 |
execute_kp_extract_for_all_files_in_dir.py | kpgx/first-order-model | 0 | 46495 | import subprocess
import time
from os import listdir
from os.path import isfile, join
COMMAND = ["python3", "onnx_sender.py",]
DIR = "working"
def get_file_list_from_dir(mypath):
onlyfiles = [join(mypath, f) for f in listdir(mypath) if isfile(join(mypath, f))]
return onlyfiles
file_list = get_file_list_fro... | 2.6875 | 3 |
src/CompartmentalSystems/bins/TsTpMassFieldsPerTimeStep.py | goujou/CompartmentalSystems | 0 | 46496 | # vim: set ff=unix expandtab ts=4 sw=4:
import numpy as np
from .TsMassFieldsPerTimeStep import TsMassFieldsPerTimeStep
from .FieldsPerTimeStep import FieldsPerTimeStep
class TsTpMassFieldsPerTimeStep(FieldsPerTimeStep):
@property
def total_contents(self):
return [field.total_content for field in self... | 2.21875 | 2 |
tests/trainer/evaluator_test.py | elifesciences/sciencebeam-gym | 25 | 46497 | <filename>tests/trainer/evaluator_test.py<gh_stars>10-100
import logging
import pytest
import tensorflow as tf
from sciencebeam_utils.utils.collection import (
to_namedtuple
)
from sciencebeam_gym.utils.tfrecord import (
dict_to_example
)
from sciencebeam_gym.trainer.data.examples import (
parse_example... | 2.0625 | 2 |
mqtt_test/Subscribe.py | janice880624/webduino_blockly | 0 | 46498 | import paho.mqtt.client as mqtt
# 當地端程式連線伺服器得到回應時,要做的動作
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# 將訂閱主題寫在on_connet中
# 如果我們失去連線或重新連線時
# 地端程式將會重新訂閱
client.subscribe("Try/MQTT")
# 當接收到從伺服器發送的訊息時要進行的動作
def on_message(client, userdata, msg):
# 轉換編... | 2.65625 | 3 |
settings.py | WZBSocialScienceCenter/otreeutils | 16 | 46499 | <filename>settings.py<gh_stars>10-100
import importlib.util
from os import environ
# SET THIS IN YOUR OWN EXPERIMENTS
SECRET_KEY = '...'
# List of example experiments
SESSION_CONFIGS = [
{
'name': 'otreeutils_example1',
'display_name': 'otreeutils example 1 (Understanding questions, ti... | 2.234375 | 2 |