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 |
|---|---|---|---|---|---|---|
Archive for old stuff/BluetoothServer/Old/gatt-python.py | Kandidatarbete-Chalmers-MCCX02-19-06/RaspberryPiRadarProgram | 7 | 12763051 | import gatt
class AnyDeviceManager(gatt.DeviceManager):
def device_discovered(self, device):
print("Discovered [%s] %s" % (device.mac_address, device.alias()))
manager = AnyDeviceManager(adapter_name='hci0')
manager.start_discovery()
manager.run() | 2.359375 | 2 |
specklepy/reduction/dark.py | felixbosco/specklepy | 0 | 12763052 | import numpy as np
import os
from astropy.io import fits
from astropy.stats import sigma_clip, sigma_clipped_stats
from specklepy.logging import logger
from specklepy.reduction.subwindow import SubWindow
from specklepy.utils.time import default_time_stamp
class MasterDark(object):
extensions = {'variance': 'VA... | 2.09375 | 2 |
appion/bin/testStackFormat.py | leschzinerlab/myami-3.2-freeHand | 0 | 12763053 | #!/usr/bin/env python
#python
import os
import shutil
import random
#appion
from appionlib import appionScript
from appionlib import apStack
from appionlib import apDisplay
from appionlib import apStackFormat
class convertStackScript(appionScript.AppionScript):
#=====================
def setupParserOptions(self):
... | 2.359375 | 2 |
rise_of_machines/helpers.py | fpdevil/rise_of_machines | 0 | 12763054 | #!/usr/bin/env python3
# coding: utf-8
# Contains common methods frequently used across....
# The example reference at the below matplotlib is helpful in choosing an
# appropriate colormap for the output plot
# https://matplotlib.org/examples/color/colormaps_reference.html
# import the necessary packages
import numpy... | 4.09375 | 4 |
8bit subleq CPU/assemble.py | MajFontana/computer-architecture | 0 | 12763055 | import ext
import re
CODE = "assembly.txt"
OUTPUT = "assembled.bin"
def parse(value):
if re.match("^0[a-zA-Z]", value):
if value[1] == "b":
parsed = int(value, 2)
elif value[1] == "x":
parsed = int(value, 16)
else:
parsed = int(value)
return parsed
with ope... | 2.8125 | 3 |
app/main/routes.py | GyftakisK/OpenDataGraph | 0 | 12763056 | <gh_stars>0
import os
from app import graph_manager
from app.main import bp
from flask import render_template, request, jsonify
from app.utilities import relationships_to_d3_data, normilize_mesh_term
@bp.route('/')
@bp.route('/index')
def index():
literature_status = graph_manager.get_literature_status()
dise... | 2.203125 | 2 |
examples/tenant_tutorial/customers/apps.py | buraketmen/django-tenants | 514 | 12763057 | from __future__ import unicode_literals
from django.apps import AppConfig
class CustomersConfig(AppConfig):
name = 'customers'
verbose_name = 'Customers'
def ready(self):
import customers.handlers
| 1.5625 | 2 |
schwarz/log_utils/tests/testutils_test.py | FelixSchwarz/log_utils | 0 | 12763058 | # -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME>
# The source code contained in this file is licensed under the MIT license.
# SPDX-License-Identifier: MIT
import logging
from pythonic_testcase import assert_raises, PythonicTestCase
from ..testutils import (assert_did_log_message, assert_no_log_messages,
buil... | 2.140625 | 2 |
tests/conftest.py | infobip-community/infobip-api-python-sdk | 0 | 12763059 | import json
import string
from io import IOBase
from random import choice
from string import ascii_letters
from typing import Optional
import pytest
import requests
from werkzeug import Response
from infobip_channels.core.models import CamelCaseModel, MultipartMixin
def get_random_string(length: int) -> str:
re... | 2.171875 | 2 |
examples/keras_parikh_entailment/spacy_hook.py | moyogo/spacy | 0 | 12763060 | <gh_stars>0
from keras.models import model_from_json
import numpy
import numpy.random
class KerasSimilarityShim(object):
@classmethod
def load(cls, path, nlp, get_features=None):
if get_features is None:
get_features = doc2ids
with (path / 'config.json').open() as file_:
... | 2.390625 | 2 |
src/gibbs_sampling.py | alexandru-dinu/MCMC | 0 | 12763061 | import numpy as np
import seaborn as sns
def p_x_given_y(y, mus, sigmas):
mu = mus[0] + sigmas[1, 0] / sigmas[0, 0] * (y - mus[1])
sigma = sigmas[0, 0] - sigmas[1, 0] / sigmas[1, 1] * sigmas[1, 0]
return np.random.normal(mu, sigma)
def p_y_given_x(x, mus, sigmas):
mu = mus[1] + sigmas[0, 1] / sigmas... | 2.6875 | 3 |
parkinson.py | Cassiel60/python | 0 | 12763062 | <reponame>Cassiel60/python<filename>parkinson.py<gh_stars>0
#coding=utf-8
import pandas as pd
import pdb
import re
varfil1=r'C:\Users\BAIOMED07\Desktop\parkinson_Database_20170619.xlsx'
varfil2=r'C:\Users\BAIOMED07\Desktop\parkinson.txt'
out = open('parkinson.xls','wb')
df1=pd.read_excel(varfil1)
df2=pd.read_csv(... | 2.84375 | 3 |
realtime-epi-figs/ridge.py | COVID-IWG/epimargin-studies | 0 | 12763063 | <reponame>COVID-IWG/epimargin-studies
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from epimargin.utils import cwd
from sklearn.linear_model import Ridge, Lasso, ElasticNet, ElasticNetCV, LogisticRegression
from sklearn.decomposition import SparsePCA
from sklearn.preprocessing import minmax_sc... | 2.46875 | 2 |
constants.py | erinxocon/pybuntu-docker | 6 | 12763064 | from pathlib import Path
ROOT = Path(__file__).parent
TEMPLATES_DIR = ROOT / "templates"
OUT = ROOT / "out"
UBUNTU_VERSIONS = {"18.04": "bionic", "20.04": "focal"}
PYTHON_VERSIONS = {"3.6.15", "3.7.12", "3.8.12", "3.9.7", "3.10.0rc2"}
VERSIONS = ((u_ver, p_ver) for u_ver in UBUNTU_VERSIONS for p_ver in PYTHON_VERSI... | 1.9375 | 2 |
src/tweetengine/handlers/twitter.py | Arachnid/tweetengine | 2 | 12763065 | <filename>src/tweetengine/handlers/twitter.py
import environment
import datetime
import logging
import urlparse
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from tweetengine.handlers import base
from tweetengine import model
from tweetengine import ... | 2.6875 | 3 |
paper/figures/make_ha_cachito_Fe_figure.py | abostroem/asassn15oz | 0 | 12763066 |
# coding: utf-8
# Creates:
# * cachito_fe_vel_comp.pdf
# In[1]:
import os
import numpy as np
import yaml
from astropy.io import ascii as asc
from astropy.time import Time
import astropy.units as u
import astropy.constants as c
from astropy.modeling import models, fitting
from matplotlib import pyplot as plt
#... | 1.992188 | 2 |
module1-introduction-to-sql/buddymove_holidayiq.py | sberniz/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 12763067 | <filename>module1-introduction-to-sql/buddymove_holidayiq.py
import pandas as pd
import sqlite3
#Part 2
db = pd.read_csv('buddymove_holidayiq.csv')
print(db.shape)
conn = sqlite3.connect('buddymove_holidayiq.sqlite3')
curs = conn.cursor()
db.to_sql('buddymove_holidayiq',conn, if_exists='replace')
QUERY = 'SELECT COU... | 3.578125 | 4 |
tests/generate_search_info_test_data.py | garz75/osxphotos | 0 | 12763068 | <filename>tests/generate_search_info_test_data.py
""" Create the test data needed for test_search_info_10_15_7.py """
# reads data from the author's system photo library to build the test data
# used to test SearchInfo
# run as:
# python3 tests/generate_search_info_test_data.py >tests/search_info_test_data_10_15_7.jso... | 2.546875 | 3 |
Curso_Em_Video_Python/ex088.py | ThallesTorres/Curso_Em_Video_Python | 0 | 12763069 | <reponame>ThallesTorres/Curso_Em_Video_Python
# Ex: 088 - Faça um programa que ajude um jogador da MEGA SENA a criar palpites.
# O programa vai perguntar quantos jogos serão gerados e vai sortear 6 números
# entre 1 e 60 para cada jogo, cadastrando tudo em uma lista composta.
from random import sample
from time impo... | 3.828125 | 4 |
tests/test_utils/test_share_storage.py | jvrana/pyro-graphnets | 0 | 12763070 | <filename>tests/test_utils/test_share_storage.py<gh_stars>0
import pytest
import torch
from caldera.utils import same_storage
view_methods = {
"slice": lambda x: x[:10],
"cpu": lambda x: x.cpu(),
"contiguous": lambda x: x.contiguous(),
}
copy_methods = {
"clone": lambda x: x.clone(),
"torch.tenso... | 2.140625 | 2 |
cs251tk/student/markdownify/process_file.py | renovate-tests/cs251-toolkit | 0 | 12763071 | <gh_stars>0
import os
from collections import Iterable
from cs251tk.common import run, flatten
from .truncate import truncate
from .cat import cat
from .pipe import pipe
def get_file(filename, results, options):
file_status, file_contents = cat(filename)
if file_status == 'success':
_, last_edit, _ =... | 2.359375 | 2 |
moceansdk/modules/command/button/wa_call_button.py | d3no/mocean-sdk-python | 0 | 12763072 | <reponame>d3no/mocean-sdk-python
from moceansdk.modules.command.button.wa_button_basic import WaButtonBasic
class WaCallButton(WaButtonBasic):
def type(self):
return "call"
def required_key(self):
return []
| 2.34375 | 2 |
proxy/core/acceptor.py | opencollective/proxy.py | 0 | 12763073 | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Programmable Proxy Server in a single Python file.
:copyright: (c) 2013-present by <NAME> and contributors.
:license: BSD, see LICENSE for more details.
"""
import logging
import multiprocessing
import selectors
import socket
impo... | 2.328125 | 2 |
Weather_Predictor/weather.py | LasalJayawardena/Neural-Network-Projects | 0 | 12763074 | <filename>Weather_Predictor/weather.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.preprocessing import StandardScaler
from sklearn.neural_network import MLPCl... | 3.03125 | 3 |
WORKFLOW/code/python_code/tes.py | tabhitmy/MLTF | 0 | 12763075 | <filename>WORKFLOW/code/python_code/tes.py
import numpy
import numpy as np
import time
print(' $$$ WELCOME to MLTF(v0.1) ! $$$')
print(' <Author: <NAME>> ')
print(' <Copyright Reserved.>')
timenow = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
print(' <' + timenow + '>')
a = t... | 3.125 | 3 |
icpp2018/experiments/experimentaux.py | eclufsc/packdrop-data-analysis | 1 | 12763076 | <reponame>eclufsc/packdrop-data-analysis<filename>icpp2018/experiments/experimentaux.py<gh_stars>1-10
from parseutils.file_outputter import *
from parseutils.experiment_analyzer import *
from parseutils.experiment_groups import *
from parseutils.directory_resolver import *
from enum import Enum
def list_append(lst, i... | 2.453125 | 2 |
Baselines/enjoy_custom.py | AhmetHamzaEmra/Understanding_RL | 2 | 12763077 | import gym
import itertools
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
import baselines.common.tf_util as U
from baselines.common.tf_util import load_state, save_state
from baselines import logger
from baselines import deepq
from baselines.deepq.replay_buffer import ReplayBuf... | 2.15625 | 2 |
draugr/visualisation/matplotlib_utilities/annotate.py | cnHeider/draugr | 3 | 12763078 | <filename>draugr/visualisation/matplotlib_utilities/annotate.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__doc__ = r"""
Created on 04-03-2021
"""
from typing import Tuple
from draugr.scipy_utilities import mag_decimation_subsample
__all__ = [
"ann... | 2.640625 | 3 |
nnunet/self_supervision/train_pretext.py | julieeecious/nnUNet | 1 | 12763079 | ######################################################################################
# ----------Copyright 2021 Division of Medical and Environmental Computing,----------#
# ----------Technical University of Darmstadt, Darmstadt, Germany--------------------#
###########################################################... | 2.34375 | 2 |
PP4E-Examples-1.4/Examples/PP4E/System/Processes/pipefifo.py | AngelLiang/PP4E | 0 | 12763080 | <reponame>AngelLiang/PP4E<filename>PP4E-Examples-1.4/Examples/PP4E/System/Processes/pipefifo.py
"""
named pipes; os.mkfifo is not available on Windows (without Cygwin);
there is no reason to fork here, since fifo file pipes are external
to processes--shared fds in parent/child processes are irrelevent;
"""
import os... | 2.609375 | 3 |
day16.py | t-ah/adventofcode-2019 | 0 | 12763081 | <gh_stars>0
def parse():
with open("input16") as f:
n = [int(x) for x in f.read()]
return n
n = parse()
for _ in range(100):
result = []
for i in range(1, len(n) + 1):
digit = 0
start = i - 1
add = 1
while start < len(n):
end = min(start + i, len(n))... | 2.453125 | 2 |
scripts/build_signals_page.py | malariagen/agam-selection-atlas | 3 | 12763082 | <filename>scripts/build_signals_page.py
# -*- coding: utf-8 -*-
from setup import *
if __name__ == '__main__':
loader = jinja2.FileSystemLoader('templates')
env = jinja2.Environment(loader=loader)
template = env.get_template('signals.rst')
data = dict()
data['signals'] = list(etl.fromcsv('docs... | 2.03125 | 2 |
src/pretix/plugins/paypal/signals.py | NicsTr/pretix | 0 | 12763083 | import json
from collections import OrderedDict
from django import forms
from django.dispatch import receiver
from django.template.loader import get_template
from django.utils.translation import gettext_lazy as _
from pretix.base.forms import SecretKeySettingsField
from pretix.base.signals import (
logentry_displ... | 1.929688 | 2 |
ngrams.py | RichardLitt/language-niche-research | 2 | 12763084 | <gh_stars>1-10
import nltk
from nltk import bigrams
from nltk import trigrams
from nltk.util import ngrams
from sys import argv
script, filename = argv
text = open(filename)
# for n in range (2,7):
for line in text:
tokens = nltk.word_tokenize(line)
tokens = [token.lower() for token in tokens if len(token) > 1] #... | 3.5 | 4 |
priority_queues/slider_puzzle_solver.py | reppertj/algorithms | 0 | 12763085 | from functools import total_ordering
from MinPQ import MinPQ
"""
Write a program to solve the 8-puzzle problem
(and its natural generalizations) using the A* search algorithm
"""
class Board():
def __init__(self, array):
"""constructor takes an
n x n list of lists containing
the n ** 2 i... | 4 | 4 |
examples/hydro_thermal/discrete.py | odow/msppy | 0 | 12763086 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: lingquan
"""
import pandas
import numpy
from msppy.msp import MSLP
from msppy.solver import SDDP
import gurobipy
import sys
n_processes = int(sys.argv[1])
hydro_ = pandas.read_csv("./data/hydro.csv", index_col=0)
demand = pandas.read_csv("./data/de... | 1.96875 | 2 |
GeologicProfile_Toolbox/StrDataToPlanProfile.py | DannyLeonD/GeoTools | 0 | 12763087 | <reponame>DannyLeonD/GeoTools
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# StrDataToPlanProfile.py
# Author: <NAME> (Servicio Geologico Colombiano), <NAME>(Servicio Geologico Colombiano), <NAME> (Servicio Geologico Colombiano), <NAME>(Servicio Geologico Colo... | 1.898438 | 2 |
GRU.py | harrys17451/CryptocurrencyPrediction | 669 | 12763088 | <reponame>harrys17451/CryptocurrencyPrediction
import pandas as pd
import numpy as numpy
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten,Reshape
from keras.layers import Conv1D, MaxPooling1D, LeakyReLU
from keras.utils import np_utils
from keras.layers import GRU,CuDNNGR... | 2.328125 | 2 |
make/photon/prepare/migrations/__init__.py | gerhardgossen/harbor | 1 | 12763089 | import os
MIGRATION_BASE_DIR = os.path.dirname(__file__)
accept_versions = {'1.9.0', '1.10.0', '2.0.0'} | 1.546875 | 2 |
update_metrics.py | Shpinkso/Software_metrics | 0 | 12763090 | <reponame>Shpinkso/Software_metrics<filename>update_metrics.py
from gitlabMetrics import *
from jiraMetrics import *
import yaml
import argparse
prodmode = ''
def main():
login_dict = yaml.safe_load(open('login.yml'))
gl_project = login_dict['gitlab_project_id']
jira_project_key = login_dict['jira_project... | 2.5 | 2 |
utils.py | yuanc3/LSUnetMix | 0 | 12763091 | import numpy as np
from sklearn.metrics import roc_auc_score,jaccard_score
import cv2
from torch import nn
import torch.nn.functional as F
import math
from functools import wraps
import warnings
import weakref
from torch.optim.optimizer import Optimizer
class WeightedBCE(nn.Module):
def __init__(self, weights=[0.... | 2.21875 | 2 |
backend/ai/mean_actor_critic.py | MisterTea/LandsharkGame | 0 | 12763092 | <gh_stars>0
#!/usr/bin/env python3
import copy
import os
import random
from collections import Counter
from enum import IntEnum
from typing import Dict, List, Tuple
from uuid import UUID, uuid4
import numpy as np
import pytorch_lightning as pl
import torch
from engine.game_interface import GameInterface
from torch im... | 1.921875 | 2 |
epipack/tests/numeric_tests.py | benmaier/epipack | 25 | 12763093 | import unittest
import numpy as np
from scipy.optimize import root
from scipy.interpolate import interp1d
from scipy.stats import entropy, poisson
import warnings
from epipack.numeric_epi_models import (
DynamicBirthRate,
ConstantBirthRate,
DynamicLinearRate,
ConstantLi... | 2.015625 | 2 |
integration_tests/txinfo_msgtransfer.py | SaveTheAles/cyber.py | 0 | 12763094 | from cyber_sdk.client.lcd import LCDClient
if __name__ == "__main__":
client = LCDClient(url="https://lcd.space-pussy-1.cybernode.ai/", chain_id="space-pussy-1")
client.tx.tx_info(
"D22FC6EB287D9F099DD8EBADAAC5D9A0F6AA9D6B87F4A35A3FACEF4182706A16"
)
| 1.632813 | 2 |
pygama/dsp/_processors/gaussian_filter1d.py | iguinn/pygama | 13 | 12763095 | <filename>pygama/dsp/_processors/gaussian_filter1d.py
# Copyright (C) 2003-2005 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice,... | 1.679688 | 2 |
software_gui/VAEsemane_GUI.py | Roboy/robotic_musicianship | 8 | 12763096 | <reponame>Roboy/robotic_musicianship<filename>software_gui/VAEsemane_GUI.py
import sys
import os
import torch
import threading
import time
import mido
import numpy as np
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication, QMainWindow, qApp, QAction, QFileDialog
from PyQt5.uic import loadUi
from ... | 2.28125 | 2 |
sdk/cognitivelanguage/azure-ai-language-conversations/tests/test_conversation_app.py | praveenkuttappan/azure-sdk-for-python | 2,728 | 12763097 | <reponame>praveenkuttappan/azure-sdk-for-python
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.... | 2.171875 | 2 |
metecho/api/migrations/0091_user_onboarded_at.py | VaccineCloud/Metecho-Vax | 21 | 12763098 | # Generated by Django 3.1.6 on 2021-02-08 21:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0090_rename_repository_project"),
]
operations = [
migrations.AddField(
model_name="user",
name="onboarded_at... | 1.890625 | 2 |
python/problems/smallest-subarray.py | fossabot/a-grim-loth | 4 | 12763099 | <reponame>fossabot/a-grim-loth<filename>python/problems/smallest-subarray.py
from bisect import bisect_left, bisect_right
def Merge(left, right):
mergedList = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
mergedList.append(left[i])
i += 1
... | 3.515625 | 4 |
porespy/filters/__init__.py | xu-kai-xu/porespy | 0 | 12763100 | r"""
Filters
#######
**Highlight Features of Interest**
This module contains a variety of functions for altering images based on
the structural characteristics, such as pore sizes. A definition of a
*filter* is a function that returns an image the shape as the original
image, but with altered values.
.. currentmod... | 1.796875 | 2 |
Collections.py | Ichinga-Samuel/Python-Buffet | 0 | 12763101 | <reponame>Ichinga-Samuel/Python-Buffet
from collections import OrderedDict as od, Counter, namedtuple, ChainMap
# OrderedDict and dictionaries
a = [('a', 1), ('z', 34), ('b', 2), ('c', 3)]
d = od(a) # create and ordered dictionary from a list of tuples
print(d) # --> OrderedDict([('a', 1), ('z', 34), ('b', 2),('c', ... | 3.953125 | 4 |
curvetorch/curvesgd.py | yashpatel5400/CurveTorch | 0 | 12763102 | #!/usr/bin/env python3
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import torch
from torch.optim.optimizer import Optimizer
import numpy as np
from scipy.optimize import minimize
__all__ = ('CurveSGD',)
class CurveSGD(Op... | 2.578125 | 3 |
client_app/python-pcl-0.3.0rc1/examples/3dharris.py | yaseenit/debs19_grand_challenge- | 46 | 12763103 | <filename>client_app/python-pcl-0.3.0rc1/examples/3dharris.py<gh_stars>10-100
# -*- coding: utf-8 -*-
# http://virtuemarket-lab.blogspot.jp/2015/03/harris.html
import pcl
import numpy as np
import pcl.pcl_visualization
# pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
# pcl::io::loadPCD... | 2.546875 | 3 |
trove/tests/api/flavors.py | sapcc/trove | 1 | 12763104 | # Copyright (c) 2011 OpenStack Foundation
# 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... | 1.648438 | 2 |
tests/test_rs_compute_tex.py | pygfx/wgpu-py | 74 | 12763105 | import random
import ctypes
import sys
import wgpu.backends.rs # noqa
import numpy as np
from pytest import skip
from testutils import run_tests, get_default_device
from testutils import can_use_wgpu_lib, is_ci
from renderutils import render_to_texture, render_to_screen # noqa
if not can_use_wgpu_lib:
skip("S... | 1.984375 | 2 |
spectral_cube/tests/test_regrid.py | sushobhana/spectral-cube | 0 | 12763106 | <gh_stars>0
import pytest
import numpy as np
from astropy import units as u
from astropy import convolution
from astropy.wcs import WCS
from astropy import wcs
from astropy.io import fits
from radio_beam import beam, Beam
from .. import SpectralCube
from ..utils import WCSCelestialError
from .test_spectral_cube impo... | 2.0625 | 2 |
disk1.py | ricaportela/disk-usage | 0 | 12763107 | <gh_stars>0
from matplotlib import pyplot as plt
def plot_data():
""" Draw Pie Chart with values from Json File """
# Data to plot
labels = 'Used', 'Available', 'Use%'
sizes = [215, 210, 134]
colors = ['gold', 'yellowgreen', 'lightcoral']
explode = (0.1, 0, 0) # explode 1st slice
plt.tit... | 3.28125 | 3 |
apps/make-zero-based.py | ShabnamSheikhha/ligra | 0 | 12763108 | <filename>apps/make-zero-based.py
import sys
in_name, out_name = sys.argv[1], sys.argv[2]
in_file, out_file = open(in_name, 'r'), open(out_name, 'w')
firstline = True
i = 0
while True:
line = in_file.readline()
# reached end of file
if not line:
break
# skip the comments
if line[0] == "%"... | 2.96875 | 3 |
test/mm.py | justrypython/utils | 0 | 12763109 | <filename>test/mm.py
#encoding:UTF-8
import os
import random
import numpy as np
import matplotlib.pyplot as plt
def get_ratio(pos):
pos = np.array(pos).reshape((-1, 1))
def _get_ratio(*args):
pos_list = pos
ratios = args[0]
ratios[ratios>=0] = 1
ratios[ratios<0] = -1
r... | 2.859375 | 3 |
string_op.py | princejvm/python | 0 | 12763110 | <reponame>princejvm/python
# Set the variable brian on line 3!
brian = "Hello life!"
# Assign your variables below, each on its own line!
caesar = "Graham"
praline = "John"
viking = "Teresa"
# Put your variables above this line
print caesar
print praline
print viking
# The string below is broken. Fix it using the ... | 4.09375 | 4 |
python-pj/scrapy_spider/hentai.py | RabitDash/practice | 0 | 12763111 | import requests
# import re
from bs4 import BeautifulSoup
import time
courl = "https://e-hentai.org/?page={}"
def getContent(url):
res = requests.get(url)
soup = BeautifulSoup(res.text, 'lxml')
return soup
def getImage(soup):
src = soup.find_all('div', {'class': 'it5'})
name = soup.find_all('div... | 3.078125 | 3 |
Curso_em_Video_py3/ex034.py | Rodrigo98Matos/Projetos_py | 1 | 12763112 | s = float(input('Salário: '))
if s <= 1250:
s = s * 1.15
if s > 1250:
s = s * 1.1
print('Novo salário: R${}'.format(s))
| 3.5625 | 4 |
sasmodels/models/lamellar_hg.py | pkienzle/sasmodels | 11 | 12763113 | # Note: model title and parameter table are inserted automatically
r"""
This model provides the scattering intensity, $I(q)$, for a lyotropic lamellar
phase where a random distribution in solution are assumed. The SLD of the head
region is taken to be different from the SLD of the tail region.
Definition
----------
T... | 2.4375 | 2 |
bip_utils/ss58/ss58.py | MIPPLTeam/bip_utils | 149 | 12763114 | <reponame>MIPPLTeam/bip_utils
# Copyright (c) 2021 <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 without restriction, including without limitation the rights
# to use, copy, modify... | 1.4375 | 1 |
aldryn_events/cms_plugins.py | what-digital/aldryn-events | 25 | 12763115 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from distutils.version import LooseVersion
from django.contrib.sites.shortcuts import get_current_site
from django.utils import timezone
from django.utils.dates import MONTHS
from django.utils.translation import ugettext_lazy as _, get_... | 1.796875 | 2 |
exec_procedure.py | SigmaAdvancedAnalytics/hydra | 0 | 12763116 | <reponame>SigmaAdvancedAnalytics/hydra
def exec_procedure(session, proc_name, params):
sql_params = ",".join(["@{0}={1}".format(name, value) for name, value in params.items()])
sql_string = """
DECLARE @return_value int;
EXEC @return_value = [dbo].[{proc_name}] {params};
SELECT '... | 2.4375 | 2 |
iot_detector.py | perygee/IoT-device-type-identification | 26 | 12763117 | import os
import numpy as np
import pandas as pd
import tensorflow as tf
def load_data(data_path, label_col, feature_cols=None):
# Load data csv with pandas and divide it to features and labels
if feature_cols:
data = pd.read_csv(os.path.abspath(data_path), usecols=feature_cols + [label_col], low_memo... | 2.734375 | 3 |
contests_atcoder/abc172/abc172_e_after.py | takelifetime/competitive-programming | 0 | 12763118 | <gh_stars>0
MOD = 10 ** 9 + 7
n, m = map(int, input().split())
def comb(n, r, p):
if r < 0 or n < r:
return 0
r = min(r, n - r)
return fact[n] * factinv[r] * factinv[n-r] % p
def perm(n, r, p):
if r < 0 or n < r:
return 0
return fact[n] * factinv[n-r] % p
p = MOD
N = m
fact = [1,... | 2.328125 | 2 |
CondTools/DT/test/popcon_keyconf_user.py | ckamtsikis/cmssw | 852 | 12763119 | import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("CondCore.DBCommon.CondDBCommon_cfi")
process.CondDBCommon.connect = 'sqlite_file:userconf.db'
process.CondDBCommon.DBParameters.authenticationPath = '.'
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.Co... | 1.414063 | 1 |
tests/test_host_config.py | mrzor/gcloud_sync_ssh | 7 | 12763120 | from gcloud_sync_ssh.host_config import HostConfig
def test_empty():
hc = HostConfig()
assert not hc.minidict()
def test_default_lines():
hc = HostConfig(HostName="172.16.31.10", CertificateFile="exists-or-not-we-dont-check")
ls = hc.lines()
assert ls == [' CertificateFile exists-or-not-we-do... | 2.40625 | 2 |
Source/Componentes/menu_principal.py | NicolasTangredi/grupo4 | 0 | 12763121 | import json
import PySimpleGUI as sg
from ..Ventanas import principal as ventana, ayuda
from ..Componentes import menu_estadisticas, menu_tablero
from ..Componentes import menu_puntajes
from ..Componentes import menu_configuracion
from ..Handlers import usuario
def iniciar():
''' comienza la ejecucion del menu de... | 2.78125 | 3 |
AISnake/Algorithm_2/modules/agent.py | EdgarLi/AIGames | 543 | 12763122 | <reponame>EdgarLi/AIGames
'''
Function:
define the ai agent
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
from modules.food import *
from operator import itemgetter
from collections import OrderedDict
'''ai agent'''
class Agent():
def __init__(self, cfg, snake, **kwargs):
self.cfg = cfg
self.num_rows = cfg.GAME_MATR... | 3.046875 | 3 |
etl.py | Lamasheg/DENDDataLakeProject | 0 | 12763123 | import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf, col
from pyspark.sql.functions import year, month, dayofmonth, hour, weekofyear, date_format, dayofweek
config = configparser.ConfigParser()
config.read('dl.cfg')
os.environ['AWS_... | 2.96875 | 3 |
SmartStats/roster/tests.py | waztaz/Basketball-Stats | 1 | 12763124 | <filename>SmartStats/roster/tests.py
from django.test import TestCase
from myapp.models import Coach, Team, Player, Scout, Game, CumulativeStats, BasketballStats
# Create your tests here.
class CoachTestCase(TestCase):
def setUp(self):
Coach.objects.create(first_name="Test" , last_name="Coach")
def test_coach_exi... | 2.359375 | 2 |
FluentPy/basic_data_sturcture/NumpyAndScipy.py | QAlexBall/Learning_Py | 2 | 12763125 | <filename>FluentPy/basic_data_sturcture/NumpyAndScipy.py
import numpy
a = numpy.arange(12)
print(a)
print(type(a))
print(a.shape)
a.shape = 3, 4
print(a)
print(a[2])
print(a[2, 1])
print(a[:, 1])
print(a.transpose())
# Numpy也可以对numpy.ndarray 中的元素进行抽象的读取,保存和其他操作
| 3.046875 | 3 |
iot_search.py | BoneLee/IOT-search-engine | 1 | 12763126 | <reponame>BoneLee/IOT-search-engine<filename>iot_search.py
import nltk
from influxdb import InfluxDBClient
from baeza_yates_intersect import BaezaYates_intersect
class IotSearcher(object):
def __init__(self, database='searcher', host="localhost", port=8086, user='root', password='<PASSWORD>'):
self._clien... | 2.8125 | 3 |
pychk/fetch_resources.py | ayushpriya10/pychk | 1 | 12763127 | import json
import requests
import sys
def fetch_jsons(json_output=False):
print('[INFO] Fetching latest resource files.')
try:
insecure_deps = json.loads(requests.get('https://raw.githubusercontent.com/pyupio/safety-db/master/data/insecure.json').content)
print('[INFO] Fetched list of Insecu... | 3.59375 | 4 |
itertools_module/itertools_module.py | pyjads/Python_module_helper | 0 | 12763128 | # %%
# line printer
def printer(info):
print('\n\n================================= {} =================================================\n\n'.format(info))
# %%
import itertools
# to get a counter starting from 0 to infinte
counter = itertools.count() # return type is the iterator and count will start from 0... | 4.0625 | 4 |
empower_core/accountsmanager/accountshandler.py | 5g-empower/empower-core | 3 | 12763129 | <reponame>5g-empower/empower-core
#!/usr/bin/env python3
#
# Copyright (c) 2019 <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
#
# Un... | 2.078125 | 2 |
examples/get_started.py | paulgoetze/whattime | 0 | 12763130 | <reponame>paulgoetze/whattime
from datetime import datetime
from whattime import whattime, Hemisphere
# Asking for all types of time descriptors for a e.g. a monday afternoon in summer time on the southern hemisphere:
now = datetime.now()
info = whattime(now, Hemisphere.SOUTHERN)
print(info.types)
# {<TimeType.WEEKD... | 3.71875 | 4 |
scripts/generate-sprites.py | alexfmpe/beeraffe | 41 | 12763131 | #!/usr/bin/python
import subprocess
import sys
import os
# This is in the `unicode-character-database` package on Arch Linux.
UNICODE_DATABASE = '/usr/share/unicode-character-database/UnicodeData.txt'
WORDS = 'data/words.txt'
NOTO_EMOJI_DIR = '/home/jasper/Stash/noto-emoji'
def load_unicode_database():
data = {}
... | 2.65625 | 3 |
src/vision/utils.py | ncl-ROVers/surface-2019-20 | 3 | 12763132 | """
Computer vision Utils
=====================
Standard utils module storing common to the package classes, functions, constants, and other objects.
"""
| 1.054688 | 1 |
app/main.py | scraiber/kubectl-api | 0 | 12763133 | from fastapi import FastAPI
from pydantic import BaseModel
from typing import List
import subprocess
import random
import string
import os
app = FastAPI()
class Item(BaseModel):
kube_str: str
yaml_file: List[str]
class Response(BaseModel):
Output: str
Error: str
@app.get("/general/{item}", response_... | 2.765625 | 3 |
diction.py | beatles213/py_emulate | 2 | 12763134 | <reponame>beatles213/py_emulate
'''字典 key - value'''
alien_0={'color':'green','points':5}
print(alien_0['color'])
print(alien_0['points'])
#添加
alien_0['x_position']=0
alien_0['y_position']=25
print(alien_0)
#修改
alien_0['color']='yellow'
print(alien_0)
#删除 删除的键—值对永远消失了。
del alien_0['points']
print(alien_0)
#由类似对象组成 的... | 3.6875 | 4 |
powersimdata/data_access/tests/sql/test_execute_table.py | c-voegele/PowerSimData | 27 | 12763135 | from collections import OrderedDict
import pytest
from powersimdata.data_access.execute_table import ExecuteTable
from powersimdata.data_access.sql_store import SqlError
row_id = 9000
def _get_test_row():
global row_id
row_id += 1
return OrderedDict([("id", row_id)])
class NoEffectSqlStore(ExecuteTab... | 2.203125 | 2 |
tests/utils.py | kbakba/github3.py | 0 | 12763136 | import requests
import github3
import expecter
import json
import sys
from mock import patch
from io import BytesIO
from unittest import TestCase
from requests.structures import CaseInsensitiveDict
is_py3 = sys.version_info > (3, 0)
def load(name):
with path(name) as f:
j = json.load(f)
return j
de... | 2.40625 | 2 |
ephemere/archive.py | vandalt/ephemere | 0 | 12763137 | from pathlib import Path
from typing import List, Optional, Union
from exofile.archive import ExoFile
from pandas.core.frame import DataFrame
from ephemere import constants as const
def load_archive(
query: bool = True,
exofile_param_file: Optional[Union[str, Path]] = None,
use_alt_exofile: bool = False... | 2.515625 | 3 |
tests/gsl.pkg/vector_set.py | PyreFramework/pyre | 0 | 12763138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME>. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
"""
Exercise setting and getting individual vector elements
"""
def test():
# package access
import gsl
# make a vector
v = gsl.vector(shape=100)
# fill with a test pattern
f... | 3.046875 | 3 |
mani_skill_learn/utils/torch/misc.py | art-e-fact/ManiSkill-Learn | 39 | 12763139 | from functools import wraps
import numpy as np
import torch
from mani_skill_learn.utils.data import split_in_dict_array, concat_list_of_array
def disable_gradients(network):
for param in network.parameters():
param.requires_grad = False
def worker_init_fn(worker_id):
"""The function is designed for ... | 2.671875 | 3 |
Deep_Crossing/modules.py | jingxiufenghua/rec-model | 1,323 | 12763140 | <filename>Deep_Crossing/modules.py
"""
Created on May 18, 2021
modules of Deep&Crossing: Residual units
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras.layers import Dense, ReLU, Layer
class Residual_Units(Layer):
"""
Residual Units
"""
def __init__(self, hidden_unit, dim... | 2.8125 | 3 |
source/cloudsatlhr/acquisition_stack.py | JakeHendy/cloudsatlhr | 0 | 12763141 | from aws_cdk import (core )
from .ingestion_stack import IngestionStack
from .data_store_stack import DataStoreStack
class AcquisitionStack(core.Stage):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
self.datastore_stack = DataStoreSta... | 2.15625 | 2 |
melange/tests/test_propagators.py | dominicrufa/melange | 1 | 12763142 | """
test melange.propagators
"""
from jax import random
from jax import vmap
import jax.numpy as jnp
from melange.propagators import *
from melange.tests.utils import checker_function, get_nondefault_potential_initializer
import tqdm
import numpy as np
from jax.config import config; config.update("jax_enable_x64", True... | 2.21875 | 2 |
lib/TmpGnmAnnApi/TmpGnmAnnApiClient.py | rsutormin/TmpGnmAnnApi | 0 | 12763143 | # -*- coding: utf-8 -*-
############################################################
#
# Autogenerated by the KBase type compiler -
# any changes made here will be overwritten
#
############################################################
from __future__ import print_function
# the following is a hack to get the basec... | 2.125 | 2 |
distributed/tests/test_utils_comm.py | brinkar/distributed | 0 | 12763144 | <reponame>brinkar/distributed
from __future__ import print_function, division, absolute_import
import pytest
from distributed.utils_test import gen_cluster
from distributed.utils_comm import (scatter_to_workers, pack_data,
gather_from_workers)
def test_pack_data():
data = {'x': 1}
assert pack_data((... | 2.265625 | 2 |
attack.py | carlobar/resilient-forecast | 0 | 12763145 | <reponame>carlobar/resilient-forecast
import numpy as np
import os
import time
import random
import forecast_lib as fl
dropout=False
if dropout:
type_exp = '_dropout'
else:
type_exp = ''
# experiment parameters
directory = './experiments/models_diff_size'+type_exp+'/'
m = fl.num_meters
max_num_models = 20
m_... | 1.976563 | 2 |
examples/generative_models/dgmg/utils.py | jinyu-hou/dgl-lifesci | 1 | 12763146 | <reponame>jinyu-hou/dgl-lifesci<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import datetime
import math
import numpy as np
import os
import pickle
import random
import torch
import torch.distributed as dist
import to... | 1.84375 | 2 |
generators.py | xianqiu/math-homework | 1 | 12763147 | <filename>generators.py
__all__ = ['MathL1', 'MathL2', 'MathL3', 'MathL4',
'MathL5', 'MathL6', 'MathL7', 'MathL8',
'MathL9', 'MathL10', 'MathL11', 'MathL12',
'MathL13', 'MathL14', 'MathL15', 'MathL16',
'MathL17', 'MathL18', 'MathL19', 'MathL20',
'MathL21', 'MathL2... | 2.75 | 3 |
tests/plugins/tools/test_node_npmaudit.py | RiverSafeUK/eze-cli | 4 | 12763148 | # pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,line-too-long
from unittest import mock
import pytest
from eze.plugins.tools.node_npmaudit import NpmAuditTool
from eze.utils.io import create_tempfile_path
from tests.plugins.tools.tool_helper import ToolMetaTestBase
clas... | 2.140625 | 2 |
starter/dog_shelters/migrations/0012_auto_20220319_1725.py | hadi-f90/mslearn-django-models-data | 0 | 12763149 | # Generated by Django 3.2.12 on 2022-03-19 17:25
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('dog_shelters', '0011_auto_20220319_1724'),
]
operations = [
migrations.Remo... | 1.46875 | 1 |
scripts/release/rethreshold_family.py | Rfam/rfam-production | 7 | 12763150 | """
Copyright [2009-2019] EMBL-European Bioinformatics Institute
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... | 1.6875 | 2 |