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 |
|---|---|---|---|---|---|---|
imgMS/MSData.py | nikadilli/imgMS | 0 | 47900 | <reponame>nikadilli/imgMS
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
import pandas as pd
import warnings
from decimal import Decimal
import datetime
import logging
import itertools
from imgMS.side_functions import *
from imgMS.MSEval import *
class MSDa... | 2.203125 | 2 |
tfkit/model/once/dataloader.py | voidful/TFk | 0 | 47901 | <filename>tfkit/model/once/dataloader.py
from tfkit.utility import tok
from tfkit.utility.dataloader import get_gen_data_from_file
get_data_from_file = get_gen_data_from_file
def preprocessing_data(item, tokenizer, maxlen=512, handle_exceed='start_slice', **kwargs):
tasks, task, input, targets = item
p_targe... | 2.59375 | 3 |
river/optim/base.py | online-ml/creme | 1,105 | 47902 | import abc
import numbers
from typing import Union
import numpy as np
from river import base, optim, utils
VectorLike = Union[utils.VectorDict, np.ndarray]
__all__ = ["Initializer", "Scheduler", "Optimizer", "Loss"]
class Initializer(base.Base, abc.ABC):
"""An initializer is used to set initial weights in a ... | 3.203125 | 3 |
scripts/multiplexer/tester/client.py | j0lama/powder-demo | 14 | 47903 | <gh_stars>10-100
import socket
import time
def assembleMSG(teid):
buf = bytearray()
buf.append(0x00)
buf.append(0x00)
buf.append(0x00)
buf.append(0x00)
buf.append((teid >> 24) & 0xFF)
buf.append((teid >> 16) & 0xFF)
buf.append((teid >> 8) & 0xFF)
buf.append(teid & 0xFF)
buf.append(0xFF)
return buf
def getT... | 2.640625 | 3 |
haros_plugin_pbt_gen/selectors.py | git-afsantos/haros-plugin-pbt | 0 | 47904 | <gh_stars>0
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
# Copyright © 2019 <NAME>
###############################################################################
# Imports
###############################################################################
from builtins import map
from builtins import object
f... | 3.078125 | 3 |
test/test_cases/bad_end_google.py | PFacheris/flake8-function-definition | 0 | 47905 | def foo(bar1, bar2, bar3,
bar4
): # FD102
return
| 1.453125 | 1 |
keras-to-tensorflowjs/keras-to-tensorflowjs.py | mristin/mediti-experimental | 0 | 47906 | #!/usr/bin/env python3
"""Quantize and convert a keras model to tensorflowjs model."""
import argparse
import pathlib
import tempfile
import numpy as np
import tensorflow as tf
import tensorflowjs as tfjs
def main() -> None:
"""Execute the main routine."""
##
# Parse command-line arguments
##
... | 2.953125 | 3 |
apps/blog/template.py | Bean-jun/PersonBlogSystemFlask | 0 | 47907 | <reponame>Bean-jun/PersonBlogSystemFlask
from flask import request
from apps.blog import home_blueprint
from apps.models import Category
@home_blueprint.app_template_global("category_navigate")
def category_navigate():
"""导航栏"""
category_obj = Category.query.all()
return category_obj
# 前端template页面可以使用这... | 2.109375 | 2 |
tests/application/test_factory.py | AlexKouzy/ethnicity-facts-and-figures-publisher | 1 | 47908 | from flask import render_template_string
from werkzeug.test import EnvironBuilder, run_wsgi_app
class TestTemplateGlobals:
def test_static_mode(self, single_use_app):
@single_use_app.route("/test-globals")
def test_globals():
return render_template_string("""{{ static_mode }}""")
... | 2.203125 | 2 |
funcs.py | blookot/rsa2elk | 18 | 47909 | #!/usr/bin/env python
########################################################################
# RSA2ELK, by <NAME>
# Converts Netwitness log parser configuration to Logstash configuration
# see https://github.com/blookot/rsa2elk
########################################################################
import config
i... | 2.6875 | 3 |
Ar_Script/unittest_demo/BBS/test_case/page_obj/base.py | archerckk/PyTest | 0 | 47910 | <filename>Ar_Script/unittest_demo/BBS/test_case/page_obj/base.py
class Page(object):
'''
页面基类,用于所有页面的继承
初始化,地址,驱动,超时时间
打开网页方法
查找单个元素方法
查找多个元素方法
页面打开检查
调用JavaScript代码
'''
bbs_url='https://mail.qq.com'
def __init__(self,selenium_driver,base_url=bbs_url,parent=None):
... | 2.484375 | 2 |
commons/Helpers/Helper_zip.py | swxs/home | 1 | 47911 | # -*- coding: utf-8 -*-
import os
import shutil
import io
import zipfile
from commons.Utils import path_utils
class ZipHelper(object):
@classmethod
def _get_arcname(cls, old_arcname, new_arcname):
if old_arcname is not None:
return os.path.join(old_arcname, new_arcname)
else:
... | 2.96875 | 3 |
backend/env_collection/env_creator.py | MU-Software/dodoco | 6 | 47912 | import json
import pathlib
import traceback
import typing
def get_traceback_msg(err):
return ''.join(traceback.format_exception(
etype=type(err),
value=err,
tb=err.__traceback__))
def json_to_envfiles(output_file: pathlib.Path):
try:
output_na... | 2.453125 | 2 |
alshamelah_api/apps/authors/models.py | devna-dev/durar-backend | 0 | 47913 | <reponame>devna-dev/durar-backend
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ..core.models import BaseModel
class Author(BaseModel):
name = models.CharField(max_length=100, verbose_name=_(u'name'), null=False, blank=False)
class Meta:
verbose_name_plura... | 2.046875 | 2 |
utils/user_funcs.py | Naughtsee/qtbot | 8 | 47914 | <reponame>Naughtsee/qtbot
import asyncpg
class PGDB:
def __init__(self, pg_con):
self.pg_con = pg_con
async def fetch_user_info(self, member_id: int, column: str):
query = f"""SELECT {column} FROM user_info WHERE member_id = {member_id};"""
return await self.pg_con.fetchval(query)
... | 2.640625 | 3 |
contentcuration/contentcuration/utils/export_writer.py | neo640228/studio | 0 | 47915 | # -*- coding: utf-8 -*-
import csv
import logging as logmodule
import math
import os
import sys
import tempfile
from collections import OrderedDict
# On OS X, the default backend will fail if you are not using a Framework build of Python,
# e.g. in a virtualenv. To avoid having to set MPLBACKEND each time we use Studi... | 1.617188 | 2 |
ground.py | despargy/Shade | 3 | 47916 | <filename>ground.py
#!/usr/bin/python3
import socket , requests
import json
import threading
import sys , time, os
import logger
class GroundClient:
def __init__(self, elinkmanager_ip):
if elinkmanager_ip == 'local':
self.uplink_host = socket.gethostname()
else:
self.uplin... | 2.875 | 3 |
ephys_anonymizer/__init__.py | alexrockhill/video_anonymize | 0 | 47917 | <filename>ephys_anonymizer/__init__.py
"""A anonymization toolbox for video and neuroimaging files."""
__version__ = '0.1.5'
from ephys_anonymizer.anonymizer import video_anonymize, raw_anonymize # noqa
| 1.148438 | 1 |
266/Palindrome Permutation.py | cccccccccccccc/Myleetcode | 0 | 47918 | <reponame>cccccccccccccc/Myleetcode
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset)<=1
A = Solution()
s = "aab"
pri... | 3.125 | 3 |
2020/2/2-1.py | jonathonball/adventofcode | 1 | 47919 | <reponame>jonathonball/adventofcode<filename>2020/2/2-1.py
#!/usr/bin/python3
import sys
total_valid = 0
for line in sys.stdin:
raw = line.strip()
rules, password = raw.split(":")
ranges, character = rules.split(" ")
min_range, max_range = [ int(x) for x in ranges.split("-") ]
count ... | 3.265625 | 3 |
Voice Analysis/Python/SVM/AudioSignal.py | lokesh9460/Realtime-Interview-Emotion-Analysis | 574 | 47920 | import os
import numpy
from pydub import AudioSegment
from scipy.fftpack import fft
class AudioSignal(object):
def __init__(self, sample_rate, signal=None, filename=None):
# Set sample rate
self._sample_rate = sample_rate
if signal is None:
# Get file name and file extensio... | 3.171875 | 3 |
Extended Programming Challenges Python/Problem Collatza/collatz.py | szachovy/School-and-Training | 0 | 47921 | <reponame>szachovy/School-and-Training
from enum import Enum, unique
import mywarnings
@unique
class numberKind(Enum):
int = 'int'
float = 'float'
def userInterface():
while True:
kind = input("What kind of number do you want to input ->")
if kind == 'int' or kind == 'float':
... | 3.515625 | 4 |
bricks/ev3dev/modules/pybricks/tools.py | ZPhilo/pybricks-micropython | 115 | 47922 | # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
# Expose method and class written in C
from _pybricks.tools import wait, StopWatch
# Imports for DataLog implementation
from utime import localtime, ticks_us
class DataLog:
def __init__(self, *headers, name="log", timestamp=True, exte... | 2.453125 | 2 |
sentences/sentence21.py | kelltrill/scifibot | 5 | 47923 | <filename>sentences/sentence21.py
from sentences.base_sentence import base_sentence
class sentence21(base_sentence):
def get_sentence(self, components):
sentence = 'The ' + components['primary_actor_desc']
sentence += ' ' + components['primary_actor']
sentence += ' runs for ' ... | 3.09375 | 3 |
crane_controllers/external/casadi-3.4.5/test/python/matrix.py | tingelst/crane | 2 | 47924 | <reponame>tingelst/crane<gh_stars>1-10
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 <NAME>, <NAME>, <NAME>,
# <NAME>. All rights reserved.
# Copyright (C) 2011-2014 <NAME>
#
# CasADi is free softwa... | 2.265625 | 2 |
pipeline/nodes/adj_vol.py | HippieAtrophy/NeuroMet2_structural_analysis | 0 | 47925 | # -*- coding: utf-8 -*-
"""
#The following formula is used
#Adjusted Volume = Raw Volume - Regression Slope * (TIV - Cohort Mean TIV)
#Reference Literature: Voevodskaya et al, 2014: The effects of intracranial volume adjustment approaches on multiple regional MRI volumes in healthy aging and Alzheimer's disease
"""
i... | 2.34375 | 2 |
app.py | loftysky/slackwhereis | 0 | 47926 | from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from flask import Flask, request, Response, jsonify
from slackclient import SlackClient
import datetime
try:
import a... | 2.875 | 3 |
PyLESA/run.py | andrewlyden/PyLESA | 6 | 47927 | <reponame>andrewlyden/PyLESA
"""run module
runs the models and outputs
"""
import glob
import os
import time
import read_excel
import parametric_analysis
import inputs
import fixed_order
import mpc
import outputs
# print excel file names in input folder
path = os.path.join(os.path.dirname(__file__)... | 2.625 | 3 |
test_auth_app/backend/db_set_users.py | MalyshevValery/testweb | 0 | 47928 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
__author__ = "<EMAIL>"
from test_auth_app.backend import test_auth_app_db
from test_auth_app.backend.db_models import User, Role, Application
from test_auth_app.backend.db_models import ... | 2.046875 | 2 |
Reducer/__main__.py | Dahk/MapReduce | 0 | 47929 | import sys
from cos_backend import COSBackend
import json
import re
import pika
class ReduceCallback(object):
def __init__ (self, cb, target_bucket, nthreads):
self.cb = cb
self.target_bucket = target_bucket
self.nthreads = nthreads
self.result = {} # where we... | 2.328125 | 2 |
activecollab_digger/views.py | kingsdigitallab/django-activecollab-digger | 0 | 47930 | <reponame>kingsdigitallab/django-activecollab-digger
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse
from django.views.generic.base import TemplateView
from .activecollab import get_activecollab, post_activecollab
class IndexPageView(Log... | 1.921875 | 2 |
evaluation.py | BashirSbaiti/CKD-Net-SF2020 | 0 | 47931 | from tensorflow import keras
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
model = keras.models.load_model("Saved models/2layerNet.h5")
x = np.load("data/preprocessedInputs.npy")
y = np.load("data/outputs.npy")
oosx = np.load("data/testx.npy")
oosy = np.load("data/testy.npy")
... | 2.78125 | 3 |
pathgather/providers.py | tonybaloney/pathgather | 1 | 47932 | # -*- coding: utf-8 -*-
# Licensed to <NAME> (<EMAIL>) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... | 2.015625 | 2 |
iocage/tests/unit_tests/1000_cli_activate_test.py | project-fifo/iocage | 0 | 47933 | import mock
import pytest
from iocage.cli.activate import\
(get_zfs_pools, set_zfs_pool_active_property, set_zfs_pool_comment)
@mock.patch('iocage.cli.activate.Popen.communicate')
def test_get_zfs_pools_multiple_pools(mock_communicate):
""" Fake the expected output from zpool list -H -o name
on a syst... | 2.1875 | 2 |
positionEncoding.py | GehartM/german-text-watermarking | 1 | 47934 | from treeNode import TreeNode
from collections import defaultdict
from treeNodeTravelThrewTreeNodes import TravelThrewTreeNodes
# In positionEncoding wird die Zugehörigkeit der Ecodierung zu ihrem Wert festgelegt.
# Dieser Wert entspricht der Position des Buchstabens der nächsten Zeile.
positionEncoding = defa... | 2.609375 | 3 |
revenue/utils/date_utils.py | osnory/BE-Challenge | 0 | 47935 | <filename>revenue/utils/date_utils.py
import datetime
from datetime import datetime as dt
API_DATE_FORMAT = "%d/%m/%Y"
CSV_DATE_FORMAT = "%d/%m/%y %H:%M"
def from_api_string(date: str):
"""
:param date: in format as comes from api, such as 03/06/2020
:return: datetime object.
"""
return dt.strp... | 3.578125 | 4 |
pool.py | Reno-Greenleaf/tomb | 0 | 47936 | from actor import Actor, Location, Passage, Switch, Ghost
from json import load
class Pool(dict):
""" Contains ingame objects. """
def fill(self):
with open('data/actors.json', 'r') as data:
actors = load(data)
for name, properties in actors.items():
self._build(properties, name)
with ope... | 3.25 | 3 |
mass_mer/models.py | georgiawang5332/meatFoodManager | 0 | 47937 | <reponame>georgiawang5332/meatFoodManager
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.urls import reverse
# Create your models here.
# results = Mass_Mer_Person.objects.all()
# results = Mass_Mer_Person.objects.create(user=user, title="some time")
class Mass_Mer_Pers... | 2.34375 | 2 |
tests/test_equity.py | the-Arki/portfolio-tracker | 0 | 47938 | <filename>tests/test_equity.py
from defer import return_value
from src.stock import Equity
from src.io_manager import read_json
import pytest
equity_info = read_json('./tests/equity_info.json')
equity = Equity('MSFT')
def test__get_info(mocker):
mocker.patch('src.stock.Equity._get_info', return_value=equity_inf... | 2.296875 | 2 |
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/data_specification/constants.py | Roboy/LSM_SpiNNaker_MyoArm | 2 | 47939 | """
Constants used by the Data Structure Generator (DSG)
and the Spec Executor
"""
# MAGIC Numbers:
# Data spec magic number
DSG_MAGIC_NUM = 0x5B7CA17E
# Application data magic number
APPDATA_MAGIC_NUM = 0xAD130AD6
# Version of the file produced by the DSE
DSE_VERSION = 0x00010000
# DSG Arrays and tables sizes:
MAX... | 1.515625 | 2 |
argentum-api/api/tests/data/configs.py | devium/argentum | 1 | 47940 | from api.models.config import Config
from api.tests.utils.test_objects import TestObjects
class TestConfigs(TestObjects):
MODEL = Config
POSTPAID_LIMIT: MODEL
POSTPAID_LIMIT_PATCHED: MODEL
@classmethod
def init(cls):
# These models are created in the initial Django signal, not from this... | 2.34375 | 2 |
dql/grammar/common.py | ikonst/dql | 0 | 47941 | <reponame>ikonst/dql<filename>dql/grammar/common.py
""" Common use grammars """
from pyparsing import (
Word,
upcaseTokens,
Optional,
Combine,
Group,
alphas,
nums,
alphanums,
quotedString,
Keyword,
Suppress,
Regex,
delimitedList,
Forward,
oneOf,
OneOrMore,... | 2.609375 | 3 |
src/datasets/mnist.py | dem123456789/Speech-Emotion-Recognition-with-Dual-Sequence-LSTM-Architecture | 6 | 47942 | <reponame>dem123456789/Speech-Emotion-Recognition-with-Dual-Sequence-LSTM-Architecture
import codecs
import gzip
import numpy as np
import os
import torch
from PIL import Image
from torch.utils.data import Dataset
from utils import makedir_exist_ok
from .utils import download_url, make_branch_classes_to_labels
class M... | 2.875 | 3 |
pkgs/sdk-pkg/src/genie/libs/sdk/triggers/shutnoshut/vlan/shutnoshut.py | miott/genielibs | 94 | 47943 | ''' implementation for Vlan shut/noshut triggers'''
# import python
import time
# Genie Libs
from genie.libs.sdk.libs.utils.mapping import Mapping
from genie.libs.sdk.triggers.shutnoshut.shutnoshut import \
TriggerShutNoShut
| 1.210938 | 1 |
2020/20/sea_monster.py | cheshyre/advent-of-code | 1 | 47944 | def get_sea_monster():
sea_monster = [
" # ",
"# ## ## ###",
" # # # # # # ",
]
return sea_monster, len(sea_monster), len(sea_monster[0])
def mark_sea_monsters_at_coord(grid, x, y):
sm, sm_y, sm_x = get_sea_monster()
for yval in range(y, y + sm_y):
for xval ... | 3.453125 | 3 |
numpy_backend/environment.py | alewis/jax_vumps | 0 | 47945 | import numpy as np
import scipy as sp
from scipy.sparse.linalg import LinearOperator, lgmres, gmres
import tensornetwork as tn
import jax_vumps.numpy_backend.contractions as ct
# import jax_vumps.numpy_backend.mps_linalg as mps_linalg
def LH_linear_operator(A_L, lR):
"""
Return, as a LinearOperator, the LH... | 2.0625 | 2 |
FatherSon/HelloWorld2_source_code/Listing_23-11.py | axetang/AxePython | 1 | 47946 | # Listing_23-11.py
# Copyright Warren & <NAME>, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# Crazy Eights - the main loop with scoring added
# Note that this is not a complete program. It needs to be put together
# ... | 3.71875 | 4 |
mindefuse/strategy/swaszek/agent/agent.py | sinistro14/mindefuse | 0 | 47947 | <filename>mindefuse/strategy/swaszek/agent/agent.py
#!/usr/bin/env python3.7
from abc import ABC, abstractmethod
class Agent(ABC):
@abstractmethod
def agent_choice(self, possibilities):
"""
Returns the choice of the specific agent
:param possibilities: list of all possible solutions ... | 3.390625 | 3 |
utils.py | yizt/keras-lbl-IvS | 22 | 47948 | # -*- coding: utf-8 -*-
"""
File Name: utils
Description :
Author : mick.yi
date: 2019/1/4
"""
import numpy as np
def enqueue(np_array, elem):
"""
入队列,新增元素放到队首,队尾元素丢弃
:param np_array: 原始队列
:param elem: 增加元素
:return:
"""
np_array[1:] = np_arra... | 2.796875 | 3 |
Python/klampt/robotcspace.py | bbgw/Klampt | 0 | 47949 | <filename>Python/klampt/robotcspace.py
import cspace
import robotsim
import robotcollide
from cspaceutils import AdaptiveCSpace
class RobotCSpace(AdaptiveCSpace):
"""A basic robot cspace that allows collision free motion.
Warning: if your robot has non-standard joints, like a free-
floating base or contin... | 3.1875 | 3 |
backend/widgets/github_discussions.py | MLH-Fellowship/fellow-dashboard | 1 | 47950 | <filename>backend/widgets/github_discussions.py<gh_stars>1-10
from flask_restful import Resource
from utils.error_handling import handle_github_request_errors
import requests
class GithubPodList(Resource):
def get(self, oAuth_token):
headers = {
"Accept": "application/vnd.github.v3+json",
... | 2.65625 | 3 |
frankenpoem/__init__.py | ruthlee/frankenpoems | 3 | 47951 | import random
import pandas as pd
import pronouncing
from collections import defaultdict
import re
import pkg_resources
def load_data():
stream = pkg_resources.resource_stream(__name__, 'data.pkl.compress')
return pd.read_pickle(stream, compression="gzip")
def define_structure():
length = random.randint(4... | 3.03125 | 3 |
tree_math/integration_test.py | cgarciae/tree-math | 108 | 47952 | <reponame>cgarciae/tree-math
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.6875 | 3 |
urls.py | audaciouscode/PassiveDataKit-Django | 5 | 47953 | # pylint: disable=line-too-long
from django.conf.urls import url
from django.contrib.auth.views import LogoutView
from django.conf import settings
from .views import pdk_add_data_point, pdk_add_data_bundle, pdk_app_config, pdk_issues, \
pdk_issues_json, pdk_fetch_metadata_json
urlpatterns = [
... | 1.914063 | 2 |
footy/test/clubs/test_club_gateway.py | bryce-klinker/hello-python | 0 | 47954 | import unittest
from nose.tools import *
from footy.test_data.test_data_paths import premier_league_2015_2016_path
from footy.src.clubs.club_gateway import ClubGateway
class ClubGatewayTest(unittest.TestCase):
def setUp(self):
self.gateway = ClubGateway(premier_league_2015_2016_path)
def test_get_al... | 2.671875 | 3 |
species/read/read_color.py | vandalt/species | 0 | 47955 | """
Module with reading functionalities of color and magnitude data from photometric and
spectral libraries.
"""
import os
import configparser
from typing import Optional, Tuple
import h5py
import numpy as np
from typeguard import typechecked
from species.core import box
from species.read import read_spectrum
from... | 2.921875 | 3 |
feed/tests/serializers/test_serialize.py | cul-it/arxiv-rss | 4 | 47956 | <filename>feed/tests/serializers/test_serialize.py
from typing import Optional
import pytest
from lxml import etree
from feed.domain import DocumentSet
from feed.consts import FeedVersion
from feed.serializers import serialize, Feed
from feed.errors import FeedError, FeedVersionError
@pytest.fixture
def documents()... | 2.28125 | 2 |
Coursera/Contar palavras.py | tobiaspontes/ScriptsPython | 0 | 47957 | <gh_stars>0
''' Esta função conta o número de ocorrências de cada palavra em uma frase '''
def count_words(sentence):
for s in ".:!&@$%^&": sentence=sentence.replace(s,'')
for s in "\n\r\t,_": sentence=sentence.replace(s,' ')
counts={}
for word in sentence.lower().split():
word = word.strip... | 3.796875 | 4 |
examples/Exercise1A_properties.py | marcelosalles/pyidf | 19 | 47958 | <filename>examples/Exercise1A_properties.py
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.simulation_parameters import Building
from pyidf.thermal_zones_and_surfaces import GlobalGeometryRules
from pyidf.thermal_zones_and_surfaces import BuildingSurfaceDetailed
from ... | 1.890625 | 2 |
django_pandas/managers.py | thedrow/django-pandas | 1 | 47959 | <reponame>thedrow/django-pandas
from django.db.models.query import QuerySet
from model_utils.managers import PassThroughManager
from .io import read_frame
class DataFrameQuerySet(QuerySet):
def to_pivot_table(self, fieldnames=(), verbose=True,
values=None, rows=None, cols=None,
... | 3.046875 | 3 |
k-way_merge/k_smallest_number.py | mridulpant2010/algorithms | 0 | 47960 | <gh_stars>0
import heapq
def find_k_closest_numbers(lis,k,n):
he=[]
#merged=[]
heapq.heapify(he)
for i in range(len(lis)):
heapq.heappush(he,(lis[i][0],(i,0)))
#print(he,len(he))
numberCount=0
top=0
while he:
top,pos=heapq.heappop(he)
#print(top,... | 3.234375 | 3 |
psychic/nodes/faster.py | wmvanvliet/psychic | 0 | 47961 | <reponame>wmvanvliet/psychic
from ..faster import interpolate_channels
from .basenode import BaseNode
class InterpolateChannels(BaseNode):
"""Interpolate channels from surrounding channels.
This implementation was adapted by the original one by <NAME> for
the MNE-Python toolbox (https://github.com/mne-too... | 2.9375 | 3 |
my/league.py | seanbreckenridge/HPI | 36 | 47962 | """
Parses league of legend history from my `lolexport.parse` format
from: https://github.com/seanbreckenridge/lolexport
"""
REQUIRES = ["git+https://github.com/seanbreckenridge/lolexport"]
# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example
from my.config i... | 2.875 | 3 |
aboutme/migrations/0001_initial.py | tharindubasnnayaka/MyWebApp | 2 | 47963 | # Generated by Django 2.1a1 on 2018-07-30 18:50
import aboutme.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Me',
fields=[
('id', ... | 1.953125 | 2 |
abintb/spin.py | abyellow/abin-tight-binding | 1 | 47964 | import numpy as np
from time import time
#from itertools import product
import sys
import matplotlib.pyplot as plt
#from matplotlib.colors import LogNorm
from sshPES import PES
from sshIniData import SSHIniData
from sshHf import SSHHf
#from mpl_toolkits.mplot3d import Axes3D
class pseudoSpin(PES):
def integral_PES... | 2.53125 | 3 |
api/api/admin/controllers.py | apiotrowsky/click-event-patterns | 0 | 47965 | <filename>api/api/admin/controllers.py
from flask import Blueprint, request
import api
from api.filehandling.FileManager import handelCSVfile, saveCsvFile, getLatestCsvFile, isCsvFilesDirEmpty, saveTagsFile, \
getLatestTagsFile
admin = Blueprint('admin', __name__)
@admin.route('/uploadCsv', methods=['POST'])
def... | 2.40625 | 2 |
app/plugin/playco/redis_db.py | MU-Software/mudev_backend | 0 | 47966 | <reponame>MU-Software/mudev_backend<filename>app/plugin/playco/redis_db.py
import copy
import datetime
import flask
import json
import typing
import app.common.utils as utils
import app.database as db_module
import app.database.user as user_module
import app.database.jwt as jwt_module
import app.database.playco.playli... | 1.960938 | 2 |
main.py | codeforbtv/courtbot-vt | 2 | 47967 | <filename>main.py
"""
This script should be run periodically to update the codeforbtv/court-calendars repo
Usage:
python3 main.py
"""
import src.parse.calendar_parse as parser
import src.github_database.write_events as event_writer
import src.mongo.write_to_mongo as write_mongo
from dotenv import load_dotenv
import o... | 2.84375 | 3 |
src/algorithms.py | IsakFalk/active_learning_code | 0 | 47968 | <reponame>IsakFalk/active_learning_code<gh_stars>0
"""
All algorithms used for subsampling dataset in a smart way
"""
import numpy as np
import scipy.linalg as linalg
from tqdm import tqdm
class MCSampling:
"""Uniformly sample from X by shuffling the indices and returning a new matrix"""
def __init__(self, ... | 3.21875 | 3 |
fjcommon/qsuba_git_helper.py | fab-jul/fjcommon | 2 | 47969 | <reponame>fab-jul/fjcommon
#!/usr/bin/env python
import os
import sys
import subprocess
import argparse
def unique_checkout(unique_id, git_url, git_checkout):
"""
Flow:
if exists unique_id:
cd unique_id
git fetch
else:
git clone git_rul unique_id
cd uinque_id
git check... | 2.625 | 3 |
awesomecure/md2dict.py | protontypes/OpenCurate | 6 | 47970 | import sys
import re
from pprint import pprint
sample = { 'awesome-cancer-variant-databases':
{ 'Cancer':
{
'Clinically-focused':
[{'CanDL': 'https://candl.osu.edu' }],
'Catalogs':
[{ 'COSMIC':
... | 2.453125 | 2 |
emotion_detection/train_test.py | AbhinavGoudBingi/Text-and-Emotion-from-Speech | 0 | 47971 | from collections import OrderedDict
import logging
import warnings
warnings.filterwarnings("ignore")
logging.basicConfig(filename="runtime.log", \
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', \
datefmt='%d-%b-%y %H:%M:%S', \
level=logging.DEBUG, filemode="a")
import torch
import torch... | 2.25 | 2 |
cardinal_pythonlib/wsgi/cache_mw.py | RudolfCardinal/pythonlib | 10 | 47972 | <filename>cardinal_pythonlib/wsgi/cache_mw.py<gh_stars>1-10
#!/usr/bin/env python
# cardinal_pythonlib/cache_mw.py
"""
===============================================================================
Original code copyright (C) 2009-2021 <NAME> (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed... | 1.726563 | 2 |
sum-of-multiples/sum_of_multiples.py | KrishanBhasin/exercism | 0 | 47973 | def check_if_multiple(test_num,list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num%i:
return test_num
return 0
def sum_of_multiples(number, multiples_list = None):
multiples_list = multiples_list or [3,5]
#implicitly check if None is passed to the function
return sum(l... | 4.25 | 4 |
src/dbn_samples.py | jamesrobertlloyd/kmc-research | 9 | 47974 | <gh_stars>1-10
"""
Generate and save samples from a dbn trained on mnist
Created Decemeber 2013
@authors: <NAME> (<EMAIL>)
"""
import numpy as np
import matplotlib.pyplot as plt
import itertools
import os.path
import cloud
from deep_learning.rbm_label import train_rbm
from deep_learning.logistic_sgd import load_d... | 2.59375 | 3 |
wmsmanager/forms.py | dbca-asi/borgcollector | 0 | 47975 | from django import forms
from tablemanager.models import Workspace
from wmsmanager.models import WmsServer,WmsLayer
from borg_utils.form_fields import GeoserverSettingForm,MetaTilingFactorField,GridSetField
from borg_utils.form_fields import GroupedModelChoiceField
class WmsServerForm(forms.ModelForm,GeoserverSetting... | 2.125 | 2 |
tensorflow/examples/custom_ops_doc/sleep/sleep_test.py | EricRemmerswaal/tensorflow | 7 | 47976 | <reponame>EricRemmerswaal/tensorflow
# Copyright 2021 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/LICEN... | 2.5625 | 3 |
tests/test_types.py | juniorcarvalho/python-btr | 0 | 47977 | <reponame>juniorcarvalho/python-btr<filename>tests/test_types.py
from decimal import InvalidOperation
import pytest
from binance.types import Results, Trading, format_fee
def test_results_attributes():
tr = Results(
datetime_value='2018-11-13 01:58:03',
pair='STORMBTC',
type_operation='SE... | 2.328125 | 2 |
vampire/models/basic.py | kmayerb/vampire | 14 | 47978 | <filename>vampire/models/basic.py
"""
Kristian's original 2-layer VAE.
Model diagram with 35 latent dimensions and 100 dense nodes:
https://user-images.githubusercontent.com/112708/48358766-4f7a7e00-e650-11e8-9bab-d7a294548100.png
"""
import numpy as np
import keras
from keras.models import Model
from keras.layers i... | 2.796875 | 3 |
morse-stf/stensorflow/homo_enc/homo_mul.py | alipay/Antchain-MPC | 33 | 47979 | <filename>morse-stf/stensorflow/homo_enc/homo_mul.py<gh_stars>10-100
#!/usr/bin/env python
# coding=utf-8
"""
Ant Group
Copyright (c) 2004-2021 All Rights Reserved.
------------------------------------------------------
File Name : homo_mat_mul
Author : <NAME>
Email: <EMAIL>
Create Time : 2021/9/30... | 2.265625 | 2 |
setup.py | IvanProgramming/dnevnik_mos_ru | 19 | 47980 | <gh_stars>10-100
from setuptools import setup, find_packages
from dnevnik import __version__
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name='dnevnik-mos-ru',
version=__version__,
description="This package is kind of wrapper for dnevnik.mos.ru API service"... | 1.71875 | 2 |
pyprocessing/renderer/tkinter/renderer.py | InfiniteSwerve/pyprocessing | 0 | 47981 | import tkinter as tk
from pyprocessing.renderer.tkinter.window import Window
class TkRenderer:
def __init__(self, pyprocessing):
self.pp = pyprocessing
self.root = None
self.window = None
self.this = self
def init(self):
self.root = tk.Tk()
w = self.pp.namespac... | 3.046875 | 3 |
erica/api/v2/endpoints/tax.py | digitalservice4germany/erica | 3 | 47982 | from uuid import UUID
from fastapi import status, APIRouter
from starlette.requests import Request
from starlette.responses import FileResponse, RedirectResponse
from erica.api.v2.responses.model import response_model_get_tax_number_validity_from_queue, response_model_post_to_queue
from erica.application.JobService.job... | 2.375 | 2 |
hdbo/febo/labels.py | eric-vader/HD-BO-Additive-Models | 5 | 47983 | def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
# env = config['experiment.simple']['environment'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = ge... | 2.296875 | 2 |
libsvc/persistence/__init__.py | derekmerck/endpoint | 0 | 47984 | <reponame>derekmerck/endpoint
from .persistence import PersistenceBackend, ShelfMixin
from .redis_persistence import RedisPersistenceBackend | 1.117188 | 1 |
py/redrock/__init__.py | michaelJwilson/redrock | 14 | 47985 | <filename>py/redrock/__init__.py<gh_stars>10-100
"""
redrock
=======
Redrock redshift fitter.
"""
from __future__ import absolute_import, division, print_function
from ._version import __version__
| 0.894531 | 1 |
pyrez/api/APIBase.py | pytheous/Pyrez | 0 | 47986 |
from ..exceptions.ServiceUnavailable import ServiceUnavailable
from ..logging import create_logger
from ..utils.http import http_request
class APIBase:
#Do not instantiate this object directly; instead, use::
"""Provide an base class for easier requests. DON'T INITALISE THIS YOURSELF!
Attributes
-----... | 2.546875 | 3 |
lambda/slack_bot.py | ebc-2in2crc/slack-echo-bot | 1 | 47987 | <filename>lambda/slack_bot.py
import hashlib
import hmac
import json
import logging
import os
import urllib.request
SLACK_BOT_USER_ACCESS_TOKEN = os.environ["SLACK_BOT_USER_ACCESS_TOKEN"]
SLACK_SIGNING_SECRET = os.environ["SLACK_SIGNING_SECRET"]
# ログ設定
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def ... | 2.4375 | 2 |
aims/analysis/density.py | Xiangyan93/AIMS | 3 | 47988 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from ..database.models import *
from aims.aimstools.utils import polyfit, is_monotonic, get_V
def get_density(mol: Molecule, plot_fail: bool = False) -> Optional[Tuple[List[float], List[float], List[float]]]:
jobs = [job for job in mo... | 2.1875 | 2 |
elvia/types/common.py | andersem/elvia-python | 0 | 47989 | <gh_stars>0
from typing_extensions import TypedDict
class CustomerContract(TypedDict):
startTime: str
endTime: str
| 1.96875 | 2 |
python/simplify.py | TechieHelper/Codewars | 0 | 47990 | <filename>python/simplify.py<gh_stars>0
def simplify(poly):
pass | 1.265625 | 1 |
tests/port_tests/polygon_tests/test_equals.py | skrat/martinez | 7 | 47991 | from typing import Tuple
from hypothesis import given
from tests.port_tests.hints import PortedPolygon
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.polygons)
def test_reflexivity(polygon: PortedPolygon) -> None:
assert polygon == polygon
... | 3 | 3 |
src/openeo_grass_gis_driver/process_graph_validation.py | marcjansen/openeo-grassgis-driver | 7 | 47992 | <filename>src/openeo_grass_gis_driver/process_graph_validation.py
# -*- coding: utf-8 -*-
from flask import make_response, request
from openeo_grass_gis_driver.actinia_processing.base import Graph
from openeo_grass_gis_driver.actinia_processing.config import \
Config as ActiniaConfig
from openeo_grass_gis_driver.a... | 2.296875 | 2 |
tests/test_views.py | jeancochrane/just-spaces | 0 | 47993 | <gh_stars>0
import pytest
from django.urls import reverse
from pldp.forms import AGE_COMPLEX_CHOICES
@pytest.mark.django_db
def test_survey_list_edit(client, user, survey_form_entry, survey_form_entry_observational):
client.force_login(user)
url = reverse('surveys-list-edit')
response = client.get(url)
... | 2.359375 | 2 |
blocks/__init__.py | blandfort/mirror | 0 | 47994 | from .countdown import CountdownBlock
| 1.023438 | 1 |
app.py | bmcculley/mailhide | 0 | 47995 | from flask import Flask, render_template, request, jsonify, \
redirect, Response, url_for, abort
import helpers
config_dic = helpers.load_config()
# flask app setup
app = Flask(__name__)
app.secret_key = config_dic["app_secret_key"]
@app.route("/", methods=["GET"])
def home():
return render_... | 2.78125 | 3 |
system_a/analyzer_main.py | hkayesh/depend_clean | 0 | 47996 | from scripts.processing import Processor
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--train", type=str, default='files/mmhsct_dataset.csv', help="--train file_path")
parser.add_argument("--data", type=str, default='files/sr_all_comments_111.csv', help="--data file_path")
parse... | 2.890625 | 3 |
problem0669.py | kmarcini/Project-Euler-Python | 0 | 47997 | ###########################
#
# #669 The King's Banquet - Project Euler
# https://projecteuler.net/problem=669
#
# Code by <NAME>
#
###########################
| 1.601563 | 2 |
env.py | camigord/WorldModels | 83 | 47998 | <reponame>camigord/WorldModels
import numpy as np
#import gym
from custom_envs.car_racing import CarRacing
def make_env(env_name, seed=-1, render_mode=False):
if env_name == 'car_racing':
env = CarRacing()
if (seed >= 0):
env.seed(seed)
else:
print("couldn't find this env")
return env
| 2.53125 | 3 |
slalom/dataops/infra.py | slalom-ggp/dataops-tools | 5 | 47999 | #!/usr/bin/env python3
from joblib import Parallel, delayed
import os
import sys
from pathlib import Path
from typing import Dict, List
import fire
from logless import get_logger, logged, logged_block
import runnow
from tqdm import tqdm
import uio
code_file = os.path.realpath(__file__)
repo_dir = os.path.dirname(os.p... | 2 | 2 |