max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
src/utils/data_utils.py | sahaana/ember-API | 7 | 12788951 | <filename>src/utils/data_utils.py
import numpy as np
import pandas as pd
from typing import List, Union, Dict, Optional, Tuple
def sample_excluding(n: int,
exclude: List[int]) -> int:
x = np.random.randint(n)
while x in exclude:
x = np.random.randint(n)
return x
def sequenti... | 3.09375 | 3 |
lib/surface/data_fusion/operations/wait.py | kustodian/google-cloud-sdk | 2 | 12788952 | # -*- coding: utf-8 -*- #
# Copyright 2019 Google Inc. 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 requir... | 2.28125 | 2 |
src/classification/data_object.py | PeterJackNaylor/CellularHeatmaps | 0 | 12788953 | <filename>src/classification/data_object.py
import numpy as np
from glob import glob
from tqdm import tqdm
import pandas as pd
import os
from skimage.util import crop, pad
from sklearn.model_selection import StratifiedKFold
def t_name(name):
"""
How to process the file name to get the key.
"""
basname... | 2.734375 | 3 |
ddf_utils/chef/procedure/groupby.py | semio/ddf_utils | 2 | 12788954 | # -*- coding: utf-8 -*-
"""groupby procedure for recipes"""
import fnmatch
import logging
from typing import List
from .. helpers import debuggable, mkfunc
from .. model.ingredient import DataPointIngredient
from .. model.chef import Chef
logger = logging.getLogger('groupby')
@debuggable
def groupby(chef: Chef,... | 3.015625 | 3 |
Learning to Monitor Machine Health with Convolutional Bi-Directional LSTM Networks/main_test.py | cingtiye/Convolutional-Bi-Directional-LSTM-Networks-and-feature-based-gated-recurrent-unit-networks | 17 | 12788955 | # -*- coding: utf-8 -*-
import pickle
import numpy as np
from Conv_Bidrect_LSTM import CBLSTM
import tensorflow as tf
def load_data(normal_stat=False):
if normal_stat:
filepath = "./data/data_normal.p"
else:
filepath = "./data/data_seq.p"
with open(filepath, mode='rb') as f:
x = pi... | 2.578125 | 3 |
tests/unit/console/parsers/test_getinfo_parser.py | antonku/ncssl_api_client | 8 | 12788956 | <gh_stars>1-10
import unittest
import argparse
from ncssl_api_client.console.parsers.getinfo_parser import GetInfoParser
class GetInfoParserTest(unittest.TestCase):
def setUp(self):
self.parser = argparse.ArgumentParser()
self.subparsers = self.parser.add_subparsers(help='Available commands:', de... | 2.90625 | 3 |
mc_luigi/tools/__init__.py | constantinpape/mc_luigi | 0 | 12788957 | from .tools import config_logger, run_decorator, get_replace_slices
from .numpy_tools import get_unique_rows, find_matching_row_indices, find_matching_indices, replace_from_dict, cartesian
| 1.328125 | 1 |
letterCombinations.py | xiaochuan-cd/leetcode | 0 | 12788958 |
tb = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
class Solution:
def recursive(self, st, res):
if not st:
return res
if not res:
res = ['']
res2 = []
cs = st.pop()
for c in cs:
res2 += [c+x for x in res]
retur... | 3.421875 | 3 |
exphydro/lumped/ExphydroParameters.py | sopanpatil/exp-hydro | 11 | 12788959 | #!/usr/bin/env python
# Programmer(s): <NAME>.
# This file is part of the 'exphydro.lumped' package.
from hydroutils import Parameter
######################################################################
class ExphydroParameters(object):
def __init__(self):
""" Each parameter set conta... | 3.015625 | 3 |
deepscm/experiments/medical/ukbb/sem_vi/conditional_sem.py | mobarakol/deepscm | 183 | 12788960 | import torch
import pyro
from pyro.nn import pyro_method
from pyro.distributions import Normal, Bernoulli, TransformedDistribution
from pyro.distributions.conditional import ConditionalTransformedDistribution
from deepscm.distributions.transforms.affine import ConditionalAffineTransform
from pyro.nn import DenseNN
fr... | 2.0625 | 2 |
src/destination/abstract_classes/__init__.py | tomfran/lastfm-project | 1 | 12788961 | <gh_stars>1-10
from .abstract_destination import AbstractDestination
| 1.085938 | 1 |
configs/train_config.py | Open-Speech-EkStep/speech_music_classification | 0 | 12788962 | <gh_stars>0
from dataclasses import dataclass
@dataclass
class SpectConfig:
samp_rate : int = 16000 # Sampling rate for extracting spectrogram features
n_fft : int = 512 # Length of the windowed signal after padding
win_dur : float = 0.025 # Window size in seconds
win_stride : float = 0.01 # Window str... | 2.34375 | 2 |
Edurights/UI/urls.py | AnshShrivastava/EduRights | 0 | 12788963 | <filename>Edurights/UI/urls.py
from django.urls import path
from . import views
urlpatterns = [
path("",views.home,name="Home"),
path("home",views.home,name="Home"),
path("test",views.test,name="test"),
path("newrequest",views.newrequest,name="Requests"),
path("about",views.about_us,name="About Us"... | 1.945313 | 2 |
chmp/src/chmp/bayes/__init__.py | chmp/misc-exp | 6 | 12788964 | """Helpers for Bayesian Modelling.
"""
import inspect
class NoOpContext:
def __enter__(self):
return self
def __exit__(self, exc, exc_type, traceback):
pass
class Model(NoOpContext):
"""Definition of a model
Usage::
with bayes.Model() as model:
@model.observe
... | 2.984375 | 3 |
tdb/app.py | hotdrink7/tdb | 0 | 12788965 | from base64 import b64encode
from ipykernel.comm import Comm
from IPython import get_ipython
import io
from io import BytesIO
import urllib.request, urllib.parse, urllib.error
_comm=None
def is_notebook():
iPython=get_ipython()
if iPython is None or not iPython.config:
return False
return 'IPKernelApp' in iPyt... | 2.421875 | 2 |
pyrt/ray.py | sdeu/pyrt | 0 | 12788966 | <filename>pyrt/ray.py
from dataclasses import dataclass
from pyrt.point import Point3
from pyrt.vec3 import Vec3
@dataclass
class Ray:
origin: Point3
direction: Vec3
def point_at(self, t):
return self.origin + (t * self.direction)
def __str__(self):
return f'{self.origin} + t*{self.... | 2.96875 | 3 |
coveo-stew/coveo_stew/utils.py | coveooss/coveo-python-oss | 7 | 12788967 | from pathlib import Path
from typing import MutableMapping, Any
from coveo_styles.styles import ExitWithFailure
import toml
from toml import TomlDecodeError
def load_toml_from_path(toml_path: Path) -> MutableMapping[str, Any]:
"""Loads a toml from path or raise ExitWithFailure on failure."""
return _load_tom... | 2.328125 | 2 |
chess/parser.py | victor-rene/vacc | 0 | 12788968 | from vector import Vector
from movement import movements
def dest_rank(text):
i = len(text) -1
while i >= 0:
if text[i].isdigit():
return ord(text[i]) - 48 - 1
else: i -= 1
raise Exception("No number found in " + text + ".")
def dest_file(text):
i = len(text) - 1
wh... | 3.625 | 4 |
samochat/__init__.py | SamoChat/samochat-python | 1 | 12788969 | <reponame>SamoChat/samochat-python
# Authorization
from samochat.auth import OAuthHandler
# API data
from samochat.client import SamochatData
# global variables
client_id = None
client_secret = None
__base_url__ = "https://api.samochat.net/" | 1.578125 | 2 |
yard/skills/00-web/django_demo/dss/urls.py | paser4se/bbxyard | 1 | 12788970 | <filename>yard/skills/00-web/django_demo/dss/urls.py<gh_stars>1-10
from com.adapter.urls import path, include
import dss.views
urlpatterns = [
path('do', dss.views.do),
]
| 1.414063 | 1 |
lorenz/tests/test_dataset.py | eryl/lorenz-timeseries | 0 | 12788971 | import unittest
import os
import matplotlib.pyplot as plt
import numpy as np
from lorenz.lorenz import make_dataset, plot_3d
import lorenz.dataset
class TestDataset(unittest.TestCase):
def setUp(self):
self.path = os.path.join(os.path.split(os.path.split(os.path.dirname(__file__))[0])[0], 'data', 'lorenz... | 2.9375 | 3 |
keras_maskrcnn/utils/overlap.py | akashdeepjassal/keras-maskrcnn | 432 | 12788972 | <filename>keras_maskrcnn/utils/overlap.py
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 re... | 2.65625 | 3 |
docker/output/Neo_Gene_EC_Map.py | PhilPalmer/onemetagenome | 1 | 12788973 | #!/usr/bin/env python
import os
import os.path
import sys
import shutil
Swiss_prot_map = sys.argv[1]
Prot_file = sys.argv[2]
Gene_EC_map = sys.argv[3]
mapping_dict = {}
with open(Swiss_prot_map, "r") as mapping:
for line in mapping:
line_as_list = line.strip("\n").split("\t")
mapping_dict[line_as... | 2.953125 | 3 |
q2.py | Utd04/Kannada-Digit-Classification-using-Neural-Networks | 0 | 12788974 | <reponame>Utd04/Kannada-Digit-Classification-using-Neural-Networks
import sys
import pandas as pd
import numpy as np
import math
import time
import random
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
def sigmoid_activation(a):
a1 = np.m... | 3.5 | 4 |
tests/cases/update_with.py | trivoldus28/gunpowder | 43 | 12788975 | <gh_stars>10-100
import numpy as np
from gunpowder import (
BatchProvider,
BatchFilter,
Array,
ArraySpec,
ArrayKey,
Graph,
GraphSpec,
GraphKey,
Batch,
BatchRequest,
Roi,
PipelineRequestError,
build,
)
import pytest
class ArrayTestSource(BatchProvider):
def __in... | 2.203125 | 2 |
Python/43. MultiplyStrings.py | nizD/LeetCode-Solutions | 263 | 12788976 | """
Leetcode's Medium challege #43 - Multiply Strings (Solution)
<https://leetcode.com/problems/multiply-strings/>
Description:
Given two non-negative integers num1 and num2
represented as strings, return the product of num1 and num2,
also represented as a string.
EXAMPLE:
Input: num1 = "2", num2 = "3"
Output: "6... | 3.921875 | 4 |
src/engr16x/piTalk/computer.py | engr16x/engr16x-library | 0 | 12788977 | # Library file on the Computer.
# Must be in the same directory as any file using it's functions.
import socket
import struct
import sys
from threading import Thread, Event
from binascii import crc_hqx
class CompTalk:
def __init__(self, host):
# Variables that define the communication
self.buf... | 2.84375 | 3 |
probability/queue_test.py | peterhogan/python | 0 | 12788978 | <reponame>peterhogan/python<filename>probability/queue_test.py<gh_stars>0
from time import sleep
server_wait = "0 |"
server_serv = "0x|"
print("Queue System")
cust = "x"
for while 1 == 1:
print(server_wait,n*cust, end="\r")
sleep(0.5)
| 2.921875 | 3 |
__init__.py | mikhailkin/dataset | 0 | 12788979 | <reponame>mikhailkin/dataset
import sys
import importlib
sys.modules[__package__] = importlib.import_module('.dataset', __package__)
| 1.125 | 1 |
OJS/teste3.py | r-luis/Projeto-PUB | 0 | 12788980 | <gh_stars>0
from urllib.request import urlopen
from urllib.error import URLError
from urllib.error import HTTPError
from bs4 import BeautifulSoup
import requests
def baixadireto(url, nomearquivo):
"""
Faz o download direto do arquivo PDF
e coloca direto no diretório que é mostrado.
"""
nomearquivo... | 3.234375 | 3 |
app.py | vitorkaio/py-class-mongo | 0 | 12788981 | <filename>app.py
# from controller.database import Database
from controller.user import User
from controller.perfil import Perfil
from datetime import datetime as Date
from bson.objectid import ObjectId
user = User()
perfil = Perfil()
newUser = {
'name': 'Alice',
'password': '<PASSWORD>',
'email': '<EMAIL>',
... | 2.953125 | 3 |
source/main.py | ubombar/Traffic-Simulator | 0 | 12788982 | <reponame>ubombar/Traffic-Simulator<gh_stars>0
if __name__ == "__main__":
raise NotImplementedError('The main program not implemented yet!') | 1.289063 | 1 |
opentelemetry-auto-instrumentation/src/opentelemetry/auto_instrumentation/instrumentor.py | gky360/opentelemetry-python | 0 | 12788983 | <gh_stars>0
# Copyright The OpenTelemetry Authors
#
# 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 a... | 2.1875 | 2 |
extra_foam/gui/windows/tests/test_filestream_window.py | ebadkamil/EXtra-foam | 7 | 12788984 | <gh_stars>1-10
import unittest
from unittest.mock import MagicMock, patch
from PyQt5.QtTest import QSignalSpy
from PyQt5.QtWidgets import QMainWindow
from extra_foam.logger import logger_stream as logger
from extra_foam.gui import mkQApp
from extra_foam.gui.windows.file_stream_w import FileStreamWindow
app = mkQApp(... | 1.960938 | 2 |
aioffmpeg/cmd_opts.py | ucrux/aioffmpeg | 4 | 12788985 | <reponame>ucrux/aioffmpeg<gh_stars>1-10
from aioffmpeg._cmd_raw_str import *
# h264编码参数选项
class H264EncoderArgs():
"""
h.264 编码的一些参数
; -profile:v
; -level
; -preset
; -crf
; -c:v
; -r
如果ffmpeg编译时加了external的libx264,那就这么写:
aioffmpeg -i input.mp4 -c:v libx264 -x264-params "profile=... | 2.015625 | 2 |
scripts/make_graphical_abstract.py | rohitsupekar/active_matter_spheres | 1 | 12788986 | <gh_stars>1-10
import os
import sys
sys.path.append("../") # go to parent dir
import glob
import time
import logging
import numpy as np
from scipy.sparse import linalg as spla
import matplotlib.pyplot as plt
import logging
from mpl_toolkits import mplot3d
from mayavi import mlab
from scipy.special import sph_harm
#ad... | 1.890625 | 2 |
pylgrum/tests/test_hand.py | jrheling/pylgrum | 2 | 12788987 | <gh_stars>1-10
import unittest
from pylgrum.card import Card, Rank, Suit
from pylgrum.hand import Hand
from pylgrum.errors import OverdealtHandError
class TestHand(unittest.TestCase):
def test_too_many_cards(self):
"""Implicitly tests the add() override in Hand, too."""
h = Hand()
self.ass... | 3.359375 | 3 |
config.py | mixtek/Webscraping_Mars | 0 | 12788988 | # Twitter API Keys
consumer_key = "k4dGS4RNgveXn70tuR8fujiAu"
consumer_secret = "<KEY>"
access_token = "<KEY>"
access_token_secret = "<KEY>" | 1.132813 | 1 |
test/mongo_mock_repository.py | SeniorSA/hybrid-rs-trainner | 15 | 12788989 | from mongomock import MongoClient
from repository.repository_factory import RepositoryFactory
class MongoMockRepository(RepositoryFactory):
__data_source = None
def get_data_source(self):
if MongoMockRepository.__data_source == None:
MongoMockRepository.__data_source = MongoClient()
... | 2.3125 | 2 |
skelshop/utils/timer.py | cstenkamp/skelshop | 2 | 12788990 | <filename>skelshop/utils/timer.py
import logging
from time import perf_counter_ns
logger = logging.getLogger(__name__)
class Timer:
def __init__(self, name="task", logger=logger):
self.name = name
self.logger = logger
def __enter__(self):
if self.logger.isEnabledFor(logging.INFO):
... | 2.828125 | 3 |
openks/distributed/quick-start/openKS_distributed/base/RoleMaker.py | HIT-SCIR-xuanxuan/OpenKS | 88 | 12788991 | # Copyright (c) 2020 Room 525 Research Group, Zhejiang University.
# All Rights Reserved.
"""Defination of Role Makers."""
from __future__ import print_function
import paddle.fluid as fluid
import os
import time
__all__ = [
'Role', 'RoleMakerBase', 'MPISymetricRoleMaker', 'UserDefinedRoleMaker',
'UserDef... | 2.421875 | 2 |
src/testplates/impl/validators/type.py | kprzybyla/testplates | 0 | 12788992 | <gh_stars>0
__all__ = ("TypeValidator",)
import testplates
from typing import (
Any,
)
from resultful import (
success,
failure,
Result,
)
from testplates.impl.exceptions import TestplatesError, InvalidTypeError
from testplates.impl.utils import (
format_like_tuple,
)
class TypeValidator:
... | 2.484375 | 2 |
extension_management/01_ManageExtensions.py | IBM/api-samples | 172 | 12788993 | <reponame>IBM/api-samples<filename>extension_management/01_ManageExtensions.py<gh_stars>100-1000
#!/usr/bin/env python3
# In this sample you will see how to manage extensions using the REST API.
# The sample contains uploading extension, installing extension, checking
# installing task and delete extension.
import j... | 2.484375 | 2 |
torch_optimizer_study.py | xzgz/vehicle-reid | 3 | 12788994 | <gh_stars>1-10
from __future__ import print_function
from __future__ import division
import os
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.optim import lr_scheduler
from model import init_model
from utils.torchtools import count_num_param
from optimizers impo... | 2.515625 | 3 |
template/osi/__base__.py | clayne/syringe-1 | 25 | 12788995 | <filename>template/osi/__base__.py
from ptypes import ptype
class stackable:
def nextlayer(self):
'''returns a tuple of (type,remaining)'''
raise NotImplementedError
class terminal(stackable):
def nextlayer(self):
return None, None
| 2.265625 | 2 |
cash.py | PiggehJB/Cash_PY_Week6_CS50x | 0 | 12788996 | import colorama
from colorama import Fore
while True:
try:
cash = float(input("Enter your cash: "))
while True:
if cash > 0:
print(f"Alright! Your balance is: {cash}")
break
else:
cash = float(input(f"{Fore.RED}Uh ... | 3.9375 | 4 |
srfnef/corrections/__init__.py | twj2417/srf | 0 | 12788997 | # encoding: utf-8
'''
@author: <NAME>
@contact: <EMAIL>
@software: nef
@file: __init__.py
@date: 5/8/2019
@desc:
'''
# from . import psf
__all__ = (
'AttenuationCorrect', 'PsfFit', 'PsfCorrect', 'FittedY', 'FittedZ', 'FittedX', 'PointSource')
from .attenuation.attenuation_correct import AttenuationCorrect
from .psf... | 1 | 1 |
bdsim/bdedit/interface_graphics_view.py | petercorke/bdsim | 64 | 12788998 | <filename>bdsim/bdedit/interface_graphics_view.py<gh_stars>10-100
# PyQt5 imports
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QGraphicsView
# BdEdit imports
from bdsim.bdedit.block import Block
from bdsim.bdedit.block_graphics_wire import GraphicsWire
from bdsim.bdedit.block_graphi... | 1.726563 | 2 |
cursoemvideo/desafios/Desafio007.py | adinsankofa/python | 0 | 12788999 | '''
Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre a sua média
'''
nota1 = float(input('Digite a 1ª nota: '))
nota2 = float(input('Digite a 2ª nota: '))
media = (nota1 + nota2)/2
print("Média: {:0.2f}".format(media))
| 3.828125 | 4 |
wally/suits/io/fio_job.py | Mirantis/rally-results-processor | 41 | 12789000 | <reponame>Mirantis/rally-results-processor<filename>wally/suits/io/fio_job.py
import copy
from collections import OrderedDict
from typing import Optional, Iterator, Union, Dict, Tuple, Any, cast
from cephlib.units import ssize2b, b2ssize
from ..job import JobConfig, JobParams, Var
def is_fio_opt_true(vl: Union[str,... | 2.171875 | 2 |
utils/SRCNN/SR_CNN.py | roman-vygon/pyFAST | 0 | 12789001 | # Generated with SMOP 0.41
from libsmop import *
# SR_CNN.m
@function
def SR_CNN(iml=None,ratio=None,model=None,*args,**kwargs):
varargin = SR_CNN.varargin
nargin = SR_CNN.nargin
if 2 == ratio:
sr_model=model.x2_model
# SR_CNN.m:5
else:
if 3 == ratio:
sr_model=model.x... | 1.867188 | 2 |
barrage/services.py | briannemsick/barrage | 16 | 12789002 | <reponame>briannemsick/barrage
import os
from typing import List
from tensorflow.python.keras import callbacks
from barrage import logger
DATASET = "dataset"
BEST_CHECKPOINT = "best_checkpoint"
BEST_MODEL = "model_best.ckpt"
RESUME_CHECKPOINTS = "resume_checkpoints"
RESUME_MODEL = "model_epoch_{epoch:04d}.ckpt"
TENS... | 2.3125 | 2 |
codewars/6kyu/One Line Task Element-wise Maximum/main_test.py | ictcubeMENA/Training_one | 0 | 12789003 | import main
import unittest
class OnelineTest(unittest.TestCase):
def example_test(self):
a = [1, 2, 3, 4, 5]
b = [10, 0, 10, 0, 10]
main.fmax(a,b)
self.assertEqual(a,[10, 2, 10, 4, 10])
if __name__ == '__main__':
unittest.main() | 2.8125 | 3 |
mylibrary/controllers/backup.py | keygenqt/MyLibrary-server | 0 | 12789004 | <reponame>keygenqt/MyLibrary-server<gh_stars>0
"""
Copyright 2020 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... | 1.867188 | 2 |
CentroidsGeneration/distribution.py | dudenzz/word_embedding | 0 | 12789005 | from utilities import load_stf
import numpy as np
from scipy.spatial.distance import cosine
import time
#vsm = load_stf('glove.840B.300d.sample.txt',300)
#csm = np.load('centroids').item()
#distrib = np.zeros((100000,10))
#oFile = open('f_distrib','w+')
def dot_product(v1,v2):
total = 0
if len(v1) != len(v2):
thr... | 2.1875 | 2 |
app/main/views.py | dynamodenis/pitch-master | 0 | 12789006 | <filename>app/main/views.py
import functools
import os
import secrets
from PIL import Image
from flask import render_template,redirect,url_for,abort,flash,request
from . import main
from flask_login import login_required,current_user
from ..models import User,Comment,Pitch
from .forms import UploadPitch,CommentsForm,Up... | 2.28125 | 2 |
example/tasks.py | khorolets/kuyruk | 0 | 12789007 | <filename>example/tasks.py
from kuyruk import Kuyruk
kuyruk = Kuyruk()
@kuyruk.task()
def echo(message):
print message
| 1.640625 | 2 |
TerraPi/dashboard.py | sghctoma/terrapi | 2 | 12789008 | #!/usr/bin/env python3
import json
import logging
import pkg_resources
import pytz
import sys
import tzlocal
import yaml
from datetime import datetime, timedelta
from os.path import expanduser, isfile
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly
import plotly.graph_... | 2.078125 | 2 |
app/views.py | albertodepaola/catalog-project | 0 | 12789009 | <gh_stars>0
from flask import render_template, session, make_response
from app import appbuilder, db
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder import ModelView, expose
from app.models import Category, Item
from flask_appbuilder.fieldwidgets import BS3TextAreaFieldWidget, Tex... | 2.515625 | 3 |
apps/jetbrains/jetbrains_actions.py | RichardHladik/knausj_talon | 1 | 12789010 | <filename>apps/jetbrains/jetbrains_actions.py
from talon import Context, actions
ctx = Context()
ctx.matches = r"""
# Requires https://plugins.jetbrains.com/plugin/10504-voice-code-idea
app: jetbrains
"""
@ctx.action_class('user')
class UserActions:
#talon app actions (+custom tab actions)
def tab_final(): ... | 2.359375 | 2 |
pyETM/parameters/flexibility_order.py | robcalon/PyETM | 0 | 12789011 | <reponame>robcalon/PyETM
import json
import numpy
class FlexibilityOrder:
@property
def flexibility_order(self):
# get flexibility order
if self._flexibility_order is None:
self.get_flexibility_order()
return self._flexibility_order
@flexi... | 2.53125 | 3 |
app.py | crumpstrr33/imgur_album_downloader | 0 | 12789012 | from ast import literal_eval
from flask import Flask, jsonify, render_template, request, Response
from scripts.downloader import download_hashes
from scripts.checks import check_info
app = Flask(__name__)
@app.route("/check/")
def check():
"""
Does the following checks:
- The album hash (album_hash... | 3.015625 | 3 |
API.py | erose1337/export_opera_passwords | 0 | 12789013 | <reponame>erose1337/export_opera_passwords
VERSION = "1.0.1"
LANGUAGE = "python"
PROJECT = "export_opera_passwords"
API = {"export_opera_passwords.main.main" : {"command line arguments" : ("output filename",
"database filename"),
... | 1.46875 | 1 |
examples/10-kdh.py | hebrewsnabla/dh | 1 | 12789014 | #!/usr/bin/env python
'''
KDH at an individual k-point
'''
from functools import reduce
import numpy
from pyscf.pbc import gto
from pyscf import pbcdh, lib
#lib.num_threads(28)
cell = gto.Cell()
cell.atom='''
C 0.000000000000 0.000000000000 0.000000000000
C 1.685068664391 1.685068664391 1.685068664391
'''
c... | 2.078125 | 2 |
lists_dictionary/Double Char.py | vasetousa/Python-fundamentals | 0 | 12789015 |
word = input()
for i in range(len(word)):
print(word[i]*2, end="") # printing every letter from the string "word" x 2
| 4.125 | 4 |
dork_compose/plugins/cleanup.py | iamdork/dork-compose | 2 | 12789016 | <reponame>iamdork/dork-compose
import dork_compose.plugin
from docker.api.client import APIClient
class Plugin(dork_compose.plugin.Plugin):
def cleanup(self):
client = APIClient()
# Remove unused volumes.
volumes = client.volumes({'dangling': True})
if volumes and volumes['Volumes... | 2.0625 | 2 |
src/api/dataflow/tests/test_modeling/test_model/test_model_task.py | Chromico/bk-base | 84 | 12789017 | <reponame>Chromico/bk-base<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:... | 1.351563 | 1 |
main_pipeline/data_processing/compute_raster_features.py | andher1802/geomodelling_challenge | 0 | 12789018 | from data_collection.read_sentinel import pair_imagenames
from utils.set_user_input import set_arguments_pipeline
from utils.raster_helper import read_url_image, read_input_geometry, array2raster
import numpy as np
import rasterio
def compute_ndvi(band_inf, bands=["red", "nir"]):
"""
This function computes t... | 2.828125 | 3 |
tests/integration/test_network_plugin.py | vmware/tosca-vcloud-plugin | 14 | 12789019 | <reponame>vmware/tosca-vcloud-plugin
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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/lice... | 2.015625 | 2 |
Level.py | blcmill/ILS-Z399-Fall-Down | 0 | 12789020 | <gh_stars>0
import pygame
from Color import Color
from itertools import repeat
class Level:
def __init__(self,filename):
self.block_size = (self.w,self.h) = (80,80)
self.level = []
self.screen_player_offset = (100,300)
self.player_position = (0,0)
self.enemies = []
self.floor = []
self.screen_shake = Fa... | 3.046875 | 3 |
Customer Lifetime Value/pre_processing.py | uicloudanalytics/Data-Apps | 0 | 12789021 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import datetime as dt
import numpy as np
import plotly.express as px
# pd.options.display.float_format = '${:,.2f}'.format
# Load the data
data = pd.read_excel("./data/Online_Retail.xlsx")
# remove duplicate rows
filtered_data = data.drop_du... | 3 | 3 |
main.py | aysunakarsu/google-shopping-performance-api | 1 | 12789022 | <filename>main.py
# Copyright 2018 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 ... | 2.1875 | 2 |
tests/agent_tests.py | tomakehurst/saboteur | 258 | 12789023 | from saboteur.agent import SaboteurWebApp
import json
import unittest
from test_utils import MockShell
from saboteur.apicommands import FAULT_TYPES, alphabetical_keys
def post_request(params):
return request('POST', params)
def delete_request():
return {'path': '/',
'method': 'DELETE'}
def req... | 2.421875 | 2 |
scrapi/harvesters/cuny.py | wearpants/scrapi | 34 | 12789024 | """
A harvester for City Universtiy of New York for the SHARE project
An example API call: http://academicworks.cuny.edu/do/oai/request?
verb=ListRecords&metadataPrefix=oai_dc
"""
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class CUNY_Harvester(OAIHarvester):
short_name = 'cuny... | 1.992188 | 2 |
run.py | RavicharanN/Messenger-scheduler | 1 | 12789025 | import os
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
# Change the info here
messenger_link = "https://www.messenger.com/t/abc"
email = ""
password = ""
message = ""
os.environ["SELENIUM_SERVER_JAR"] = "selenium-server-standalone-2.41.0.jar"
browser = webdrive... | 2.859375 | 3 |
catnip/__init__.py | ramadan8/Catnip | 1 | 12789026 | from .camera import Camera, Frame
from .event import Event
from .manager import Manager
| 1.085938 | 1 |
numba/specialize/exttypes.py | liuzhenhai/numba | 1 | 12789027 | import ast
import numba
from numba import *
from numba import error
from numba import typesystem
from numba import visitors
from numba import nodes
from numba import function_util
from numba.exttypes import virtual
from numba.traits import traits, Delegate
class ExtensionTypeLowerer(visitors.NumbaTransformer):
""... | 2.09375 | 2 |
create_event.py | XtremeNolaner/MySchedule-to-Calendar | 0 | 12789028 | from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
import pickle
import datetime
# What the program can access within Calendar
# See more at https://developers.google.com/calendar/auth
scopes = ["https://www.googleapis.com/auth/calendar"]
flow = InstalledAppFlow.from_cl... | 3.265625 | 3 |
Assignments/Assignment 2/DS_Assignment2_201911189/A5-4.py | h0han/SE274_2020_spring | 0 | 12789029 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#A5-4 (3 points)
from linked_binary_tree import LinkedBinaryTree
class personal_LBP(LinkedBinaryTree):
def _delete_subtree(self, p):
if self.num_children(p) != 0:
for child in self.children(p):
self._delete_subtree(child)
... | 3.109375 | 3 |
utils.py | chu-data-lab/zeroer | 13 | 12789030 | <reponame>chu-data-lab/zeroer
import numpy as np
from sklearn.metrics import precision_score, recall_score, f1_score
from model import get_y_init_given_threshold,ZeroerModel
DEL = 1e-300
def get_results(true_labels, predicted_labels):
p = precision_score(true_labels, predicted_labels)
r = recall_score(true_... | 2.5 | 2 |
talk-dpg-20220316/russia-treemap.py | ohnemax/atomwaffen-in-russland | 9 | 12789031 | <filename>talk-dpg-20220316/russia-treemap.py
###############################################################################
# Some standard modules
import os
import sys
import copy
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import squarify
##################################################... | 2.578125 | 3 |
software/urls.py | RevolutionTech/revolutiontech.ca | 0 | 12789032 | """
:Created: 26 July 2015
:Author: <NAME>
"""
from django.conf.urls import url
from basecategory.views import ItemPageView
from software.models import Software
from software.views import SoftwareListView
app_name = "software"
urlpatterns = [
url(
r"^(?P<slug>[\w_-]+)/?$",
ItemPageView.as_view()... | 1.898438 | 2 |
examples/kubeflow/tfjob/tf_job_s3_gateway_minio.py | storey247/pachyderm | 0 | 12789033 | <filename>examples/kubeflow/tfjob/tf_job_s3_gateway_minio.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import MinIO library.
from minio import Minio
from minio.error import (ResponseError, BucketAlreadyOwnedByYou,
BucketAlread... | 2.140625 | 2 |
crawler.py | EnzoPB/WankilFinderCrawler | 1 | 12789034 | from youtube_transcript_api import YouTubeTranscriptApi, _errors as YouTubeTranscriptApiErrors
from datetime import datetime
from database import con, cur # on importe la connexion et le curseur de la base de donnée
from youtubeAPI import youtubeAPI # on importe la fonction youtubeAPI, qui sert juste à formatter des r... | 2.59375 | 3 |
tests/web_platform/CSS2/linebox/test_vertical_align_sub.py | fletchgraham/colosseum | 0 | 12789035 | from tests.utils import W3CTestCase
class TestVerticalAlignSub(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'vertical-align-sub-'))
| 1.75 | 2 |
multilayerGM/__init__.py | MultilayerBenchmark/MultilayerBenchmark-py | 10 | 12789036 | <filename>multilayerGM/__init__.py
from . import dependency_tensors
from . import export
from . import comparisons
from .networks import multilayer_DCSBM_network
from .partitions import sample_partition, DirichletNull, dirichlet_null
from pkg_resources import get_distribution, DistributionNotFound
try:
__version_... | 1.1875 | 1 |
batch_requests/authentication.py | GoLorry/django-batch-requests | 0 | 12789037 | <gh_stars>0
from django.contrib.auth import authenticate
from rest_framework.authentication import BaseAuthentication
class BatchAuthentication(BaseAuthentication):
'''
Similar to session authentication. Authenticates users already authenticated by
batch_requests.
'''
def authenticate(self, requ... | 2.640625 | 3 |
OpenMatch/modules/encoders/positional_encoder.py | vishalbelsare/OpenMatch | 403 | 12789038 | import torch
import torch.nn as nn
class PositionalEncoder(nn.Module):
def __init__(
self,
embed_dim: int,
max_len: int = 512
) -> None:
super(PositionalEncoder, self).__init__()
self._embed_dim = embed_dim
self._max_len = max_len
self._embed_matrix = to... | 2.375 | 2 |
src/generate_features.py | isotopi/Android_Permission | 0 | 12789039 | import pandas as pd
from sklearn.preprocessing import LabelEncoder
# read dataset file
df = pd.read_csv("../data/Android_Permission.csv", header=0, delimiter=',')
# Drop the columns which have a remarkable number of identic values.
dropper = []
for col in df.columns[10:]:
if (df[col].value_counts()[0] > 28999 or ... | 3.21875 | 3 |
plugins/modules/unpackage.py | bferguso/nr-ansible | 0 | 12789040 | <gh_stars>0
#!/usr/bin/env python
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: unpackage.py
short_description: A Custom Version of unarchive
description:
- Untars/Unzips if no valid check... | 2.171875 | 2 |
tests/core/sources/test_municipality_database.py | pyramidoereb/pyramid_oereb | 2 | 12789041 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
@pytest.fixture
def municipality_data(dbsession, transact):
from pyramid_oereb.contrib.data_sources.standard.models.main import Municipality
del transact
municipalities = [
Municipality(**{
'fosnr': 1234,
'name': u'Test'... | 2.015625 | 2 |
fdp/methods/fft_old.py | Fusion-Data-Platform/fdp | 10 | 12789042 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 15 21:00:08 2016
@author: drsmith
"""
from __future__ import division
from builtins import range
from builtins import object
from past.utils import old_div
import numpy as np
from scipy import fftpack
from .globals import FdpError
class Fft(object):
... | 1.867188 | 2 |
prompt412/round-105/d.py | honux77/algorithm | 2 | 12789043 | <filename>prompt412/round-105/d.py
n = int(input())
m = list(map(int, input().split()))
m.sort()
ans = 0
if n % 2 != 0:
ans = m[-1]
m.pop()
i = 0
j = len(m) - 1
while i < j:
ans = max(ans, m[i] + m[j])
i += 1
j -= 1
print(ans) | 2.6875 | 3 |
build_migrator/common/algorithm.py | alexsharoff/BuildMigrator | 17 | 12789044 | <gh_stars>10-100
from copy import deepcopy
try:
# Python 3
from collections.abc import Hashable, Iterable
except ImportError:
# Python 2
from collections import Hashable, Iterable
# Explanation by example:
# A = 1 2 3 4 5
# B = 2 3 4 5
#
# Optimized:
# common_set C = 2 3 4 5 (+4)
# A = 1 C (-3)
# B =... | 2.890625 | 3 |
webviz_config/utils/_dash_component_utils.py | anders-kiaer/webviz-conf | 44 | 12789045 | <reponame>anders-kiaer/webviz-conf<filename>webviz_config/utils/_dash_component_utils.py
import math
def calculate_slider_step(
min_value: float, max_value: float, steps: int = 100
) -> float:
"""Calculates a step value for use in e.g. dcc.RangeSlider() component
that will always be rounded.
The numb... | 2.578125 | 3 |
compsim/generate/randgen.py | skyman/CompressionSimulator | 0 | 12789046 | # coding=utf-8
import numpy as np
import random
from compsim.simulate import Grid, ColoredParticle, NewSeparationSimulator
from compsim.io import BRIGHT_COLORS
def generate_random_grid(n_particles, simulator_type, weighted_particle_types, size=None):
# weighted particle types is a list of particle types in (sing... | 2.84375 | 3 |
scripts/service_server.py | mankutimma/ros_fundamentals | 0 | 12789047 | <gh_stars>0
#!/usr/bin/env python3
import rospy
from ros_fundamentals.srv import AddTwoIntegers, AddTwoIntegersResponse
def main():
# name of service, type of service and callback
server = rospy.Service(name="addition_service", service_class=AddTwoIntegers, handler=callback)
rospy.init_node(name="additio... | 2.5625 | 3 |
pwndbg/commands/nearpc.py | ctfhacker/pwndbg | 0 | 12789048 | <filename>pwndbg/commands/nearpc.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from capstone import *
import collections
import gdb
import pwndbg.arguments
import pwndbg.color
import pwndbg.disasm
import pwndbg.disasm.color
import pwndbg.functions
import pwndbg.ida
import pwndbg.regs
import pwndbg.strin... | 2.59375 | 3 |
storage/models/fighter.py | Some1Nebo/ufcpy | 0 | 12789049 | from storage.models.base import *
from sqlalchemy.orm import validates
class Fighter(Base):
__tablename__ = 'fighters'
id = Column(Integer, primary_key=True)
ref = Column(String(STR_SIZE), unique=True, nullable=False)
name = Column(String(STR_SIZE), nullable=False)
country = Column(String(STR_SIZ... | 2.546875 | 3 |
tensorlayerx/nn/core/core_mindspore.py | tensorlayer/TensorLayerX | 34 | 12789050 | <gh_stars>10-100
#! /usr/bin/python
# -*- coding: utf-8 -*-
from .common import check_parameter, processing_act, str2init, random_normal, tolist, construct_graph, ModuleNode, select_attrs
from .common import _save_weights, _load_weights, _save_standard_weights_dict, _load_standard_weights_dict
from mindspore.nn import... | 1.828125 | 2 |