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 |
|---|---|---|---|---|---|---|
python/protein-translation/protein_translation.py | squibdev/Exercism.io | 0 | 12773051 | from textwrap import wrap
def proteins(strand):
# textwrap.wrap(s, i) creates a list of elements from s with a max width of i
codons = wrap(strand, 3)
codons_to_protein = {
'AUG': 'Methionine',
'UUU': 'Phenylalanine',
'UUC': 'Phenylalanine',
'UUA': 'Leucine',
'U... | 3.359375 | 3 |
autoPyTorch/components/metrics/additional_logs.py | jmm-montiel/Auto-PyTorch | 2 | 12773052 | class test_result():
"""Log the performance on the test set"""
def __init__(self, autonet, X_test, Y_test):
self.autonet = autonet
self.X_test = X_test
self.Y_test = Y_test
def __call__(self, model, epochs):
if self.Y_test is None or self.X_test is None:
retu... | 2.8125 | 3 |
src/Alice/Brain.py | EnochXDDD/DevTools | 0 | 12773053 | <reponame>EnochXDDD/DevTools
import logging
import sys
import time
import traceback
from functools import partial
LOG = logging.getLogger(__name__)
class TimeEstimate:
def __init__(self, block_name="", without_any_args=False, handler=None):
self._block_name = block_name
self._without_any_args = wi... | 2.53125 | 3 |
py/test/fixture/touchscreen_calibration/fixture.py | arccode/factory | 3 | 12773054 | # Copyright 2014 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.
import collections
import threading
import time
from cros.factory.test import event
from cros.factory.test.i18n import _
from cros.factory.test import se... | 2.234375 | 2 |
src/cyborgbackup/ui/urls.py | ThorpeJosh/cyborgbackup | 0 | 12773055 | <reponame>ThorpeJosh/cyborgbackup
from django.conf.urls import url
from django.views.generic.base import TemplateView
from django.contrib.staticfiles import views
from django.urls import re_path
from cyborgbackup.main.utils.tasks import catalog_is_running, celery_worker_is_running
from cyborgbackup.main.models import... | 1.992188 | 2 |
pycrowipmodule/status_state.py | febalci/pycrowipmodule | 1 | 12773056 | '''Crow/AAP Alarm IP Module Feedback Class for alarm state'''
class StatusState:
# Zone State
@staticmethod
def get_initial_zone_state(maxZones):
"""Builds the proper zone state collection."""
_zoneState = {}
for i in range (1, maxZones+1):
_zoneState[i] = {'status': {'o... | 2.265625 | 2 |
create_venv.py | toopazo/toopazo_ulg | 0 | 12773057 | #!/usr/bin/env python3
import subprocess
import argparse
def increment_setup_version():
filename = 'setup.py'
# Read file
fd = open(filename, 'r')
line_arr = fd.readlines()
fd.close()
# Search for the specific line
count = 0
version = None
version_line = None
for i in range(... | 2.90625 | 3 |
Solutions/284.py | ruppysuppy/Daily-Coding-Problem-Solutions | 70 | 12773058 | <reponame>ruppysuppy/Daily-Coding-Problem-Solutions<filename>Solutions/284.py<gh_stars>10-100
"""
Problem:
Two nodes in a binary tree can be called cousins if they are on the same level of the
tree but have different parents. For example, in the following diagram 4 and 6 are
cousins.
1
/ \
2 3
/ \ \
4 ... | 3.8125 | 4 |
src/bio2bel_ddr/__init__.py | bio2bel/ddr | 1 | 12773059 | # -*- coding: utf-8 -*-
"""Bio2BEL DDR."""
from .ddr import Manager
| 0.996094 | 1 |
loss_functions.py | xdr940/cc | 0 | 12773060 | # Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
import torch
from torch import nn
from torch.autograd import Variable
from inverse_warp import inverse_warp, flow_warp
from ssim import ssim
from process_functions import depth_occlusion_masks,oc... | 1.820313 | 2 |
src/bt_utils/handle_sqlite.py | zaanposni/umfrageBot | 6 | 12773061 | <filename>src/bt_utils/handle_sqlite.py<gh_stars>1-10
import os.path
import sqlite3
from .console import Console
from .config import cfg
from .get_content import content_dir
SHL = Console(prefix="handleSQLITE")
BASE_PATH = content_dir
DB_PATH = "bundestag.db"
class DatabaseHandler:
debug = False
def __in... | 2.78125 | 3 |
tests/pgsmo_tests/test_object_server.py | DaeunYim/pgtoolsservice | 33 | 12773062 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.484375 | 2 |
nemo/collections/nlp/models/language_modeling/megatron_finetune_model.py | gkucsko/NeMo | 0 | 12773063 | # Copyright (c) 2022, NVIDIA CORPORATION. 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 required by appli... | 1.6875 | 2 |
bullet-gym-primitive/showKerasCEMCartPoleExample.py | benelot/bullet-gym | 55 | 12773064 | <gh_stars>10-100
#!/usr/bin/python
import os
os.system('python runTrainer.py --agent=KerasCEMAgent --env=CartPolev0Env --train-for=0 --test-for=10000000 --delay=0.005 --gui --show-test --load-file=checkpoints/KerasCEM-CartPolev0-chkpt-1.h5')
| 1.804688 | 2 |
database_api/mongodb_server.py | shenhao-stu/2021_computer_design | 3 | 12773065 | <filename>database_api/mongodb_server.py<gh_stars>1-10
# -*- coding:utf-8 -*-
# -------------------------------
# @Author : shenhao-stu
# @Email : <EMAIL>
# -------------------------------
# @File : mongodb_server.py
# @Time : 2021-03-14 16:24
# -------------------------------
from flask import Flask, Response, request... | 2.984375 | 3 |
plugin_tests/dataverse_test.py | whole-tale/girder_wholetale | 3 | 12773066 | <reponame>whole-tale/girder_wholetale
import json
import os
import responses
import time
import vcr
from tests import base
from girder.models.folder import Folder
from girder.models.item import Item
DATA_PATH = os.path.join(
os.path.dirname(os.environ['GIRDER_TEST_DATA_PREFIX']),
'data_src', 'plugins', 'whol... | 2.15625 | 2 |
cycle-gan-vgg/util/proper.py | nallab/style-transfer | 0 | 12773067 | """
準備用:データセットをTFRecord形式にする
"""
import tensorflow as tf
from absl import flags
from absl import app
from glob import glob
from tensorflow.keras.preprocessing.image import load_img, img_to_array
FLAGS = flags.FLAGS
flags.DEFINE_string('old_image_path', "./datasets/original_data", 'Path to the data folder')
flags.DEFI... | 2.546875 | 3 |
src/data_manager.py | bruggerl/gdp-height | 0 | 12773068 | <gh_stars>0
import pandas as pd
import constants as c
class DataManager:
"""
This class encapsulates the logic for reading and processing the datasets.
"""
def __init__(self, heights_csv, gdps_csv):
"""
Initialize the DataManager with the given CSV inputs. The DataManager holds the in... | 3.90625 | 4 |
google-native-ts-k8s-python-postgresql/app/app/config.py | riddopic/examples | 0 | 12773069 | from pydantic import BaseSettings, SecretStr
class Config(BaseSettings):
app_port: int
app_host: str
db_username: str
db_password: SecretStr | None = None
db_host: str
db_port: int
db_database_name: str
| 1.867188 | 2 |
kattis/buka.py | terror/Solutions | 2 | 12773070 | def go(o, a, b):
if o == '+':
return a + b
return a * b
def main():
a, o, b = int(input()), input(), int(input())
return go(o, a, b)
if __name__ == '__main__':
print(main())
| 3.53125 | 4 |
edit-file/edit-file.py | bgoodr/rhythmbox-plugins-edit-file | 0 | 12773071 | # -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# edit-file.py
#
# Adds an option to edit the file containing the selected track
# to the right click context menu.
# Based on code in
#
# Partly based on code in https://github.com/donaghhorgan/rhythmbox-plugins-open-containi... | 2.515625 | 3 |
web-service/kagan.py | ResearcherOne/example-repo | 0 | 12773072 | print("yeni kagan ozellik çalışıyor")
| 1.289063 | 1 |
tests/helpers/triple_store.py | data4knowledge/RdfOgm | 0 | 12773073 | <reponame>data4knowledge/RdfOgm
import requests
from requests.auth import HTTPBasicAuth
class TripleStore:
def __init__(self):
self.__cfg__ = self.__store_config()
def clear(self, graph='DEFAULT'):
if graph != 'DEFAULT':
graph = f'GRAPH <{graph}>'
self.__update(f'CLEAR {... | 2.046875 | 2 |
Placer.py | hal-lab-u-tokyo/GenMap | 0 | 12773074 | # This file is part of GenMap and released under the MIT License, see LICENSE.
# Author: <NAME>
import networkx as nx
import random
import math
from multiprocessing import Pool
import multiprocessing as multi
class Placer():
def __init__(self, method, iterations = 50, randomness = "Full"):
""" Initia... | 2.796875 | 3 |
openslides_voting/urls.py | jwinzer/openslides-voting | 4 | 12773075 | from django.conf.urls import url
from . import views
from .votecollector import urls
urlpatterns = [
url(r'^voting/attendance/shares/$',
views.AttendanceView.as_view(),
name='voting_attendance'),
] + urls.urlpatterns
| 1.578125 | 2 |
var/spack/repos/builtin/packages/r-mlinterfaces/package.py | whitfin/spack | 3 | 12773076 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RMlinterfaces(RPackage):
"""This package provides uniform interfaces to machine learning
... | 1.609375 | 2 |
openid/test/test_pape_draft5.py | pbx/python3-openid | 39 | 12773077 | <filename>openid/test/test_pape_draft5.py
from openid.extensions.draft import pape5 as pape
from openid.message import *
from openid.server import server
import warnings
warnings.filterwarnings(
'ignore', module=__name__, message='"none" used as a policy URI')
import unittest
class PapeRequestTestCase(unittest.... | 2.15625 | 2 |
src/dynamic_sites/urls.py | oruehenbeck/django_dynamic_sites | 0 | 12773078 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from .views import RedirectView, ContentView, ContentEditView, ContentDeleteView, ContentDownloadView, ContentFormView
urlpatterns = [
# toplayer
url(r'^$', RedirectView.as_view(), name='redirect_landing'),
url(r'^(?P<slug>[-\w]*form[-\w]*)/$', Cont... | 1.992188 | 2 |
learningPygame/Derek/00-MovingSmile/04-Drawing.py | Rosebotics/catapult2019 | 0 | 12773079 | <reponame>Rosebotics/catapult2019<gh_stars>0
# TODO: Copy all of your 03-Colors.py program and put it below this comment.
# TODO One way to do so is:
# TODO 1. Inside 03-Colors.py, do:
# TODO -- Control-A (to SELECT the entire contents of the file, then
# TODO -- Control-C (to COPY tha... | 3.296875 | 3 |
Ch12/bst_height.py | anandg95/CLRS-solutions | 3 | 12773080 | <gh_stars>1-10
from collections import deque
def height_recursive(bst, node):
if node is None or (node.left == node.right == None):
return 0
lh = height_recursive(bst, node.left)
rh = height_recursive(bst, node.right)
return 1 + max(lh, rh)
def height_iterative(bst):
if bst.root is None:... | 3.609375 | 4 |
ms2ldaviz/ms2ldaviz/settings_docker.py | sdrogers/ms2ldaviz | 6 | 12773081 | from .settings import *
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '^(2&40trp_*ei%$_*p-k598#hu3-w(@9%&&dr�##dpag=c%+'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['*']
DATABASES['default']['HOST'] = 'db'
CELERY_BROKER_URL = ... | 1.046875 | 1 |
Vault7/Lost-in-Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/lp/gui/__init__.py | dendisuhubdy/grokmachine | 46 | 12773082 |
# package dsz.lp.gui
import dsz
import dsz.lp.alias
import dsz.lp.cmdline
import dsz.path
import dsz.version
import os
import re
import sys
import xml.dom.minidom
| 1.039063 | 1 |
tests/test_scripts/test_gen_jsonld_context.py | krishna-saravan/linkml | 83 | 12773083 | <gh_stars>10-100
import unittest
import click
from linkml.generators import jsonldcontextgen
from tests.test_scripts.environment import env
from tests.utils.clicktestcase import ClickTestCase
from tests.utils.filters import ldcontext_metadata_filter
class GenContextTestCase(ClickTestCase):
testdir = "gencontext"... | 2.03125 | 2 |
src/musescore/__init__.py | ryanrudes/musescore | 0 | 12773084 | <gh_stars>0
from .musescore import *
| 0.894531 | 1 |
pymap3d/azelradec.py | unjambonakap/pymap3d | 0 | 12773085 | <gh_stars>0
"""
Azimuth / elevation <==> Right ascension, declination
"""
from typing import Tuple
from datetime import datetime
from .vallado import azel2radec as vazel2radec, radec2azel as vradec2azel
from .timeconv import str2dt # astropy can't handle xarray times (yet)
try:
from astropy.time import Time
fr... | 2.796875 | 3 |
sqlce.py | jobead/python-excel | 0 | 12773086 | <gh_stars>0
import os
import time
import datetime
import zipfile
import xml.dom.minidom
def get_files_from_folder(path = os.environ['HOME']):
homedir = os.environ['HOME'] + '/python'
def get_external_data_connections(path = os.environ['HOME'] + '/python/excelfiles', filename = 'external_data_connections'):
pri... | 2.9375 | 3 |
dev_global/dev_global/basic.py | FrederichRiver/neutrino2 | 0 | 12773087 | <reponame>FrederichRiver/neutrino2
#!/usr/bin/python38
import atexit
import os
import signal
import sys
__version__ = '1.0.1'
PROG_NAME = 'Neutrino'
def deamon(pid_file: str, log_file: str, prog_name: str):
"""
pid_file: full path of pid file, it is suggested in /tmp
log_file: full path of log file.
... | 2.578125 | 3 |
py/codeforces/872A.py | shhuan/algorithms | 0 | 12773088 | <reponame>shhuan/algorithms<filename>py/codeforces/872A.py<gh_stars>0
# -*- coding: utf-8 -*-
import math
import collections
import bisect
import heapq
import time
import random
import itertools
"""
created by shhuan at 2017/10/20 08:16
"""
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
B =... | 3.203125 | 3 |
techStore(final)/img/image_data/admin.py | X3eRo0/E-Commerce-Website | 0 | 12773089 | <gh_stars>0
from django.contrib import admin
# Register your models here.
from .models import Product
# Register your models here.
admin.site.register(Product)
class ProductAdmin(admin.ModelAdmin):
list_display=['__str__','slug']
class Meta:
model=Product
| 1.8125 | 2 |
2021/09/solution_two.py | adtok/advent-of-code | 0 | 12773090 | <reponame>adtok/advent-of-code
"""
Advent of Code 2021: Day 09 Part 1
tldr: graph traversal to find basins
"""
from functools import reduce
from typing import List, Set, Tuple
Point = Tuple[int, int]
Map = List[List[int]]
def read_input(input_file: str) -> Map:
"""Reads the input file into a list of lists of i... | 3.90625 | 4 |
src/coin_price/admin.py | HaotingS/Python-Django-CRUD-project | 0 | 12773091 | from django.contrib import admin
# Register your models here.
from .models import Coin
admin.site.register(Coin) | 1.382813 | 1 |
collect.py | cuppett/collect_aws_logs | 2 | 12773092 | <gh_stars>1-10
# Copyright (c) 2015 <NAME> <<EMAIL>>
# All rights reserved
from boto import logs
from boto.logs.exceptions import LimitExceededException
import argparse
import tempfile
import time
import os
import shutil
parser = argparse.ArgumentParser(description='An AWS log file extractor', epilog=' - For Steven')... | 2.234375 | 2 |
mabed/functions.py | FirasOdeh/MABED | 1 | 12773093 | # coding: utf-8
import timeit
import json
import time
from flask import jsonify
from mabed.es_corpus import Corpus
from mabed.mabed import MABED
from mabed.es_connector import Es_connector
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from nltk.tokenize import word_tokenize
__author__ = "<NAME>"
__email... | 2.375 | 2 |
generate_datasets/TISE/tise_gendata.py | clott3/SIB-CL | 2 | 12773094 | <gh_stars>1-10
import numpy as np
from solveTISE import TISE
import time
import h5py
import sys
sys.path.append('./../PhC/')
from fourier_phc import FourierPhC
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from skimage.transform import resize
from scipy.sparse.linalg import eigs, eigsh
impor... | 1.882813 | 2 |
awwards/admin.py | Jay-68/awwards | 0 | 12773095 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from awwards.models import Profile, Project, Review
# Register your models here.
admin.site.register(Project)
admin.site.register(Profile)
admin.site.register(Review) | 1.210938 | 1 |
projects/FastRetri/fastretri/datasets.py | UU-tracktech/fast-reid | 0 | 12773096 | <reponame>UU-tracktech/fast-reid
# encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
import os
from processor.pipeline.reidentification.fastreid.fastreid.data.datasets import DATASET_REGISTRY
from processor.pipeline.reidentification.fastreid.fastreid.data.datasets.bases import ImageDataset
__all__ = ["Cars1... | 2.15625 | 2 |
lib/tests/dos_circular_fragment.py | bbhunter/graphql-cop | 89 | 12773097 | <reponame>bbhunter/graphql-cop<gh_stars>10-100
"""Circular Fragment tests."""
from lib.utils import graph_query, curlify
def circular_fragment(url, proxy, headers):
"""Check for circular fragment."""
res = {
'result':False,
'title':'Circular Fragment',
'description':'Circular Fragment allowed in Query... | 2.453125 | 2 |
src/lgt/group/generators.py | nftqcd/lgt | 0 | 12773098 | <filename>src/lgt/group/generators.py
"""
generators.py
Contains methods for generating elements of SU(2), SU(3) gauge groups.
Note:
- The `eps` (type: float) argument to the below functions controls the
'distance' from the identity matrix.
"""
from __future__ import absolute_import, print_function, division, ann... | 2.59375 | 3 |
src/utils/plotsolution.py | Vnicius/ed-tsp | 0 | 12773099 | <filename>src/utils/plotsolution.py
# -*- coding: utf-8 -*-
import math
import matplotlib.pyplot as plt
from copy import copy
import random
def get_plot_values(graph, has_points=False):
xs = []
ys = []
xs_line = []
ys_line = []
N = len(graph)
if has_points:
for node in graph:
... | 3.203125 | 3 |
migration/migrator/migrations/course/20190710182514_add_view_date_for_teams.py | elihschiff/Submitty | 411 | 12773100 | """Migration for a given Submitty course database."""
def up(config, database, semester, course):
if not database.table_has_column('teams', 'last_viewed_time'):
database.execute('ALTER TABLE teams ADD COLUMN last_viewed_time timestamp with time zone')
def down(config, database, semester, course):
pass... | 2.625 | 3 |
util/build_benchmarks_page.py | wenq1/duktape | 4,268 | 12773101 | #!/usr/bin/env python2
import os
import sys
import re
import json
def main():
# Adapt manually.
duk = '/usr/local/bin/duk'
lzstring = '/home/duktape/duktape/lz-string/libs/lz-string.js'
duktape_repo = '/home/duktape/duktape'
duktape_testrunner_repo = '/home/duktape/duktape-testrunner'
duktape... | 2.53125 | 3 |
canopy/session.py | CanopySimulations/canopy-python | 0 | 12773102 | <reponame>CanopySimulations/canopy-python
from typing import Optional, Callable, Awaitable, Union
import canopy
import aiohttp
import atexit
import asyncio
from aiohttp.client_exceptions import ClientResponseError, ClientConnectionError, ServerTimeoutError, ClientError
import logging
logger = logging.getLogger(__nam... | 2.28125 | 2 |
drfexample/locations/models.py | craigderington/django-drf-examples | 0 | 12773103 | <reponame>craigderington/django-drf-examples
from django.db import models
# Create your models here.
class Location(models.Model):
"""
The Location data model for geo-coding
"""
ip_addr = models.CharField(max_length=15, null=False, blank=False)
time_zone = models.CharField(max_length=255, null=Fa... | 2.734375 | 3 |
raciocinio_algoritmico/Prova 01/05.py | PedroMoreira87/python | 0 | 12773104 | # Entrada de dados
from math import acos, degrees
a = float(input('a: '))
b = float(input('b: '))
c = float(input('c: '))
# Verificar se os lados A, B e C formam um triângulo
if a < b + c and b < a + c and c < a + b:
if a != b and a != c and b != c:
print('Triângulo Escaleno')
elif a == b and a == c and... | 4.09375 | 4 |
google/cloud/security/common/data_access/project_dao.py | pombredanne/forseti-security | 1 | 12773105 | <reponame>pombredanne/forseti-security
# Copyright 2017 The Forseti Security Authors. 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/license... | 2.109375 | 2 |
tests/test_H0.py | CNERG/RadClass | 1 | 12773106 | <reponame>CNERG/RadClass
import numpy as np
import pytest
import os
from datetime import datetime, timedelta
from RadClass.RadClass import RadClass
from RadClass.H0 import H0
import tests.test_data as test_data
# initialize sample data
start_date = datetime(2019, 2, 2)
delta = timedelta(seconds=1)
timestamps = np.ara... | 2.140625 | 2 |
main.py | grinya007/recomlive_rnn | 0 | 12773107 | <reponame>grinya007/recomlive_rnn<filename>main.py
#!/usr/bin/env python3
import sys, os
from src.server import Server
from src.recommender import Recommender
"""Creates recommender object, see src/recommender.py for details
"""
recommender = Recommender(
int(os.getenv('RECOMMENDER_DOCS_LIMIT', 2000)),
int(os... | 2.828125 | 3 |
skactiveml/utils/_validation.py | LukasLuehrs/scikit-activeml | 0 | 12773108 | import copy
import warnings
from collections.abc import Iterable
from inspect import Parameter, signature
import numpy as np
from sklearn.utils.validation import (
check_array,
column_or_1d,
assert_all_finite,
check_consistent_length,
check_random_state as check_random_state_sklearn,
)
from ._labe... | 2.734375 | 3 |
state_machine/drivers/pycubedmini/lib/bq25883.py | PyCubed-Mini/software_example_beepsat | 30 | 12773109 | <reponame>PyCubed-Mini/software_example_beepsat<gh_stars>10-100
"""
`bq25883`
====================================================
CircuitPython driver for the BQ25883 2-cell USB boost-mode charger.
* Author(s): <NAME>
Implementation Notes
--------------------
"""
from micropython import const
from a... | 2.28125 | 2 |
rl.py | llSourcell/Sensor_Networks | 40 | 12773110 | <reponame>llSourcell/Sensor_Networks
from gridworld import GridWorldMDP
from qlearn import QLearner
import numpy as np
import matplotlib.pyplot as plt
def plot_convergence(utility_grids, policy_grids):
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
utility_ssd = np.sum(np.square(np.diff(utility_grids)), axi... | 2.4375 | 2 |
test.py | erikhoward/py3-disco | 0 | 12773111 | # Python application to test miniconda data science installation
import math
import os
import sys
libs = ["numpy", "pandas", "matplotlib", "sklearn", "skimage", "cv2",
"sqlalchemy", "bokeh", "nltk", "missingno", "geopandas", "wordcloud",
"lightgbm", "scipy", "xgboost", "catboost", "keras"]
def main()... | 2.90625 | 3 |
tests/test_vector.py | cs207FinalProjectGroup/cs207-FinalProject | 0 | 12773112 | <filename>tests/test_vector.py
import sys
import os
import numpy as np
import pytest
sys.path.append('..')
import autodiff as ad
def test_create_vector():
v = ad.create_vector('v', [1, 2])
assert(v[0].getValue() == 1)
assert(v[1].getValue() == 2)
derivs = ad.get_deriv(v)
assert(np.array_equal(np... | 2.515625 | 3 |
tests/test_portproxy.py | pseeth/portproxy | 1 | 12773113 | <reponame>pseeth/portproxy
def test_portproxy():
# No tests yet...
pass | 1.085938 | 1 |
NNServer/test/test_app.py | yinkn/iam_plus | 0 | 12773114 | """
curl -i -X POST -H "Content-Type:application/json" http://localhost:5000/train -d '{"userName":"TEST1","dataset":[[-15, -57, 88, 50, 16, 83, 198, 16, -70],[202, -53, 140, 134, 0, 84, 165, -16, -15],[15, -67, 96, 108, 0, 79, 212, -16, -23],[16, -67, 126, 119, -15, 67, 258, -16, -16],[53, -65, 155, 59, 15, 65, 179,... | 1.78125 | 2 |
oandapyV20-examples-master/src/streaming_trans.py | cdibble2011/OANDA | 127 | 12773115 | # -*- coding: utf-8 -*-
"""Simple demo of streaming transaction data."""
from oandapyV20 import API
from oandapyV20.exceptions import V20Error, StreamTerminated
from oandapyV20.endpoints.transactions import TransactionsStream
from exampleauth import exampleAuth
accountID, access_token = exampleAuth()
api = API(access_... | 2.6875 | 3 |
project euler solutions/Problem_059.py | helq/old_code | 0 | 12773116 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
def decrypt(text,passw):
l = min(len(text), len(passw))
if l == 0: return ""
return "".join(chr(ord(text[n])^ord(passw[n])) for n in xrange(l) ) + decrypt(text[l:], passw)
text_encrypt = "".join(map(lambda x: chr(x), eval( "[" + open("059-cipher1.txt", "Ur").... | 3.40625 | 3 |
rpython/jit/codewriter/call.py | kantai/passe-pypy-taint-tracking | 2 | 12773117 | <gh_stars>1-10
#
# Contains the logic to decide, based on the policy, which graphs
# to transform to JitCodes or not.
#
from rpython.jit.codewriter import support
from rpython.jit.codewriter.jitcode import JitCode
from rpython.jit.codewriter.effectinfo import (VirtualizableAnalyzer,
QuasiImmutAnalyzer, RandomEffec... | 1.921875 | 2 |
python/occurence.py | albandewilde/huffman_coding_tp | 0 | 12773118 | <gh_stars>0
from typing import Dict
from to_bin import read_file, write_to_file
import json
def get_occurence(occurence, letter):
if letter not in occurence:
occurence[letter] = 1
else:
occurence[letter] += 1
return occurence
def text_to_bin(content: str, file: str, file_output:str) -> ... | 3.5625 | 4 |
reframe/core/schedulers/pjm.py | LorienLV/reframe | 0 | 12773119 | <reponame>LorienLV/reframe
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import functools
import itertools
import re
import time
import reframe.core.runtime as rt
import r... | 1.75 | 2 |
demo/demo.py | nielsonf/hello_world | 0 | 12773120 | <filename>demo/demo.py
def cube(a):
"""Cube the number a.
Args:
a (float): The number to be squared.
"""
return a**3
| 3.59375 | 4 |
literal/apps/authentication/dto.py | spanickroon/Text-From-Photo-Django-API | 0 | 12773121 | import typing
from pydantic import BaseModel
class AuthenticationDTO(BaseModel):
username: typing.Optional[str]
email: typing.Optional[str]
token: typing.Optional[str]
password: typing.Optional[str]
class RegisterDTO(BaseModel):
username: str
token: str
class LoginDTO(BaseModel):
user... | 2.390625 | 2 |
python/paddle/fluid/tests/unittests/rnn/test_rnn_cells_static.py | L-Net-1992/Paddle | 11 | 12773122 | <gh_stars>10-100
# Copyright (c) 2020 PaddlePaddle Authors. 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 ... | 1.929688 | 2 |
test/test_schema.py | blawson/dataforj | 1 | 12773123 | import unittest
import yaml
from pyspark.sql import *
from dataforj import schema
from test.test_samples import flow_simple, simple_yaml_text, flow_complex
city_yaml_text = '''
- name: city
tests:
- not_null
- accepted_values: ['Amsterdam', 'Dublin', 'Frankfurt']
'''
flag_yaml_text = '''
- name: flag
... | 2.9375 | 3 |
dgcnn/main.py | linhaojia13/GCN_pointcloud | 15 | 12773124 | <filename>dgcnn/main.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Contact: <EMAIL>
@File: main.py
@Time: 2018/10/13 10:39 PM
"""
from __future__ import print_function
import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from ... | 1.960938 | 2 |
docs/assignment-3/src/histogram_1d.py | aligholamee/Patterns | 1 | 12773125 | <filename>docs/assignment-3/src/histogram_1d.py
# ========================================
# [] File Name : histogram_1d.py
#
# [] Creation Date : April 2018
#
# [] Author 2 : <NAME>
#
# ========================================
import matplotlib.pyplot as plt
import numpy as np
# Number of samples
NUM_SAMPLES = 100
... | 3.78125 | 4 |
src/joint_state_publisher_gui/src/joint_state_publisher_gui/__init__.py | MrDavidAlv/TATTOTRONIX | 0 | 12773126 | <gh_stars>0
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the ... | 1.132813 | 1 |
backblaze/utils.py | WardPearce/aiob2 | 0 | 12773127 | from datetime import datetime, timedelta
from typing import Union
from .models.file import UploadUrlModel
from .cache import Cache
def format_route_name(name: str) -> str:
"""Used to format route name.
Parameters
----------
name : str
Returns
-------
str
"""
return name.replac... | 2.5 | 2 |
programs/pgm14_14.py | danielsunzhongyuan/python_practice | 0 | 12773128 | <gh_stars>0
#
# This file contains the Python code from Program 14.14 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by <NAME>.
#
# Copyright (c) 2003 by <NAME>, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm14_14.txt
#
class SimpleRV(RandomVa... | 2.5 | 2 |
dpkt/sip.py | 0x4e38/dpkt | 1 | 12773129 | # $Id$
"""Session Initiation Protocol."""
import http
class Request(http.Request):
"""SIP request."""
__hdr_defaults__ = {
'method':'INVITE',
'uri':'sip:<EMAIL>',
'version':'2.0',
'headers':{ 'To':'', 'From':'', 'Call-ID':'', 'CSeq':'', 'Contact':'' }
}
__methods =... | 2.453125 | 2 |
pictures/urls.py | bintadam/My-Gallery | 0 | 12773130 | from django.urls import path
from . import views
from os import name
from django.conf.urls.static import static
from django.conf import settings
urlpatterns=[
path('',views.welcome,name ='welcome'),
path('gallery/',views.pictures,name='pictures'),
path('search/', views.search_results, name='search_results'... | 2 | 2 |
test/OR-WE-514/main.py | eydam-prototyping/mp_modbus | 2 | 12773131 | import mp_modbus_master as mmm
import time
import struct
d1 = mmm.modbus_rtu_master(uart_no=2, parity=0, tx_pin=12, rx_pin=13, en_pin=32)
l = {
"U" : {"register": 305, "desc": "Voltage", "type": "uint16", "gain": 100, "unit": "V"},
"I" : {"register": 313, "desc":... | 2.390625 | 2 |
app/src/main/python/booksite/SoxsSite.py | xiaoping2100/androidPyBook | 0 | 12773132 | import copy
import re
import requests
import urllib.parse
from bs4 import BeautifulSoup
from typing import List
try:
import basesite
except (ModuleNotFoundError, ImportError) as e:
from . import basesite
class SoxsSite(basesite.BaseSite):
def __init__(self):
self.site_info = basesite.SiteInfo(
... | 2.90625 | 3 |
maskrcnn_benchmark/modeling/roi_heads/box_head/attention.py | wuyuebupt/doubleheadsrcnn | 60 | 12773133 | <filename>maskrcnn_benchmark/modeling/roi_heads/box_head/attention.py<gh_stars>10-100
import torch
from torch import nn
from torch.nn import functional as F
class ListModule(nn.Module):
def __init__(self, *args):
super(ListModule, self).__init__()
idx = 0
for module in args:
se... | 2.28125 | 2 |
tests/views/test_planing.py | DanielGrams/gsevp | 1 | 12773134 | def test_list(client, seeder, utils):
user_id, admin_unit_id = seeder.setup_base()
seeder.create_event(admin_unit_id)
url = utils.get_url("planing")
utils.get_ok(url)
url = utils.get_url("planing", keyword="name")
utils.get_ok(url)
| 1.859375 | 2 |
src/xrl/utils/pruner.py | k4ntz/XmodRL | 0 | 12773135 | <filename>src/xrl/utils/pruner.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.nn.utils.prune as prune
# own pruning class for disabling nodes from prev layer
# based on threshold
class ThresholdPruning(prune.BasePruningMethod):
PRUNING_TYPE = "unstr... | 2.5625 | 3 |
Task/Balanced-brackets/Python/balanced-brackets-2.py | LaudateCorpus1/RosettaCodeData | 1 | 12773136 | >>> from itertools import accumulate
>>> from random import shuffle
>>> def gen(n):
... txt = list('[]' * n)
... shuffle(txt)
... return ''.join(txt)
...
>>> def balanced(txt):
... brackets = ({'[': 1, ']': -1}.get(ch, 0) for ch in txt)
... return all(x>=0 for x in accumulate(brackets))
...
>>> for ... | 3.796875 | 4 |
0405.convert_a_number_to_hexadecimal/solution.py | WZMJ/Algorithms | 5 | 12773137 | class Solution:
def to_hex(self, num: int) -> str:
if num == 0:
return "0"
prefix, ans = "0123456789abcdef", ""
num = 2 ** 32 + num if num < 0 else num
while num:
item = num & 15 # num % 16
ans = prefix[item] + ans
num >>= 4 # num //=... | 3.234375 | 3 |
flexipage/tests/test_flexipage.py | eRestin/MezzGIS | 0 | 12773138 | <reponame>eRestin/MezzGIS
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test.utils import override_settings
from django.template import Template
from django.forms import ... | 2.46875 | 2 |
setup.py | davidfraser/mimetype-description | 0 | 12773139 | <reponame>davidfraser/mimetype-description
from setuptools import setup, find_packages
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="mimetype-description",
description="Human readable MIME type descriptions",
license="MIT",
url="https://github.com/chesstrian/mimetype-d... | 1.453125 | 1 |
python/test.py | event-driven-robotics/imu_tk2 | 0 | 12773140 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul
@author: <NAME> <<EMAIL>>
"""
# %% Preliminaries
import numpy as np
import os
import sys
import glob
repos_path = os.getenv('GIT_REPOS_PATH')
bimvee_path = os.environ.get('BIMVEE_PATH')
wp5_slam_path = os.environ.get('WP5_SLAM_PATH')
... | 1.703125 | 2 |
estrategias/Valdrighi.py | lucasmoschen/jogos_vorazes | 1 | 12773141 | # coding: utf8
from .jogadores import Jogador
import random
class MeuJogador(Jogador):
def escolha_de_cacada(self, rodada, comida_atual, reputacao_atual, m, reputacoes_dos_jogadores):
if rodada==1:
self.comida=comida_atual
escolhas = ['c' for x in reputacoes_dos_jogadores]
... | 3.265625 | 3 |
example_usage_multinmf_conv_em.py | fakufaku/separake | 10 | 12773142 | <gh_stars>1-10
import numpy as np
import numpy.random as random
import matplotlib.pyplot as plt
import pyroomacoustics as pra
from scipy.io import wavfile
from multinmf_conv_em import multinmf_conv_em
def example_usage_multinmf_conv_em():
#
# example_usage_multinmf_conv_em()
#
# Example of... | 2.265625 | 2 |
datasets/multi_task_dataset_coco.py | zhangwenwen/multi-task.chainer | 0 | 12773143 | <filename>datasets/multi_task_dataset_coco.py
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
class Multi_task_COCO(GetterDataset):
def __init__(self):
super(Multi_task_COCO, self).__init__()
def __len__(self):
pass
def _get_annotations(self):
pass
... | 2.015625 | 2 |
office365/onedrive/driveitems/thumbnail.py | rikeshtailor/Office365-REST-Python-Client | 544 | 12773144 | <reponame>rikeshtailor/Office365-REST-Python-Client
from office365.runtime.client_value import ClientValue
class Thumbnail(ClientValue):
"""
The thumbnail resource type represents a thumbnail for an image, video, document,
or any item that has a bitmap representation.
"""
pass
| 2.1875 | 2 |
tacker/service.py | priya-pp/Priya | 3 | 12773145 | <gh_stars>1-10
# Copyright 2011 VMware, Inc
# 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
#
# Unles... | 1.890625 | 2 |
k8s/submit_kbs_jobs.py | kcyu2014/nas-landmarkreg | 8 | 12773146 | <gh_stars>1-10
import IPython
import yaml
import math
from kubernetes import client, config
from kubernetes.client.rest import ApiException
import os
# load the default configs.
from kubernetes.client import V1Job
from argparse import ArgumentParser
import time
NAMESPACE='cvlab-deadline'
INTERACTIVE_UPPER_LIMIT = 14 *... | 2.1875 | 2 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/plugins/apps.py | osoco/better-ways-of-thinking-about-software | 3 | 12773147 | <filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/plugins/apps.py
"""
Plugins Application Configuration
Signal handlers are connected here.
"""
from django.apps import AppConfig
from django.conf import settings
from edx_django_utils.plugins import connect_pl... | 2.203125 | 2 |
tests/service/user/test_async_user.py | dicomgrid/sdk-python | 9 | 12773148 | <reponame>dicomgrid/sdk-python
import pytest
@pytest.mark.asyncio
class TestAsyncUser:
"""Test async user."""
async def test_get(self, async_api):
"""Test user get."""
user = await async_api.User.get().get()
assert user
async def test_get_with_only(self, async_api):
"""Te... | 2.65625 | 3 |
paperscraper/scholar/__init__.py | henrykrumb/paperscraper | 16 | 12773149 | from .scholar import * # noqa
| 0.996094 | 1 |
WebAPI/DB.py | cbluoss/TerraCtl | 0 | 12773150 | <filename>WebAPI/DB.py
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
class State(db.Model):
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.DateTime, unique=True, nullable=False)
state = db.Column(db.Text, unique=True, nullable=False)
def __repr__(self):
retur... | 2.765625 | 3 |