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 |
|---|---|---|---|---|---|---|
dbd/cli/dbdcli.py | AlexRogalskiy/dbd | 33 | 17900 | import importlib.metadata
import logging
import os
import shutil
from typing import Dict, Any, List
import click
from sqlalchemy import text
from dbd.log.dbd_exception import DbdException
from dbd.config.dbd_profile import DbdProfile
from dbd.config.dbd_project import DbdProject
from dbd.executors.model_executor impo... | 2.28125 | 2 |
bestiary/serializers.py | Itori/swarfarm | 66 | 17901 | <filename>bestiary/serializers.py<gh_stars>10-100
from rest_framework import serializers
from bestiary import models
class GameItemSerializer(serializers.ModelSerializer):
category = serializers.SerializerMethodField()
class Meta:
model = models.GameItem
fields = [
'id',
... | 2.234375 | 2 |
Code/ConvNetAbel.py | abel-gr/AbelNN | 1 | 17902 | <reponame>abel-gr/AbelNN
# Copyright <NAME>. All Rights Reserved.
# https://github.com/abel-gr/AbelNN
import numpy as np
import copy as copy
import random
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from pylab import text
import math
class ConvNetAbel:
version = 1.2
def... | 2.34375 | 2 |
trading_ig/config.py | schwankner/ig-markets-api-python-library | 1 | 17903 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import logging
ENV_VAR_ROOT = "IG_SERVICE"
CONFIG_FILE_NAME = "trading_ig_config.py"
logger = logging.getLogger(__name__)
class ConfigEnvVar(object):
def __init__(self, env_var_base):
self.ENV_VAR_BASE = env_var_base
def _env_var(self, key):
... | 2.8125 | 3 |
train.py | jmlipman/MedicDeepLabv3Plus | 1 | 17904 | <reponame>jmlipman/MedicDeepLabv3Plus
# Example usage:
# python train.py --device cuda --epochs 10 --input /home/miguelv/data/in/train/ --output /home/miguelv/data/out/delete/test/25/
import os, time, torch, json
import numpy as np
import nibabel as nib
from lib.utils import *
from lib.losses import Loss
from torch.ut... | 2.265625 | 2 |
src/graph_util.py | oonat/inverse-distance-weighted-trust-based-recommender | 0 | 17905 | <reponame>oonat/inverse-distance-weighted-trust-based-recommender
import numpy as np
from toml_parser import Parser
from scipy.sparse.csgraph import dijkstra, csgraph_from_dense
from sklearn.metrics.pairwise import nan_euclidean_distances
from math import sqrt
class Graph(object):
def __init__(self, transactions, we... | 2.71875 | 3 |
qtapps/skrf_qtwidgets/analyzers/analyzer_rs_zva.py | mike0164/scikit-rf | 379 | 17906 | <gh_stars>100-1000
from skrf.vi.vna import rs_zva
class Analyzer(rs_zva.ZVA):
DEFAULT_VISA_ADDRESS = "GPIB::16::INSTR"
NAME = "Rhode & Schwartz ZVA"
NPORTS = 4
NCHANNELS = 32
SCPI_VERSION_TESTED = ''
| 1.296875 | 1 |
rules/taxonomic_classification/utils.py | dahak-metagenomics/taco-taxonomic-classification | 0 | 17907 | def container_image_is_external(biocontainers, app):
"""
Return a boolean: is this container going to be run
using an external URL (quay.io/biocontainers),
or is it going to use a local, named Docker image?
"""
d = biocontainers[app]
if (('use_local' in d) and (d['use_local'] is True)):
... | 3.203125 | 3 |
Contents/Libraries/Shared/guessit/rules/properties/episodes.py | slvxstar/Kinopoisk.bundle | 7 | 17908 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
episode, season, disc, episode_count, season_count and episode_details properties
"""
import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
fr... | 2.484375 | 2 |
cwinpy/heterodyne/heterodyne.py | nigeltrc72/cwinpy | 5 | 17909 | <gh_stars>1-10
"""
Run heterodyne pre-processing of gravitational-wave data.
"""
import ast
import configparser
import copy
import os
import shutil
import signal
import sys
import tempfile
from argparse import ArgumentParser
import cwinpy
import numpy as np
from bilby_pipe.bilbyargparser import BilbyArgParser
from bi... | 2.171875 | 2 |
timpani/webserver/webhelpers.py | ollien/Timpani | 3 | 17910 | import flask
import functools
import bs4
import urllib.parse
from .. import auth
from .. import themes
from .. import settings
INVALID_PERMISSIONS_FLASH_MESSAGE = "Sorry, you don't have permission to view that page."
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.se... | 2.796875 | 3 |
bot/plugins/keyboard/__init__.py | grahamtito/TelegramFiletoCloud | 0 | 17911 | #!/usr/bin/env python3
# This is bot coded by <NAME> and used for educational purposes only
# https://github.com/AbhijithNT
# Copyright <NAME>
# Thank you https://github.com/pyrogram/pyrogram
from pyrogram.types import (
InlineKeyboardMarkup,
InlineKeyboardButton
)
def server_select():
upload_selection =... | 2.21875 | 2 |
django_storymarket/forms.py | jacobian/django-storymarket | 1 | 17912 | <gh_stars>1-10
import logging
import operator
import storymarket
from django import forms
from django.core.cache import cache
from django.conf import settings
from .models import SyncedObject
# Timeout for choices cached from Storymarket. 5 minutes.
CHOICE_CACHE_TIMEOUT = 600
log = logging.getLogger('django_storymark... | 2.1875 | 2 |
revisum/snippet.py | medariox/revisum | 0 | 17913 | import pickle
from collections import OrderedDict
from datetime import datetime
from .chunk import Chunk
from .review import Review
from .tokenizer import LineTokenizer
from .utils import norm_path
from .database.snippet import maybe_init, Snippet as DataSnippet
class Snippet(object):
def __init__(self, snippet... | 2.4375 | 2 |
ainnovation_dcim/workflow/__init__.py | ltxwanzl/ainnovation_dcim | 0 | 17914 | <reponame>ltxwanzl/ainnovation_dcim
# default_app_config = '.apps.WorkflowConfig'
| 1.046875 | 1 |
examples/api-samples/inc_samples/sample33.py | groupdocs-legacy-sdk/python | 0 | 17915 | <reponame>groupdocs-legacy-sdk/python
####<i>This sample will show how to convert several HTML documents to PDF and merge them to one document</i>
#Import of classes from libraries
import base64
import os
import shutil
import random
import time
from pyramid.renderers import render_to_response
from groupdocs.StorageAp... | 2.59375 | 3 |
silver/api/pagination.py | DocTocToc/silver | 222 | 17916 | # Copyright (c) 2015 Presslabs SRL
#
# 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 writ... | 2.03125 | 2 |
process_filing_headers.py | jsfenfen/fec2file | 1 | 17917 | import os
import fecfile
import json
import csv
import sys
from settings import RAW_ELECTRONIC_DIR, MASTER_HEADER_ROW, HEADER_DUMP_FILE
START_YEAR = 2019
ERROR_HEADERS = ['path', 'error', ]
def readfile(filepath, writer):
filename = os.path.basename(filepath)
filename = filename.replace(".fec", "")
f... | 2.859375 | 3 |
src/python/collector/urls.py | swqqn/django-collector | 3 | 17918 | # -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('collector.views',
url(r'^blob404/$', 'blob404'),
url(r'^deleted/$', 'deleted'),
url(r'^$', 'create'),
url(r'^(?P<uid>\w+)/$', 'delete'),
)
# Local Variables:
# indent-tabs-mode: nil
# End:
# vim: ai et... | 1.5 | 2 |
cdisp/core.py | felippebarbosa/cdisp | 0 | 17919 | #-*- coding: utf-8 -*-
"""
Dispersion calculation functions
"""
import numpy # module for array manipulation
import pandas # module for general data analysis
import os # module for general OS manipulation
import scipy # module for scientific manipulation and analysis
##
def set_transverse_mo... | 3 | 3 |
appname/predict.py | Lambda-ds-31/build_week_spotify | 0 | 17920 | <gh_stars>0
import numpy as np
from data_prep import data
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
from os import getenv
client_id = getenv('CLIENT_ID')
client_id_secret = getenv('CLIENT_ID_SECRET')
manager = SpotifyClientCredentials(
client_id = client_id,
client_secret= client_id_s... | 3.140625 | 3 |
tests/cpydiff/modules_array_deletion.py | learnforpractice/micropython-cpp | 692 | 17921 | """
categories: Modules,array
description: Array deletion not implemented
cause: Unknown
workaround: Unknown
"""
import array
a = array.array('b', (1, 2, 3))
del a[1]
print(a)
| 2.546875 | 3 |
jaysblog/models.py | cRiii/jaysblog | 5 | 17922 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Time : 2019/9/17 15:07
@Author : <NAME>
@FileName: models.py
@GitHub : https://github.com/cRiii
"""
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from jaysblog.extensions import db
from flask_login i... | 2.171875 | 2 |
112_Path Sum.py | Alvin1994/leetcode-python3- | 0 | 17923 | <filename>112_Path Sum.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def hasPathSum(self, root: 'TreeNode', sum: 'int') -> 'bool':
if not root:
return False
... | 3.703125 | 4 |
telemanom/_globals.py | tonyzeng2019/telemanom | 0 | 17924 | #!/usr/bin/env python
# coding: utf-8
import yaml
import json
import sys
import os
sys.path.append('../venv/lib/python3.5/site-packages')
from elasticsearch import Elasticsearch
sys.path.append('../telemanom')
class Config:
'''Loads parameters from config.yaml into global object'''
def __init__(self, path... | 2.3125 | 2 |
nanome/_internal/_network/_commands/_serialization/_open_url.py | rramji/nanome-lib | 0 | 17925 | <gh_stars>0
from nanome._internal._util._serializers import _StringSerializer
from nanome._internal._util._serializers import _TypeSerializer
class _OpenURL(_TypeSerializer):
def __init__(self):
self.string = _StringSerializer()
def version(self):
return 0
def name(self):
return ... | 1.929688 | 2 |
questoes/questao1.py | raulbarcelos/Lista-de-Exercicios-PO | 0 | 17926 | <reponame>raulbarcelos/Lista-de-Exercicios-PO
print("********************************")
print("********** QUESTÃO 01 **********")
print("********************************")
print("******** <NAME> *********")
print()
print("Ol<NAME>")
| 1.960938 | 2 |
homeassistant/components/hue/v2/helpers.py | MrDelik/core | 30,023 | 17927 | """Helper functions for Philips Hue v2."""
from __future__ import annotations
def normalize_hue_brightness(brightness: float | None) -> float | None:
"""Return calculated brightness values."""
if brightness is not None:
# Hue uses a range of [0, 100] to control brightness.
brightness = float((... | 3.03125 | 3 |
incapsula/__init__.py | zanachka/incapsula-cracker-py3 | 0 | 17928 | from .errors import IncapBlocked, MaxRetriesExceeded, RecaptchaBlocked
from .parsers import ResourceParser, WebsiteResourceParser, IframeResourceParser
from .session import IncapSession
| 0.878906 | 1 |
sdk/python/pulumi_civo/get_network.py | dirien/pulumi-civo | 3 | 17929 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 1.976563 | 2 |
Hard/longest_valid_parentheses.py | BrynjarGeir/LeetCode | 0 | 17930 | <gh_stars>0
from collections import deque
class Solution:
def longestValidParentheses(self, s: str) -> int:
if len(s) == 1 or s == '': return 0
opened = deque()
for i,p in enumerate(s):
if p == '(': opened.append(i)
else:
if opened:
... | 3.09375 | 3 |
IMFlask/config.py | iml1111/IMFlask | 2 | 17931 | '''
Flask Application Config
'''
import os
from logging.config import dictConfig
BASEDIR = os.path.abspath(os.path.dirname(__file__))
class Config:
'''공통 Config'''
JWT_SECRET_KEY = os.environ.get('FLASK_JWT_SECRET_KEY')
# test only
TEST_ACCESS_TOKEN = os.environ.get('FLASK_TEST_ACCESS_TOKEN')
ADM... | 1.953125 | 2 |
cnn/conv_average_pooling.py | nforesperance/Tensorflow-Keras | 1 | 17932 | <filename>cnn/conv_average_pooling.py
# example of average pooling
from numpy import asarray
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import AveragePooling2D
# define input data
data = [[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0... | 3.59375 | 4 |
acquisitions/models.py | 18F/acqstackdb | 2 | 17933 | from django.db import models
from django.core.validators import RegexValidator, ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from smart_selects.db_fields import ChainedForeignKey, ChainedManyToManyField
from ordered_model.models import OrderedModel
... | 2.125 | 2 |
app/kobo/forms.py | wri/django_kobo | 1 | 17934 | from django import forms
from .models import Connection, KoboUser, KoboData
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db.models import Q
class ConnectionForm(forms.ModelForm):
class Meta:
model = Connection
exclude = []
widgets = {
'auth_pass':... | 2.078125 | 2 |
old/dea/aws/__init__.py | robbibt/odc-tools | 0 | 17935 | <reponame>robbibt/odc-tools<gh_stars>0
from odc.aws import (
ec2_metadata,
ec2_current_region,
botocore_default_region,
auto_find_region,
make_s3_client,
s3_url_parse,
s3_fmt_range,
s3_ls,
s3_ls_dir,
s3_find,
get_boto_session,
get_creds_with_retry,
s3_fetch,
)
from o... | 1.828125 | 2 |
systems/stage.py | will-nickson/starter_system | 0 | 17936 | from log.logger import logger
class SystemStage(object):
"""
Default stage object: creates a SystemStage for doing something
"""
@property
def name(self):
return "Need to replace name when inheriting"
def __repr__(self):
return "SystemStage '%s' Try %s.methods()" % (
... | 2.9375 | 3 |
pybind/slxos/v17r_2_00/mpls_state/rsvp/igp_sync/link/lsp/__init__.py | extremenetworks/pybind | 0 | 17937 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 1.898438 | 2 |
vega/trainer/callbacks/horovod.py | zjzh/vega | 0 | 17938 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | 1.859375 | 2 |
parse_doc.py | nprapps/idp-georgia | 1 | 17939 | # _*_ coding:utf-8 _*_
import logging
import re
import app_config
from bs4 import BeautifulSoup
from shortcode import process_shortcode
logging.basicConfig(format=app_config.LOG_FORMAT)
logger = logging.getLogger(__name__)
logger.setLevel(app_config.LOG_LEVEL)
end_doc_regex = re.compile(ur'^\s*[Ee][Nn][Dd]\s*$',
... | 2.625 | 3 |
01_irc_bot/bot.py | pymug/ARJ_SpoonfeedingSockets_APR2021 | 0 | 17940 | """
<NAME>
Skeleton of https://github.com/pyhoneybot/honeybot/
"""
import time
import os
import socket
directory = "irc"
if not os.path.exists(directory):
os.makedirs(directory)
target = open(os.path.join(directory, "log.txt"), "w")
def message_checker(msgLine):
sendvar = ""
global mute
mute = False... | 2.40625 | 2 |
xenia_python_client_library/models/attachments_list.py | DutchAnalytics/xenia-python-client-library | 0 | 17941 | # coding: utf-8
"""
Xenia Python Client Library
Python Client Library to interact with the Xenia API. # noqa: E501
The version of the OpenAPI document: v2.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from xenia_python_client_library.configur... | 1.867188 | 2 |
src/AuShadha/registry/icd10/aushadha.py | GosthMan/AuShadha | 46 | 17942 | ################################################################################
# Create a Registration with the UI for a Role.
# Each module's aushadha.py is screened for this
#
# Each Class is registered for a Role in UI
# These can be used to generate Role based UI elements later.
#
# As of now string base role... | 2.25 | 2 |
Etap 2/Logia03/Zad1.py | aszokalski/Logia | 0 | 17943 | <filename>Etap 2/Logia03/Zad1.py
from turtle import *
def rysuj(s):
a = 720 / len(s)
up = "bdfhklt"
down = "gjpqy"
numb = "0123456789"
samogloski = "aeiouy"
pu(); bk(360); pd()
for elem in s:
if elem in numb:
prost(a, "green")
elif elem in up:
prost(a... | 2.953125 | 3 |
server/src/models/movie.py | Rubilmax/netflux | 2 | 17944 | """
Define the Movie model
"""
from . import db
from .abc import BaseModel, MetaBaseModel
class Movie(db.Model, BaseModel, metaclass=MetaBaseModel):
""" The Movie model """
__tablename__ = "movies"
movie_id = db.Column(db.String(300), primary_key=True)
title = db.Column(db.String(300))
author = ... | 3.640625 | 4 |
wmt-shared-task/segment-level/segment_level_prism.py | chryssa-zrv/UA_COMET | 0 | 17945 | <filename>wmt-shared-task/segment-level/segment_level_prism.py
f"""
Shell script tho reproduce results for BERTScores in data from WMT18/19 Metrics Shared task.
"""
import argparse
import hashlib
import logging
import os
import sys
from typing import Any, Dict, Iterator, List
import numpy as np
import pandas as pd
imp... | 1.796875 | 2 |
source_code/3-2-download.py | VickyMin1994/easy-scraping-tutorial | 708 | 17946 | <gh_stars>100-1000
import os
os.makedirs('./img/', exist_ok=True)
IMAGE_URL = "https://mofanpy.com/static/img/description/learning_step_flowchart.png"
def urllib_download():
from urllib.request import urlretrieve
urlretrieve(IMAGE_URL, './img/image1.png') # whole document
def request_download():
i... | 3.21875 | 3 |
flare_classifier/cnn.py | Wingham1/hessidf | 0 | 17947 | from tensorflow.keras import Sequential
from tensorflow.keras.layers import Conv2D, Flatten, Dense, Dropout
import tensorflow.keras as keras
import os
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
def data_prep(path, img_rows, img_cols, color):
"""
A function to preprocess ... | 3.546875 | 4 |
survol/sources_types/oracle/library/__init__.py | AugustinMascarelli/survol | 0 | 17948 | """
Oracle library
"""
import lib_common
from lib_properties import pc
def Graphic_colorbg():
return "#CC99FF"
def EntityOntology():
return ( ["Db", "Schema", "Library"], )
# Ambiguity with tables, oracle or normal users.
def MakeUri(dbName,schemaName,libraryName):
return lib_common.gUriGen.UriMakeFromDict("ora... | 2.296875 | 2 |
src/train.py | rnagumo/dgm_vae | 5 | 17949 | <gh_stars>1-10
"""Training method"""
import argparse
import json
import os
import pathlib
from typing import Union
import numpy as np
import torch
from torch.backends import cudnn
import pytorch_lightning as pl
import dgmvae.models as dvm
from experiment import VAEUpdater
def main():
# ---------------------... | 2.171875 | 2 |
kea/axi_lite_registers/_registers.py | SmartAcoustics/Kea | 3 | 17950 | from myhdl import Signal, intbv, block, always_comb, ConcatSignal
import myhdl
from collections import OrderedDict
import keyword
def _is_valid_name(ident: str) -> bool:
'''Determine if ident is a valid register or bitfield name.
'''
if not isinstance(ident, str):
raise TypeError("expected str, b... | 2.671875 | 3 |
tools/clear_from_n.py | ubercomrade/MultiDeNA | 0 | 17951 | <filename>tools/clear_from_n.py
import random
def read_fasta(path_in, path_out):
fasta = list()
append = fasta.append
fasta_in = open(path_in, 'r')
fasta_out = open(path_out, 'w')
for index, line in enumerate(fasta_in):
if not line.startswith('>'):
line = line.strip().upper()
... | 3.296875 | 3 |
tensorbank/tf/slices.py | pshved/tensorbank | 1 | 17952 | <filename>tensorbank/tf/slices.py
"""Advanced Tensor slicing
==========================
Utilities for advanced tensor slicing and batching operations.
Reference
---------
"""
import tensorflow as tf
def slice_within_stride(x, stride, si=0, ei=None, keepdims=True):
"""Select ``x[..., (i * stride + si):(i * strid... | 3.21875 | 3 |
testfixtures/tests/test_roundcomparison.py | Alexhuszagh/XLDiscoverer | 0 | 17953 | # Copyright (c) 2014 Simplistix Ltd
# See license.txt for license details.
from decimal import Decimal
from testfixtures import RoundComparison as R, compare, ShouldRaise
from unittest import TestCase
from ..compat import PY2, PY3
class Tests(TestCase):
def test_equal_yes_rhs(self):
self.assertTrue(0.1... | 3 | 3 |
config/usb_device_cdc.py | newbs/usb | 0 | 17954 | """*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... | 0.960938 | 1 |
quant_test/__init__.py | rgkimball/quant_test | 0 | 17955 | """
quant_test
~~~~~~
The quant_test package - a Python package template project that is intended
to be used as a cookie-cutter for developing new Python packages.
"""
| 0.902344 | 1 |
django_sql_dashboard/extensions/ExtendedParameter.py | ipamo/django-sql-dashboard | 0 | 17956 | <filename>django_sql_dashboard/extensions/ExtendedParameter.py
import re
from django.utils.html import escape
from django.utils.safestring import mark_safe
from ..utils import Parameter
class ExtendedParameter(Parameter):
extract_re = re.compile(r"\%\(([\w\-]+)(?:\:([\w\-]+))?\)(s|(?:0?\.(\d+))?d|b)")
extract... | 2.34375 | 2 |
jiotc/models/bilstm_model.py | JHP4911/JioTC | 4 | 17957 | # -*- coding=utf-8 -*-
# author: dongrixinyu
# contact: <EMAIL>
# blog: https://github.com/dongrixinyu/
# file: bare_embedding.py
# time: 2020-06-12 11:27
import os
import pdb
import logging
from typing import Union, Optional, Dict, Any, Tuple
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_... | 2.28125 | 2 |
tests/learning/test_prediction_error_delta_function.py | mihaic/psyneulink | 0 | 17958 | <filename>tests/learning/test_prediction_error_delta_function.py
import numpy as np
from psyneulink import PredictionErrorDeltaFunction
np.set_printoptions(suppress=True)
def test_prediction_error_delta_first_run():
learning_rate = 0.3
stimulus_onset = 41
sample = np.zeros(60)
sample[stimulus_onset... | 2.96875 | 3 |
jts/backend/jobapps/views.py | goupaz/babylon | 1 | 17959 | <gh_stars>1-10
from datetime import datetime as dt
from django.utils import timezone
import uuid
from django.contrib.auth import get_user_model
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
from company.utils import get_or_creat... | 2.09375 | 2 |
reassign.py | Ca2Patton/PythonStuff | 0 | 17960 | <gh_stars>0
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
x=5
print x
def reassign(b):
x=6
print x
reassign(x)
print x
| 2.0625 | 2 |
python_modules/dagster/dagster/core/meta/config_types.py | Ramshackle-Jamathon/dagster | 0 | 17961 | from collections import namedtuple
from dagster import check
from dagster.config.config_type import ConfigType, ConfigTypeKind
from dagster.config.field import Field
from dagster.core.serdes import whitelist_for_serdes
@whitelist_for_serdes
class NonGenericTypeRefMeta(namedtuple('_NonGenericTypeRefMeta', 'key')):
... | 2.1875 | 2 |
database/migrations/2017_06_14_205530_create_users_table.py | emirbek/cope | 2 | 17962 | from orator.migrations import Migration
class CreateUsersTable(Migration):
def up(self):
"""
Run the migrations.
"""
with self.schema.create('users') as table:
table.integer('id')
table.string('name')
table.string('gender', 1)
table.... | 2.671875 | 3 |
make_json.py | jfalcou/infra | 135 | 17963 | <reponame>jfalcou/infra<gh_stars>100-1000
from configparser import ConfigParser
import os
import json
obj = {}
config = ConfigParser()
config.read(os.path.join(os.getenv("HOME"), ".aws", "credentials"))
obj["MY_ACCESS_KEY"] = config.get("default", "aws_access_key_id", fallback="")
obj["MY_SECRET_KEY"] = config.get("de... | 2.15625 | 2 |
ztest-type1.py | tochiji/ztest-type1 | 0 | 17964 | #########################################################
# 母比率の差の検定/タイプ1
#########################################################
import sys
import math
def error_usage():
sys.stderr.write("usage: " + sys.argv[0] + "\n")
sys.stderr.write("\tこのプログラムは、4つの引数が必要です。\n\n")
sys.stderr.write(
"\t1.属性1のn... | 2.9375 | 3 |
flask_demo/main.py | yzj2019/database_learning | 0 | 17965 | # coding=utf-8
import functools
from flask import Flask, session
from flask import redirect
from flask import request, make_response
from flask import render_template
from flask import url_for
from flask_bootstrap import Bootstrap
# 数据库处理
from db import *
# json
import json
# 生成一个app
app = Flask(__name... | 3.1875 | 3 |
tests/test_env.py | dmitrvk/mymusichere-app | 0 | 17966 | <gh_stars>0
# Licensed under the MIT License
from mymusichere import env
class TestEnv:
def test_get_config_from_env(self, monkeypatch):
monkeypatch.setenv('CONFIG', 'value')
assert env.get_str_config('config') == 'value'
def test_get_secret_from_env(self, monkeypatch):
monkeypatch.... | 2.28125 | 2 |
tests/factorys.py | 2h4dl/pymilvus | 0 | 17967 | # STL imports
import random
import logging
import string
import time
import datetime
import random
import struct
import sys
from functools import wraps
# Third party imports
import numpy as np
import faker
from faker.providers import BaseProvider
logging.getLogger('faker').setLevel(logging.ERROR)
sys.path.append('.'... | 2.15625 | 2 |
HACKERRANK_Regrex&Parsing/Matrix_Script.py | StefaniaSferragatta/ADM2020-HW1 | 0 | 17968 | import math
import os
import random
import re
import sys
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
if (n>0 and m>0 and n<100 and m< 100):
for _ in range(n):
matrix_item = input()
matrix.append(matrix_item)
for... | 3.0625 | 3 |
smartsheet/models/filter.py | Funtimes-Smarts/Python-import-Smart | 0 | 17969 | # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2016 Smartsheet.com, 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.... | 1.960938 | 2 |
utils/train.py | danilonumeroso/MEG | 6 | 17970 | import torch
import torch.nn.functional as F
import os.path as osp
import json
from torch_geometric.utils import precision, recall
from torch_geometric.utils import f1_score, accuracy
from torch.utils.tensorboard import SummaryWriter
def train_epoch_classifier(model, train_loader, len_train, optimizer, device):
m... | 2.359375 | 2 |
Algorithms/LCP/29/math1.py | M-Quadra/LeetCode-problems | 0 | 17971 | <reponame>M-Quadra/LeetCode-problems
class Solution:
def orchestraLayout(self, num: int, xPos: int, yPos: int) -> int:
a, b = (min(xPos, num-1-yPos), 1) if yPos >= xPos else (min(yPos, num-1-xPos), -1)
return (4*num*a - 4*a*a - 2*a + b*(xPos+yPos) + (b>>1&1)*4*(num-a-1))%9 + 1 | 2.78125 | 3 |
python-sdk/nuimages/scripts/render_images.py | bjajoh/nuscenes-devkit | 1,284 | 17972 | # nuScenes dev-kit.
# Code written by <NAME>, 2020.
import argparse
import gc
import os
import random
from typing import List
from collections import defaultdict
import cv2
import tqdm
from nuimages.nuimages import NuImages
def render_images(nuim: NuImages,
mode: str = 'all',
ca... | 2.46875 | 2 |
version_info.py | sairam4123/GodotReleaseScriptPython | 0 | 17973 | <filename>version_info.py
import re
from configparser import ConfigParser
from constants import PROJECT_FOLDER, RELEASE_LEVEL_DICT
from release_type import ReleaseLevel, ReleaseType, value_from_key
class VersionInfo:
def __init__(
self,
major: int = 0,
minor: int = 0,
... | 2.65625 | 3 |
test/test_create_json_items_from_embark_xml.py | ndlib/mellon-search | 0 | 17974 | <reponame>ndlib/mellon-search
# test_create_json_items_from_embark_xml.py 2/18/19 sm
""" test create_json_items_from_embark_xml.py """
import sys
import json
import unittest
import csv
from xml.etree.ElementTree import ElementTree, tostring
# add parent directory to path
import os
import inspect
CURRENTDIR = os.path.... | 2.578125 | 3 |
plot/laikago/plot_task.py | MaxxWilson/ASE389Project | 17 | 17975 | import os
import sys
cwd = os.getcwd()
sys.path.append(cwd)
import pickle
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from plot.helper import plot_task, plot_weights, plot_rf_z_max, plot_rf_quad, plot_vector_traj
tasks = [
'com_pos', 'com_vel', 'chassis_quat', 'ch... | 2.046875 | 2 |
h/views/api/users.py | bibliotechie/h | 0 | 17976 | from pyramid.httpexceptions import HTTPConflict
from h.auth.util import client_authority
from h.presenters import TrustedUserJSONPresenter
from h.schemas import ValidationError
from h.schemas.api.user import CreateUserAPISchema, UpdateUserAPISchema
from h.services.user_unique import DuplicateUserError
from h.views.api... | 2.421875 | 2 |
controllers/social_auth/kivyauth/__init__.py | richierh/SalesKivyMD | 126 | 17977 | <filename>controllers/social_auth/kivyauth/__init__.py
from kivy.logger import Logger
from kivy.utils import platform
__version__ = "2.3.2"
_log_message = "KivyAuth:" + f" {__version__}" + f' (installed at "{__file__}")'
__all__ = ("login_providers", "auto_login")
Logger.info(_log_message)
| 1.929688 | 2 |
RDS/circle3_central_services/research_manager/src/api/User/__init__.py | Sciebo-RDS/Sciebo-RDS | 10 | 17978 | from .user import * | 1.171875 | 1 |
cesium_app/app_server.py | yaowenxi/cesium | 41 | 17979 | <filename>cesium_app/app_server.py
import tornado.web
import os
import sys
import pathlib
from baselayer.app.config import Config
from . import models
from baselayer.app import model_util
# This provides `login`, `complete`, and `disconnect` endpoints
from social_tornado.routes import SOCIAL_AUTH_ROUTES
from .handl... | 2.25 | 2 |
tests/test_building.py | sietekk/elevator | 0 | 17980 | <reponame>sietekk/elevator
#
# Copyright (c) 2016 <NAME>
#
from elevator.building import (
Building,
Floor,
DEFAULT_FLOOR_QTY,
DEFAULT_ELEVATOR_QTY,
)
from elevator.elevator import Elevator
def test_building():
b1 = Building()
assert len(b1.floors) == DEFAULT_FLOOR_QTY, \
"Incorrect ... | 3.421875 | 3 |
Modulo_3/semana 2/miercoles/main.py | AutodidactaMx/cocid_python | 0 | 17981 | import tkinter as tk
from presentacion.formulario import FormularioPersona
def centrar_ventana(ventana):
aplicacion_ancho = 550
aplicacion_largo = 650
pantall_ancho = ventana.winfo_screenwidth()
pantall_largo = ventana.winfo_screenheight()
x = int((pantall_ancho/2) - (aplicacion_ancho/2))
y = ... | 3.15625 | 3 |
Voting/urls.py | Poornartha/Odonata | 0 | 17982 | from django.urls import path
from .views import teams_all, team_vote
urlpatterns = [
path('teams/all', teams_all, name="teams_all"),
path('teams/<int:pk>', team_vote, name="team_vote"),
] | 1.617188 | 2 |
models/3-Whats goin on/train_code/resnext50/train.py | cns-iu/HuBMAP---Hacking-the-Kidney | 0 | 17983 | from Dataset import *
from Network import *
from Functions import *
import os
from fastai.distributed import *
import argparse
import torch
try:
#from apex.parallel import DistributedDataParallel as DDP
from apex.fp16_utils import *
from apex import amp, optimizers
from apex.multi_tensor_apply import mu... | 2.140625 | 2 |
models/node/node.py | InfoCoV/Multi-Cro-CoV-cseBERT | 0 | 17984 | """
NODE model definition and experiment setup.
Neural Oblivious Decision Ensembles for Deep Learning on Tabular Data
https://arxiv.org/abs/1909.06312
Model details:
https://pytorch-tabular.readthedocs.io/en/latest/models/#nodemodel
"""
import logging
import os.path
import shutil
from sklearn.metrics import classif... | 2.640625 | 3 |
dtf/packages/models.py | WebPowerLabs/django-trainings | 0 | 17985 | from django.db import models
from django.core.urlresolvers import reverse
from djnfusion import server, key
from django.conf import settings
from jsonfield import JSONField
# TODO: change to this. Currently doesnt work. may have something to do with
# the server not in __init__
# from packages.providers.infusionsoft ... | 1.921875 | 2 |
chap 2/2_1.py | hmhuy2000/Reinforcement-Learning-SuttonBartoI | 0 | 17986 | import numpy as np
import matplotlib.pyplot as plt
from tqdm import trange
class CFG:
n = 10
mean = 0.0
variance = 1.0
t = 1000
esp = [0, 0.01, 0.05, 0.1, 0.15, 0.2]
n_try = 2000
class bandit():
def __init__(self, m, v):
self.m = m
self.v = v
self.mean = 0.0
... | 2.9375 | 3 |
jetavator_databricks_client/setup.py | jetavator/jetavator_databricks | 0 | 17987 | <filename>jetavator_databricks_client/setup.py
# -*- coding: utf-8 -*-
import io
import os
from setuptools import setup, find_packages
# Package metadata
# ----------------
SHORT_NAME = 'databricks_client'
NAME = 'jetavator_databricks_client'
DESCRIPTION = (
'Databricks support for the Jetavator engine '
't... | 2.140625 | 2 |
web-interface/app/application/misc/pages/misc_options/purposes_sampling.py | horvathi94/seqmeta | 0 | 17988 | from dataclasses import dataclass
from .base import _MiscOptionBase
from application.src.misc.sampling import PurposesOfSampling
@dataclass
class Editor(_MiscOptionBase):
name = "Purpose of sampling"
id = "purpose_of_sampling"
link = "misc_bp.submit_purpose_of_sampling"
description = "The reason the ... | 2.546875 | 3 |
src/python3/sdp/scripts/FWR_Postprocess/nstx_singlechannel_analysis.py | LeiShi/Synthetic-Diagnostics-Platform | 5 | 17989 | <gh_stars>1-10
import sdp.scripts.load_nstx_exp_ref as nstx_exp
#import sdp.scripts.FWR2D_NSTX_139047_Postprocess as fwrpp
import pickle
import numpy as np
with open('/p/gkp/lshi/XGC1_NSTX_Case/FullF_XGC_ti191_output/ref_pos.pck','r') as f:
ref_pos = pickle.load(f)
channel = 9
nt = 50
llim = 1e-7
ulim = 1e-4
time... | 1.773438 | 2 |
tests/integration/suites/default/reboot.py | bularcasergiu/Anjay | 0 | 17990 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2020 AVSystem <<EMAIL>>
#
# 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 ap... | 2.09375 | 2 |
astrodet/scarlet.py | lyf1436/astrodet | 0 | 17991 | <reponame>lyf1436/astrodet
import sys, os
import numpy as np
import scarlet
import sep
from astropy.io import ascii
import astropy.io.fits as fits
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from astropy.wcs import WCS
def write_scarlet_results(datas, observation, starl... | 2.53125 | 3 |
serve.py | haiyoumeiyou/cherrybrigde | 0 | 17992 | <reponame>haiyoumeiyou/cherrybrigde<gh_stars>0
from application import bootstrap
bootstrap()
if __name__=='__main__':
import cherrypy
cherrypy.engine.signals.subscribe()
cherrypy.engine.start()
cherrypy.engine.block()
| 1.28125 | 1 |
ooobuild/lo/smarttags/x_range_based_smart_tag_recognizer.py | Amourspirit/ooo_uno_tmpl | 0 | 17993 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 1.835938 | 2 |
apprest/plugins/icat/views/ICAT.py | acampsm/calipsoplus-backend | 4 | 17994 | from rest_framework import status
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from apprest.plugins.icat.helpers.complex_encoder import JsonResponse
from apprest.plugins.icat.services... | 2.171875 | 2 |
python/phevaluator/table_tests/test_hashtable8.py | StTronn/PokerHandEvaluator | 1 | 17995 | import unittest
from table_tests.utils import BaseTestNoFlushTable
from evaluator.hashtable8 import NO_FLUSH_8
class TestNoFlush8Table(BaseTestNoFlushTable):
TOCOMPARE = NO_FLUSH_8
TABLE = [0] * len(TOCOMPARE)
VISIT = [0] * len(TOCOMPARE)
NUM_CARDS = 8
def test_noflush8_table(self):
self.assertListEqua... | 3.09375 | 3 |
Marcelina_Skoczylas_praca_domowa_3.py | marcelinaskoczylas/python_wprowadzenie_warsztaty_2021 | 1 | 17996 | <gh_stars>1-10
#zadanie 1
i=1
j=1
k=1
ciag=[1,1]
while len(ciag)<50:
k=i+j
j=i
i=k
ciag.append(k)
print(ciag)
#zadanie 2
wpisane=str(input("Proszę wpisać dowolne słowa po przecinku "))
zmienne=wpisane.split(",")
def funkcja(*args):
'''Funkcja sprawdza długość słów i usuw... | 3.171875 | 3 |
rh_pathfinding/src/rh_pathfinding/engine/geometry/obstacle/lineFinder/__init__.py | RhinohawkUAV/rh_ros | 4 | 17997 | <reponame>RhinohawkUAV/rh_ros
from linePathSegment import LinePathSegment
from lineSegmentFinder import LineSegmentFinder | 1.085938 | 1 |
days/day01/part2.py | jaredbancroft/aoc2021 | 0 | 17998 | <filename>days/day01/part2.py<gh_stars>0
from helpers import inputs
def solution(day):
depths = inputs.read_to_list(f"inputs/{day}.txt")
part2_total = 0
for index, depth in enumerate(depths):
if index - 3 >= 0:
current_window = (
int(depth) + int(depths[index - 1]) + in... | 3.015625 | 3 |
src/unicon/plugins/nxos/n5k/service_statements.py | TestingBytes/unicon.plugins | 18 | 17999 | <gh_stars>10-100
from unicon.eal.dialogs import Statement
from .service_patterns import NxosN5kReloadPatterns
from unicon.plugins.nxos.service_statements import (login_stmt, password_stmt,
enable_vdc, admin_password)
from unicon.plugins.generic.service_statements import (save_env,
auto_provision, auto_install... | 1.765625 | 2 |