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 |
|---|---|---|---|---|---|---|
began/train.py | norveclibalikci/MyDeepLearning | 2 | 43400 | from __future__ import print_function
from math import log10
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from dataset import DataSetFromFolder
import torch.cuda
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import torchvision.utils as... | 2.140625 | 2 |
eispy/legacy/eis_utils.py | dstansby/EISpy | 5 | 43401 | <reponame>dstansby/EISpy
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# pylint: disable=E1101, C0330
"""
Utilities used in EIS calculations, corrections and fits.
"""
import os
import datetime as dt
import warnings
import urllib
import pathlib
from scipy.io import readsav
from scipy.interpolate import interp1d
i... | 2.15625 | 2 |
Tracker_Development/Tracker_Troubleshooting/Tracker_Tree_Reconstruction.py | The-Kristina/CellComp | 7 | 43402 | <reponame>The-Kristina/CellComp
# TODO: Find out if you can reconstruct chopped trees from the tracker:
import sys
sys.path.append("../")
from Cell_IDs_Analysis.Plotter_Lineage_Trees import PlotLineageTree
raw_file = "/Volumes/lowegrp/Data/Kristina/MDCK_90WT_10Sc_NoComp/17_07_24/pos13/analysis/channel_RFP/cellIDdeta... | 1.9375 | 2 |
Youtube/OpenCV Course/Advanced/splitmerge.py | aayush1036/OnlineCourses | 0 | 43403 | import cv2
import numpy as np
img = cv2.imread('../Resources/Photos/park.jpg')
b,g,r = cv2.split(img)
# cv2.imshow('Blue',b)
# cv2.imshow('Green',g)
# cv2.imshow('Red',r)
blank = np.zeros(img.shape[:2],dtype='uint8')
blue = cv2.merge([b,blank,blank])
green = cv2.merge([blank,g,blank])
red = cv2.merge([blank,blank,r]... | 2.96875 | 3 |
old_project/start.py | tzontzy13/IN3063-CW | 0 | 43404 | <filename>old_project/start.py
import numpy as np
from mnist_data import get_mnist_data
from MLP import MLP
from MLP_SGD import MLP_SGD
# get data from mnist_data file
test_data, test_targets, train_data, train_targets = get_mnist_data()
# initialize a Stochaistic Gradient Descent Multi Layer Perceptron
mlp_sgd = M... | 3.109375 | 3 |
data/transforms/utils.py | CHC278Cao/template_cv | 0 | 43405 | # encoding: utf-8
"""
@author: ccj
@contact:
"""
import numpy as np
from typing import List, Dict, Tuple, Any
import torch
import torch.nn.functional as F
def crop_white(image: np.ndarray, value: int = 255) -> np.ndarray:
"""
Crop white border from image
:param image: Type: np.ndarray, image to be ... | 3.046875 | 3 |
nova_powervm/tests/virt/powervm/nvram/test_manager.py | openstack/nova-powervm | 24 | 43406 | <filename>nova_powervm/tests/virt/powervm/nvram/test_manager.py
# Copyright 2016, 2018 IBM Corp.
#
# 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
#
# ... | 1.789063 | 2 |
src/server.py | nathancohen4299/v-stream | 0 | 43407 | <reponame>nathancohen4299/v-stream
import argparse
import configparser
import logging
import os
import shutil
import signal
import sys
import threading
import time
from pathlib import Path
from socket import *
from typing import List
from delta_list.delta_list import DeltaList
from objs.ack import Ack
from objs.frame ... | 2.109375 | 2 |
btclib/transaction.py | qwerty-w/btc-lib | 0 | 43408 | <reponame>qwerty-w/btc-lib<filename>btclib/transaction.py
from abc import abstractmethod
from typing import Iterable, Protocol
import json
from btclib.const import DEFAULT_SEQUENCE, DEFAULT_VERSION, DEFAULT_LOCKTIME, \
SIGHASHES, EMPTY_SEQUENCE, NEGATIVE_SATOSHI
from btclib.utils import d_sha256, uint32, sint64, d... | 2.5625 | 3 |
modules/overlay.py | zlrc/Can.dl | 1 | 43409 | <reponame>zlrc/Can.dl
# Overlay commands.
import discord
from discord.ext import commands
from builtins import bot
from math import floor
import asyncio
import aiohttp
from io import BytesIO
from PIL import Image
import os
import random
from wax.logger import log
from wax.helpers import convert_to_url, get_img, abs_pat... | 2.3125 | 2 |
packages/utils/helpers.py | google/compass | 5 | 43410 | <gh_stars>1-10
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 2.25 | 2 |
scripts/compare_neigh_overlap.py | cabrittin/elegansbrainmap | 2 | 43411 | """
compare_neigh_overlap.py
Plots distributions of Jaccard distances for overlapping ipsilateral
neighborhoods (blue) and homologous contralateral neighborhoods (red)
in the adult and L4.
crated: <NAME>
data: 01 November 2018
"""
import os
from configparser import ConfigParser,ExtendedInterpolation
import argpars... | 2.546875 | 3 |
tools/profiling/microbenchmarks/speedup.py | lalo/grpc | 0 | 43412 | <reponame>lalo/grpc<filename>tools/profiling/microbenchmarks/speedup.py
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code mus... | 1.632813 | 2 |
nidaqmx/examples/contrib/alternate_on_off_slow.py | jkfindeisen/pylibnidaqmx | 1 | 43413 | <reponame>jkfindeisen/pylibnidaqmx
# with relatively loose timing constraints
# turn on and off a digital output
from __future__ import division
from numpy import *
import labdaq.daqmx as daqmx
import labdaq.daq as daq
import threading,time
def min2sec(minutes):
return minutes*60.0
###### setup script parameters... | 2.734375 | 3 |
thingsboard_gateway/connectors/opcua_asyncio/opcua_connector.py | atorber/thingsboard-gateway | 1 | 43414 | <filename>thingsboard_gateway/connectors/opcua_asyncio/opcua_connector.py<gh_stars>1-10
# Copyright 2022. ThingsBoard
#
# 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
#
# ... | 2.046875 | 2 |
webpage/autocorrect.py | JoeLanzi/CSCI_5030_TEAM_1 | 0 | 43415 | #%%
import ast
from preprocess import to_n_gram
from grammar_checker import Checker
import pickle
LANGUAGES = ast.literal_eval(open("language_short_names.txt", "r").read())
class Autocorrect:
def __init__(self, language = 'en-US') -> None:
self.language = language
self.tool = self.load_dictionary... | 2.984375 | 3 |
data_ocean/emails.py | OlexandrTopuzov/Data_converter | 0 | 43416 | <gh_stars>0
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from data_converter.email_utils import send_template_mail
from data_ocean.models import Register, Report
from users.models import DataOceanUser
def send_reports_mail():
reports = Report.collect_last_day_reports()... | 1.976563 | 2 |
src/epython/poke/eprequests.py | elibs/epython | 0 | 43417 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Description:
This module houses the Poke class, and the wrapped requests methods.
Author:
<NAME>
Date:
3/16/21
"""
import requests
from epython.environment import EPYTHON_REQUEST_ID, EPYTHON_REQUEST_RETRIES, EPYTHON_REQUEST_INTERVAL
from epython.handlers import ba... | 2.953125 | 3 |
src/python/tests/integration/test_web/test_handler/test_auto_queue.py | annihilatethee/seedsync | 255 | 43418 | <gh_stars>100-1000
# Copyright 2017, <NAME>, All rights reserved.
import json
from urllib.parse import quote
from controller import AutoQueuePattern
from tests.integration.test_web.test_web_app import BaseTestWebApp
class TestAutoQueueHandler(BaseTestWebApp):
def test_get(self):
self.auto_queue_persist.... | 2.484375 | 2 |
udponxbee/frame.py | jimzhong/udp-on-xbee | 0 | 43419 | from struct import pack, unpack, calcsize
from enum import Enum
import logging
START_DELIMITER = 0x7E
class XBeeOutFrame(object):
def __bytes__(self):
raise NotImplementedError("Subclass should implement this method")
@staticmethod
def calc_checksum(partial_frame):
'''
partial_fr... | 2.640625 | 3 |
fasta/reorient_sequences_by_id.py | senjoro/biocode | 355 | 43420 | <reponame>senjoro/biocode<filename>fasta/reorient_sequences_by_id.py
#!/usr/bin/env python3
'''
Description:
Use this when you have a multi-FASTA file and you want to reverse or reverse
complement only select sequences within that file. For example, strand-specific
RNA-Seq read alignment showed that some assembled t... | 3.6875 | 4 |
grafos/grafo_niveles.py | Tensor4Dummies/2_tensorboard | 1 | 43421 | #IMPORTACIÓN DE LIBRERIAS
import tensorflow as tf
import os
#QUITAR LOS MENSAJES DE AVISO
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
#CREAR EL MODELO
#Entradas
A = tf.constant([4], tf.int32, name='A')
B = tf.constant([5], tf.int32, name='B')
C = tf.constant([6], tf.int32, name='C')
x = tf.placeholder(tf.int... | 2.671875 | 3 |
ui/context_processors.py | usgin/nrrc-repository | 0 | 43422 | from ui.config import SITE_CONFIG
from django.contrib.sites.models import Site
def basics(req):
result = SITE_CONFIG
result['domain'] = Site.objects.get_current().domain
return result | 1.710938 | 2 |
apps/exotics/apps.py | kngeno/telelbirds | 2 | 43423 | <reponame>kngeno/telelbirds
from django.apps import AppConfig
class ExoticsConfig(AppConfig):
name = 'exotics'
| 1.203125 | 1 |
echo_server.py | RIDERIUS/utilities | 2 | 43424 | """An echo server that has a server thread and a client thread. ONLY 5 CONNECTIONS."""
import threading
import socket
def server() -> None:
"""A server thread that has a server thread"""
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 8007
host = 'localhost'
server_socket... | 3.640625 | 4 |
Section 02/sec02-xlsxread-openpyxl.py | PacktPublishing/Python-Data-Visualization-Solutions | 0 | 43425 | <gh_stars>0
from openpyxl import load_workbook
file = 'sec02-xlsxdata.xlsx'
wb = load_workbook(filename=file)
ws = wb.get_sheet_by_name('Sheet1')
dataset = []
for r in ws.rows:
col = []
for c in r:
col.append(c.value)
dataset.append(col)
from pprint import pprint
pprint(dataset)
| 2.640625 | 3 |
moves/_moves.py | blech/moves | 0 | 43426 | import json
import urllib
import requests
import types
class MovesAPIError(Exception):
"""Raised if the Moves API returns an error."""
pass
class MovesAPINotModifed(Exception):
"""Raised if the document requested is unmodified. Need the use of etag header"""
pass
class MovesClient(object):
"""OA... | 2.765625 | 3 |
core/migrations/0008_auto_20200409_0247.py | scottstanie/fashbowl | 1 | 43427 | # Generated by Django 2.2.10 on 2020-04-09 02:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20200409_0223'),
]
operations = [
migrations.RenameField(
model_name='game',
old_name='active_gue... | 1.671875 | 2 |
ExperimentalData/utils.py | MurpheyLab/SmarticlesRattling2020 | 0 | 43428 | import pickle
import numpy as np
import scipy.linalg as sci
from scipy import signal
# Rotations
def wrap2Pi(x):
xm = np.mod(x+np.pi,(2.0*np.pi))
return xm-np.pi
def Rot(x):
return np.array([[np.cos(x),-np.sin(x)],[np.sin(x),np.cos(x)]])
def RotVec(x_vec, rot_vec):
rvec = np.array([np.dot(x_vec[i,:-1],Rot(rot_ve... | 2.234375 | 2 |
tests/unit/time_manager/schemas/test_user.py | krjakbrjak/time_management | 0 | 43429 | import pytest
from time_manager.schemas.user import (
UserBase,
UserCredentials,
UserDB,
UserDBBase,
validate_username,
)
@pytest.mark.parametrize(
"username,should_raise",
[
("", True),
(" ", True),
(" -", True),
("- ", True),
("-a", True),
... | 2.6875 | 3 |
src/test/parser/template/graph/test_datetime.py | hiitsme123/python | 5 | 43430 | <reponame>hiitsme123/python
import xml.etree.ElementTree as ET
import unittest
from test.parser.template.graph.test_graph_client import TemplateGraphTestClient
class TemplateGraphDateTimeTests(TemplateGraphTestClient):
def test_date_format_as_attrib(self):
template = ET.fromstring("""
<templ... | 2.890625 | 3 |
Chapter10/10_03_print_statements.py | PacktPublishing/Mastering-ArcGIS-Enterprise-Administration | 6 | 43431 | <reponame>PacktPublishing/Mastering-ArcGIS-Enterprise-Administration<filename>Chapter10/10_03_print_statements.py<gh_stars>1-10
import arcpy
result = arcpy.GetCount_management(
r"C:\Projects\GDBs\Sandbox.gdb\StudyAreas"
)
record_count = int(result.getOutput(0))
if record_count > 0:
arcpy.FeatureClassToFeatureC... | 1.90625 | 2 |
LOBDeepPP/__init__.py | mariussterling/LOBDeepPP_code | 1 | 43432 | from __future__ import absolute_import
from . import LOBDeepPP_class
from . import LOBDeepPP_model
from . import LOBDeepPP_params_files
| 1.171875 | 1 |
Day7-HandyHaversacks.py | n-Holmes/AdventOfCode2020 | 0 | 43433 | <reponame>n-Holmes/AdventOfCode2020
from collections import Counter
from functools import lru_cache
def get_contents(path : str) -> dict[str, dict[str, int]]:
"""Get a weighted, directed graph of bags.
No protection for the case of cycles.
"""
with open(path, "r") as f:
lines = f.readlines();
... | 3.265625 | 3 |
tasks/develop.py | mdegans/smart-social-distancing | 0 | 43434 | <gh_stars>0
from invoke import task
from .common import docker, constants, config, ROOT_DIR
valid_backend_names = constants.D_BACKENDS
@task(help={'name': '|'.join(constants.D_ALL)})
def build(c, name, local=False, build_frontend=True):
assert name in constants.D_ALL
docker.auto_build(c, 'frontend', local=lo... | 2 | 2 |
lignet/learning_curve_full_net.py | LigninTools/lignet2.0 | 14 | 43435 | """
Make a learning curve for the full neural net trained on all 30 output
measures. The point of this graph is to investigate how much training data
is needed to achieve various MSE values.
"""
import matplotlib.pyplot as plt
import numpy as np
import cPickle as pickle
import lasagne
from lasagne import layers
from ... | 3.515625 | 4 |
api/views/partials/resources.py | 9kittikul/machinaris | 1 | 43436 | <reponame>9kittikul/machinaris
import datetime as dt
from flask.views import MethodView
from api import app
from api.extensions.api import Blueprint, SQLCursorPage
from common.extensions.database import db
from common.models import Partial
from .schemas import PartialSchema, PartialQueryArgsSchema, BatchOfPartialSch... | 2.109375 | 2 |
pyrf/gui/amplitude_controls.py | Sout/pyrf | 0 | 43437 | <filename>pyrf/gui/amplitude_controls.py
from PySide import QtGui, QtCore
from pyrf.gui.util import hide_layout
from pyrf.gui.fonts import GROUP_BOX_FONT
from pyrf.gui.widgets import QCheckBoxPlayback
import numpy as np
PLOT_YMAX = 40
PLOT_TOP = 0
PLOT_BOTTOM = -160
PLOT_YMIN = -240
PLOT_STEP = 5
class AmplitudeContro... | 2.609375 | 3 |
content/test/gpu/page_sets/PRESUBMIT.py | kjthegod/chromium | 1 | 43438 | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
def _GetTelemetryPath(input_api):
return os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.di... | 2.203125 | 2 |
modules/action/exploit_jexboss.py | mrpnkt/apt2 | 37 | 43439 | <gh_stars>10-100
import os
import re
from core.actionModule import actionModule
from core.utils import Utils
from core.keystore import KeyStore as kb
class exploit_jexboss(actionModule):
def __init__(self, config, display, lock):
super(exploit_jexboss, self).__init__(config, display, lock)
self.ti... | 2.34375 | 2 |
Reliquary/src/com/duckandcover/scripting/startUp.py | NicholasWMRitchie/Roentgen | 2 | 43440 | import com.duckandcover.scripting as _dacs
sys.setClassLoader(_dacs.ScriptClassLoader(sys.getClassLoader()))
| 1.265625 | 1 |
notebooks/helpers.py | maximusKarlson/networkx | 70 | 43441 | <filename>notebooks/helpers.py
import networkx as nx
from seaborn import color_palette, set_style, palplot
def create_color_map(G, attribute, seaborn_palette="colorblind"):
"""Return a list of hex color mappings for node attributes"""
attributes = [G.node[label][attribute] for label in G.nodes()]
# get t... | 3.25 | 3 |
app/routes.py | faulty-heart/flask-microblog | 0 | 43442 | from flask import render_template, flash, redirect, url_for
from app import flask_app
from app.forms import LoginForm
from flask_login import current_user, login_user
from app.models import User
from flask_login import logout_user
from flask_login import login_required
from flask import request
from werkzeug.urls impor... | 2.65625 | 3 |
ephios/core/services/notifications/backends.py | ephios-dev/ephios | 14 | 43443 | <filename>ephios/core/services/notifications/backends.py
import logging
import traceback
from django.conf import settings
from django.core.mail import EmailMultiAlternatives, mail_admins
from django.utils.translation import gettext_lazy as _
from webpush import send_user_notification
from ephios.core.models.users imp... | 1.859375 | 2 |
tests/extensions/aria_extension_tosca/simple_v1_0/functions/test_function_get_operation_output.py | tnadeau/incubator-ariatosca | 0 | 43444 | <reponame>tnadeau/incubator-ariatosca
# -*- coding: utf-8 -*-
# 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 A... | 1.734375 | 2 |
docs/code_snippets/hello_world_infix.py | Ying1123/pysmt | 435 | 43445 | from pysmt.shortcuts import Symbol
from pysmt.typing import INT
h = Symbol("H", INT)
domain = (1 <= h) & (10 >= h)
| 2.359375 | 2 |
cy/old__init__.py | techiaith/anonymeiddiwr-beta | 0 | 43446 | # encoding: utf8
from __future__ import unicode_literals, print_function
# Gruff
#from spacy.lang.cy.lemmatization import lemmatize_doc
#from spacy.lang.cy.dictionary_pos_tagger import rule_based_pos_tag
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .tag_map import TAG_MAP
from .stop_words import STOP_W... | 2.40625 | 2 |
app/main/__init__.py | krayzpipes/ACE-1 | 28 | 43447 | # vim: sw=4:ts=4:et
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
| 1.171875 | 1 |
Controller/finalizar.py | felipezago/ControleEstoque | 0 | 43448 | from PyQt5.QtWidgets import QMainWindow
from Controller.venda import VendaTemp
from Funcoes.utils import data_hora_atual
from Model.Compra_Itens import Compra_Itens
from Model.Compra_Fin import Compra_Fin
from Model.Compra_Header import Compras_Header
from Model.Compra_Tmp import Compra_Tmp
from Model.Fornecedor import... | 2.09375 | 2 |
Sketches/RJL/bittorrent/BitTorrent/BitTorrent/obsoletepythonsupport.py | sparkslabs/kamaelia_orig | 12 | 43449 | # The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... | 2.625 | 3 |
third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_format_table.py | zipated/src | 2,151 | 43450 | <filename>third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_format_table.py<gh_stars>1000+
#!/usr/bin/python
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# gen_vk_format_table.py:
# Code gene... | 1.890625 | 2 |
api/notificationserializer.py | Sinma1/tricityTrafficAPI | 0 | 43451 | <filename>api/notificationserializer.py
from rest_framework import serializers
from shared.models import Notification
class NotificationSerializer(serializers.Serializer):
title = serializers.CharField(max_length=60)
content = serializers.CharField()
date = serializers.DateTimeField()
source = serial... | 1.898438 | 2 |
preprocessing/init_buffer.py | GPrathap/OpenBCIPython | 1 | 43452 | ring_buffers = []
max_iteration = 10
channel_data = "" | 1.09375 | 1 |
Introduction/PythonVariaables/Python_Global_Variables.py | nayanrajani/PYTHON | 0 | 43453 | <filename>Introduction/PythonVariaables/Python_Global_Variables.py
'''
Global Variables
Variables that are created outside of a function (as in all of the examples above) are known as global variables.
Global variables can be used by everyone, both inside of functions and outside.
'''
#Example
#Create a variable ou... | 4.65625 | 5 |
core/element.py | david-wm-sanders/oeo | 1 | 43454 | <reponame>david-wm-sanders/oeo
from enum import Enum, unique
@unique
class Element(Enum):
Normal = 1
Fight = 2
Flying = 3
Poison = 4
Ground = 5
Rock = 6
Bug = 7
Ghost = 8
Steel = 9
Fire = 10
Water = 11
Grass = 12
Electric = 13
Psychic = 14
Ice = 15
Drago... | 3.21875 | 3 |
libsheep/state.py | exogen/80sheep | 1 | 43455 | <gh_stars>1-10
from libsheep.filelist import FileListing
class State(object):
def __init__(self):
self.file_list = FileListing(None)
self.downloaded_lists = None
self.hubs = None
| 2.265625 | 2 |
task1.py | mohansah/-The_Genome_Project | 3 | 43456 | <reponame>mohansah/-The_Genome_Project<gh_stars>1-10
import re
import sys
import PySimpleGUI as sg
from tkinter import filedialog
from tkinter import *
#####################################
# The GUI which takes input of files
####################################
files = []
if len(sys.argv) == 1:
event,... | 3 | 3 |
EasyRecycle/tests/unittests/recycle/views/test_EditCommercialOrderAPIView.py | YuriyLisovskiy/EasyRecycle | 0 | 43457 | from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from core.models import UserModel
from recycle import garbage
from recycle.models import CommercialRequest, Location
from recycle.views.commercial_order import EditCommercialOrderAPIView
from tests.unit... | 2.21875 | 2 |
orangecontrib/aps/srw/widgets/_not_used/ow_thickness_error_phase_shift.py | oasys-aps-kit/OASYS1-APS-ShadowOui | 1 | 43458 | import numpy, copy
from numpy import nan
from PyQt5.QtGui import QPalette, QColor, QFont
from PyQt5.QtWidgets import QMessageBox
from orangewidget import gui
from orangewidget import widget
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui
from oasys.widgets import congruence
from oa... | 1.71875 | 2 |
sensehat/tests/Pi_ReportHumidity.py | knightman/pi-projects | 0 | 43459 | # Pi_ReportHumidity.py
#
# Created: Jan 10, 2016 by <NAME>
#
# Simple script to read humidity on RPi
import time
from sense_hat import SenseHat
sense = SenseHat()
#humidity = sense.get_humidity()
#print("Humidity: %s %%rH" % humidity)
# alternatives
#print(sense.humidity)
# continue to print humidity reading every ... | 3.1875 | 3 |
tests/api/test_factory.py | jroquejr/nfe-reader | 0 | 43460 | <reponame>jroquejr/nfe-reader
from api.app import create_app
def test_factory():
assert not create_app().testing
assert create_app({"TESTING": True}).testing
| 1.679688 | 2 |
episodes/templatetags/episode_extras.py | jinpark/something-sunshine-django | 0 | 43461 | from django import template
from django.template.defaultfilters import stringfilter
from django.conf import settings
from urlparse import urlparse
register = template.Library()
@register.filter(is_safe=True)
@stringfilter
def xml_escape(string):
"""Replaces all unescaped xml characters"""
return string.repla... | 2.03125 | 2 |
module/tfcn.py | sc0ttms/SE-TFCN | 9 | 43462 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import sys
import os
import torch
import torch.nn as nn
from torchinfo import summary
sys.path.append(os.getcwd())
from module.input_block import InputBlock
from module.repeated_block import RepeatedBlock
from module.output_block import OutputBlock
class TFCN(nn.Module):
... | 2.640625 | 3 |
evaluation_utils.py | Tatyana-jl/butterfly-net | 1 | 43463 | import numpy as np
import torch
from matplotlib import pyplot as plt
from scipy.spatial.distance import directed_hausdorff
from numpy import linalg as LA
from sklearn import metrics
def get_roc_auc(target, prediction):
y_true = target.view(-1).numpy()
y_score = prediction.view(-1).cpu().detach().numpy()
... | 2.21875 | 2 |
display.py | HocRiser01/GEV-NN | 0 | 43464 | <filename>display.py
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def Disp(y1, y2, id):
plt.subplot(7, 10, id)
x = np.arange(len(y1))
plt.plot(x, y1, 'r', label = 'Train')
plt.plot(x, y2, 'b', label = 'Test')
plt.xlabel('Epoch')
plt.ylabel('Loss')
plt.title('Sample%d' % id)
plt.legend(n... | 3.15625 | 3 |
deploy/server_demo.py | gregdelozier/swift | 0 | 43465 | from server import Server
import os
def file_exists(server, name):
out, _ = server.run("ls")
print(out)
files = out.strip().split("\n")
print(files)
return name in files
if __name__ == "__main__":
server = Server(host = "192.168.3.11", user="ubuntu", key_filename="/Users/greg/.ssh/lightsail-oh... | 2.921875 | 3 |
tests/python/pants_test/build_graph/test_build_file_address_mapper.py | qma/pants | 0 | 43466 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... | 2.359375 | 2 |
libpebble2/communication/transports/pulse.py | dkirker/libpebble2 | 68 | 43467 | from __future__ import absolute_import
__author__ = '<NAME>'
import time
import struct
try:
from pebble import pulse2
except ImportError:
pass
from . import BaseTransport, MessageTargetWatch
from libpebble2.exceptions import ConnectionError, PebbleError
class PULSETransport(BaseTransport):
"""
Repr... | 2.59375 | 3 |
fairways/io/syn/oracle.py | dan-win/fairways_py | 0 | 43468 | # -*- coding: utf-8 -*-
import cx_Oracle
import re
from collections import namedtuple
from .base import (SynDataDriver)
import logging
log = logging.getLogger(__name__)
# RE_CONN_TEMPLATE = re.compile(r"(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<host>[^:^/]*)(?::(?P<port>[^/|^?]*))?(?:/(?P<path>.*))?")
RE_CONN_... | 2.859375 | 3 |
mflog/syslog.py | vincentchabot/mflog | 2 | 43469 | from logging.handlers import SysLogHandler
from logging import LogRecord
import json
class SyslogLoggerMsgOnlyFormatter(object):
def format(self, record):
return record.msg['event']
class SyslogLoggerJSONFormatter(object):
def format(self, record):
return json.dumps(record.msg)
class Sys... | 2.5 | 2 |
galleries/sql/queries/data_retriever.py | mnicolas94/galleries | 0 | 43470 | <filename>galleries/sql/queries/data_retriever.py<gh_stars>0
import abc
import numpy as np
from typing import List, Any, Dict, Optional
from galleries.annotations_filtering.filter import FilterStatement
class SqlDataRetriever:
@abc.abstractmethod
def get_indices(self, cursor, filters: List[List[FilterStatem... | 2.40625 | 2 |
baiocas/transports/base.py | ViViDboarder/baiocas | 0 | 43471 | <filename>baiocas/transports/base.py<gh_stars>0
import logging
import urllib.parse
from tornado.ioloop import IOLoop
from baiocas import errors
from baiocas.channel_id import ChannelId
from baiocas.message import Message
class Transport(object):
DEFAULT_MAXIMUM_NETWORK_DELAY = 10000
OPTION_MAXIMUM_NETWORK... | 2 | 2 |
setup.py | ifigueroap/hdptest | 0 | 43472 | <reponame>ifigueroap/hdptest
import setuptools
setuptools.setup(
name='hdptest',
version='0.3',
scripts=[],
author="<NAME>",
author_email="<EMAIL>",
description="Mecanismo simple para tests en Jupyter Notebooks",
url="https://github.com/ifigueroap/hdptest",
packages=setuptools.find_pack... | 1.273438 | 1 |
p5-b.py | preetipanwar/pylab_s4 | 1 | 43473 | <reponame>preetipanwar/pylab_s4<filename>p5-b.py
''' 5. b.
To get a string from a given string where
all occurrences of its first char have been
changed to '$', except the first char itself.
'''
word = input("Enter a long word: ") #arastratiosphecomyia
first_char = word[0] # set first character of ... | 3.765625 | 4 |
src/azure-cli/azure/cli/command_modules/synapse/manual/operations/accesscontrol.py | YuanyuanNi/azure-cli | 3,287 | 43474 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.828125 | 2 |
dripbot_neopixel.py | bobtiki/DripBot | 0 | 43475 | <filename>dripbot_neopixel.py
# NeoPixel library strandtest example
# Author: <NAME> (<EMAIL>)
#
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from neopixel import *
import argparse
import signal
import sys
def signal_handler(si... | 2.828125 | 3 |
core/csv_parser.py | 73k05/cfp-app-xml-generator | 1 | 43476 | <filename>core/csv_parser.py
import os
import lxml.etree as ET
import chardet
import pandas as pd
from lxml.etree import CDATA
from utils.log import write_log
def celltostr(cell):
if not pd.isnull(cell):
return str(cell)
return ''
def parse_generate(file_csv_path):
if not os.path.exists(file_c... | 3.140625 | 3 |
server/server/events/migrations/0002_auto_20210624_1022.py | omert-visiblerisk/connective | 4 | 43477 | <reponame>omert-visiblerisk/connective
# Generated by Django 3.1.11 on 2021-06-24 07:22
import django.core.validators
from django.db import migrations, models
import server.utils.model_fields
class Migration(migrations.Migration):
dependencies = [
('users', '0004_auto_20210624_1022'),
('events',... | 1.757813 | 2 |
backend/fastapi/fastapi_tutorial/path_params.py | spideynolove/Other-repo | 0 | 43478 | <gh_stars>0
from fastapi import FastAPI
from enum import Enum
rememeber = '''
- path operation decorator and function
- return the content
- Documentation
- Path Order matters
- Enum class
- render correctly
- Path parameters containing paths
- value : to get enum values
- API annotation and automatic documentation
'''... | 2.578125 | 3 |
scripts/convert_madmax_to_euroc.py | wstuerzl/granite | 20 | 43479 | <gh_stars>10-100
#!/usr/bin/env python3
import os
import argparse
import glob
import sophus as sp
import numpy as np
from scipy.spatial.transform import Rotation as R
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Convert morocco sequence to EuRoC format.")
parser.add_argume... | 2.515625 | 3 |
07_Natural_Language_Processing/C0707_Doc2Vec.py | zhuyuanxiang/tensorflow_cookbook | 7 | 43480 | # -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : tensorflow_cookbook
@File : C0707_Doc2Vec.py
@Version : v0.1
@Time : 2019-12-06 17:12
@License : ... | 2.21875 | 2 |
tensorflow/python/ipu/ops/op_util.py | pierricklee/tensorflow | 0 | 43481 | # Copyright 2020 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... | 1.640625 | 2 |
ml_logger/ml_logger_tests/test_cloud/test_s3.py | mcx/ml_logger | 107 | 43482 | <filename>ml_logger/ml_logger_tests/test_cloud/test_s3.py
"""
# AWS S3 Tests
"""
from os.path import join as pathJoin
import pytest
from ml_logger import logger
@pytest.fixture(scope='session')
def log_dir(request):
return request.config.getoption('--logdir')
@pytest.fixture(scope="session")
def setup(log_dir)... | 2.09375 | 2 |
dcgan/.ipynb_checkpoints/visual-checkpoint.py | Ontheway361/ak47GAN | 0 | 43483 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import torch
import numpy as np
from utils import Generator
import matplotlib.pyplot as plt
from IPython.display import HTML
import torchvision.utils as vutils
import matplotlib.animation as animation
from IPython import embed
if __name__ == "__main__":
... | 2.375 | 2 |
eval/fig5.py | tk2lab/logbesselk | 0 | 43484 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import ListedColormap
from . import common
def v_loc(x):
return 40*np.log10(x + 1)
def x_loc(x):
return 40*(np.log10(x) + 1)
def main(debug=False):
name = ['I', 'SCA', 'tfp']
suffi... | 2.6875 | 3 |
parser/team22/interfaz/interfaz.py | strickergt128/tytus | 1 | 43485 | <gh_stars>1-10
from tkinter import ttk,scrolledtext,Frame,Scrollbar,Canvas,Menu,Tk,VERTICAL
from funciones import Funciones_
class Interfaz_Ml:
def __init__(self,ventana):
#########################__Contenedor Principal__#######################
self.raiz = ventana
self.creaVentana()
... | 2.953125 | 3 |
main_module/__init__.py | T-R0D/Smok3_Tagg3r | 7 | 43486 | __author__ = 'Terence'
| 0.964844 | 1 |
asynctb/_tests/conftest.py | shamrin/asynctb | 6 | 43487 | import pytest
from asynctb._registry import HANDLING_FOR_CODE
from asynctb._glue import ensure_installed
@pytest.fixture
def local_registry():
ensure_installed()
prev_contents = list(HANDLING_FOR_CODE.items())
yield
HANDLING_FOR_CODE.clear()
HANDLING_FOR_CODE.update(prev_contents)
@pytest.fixtur... | 1.890625 | 2 |
my/core/__main__.py | ktaranov/HPI | 1 | 43488 | import os
from pathlib import Path
import sys
from subprocess import run, PIPE
from typing import Optional, Sequence, Iterable, List
import importlib
import traceback
from . import LazyLogger
log = LazyLogger("HPI cli")
import functools
@functools.lru_cache()
def mypy_cmd() -> Optional[Sequence[str]]:
try:
... | 2.15625 | 2 |
tests/ov/test_utils.py | ftheoleyre/openvisualizer | 6 | 43489 | <reponame>ftheoleyre/openvisualizer
#!/usr/bin/env python
import json
import logging.handlers
import pytest
# ============================ logging =========================================
from openvisualizer.utils import byteinverse, hex2buf, format_ipv6_addr, buf2int
LOGFILE_NAME = 'test_utils.log'
log = logging... | 2.09375 | 2 |
examples/wavelets.py | RandallBalestriero/TheanoXLA | 67 | 43490 | import symjax
import symjax.tensor as T
import matplotlib.pyplot as plt
import numpy as np
J = 5
Q = 4
scales = T.power(2, T.linspace(0.1, J - 1, J * Q))
scales = scales[:, None]
print(scales.get())
wavelet = symjax.tensor.signal.complex_morlet(5 * scales, np.pi / scales)
waveletw = symjax.tensor.signal.fourier_comp... | 2.125 | 2 |
random_walk/__init__.py | NishanthVAnand/new_env_gym | 0 | 43491 | <reponame>NishanthVAnand/new_env_gym
from gym.envs.registration import register
register(
id='RandomWalk-v0',
entry_point='random_walk.envs:RandomWalk',
timestep_limit=100,
) | 1.46875 | 1 |
scripts/create_catalog_for_gdal2tiles_tiles.py | granularag/pyspatial | 76 | 43492 | <reponame>granularag/pyspatial
import os
import sys
import json
import math
import pprint
import argparse
import logging
# log = logging.getLogger('geos.py')
# log.propagate = False
log = logging.getLogger(__file__)
# logging.basicConfig(stream = sys.stderr, level=logging.DEBUG, format='%(filename)s:%(lineno)s %(level... | 2.65625 | 3 |
automated_survey/admin.py | gaganmac/d4surveyHeroku | 55 | 43493 | <gh_stars>10-100
from django.contrib import admin
from .models import Question, QuestionResponse, Survey
# Register for models for use in admin interface
admin.site.register(Question, admin.ModelAdmin)
admin.site.register(QuestionResponse, admin.ModelAdmin)
admin.site.register(Survey, admin.ModelAdmin)
| 1.5625 | 2 |
migrations/versions/8b6b0dfd41ea_batch_history_table_creation_3.py | dandud/dabl | 2 | 43494 | <filename>migrations/versions/8b6b0dfd41ea_batch_history_table_creation_3.py<gh_stars>1-10
"""batch history table creation_3
Revision ID: <KEY>
Revises: 03949a380153
Create Date: 2021-11-02 21:33:05.445976
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'... | 1.507813 | 2 |
gost/gost.py | kste/aeshash | 5 | 43495 | '''
Created on Jan 7, 2014
@author: <NAME>
'''
import random
class GOST:
"""
A basic implementation of the round function of the
GOST hash function.
"""
# Constant values for KeySchedule function
C = [
<KEY>,
<KEY>,
0xf574dcac2bce2fc70a39fc286a3d843506f15e5f529c1f8bf2e... | 2.359375 | 2 |
python/SerialPort.py | ptracton/project_stub | 0 | 43496 | <gh_stars>0
#! /usr/bin/env python3
'''
This is our Serial Port class. It inherits from PySerial. We extend it for
our needs as a packet communication system.
'''
import array
import logging
import serial
import serial.tools.list_ports
import Packet
from constants import *
class SerialPort(serial.Serial):
"""... | 2.90625 | 3 |
CCC/CCC '14 S5 - Lazy Fox (9 of 15).py | Joon7891/Competitive-Programming | 2 | 43497 | <reponame>Joon7891/Competitive-Programming<filename>CCC/CCC '14 S5 - Lazy Fox (9 of 15).py
points = [[0, 0]]
n = int(input())
for i in range(n):
x, y = map(int, input().split())
points.append([x, y])
distance_pairs = []
for i in range(n + 1):
for j in range(i, n + 1):
dx = points[i][0] - points[j][0]
dy ... | 2.875 | 3 |
core/simulation.py | xlcbingo1999/CloudSimPy | 0 | 43498 | <gh_stars>0
from core.monitor import Monitor
class Simulation(object):
def __init__(self, env, cluster, task_broker, machine_broker, scheduler, event_file):
self.env = env
self.cluster = cluster
self.task_broker = task_broker
self.machine_broker = machine_broker
self.schedu... | 2.453125 | 2 |
Data Science With Python/22-network-analysis-in-python-(part-1)/02-important-nodes/07-networkx-betweenness-centrality-on-a-social-network.py | aimanahmedmoin1997/DataCamp | 3 | 43499 | '''
NetworkX betweenness centrality on a social network
Betweenness centrality is a node importance metric that uses information about the shortest paths in a network. It is defined as the fraction of all possible shortest paths between any pair of nodes that pass through the node.
NetworkX provides the nx.betweennes... | 3.984375 | 4 |