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 |
|---|---|---|---|---|---|---|
run.py | SDJustus/skip-ganomaly | 0 | 12796951 | <filename>run.py
"""
TRAIN SKIP/GANOMALY
. Example: Run the following command from the terminal.
run train.py \
--dataset cifar10 \
--abnormal_class airplane \
--display \
"""
#... | 2.890625 | 3 |
misago/misago/users/api/ranks.py | vascoalramos/misago-deployment | 2 | 12796952 | from rest_framework import mixins, viewsets
from ..models import Rank
from ..serializers import RankSerializer
class RanksViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
serializer_class = RankSerializer
queryset = Rank.objects.filter(is_tab=True).order_by("order")
| 1.898438 | 2 |
bot/models/party.py | maxsaltonstall/letters-with-strangers | 3 | 12796953 | <reponame>maxsaltonstall/letters-with-strangers<filename>bot/models/party.py
import logging, uuid, random
from .dictionary import Dictionary
from .player import Player
from .util.string_util import StringUtil
from .util.datastore import save_party, load_party, disband_party
class Party:
def __init__(self, part... | 2.71875 | 3 |
venv/Lib/site-packages/plotnine/tests/test_position.py | EkremBayar/bayar | 0 | 12796954 | import string
import numpy as np
import pandas as pd
import pytest
from plotnine import (ggplot, aes, geom_point, geom_jitter, geom_bar,
geom_col, geom_boxplot, geom_text, geom_rect,
after_stat, position_dodge, position_dodge2,
position_jitter, positio... | 2.09375 | 2 |
bibstuff/bibfile.py | cpitclaudel/bibstuff | 9 | 12796955 | <reponame>cpitclaudel/bibstuff
"""
:mod:`bibstuff.bibfile`: High level BibTeX file interface
---------------------------------------------------------
Provides two classes, BibFile and BibEntry for accessing the parts of a bibtex
database. BibFile inherits from ``simpleparse.dispatchprocessor``. To fill a
BibFile inst... | 2.15625 | 2 |
tea_admin/tea_admin/doctype/labour_information/test_labour_information.py | nivedita05/Tea-Admin | 0 | 12796956 | <reponame>nivedita05/Tea-Admin<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Labour Information')
class TestLabourInformation(unittest.TestCase):
#from e... | 2.484375 | 2 |
setup.py | deepakunni3/golr-schema-generator | 0 | 12796957 | from setuptools import setup, find_packages
NAME = 'golr-schema-generator'
DESCRIPTION = 'GOlr Schema Generator'
URL = 'https://github.com/deepakunni3/golr-schema-generator'
AUTHOR = '<NAME>'
EMAIL = '<EMAIL>'
REQUIRES_PYTHON = '>=3.7.0'
VERSION = '0.0.1'
LICENSE = 'BSD3'
REQUIRED = [
'PyYAML>=5.3'
]
EXTRAS = {
... | 1.1875 | 1 |
jqp/cli.py | abranjith/jqp | 0 | 12796958 | import json
import click
from tokenizer import get_grouped_tokens, TokenName
NULL = "null"
#from click documentation to support alias command
class AliasedGroup(click.Group):
def get_command(self, ctx, cmd_name):
rv = click.Group.get_command(self, ctx, cmd_name)
if rv is not None:
ret... | 2.703125 | 3 |
config.py | andela-oadeniran/bucket_list_app | 0 | 12796959 | import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
MAIN_DB_URL = os.path.join(BASE_DIR, 'bucketlist.sqlite')
TEST_DB_URL = os.path.join(BASE_DIR, 'test.sqlite')
class BaseConfig(object):
'''
The class holds base config for each environment
'''
SECRET_KEY = os.getenv('SECRET_KEY', 'This s... | 2.328125 | 2 |
parentopticon/db/test_model.py | EliRibble/parentopticon | 0 | 12796960 | import datetime
import os
from typing import List, Optional
import unittest
from parentopticon.db import test_utilities
from parentopticon.db.model import ColumnInteger, ColumnText, Model
class ModelTests(test_utilities.DBTestCase):
"Test all of our logic around the model class."
class MyTable(Model):
COLUMNS = {... | 2.9375 | 3 |
babilim/data/specialized_readers/data_downloader.py | penguinmenac3/babilim | 1 | 12796961 | <reponame>penguinmenac3/babilim<filename>babilim/data/specialized_readers/data_downloader.py
import os
import urllib.request
from zipfile import ZipFile
def download_zip(root_dir: str, url: str) -> None:
"""
Download a zip from a url and extract it into a data folder.
Usefull for downloading small dataset... | 3.859375 | 4 |
kiv_bit_rsa/hash/__init__.py | miroslavkrysl/kiv-bit-rsa | 0 | 12796962 | """Hashing module
A simple module for hashing.
Contains base class :py:class:`Hash` from which all
hash implementations inherits.
For now contains only MD5 hash class :py:class:`Md5`
"""
from .hash import Hash
from .md5 import Md5
__all__ = ["Hash", "Md5"]
| 3.28125 | 3 |
Numpy/Zeros and Ones.py | Code-With-Aagam/python-hackerrank | 3 | 12796963 | <reponame>Code-With-Aagam/python-hackerrank
import numpy
numbers = tuple(map(int, input().split()))
print(numpy.zeros(numbers, dtype = numpy.int), numpy.ones(numbers, dtype = numpy.int), sep='\n')
| 3.3125 | 3 |
plaso/formatters/utmpx.py | CNR-ITTIG/plasodfaxp | 1 | 12796964 | # -*- coding: utf-8 -*-
"""The UTMPX binary file event formatter."""
from plaso.formatters import interface
from plaso.formatters import manager
from plaso.lib import errors
class UtmpxSessionFormatter(interface.ConditionalEventFormatter):
"""Formatter for an UTMPX session event."""
DATA_TYPE = u'mac:utmpx:even... | 2.375 | 2 |
log.py | k1k9/job-offer-fetcher | 0 | 12796965 | <filename>log.py
#!/usr/bin/env python3
#
# Title: job-ofert-fetcher
# Description: This part of script is responsible for saving script behaviors into log file
# Author: @k1k9
# License: MIT
#
from time import localtime as ltime
def saveLog(content, tag="INFO"):
''' Save information (log) into log file '''
# Confi... | 3.140625 | 3 |
mousemorph/mousemorph.py | dancebean/mousemorph | 20 | 12796966 | <filename>mousemorph/mousemorph.py
#!/usr/bin/python
"""MouseMorph, an automatic mouse MR image processor
This is the base MouseMorph program. Run it with Python.
Usage
python mousemorph.py --help
Orient brains to standard space
-------------------------------
python ... | 3.265625 | 3 |
kdcrf/tests/test_template.py | fagonzalezo/sklearn-kdcrf | 0 | 12796967 | import pytest
import numpy as np
from sklearn.datasets import load_iris
from numpy.testing import assert_array_equal
from numpy.testing import assert_allclose
from .._kdclassifier import KDClassifierRF
from .._RBFSamplerORF import RBFSamplerORF
from .._RBFSamplerSORF import RBFSamplerSORF
@pytest.fixture
def data()... | 2.28125 | 2 |
docs_build/tutorials_templates/data_management/data_versioning/mds.py | dataloop-ai/sdk_examples | 3 | 12796968 | def section1():
"""
# Data Versioning
Dataloop's powerful data versioning provides you with unique tools for data management - clone, merge, slice & dice your files, to create multiple versions for various applications. Sample use cases include:
Golden training sets management
Reproducibility (datas... | 2.984375 | 3 |
applied_python/applied_python/lib/python2.7/site-packages/ansible/runner/lookup_plugins/dict.py | mith1979/ansible_automation | 1 | 12796969 | <gh_stars>1-10
# (c) 2014, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | 2.03125 | 2 |
2015/day_14/reindeers.py | ceronman/AdventOfCode2015 | 4 | 12796970 | from itertools import cycle, islice
import re
distances = {}
for line in open('input.txt'):
m = re.match(r'(\w+) can fly (\d+) km/s for (\d+) seconds, '
r'but then must rest for (\d+) seconds.', line)
reindeer, speed, time, rest = m.groups()
distances[reindeer] = cycle([int(speed)] * int(... | 3.046875 | 3 |
bliss/urls.py | jugovich/teresajugovich | 0 | 12796971 | <reponame>jugovich/teresajugovich
from django.conf.urls import include, url
from dolove import views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
admin.autodiscover()
urlpatterns = [
url(r'^$', view... | 1.859375 | 2 |
Day-32/Birthday_Wisher/main.py | MihirMore/100daysofcode-Python | 4 | 12796972 | import datetime as dt
import pandas
import random
import smtplib
from astroid import Pass
MY_EMAIL = "your_email"
PASSWORD = "<PASSWORD>"
today = dt.datetime.now()
today_tuple = (today.month, today.day)
data = pandas.read_csv("birthdays.csv")
birthday_dict = {(data_row.month, data_row.day): data_row for (index, da... | 3.296875 | 3 |
pyodesys/convergence.py | slayoo/pyodesys | 82 | 12796973 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
import warnings
from math import exp
import numpy as np
def fit_factory(discard=1):
def fit(x, y):
p = np.polyfit(x, y, 1)
v = np.polyval(p, x)
e = np.abs(y - v)
drop_idxs = np.argsort(e)[-... | 2.8125 | 3 |
supports/pyload/src/pyload/plugins/accounts/PremiumizeMe.py | LuckyNicky/pycrawler | 1 | 12796974 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import json
from ..base.multi_account import MultiAccount
class PremiumizeMe(MultiAccount):
__name__ = "PremiumizeMe"
__type__ = "account"
__version__ = "0.30"
__status__ = "testing"
__pyload_version__ = "0.5"
__config__ = [
("mh_mode", "all;l... | 2.203125 | 2 |
catalog/urls.py | gcrsaldanha/sms | 0 | 12796975 | <gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('item/', views.ItemListCreate.as_view()),
]
| 1.4375 | 1 |
setup.py | tsurusekazuki/Create_Package | 0 | 12796976 | # -*- coding: utf-8 -*-
# Learn more: https://github.com/kennethreitz/setup.py
import os, sys
from setuptools import setup, find_packages
def read_requirements() -> List:
"""Parse requirements from requirements.txt."""
reqs_path = os.path.join('.', 'requirements.txt')
with open(reqs_path, 'r') as f:
... | 1.90625 | 2 |
tests/test_models.py | kalev/flatpak-indexer | 6 | 12796977 | from flatpak_indexer.models import FlatpakBuildModel, ImageModel, ImageBuildModel, RegistryModel
IMAGE1 = {
"Annotations": {"key1": "value1"},
"Architecture": "amd64",
"Digest": "sha256:baabaa",
"Labels": {"key2": "value2"},
"MediaType": "application/vnd.docker.distribution.manifest.v2+json",
... | 1.734375 | 2 |
IMTool/IMUtil.py | naong2/MayaPython | 0 | 12796978 | <reponame>naong2/MayaPython
#-*- coding: utf-8 -*-
import sys, os
import maya.cmds as cmds
import maya.mel as mel
from inspect import getsourcefile
from os.path import abspath
import maya.app.general.resourceBrowser as resourceBrowser
# 기능
#############################################################################
d... | 2.359375 | 2 |
but/trades/apps.py | yevgnenll/but | 4 | 12796979 | from django.apps import AppConfig
class AppConfigTrade(AppConfig):
name = "trades"
def ready(self):
from trades.signals.post_save import post_save_hashid
| 1.65625 | 2 |
set3/crack_MT19937_seed.py | nahgil2614/cryptopals | 0 | 12796980 | import time
import random
from MT19937 import seed_mt
from MT19937 import extract_number
def delay( seconds ): #delay thì Ctrl + C được, còn time.sleep() thì không
start = time.time()
while time.time() - start < seconds:
pass
def main():
start_time = time.time()
print('Pending.... | 3.03125 | 3 |
guild/commands/main_impl.py | guildai/guild-cli | 63 | 12796981 | <reponame>guildai/guild-cli
# Copyright 2017-2022 RStudio, PBC
#
# 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.867188 | 2 |
demos/python/sdk_wireless_camera_control/tests/test_wifi_commands.py | hypoxic/OpenGoPro | 1 | 12796982 | <gh_stars>1-10
# test_wifi_commands.py/Open GoPro, Version 1.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Tue May 18 22:08:51 UTC 2021
from pathlib import Path
import pytest
from open_gopro.wifi_commands import WifiCommands, WifiSettings, WifiCommunicator
from... | 2.25 | 2 |
sources/praline/client/project/pipeline/stages/load_clang_format.py | dansandu/praline | 0 | 12796983 | from praline.client.project.pipeline.stage_resources import StageResources
from praline.client.project.pipeline.stages.stage import stage
from praline.client.repository.remote_proxy import RemoteProxy
from praline.common.file_system import FileSystem, join
from typing import Any, Dict
clang_format_style_file_contents... | 1.90625 | 2 |
peacecorps/contenteditor/forms.py | cmc333333/peacecorps-site | 8 | 12796984 | <reponame>cmc333333/peacecorps-site
import logging
from django import forms
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth.forms import (
AdminPasswordChangeForm, PasswordChangeForm, UserCreationForm)
from django.utils.translation import ugettext_lazy as _
from contentedit... | 2.4375 | 2 |
tests/test_slack_neuron.py | royto/slack_neuron | 0 | 12796985 | import unittest
from kalliope.core.NeuronModule import MissingParameterException
from kalliope.neurons.slack.slack import Slack
class TestSlack(unittest.TestCase):
def setUp(self):
self.slack_token="<PASSWORD>"
self.channel = "kalliochannel"
self.message = "kalliomessage"
def testPa... | 2.640625 | 3 |
lib/googlecloudsdk/api_lib/spanner/instance_configs.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | 12796986 | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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.890625 | 2 |
experiments/enumerate_params.py | falkben/fastapi_experiments | 4 | 12796987 | <reponame>falkben/fastapi_experiments<gh_stars>1-10
from enum import Enum
from typing import Optional
import uvicorn
from fastapi import FastAPI, Query
app = FastAPI()
class NameEnum(str, Enum):
empty = ""
bob = "bob"
doug = "doug"
@app.get("/hello")
async def hello(name: NameEnum = Query(NameEnum.em... | 2.90625 | 3 |
setup.py | guilleCoro/django-autocomplete | 1 | 12796988 | from setuptools import setup
import pkg_resources
import autocomplete
def get_metadata_version():
"""
Tries to get the version from the django_autocomplete.egg-info directory.
"""
try:
pkg = list(pkg_resources.find_distributions('.', True))[0]
except IndexError:
return autocomplete... | 1.84375 | 2 |
typhon/tests/plots/test_plots.py | SallyDa/typhon | 0 | 12796989 | # -*- coding: utf-8 -*-
"""Testing the functions in typhon.plots.
"""
import os
from typhon import plots
class TestPlots:
"""Testing the plot functions."""
def test_figsize(self):
"""Test golden ratio for figures sizes."""
ret = plots.figsize(10)
assert ret == (10, 6.1803398874989481... | 2.625 | 3 |
ckanext/heroslider/plugin.py | OpenGov-OpenData/ckanext-heroslider | 0 | 12796990 | # encoding: utf-8
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import logging
try:
from ckan.common import config # CKAN 2.7 and later
except ImportError:
from pylons import config # CKAN 2.7 and later
log = logging.getLogger(__name__)
def dataset_count():
"""Return a count of a... | 2.109375 | 2 |
graphsignal/graphsignal_test.py | graphsignal/graphsignal | 84 | 12796991 | <filename>graphsignal/graphsignal_test.py
import unittest
import logging
import sys
from unittest.mock import patch, Mock
import graphsignal
logger = logging.getLogger('graphsignal')
class GraphsignalTest(unittest.TestCase):
def setUp(self):
if len(logger.handlers) == 0:
logger.addHandler(lo... | 2.703125 | 3 |
intralinks/utils/associations.py | ilapi/intralinks-sdk-python | 3 | 12796992 | <filename>intralinks/utils/associations.py
"""
For educational purpose only
"""
def associate_users_and_groups(users, groups, group_members):
users_by_id = {u['id']:u for u in users}
groups_by_id = {g['id']:g for g in groups}
for u in users:
u['groups'] = []
for g in groups:
g... | 2.671875 | 3 |
changecolor.py | VSanteriH/Python-Kivy-template | 0 | 12796993 | '''
This file is used for changing icons color from black to white, so icon color could be
changed in code.
Icon images are from https://github.com/iconic/open-iconic/tree/master/png
'''
import os
from PIL import Image # https://pillow.readthedocs.io/en/stable/
def find_files():
""" Finds all files from icons fo... | 3.96875 | 4 |
src/reader/management/commands/batch_import_perseus.py | LukeMurphey/textcritical_net | 6 | 12796994 | from django.core.management.base import BaseCommand
from reader.importer.PerseusBatchImporter import PerseusBatchImporter
from reader.importer.batch_import import JSONImportPolicy
import os
import sys
class Command(BaseCommand):
help = "Imports all Perseus XML documents from a directory that match the i... | 2.234375 | 2 |
src/models/predict_model.py | MariaFogh/MLOps_Transformers | 1 | 12796995 | <reponame>MariaFogh/MLOps_Transformers<filename>src/models/predict_model.py
import torch
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification
from wandb_helpers import wandb_arg_parser
import wandb
def test_model():
"""
Tests the trained model using the small ve... | 2.546875 | 3 |
HeavyIonsAnalysis/TrackAnalysis/python/TrkAnalyzers_cff.py | flodamas/cmssw | 0 | 12796996 | <gh_stars>0
import FWCore.ParameterSet.Config as cms
from HeavyIonsAnalysis.TrackAnalysis.trackAnalyzer_cfi import *
anaTrack = ppTrack.clone(
trackPtMin = 0.49,
trackSrc = cms.InputTag("hiGeneralTracks"),
vertexSrc = cms.VInputTag('hiSelectedVertex'),
mvaSrc = cms.InputTag('hiGeneralTracks','MVAVals'... | 1.117188 | 1 |
DCP#2/Dcp2.py | Tsubanee/Algorithms-Practice | 0 | 12796997 | <reponame>Tsubanee/Algorithms-Practice<gh_stars>0
import numpy as np
def MultiForEachInd(arr):
new_arr = np.ones((len(arr), 1))
np.array(arr)
k = len(arr)
for i in range(k):
for j in range(k):
if j != i:
new_arr[j] *= arr[i]
return new_arr
#Solution with product... | 3.515625 | 4 |
pool_service/tokens.py | sunil16/token_pool | 0 | 12796998 | <filename>pool_service/tokens.py
import random
import string
def randomStringDigits(stringLength=15):
"""Generate a random string of letters and digits """
lettersAndDigits = string.ascii_letters + string.digits
return ''.join(random.choice(lettersAndDigits) for i in range(stringLength))
def getTokens(nu... | 3.265625 | 3 |
floga/analyzer/analyzer_fs.py | sudaning/Floga | 2 | 12796999 | <filename>floga/analyzer/analyzer_fs.py
# -*- coding: utf-8 -*-
import os
import time
import sys
from datetime import datetime
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
from base.base import PRINT, INPUT, getColor
if PY2:
from analyzer import LogAnalyzer
else:
from analyzer.analyzer import... | 2 | 2 |
examples/boost_python/demo3_numpy/demo3.py | davidcortesortuno/finmag | 10 | 12797000 | <reponame>davidcortesortuno/finmag<filename>examples/boost_python/demo3_numpy/demo3.py
import numpy as np
import demo3_module
a = np.array([[1, 2], [3, 4]], dtype=float)
print "Trace of a:", demo3_module.trace(a)
| 2.25 | 2 |
lib/mvc/notification_window/controller.py | realmar/gnome-quota-indicator | 0 | 12797001 | <reponame>realmar/gnome-quota-indicator<gh_stars>0
"""Controller of the notification window."""
from lib.mvc.bases import ControllerBase
from lib.mvc.notification_window.model import NotificationWindowModel
from lib.mvc.notification_window.view import NotificationWindowView
from lib.exception_feedback import add_defau... | 1.84375 | 2 |
setup.py | Daiwv/bittrex_autotrader | 1 | 12797002 | <filename>setup.py
from distutils.core import setup
version = '0.0.6'
setup(
name = 'bittrex_autotrader',
packages = ['bittrex_autotrader'],
version = version,
description = 'Bittrex currency exchange autotrading script in a nutshell.',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.... | 1.328125 | 1 |
smlb/optimizers/random_optimizer.py | CitrineInformatics/smlb | 6 | 12797003 | """An "optimizer" that draws random samples.
Scientific Machine Learning Benchmark
A benchmark of regression models in chem- and materials informatics.
2019-2020, Citrine Informatics.
"""
from typing import Optional, Any
from smlb import (
params,
Random,
RandomVectorSampler,
VectorSpaceData,
Opt... | 3.21875 | 3 |
models/windows81_general_configuration.py | MIchaelMainer/msgraph-v10-models-python | 1 | 12797004 | <reponame>MIchaelMainer/msgraph-v10-models-python<filename>models/windows81_general_configuration.py
# -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any ... | 1.945313 | 2 |
deplodocker/formatter.py | RCheese/deplodocker | 5 | 12797005 | try:
import orjson as json
except ImportError:
import json
import toml
import yaml
def format_requirements(data: dict) -> str:
result = []
for group, values in data.items():
result.append(f"### {group.upper()}\n")
for extras, version in values.items():
result.append(f"{ext... | 2.734375 | 3 |
launch/launchLESHIT.py | mcaldana/CubismUP_3D | 8 | 12797006 | #!/usr/bin/env python3
import os, numpy as np, argparse
def relFit(nu, eps): return 7.33972668 * np.power(eps, 1/6.0) / np.sqrt(nu)
def etaFit(nu, eps): return np.power(eps, -0.25) * np.power(nu, 0.75)
def lambdaFit(nu, eps): return 5.35507603 * np.power(eps,-1/6.0) * np.sqrt(nu);
def runspec(nu, eps, run, cs... | 2.078125 | 2 |
eden/iterated_maximum_subarray.py | smautner/EDeN | 42 | 12797007 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
import numpy as np
def find_smallest_positive(alist):
# find first positive value
minpos = -1
for x in alist:
if x > 0:
minpos = x
... | 3.03125 | 3 |
_unittests/ut_sklapi/test_onnx_helper.py | Exlsunshine/mlprodict | 0 | 12797008 | <filename>_unittests/ut_sklapi/test_onnx_helper.py
"""
@brief test log(time=2s)
"""
import unittest
from logging import getLogger
import numpy
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import Binarizer, StandardScaler, OneHotEncoder
from skl2onnx import convert_sklearn
from skl2onnx.com... | 2.46875 | 2 |
recipes/Python/286229_Remove_control_character_M_opened_html/recipe-286229.py | tdiprima/code | 2,023 | 12797009 | <reponame>tdiprima/code
import string
class Stripper( SGMLParser ) :
...
def handle_data( self, data ) :
data = string.replace( data, '\r', '' )
...
| 2.3125 | 2 |
mmdet/models/bbox_heads/convfc_bbox_head_MH.py | Gitgigabyte/mmd | 1 | 12797010 | import torch.nn as nn
from ..registry import HEADS
from ..utils import ConvModule
from .bbox_head import BBoxHead
import torch
import torch.nn.functional as F
import mmcv
from mmdet.core import mask_target, mask_bg_target, force_fp32, bbox_target, bbox_overlaps
from ..losses import accuracy
from ..builder import build... | 1.84375 | 2 |
services/mongoDbService/matchProvider.py | DanielTal87/Football-Management-Tool | 0 | 12797011 | #!/usr/bin/python3
from services.loggerServices.loggerService import LoggerService
logger = LoggerService().logger
def create_match(self, data):
return self.client.FMT["matches"].insert_one(data).inserted_id
def update_match(self, data):
return self.client.FMT["matches"].update_one(data, upsert=True).inser... | 2.875 | 3 |
cursoemvideoPy/Mundo1/ex012.py | BrCarlini/exPython | 0 | 12797012 | print('========= Desconto =========')
preco = float(input('Digite o preço do produto: R$'))
calc = preco - ((5 / 100) * preco)
print(f'Preço digitado R${preco}\nDesconto: 5%\nPreço com desconto: R${calc}') | 3.875 | 4 |
asf_search/ASFSearchResults.py | gitter-badger/Discovery-asf_search | 57 | 12797013 | <gh_stars>10-100
from collections import UserList
from multiprocessing import Pool
import json
from asf_search import ASFSession
class ASFSearchResults(UserList):
def geojson(self):
return {
'type': 'FeatureCollection',
'features': [product.geojson() for product in self]
}
... | 2.953125 | 3 |
eoxserver/services/subset.py | ESA-VirES/eoxserver | 1 | 12797014 | <reponame>ESA-VirES/eoxserver<filename>eoxserver/services/subset.py<gh_stars>1-10
#-------------------------------------------------------------------------------
# $Id$
#
# Project: EOxServer <http://eoxserver.org>
# Authors: <NAME> <<EMAIL>>
#
#-------------------------------------------------------------------------... | 1.304688 | 1 |
c2cwsgiutils/scripts/genversion.py | camptocamp/c2cwsgiutils | 5 | 12797015 | #!/usr/bin/env python3
import json
import logging
import os
import re
import subprocess # nosec
import sys
from typing import Dict, Optional, Tuple, cast
SRC_VERSION_RE = re.compile(r"^.*\(([^=]*)===?([^=]*)\)$")
VERSION_RE = re.compile(r"^([^=]*)==([^=]*)$")
LOG = logging.getLogger(__name__)
def _get_package_versi... | 2.484375 | 2 |
src/constellix/domains/record/type/main.py | aperim/python-constellix | 0 | 12797016 | <filename>src/constellix/domains/record/type/main.py
"""A Record"""
import logging
_LOGGER = logging.getLogger(__name__)
class DomainRecord(object):
def __init__(self, protocol=None, domain=None):
super().__init__()
self.__protocol = protocol
self.__domain = domain
@property
def ... | 2.625 | 3 |
scripts/autoreduce/reduce_REF_L.py | neutrons/LiquidsReflectometer | 0 | 12797017 | <gh_stars>0
"""
Auto-reduction script for the Liquids Reflectometer
For reference:
Type 0: Normal sample data
Type 1: Direct beams for scaling factors
Type 2: Zero-attenuator direct beams
Type 3: Data that we don't need to treat
"""
import sys
import os
import json
import warning... | 2.328125 | 2 |
openerp/addons/document/content_index.py | ntiufalara/openerp7 | 3 | 12797018 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 1.75 | 2 |
create_morf_wordmap.py | lallubharteja/KWS-Scripts | 27 | 12797019 | #!/usr/bin/env python3
from __future__ import print_function
import morfessor
import sys
import logging
import lzma
import os
import math
def main(allowed_chars_file, model):
allowed_chars = {line.strip() for line in open(allowed_chars_file, encoding='utf-8') if len(line.strip()) == 1}
model = morfessor.M... | 3 | 3 |
data_utils/create_data.py | jsedoc/Tree_Learning | 0 | 12797020 | from __future__ import print_function
from create_tree import *
import numpy as np
import random
DATA_DIR = "../data/"
def curriculum_depth(i, num_examples, max_depth):
curriculum_max_depth= int((max_depth*i)/num_examples)
#print(i, curriculum_max_depth,)
if curriculum_max_depth > 0:
random_depth ... | 3.234375 | 3 |
setup.py | daconex/GroupMeNotifier | 1 | 12797021 | <reponame>daconex/GroupMeNotifier<filename>setup.py
from setuptools import setup
setup(
name='GroupMe Notifier',
version=0.1,
description='GroupMe Notifier is a tool for getting notifications on desktop',
author='<NAME>',
author_email='<EMAIL>',
url='http://daconex.me',
install_requires=['r... | 1.5625 | 2 |
GraphTheory/check_binary_search_tree.py | GeorgeLinut/CodingInterviewTipsAndTricks | 19 | 12797022 | def check_bst_util(root, min_value, max_value):
if root is None:
return True
if not (min_value < root.value < max_value):
return False
return check_bst_util(root.left, min, root.value) and check_bst_util(root.right, root.value, max)
def check_bst(root):
return check_bst_util(root, - ma... | 3.390625 | 3 |
core.py | pygics-mod/page | 0 | 12797023 | <reponame>pygics-mod/page<gh_stars>0
# -*- coding: utf-8 -*-
'''
Created on 2017. 10. 25.
@author: HyechurnJang
'''
import os
import uuid
import types
import jinja2
from pygics import Lock, ContentType, export, rest
def createVid(): return 'v-' + str(uuid.uuid4())
class Tag(dict):
def __init... | 2.4375 | 2 |
pharmacognosy/users/__init__.py | skylifewww/pharmacognosy | 0 | 12797024 | <reponame>skylifewww/pharmacognosy<gh_stars>0
default_app_config = 'pharmacognosy.users.apps.Config'
| 1.109375 | 1 |
example.py | bekaertruben/ns-census-maximizer | 3 | 12797025 | <filename>example.py<gh_stars>1-10
import census_maximizer as cm
import matplotlib.pyplot as plt # if not installed, run `pip install matplotlib`
# CONFIG
USER = "<Insert nation name here>"
PASSWORD = "<<PASSWORD> here>"
CONTACT = "<Nationstates demands that the User Agent contain a method of contacting the Scrip... | 3.15625 | 3 |
python/setuptools/example_without_dependency/jdhp_setuptools_demo/__init__.py | jeremiedecock/snippets | 23 | 12797026 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 <NAME> (http://www.jdhp.org)
"""
A great package example!
"""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha rele... | 1.898438 | 2 |
f5/bigip/shared/test/functional/test_iapp.py | nghia-tran/f5-common-python | 272 | 12797027 | # Copyright 2015 F5 Networks Inc.
#
# 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 agreed to in writi... | 1.617188 | 2 |
lesson-03/fractal_tree_v1.0.py | hemiaoio/pylearning | 1 | 12797028 | """
功能:分形树
版本:1.0
日期:2018/08/19
"""
import turtle
def draw_branch(branch_length, pen_size):
if(branch_length > 0):
turtle.forward(branch_length)
turtle.right(20)
draw_branch(branch_length-10, pen_size)
turtle.left(40)
draw_branch(branch_length-10, pen_size)
... | 4.28125 | 4 |
renpy/preferences.py | GlebYoutuber/DDLC | 1 | 12797029 | <filename>renpy/preferences.py
# Copyright 2004-2017 <NAME> <<EMAIL>>
#
# 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, ... | 1.71875 | 2 |
app/apps/core/migrations/0015_auto_20190426_0724.py | lawi21/escriptorium | 4 | 12797030 | # Generated by Django 2.1.4 on 2019-04-26 07:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0014_auto_20190417_1639'),
]
operations = [
migrations.AlterUniqueTogether(
name='documentpart',
unique_together={('... | 1.375 | 1 |
LevelBuilder/sourceGenerator.py | joonamo/pocket-game | 0 | 12797031 | def write_tiledata(outfile, bank, tiles_data, name):
def write_tiles():
out = ""
for tile in tiles_data:
out += " // " + tile["name"] + "\n"
out += " " + ",".join(tile["hexdata"]) + ",\n"
return out
def write_palettes():
return ", ".join([hex(tile["palette_idx"]) for tile in tiles_dat... | 3.28125 | 3 |
core_admin/des/migrations/0033_auto_20210722_1449.py | linea-it/tno | 0 | 12797032 | # Generated by Django 2.2.13 on 2021-07-22 14:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('des', '0032_auto_20210713_2127'),
]
operations = [
migrations.AlterField(
model_name='astrometryjob',
name='status'... | 1.773438 | 2 |
tests/test_matrix.py | vladislav-miroshnikov/formal-lang-course | 0 | 12797033 | import pytest
from pyformlang.finite_automaton import NondeterministicFiniteAutomaton
from project import BooleanMatrices
@pytest.fixture
def nfa():
nfa = NondeterministicFiniteAutomaton()
nfa.add_transitions(
[
(0, "X", 1),
(0, "X", 2),
(1, "Y", 2),
(1... | 2.328125 | 2 |
python-100-examples/test76.py | zengxianbin/Practice | 2 | 12797034 | #!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
class Solution(object):
def test76(self):
'''
题目:编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,当输入n为奇数时,调用函数1/1+1/3+...+1/n
'''
return ""
if __name__ == "__main__":
solution = Solution()
solution.test76()
| 3.09375 | 3 |
src/electric/main.py | electricdb/electric-cli | 0 | 12797035 | <filename>src/electric/main.py
"""ElectricDB command line interface utility.
Run `electric --help` for usage.
"""
import click
from .resources.auth import auth
# from .resources.account import account
# from .resources.database import database
from . import browser
from . import config
@click.group(cls=click.Gro... | 2.28125 | 2 |
assign_rights/mixins/authmixins.py | RockefellerArchiveCenter/aquila | 0 | 12797036 | <gh_stars>0
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.urls import reverse_lazy
class LoggedInMixinDefaults(LoginRequiredMixin):
"""Sets basic login_url for mixin defaults."""
login_url = reverse_lazy("login")
class EditMixin(LoggedInMixinDefaults, UserPassesT... | 2.3125 | 2 |
Modifier/interface/other.py | hamano0813/PoR | 4 | 12797037 | <filename>Modifier/interface/other.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PySide6.QtWidgets import QGridLayout, QTextEdit
from widget import BackgroundFrame, ValueSpin, NameLabel
from parameter import DataSetting
# noinspection PyTypeChecker
class Other(BackgroundFrame):
def __init__(self, parent)... | 2.1875 | 2 |
quanttrader/event/__init__.py | qalpha/quanttrader | 135 | 12797038 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .event import *
from .backtest_event_engine import *
from .live_event_engine import * | 1.09375 | 1 |
autoio/mess_io/tests/test__read_pes.py | mobergd/autoio | 0 | 12797039 | <filename>autoio/mess_io/tests/test__read_pes.py
"""
tests pes reader
"""
import os
import numpy
import mess_io
PATH = os.path.dirname(os.path.realpath(__file__))
DATA_PATH = os.path.join(PATH, 'data')
DATA_NAME = 'rates.inp'
with open(os.path.join(DATA_PATH, DATA_NAME), 'r') as datfile:
INP_STR = datfile.read(... | 2.359375 | 2 |
alipay/aop/api/domain/MultiStagePayLineInfo.py | antopen/alipay-sdk-python-all | 213 | 12797040 | <reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MultiStagePayLineInfo(object):
def __init__(self):
self._payment_amount = None
self._payment_idx = None
@property
... | 2.109375 | 2 |
scripts/helpers.py | mashaelalzaid/rare-diseases-SE | 0 | 12797041 | # -*- coding: utf-8 -*-
from scripts import tabledef
from flask import session
from sqlalchemy.orm import sessionmaker
from contextlib import contextmanager
import bcrypt
import sys, subprocess, ipaddress, time, datetime, json, os, csv, copy
from watson_developer_cloud import DiscoveryV1
EnvID="5aec3469-82f9-49cb-9... | 2.1875 | 2 |
billiards/billiards/views/match.py | zxkane/billiards | 0 | 12797042 | <reponame>zxkane/billiards<filename>billiards/billiards/views/match.py
# -*- coding: utf-8 -*-
# encoding: utf-8
'''
Created on 2013年10月22日
@author: kane
'''
from StringIO import StringIO
import datetime
import json
from dateutil.relativedelta import relativedelta
from django.core import serializers
from django.core.... | 2 | 2 |
data/dataset2ssv.py | TWTDIG/frechetrange | 5 | 12797043 | <filename>data/dataset2ssv.py
""" Importer for T-Drive Dataset
takes t-drive directory and creates SSV
"""
import numpy as np;
import pandas as pd;
import os;
import sys;
from tqdm import tqdm;
from matplotlib import pyplot as plt;
def character(indir, outfile):
print("Importing Character dataset")
print... | 2.703125 | 3 |
povary/apps/recipes/tasks.py | TorinAsakura/cooking | 0 | 12797044 | # -*- coding: utf-8 -*-
from celery.task import task
@task
def publish_recipe(recipe):
from recipes.models import Recipe
try:
recipe = Recipe.objects.get(id=recipe.id)
recipe.published=True
recipe.save()
except Recipe.DoesNotExist:
pass | 1.875 | 2 |
transmission_rpc/session.py | sc104501/transmission-rpc | 61 | 12797045 | # Copyright (c) 2018-2021 Trim21 <<EMAIL>>
# Copyright (c) 2008-2014 <NAME> <<EMAIL>>
# Licensed under the MIT license.
from typing import TYPE_CHECKING, Any, Dict, Tuple, Union, Generator
from typing_extensions import Literal
from transmission_rpc.lib_types import Field
if TYPE_CHECKING:
from transmission_rpc.c... | 2.65625 | 3 |
Missions_to_Mars/scrape_mars.py | neilhsu70/web-scraping-challenge | 0 | 12797046 | <reponame>neilhsu70/web-scraping-challenge
from bs4 import BeautifulSoup
from splinter import Browser
import requests
import pymongo
import pandas as pd
import time
def scrape():
mars_news = 'https://mars.nasa.gov/news/'
mars_image = 'https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars'
mars_twit... | 3.234375 | 3 |
kunquat/tracker/ui/views/sheet/trigger_renderer.py | cyberixae/kunquat | 0 | 12797047 | # -*- coding: utf-8 -*-
#
# Author: <NAME>, Finland 2014
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or neighboring rights to Kunquat.
#
from PyQt4.QtCore impo... | 1.6875 | 2 |
systest/testcases/vim/test_vim.py | ayoubbargueoui1996/osm-devops | 0 | 12797048 | <reponame>ayoubbargueoui1996/osm-devops
# Copyright 2017 Sandvine
#
# 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/... | 1.960938 | 2 |
examples/simpy/bank.py | chrismurf/simulus | 2 | 12797049 | <gh_stars>1-10
"""This example is modified from the simpy's bank renege example; we
use the same settings as simpy so that we can get the same results."""
RANDOM_SEED = 42 # random seed for repeatability
NUM_CUSTOMERS = 5 # total number of customers
INTV_CUSTOMERS = 10.0 # mean time between new customer... | 3.046875 | 3 |
env_interpretation/lazy_cartesian_product.py | GeorgianBadita/Dronem-gym-envirnoment | 5 | 12797050 | <reponame>GeorgianBadita/Dronem-gym-envirnoment
"""
@author: <NAME>
@email: <EMAIL>
@date: 04.04.2020 17:34
"""
from typing import List, Any
from bigfloat import *
class LazyCartesianProduct:
"""
Class for generating the lazy cartesian product
"""
def __init__(self, sets: List[List[Any... | 2.859375 | 3 |