max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
src/demo.py | JKtubage/Neural-Network-deep-learning | 1 | 12767151 | import mnist_loader
import network
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
# print("training data")
# print(type(training_data))
# print(len(training_data))
# print(training_data[0][0].shape)
# print(training_data[0][1].shape)
net = network.Network([784, 30, 10])
net.SGD(training_... | 2.703125 | 3 |
sdk/python/pulumi_nomad/acl_token.py | pulumi/pulumi-nomad | 3 | 12767152 | <reponame>pulumi/pulumi-nomad
# 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, ... | 1.601563 | 2 |
cgcs-patch/cgcs-patch/cgcs_patch_id/patch_id_allocator_server.py | MarioCarrilloA/x.stx-update | 0 | 12767153 | <gh_stars>0
#!/usr/bin/env python
#
# Copyright (c) 2013-2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import os
import sys
import web
import patch_id_allocator as pida
port = 8888
urls = (
'/get_patch_id', 'get_patch_id',
)
class get_patch_id:
def GET(self):
data = web.i... | 2.296875 | 2 |
metagraph-plugin/metagraph_katana/plugins/__init__.py | chakpongchung/katana | 64 | 12767154 | ############################
# Libraries used as plugins
############################
# try:
# import katana as _
# has_katana = True
# except ImportError:
# has_katana = False
import metagraph
# Use this as the entry_point object
registry = metagraph.PluginRegistry("metagraph_katana")
def find_plugi... | 1.71875 | 2 |
src/06_test/test_06.py | Erfun76/Erfun76 | 0 | 12767155 | import sys
sys.path.insert(0, '../')
import warnings
warnings.simplefilter('ignore')
from get_config import get_config
from utils import fix_seed, rle2mask, mask2rle
from models import build_model
from utils_inference import get_pred_mask, get_rle
from get_fold_idxs_list import get_fold_idxs_list
import numpy as np
... | 1.867188 | 2 |
tests/settings.py | movermeyer/django-umanage | 4 | 12767156 | <filename>tests/settings.py
import os
DEBUG = False
ALLOWED_HOSTS = ['*']
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'urls'
SECRET_KEY = '<KEY>'
SITE_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../')
SITE_ID = 1
TIME_ZONE = 'UTC'
USE_I18N = True
UMANAGE_BASE_TEMPLATE = 'base_umanage.html'
UMANAGE_B... | 1.851563 | 2 |
src/transformers/models/bartpho/tokenization_bartpho_fast.py | datquocnguyen/transformers | 5 | 12767157 | # coding=utf-8
# Copyright 2021 <NAME> and the HuggingFace Inc. team.
#
# 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... | 1.773438 | 2 |
site/flask/lib/python2.7/site-packages/openid/consumer/__init__.py | theholyhades1/tartanHacks2015 | 5,079 | 12767158 | <reponame>theholyhades1/tartanHacks2015<filename>site/flask/lib/python2.7/site-packages/openid/consumer/__init__.py<gh_stars>1000+
"""
This package contains the portions of the library used only when
implementing an OpenID consumer.
"""
__all__ = ['consumer', 'discover']
| 1.421875 | 1 |
library/dnsimple.py | kumulustech/kolla-packet | 4 | 12767159 | #!/usr/bin/env python
from ansible.module_utils.basic import *
import requests
import os
from dnsimple import DNSimple
'''
parameters:
api_token DNSimple token for account
account_id DNSimple account id
domain Zone from DNSimple
record JSON object, includes type, name, content, ttl
exampl... | 2.546875 | 3 |
answer_type/model_utils.py | Supermaxman/epic_qa | 0 | 12767160 | <reponame>Supermaxman/epic_qa<filename>answer_type/model_utils.py<gh_stars>0
from transformers import AutoModelForSequenceClassification, BertModel
from transformers import AdamW, get_linear_schedule_with_warmup
from torch import nn
import torch
import pytorch_lightning as pl
from abc import ABC, abstractmethod
clas... | 2.3125 | 2 |
chromeos-config/cros_config_host/cros_config_test_schema_unittest.py | strassek/chromiumos-platform2 | 4 | 12767161 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=module-missing-docstring,class-missing-docstring
from __future__ import print_function
... | 1.96875 | 2 |
caoxu/20180326/h3.py | python20180319howmework/homework | 0 | 12767162 | '''输入一个三位整型数,判断它是否是一个水仙花数(比如153 = 1*1*1 + 5*5*5 + 3*3*'''
from math import *
num1=input("输入一个三位整型数:")
l=len(num1)
num2=int(num1)
num3=num2
res=0
while num2>0:
m=num2%10
num2//=10
res+=pow(m,l)
if res==num3:
print("是水仙花数")
else:
print("不是水仙花数")
| 3.828125 | 4 |
EPro-PnP-Det/epropnp_det/ops/pnp/builder.py | Lakonik/EPro-PnP | 19 | 12767163 | <filename>EPro-PnP-Det/epropnp_det/ops/pnp/builder.py
"""
Copyright (C) 2010-2022 Alibaba Group Holding Limited.
"""
from mmcv.utils import Registry, build_from_cfg
PNP = Registry('pnp')
CAMERA = Registry('camera')
COSTFUN = Registry('cost_fun')
def build_pnp(cfg, **default_args):
return build_from_cfg(cfg, PNP... | 1.648438 | 2 |
ABC_A/ABC064_A.py | ryosuke0825/atcoder_python | 0 | 12767164 | rgb = input()
rgb = rgb.replace(" ", "")
if int(rgb) % 4 == 0:
print("YES")
else:
print("NO")
| 3.484375 | 3 |
tests/plugins/test_docker_api.py | rcerven/atomic-reactor | 0 | 12767165 | """
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from dockerfile_parse import DockerfileParser
from atomic_reactor.plugin import PluginFailedExcepti... | 1.992188 | 2 |
numpy/testing/tests/test_utils.py | qpython-android/QPypi-numpy | 7 | 12767166 | <filename>numpy/testing/tests/test_utils.py
import numpy as np
from numpy.testing import *
import unittest
class _GenericTest(object):
def _test_equal(self, a, b):
self._assert_func(a, b)
def _test_not_equal(self, a, b):
try:
self._assert_func(a, b)
passed = True
... | 3.34375 | 3 |
data/strategies/publishers/sciencedirect.py | jamesrharwood/journal-guidelines | 0 | 12767167 | <gh_stars>0
url = "www.sciencedirect.com/(science/)?journal/(aip/)?{ID}"
extractor_args = dict(restrict_text=[r"guide\s*for\s*authors"])
template = "https://www.elsevier.com/journals/{ID}/{issn_print}/guide-for-authors"
| 1.546875 | 2 |
task_1/preprocess_data.py | icobx/claim_detection | 0 | 12767168 | <reponame>icobx/claim_detection
import os
import re
import sys
import json
import spacy
import pickle
# from urlextract import URLExtract
from tqdm import tqdm
from nltk.corpus import stopwords
from spacy.language import Language
from helper_funcs import *
from sklearn.model_selection import train_test_split
from def... | 2.546875 | 3 |
social_media_operations.py | canberkeh/SeleniumTests | 2 | 12767169 | '''
Welcome! You can perform some operations with social medias made below.
'''
import time
from getpass import getpass
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import xlsxwriter
class SocialMediaBot():
'''
1- Choose browser.2- Choose social media.3- Choose operation. Save... | 3.65625 | 4 |
src/imitation/envs/examples/airl_envs/point_maze_env.py | Cladett/imitation | 1 | 12767170 | <reponame>Cladett/imitation
import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
from imitation.envs.examples.airl_envs.dynamic_mjc.mjc_models import point_mass_maze
class PointMazeEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(
self,
direction=1,
maze_... | 2.28125 | 2 |
Dreya/Security/SerialReader.py | esemve/Dreya | 1 | 12767171 | <gh_stars>1-10
import serial
import time
import subprocess
class SerialReader:
key1 = ""
key2 = ""
motion = False
temp = ""
@staticmethod
def read():
while (True):
i = 0
try:
proc = subprocess.Popen(['bash','serialreader.sh'],stdout=subprocess.... | 2.546875 | 3 |
ai_transformersx/examples/tasks/news_segment/news_data_processor.py | aicanhelp/ai-transformers | 1 | 12767172 | <reponame>aicanhelp/ai-transformers
from tqdm.auto import tqdm
import random
from ..task_base import *
@configclass
class NewsDataArguments:
data_dir: str = field('/app/dataset/news', 'input the data dir for processing')
save_mid: bool = field(True, 'whether cache the middle data for check')
context_min_... | 2.703125 | 3 |
research/cv/yolox/src/yolox_dataset.py | mindspore-ai/models | 77 | 12767173 | <filename>research/cv/yolox/src/yolox_dataset.py
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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
#... | 2.390625 | 2 |
official/cv/pwcnet/src/pwc_modules.py | mindspore-ai/models | 77 | 12767174 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | 2.03125 | 2 |
205_Isomorphic Strings/205_Aaron.py | ktapsyman/LeetCodez | 0 | 12767175 | <gh_stars>0
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s) != len(t):
return False
# if it is a large {key: value} in dict, the list way is slower than dict way
# usedList = []
hashTable = {}
valueTable = {}
... | 3.515625 | 4 |
src/garnn/utils.py | LeviBorodenko/garnn | 24 | 12767176 | <reponame>LeviBorodenko/garnn
# needed for RaggedTensorFeeder
import itertools
import random
from collections import namedtuple
import numpy as np
def pow_2_reduce(n: int, batch_size: int):
""" returns the largest integer of the form
2^m that is less than or equal to n.
If this integer is greater than t... | 3.140625 | 3 |
scripts/scrape_lections.py | sevazhidkov/ted-analysis | 1 | 12767177 | import time
import random
import json
import re
import requests
import lxml.html
RATINGS = ['Funny', 'Confusing', 'Unconvincing', 'Informative', 'Fascinating',
'Persuasive', 'Obnoxious', 'Courageous', 'Beautiful', 'Longwinded',
'Inspiring', 'Ingenious', 'Jaw-dropping', 'OK']
LECTION_TOPICS_REGEX ... | 2.9375 | 3 |
angr/angr/procedures/linux_kernel/brk.py | Ruide/angr-dev | 1 | 12767178 | import angr
class brk(angr.SimProcedure):
"""
This implements the brk system call.
"""
IS_SYSCALL = True
#pylint:disable=arguments-differ
def run(self, new_brk):
return self.state.posix.set_brk(new_brk)
| 2.234375 | 2 |
smart_compose/api/models/payload.py | Jwuthri/SmartCompose | 0 | 12767179 | <filename>smart_compose/api/models/payload.py
from typing import List
from pydantic import BaseModel
class SentimentPayload(BaseModel):
text: str
def payload_to_list(payload: SentimentPayload) -> List:
return [payload.text]
| 2.09375 | 2 |
dht/value_stores/memory.py | leonkoens/dht | 1 | 12767180 | <filename>dht/value_stores/memory.py
import logging
class MemoryStore:
def __init__(self):
logging.info("Memory Value Store created")
| 2.15625 | 2 |
o3d/build/file_exists.py | rwatson/chromium-capsicum | 11 | 12767181 | <filename>o3d/build/file_exists.py
#!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os.path
import sys
sys.stdout.write(str(os.path.exists(sys.argv[1])))
sys.exit(0)
| 2.015625 | 2 |
Pygame/JonathanGame/analogclock1.py | youaresherlock/PythonPractice | 0 | 12767182 | import sys, random, math, pygame
from pygame import locals
from datetime import datetime, time, date
# main program begins
pygame.init()
screen = pygame.display.set_mode((600, 500))
pygame.display.set_caption("Analog Clock")
font = pygame.font.Font(None, 36)
orange = 220, 180, 0
white = 255, 255, 255
yellow = 255, 25... | 3.71875 | 4 |
jp.atcoder/abc246/abc246_d/30649952.py | kagemeka/atcoder-submissions | 1 | 12767183 | def main() -> None:
n = int(input())
def f(a: int, b: int) -> int:
return a**3 + (a + b) * a * b + b**3
def binary_search(a: int) -> int:
lo = -1
hi = 1 << 20
while hi - lo > 1:
# print(lo, hi)
b = (lo + hi) // 2
if f(a, b) >=... | 3.828125 | 4 |
_test_projects/unittests/tests/test_index.py | oren0e/cob | 2 | 12767184 | import pytest
from _cob import mymodels
@pytest.fixture
def people():
people = []
for _ in range(10):
person = mymodels.Person(first_name="First", last_name="Last")
people.append(person)
mymodels.db.session.add(person)
mymodels.db.session.commit()
yield people
for person in... | 2.34375 | 2 |
source/python/AxB.py | JoHyukJun/algorithm-analysis | 0 | 12767185 | '''
main.py
Created by <NAME> on 2020
Copyright © 2020 <NAME>. All rights reserved.
'''
import sys
a, b= map(int, sys.stdin.readline().rstrip().split(' '))
print(a * b) | 2.984375 | 3 |
ElderWand/ElderWand/WandTracker/trainingImageRecorder.py | alancheung/IoT-Elder-Wand | 0 | 12767186 | <gh_stars>0
from collections import deque
import numpy as np
import cv2
import imutils
import argparse
kernel = np.ones((5,5),np.uint8)
pts = deque(maxlen=64)
#parser = argparse.ArgumentParser(description = 'Record training images for Pi Wand Tracker')
#parser.add_argument('path', type='string', help='File path to sa... | 2.53125 | 3 |
clean.py | fahbench/boost | 0 | 12767187 | <reponame>fahbench/boost<filename>clean.py
want = [
'filesystem',
'program_options',
'system',
]
import shutil
import os
for d in os.listdir('libs'):
if d in want:
continue
if os.path.isdir('libs/{}'.format(d)):
shutil.rmtree('libs/{}'.format(d))
else:
os.remove('libs/{... | 2.171875 | 2 |
anella/tenor_client/tenor_pop.py | Fundacio-i2CAT/ai4.0-tenor | 0 | 12767188 | <filename>anella/tenor_client/tenor_pop.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""TeNOR PoP Class"""
"""Uses tenor ns-manager/routes/dc.rb """
import requests
import json
import ConfigParser
CONFIG = ConfigParser.RawConfigParser()
CONFIG.read('config.cfg')
DEFAULT_TENOR_URL = format('{0}:{1}'.format(
CONF... | 2.703125 | 3 |
Topology/mars_topology_launcher/src/mars_topology_launcher/TopologyParser.py | ramp-eu/Motion_Task_Planner | 1 | 12767189 | #!/usr/bin/env python
"""
Fraunhofer IML
Department Automation and Embedded Systems
Tabsize : 4
Charset : UTF-8
"""
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
from abc import ABCMeta, abstractmethod
import xml.etree.ElementTree
from MARSVertex import MARSVe... | 2.8125 | 3 |
tests/resources/test_arpc.py | andreshndz/cuenca-python | 6 | 12767190 | <gh_stars>1-10
import pytest
from cuenca.resources import Arpc
@pytest.mark.vcr
def test_arpc():
arpc_req = dict(
number='1234567890123403',
arqc='DB3C77D5469C53C6',
arpc_method='1',
transaction_data='somerandomtransactiondata',
response_code='0010',
pan_sequence='... | 2.28125 | 2 |
jacdac/dot_matrix/client.py | microsoft/jacdac-python | 1 | 12767191 | <reponame>microsoft/jacdac-python
# Autogenerated file. Do not edit.
from jacdac.bus import Bus, Client
from .constants import *
from typing import Optional
class DotMatrixClient(Client):
"""
A rectangular dot matrix display, made of monochrome LEDs or Braille pins.
Implements a client for the `Dot Matrix... | 3.421875 | 3 |
aiohttp_json_rpc/decorators.py | ZhukovGreen/aiohttp-json-rpc | 0 | 12767192 | def raw_response(function=None):
def decorator(function):
function.raw_response = True
return function
if function:
return decorator(function)
return decorator
| 2.59375 | 3 |
pyjamaparty/strutils/string_builder.py | krajasek/pyjama | 0 | 12767193 |
class StringBuilder(object):
def __init__(self, strr=''):
self.str_list = [s for s in strr]
def __getitem__(self, item):
return ''.join(self.str_list[item])
def __setitem__(self, key, value):
self.str_list[key] = value
def __repr__(self):
return ''.join(self.str_lis... | 3.515625 | 4 |
inboxmanager.py | zanedma/haro-listener | 1 | 12767194 | <reponame>zanedma/haro-listener<gh_stars>1-10
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from utils import getTime, exitWithError
import colors
class InboxManager:
"""Handles all direct inbox management such... | 2.265625 | 2 |
testing/collectdtesting/fake_backend.py | signalfx/collectd-common | 0 | 12767195 | <filename>testing/collectdtesting/fake_backend.py
"""
Logic pertaining to faking out the ingest server that collectd sends datapoints
to.
"""
from functools import partial as p
from contextlib import contextmanager
from io import BytesIO
import os
import string
import tempfile
from signalfx.generated_protocol_buffers ... | 2.46875 | 2 |
schema_ephys.py | yueqiw/ephys_analysis | 7 | 12767196 | import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from collections import OrderedDict
import gc
from current_clamp import *
from current_clamp_features import extract_istep_features
from visualization.feature_annotations import feature_name_dict
from read_metadata i... | 2.21875 | 2 |
tests/test__meter.py | alpha-health-ai/pyformance | 4 | 12767197 | from pyformance.meters import Meter
from tests import TimedTestCase
class MeterTestCase(TimedTestCase):
def setUp(self):
super(MeterTestCase, self).setUp()
self.meter = Meter(key="test_meter", clock=TimedTestCase.clock)
def tearDown(self):
super(MeterTestCase, self).tearDown()
de... | 2.6875 | 3 |
pylith/tests/Fault.py | joegeisz/pylith | 1 | 12767198 | <gh_stars>1-10
#!/usr/bin/env python
#
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
#... | 2.28125 | 2 |
Chapter-11/collections/ansible_collections/kubernetes/core/plugins/modules/k8s_taint.py | PacktPublishing/Ansible-for-Real-life-Automation | 7 | 12767199 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> <@alinabuzachis>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r"""
module: k8s_taint
short_de... | 2.109375 | 2 |
exe017.py | evertondutra/Curso_em-_Video_Python | 0 | 12767200 | <reponame>evertondutra/Curso_em-_Video_Python
#from math import hypot
co = float(input('Quanto mede o cateto oposto? '))
ca = float(input('Quanto mede o cateto adjacente? '))
hi = hypot(co, ca)
print(f'A hipotenusa vai medir {hi:.2f}')
'''
import math
co = float(input('Quanto mede o cateto oposto? '))
ca = float(input... | 3.515625 | 4 |
tests/processors/test_metadata.py | ankitshah009/dcase_util | 0 | 12767201 | <reponame>ankitshah009/dcase_util
import nose.tools
import dcase_util
import tempfile
import os
def test_MetadataReadingProcessor():
tmp = tempfile.NamedTemporaryFile('r+', suffix='.txt', dir='/tmp', delete=False)
try:
dcase_util.utils.Example.event_metadata_container().save(tmp.name)
m = dca... | 2.1875 | 2 |
utilities/model_logging.py | salvaRC/Graphino | 16 | 12767202 | <reponame>salvaRC/Graphino<gh_stars>10-100
"""
Author: <NAME>
"""
from datetime import datetime
import torch
def log_epoch_vals(writer, loss, epoch, val_stats=None, test_stats=None):
if writer is None:
return
writer.add_scalar('train/_loss', loss, epoch)
# writer.add_scalar('train/_mae', stats['m... | 2.09375 | 2 |
geo/models/data_paths.py | stefantaubert/life | 2 | 12767203 | import os
from geo.data_dir_config import root
test_submission = root + "submissions/submission_val.csv"
img_list_dir = root + "image_lists/"
train_samples = img_list_dir + "train/samples.npy"
train_samples_species_map = img_list_dir + "train/species_map.py"
test_samples = img_list_dir + "test/samples.npy"
#xgb no... | 2.1875 | 2 |
implementation/server/cms/migrations/0006_homepage_hero_cta_link.py | Aincient/cleo | 0 | 12767204 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-06-19 20:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
('cms', '0... | 1.679688 | 2 |
flask_scaffolding/scaffoldings/basic/gunicorn_conf_docker.py | MaXXXXfeng/flask-scaffolding | 0 | 12767205 | <filename>flask_scaffolding/scaffoldings/basic/gunicorn_conf_docker.py
# -*- coding: utf-8 -*-
import logging
LOG_PATH = '/data/logs/proj'
PID_FILE = 'proj.pid'
bind = '%s:%s' % ('0.0.0.0', 80)
workers = 4
worker_connections = 100
preload_app = True
timeout = 600
deamon = False
debug = False
loglevel = 'info'
pidfile... | 1.640625 | 2 |
ionoscloud/models/user_properties_put.py | ionos-cloud/ionos-cloud-sdk-python | 0 | 12767206 | # coding: utf-8
"""
CLOUD API
IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and ... | 1.585938 | 2 |
Database/publisher_methods.py | RomaOkorosso/fes-test-task | 0 | 12767207 | # created by RomaOkorosso at 21.03.2021
# publisher_methods.py
from datetime import datetime, timedelta, date
from typing import Optional
from Models.models import Publisher
from Models import schemas
from sqlalchemy.orm import Session
from Database.exceptions import *
from pydantic import ValidationError
class Publ... | 2.625 | 3 |
Products/CMFCore/CachingPolicyManager.py | fulv/Products.CMFCore | 0 | 12767208 | ##############################################################################
#
# Copyright (c) 2001 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | 1.484375 | 1 |
utils/test_analysis.py | ShenLeixian/data2vis | 103 | 12767209 | import os
import json
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
# t_stat, p_val = stats.ttest_ind(sample1, sample2, equal_var=False)
test_result_dir = "utils/testresults"
all_results = {}
aggregate_terms = [
"count", "valid", "missing", "distinct", "sum", "mean", "average",
... | 2.3125 | 2 |
cgi-bin/pay_order.py | metallhead01/CREATE_ORDER_HTTP_SERVER | 0 | 12767210 | <filename>cgi-bin/pay_order.py<gh_stars>0
#!C:\Users\Rustam\AppData\Local\Programs\Python\Python36\python.exe
import time
import urllib3
import requests
import xml.etree.ElementTree as ET
print("Content-type: text/html;charset=utf8\r\n\r\n")
print("<html>")
#print("<head>Something</head>")
print("<body>")
def pay_or... | 2.75 | 3 |
xnat_dashboards/app/authentication/controllers.py | XNAT-Dashboards/XNAT-Dashboards | 0 | 12767211 | # Import flask dependencies
from flask import Blueprint, render_template, session, request, redirect,\
url_for
from xnat_dashboards.app.authentication import model
# Define the blueprint: 'auth', set its url prefix: app.url/auth
auth = Blueprint('auth', __name__, url_prefix='/auth')
# Set the route and accepted... | 2.828125 | 3 |
suddendev/game/game.py | SuddenDevs/SuddenDev | 2 | 12767212 | <filename>suddendev/game/game.py
#!/usr/bin/python3.5
from .vector import Vector
from .color import Color3, random_color3, from_hex
from .player import Player
from .enemy import Enemy
from .pickup import Pickup, PickupType
from .enemy_type import EnemyType
from .wall import Wall
from .core import Core
from .event impo... | 2.484375 | 2 |
safekit/models/tiered_lm.py | duebukua/safekit | 117 | 12767213 | <filename>safekit/models/tiered_lm.py<gh_stars>100-1000
#!/usr/bin/env python
"""
This is a two tiered language model for anomaly detection, where the second tier LSTM (log line level)
takes the concatenation of the average sentence vector and final hidden state
from the lower tier (token level) LSTM as input, creatin... | 2.65625 | 3 |
src/nearby/delaunaymain.py | ghjwp7/nearby | 0 | 12767214 | <filename>src/nearby/delaunaymain.py
#!/usr/bin/python3
# -*- mode: python; coding: utf-8 -*-
# <NAME> - November 2020
'''Some tests for circumcircle routines in autoAdder2d.py'''
from pypevue import Point
from nearby.delaunay import CircumCircle2, CircumCircle3, Face
from nearby import delaunayCCvis
from random impo... | 2.546875 | 3 |
init.py | reckonsys/jatayu | 0 | 12767215 | # file: app.py
import asyncio
import asyncpg
from pgorm.postgresql import PostgreSQL
from myapp.tables import User
async def run():
connection = await asyncpg.connect(
user='reckonsys', password='<PASSWORD>',
database='demo', host='db.reckonsys.com')
pg = PostgreSQL(connection)
# Lets cre... | 2.625 | 3 |
adw_test/hyopt_gen.py | clinfo/DeepKF | 5 | 12767216 | <reponame>clinfo/DeepKF<gh_stars>1-10
import hyopt as hy
import os
import sys
import itertools
import random
process_num=2
if len(sys.argv)>1 and sys.argv[1]=="rm":
cnt=1
idx="%05d"%(cnt)
model_path= "hyopt/model"+idx+""
result_path="hyopt/result"+idx+""
try:
os.removedirs(model_path)
except OSError:
pass
... | 2.015625 | 2 |
bgen_reader/_environment.py | sbaker-dev/bgen-reader-py | 0 | 12767217 | import os
from pathlib import Path
from appdirs import user_cache_dir
from ._file import make_sure_dir_exist
CUSTOM_CACHE = None
BGEN_READER_CACHE_HOME = Path(
os.environ.get(
"BGEN_READER_CACHE_HOME",
default=Path(user_cache_dir("bgen-reader", "limix")) / "bgen-reader",
)
)
def custom_met... | 2.359375 | 2 |
app/grandchallenge/reader_studies/templatetags/get_ground_truth.py | njmhendrix/grand-challenge.org | 101 | 12767218 | <filename>app/grandchallenge/reader_studies/templatetags/get_ground_truth.py
from django import template
register = template.Library()
@register.simple_tag
def get_ground_truth(obj, image, question):
"""
Get the ground truth value for the image/question combination in reader
study obj.
"""
ground... | 2.140625 | 2 |
curvepy/extension/tangent.py | diatche/curvepy | 0 | 12767219 | <gh_stars>0
from .extension import Extension
from ..line import Line
from intervalpy import Interval
class TangentExtension(Extension):
"""
Extends an end of a function with a line using its edge tangents.
"""
name = "tangent"
def __init__(self, func, regression_degree=None, regression_period=No... | 2.796875 | 3 |
tests/mock_client.py | roman-kachanovsky/cmd.fm-python | 0 | 12767220 | from __future__ import unicode_literals
from client.client import DirbleClient
class MockClient(DirbleClient):
def get_genres(self):
return [
{
"id": 1,
"title": "Trance",
"description": "stations that plays commercial and other things in tranc... | 2.5 | 2 |
setup.py | yangzhl/trash | 3 | 12767221 | """`trash` lives on `GitHub <http://github.com/halst/trash/>`_."""
from distutils.core import setup
setup(name='trash',
version='0.1.0',
description='Safe `rm` substitute for OS X',
long_description=__doc__,
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
url='https:/... | 1.523438 | 2 |
src/models/jaxgp/mean.py | jejjohnson/uncertain_gps | 9 | 12767222 | <filename>src/models/jaxgp/mean.py
import jax.numpy as jnp
def zero_mean(x):
return jnp.zeros(x.shape[0])
| 2.0625 | 2 |
anywhere/test_base_types.py | mlga/anywhere | 0 | 12767223 | # -*- coding:utf-8 -*-
from copy import deepcopy
from itertools import combinations_with_replacement
import pytest
from anywhere import testsets
@pytest.mark.parametrize(
'where_obj,string',
zip(
testsets.WHERES,
testsets.STRINGS,
),
ids=[str(i) for i in range(1, len(testsets.WHERES)... | 2.578125 | 3 |
myparser/config.py | kbondar17/declarations-parser | 0 | 12767224 | <gh_stars>0
import configparser
from dotenv import dotenv_values
config = dotenv_values(".env")
| 1.273438 | 1 |
export_standard_full.py | MuckRock/API-examples | 42 | 12767225 | <reponame>MuckRock/API-examples<filename>export_standard_full.py
#!/usr/bin/env python2
# -- coding: utf-8 --
# Standard Library
import datetime
import json
import os
import time
# Third Party
import requests
from simplejson.scanner import JSONDecodeError
import utils
url = utils.API_URL
token = utils.get_api_key()... | 2.390625 | 2 |
python/kudu/tests/common.py | AnupamaGupta01/kudu-1 | 2 | 12767226 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 1.773438 | 2 |
tickets.py | DrumSergio/router-express | 0 | 12767227 | # -*- coding: utf-8 -*-
# system('python tickets.py "Sergio" "Fernandez" "<EMAIL>" "950001" "968868968"')
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoS... | 2.53125 | 3 |
tests/integration/test_cookies_and_contact.py | ONSdigital/ras-frontstage | 8 | 12767228 | <reponame>ONSdigital/ras-frontstage
import unittest
import requests_mock
from frontstage import app
from tests.integration.mocked_services import url_banner_api
class TestCookiesContact(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
@requests_mock.mock()
def test_cookies_succ... | 2.578125 | 3 |
tests/policy/test_offline.py | usaito/zr-obp | 0 | 12767229 | <reponame>usaito/zr-obp
import pytest
import numpy as np
from sklearn.linear_model import LogisticRegression
import torch
from obp.policy.offline import IPWLearner
from obp.policy.offline import NNPolicyLearner
from obp.policy.policy_type import PolicyType
from obp.ope.estimators import InverseProbabilityWeighting
d... | 2.046875 | 2 |
shop/models.py | lbacon17/lb-fitness | 0 | 12767230 | <reponame>lbacon17/lb-fitness
from decimal import Decimal
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django_countries.fields import CountryField
class Category(models.Model):
class Meta:
verbose_name_plural = 'Categories'
name = ... | 2.140625 | 2 |
inference/modulated_detection.py | kylevedder/mvits_for_class_agnostic_od | 114 | 12767231 | import numpy as np
import torch
from PIL import Image
import torchvision.transforms as T
from infer import Inference
from utils.nms import nms
torch.set_grad_enabled(False)
def class_agnostic_nms(boxes, scores, iou=0.5):
if len(boxes) > 1:
boxes, scores = nms(np.array(boxes), np.array(scores), iou)
... | 2.234375 | 2 |
Desafios/desafio014.py | MaxGabrielima/Python-Codes | 3 | 12767232 | c = float(input('Digite a temperatura em C°: '))
f = c * 1.8 + 32
print('{:.0f} C° é igual a {:.0f}° Fahrenheight'.format(c, f)) | 4.0625 | 4 |
actions/aux_function.py | NathanDezan/chatbot-pytube | 0 | 12767233 | from pytube import YouTube
import re
import os
#Action
class AuxFunctions():
def get_resolutions(self, url):
res_exist = {'144p': False, '240p': False, '360p': False, '480p': False, '720p': False, '1080p': False, '1440p': False, '2160p': False, '4320p': False}
resolutions_list = list()
func... | 2.765625 | 3 |
src/moeflow/util.py | rachmadaniHaryono/MoeFlow | 0 | 12767234 | # -*- coding: utf-8 -*-
import hashlib
import logging
import os
import tempfile
import time
import cv2
import numpy as np
WIDTH_HEIGHT_LIMIT = 1600 # in pixel
def resize_large_image(image_data):
img_array = np.fromstring(image_data, dtype=np.uint8)
image = cv2.imdecode(img_array, 1)
height, width = ima... | 2.53125 | 3 |
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalEtaCalib_cff.py | ckamtsikis/cmssw | 852 | 12767235 | import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
ecaletaCalibHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
# HLTPaths = ['AlCa_EcalEta'],
eventSetupPathsKey='EcalCalEtaCalib',
throw = False
)
| 0.957031 | 1 |
nose2/tests/functional/support/scenario/module_import_err/pkg/test_attribute_err.py | benj-pml/nose2 | 0 | 12767236 | from nose2.compat import unittest
def test_foo():
pass
class TestFoo(unittest.TestCase):
def test_foo(self):
pass
| 1.671875 | 2 |
tally.py | ishabalu/trial2 | 0 | 12767237 | <reponame>ishabalu/trial2
import calc
veg = 120
fruits = 45
cash = 200
tot = calc.add(veg, fruits)
cashback = calc.sub(cash,tot)
print(" cash returned is",cashback)
| 3.328125 | 3 |
python_programs/to_base.py | PatrickShaw/QuixBugs | 22 | 12767238 | <gh_stars>10-100
import string
def to_base(num, b):
result = ''
alphabet = string.digits + string.ascii_uppercase
while num > 0:
i = num % b
num = num // b
result = result + alphabet[i]
return result
"""
Integer Base Conversion
base-conversion
Input:
num: A base-10 inte... | 4.03125 | 4 |
core/processors/UNKNOWN_TASKProcessor.py | LoriSun/petp | 4 | 12767239 | <filename>core/processors/UNKNOWN_TASKProcessor.py<gh_stars>1-10
import logging
from core.processor import Processor
class UNKNOWN_TASKProcessor(Processor):
TPL: str = '{"msg":""}'
DESC: str = f'''
This is empty task, only should be used when converting Selenium IDE recording to PETP execution.
... | 2.5625 | 3 |
Singleton (__new__ version).py | joe513/Miscellaneous | 0 | 12767240 | <filename>Singleton (__new__ version).py
class Person:
IS = None
def __init__(self, name, hours, rate):
self.name = name
self.hours = hours
self.rate = rate
def __new__(cls, *args, **kwargs):
if cls.IS == None:
cls.IS = object.__new__(Person)
retu... | 3.5 | 4 |
src/hotels/utils.py | bee-travels/data-generator | 2 | 12767241 | import json
def load_json(file_name):
with open(file_name) as json_data:
return json.load(json_data) | 2.421875 | 2 |
app/waterQual/legacy/silica/silica_overfit.py | fkwai/geolearn | 0 | 12767242 | import importlib
from hydroDL.master import basins
from hydroDL.app import waterQuality, wqLinear
from hydroDL import kPath
from hydroDL.model import trainTS
from hydroDL.data import gageII, usgs
from hydroDL.post import axplot, figplot
import torch
import os
import json
import numpy as np
import pandas as pd
import m... | 2.21875 | 2 |
gpytorch/priors/_compatibility.py | bdecost/gpytorch | 0 | 12767243 | <gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import torch
from gpytorch.priors import SmoothedBoxPrior
logger = logging.getLogger()
def _bounds_to_prior(prior, bounds, batch_size=None, ... | 2.015625 | 2 |
format.py | my-personal-forks/dart-sublime-bundle | 182 | 12767244 | <gh_stars>100-1000
# Copyright (c) 2014, <NAME>. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
from subprocess import PIPE
from subprocess import Popen
import sublime
import sublime_plugin
from Dart... | 2.390625 | 2 |
ircawp-learn.py | Fortyseven/ircawp2020-markov | 0 | 12767245 | #!/bin/python3
import sys
import os
import Markov
if __name__ == "__main__":
if (len(sys.argv) < 2 or len(sys.argv) > 3):
print("usage: {} sourcefile.txt [existingbrain.json]".format(
sys.argv[0]))
sys.exit(-1)
if (not os.path.exists(sys.argv[1])):
print("Can't find sourc... | 2.671875 | 3 |
src/player.py | Flowshu/gym-mtg | 0 | 12767246 | <reponame>Flowshu/gym-mtg
from creature import Creature
from random import choice
class Player():
def __init__(self):
self.life = 5
self.creatures = []
#self.agent = 0
#self.battlefield = 0
#self.deck = 0
#self.hand = []
#self.lands = []
#... | 3.015625 | 3 |
mailing/mail/views.py | todd-sudo/mailing | 0 | 12767247 | <reponame>todd-sudo/mailing
import datetime
import uuid
from rest_framework import generics, status
from django.db.models import Q
from rest_framework.response import Response
from .models import Client, Message, MailingList
from .serializers import (
ClientCreateUpdateSerializer,
MailingCreateUpdateSerialize... | 1.851563 | 2 |
attacks/fgsm.py | Jackie-LJQ/efficientdet | 0 | 12767248 | <reponame>Jackie-LJQ/efficientdet
from torch.autograd import Variable
import torch
def linf_clamp(x, _min, _max):
'''
Inplace linf clamping on Tensor x.
Args:
x: Tensor. shape=(N,C,W,H)
_min: Tensor with same shape as x.
_max: Tensor with same shape as x.
'''
idx = x.data ... | 2.296875 | 2 |
lib/models/Transformer.py | fivosts/pinkySpeaker | 1 | 12767249 | <gh_stars>1-10
#!/usr/bin/env python
import numpy as np
import gensim
from os import path, makedirs
from keras import backend as K
from keras.models import Sequential, load_model
from keras.callbacks import LambdaCallback
from keras.layers.recurrent import LSTM
from keras.layers.embeddings import Embedding
from keras... | 2.46875 | 2 |
detector.py | Xia-Xinyu/X-Trace | 3 | 12767250 | <gh_stars>1-10
from deepsort import DeepSort
from model.embedding import Embedding
from sqlite import *
import numpy as np
import cv2, time
global pts, ROIs
class Detector(object):
def __init__(self,video_path = None,img_arr = None,track = None, ROI=None):
global pts, ROIs
self.deepsort = DeepSo... | 2.28125 | 2 |