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
fatiando/seismic/tests/test_seismic_conv.py
XuesongDing/fatiando
179
12774951
from __future__ import absolute_import, division import numpy as np from numpy.testing import assert_array_almost_equal, assert_allclose from pytest import raises from fatiando.seismic import conv def test_impulse_response(): """ conv.convolutional_model raises the source wavelet as result when the model ...
2.4375
2
private_files/views.py
vilamatica/django-private-files
4
12774952
<filename>private_files/views.py<gh_stars>1-10 try: from urllib.parse import unquote except ImportError: from urllib import unquote from django.conf import settings from django.http import Http404 from django.core.exceptions import PermissionDenied from django.apps import apps from django.shortcuts import get_...
2.15625
2
machine-learning-gists/7e6c7875761f293ba12d882f1cf723e48e0b0350/snippet.py
qwbjtu2015/dockerizeme
0
12774953
#!/usr/bin/env python # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # @Author: <NAME> # @Lab of Machine Learning and Data Mining, TianJin University # @Email: <EMAIL> # @Date: 2018-10-26 15:32:34 # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ from __future__ i...
2.578125
3
main_game.py
Matistjati/Simple-console-game
0
12774954
<reponame>Matistjati/Simple-console-game<filename>main_game.py # todo Better drop system # Return values: # 0: Failed for something like an error in internal structure # 1: Success (even if nothing changed, it may be considered success) # 2: "Failed" due to some sort of intended reason import random import time...
2.953125
3
zeTorch/data.py
piovere/zeTorch
0
12774955
"""Contains class for data files. Maybe should eventually sublass Spectrum? """ import numpy as np class Data(object): """DOCSTRING """ def __init__(self, file=None): """DOCSTRING """ self._file = file def load(self, file=None): if file is None and self._file is N...
2.671875
3
Chapter8/src/discriminator.py
AI-Nerd/Generative-Adversarial-Networks-Cookbook
98
12774956
#!/usr/bin/env python3 import sys import numpy as np from keras.layers import Input, Dense, Reshape, Flatten, Dropout, BatchNormalization from keras.layers.convolutional import Conv3D, Deconv3D from keras.layers.core import Activation from keras.layers.advanced_activations import LeakyReLU from keras.models import Sequ...
2.53125
3
pybenford/benford.py
pierrepo/pybenford
1
12774957
<gh_stars>1-10 """Module to verify Benford's law on observed data.""" import math import numpy as np import matplotlib.pyplot as plt from scipy.stats import distributions, power_divergence np.random.seed(2021) # Random seed def get_theoretical_freq_benford(nb_digit=1, base=10): """Theoretical proportions of Be...
3.625
4
losses/l2/L2.py
harshikaninawe/Machine-Learning-concepts
10
12774958
import numpy as np def L2Loss(y_predicted, y_ground_truth, reduction="None"): """returns l2 loss between two arrays :param y_predicted: array of predicted values :type y_predicted: ndarray :param y_ground_truth: array of ground truth values :type y_ground_truth: ndarray :param reduction: redu...
4.15625
4
pyfos/utils/extension/gigabitethernet_speed_set.py
sandeepv451/Pyfostest
0
12774959
#!/usr/bin/env python3 # Copyright © 2018 Broadcom. All Rights Reserved. The term “Broadcom” refers to # Broadcom Inc. and/or its subsidiaries. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may also obtain a copy of the Lice...
2.03125
2
src/testjson.py
stormfish-scientific/sensorstreamer-data-viz-quickstart
1
12774960
<filename>src/testjson.py<gh_stars>1-10 import json import argparse from pprint import pprint parser = argparse.ArgumentParser('test json file') parser.add_argument('json_file') args = parser.parse_args() with open(args.json_file, 'r') as jf: filedata = jf.read() data = json.loads(filedata) pprint(data[0]) ...
3.15625
3
src/opendr/perception/object_detection_2d/nms/utils/nms_dataset.py
daoran/opendr
0
12774961
# Copyright 2020-2022 OpenDR European Project # # 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 agree...
1.867188
2
mashumaro/serializer/json.py
dand-oss/mashumaro
0
12774962
import json from types import MappingProxyType from typing import Any, Dict, Mapping, Type, TypeVar, Union from typing_extensions import Protocol from mashumaro.serializer.base import DataClassDictMixin DEFAULT_DICT_PARAMS = { "use_bytes": False, "use_enum": False, "use_datetime": False, } EncodedData = ...
2.28125
2
template.py
RemyG/python-scripts-template
0
12774963
import argparse parser = argparse.ArgumentParser() parser.add_argument("-V", "--version", help="show program version", action="store_true") args = parser.parse_args() if args.version: print("Version 0.1")
2.875
3
odin/metrics/performance_summary.py
gsamarakoon/Odin
103
12774964
<reponame>gsamarakoon/Odin<filename>odin/metrics/performance_summary.py import pandas as pd from .compute_drawdowns import compute_drawdowns from .compute_sharpe_ratio import compute_sharpe_ratio def performance_summary(history, portfolio_id): """This function computes common performance metrics for a time-series...
3.390625
3
cogkit/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py
stefb965/swift-k
99
12774965
#!/usr/bin/env python import os import errno import sys import random import logging import pprint import argparse import datetime import time #from __future__ import print_function import imp try: imp.find_module('libcloud') except ImportError: sys.stderr.write("Python: Apache libcloud module not available,...
2.046875
2
Singleton.py
RaynoldKim/MyTrade
0
12774966
class Singleton: __instance = None @classmethod def __get_instance(cls): return cls.__instance @classmethod def instance(cls, *args, **kargs): cls.__instance = cls(*args, **kargs) cls.instance = cls.__get_instance return cls.__instance """"" class MyClass(BaseClass...
3.421875
3
exercicios-Python/desaf095.py
marcelo-py/Exercicios-Python
0
12774967
dadosd = dict() jogadores = list() gols = list() while True: dadosd['nome'] = str(input('Nome: ')) total = int(input('Quantas partidas {} jogou? '.format(dadosd['nome']))) for c in range(0, total): gols.append(int(input('Quantos gols no {}º jogo? '.format(c+1)))) dadosd['gols'] = gols[:] ...
3.546875
4
swexpert/d3/sw_5948.py
ruslanlvivsky/python-algorithm
3
12774968
test_cases = int(input()) for t in range(1, test_cases + 1): nums = list(map(int, input().strip().split())) result = [] for i in range(0, 5): for j in range(i + 1, 6): for k in range(j + 1, 7): result.append(nums[i] + nums[j] + nums[k]) result = sorted(list(set(resul...
2.96875
3
crypto_balancer/backtest_exchange.py
GRTTX/crypto_balancer
28
12774969
import glob import json import pandas as pd from crypto_balancer.dummy_exchange import DummyExchange LIMITS = {'BNB/BTC': {'amount': {'max': 90000000.0, 'min': 0.01}, 'cost': {'max': None, 'min': 0.001}, 'price': {'max': None, 'min': None}}, 'BNB/ETH': {'amount':...
2.3125
2
db.py
vorian77/udacity-into-to-programming-python-adventure-game
0
12774970
# atomic level def get_idx(list, key): for idx in range(len(list)): if key == list[idx][0]: return idx def ins(list, key, val): list.append([key, val]) return list def ret(list, key): idx = get_idx(list, key) return list[idx][1] def upd(list, key, val): new_item = [key....
2.796875
3
src/processors/user_accounts.py
carlashley/munkicon
15
12774971
import subprocess from distutils.version import StrictVersion from platform import mac_ver try: from munkicon import plist from munkicon import worker except ImportError: from .munkicon import plist from .munkicon import worker # Keys: 'user_home_path' # 'secure_token' # 'volume_owners' ...
1.84375
2
src/values.py
abhra2020-smart/FlowLang
0
12774972
<gh_stars>0 from dataclasses import dataclass @dataclass class Number: value: any def __repr__(self): return f"{self.value}" @dataclass class Bool: value: bool def __repr__(self): return f"{self.value}".lower()
2.734375
3
causalator.py
nickwbarber/hilt-scripts
1
12774973
#!/usr/bin/env python3 import os from itertools import chain from collections import Counter import argparse import gatenlphiltlab relators = [ "because", "cuz", "since", "after", "when", "whenever", "once", "therefore", "so", "if", "soon", "result", "results", ...
2.4375
2
install/scripts/popoolationte2.py
shunhuahan/mcclintock
0
12774974
import sys import os sys.path.append(snakemake.config['paths']['mcc_path']) import scripts.mccutils as mccutils def main(): download_success = mccutils.download(snakemake.params.url, snakemake.output[0], md5=snakemake.params.md5, max_attempts=3) if not download_success: print("popoolationTE2 download f...
2.0625
2
gradle-conda-plugin/examples/multi-project-example/example-lib/src/main/python/lib.py
logbee/gradle-plugins
3
12774975
<filename>gradle-conda-plugin/examples/multi-project-example/example-lib/src/main/python/lib.py class Example: def __init__(self): self.name = "" pass def greet(self, name): self.name = name print("hello " + name)
1.820313
2
core/data/astrosource/astro_source.py
xcamilox/frastro
1
12774976
<reponame>xcamilox/frastro<gh_stars>1-10 import time import json class AstroSource(object): __id="" __catalogs=[] # list of catalogs source __images=[] #list of image source __spectra=[] #list of spectral __sumary={} #usfully data like: magnitud, redshift, name, id..etc __date_request=000000 #ti...
2.34375
2
calvin/runtime/south/plugins/storage/twistedimpl/securedht/tests/test_dht_server_evil.py
josrolgil/exjobbCalvin
1
12774977
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
1.59375
2
src/backend/common/decorators.py
guineawheek/ftc-data-take-2
0
12774978
<gh_stars>0 from functools import partial, wraps from flask import make_response, request, Response def cached_public(func=None, timeout: int = 61): if func is None: # Handle no-argument decorator return partial(cached_public, timeout=timeout) @wraps(func) def decorated_function(*args, **kwargs...
2.5625
3
actionrules/reduction/__init__.py
KIZI/actionrules
8
12774979
from .reduction import *
1.117188
1
CURSO PYTHON UDEMY/Curso Udemy/Mundo 4 (POO)/AGRAGACAO108.py
nihilboy1455/CURSO-PYTHON-UDEMY
0
12774980
<reponame>nihilboy1455/CURSO-PYTHON-UDEMY class Carrinho_de_compras: def __init__(self): self.produtos = [] def inserir_produto(self, produto): self.produtos.append(produto) def listar_produtos(self): for produto in self.produtos: print(produto.nome, produto.valor) ...
4.125
4
server.py
Mushrifah/Stress-detection
1
12774981
import flask import random import sys import os import glob import re from pathlib import Path import pickle import numpy as np # Import fast.ai Library from fastai import * from fastai.vision import * # Flask utils from flask import Flask, redirect, url_for, request, render_template,jsonify from werkzeug.utils impo...
2.46875
2
ninja_apikey/tests.py
mawassk/django-ninja-apikey
13
12774982
<reponame>mawassk/django-ninja-apikey # flake8: noqa from datetime import timedelta import pytest from django.contrib.admin.sites import AdminSite from django.contrib.auth.hashers import check_password from django.contrib.auth.models import User from django.utils import timezone from django.utils.crypto import get_ran...
2.171875
2
config.py
Zegers/fernwehTrips
0
12774983
<reponame>Zegers/fernwehTrips DEBUG = True HOST = '127.0.0.1' PORT = 8000
1.023438
1
gripql/python/gripql/connection.py
jordan2lee/grip
0
12774984
from __future__ import absolute_import, print_function, unicode_literals from gripql.graph import Graph from gripql.util import BaseConnection, raise_for_status class Connection(BaseConnection): def __init__(self, url, user=None, password=None, token=None, credential_file=None): super(Connection, self)._...
2.515625
3
CONTENT/DS-n-Algos/ALGO/_LEETCODE/032_longest_valid_parentheses/longest_valid_parentheses_TE.py
impastasyndrome/DS-ALGO-OFFICIAL
13
12774985
class Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: int """ i = 0 maxlen = 0 self.longest = {} while i < len(s): if s[i] == ")": i = i + 1 continue else: ...
3.421875
3
api/migrations/0005_auto_20201231_0034.py
jjkivai/SolutionsWeb
0
12774986
<reponame>jjkivai/SolutionsWeb # Generated by Django 3.1.4 on 2020-12-31 00:34 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0004_licenses_name'), ] operations = [ migrations.RenameModel( old_name='Licenses', ne...
1.71875
2
models/engine/file_storage.py
cbarros7/AirBnB_clone_v2
0
12774987
#!/usr/bin/python3 """This module defines a class to manage file storage for hbnb clone""" import json class FileStorage: """This class manages storage of hbnb models in JSON format""" __file_path = 'file.json' __objects = {} def all(self, cls=None): """Returns a dictionary of models currentl...
3.09375
3
grafana_client/__init__.py
peekjef72/grafana-client
11
12774988
<filename>grafana_client/__init__.py from .api import GrafanaApi
1.015625
1
ac.py
freenoth/nltktask
0
12774989
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module represent logic of detection and conversion of cheats. """ # py_ver : [3.5.2] # date : [02.11.2016] # author : [<NAME>] # email : [<EMAIL>] class AntiCheater(object): """ Help to detect and convert text cheats. :method check_word:...
3.625
4
statsmodels/stats/moment_helpers.py
ginggs/statsmodels
6
12774990
<filename>statsmodels/stats/moment_helpers.py<gh_stars>1-10 """helper functions conversion between moments contains: * conversion between central and non-central moments, skew, kurtosis and cummulants * cov2corr : convert covariance matrix to correlation matrix Author: <NAME> License: BSD-3 """ import numpy as ...
2.8125
3
app/controller/report/__init__.py
bhzunami/reanalytics
0
12774991
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Blueprint report = Blueprint('report', __name__) from . import views
1.21875
1
fte/plots_ports.py
jason-r-becker/financial-transfer-entropy
6
12774992
import time from collections import defaultdict from datetime import timedelta import cvxpy as cp import empiricalutilities as eu import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from tqdm import tqdm from transfer_entropy import TransferEntropy plt.style.use('fivethirtyei...
1.96875
2
web/controllers/home/user/Profile.py
apanly/python_learn_master
5
12774993
<gh_stars>1-10 # -*- coding: utf-8 -*- from flask import Blueprint,request from application import db from common.components.helper.UtilHelper import UtilHelper from common.components.helper.ValidateHelper import ValidateHelper from common.models.notice.UserNews import UserNews from common.services.CommonConstant impo...
2.125
2
telltime/main.py
wjimenez5271/telltime
1
12774994
from datetime import datetime from time import time from argparse import ArgumentParser def epoch_to_datetime(epoch): return datetime.fromtimestamp(epoch) def get_epoch_time(): return time() def main(): parser = ArgumentParser() parser.add_argument('epoch_time', type=int, default=-1, nargs='?') ...
3.46875
3
polus-cell-nuclei-segmentation/src/dsb2018_topcoders/albu/src/pytorch_zoo/inplace_abn/models/__init__.py
nishaq503/polus-plugins-dl
0
12774995
from .wider_resnet import *
1.140625
1
some-ml-examples/PyDataSeattle-master/check_environment.py
kryvokhyzha/examples-and-courses
1
12774996
<gh_stars>1-10 import importlib packages = ['pandas', 'IPython', 'statsmodels', 'sklearn', 'seaborn', 'toolz', 'bs4', 'requests', 'scipy', 'tables'] bad = [] for package in packages: try: importlib.import_module(package) except ImportError: bad.append("Can't import %s" % package) e...
2.609375
3
preprocessing.py
Draeius/SVM_TxtCat
0
12774997
import re from typing import List from collections import Counter from data import Article class Process: def process(self, words: List[str]) -> List[str]: pass class Strategy: _lastLetters = List[str] _measure = List[int] _containsVowel = False _doubleConsonant = False _endsWithPat...
3.3125
3
applications/CoSimulationApplication/python_scripts/helpers/dummy_solver_wrapper.py
lcirrott/Kratos
2
12774998
<reponame>lcirrott/Kratos from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 # Importing the Kratos Library import KratosMultiphysics as KM # Importing the base class from KratosMultiphysics.CoSimulationApplication.base_classes.co_s...
2.09375
2
external_packages/matlab/non_default_packages/Gaussian_Process/deck/+dk/+mapred/python/mapred_build.py
ThomasYeoLab/Standalone_He2022_MM
0
12774999
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import string import json import mapred_utils as util # ------------------------------ ========== ------------------------------ # ------------------------------ ========== ------------------------------ # Template strings to be formatted and ...
2.46875
2
appstore_tools/actions/publish.py
luke14free/appstore-tools
0
12775000
import os import hashlib import colorama import requests from typing import Union, Sequence from appstore_tools import appstore from appstore_tools.print_util import print_clr, clr, json_term from appstore_tools.appstore.auth import AccessToken from .util import ( read_txt_file, print_locale_status, print_...
2.421875
2
le-namesilo/namesilo.py
vs49688/scripts
1
12775001
#!/usr/bin/env python3 import os import urllib.parse import urllib.request from collections import OrderedDict import xml.etree.ElementTree class NameSilo(object): def __init__(self, apikey): self._apikey = apikey def _make_url(self, op, **args): x = OrderedDict( version=1, type='xml', key=self._apike...
2.5625
3
capiq/tests/unit/test_capiq_client_gdsp.py
vy-labs/capiq-python
29
12775002
import unittest from mock import mock from capiq.capiq_client import CapIQClient def mocked_gdsp_data_requests_post(*args, **kwargs): class MockResponse: def __init__(self, json_data, status_code): self.json_data = json_data self.status_code = status_code def json(self):...
2.609375
3
generate_configs.py
ryanclanigan/messaging-bridge
0
12775003
from shutil import copyfile import glob import os if not os.path.exists("config"): os.mkdir("config") for file in glob.glob("example-config/*.json"): copyfile(file, os.path.join("config", file.split("example-")[-1]))
2.765625
3
example_model.py
amipy/numerous
0
12775004
from enum import Enum from numerous.engine.model import Model from numerous.engine.simulation import Simulation from numerous.engine.system import Subsystem, Item from tests.test_equations import TestEq_ground, Test_Eq, TestEq_input from enum import Enum from numerous.engine.model import Model from numerous.engine.s...
2.40625
2
src/filter.py
Boyploy/IMF
108
12775005
<filename>src/filter.py # Copyright (c) 2017 <NAME> and <NAME> at SoftSec, KAIST # # See the file LICENCE for copying permission. import os import utils import sys def parse_name(data): return data.split('\'')[1] def parse_selector(data): if 'selector' in data: ret = data.split('selector')[1].split('...
2.46875
2
src/MicroPython/main.py
mnkagarwal0/IoTMQTTSample
46
12775006
<filename>src/MicroPython/main.py ## The file name needs to be renamed to main.py for it work on the ESP 32 board import utime from util import create_mqtt_client, get_telemetry_topic, get_c2d_topic, parse_connection HOST_NAME = "HostName" SHARED_ACCESS_KEY_NAME = "SharedAccessKeyName" SHARED_ACCESS_KEY = "SharedAcce...
2.640625
3
lisc/tests/plts/test_words.py
koudyk/lisc
0
12775007
<reponame>koudyk/lisc<filename>lisc/tests/plts/test_words.py """Tests for lisc.plts.words.""" from collections import Counter from lisc.tests.tutils import plot_test, optional_test from lisc.plts.words import * ################################################################################################### #####...
2.53125
3
2015/3/directions_2.py
lvaughn/advent
0
12775008
<reponame>lvaughn/advent #!/usr/bin/env python3 visited = set() visited.add((0, 0)) turn = 0 # Santa = 0, Robo-Santa = 1 locations = [[0, 0], [0, 0]] with open('input.txt', 'r') as f: for line in f: for ch in line: pos = locations[turn] turn = (turn + 1) % 2 if ch == ...
3.296875
3
tests/ui/test_functional.py
REFEDS/met
0
12775009
from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from pyvirtualdisplay import Display from tests.testing_utilities import populate_test_db class FunctionalTest(StaticLiveServerTestCase): def setUp...
2.375
2
src/dask_remote/cluster_base.py
octoenergy/dask-remote
4
12775010
<gh_stars>1-10 import asyncio from distributed.core import rpc from distributed.deploy.cluster import Cluster from distributed.security import Security from distributed.utils import LoopRunner class NoOpAwaitable(object): """An awaitable object that always returns None. Useful to return from a method that c...
2.46875
2
packages/cdk-s3-deployment/lib/lambda/handler.py
DaySmart/daysmart-cdk-constructs
1
12775011
<reponame>DaySmart/daysmart-cdk-constructs<gh_stars>1-10 import subprocess import os import tempfile import json import traceback import logging import shutil import boto3 import contextlib from datetime import datetime from uuid import uuid4 from urllib.request import Request, urlopen from zipfile import ZipFile log...
2.015625
2
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/connection/Connectable.py
HahaBill/CollaborativeAI
1
12775012
from abc import ABC, abstractmethod from typing import TypeVar, Generic, List from geniusweb.connection.ConnectionEnd import ConnectionEnd INTYPE = TypeVar('INTYPE') OUTTYPE = TypeVar('OUTTYPE') class Connectable(ABC, Generic[INTYPE,OUTTYPE]): ''' A Connectable is an object that can connect on request with a provi...
3
3
musicxml/xmlelement/containers.py
alexgorji/musicxml
0
12775013
<gh_stars>0 from musicxml.xmlelement.xmlchildcontainer import XMLChildContainerFactory from musicxml.xsd.xsdcomplextype import * from musicxml.xsd.xsdcomplextype import __all__ containers = {} for ct in __all__[1:]: cls = eval(ct) if cls.get_xsd_indicator(): containers[ct] = XMLChildContainerFactory(c...
1.742188
2
fastwork/merge.py
xugongli/fastwork
0
12775014
import os import pandas as pd class MergeExcel(object): def __init__(self, excel_filepath=None, folder_path=None, sheetname_lst=None): """ : df_dict: df组成的字典,key为sheetname : sheetname_lst: 需要合并的sheetname列为,默认为空,即不指定则合并所有 """ self.excel_filepath = excel_filepath self...
3.03125
3
configs/experiments.py
YuXie96/time
0
12775015
"""Experiments and corresponding analysis. format adapted from https://github.com/gyyang/olfaction_evolution Each experiment is described by a function that returns a list of configurations function name is the experiment name combinatorial mode: config_ranges should not have repetitive values sequential mode: ...
2.6875
3
onnx_tf/handlers/backend/conv_transpose.py
malisit/onnx-tensorflow
1,110
12775016
from onnx_tf.handlers.backend_handler import BackendHandler from onnx_tf.handlers.handler import onnx_op from onnx_tf.handlers.handler import partial_support from onnx_tf.handlers.handler import ps_description from .conv_mixin import ConvMixin @onnx_op("ConvTranspose") @partial_support(True) @ps_description("ConvTran...
2.0625
2
binding/__init__.py
zauberzeug/binding
1
12775017
from binding.binding import BindableProperty, update, reset
1.289063
1
Clase12/iris_seaborn.py
qagustina/python-exercises
0
12775018
# 12.10 import pandas as pd import seaborn as sns from sklearn.datasets import load_iris iris_dataset = load_iris() # creamos un dataframe de los datos de flores # etiquetamos las columnas usando las cadenas de iris_dataset.feature_names iris_dataframe = pd.DataFrame(iris_dataset['data'], columns = iris_dataset.feat...
3.015625
3
examples/__init__.py
tehdragonfly/pyramid_services_viewmapper
0
12775019
from __future__ import annotations from pyramid.config import Configurator from wsgiref.simple_server import make_server from zope.interface import Interface, implementer from pyramid_services_viewmapper import ServiceInjector as SI, ServiceViewMapper class IExampleService(Interface): def example(self): ...
2.34375
2
motivating-examples/maze-solver/maze.py
dgrafov/redi-python-intro
8
12775020
<reponame>dgrafov/redi-python-intro __author__ = "<NAME>" __email__ = "<EMAIL>" import random import os import time MAZE_WIDTH = 20 MAZE_HEIGHT = 20 MAX_STEPS = 5000 PAUSE_BETWEEN_STEPS = 0.05 class Maze: cur_x = 0 cur_y = 0 entrance = (0, 0) def __init__(self, height, width): self.height =...
3.921875
4
tests/optimization_test.py
NREL/flasc
3
12775021
<reponame>NREL/flasc import numpy as np import pandas as pd from pandas.core.base import DataError import unittest from flasc.optimization import ( find_timeshift_between_dfs, match_y_curves_by_offset ) def generate_dataframes(): # Define a reference signal t = pd.date_range( "2019-01-10 12:1...
2.640625
3
test_work/tree_views/core/views.py
Netromnik/python
0
12775022
from django.views.generic import TemplateView class Slide(TemplateView): pass
1.007813
1
pelops/features/feature_producer.py
dave-lab41/pelops
48
12775023
<filename>pelops/features/feature_producer.py<gh_stars>10-100 import numpy as np from PIL import Image from pelops.datasets.chipper import Chipper from pelops.datasets.featuredataset import FeatureDataset class FeatureProducer(object): def __init__(self, chip_producer): self.chip_producer = chip_producer...
2.75
3
PWGJE/EMCALJetTasks/Tracks/analysis/test/PlotScaledTriggered.py
maroozm/AliPhysics
114
12775024
''' Created on 22.09.2014 @author: markusfasel ''' from PWGJE.EMCALJetTasks.Tracks.analysis.base.Graphics import SinglePanelPlot, GraphicsObject, Style, Frame from PWGJE.EMCALJetTasks.Tracks.analysis.correction.TriggeredSpectrumScaler import TriggeredSpectrumScaler from PWGJE.EMCALJetTasks.Tracks.analysis.correction....
1.570313
2
HW7/Mengyuan_HW7.py
MengyuanZoe/HomeIn
5
12775025
""" Module Functions: Plot King County House Rate data, in the form of sale listing cluster map and density heat map. """ import os import webbrowser import pandas as pd import folium from folium import plugins # Set global settings and macros. MAX_SHOW = 1000 HOUSE_URL = 'houses.html' HOUSE_HEAT_URL = "hou...
3.78125
4
yangTools/scripts/ytPlugin.py
mightyang/yangTools
1
12775026
#!/usr/bin/env python # -*- coding: utf-8 -*- # File : scriptsytPlugin.py # Author : yang <<EMAIL>> # Date : 04.03.2019 # Last Modified Date: 13.03.2019 # Last Modified By : yang <<EMAIL>> from ytLoggingSettings import yl import ytVariables import ytVersion import platform import ...
2.40625
2
tests/unit/test_domain.py
be-rock/coin-flipper
1
12775027
from collections import defaultdict def test_can_obtain_coinflip_results(coin_fixture): number_of_flips = 10 results = coin_fixture.flip(number_of_flips=number_of_flips) assert isinstance(results, defaultdict) assert results["heads"] + results["tails"] == number_of_flips
2.515625
3
stats/merging_hierarchy_mapping/process_merging_tmp.py
beneisner/partnet_seg_exps
70
12775028
import os import sys in_fn = sys.argv[1] out_fn = sys.argv[2] fin = open(in_fn, 'r') fout = open(out_fn, 'w') for item in fin.readlines(): data = item.rstrip().split() if len(data[-1]) == 0: data = data[:-1] if len(data) == 4: fout.write('%s %s\n' % (data[-1], data[-1])) else: fout.wr...
2.640625
3
hsi_to_rgb.py
wkiino/Hyperspectral_to_rgb_image
3
12775029
from pathlib import Path import numpy as np from PIL import Image def load_light_distribution(name="lamp_spectrum.csv"): sd_light_source = np.loadtxt(name, skiprows=1, dtype="float") sd_light_source = sd_light_source[np.where(sd_light_source[:, 0] >= 400)] # rindx = np.where(sd_light_source[:, 0] >= 400)...
2.671875
3
backBin/scrapers/washu/scrape_washu_edu.py
rishabhranawat/CrowdPlatform
1
12775030
<reponame>rishabhranawat/CrowdPlatform<gh_stars>1-10 import requests from bs4 import BeautifulSoup import re import urlparse import json def is_abs(url): return bool(urlparse.urlparse(url).netloc) def get_relative_path(host, rel): return urlparse.urljoin(host, rel) def get_washu_courses_page(): COURSES_CS_WASHU =...
2.96875
3
server.py
zemogle/unicorn_sounds
0
12775031
import pyaudio import numpy as np import sys import time import asyncio from aiohttp import web, WSMsgType import json import os import struct import websocket HOST = os.getenv('HOST', '0.0.0.0') PORT = int(os.getenv('PORT', 8080)) SAMPLE_RATE = 44100 CHUNK_SIZE = 4096 AUDIO_FORMAT = pyaudio.paInt16 FORMAT = np.int...
2.390625
2
common/query_settings.py
clearspending/api.clearspending.ru
1
12775032
# -*- coding: utf-8 -*- APIdict = {} from api.snippets import booleaniator, dbid, yearfilter, asIs, dateRange, floatRange, toListAnd, toListOr, toList, \ is_guid, placingtype, mongo_id, unicode_whitespace, okdp_okpd, less_int # используется для фильтрации входящих параметров notUseParameterVal = {u'None', u'all'...
1.796875
2
tests/unit/test_std_stream_replacer.py
matthewgdv/miscutils
0
12775033
# import pytest class TestBaseReplacerMixin: def test_target(self): # synced assert True def test_write(self): # synced assert True def test_flush(self): # synced assert True def test_close(self): # synced assert True class TestStdOutReplacerMixin: def test...
2.125
2
api/admin.py
josuelopes512/mastercode_films_api
0
12775034
from django.contrib import admin # Register your models here. from .models import Movie class MovieAdmin(admin.ModelAdmin): list_display = ['id', 'movie_id', 'title', 'slug'] prepopulated_fields = { "slug": ("title",) } admin.site.register(Movie, MovieAdmin)
1.992188
2
dynamodb-streams-lambda-filter/src/update_view_counters.py
MauriceBrg/snippets
2
12775035
import os import boto3 TABLE_NAME = os.environ.get("TABLE_NAME", "filter-demo-data") TABLE = boto3.resource("dynamodb").Table(TABLE_NAME) CLIENT = boto3.client("dynamodb") def lambda_handler(event, context): # We can work on the assumption that we only get items # in NewImage with a type of "VIEW", that me...
2.015625
2
conanfile.py
vuo/conan-libusb
0
12775036
<filename>conanfile.py<gh_stars>0 from conans import ConanFile, tools, AutoToolsBuildEnvironment import shutil import os import platform class LibusbConan(ConanFile): name = 'libusb' source_version = '1.0.23' package_version = '0' version = '%s-%s' % (source_version, package_version) build_requir...
2.1875
2
tests/qa/test_qa_wl6351.py
timgates42/mysql-connector-python
0
12775037
# Copyright (c) 2013, 2021, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # # This program is also distributed with certain software (including # ...
1.671875
2
src/settings/ConfigurationHandler.py
jenkins-head/jenkins-head-controller
1
12775038
import logging import yaml import pprint from settings.HeadConfiguration import HeadConfiguration from settings.ConfigurationBaseClass import ConfigurationBaseClass class ConfigurationHandler(ConfigurationBaseClass): """ This class handels the configuration file. After loading the content this class prov...
2.53125
3
test/test_datastream_creation.py
scramjetorg/framework-python
16
12775039
<reponame>scramjetorg/framework-python<filename>test/test_datastream_creation.py<gh_stars>10-100 from scramjet.streams import Stream, UnsupportedOperation import asyncio from scramjet.ansi_color_codes import * import pytest # test cases @pytest.mark.asyncio async def test_creating_stream_using_constructor(): stre...
2.421875
2
app/recipe/tests/test_recipe_api.py
goldbossstatus/recipe-app-api
0
12775040
<reponame>goldbossstatus/recipe-app-api # python function that allows you to generate temp files import tempfile import os # pillow requirements importing our image class which will then let us create # test images which we can then upload to our API from PIL import Image from django.contrib.auth import get_user_model ...
2.734375
3
example_data/test_eval.py
pguridi/ageofempyres
0
12775041
<reponame>pguridi/ageofempyres import sys from turnboxed.utils import evaluate_in_sandbox code = """from basebot import BaseBot from basebot import BaseBot class Bot(BaseBot): def on_turn(self, data_dict): return None """ def main(): evaluate_in_sandbox(code) sys.exit(0) if __name__ == "__ma...
2.09375
2
PyBank/print_analysis.py
gshreve01/python-challenge
0
12775042
<reponame>gshreve01/python-challenge # prints out the analysis to screen and to a file import os import sys # from a lot of pain to eventually read on a hack method..... sys.path.insert(1, '../Common') import common # taken from stack overflow - https://stackoverflow.com/questions/21208376/converting-float-to-dollar...
3.421875
3
yt/frontends/gdf/api.py
danielgrassinger/yt_new_frontend
0
12775043
<reponame>danielgrassinger/yt_new_frontend """ API for yt.frontends.gdf """ #----------------------------------------------------------------------------- # Copyright (c) 2013, yt Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distribu...
0.996094
1
agents/nets.py
ishaanchandratreya/phyre-fwd
9
12775044
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
2.171875
2
ephios/plugins/pages/views.py
garinm90/ephios
0
12775045
from django.contrib.auth.views import redirect_to_login from django.views.generic import DetailView, ListView from ephios.core.views.settings import SettingsViewMixin from ephios.extra.mixins import StaffRequiredMixin from ephios.plugins.pages.models import Page class PageListView(StaffRequiredMixin, SettingsViewMix...
2.046875
2
Back-End/util/create_world.py
Zealll/maze
0
12775046
<gh_stars>0 from django.contrib.auth.models import User from adventure.models import Player, Room from util.sample_generator import World world = World() world.generate_rooms(23, 23, 529) cache = {} for i in world.grid: for j in i: room = Room(title = j.name, description = f'This room is called {j.name} it...
2.28125
2
tests/django_django_marshmallow/main/api.py
filwaitman/whatever-rest-framework
1
12775047
<gh_stars>1-10 from functools import partial from django.views.generic import View from wrf.api.base import BaseAPI, api_view from wrf.base import APIError from wrf.framework.django import DjangoFrameworkComponent from wrf.orm.django import DjangoORMComponent from wrf.pagination.base import NoPaginationComponent, Pag...
1.992188
2
applications/ex/models/db1.py
Gorang-Maniar/DGD
0
12775048
# coding: utf8 db.define_table('post', Field('Email',requires=IS_EMAIL()), Field('filen','upload'), auth.signature)
1.21875
1
main.py
HealYouDown/florensia-inventory-database
1
12775049
<filename>main.py import ctypes import datetime import os import sys from typing import Union import xlsxwriter as xlsx from pandas import read_excel from logger import setup_logger from pywinbot import Address, MemoryReader from strings import get_strings import traceback INVENTORY_BASE_ADDRESS = Address("007BA638"...
2.328125
2
multiscale/tests/test_bulk_img_processing.py
uw-loci/multiscale_imaging
1
12775050
# -*- coding: utf-8 -*- import multiscale.bulk_img_processing as blk from pathlib import Path import unittest class get_core_file_name_TestSuite(unittest.TestCase): """Basic test cases.""" def test_multiple_underscores(self): testStr = 'This_name_has_multiple_underscores.extension' self.asse...
2.46875
2