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 |
|---|---|---|---|---|---|---|
tomviz/python/Rotate3D.py | utkarshayachit/tomviz | 0 | 54800 | <filename>tomviz/python/Rotate3D.py
# Rotate a 3D dataset using SciPy Interpolation libraries.
#
# Developed as part of the tomviz project (www.tomviz.com).
def transform_scalars(dataset):
#----USER SPECIFIED VARIABLES-----#
###ROT_AXIS### #Specify Tilt Axis Dimensions x=0, y=1, z=2
###ROT_ANGLE### #... | 3.53125 | 4 |
insights/core/hydration.py | mglantz/insights-core | 1 | 54801 | import logging
import os
from insights.core import archives
from insights.core.archives import COMPRESSION_TYPES
from insights.core.context import ClusterArchiveContext, JDRContext, HostArchiveContext, SosArchiveContext
log = logging.getLogger(__name__)
def get_all_files(path):
all_files = []
for f in archi... | 2.15625 | 2 |
tuesday_speech/spoken_digit_system.py | trungnt13/uef-summerschool2018 | 0 | 54802 | import featext.feature_processing
from featext.mfcc import Mfcc
import numpy as np
import system.gmm_em as gmm
import system.ivector as ivector
import system.backend as backend
# UPDATE THIS FOLDER (folder to spoken digit dataset recordings):
data_folder = '/home/ville/files/recordings/'
speakers = ['jackson', 'nicol... | 2.53125 | 3 |
tests/test_statistics.py | glubbdubdrib/lazygrid | 1 | 54803 | <gh_stars>1-10
import unittest
class TestStatistics(unittest.TestCase):
def test_confidence_interval_mean_t(self):
import numpy as np
import lazygrid as lg
np.random.seed(42)
x = np.random.normal(loc=0, scale=2, size=10)
confidence_level = 0.05
l_bou... | 2.734375 | 3 |
elektro_planner/create_roombook.py | kellerroman/elekro_planner | 0 | 54804 | <filename>elektro_planner/create_roombook.py
#!/usr/bin/env python3
from elektro_planner.utils import find_object
from elektro_planner.data import *
def dict_delta(new, old):
temp = dict()
for x in new.keys():
temp[x] = new[x] - old[x]
return temp
def create_roombook(haus):
haus.room_count =... | 2.4375 | 2 |
src/qecsim/models/rotatedplanar/_rotatedplanarcode.py | MikeVasmer/qecsim | 35 | 54805 | import functools
import itertools
import operator
import numpy as np
from qecsim.model import StabilizerCode, cli_description
from qecsim.models.rotatedplanar import RotatedPlanarPauli
@cli_description('Rotated planar (rows INT >= 3, cols INT >= 3)')
class RotatedPlanarCode(StabilizerCode):
r"""
Implements ... | 3 | 3 |
lab/internal/logger/__init__.py | vidhiJain/lab | 0 | 54806 | import typing
from pathlib import PurePath
from typing import Optional, List, Union, Tuple, Dict
from lab.internal.logger.store.artifacts import Artifact
from lab.internal.logger.store.indicators import Indicator
from lab.internal.util.colors import StyleCode
from .destinations.factory import create_destination
from .... | 2.03125 | 2 |
labdrivers/labdrivers/lakeshore/__init__.py | RMUlti/Alex | 0 | 54807 | <gh_stars>0
from .ls332 import Ls332
| 1.0625 | 1 |
tabular/src/autogluon/tabular/models/lr/lr_preprocessing_utils.py | huibinshen/autogluon | 0 | 54808 | from sklearn.base import BaseEstimator, TransformerMixin
from autogluon.features.generators import OneHotEncoderFeatureGenerator
class OheFeaturesGenerator(BaseEstimator, TransformerMixin):
def __init__(self):
self._feature_names = []
self._encoder = None
def fit(self, X, y=None):
se... | 2.484375 | 2 |
card_draw_chance.py | Matt-Crow/SmallPythonPrograms | 1 | 54809 | def int_input(msg):
inp = raw_input(msg)
try:
inp = int(inp)
if inp <= 0:
print("Please enter a non-negative number")
return int_input(msg)
else:
return inp
except:
print("Please enter a valid non-decimal number")
return int_input(msg)
def run():
global starting_hand
... | 3.78125 | 4 |
awsherder.py | Kahn/awsherder | 1 | 54810 | <reponame>Kahn/awsherder
from flask import Flask, request, redirect, session, json, g, render_template, flash, abort
from flask_sqlalchemy import SQLAlchemy
from flask_openid import OpenID
from flask_sslify import SSLify
from wtforms import Form, BooleanField, TextField, PasswordField, validators, SelectField
import ur... | 1.726563 | 2 |
evaluator.py | nel215/lightgbm-mean-teacher | 0 | 54811 | <reponame>nel215/lightgbm-mean-teacher
from chainer import reporter as reporter_module
from chainer.dataset import convert
from chainer.training.extensions import Evaluator
from chainer.backends import cuda
from sklearn.metrics import roc_auc_score
class AUCEvaluator(Evaluator):
def evaluate(self):
itera... | 2.15625 | 2 |
PythonAPI/agents/navigation/basic_agent.py | anshulpaigwar/carla | 1 | 54812 | <gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2018 Intel Labs.
# authors: <NAME> (<EMAIL>)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
""" This module implements an agent that roams around a track following random
waypoints and avoiding... | 3.40625 | 3 |
archive/Tensorflow-101/ep4-multi-indexing.py | IncredibleDevHQ/incredible-dev-videos | 2 | 54813 | # Multi Indexing a Tensor
import tensorflow as tf
rank_2 = tf.constant(
[[1, 2],[3, 4],[5, 6]], dtype=tf.float16)
print(rank_2[1, 1].numpy())
# 4.0
print("Second row:", rank_2[1, :].numpy())
# Second row: [3. 4.]
print("Second column:", rank_2[:, 1].numpy())
# Second column: [2. 4. 6.]
# Skip first row :
rank_2[1:,... | 3.140625 | 3 |
tests/test_response.py | rayattack/pyrouterling | 1 | 54814 | <filename>tests/test_response.py<gh_stars>1-10
from json import dumps
from http import HTTPStatus as status
from unittest import TestCase
from routerling import ResponseWriter
from routerling.constants import MESSAGE_NOT_FOUND
response = ResponseWriter()
def test_headers_encoding():
response.headers = 'content... | 3 | 3 |
bert/bert_model.py | qianyingw/bioner | 1 | 54815 | <filename>bert/bert_model.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 30 12:45:12 2020
@author: qwang
"""
from transformers import BertPreTrainedModel, BertConfig, BertModel
from transformers import DistilBertPreTrainedModel, DistilBertConfig, DistilBertModel
import torch
import torch.nn... | 2.578125 | 3 |
app.py | hazybluedot/jekyll-html-hook | 0 | 54816 | <filename>app.py
import logging
import os
from datetime import datetime, timedelta
import json
import sys
from flask import Flask, request, make_response, jsonify
from raven.contrib.flask import Sentry
import app_config
import hmac
from hashlib import sha1
from rq import Queue
from rq.job import Job
from worker impo... | 2.265625 | 2 |
u24_lymphocyte/third_party/treeano/sandbox/nodes/tests/lrn_test.py | ALSM-PhD/quip_classification | 45 | 54817 | import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import lrn
fX = theano.config.floatX
def ground_truth_normalizer(bc01, k, n, alpha, beta):
"""
This code is adapted from pylearn2.
https://github.com/l... | 2.296875 | 2 |
tutorials/sst/tests/test_cli_commands.py | plutasnyy/tutorials | 0 | 54818 | <reponame>plutasnyy/tutorials<gh_stars>0
import os
from os.path import abspath
from pathlib import Path
import pytest
from click.testing import CliRunner
from sst import cli
from tests.path_utils import get_tests_dir
STATIC_FILES = Path(get_tests_dir() + os.sep + 'static')
example_input = abspath(STATIC_FILES / "tr... | 2.1875 | 2 |
tests/pdf/text/test_mark_line_labels.py | alexgorji/musurgia | 0 | 54819 | from pathlib import Path
from musurgia.pdf.line import HorizontalLineSegment, HorizontalSegmentedLine, VerticalSegmentedLine
from musurgia.pdf.pdf import Pdf
from musurgia.unittest import TestCase
path = Path(__file__)
class TestMarkLineLabels(TestCase):
def setUp(self) -> None:
self.pdf = Pdf()
... | 2.921875 | 3 |
oec_web.py | OpenExoplanetCatalogue/oec_web | 19 | 54820 | <filename>oec_web.py<gh_stars>10-100
#import xml.etree.ElementTree as ET
import lxml.etree as ET
import glob
import os
import time
import urllib
import difflib
import copy
import json
import visualizations
import oec_filters
import datetime
import oec_fields
from bson.objectid import ObjectId
from functools import wrap... | 2.390625 | 2 |
object_detection/serving_script/predict.py | qq2016/kubeflow_learning | 1,165 | 54821 | """ Script to send prediction request.
Usage:
python predict.py --url=YOUR_KF_HOST/models/coco --input_image=YOUR_LOCAL_IMAGE
--output_image=OUTPUT_IMAGE_NAME.
This will save the prediction result as OUTPUT_IMAGE_NAME.
The output image is the input image with the detected bounding boxes.
"""
import argparse
imp... | 2.9375 | 3 |
tests/playerActionTests.py | Capocane/keyforge-simulator | 0 | 54822 | from tests.keyforgeTest import *
class PlayCardsTest(KeyforgeTest):
def test_playCardWithAmberBonus_gainAmber(self):
card = Action(TEST_HOUSE, 1)
self.set_active_player_state(hand=[card], activeHouse = TEST_HOUSE)
self.player.play_card(card)
self.assertEqual(self.player.get_a... | 2.515625 | 3 |
IntroProPython/listagem/capitulo 11/11.29 - Novas classes - listagem parcial.py | SweydAbdul/estudos-python | 0 | 54823 | <filename>IntroProPython/listagem/capitulo 11/11.29 - Novas classes - listagem parcial.py
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: <NAME>
# Editora Novatec (c) 2010-2017
# Primeira edição - Novembro/2010 - ISBN 978-85-75... | 3.515625 | 4 |
python/isbn-verifier/isbn_verifier.py | gdantaas/Exercism-Python | 0 | 54824 | def is_valid(isbn):
from functools import reduce
import string
isbn = isbn.replace('-', '')
if len(isbn) != 10 or not isbn[:-1].isnumeric() or isbn[-1] not in string.digits + 'X':
return False
else:
weights = range(10, 0, -1)
digits = [10 if dig == 'X' else int(dig) for dig ... | 3.515625 | 4 |
core/tests/unittests/models/test_bagged_ensemble_model.py | daobook/autogluon | 1 | 54825 | <reponame>daobook/autogluon<gh_stars>1-10
import pandas as pd
from autogluon.core.models import BaggedEnsembleModel
from autogluon.core.utils.utils import CVSplitter
def test_generate_fold_configs():
y = pd.Series([0, 0, 0, 1, 1, 1, 1, 1])
X = pd.DataFrame([[0], [0], [0], [0], [0], [0], [0], [0]])
k_fo... | 2.09375 | 2 |
Code/cosmos_lumfunc.py | sbussmann/Bussmann2015 | 0 | 54826 | """
Estimate luminosity function in COSMOS from interferometric follow-up of
Miettinen+ 2014, Younger+ 2007, and Younger+2009.
"""
import numpy
import matplotlib.pyplot as plt
from pylab import savefig
from astropy.table import Table
import matplotlib
def MonteCarloCounts(fluxes, errors):
hist890, bin_edges =... | 2 | 2 |
byceps/blueprints/admin/news/forms.py | GSH-LAN/byceps | 33 | 54827 | """
byceps.blueprints.admin.news.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
import re
from flask_babel import lazy_gettext
from wtforms import FileField, StringField, TextAreaField
from wtforms.fields.html5 import DateField, TimeFi... | 1.890625 | 2 |
tests/mappers/test_email_mapper.py | adolnik/oozie-to-airflow | 61 | 54828 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2019 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 appl... | 2.015625 | 2 |
custom_components/tankerkoenig/binary_sensor.py | jressel01/homeassistant-tankerkoenig | 0 | 54829 | <gh_stars>0
"""
A component/platform which allows you to get fuel prices from tankerkoenig.
For more details about this component, please refer to the documentation at
https://github.com/panbachi/homeassistant-tankerkoenig
"""
import logging
from datetime import timedelta
from . import TankerkoenigDevice, CONF_STATIO... | 2.765625 | 3 |
mogu/assrule/apriori.py | vishalbelsare/MoguNumerics | 10 | 54830 | <filename>mogu/assrule/apriori.py
from operator import and_
from itertools import combinations
import csv
from numba import jit
class AprioriAssociationRule:
def __init__(self, inputfile):
self.transactions = []
self.itemSet = set([])
inf = open(inputfile, 'rb')
reader = csv.reade... | 2.71875 | 3 |
examples/static_react_task/run_task.py | anchit/Mephisto | 0 | 54831 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import shutil
import subprocess
from mephisto.operations.operator import Operator
from mephisto.operations.uti... | 1.6875 | 2 |
client/agc_monitor/reg_validator.py | vandersonpc/agc_monitor | 14 | 54832 | from PySide2.QtGui import QValidator
class RegValidator(QValidator):
def __init__(self, max_value):
super().__init__()
self.max_value = max_value
def validate(self, text, pos):
if text == '':
return QValidator.Acceptable
try:
value = int(text, 8)
... | 3.078125 | 3 |
arcfire/arcfire/migrations/0002_auto_20151112_0336.py | allanberry/arcfire | 0 | 54833 | # -*- coding: utf-8 -*-
# Generated by Django 1.9b1 on 2015-11-12 03:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('arcfire', '0001_initial'),
]
operations = [
... | 1.671875 | 2 |
LHBackEnd/userprofile/urls.py | minhthong582000/LH-back-end | 0 | 54834 | from django.urls import path
from django.conf.urls import url
from . import views
from django.views.generic.base import RedirectView
from rest_framework.urlpatterns import format_suffix_patterns
app_name = 'userprofile'
urlpatterns = [
path('profile/<int:pk>/', views.OtherUserDetail.as_view()), #includes favorite... | 1.9375 | 2 |
COVID-19-TweetIDS-ES-Analyse.py | remydecoupes/covid19-tweets-mood-tetis | 0 | 54835 | #!/usr/bin/env python
"""
analyse Elasticsearch query
"""
import json
from elasticsearch import Elasticsearch
from elasticsearch import logger as es_logger
from collections import defaultdict, Counter
import re
import os
from datetime import datetime
# Preprocess terms for TF-IDF
import numpy as np
import pandas as pd... | 2.40625 | 2 |
bbpyp/common/model/queue_factory.py | BloggerBust/bbpyp | 0 | 54836 | from bbpyp.common.exception.bbpyp_value_error import BbpypValueError
from bbpyp.common.model.queue_type import QueueType
class QueueFactory:
def __init__(self, fifo_queue_factory, sequence_queue_factory):
self._fifo_queue_factory = fifo_queue_factory
self._sequence_queue_factory = sequence_queue_f... | 2.671875 | 3 |
mozinor/config/classifiers.py | Jwuthri/Mozinor | 3 | 54837 | # -*- coding: utf-8 -*-
"""
Created on July 2017
@author: JulienWuthrich
"""
from mozinor.config.params import *
from mozinor.config.explain import *
Fast_Classifiers = {
"ExtraTreesClassifier": {
"import": "sklearn.ensemble",
'n_estimators': n_estimators,
"criterion": criterion,
... | 2.015625 | 2 |
setup.py | OpenJarbas/pymetal | 6 | 54838 | from distutils.core import setup
setup(
name='pymetal',
version='0.5.0',
packages=[],
install_requires=["requests", "bs4", "requests_cache",
"random-user-agent", "lxml"],
url='https://www.github.com/OpenJarbas/pymetal',
license='Apache2.0',
author='jarbasAi',
autho... | 1.140625 | 1 |
stock deep learning/4-6.K-Means.py | nosy0411/Deep-learning-project | 0 | 54839 | <reponame>nosy0411/Deep-learning-project
# K-Means clustering
# 참고 자료 : <NAME>, First contact with tensorflow (page 27)
#
# 2018.08.21, 아마추어퀀트 (조성현)
# ----------------------------------------------------------------
import tensorflow as tf
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import numpy as... | 3.140625 | 3 |
unit_tests/test_kerberos_handlers.py | openstack-charmers/charm-kerberos-keytab | 0 | 54840 | <reponame>openstack-charmers/charm-kerberos-keytab
import mock
import charms.reactive
import unit_tests.test_utils
from unittest.mock import patch
import charms_openstack.test_utils as test_utils
# Mock out reactive decorators prior to importing reactive.kerberos_keytab
dec_mock = mock.MagicMock()
dec_mock.return_val... | 2 | 2 |
kaori/plugins/gacha/commands/test_analysis.py | austinpray/kizuna | 3 | 54841 | import os
from .analysis import generate_report_charts
def test_report():
from ..engine.test.cards import sachiko, matt_morgan, ubu, xss, balanced_S, low_dmg
data = [sachiko, matt_morgan, ubu, ubu, xss, balanced_S, low_dmg]
report = generate_report_charts(data)
for f in report.values():
f.... | 2.28125 | 2 |
core/scan/factory.py | abdallah-elsharif/WRock | 14 | 54842 |
from core.scan.executor import *
def executorFactory(config: ScannerConfig):
return GeneralScanExecutor(config) | 1.320313 | 1 |
algorithms/triangle/triangle.py | zhyu/leetcode | 5 | 54843 | <filename>algorithms/triangle/triangle.py
class Solution:
# @param triangle, a list of lists of integers
# @return an integer
def minimumTotal(self, triangle):
n = len(triangle)
dp = triangle[-1]
for i in xrange(n-2, -1, -1):
for j in xrange(i+1):
dp[j] =... | 3.40625 | 3 |
orpy/client/base.py | indigo-dc/orpy | 3 | 54844 | <reponame>indigo-dc/orpy
# -*- coding: utf-8 -*-
# Copyright 2019 Spanish National Research Council (CSIC)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... | 1.859375 | 2 |
tests/encoding/test_lib.py | Defense-Cyber-Crime-Center/dfvfs | 2 | 54845 | # -*- coding: utf-8 -*-
"""Shared test cases."""
import unittest
class DecoderTestCase(unittest.TestCase):
"""The unit test case for decoder object implementions."""
| 1.570313 | 2 |
models/layers.py | dailybudushu/NAS-Lung | 23 | 54846 | import typing
import torch
import torch.nn as nn
import torch.nn.functional as F
from .net_sphere import *
class ResCBAMLayer(nn.Module):
"""
CBAM+Res model
"""
def __init__(self, in_planes, feature_size):
super(ResCBAMLayer, self).__init__()
self.in_planes = in_planes
self.f... | 2.296875 | 2 |
NLP - Spelling Correction/formatter.py | ekingungor/assignments | 0 | 54847 | # -*- coding: utf-8 -*-
import collections
import json
import re
punct = re.compile(r'(\w+)')
PATH_FOR_TXT_FILE = "base.txt"
PATH_FOR_1_GRAM_JSON = '1-grams_count_dictionary.json'
PATH_FOR_2_GRAM_JSON = '2-grams_count_dictionary.json'
#str(input("1-gram json file name withOUT .json")) + ".json"# to take the file na... | 3.59375 | 4 |
geolib/models/dsheetpiling/water_level.py | Deltares/geolib | 4 | 54848 | <filename>geolib/models/dsheetpiling/water_level.py
from typing import Optional
from geolib.models import BaseDataClass
from .internal import WaterLevel as InternalWaterLevel
from .settings import DistributionType
class WaterLevel(BaseDataClass):
name: str
level: float
distribution_type: DistributionTyp... | 2.484375 | 2 |
Dataset/Leetcode/valid/98/709.py | kkcookies99/UAST | 0 | 54849 | <gh_stars>0
class Solution:
def look(self, root, ret):
if root is None: return
self.look(root.left, ret)
ret.append(root.val)
self.look(root.right, ret)
def XXX(self, root: TreeNode) -> bool:
if not root: return True
ret = []
self.look(root, ret)
pre = ret[0... | 3.015625 | 3 |
Multi_Agent/QMIX&Rule-based/cityflow_env.py | hrushikeshjadhav9/Multi-Commander | 79 | 54850 | <reponame>hrushikeshjadhav9/Multi-Commander<filename>Multi_Agent/QMIX&Rule-based/cityflow_env.py
import cityflow
import pandas as pd
import os
import json
import math
import numpy as np
import itertools
# from sim_setting import sim_setting_control
class CityFlowEnv(object):
def __init__(self,
lane... | 2.40625 | 2 |
PRIMEIRO MUNDO - FIRST WORLD/Convertendo temperatura - 14.py | MatheusKlebson/Python-Course | 0 | 54851 | <reponame>MatheusKlebson/Python-Course<filename>PRIMEIRO MUNDO - FIRST WORLD/Convertendo temperatura - 14.py
#Exercício Python 014: Escreva um programa que converta uma temperatura digitando em graus Celsius
# converta para graus Fahrenheit.
c = float(input("Temperatura em celsius: "))
f = c * 9/5 + 32
print("Converten... | 4.15625 | 4 |
stand-alone-testing-of-alt-sql-from-proc-solns/python/proc-vs-top-level-sql-for-multi-stmt-txns/cmn.py | d-uspenskiy/tpcc | 9 | 54852 | <gh_stars>1-10
import argparse
import psycopg2
import datetime
# ----------------------------------------------------------------------------------------
class DbSession:
def __init__(self, params):
self.session = psycopg2.connect(params.connect_str)
self.session.set_session(isolation_level="repea... | 2.5 | 2 |
myuw/dao/card_display_dates.py | uw-it-aca/myuw | 18 | 54853 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
Generates the booleans to determine card visibility,
based on dates in either the current, next, or previous term.
https://docs.google.com/document/d/14q26auOLPU34KFtkUmC_bkoo5dAwegRzgpwmZEQMhaU
"""
import logging
import traceb... | 2.5 | 2 |
src/python_code/Models/PAE_models/Encoder.py | ipmach/Thesis2021 | 0 | 54854 | import tensorflow as tf
class Encoder(tf.keras.Model):
def __init__(self, dim, **kwargs):
"""
Encoder model
:param dim: hyperparameters of the model [h_dim, z_dim]
:param dropout: Noise dropout [0,1]
:param kwargs: Keras parameters (Optional)
"""
h_dim = di... | 3.046875 | 3 |
build/externals/build_python-geoip/examples/domain.py | adityaddy/GSoC_CernVM-FS | 20 | 54855 | #!/usr/bin/python
from __future__ import print_function
import GeoIP
gi = GeoIP.open("/usr/local/share/GeoIP/GeoIPDomain.dat", GeoIP.GEOIP_STANDARD)
print(gi.org_by_addr("24.24.24.24"))
| 1.992188 | 2 |
xor/model.py | pdyck/deep-learning-agi | 0 | 54856 | from keras.models import Sequential
from keras.layers.core import Dense, Activation
def XOR():
model = Sequential()
model.add(Dense(8, input_dim=2))
model.add(Activation('tanh'))
model.add(Dense(1))
model.add(Activation('sigmoid'))
return model
| 3 | 3 |
lambdata_davidvollendroff/df_utils.py | jamesluttringer2019/lambdata | 0 | 54857 | """
Utility functions for working with DataFrames
"""
import pandas
import numpy as np
TEST_DF = pandas.DataFrame([1,2,3])
class O:
"""
A square shaped block for my PyTetris game.
"""
def __init__(self):
self.type = "O"
self.color = (255, 255, 0)
mold = np.zeros([24, 10]) # fr... | 3.6875 | 4 |
src/api/models.py | ppknUWr/backend-bbz | 1 | 54858 | from django.db import models
import api.json_worker as json_worker
"""
ABSTRACT MODEL
Class BibliographyTemplateModel
Handles all fields that are in our bibliography databases.
"""
class BibliographyTemplateModel(models.Model):
# FIELDS GO HERE
id = models.IntegerField(primary_key=True) #1 - ID rekordu (inte... | 2.5 | 2 |
tests/test_strategy.py | zozzz/yapic.di | 0 | 54859 | import pytest
from yapic.di import Injector, InjectError, VALUE, FACTORY, SCOPED_SINGLETON, SINGLETON
def test_strategy_value():
injector = Injector()
provided = "VALUE"
injector.provide("V", provided, VALUE)
assert injector["V"] == "VALUE"
assert injector["V"] is provided
assert injector.pro... | 2.515625 | 3 |
Projects/1/Analysis/10/Exploit.py | Opty-MISCE/SS | 0 | 54860 | <reponame>Opty-MISCE/SS
from requests import session, get
from random import randint
from sys import argv
from Common.Driver import runScript
SERVER = argv[1]
attackerSERVER = "http://web.tecnico.ulisboa.pt/ist190774/SSof/R2Ai2t0bslrVyMxUOUyO.html"
victimSession = session()
victimUsername = str(randint(2 ** 27, 2 ** ... | 2.796875 | 3 |
qulab/cli/notebook.py | feihoo87/QuLab | 16 | 54861 | import re
import sys
from notebook.notebookapp import main
from qulab.utils import ShutdownBlocker
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
with ShutdownBlocker('jupyter-notebook'):
sys.exit(main())
| 1.4375 | 1 |
LeetCode-All-Solution/Python3/LC-0436-Find-Right-Interval.py | YuweiYin/Algorithm_YuweiYin | 0 | 54862 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0436-Find-Right-Interval.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-05-20
===============================... | 3.828125 | 4 |
binary_search_tree.py | vikashchy/ds_python | 1 | 54863 | <filename>binary_search_tree.py
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert(root, node):
if root is None:
root = node
return root
if node.value < root.value:
root.left = insert(root.left, node)
... | 3.90625 | 4 |
fredholm/self-consistent.py | Aniket-Pradhan/fredholm | 3 | 54864 | from numpy import log, pi, arange, exp
from scipy.optimize import brentq
import matplotlib.pyplot as plot
from matplotlib import rc
import equation
def diagram_sum(x, d):
return 4.*pi/log(d**2 *2.*x)
def diagram_sum_3body(x, d):
point=equation.equation(3.*x,'2D',20.,0.1,d)
point.solve()
g3=point.g3
... | 2.546875 | 3 |
cla_backend/apps/cla_butler/management/commands/monitor_multiple_outcome_codes.py | uk-gov-mirror/ministryofjustice.cla_backend | 3 | 54865 | <reponame>uk-gov-mirror/ministryofjustice.cla_backend
# coding=utf-8
import logging
from django.core.management.base import BaseCommand
from django.db.models import Count, Max, Min
from django.utils.timezone import now
from cla_eventlog.models import Log
logger = logging.getLogger(__name__)
class Command(BaseCommand... | 1.945313 | 2 |
debian/_sysconfigdata.py | Hadron/python | 2 | 54866 | import sys
if hasattr(sys, 'gettotalrefcount'):
from _sysconfigdata_dm import *
else:
from _sysconfigdata_m import *
| 1.445313 | 1 |
KeepItUp/repeatingtimer.py | yoavfrancis/KeepItUp | 1 | 54867 | <filename>KeepItUp/repeatingtimer.py<gh_stars>1-10
#Courtsey of <NAME> / https://github.com/mushkevych/scheduler
from datetime import datetime
import threading
class RepeatingTimer(threading.Thread):
def __init__(self, interval, callable, args=[], kwargs={}):
threading.Thread.__init__(self)
# in... | 3.3125 | 3 |
ProbCovTXRXDet.py | hpaulkeeler/detcov_python | 0 | 54868 | # Simulates a network with nodes, where each node can be either a
# transmitter or receiver (but not both) at any time step. The simulation
# examines the coverage based on the signal-to-interference ratio (SINR).
# The network has a random medium access control (MAC) scheme based on a
# determinantal point process, as... | 3.03125 | 3 |
prequ/repositories/base.py | wgarlock/prelaunch | 13 | 54869 | # coding: utf-8
from __future__ import (
absolute_import, division, print_function, unicode_literals)
from abc import ABCMeta, abstractmethod
from ..utils import is_pinned_requirement
try:
from abc import ABC
except ImportError:
class ABC(object):
__metaclass__ = ABCMeta
class BaseRepository(AB... | 2.671875 | 3 |
setup.py | tklijnsma/qondor | 1 | 54870 | from setuptools import setup
with open("qondor/include/VERSION", "r") as f:
version = f.read().strip()
setup(
name="qondor",
version=version,
license="BSD 3-Clause License",
description="Description text",
url="https://github.com/tklijnsma/qondor.git",
author="<NAME>",
author_email="<E... | 1.3125 | 1 |
mall/celery_tasks/sms/tasks.py | DanaLee1990/meiduo | 0 | 54871 |
"""
任务:
1、就是普通函数
2、该函数必须通过celery的实例对象的tasks装饰其装饰
3、该任务需要让celery实例对象自动检测
4、任务(函数)需要使用任务名(函数名).delay() 进行调用
"""
from libs.yuntongxun.sms import CCP
from celery_tasks.main import app
@app.task
def send_sms_code(mobile,sms_code):
ccp = CCP()
ccp.send_template_sms(mobile, [sms_code, 5], 1)
| 2.109375 | 2 |
start.py | yiyedata/simplified-scrapy | 7 | 54872 | #!/usr/bin/python
#coding=utf-8
from simplified_scrapy.simplified_main import SimplifiedMain
SimplifiedMain.startThread()
| 1.085938 | 1 |
holobot/sdk/exceptions/authorization_error.py | rexor12/holobot | 1 | 54873 | class AuthorizationError(Exception):
def __init__(self, user_id: int):
super().__init__(f"Unauthorized access from the user with the identifier '{user_id}'.")
| 2.609375 | 3 |
algorithms/reverseInteger/reverseInteger.py | zhyu/leetcode | 5 | 54874 | <reponame>zhyu/leetcode<filename>algorithms/reverseInteger/reverseInteger.py
class Solution:
# @return an integer
def reverse(self, x):
int_max = 2147483647
limit = int_max/10
if x > 0:
sig = 1
elif x < 0:
sig = -1
x = -x
else:
... | 3.359375 | 3 |
delay-rss.py | julien-hadleyjack/delay-rss | 0 | 54875 | #!/usr/bin/env python3
# -- coding: utf-8 --
import datetime
from dateutil import parser, tz
from lxml import etree
from flask import Flask, request, abort, make_response, Response
from flask_appconfig import AppConfig
import requests
def create_app(configfile=None):
app = Flask("delayrss")
AppConfig(app, c... | 2.640625 | 3 |
petstagram/petstagram/common/tests.py | batsandi/petstagram_2 | 0 | 54876 | import unittest
from django.core.exceptions import ValidationError
from petstagram.common.validators import MaxFileSizeInMbValidator
class FakeFile:
size = 5
class FakeImage:
file = FakeFile()
class MaxFileSizeInMbValidatorTests(unittest.TestCase):
def test_when_file_is_bigger__expect_to_raise(self):... | 2.6875 | 3 |
examples/example_loop.py | RadostW/stochastic | 2 | 54877 | <reponame>RadostW/stochastic
import pychastic # solving sde
import pygrpy.jax_grpy_tensors # hydrodynamic interactions
import pywrithe # computing writhe of closed curve
import jax.numpy as jnp # jax array operations
import jax #... | 2.21875 | 2 |
utils/split_data.py | ronilp/tumor-classification | 1 | 54878 | import os
import csv
import sys
from sklearn.model_selection import train_test_split
sys.path.append("..")
from training_config import RANDOM_SEED, ALLOWED_CLASSES, DATA_DIR
def stratified_split(X, y, test_size=0.2, validate_size=0.2, random_state=42):
X_train, X_test, y_train, y_test = train_test_split(X, y, str... | 2.765625 | 3 |
src/third_party/swiftshader/third_party/subzero/pydir/gen_test_arith_ll.py | rhencke/engine | 2,151 | 54879 | <filename>src/third_party/swiftshader/third_party/subzero/pydir/gen_test_arith_ll.py
def mangle(op, op_type, signed):
# suffixMap gives the C++ name-mangling suffixes for a function that takes two
# arguments of the given type. The first entry is for the unsigned version of
# the type, and the second entry is fo... | 2.203125 | 2 |
src/Lexer.py | blankettripod/Pastrel | 0 | 54880 | import Utility
from Error import *
from Token import *
L_NUMBERS = '.0123456789'
L_WHITESPACE = ' \t\n'
L_ARITHMETIC_OPERATORS = '+-*/'
L_CONDITIONAL_OPERATORS = '=<>'
L_EXTENDED_CONDITIONAL_OPERATORS = ['==', '>=', '<=', '!=']
L_MISC_OPERATORS = "()[]{}<>?:;"
L_STRING_STARTERS = "'\""
L_CHARACTERS = "abcdefghijklmnop... | 3.078125 | 3 |
JPS_ARBITRAGE/python/caresjpsarbitrage/print_headers.pyw | mdhillmancmcl/TheWorldAvatar-CMCL-Fork | 21 | 54881 | <reponame>mdhillmancmcl/TheWorldAvatar-CMCL-Fork<filename>JPS_ARBITRAGE/python/caresjpsarbitrage/print_headers.pyw<gh_stars>10-100
def print_headers():
headers = [
"V_energyF_Electricity_001,",
"V_Costs_Transport_USGC-NEA_NaturalGas_001,",
"V_Costs_MediumPressureSteam_001,",
"V_Costs_CoolingWater_001,",
"V_mas... | 1.507813 | 2 |
pyfibre/tests/utils.py | franklongford/ImageCol | 2 | 54882 | import os
def delete_log():
if os.path.exists('pyfibre.log'):
os.remove('pyfibre.log')
| 2.234375 | 2 |
service/joke.py | mitom18/jarvis | 0 | 54883 | import requests
def get_programming_joke() -> str:
joke = "// This line doesn't actually do anything, but the code stops working when I delete it."
response = requests.get(
"https://sv443.net/jokeapi/v2/joke/Programming?format=txt&type=single")
if response.status_code == 200:
joke = respon... | 3.078125 | 3 |
unittests/discordremotetestcase.py | gcurtis79/OctoPrint-DiscordRemote | 0 | 54884 | from unittest import TestCase
class DiscordRemoteTestCase(TestCase):
def assertBasicEmbed(self, embeds, title, description, color, author):
self.assertEqual(1, len(embeds))
first_embed = embeds[0].get_embed()
self.assertEqual(title, first_embed['title'])
self.assertEqual(descriptio... | 2.78125 | 3 |
tests/models/jax/test_jax_ite.py | AliciaCurth/CATENets | 33 | 54885 | from copy import deepcopy
import pytest
from catenets.datasets import load
from catenets.experiment_utils.tester import evaluate_treatments_model
from catenets.models.jax import FLEXTE_NAME, OFFSET_NAME, FlexTENet, OffsetNet
LAYERS_OUT = 2
LAYERS_R = 3
PENALTY_L2 = 0.01 / 100
PENALTY_ORTHOGONAL_IHDP = 0
MODEL_PARAM... | 2.125 | 2 |
scripts/mgear/maya/shifter/gui.py | KRNKRS/mgear | 94 | 54886 | import os
from functools import partial
# pymel
import pymel.core as pm
# mgear
import mgear
from mgear.maya import shifter, skin, pyqt, utils
GUIDE_UI_WINDOW_NAME = "guide_UI_window"
GUIDE_DOCK_NAME = "Guide_Components"
##############################
# CLASS
##############################
class Guide_UI(object):... | 2.265625 | 2 |
tk_file_download/download_frame.py | minminopk/PySnippet | 0 | 54887 | # -*- coding: UTF-8 -*-
"""TK版文件下载
技术要点:1 自定义事件;2 UI线程和子线程数据通信
"""
from Tkinter import *
import sys,os
import urllib
import threading
import Queue
import tkMessageBox
class Event(object):
REFLASH = '<<Reflash>>'
class MWindow(Frame):
def __init__(self):
Frame.__init__(self)
self.master.title... | 3.0625 | 3 |
tools/spaceSwitcher/python/spaceswitcher/__init__.py | koborit/SpaceSwitcherSample | 0 | 54888 | <reponame>koborit/SpaceSwitcherSample<filename>tools/spaceSwitcher/python/spaceswitcher/__init__.py
"""
MIT License
Copyright (c) 2017 <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 witho... | 1.8125 | 2 |
trace_simexp/cmdln_args/prepro.py | damar-wicaksono/trace-simexp | 0 | 54889 | <reponame>damar-wicaksono/trace-simexp<gh_stars>0
# -*- coding: utf-8 -*-
"""
trace_simexp.cmdln_args.prepro
******************************
Module to parse command line arguments used in the pre-processing step
"""
from .._version import __version__
__author__ = "<NAME>"
def get() -> tuple:
r"""Pars... | 2.625 | 3 |
pyscriptman/hosts/localhost.py | reap2sow1/pyscriptman | 0 | 54890 | <reponame>reap2sow1/pyscriptman
"""The 'LocalHost' host class module."""
# Standard Library Imports
import os
import pathlib
from os.path import expanduser
# Third Party Imports
# Local Application Imports
from pyscriptman.hosts.host import Host
from util.message import Message
class LocalHost(Host):
"""The 'Lo... | 3.03125 | 3 |
main.py | camehu2022/cotacao_moeda | 0 | 54891 | from flask import Flask, render_template, redirect
import requests
import json
app: Flask = Flask( __name__ )
@app.route( "/" )
def index():
cotacao = requests.get("https://economia.awesomeapi.com.br/last/USD-BRL,EUR-BRL,BTC-BRL")
cotacao = cotacao.json()
cotacao_bit = cotacao['BTCBRL']['bid']
cotaca... | 2.765625 | 3 |
exercises from lesson/5.py | mo1cy/goiteens-python3-rudiy | 0 | 54892 | <gh_stars>0
first_day = 500 #accounts deleted
pair_user = 50 #hrn
odd_user = 40 #hrn
profit = 500 #hrn
pair_users = 250 * pair_user #hrn
odd_users = 250 * odd_user #hrn
total_loss_of_deleted_users = pair_users + odd_users
total_loss = profit - total_loss_of_deleted_users
print("total loss:" ,total_loss)
| 2.25 | 2 |
test/util/skl/util_skl_impute.py | bomtuckle/pyrolite | 69 | 54893 | <filename>test/util/skl/util_skl_impute.py
import unittest
import numpy as np
from pyrolite.util.synthetic import normal_frame
from pyrolite.comp.codata import close
try:
import sklearn
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
HAVE_SKLEARN = True
def test_class... | 2.546875 | 3 |
reader/fnoData/stkOptDailyDataWrapper.py | sifarone/gce_k8s_deployment | 0 | 54894 | <reponame>sifarone/gce_k8s_deployment<filename>reader/fnoData/stkOptDailyDataWrapper.py
from . import fnoUtils as utils
class StkOptDailyDataWrapper:
def __init__(self, dailyData):
self.date = utils.convertDateToString(dailyData['date'])
self.stkOptOpenPrice ... | 2.203125 | 2 |
scrips/benchmark/benchmark_mmdist_analysis.py | lonelu/Metalprot | 0 | 54895 | <reponame>lonelu/Metalprot<filename>scrips/benchmark/benchmark_mmdist_analysis.py
'''
The function here is for analyzing the effect of metal-metal-distance on scoring and protein backbone sensitivity.
After search the ~500 benchmark protein with metal-metal-distance [0.15, 0.25...1.05]
Check the score changes.
'''
... | 1.984375 | 2 |
geomagio/imfv122/IMFV122Parser.py | usgs/geomag-algorithms | 49 | 54896 | <gh_stars>10-100
"""Parsing methods for the IMFV122 Format."""
import numpy
from obspy.core import UTCDateTime
# values that represent missing data points in IAGA2002
EIGHTS = numpy.float64("888888")
NINES = numpy.float64("999999")
class IMFV122Parser(object):
"""IMFV122 parser.
Based on documentation at:... | 2.84375 | 3 |
bgheatmaps/__init__.py | MathieuBo/bg-heatmaps | 10 | 54897 | from bgheatmaps.heatmaps import heatmap
from bgheatmaps.planner import plan
from bgheatmaps.slicer import get_structures_slice_coords
| 1.132813 | 1 |
app/test_app.py | Sadch/ws-github-concepts | 0 | 54898 | import pytest
from run import app
@pytest.fixture
def client():
app.config["TESTING"] = True
with app.test_client() as client
| 1.539063 | 2 |
StockAndFlowInPython/depreciated/SFD_display_0.py | Rutherford1895/SFD_Canvas | 3 | 54899 | <reponame>Rutherford1895/SFD_Canvas
import math
from tkinter import *
# matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from StockAndFlowInPython.depreciated.classes import global_model as glbele
class SFDCanvas(Frame):
def __init__(self, master, stocks, flows, auxs, conn... | 2.625 | 3 |