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 |
|---|---|---|---|---|---|---|
conan/test_package/test.py | SaeidSamadi/Tasks | 60 | 12763551 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
#
from __future__ import print_function
import math
import eigen
import sva
import rbdyn
import tasks
import sch
def makeZXZArm(isFixed = True, X_base = sva.PTransformd.Identity()):
mbg = rbdyn.MultiBodyGraph()
m... | 2.03125 | 2 |
tests/classtime/brain/scheduling/test_schedule.py | rosshamish/classtime-implementation | 1 | 12763552 |
import unittest
from classtime.brain.scheduling import Schedule
class TestSchedule(unittest.TestCase): #pylint: disable=R0904
@classmethod
def setup_class(cls):
pass
@classmethod
def teardown_class(cls):
pass
def test_section_add(self):
def assert_section_add(section, nu... | 3.265625 | 3 |
nasdaqdatalink/model/data_list.py | edvn0/data-link-python | 1,178 | 12763553 | from .model_list import ModelList
from .data_mixin import DataMixin
class DataList(DataMixin, ModelList):
pass
| 1.226563 | 1 |
puput/wagtail_hooks.py | UCBerkeleySETI/puput | 554 | 12763554 | <gh_stars>100-1000
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler, BlockElementHandler
from wagtail.core import hooks
@hooks.register('register_rich_text_features')
def register_blockquote_feat... | 2.0625 | 2 |
tests/test_add.py | GoodRx/pytest-mark-no-py3 | 3 | 12763555 | from textwrap import dedent
import pytest
from pytest_mark_no_py3.add import main
@pytest.mark.parametrize("directory", [True, False])
def test_main_no_results_file(directory, runner, testdir):
pyfile = testdir.makepyfile(
dedent(
"""\
@pytest.mark.no_py3
def test_already_mar... | 2.265625 | 2 |
thirdparty/src/opencc/setup.py | kanskinson/librime | 0 | 12763556 | import os
import re
import subprocess
import sys
import warnings
import setuptools
import setuptools.command.build_ext
import wheel.bdist_wheel
_this_dir = os.path.dirname(os.path.abspath(__file__))
_clib_dir = os.path.join(_this_dir, 'python', 'opencc', 'clib')
_build_dir = os.path.join(_this_dir, 'build', 'python')... | 1.914063 | 2 |
packaging/setup/ovirt_engine_setup/engine_common/database.py | UranusBlockStack/ovirt-engine | 0 | 12763557 | <filename>packaging/setup/ovirt_engine_setup/engine_common/database.py
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, 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 th... | 1.773438 | 2 |
home/migrations/0003_site_image.py | txcary/startpage | 0 | 12763558 | <reponame>txcary/startpage
# Generated by Django 2.1.3 on 2018-11-12 14:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_auto_20181112_1334'),
]
operations = [
migrations.AddField(
model_name='site',
... | 1.625 | 2 |
tests/downloads/conftest.py | allenmichael/pyTenable | 0 | 12763559 | <reponame>allenmichael/pyTenable<gh_stars>0
import pytest, os, uuid, warnings
from tenable.downloads import Downloads
from tenable.errors import *
@pytest.fixture(scope='module')
def vcr_config():
return {
'filter_headers': [
('Authorization', 'Bearer 000'),
],
}
@pytest.fixture(a... | 1.851563 | 2 |
src/hive_udf/hive_udf_example.py | zpz/hive-udf | 0 | 12763560 | <reponame>zpz/hive-udf
'''
This is an example UDF for Hive, to be processed by `make_udf` and used in tests.
UDFs should follow this example. The main points include:
1. The code in this module is written against the Python version that is
available on the Hive cluster.
2. Because this module runs in the environ... | 2.671875 | 3 |
yumsync/yumrepo.py | hoonetorg/yumsync | 21 | 12763561 | # standard imports
from contextlib import contextmanager
from urllib2 import urlopen
from urlparse import urlparse
import copy
import os
import shutil
import sys
import tempfile
import time
# third-party imports
import createrepo
import yum
# local imports
from yumsync.yumbase import YumBase
import yumsync.util as util... | 2.078125 | 2 |
product/product_labels.py | saiihamza/open_data_parsing | 0 | 12763562 | <reponame>saiihamza/open_data_parsing
class ProductLabels(object):
def __init__(self, labels, labels_tags, labels_fr):
self.Labels = labels
self.LabelsTags = labels_tags
self.LabelsFr = labels_fr
def __str__(self):
return self .Labels
| 2.828125 | 3 |
consort/tools/SimpleDynamicExpression.py | josiah-wolf-oberholtzer/consort | 9 | 12763563 | <filename>consort/tools/SimpleDynamicExpression.py<gh_stars>1-10
import abjad
from abjad import attach
from abjad import inspect
from abjad import iterate
from abjad import override
from abjad.tools import abctools
from abjad.tools import indicatortools
from abjad.tools import instrumenttools
from abjad.tools import se... | 2.265625 | 2 |
karabo_bridge/tests/test_server.py | European-XFEL/karabo-bridge-py | 6 | 12763564 | from karabo_bridge import Client
from .utils import compare_nested_dict
def test_req_rep(server, data):
for _ in range(3):
server.feed(data)
with Client(server.endpoint) as client:
for _ in range(3):
d, m = client.next()
compare_nested_dict(data, d)
| 2.5 | 2 |
django_flex_user/urls.py | ebenh/django-flex-user | 1 | 12763565 | <reponame>ebenh/django-flex-user
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from django_flex_user import views
urlpatterns = [
path('csrf-tokens/', views.get_csrf_token),
path('users/', views.FlexUsers.as_view()),
path('users/user/', views.FlexUser.as_view(... | 2.078125 | 2 |
baikeSpider/spiders/wiki_en_spider.py | pluto-junzeng/baiduSpider | 13 | 12763566 | <gh_stars>10-100
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author:lichunhui
@Time: 2018/7/26 19:48
@Description:
"""
import re
import copy
from itertools import chain
from urllib.parse import unquote
from scrapy.linkextractors import LinkExtractor
from scrapy.selector import Selector
from scrapy.spiders i... | 2.125 | 2 |
fdap/app/contracts/service.py | miniyus/AutomaticPosting-Python | 0 | 12763567 | <filename>fdap/app/contracts/service.py
from fdap.app.contracts.logging import Logging
from fdap.app.exceptions.parse_exceptoin import ParseException
class Service(Logging):
def __init__(self):
super().__init__()
def throw(self, code: int, message: str):
raise ParseException(code, message)
| 2.15625 | 2 |
var/spack/repos/builtin/packages/ispc/package.py | tomdele/spack | 9 | 12763568 | # Copyright 2013-2020 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)
import os
import platform
from spack import *
class Ispc(Package):
"""ispc is a compiler for a variant of the C pro... | 1.828125 | 2 |
py_system/prototype/__init__.py | mingpz2010/PhysicsThinker | 1 | 12763569 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
The basic algorithm simulation archtecture of the C/C++ system
"""
import numpy as np
PRIME= np.array([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
157, 163, 167, ... | 2.96875 | 3 |
src/trainer/model_step_handler.py | renyi-ai/drfrankenstein | 4 | 12763570 | <reponame>renyi-ai/drfrankenstein<gh_stars>1-10
import os
import pandas as pd
import torch
class ModelStepHandler:
def __init__(self,
model,
optimizer_name='sgd',
lr=1e-4,
multilabel=False,
weight_decay=0.):
self.model =... | 2.296875 | 2 |
run.py | davidkiama/Passowrd-Locker | 0 | 12763571 | #!/usr/bin/env python3
import random
from user import User
from credentials import Credentials
def create_user(username, password):
'''
Function to create a new user
'''
new_user = User(username, password)
return new_user
def check_password(password):
"""
Function to check if the passw... | 4.375 | 4 |
es.py | elliotxx/es-handle | 6 | 12763572 | #coding=utf8
'''
使用 python client 对 ElasticSearch 进行常用的增删改查操作
'''
from elasticsearch import Elasticsearch
import sys
import json
argname_list = ['cmd','addr','op','index','type','id']
default_host = '127.0.0.1'
default_port = '9200'
# 参数数量可能的范围 [Argument_Num_Min_Limit,Argument_Num_Max_Limit]
Argument_Num_Min_Limit = ... | 2.921875 | 3 |
dci/alembic/versions/732a3e25e65e_remove_topics_label_column.py | redhat-cip/dci-control-server | 17 | 12763573 | <filename>dci/alembic/versions/732a3e25e65e_remove_topics_label_column.py
#
# Copyright (C) 2018 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/license... | 1.335938 | 1 |
BAIT2123 Internet Of Things/Practical/Practical 7/test09.py | loozixuan/SoftwareSystemsDevelopment-Y2S1 | 3 | 12763574 | <reponame>loozixuan/SoftwareSystemsDevelopment-Y2S1<filename>BAIT2123 Internet Of Things/Practical/Practical 7/test09.py
from time import *
from grovepi import *
from paho.mqtt import publish
MQTT_BROKER = "192.168.56.1"
#MQTT_BROKER = "broker.emqx.io" #using public mqtt broker to act as publisher
MQTT_TOPIC = "... | 1.898438 | 2 |
tasks.py | MinchinWeb/gpx-reader | 1 | 12763575 | from minchin.releaser import make_release, vendorize
| 1.132813 | 1 |
metaheuristic_algorithms/hsgo.py | thieu1995/mpoc_code | 0 | 12763576 | <filename>metaheuristic_algorithms/hsgo.py
import numpy as np
from copy import deepcopy
from includes.utils import *
from blockchain_network.simulation import Simulator
class HsgoEngine:
def __init__(self, population_size=50, n_clusters=5, epochs=500, num_simulation_each_solution=2, n_value=None):
self.e... | 2.65625 | 3 |
tests/__init__.py | paulross/typin | 7 | 12763577 | # -*- coding: utf-8 -*-
"""Unit test package for typin."""
| 1.023438 | 1 |
doc_v3/apps.py | julics129/clinic_v3 | 0 | 12763578 | from django.apps import AppConfig
class DocV3Config(AppConfig):
name = 'doc_v3'
| 1.015625 | 1 |
var/spack/repos/builtin/packages/cray-fftw/package.py | varioustoxins/spack | 0 | 12763579 | # Copyright 2013-2022 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 CrayFftw(Package):
"""FFTW is a C subroutine library for computing the discrete Fourier
... | 2.03125 | 2 |
nineml/visitors/equality.py | INCF/nineml-python | 6 | 12763580 | from builtins import zip
import math
import sympy
from itertools import chain
from .base import BaseVisitor, BaseDualVisitor, DualWithContextMixin
from nineml.exceptions import (NineMLDualVisitException,
NineMLDualVisitValueException,
NineMLDualVisitTypeExce... | 2.21875 | 2 |
tripleo_common/image/base.py | openstack/tripleo-common | 52 | 12763581 | <gh_stars>10-100
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.71875 | 2 |
web/schema/__init__.py | ShenTengTu/py_sms_impl | 0 | 12763582 | from functools import lru_cache
from pydantic import BaseSettings, BaseModel
class StringConstraint(BaseModel):
min_length: int = None
max_length: int = None
regex: str = None
class _Constraints(BaseSettings):
user_id: StringConstraint = StringConstraint(
min_length=4, max_length=32, regex=r... | 2.625 | 3 |
examples/visualizations/compare_logscale.py | cdagnino/ngboost | 3 | 12763583 | import numpy as np
import scipy as sp
import scipy.stats
from ngboost.distns import Normal, Laplace, LogNormal, LogLaplace
from ngboost.ngboost import NGBoost
from ngboost.scores import MLE, CRPS, MLE_SURV, CRPS_SURV
from ngboost.learners import default_tree_learner, default_linear_learner
from ngboost.evaluation impor... | 2.515625 | 3 |
day_11/part_2.py | berkanteber/advent-of-code-2021 | 0 | 12763584 | <gh_stars>0
import os
input_path = os.path.join(os.path.dirname(__file__), "input.txt")
with open(input_path) as f:
data = f.read()
def solve(data: str) -> int:
energy_levels = {}
for r, line in enumerate(data.splitlines()):
for c, energy in enumerate(line):
energy_levels[r, c] = int... | 2.890625 | 3 |
TWLight/message_storage.py | aacaldwell/TWLight | 67 | 12763585 | <reponame>aacaldwell/TWLight
from django.contrib.messages.storage.session import SessionStorage
from django.contrib.messages.storage.base import Message
from .view_mixins import DedupMessageMixin
class SessionDedupStorage(DedupMessageMixin, SessionStorage):
"""
Custom session storage to prevent storing duplic... | 1.898438 | 2 |
ample/parsers/tests/test_tm_parser.py | fsimkovic/ample | 6 | 12763586 | <gh_stars>1-10
"""Test functions for parsers.tm_parser"""
import os
import unittest
from ample import constants
from ample.parsers import tm_parser
class TestTMscore(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.thisd = os.path.abspath(os.path.dirname(__file__))
cls.ample_share = c... | 2.453125 | 2 |
E03 - Learning programs and models/Architectures/models/hrnet.py | mialona/Stomatal-segmentation | 0 | 12763587 | <filename>E03 - Learning programs and models/Architectures/models/hrnet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from .segbase import SegBaseModel
__all__ = ['HRNet']
class HRNet(SegBaseModel):
def __init__(self, nclass, backbone_name='hrnet_w30', norm_layer=nn.BatchNorm2d, BN_MOMEN... | 2.71875 | 3 |
src/project/ecommerce/models.py | Kaushal1011/django-ecommerce-graphql | 7 | 12763588 | from django.db import models
from django.conf import settings
class Product(models.Model):
product_id = models.AutoField(primary_key=True)
product_name = models.CharField(max_length=100)
product_category = models.TextField()
product_price = models.FloatField()
product_discount_price = models.Float... | 2.078125 | 2 |
main.py | putt/futures-collect | 1 | 12763589 | <reponame>putt/futures-collect<filename>main.py<gh_stars>1-10
#-*- coding=utf-8 -*-
# from FinalLogger import logger
# from Constant import inst_strategy, suffix_list
import urllib.request
import sqlite3
import pandas as pd
from pvplot import PriceVolumePlotter
import numpy as np
from datetime import datetime
import ti... | 2.28125 | 2 |
scaffold/masterpage.py | allankellynet/mimas | 0 | 12763590 | #-----------------------------------------------------
# Mimas: conference submission and review system
# (c) <NAME> 2016-2020 http://www.allankelly.net
# Licensed under MIT License, see LICENSE file
# -----------------------------------------------------
# System imports
# Google imports
import logging
# Local impo... | 2.34375 | 2 |
game/client/view/pad/legend.py | AntonYermilov/progue | 0 | 12763591 | from game.client.view.pad.pad import Pad
class LegendPad(Pad):
TEXT_COLOR = '#eaeaea'
HIGHLIGHTED_TEXT_COLOR = '#e6e600'
BACKGROUND_COLOR = '#26004d'
# BACKGROUND_COLOR = '#000000'
INVENTORY_TEXT = ' Inventory '
SKIP_TEXT = ' Skip turn '
NEXT_TEXT = ' Next (↓) '
PREV_TEXT = ... | 2.5 | 2 |
impy/tests/test_all_lab.py | kotania/impy | 6 | 12763592 | from __future__ import print_function
import sys
import os
import numpy as np
from multiprocessing import Pool, freeze_support
import tempfile
from impy.definitions import *
from impy.constants import *
from impy.kinematics import EventKinematics
from impy import impy_config, pdata
from impy.util import info
# AF: T... | 2.078125 | 2 |
LC_problems/15.py | Howardhuang98/Blog | 0 | 12763593 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : 15.py
@Contact : <EMAIL>
@Modify Time : 2022/4/14 20:57
------------
"""
import itertools
from typing import List
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
nums.sort()
memo = set()
... | 3.953125 | 4 |
pretrained_mobilenetssd_image.py | PacktPublishing/Computer-Vision-Python-OCR-Object-Detection-Quick-Starter | 6 | 12763594 | # -*- coding: utf-8 -*-
"""
@author: abhilash
"""
import numpy as np
import cv2
# load the image to detect, get width, height
# resize to match input size, convert to blob to pass into model
img_to_detect = cv2.imread('images/testing/scene3.jpg')
img_height = img_to_detect.shape[0]
img_width = img_to_... | 3.375 | 3 |
setup.py | messa/aiohttp-request-id-logging | 8 | 12763595 | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='aiohttp-request-id-logging',
version='0.0.1',
description='Setup proper request id logging for your Aiohttp app',
classifiers=[
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.... | 1.4375 | 1 |
src/python/utility/strings.py | andyjost/Sprite | 1 | 12763596 | <filename>src/python/utility/strings.py<gh_stars>1-10
from six import PY2, PY3, text_type, binary_type
def ensure_str_safe(arg, encoding='utf-8', errors='strict'):
'''Like ensure_str, but passes non-string-like objects through.'''
if isinstance(arg, (text_type, binary_type)):
return ensure_str(arg, encoding, e... | 2.890625 | 3 |
migrations/versions/65f48a3dd741_change_image_paths.py | audreynjiraini/personal-blog | 0 | 12763597 | <filename>migrations/versions/65f48a3dd741_change_image_paths.py<gh_stars>0
"""change image paths
Revision ID: 65f48a3dd741
Revises: <KEY>
Create Date: 2019-09-24 09:15:00.262210
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '65f48a3dd741'
down_revision = '<K... | 1.460938 | 1 |
script_sequential_mnist.py | CookieBox26/_ML | 0 | 12763598 | from utils.data_loader import MNIST
from models.gru import GRU
from models.tcn import TCN
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
# 1エポック学習します
def train(model, optimizer, train_loader, log_interval=10):
model.train()
loss_... | 2.859375 | 3 |
jsonlddb/index.py | u8sand/jsonlddb | 0 | 12763599 | def dds_insert(d, s, p, o):
if d.get(s) is None:
d[s] = {}
if d[s].get(p) is None:
d[s][p] = set()
d[s][p].add(o)
def dds_remove(d, s, p, o):
if d.get(s) is not None and d[s].get(p) is not None:
d[s][p].remove(o)
if not d[s][p]:
del d[s][p]
if not d[s]:
del d[s]
class JsonL... | 3.078125 | 3 |
views.py | ernstki/flask-admin-column-labels | 2 | 12763600 | <reponame>ernstki/flask-admin-column-labels<filename>views.py
from flask_admin.contrib.sqla import ModelView
class ColumnPropertiesView(ModelView):
"""
Shows table metadata gleaned from a view that's based on the MySQL
information_schema.TABLES table, scoped to just tables that exist in
the current da... | 2.328125 | 2 |
tests/test_books.py | pavlovprojects/python_qa_module_testing | 0 | 12763601 | import unittest
from src import Book
class TestBookClass(unittest.TestCase):
BOOK_DATA = {"title": "Просто Книга", "author": "<NAME>",
"genre": "Боевик", "year": "2020"}
def setUp(self):
self.book = Book(self.BOOK_DATA)
def test_book_attributes(self):
self.assertEqual(s... | 3.640625 | 4 |
src/livecli/plugins/foxtr.py | NghiemTrung/livecli | 1 | 12763602 | <reponame>NghiemTrung/livecli
from __future__ import print_function
import re
from livecli.plugin import Plugin
from livecli.plugin.api import http
from livecli.stream import HLSStream
__livecli_docs__ = {
"domains": [
"fox.com.tr",
],
"geo_blocked": [],
"notes": "",
"live": True,
"vod... | 2.328125 | 2 |
colors.py | mmarchetti/cv_sandbox | 0 | 12763603 | <reponame>mmarchetti/cv_sandbox
# BGR colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GRAY25 = (64, 64, 64)
GRAY50 = (128, 128, 128)
GRAY75 = (192, 192, 192)
GRAY33 = (85, 85, 85)
GRAY66 = (170, 170, 170)
BLUE = (255, 0, 0)
GREEN = (0, 255, 0)
RED = (0, 0, 255)
CYAN = (255, 255, 0)
MAGENTA = (255, 0, 255)
YELLOW ... | 1.375 | 1 |
result/error_analyze.py | shuu-tatsu/distantSV | 1 | 12763604 | <reponame>shuu-tatsu/distantSV
import sys
class ErrorAnalyzer():
def __init__(self, known_ne, unk_ne, result_file_list):
self.known_ne_set = known_ne
self.unk_ne_set = unk_ne
self.result_output_list = read_file(result_file_list)
self.known_occurrences = 0
self.unk_occurren... | 2.84375 | 3 |
app/app.py | jhollowe/groceri.es | 0 | 12763605 | <filename>app/app.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_babel import Babel, format_date
from config import Config
from slugify import slugify
import pycountry
app = Flask(__name__)
app.config.from_object(Conf... | 2.65625 | 3 |
Lista3_11.py | AlessandroGoncalve/Lista3_Python | 12 | 12763606 | <reponame>AlessandroGoncalve/Lista3_Python
#Altere o programa anterior para mostrar no final a soma dos números.
n1 = int(input("Digite um número: "))
n2 = int(input("Digite outro número: "))
for i in range(n1 + 1, n2):
print(i)
for i in range(n2 + 1, n1):
print(i)
print("Soma dos números... | 4.125 | 4 |
jsengine/chakra_win.py | SeaHOH/jsengine | 4 | 12763607 | <gh_stars>1-10
'''This is a Python binding to Microsoft Chakra Javascript engine.
Forked from PyChakra (https://github.com/zhengrenzhe/PyChakra) to support
Windows' built-in Chakra.
'''
import ctypes as _ctypes
import threading as _threading
import json
# load Windows' built-in chakra binary
try:
chakra = _ctyp... | 2.171875 | 2 |
classification_scale.py | jrctrabuco/Assay-Multiparameter-Dash | 0 | 12763608 | #Scale for classification of Devices
| 1.085938 | 1 |
model_code/mechanisms/parametric_mse.py | burrelln/Measurement-Integrity-and-Peer-Assessment | 0 | 12763609 | <filename>model_code/mechanisms/parametric_mse.py<gh_stars>0
"""
Implementation of the parametric MSE mechanism and the EM procedure used to estimate the parameters of the parametric model (model PG_1 from Piech et al. 2013).
@author: <NAME> <<EMAIL>>
"""
import numpy as np
from math import sqrt
from sklearn.metrics ... | 2.96875 | 3 |
estomagordo-python3/day_11b.py | erikagnvall/advent_of_code_2019 | 0 | 12763610 | <filename>estomagordo-python3/day_11b.py
import re
from heapq import heappop, heappush
from collections import Counter, defaultdict
from itertools import permutations
def paint(painted):
loy = 1000
hiy = -1000
lox = 1000
hix = -1000
out = []
for y, x in painted.keys():
loy = min(loy... | 3.109375 | 3 |
api/models/__init__.py | weng-lab/SCREEN | 5 | 12763611 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2016-2020 <NAME>, <NAME>, <NAME>, <NAME>
| 0.914063 | 1 |
0x04-python-more_data_structures/3-common_elements.py | malu17/alx-higher_level_programming | 0 | 12763612 | <gh_stars>0
#!/usr/bin/python3
def common_elements(set_1, set_2):
return (set(set_1) & set(set_2))
| 2.46875 | 2 |
backend/core/tests.py | ES2-UFPI/404-portal | 1 | 12763613 | from django.test import TestCase
from django.urls import reverse
from ..core.models import Portal
USERNAME = "username_test"
PASSWORD = "<PASSWORD>"
class PortalTestCase(TestCase):
@classmethod
def setUpTestData(self):
portal = Portal.objects.create()
portal.email = "<EMAIL>"
portal.nome_solicitante... | 2.796875 | 3 |
lightnion/cache.py | pthevenet/lightnion | 120 | 12763614 | <reponame>pthevenet/lightnion
import os
import time
import json
import shutil
import base64
import logging
cache_directory = '.lightnion-cache.d'
def directory(base_dir=None):
if base_dir is None:
base_dir = os.getcwd()
base_dir = os.path.join(base_dir, cache_directory)
if not os.path.isdir(base_... | 2.375 | 2 |
simpleAICV/classification/datasets/ilsvrc2012dataset.py | zgcr/pytorch-ImageNet-CIFAR-COCO-voc-training | 0 | 12763615 | <filename>simpleAICV/classification/datasets/ilsvrc2012dataset.py<gh_stars>0
import os
import cv2
import numpy as np
from torch.utils.data import Dataset
class ILSVRC2012Dataset(Dataset):
'''
ILSVRC2012 Dataset:https://image-net.org/
'''
def __init__(self, root_dir, set_name='train', transform=None... | 2.59375 | 3 |
models/Lightweight/MobileNetV1.py | Dou-Yu-xuan/deep-learning-visal | 150 | 12763616 | <filename>models/Lightweight/MobileNetV1.py
import torch
import torch.nn as nn
import torchvision
def BottleneckV1(in_channels, out_channels, stride):
return nn.Sequential(
nn.Conv2d(in_channels=in_channels,out_channels=in_channels,kernel_size=3,stride=stride,padding=1,groups=in_channels),
nn.BatchN... | 2.578125 | 3 |
database_delivery_sdk/api/dbtask/create_custom_dbtask_pb2.py | easyopsapis/easyops-api-python | 5 | 12763617 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: create_custom_dbtask.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _mess... | 1.148438 | 1 |
script/nightly_assess.py | gaoming714/arkham | 1 | 12763618 | <reponame>gaoming714/arkham<gh_stars>1-10
"""
download data from jqdatasdk
need finance.pickle
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
import jqdatasdk as jq
import pickle
from datetime import datetime, timedelta
import time
import pytz... | 2.15625 | 2 |
bst.py | RMalsonR/BinarySearchTree | 0 | 12763619 | class Node(object):
value = None
left_child = None
right_child = None
def __init__(self, value, left=None, right=None):
self.value = value
if left:
self.left_child = left
if right:
self.right_child = right
def __str__(self):
return self.value... | 3.875 | 4 |
sample/sample.py | eaybek/livequery | 0 | 12763620 | <reponame>eaybek/livequery<filename>sample/sample.py
from livequery.livequery import Livequery
class Livequery(object):
pass
| 1.21875 | 1 |
tests/asdf_tests/test_asdf_aws_schema.py | vhirtham/weldx | 0 | 12763621 | """Test ASDF serialization of AWS schema definitions."""
import pytest
# weld design -----------------------------------------------------------------
from weldx.asdf.tags.weldx.aws.design.base_metal import BaseMetal
from weldx.asdf.tags.weldx.aws.design.connection import Connection
# weld design --------------------... | 1.898438 | 2 |
lab_exercises/le_04-2020Fall/lab_exercise_04.py | arwhyte/SI506-practice | 12 | 12763622 | <reponame>arwhyte/SI506-practice
# START LAB EXERCISE 04
print('Lab Exercise 04 \n')
# SETUP
city_state = ["Detroit|MI", "Philadelphia|PA", "Hollywood|CA",
"Oakland|CA", "Boston|MA", "Atlanta|GA",
"Phoenix|AZ", "Birmingham|AL", "Houston|TX", "Tampa|FL"]
# END SETUP
# PROBLEM 1.0 (5 Points)
#... | 2.0625 | 2 |
regex.py | deb17/regex | 0 | 12763623 | '''This module performs operations related to the re module.
Its functions are:
run_re - Run the requested re and format the input data with
highlighting.
check_re - Check if the re is valid (can be compiled).
clean_data - Remove all span tags from the input test data.
get_flags_value - C... | 3.28125 | 3 |
bloom/editor/map_objects/sector_collection.py | thomasrogers03/bloom | 9 | 12763624 | # Copyright 2020 <NAME>
# SPDX-License-Identifier: Apache-2.0
import typing
from panda3d import bullet, core
from ... import audio, constants, editor, game_map, map_data, seq
from .. import (
event_grouping,
marker_constants,
plane,
ror_constants,
sector_geometry,
sprite_find_sector,
undo... | 1.90625 | 2 |
thrift/__init__.py | PythonRebirth/SB | 1 | 12763625 | __all__ = ['unverting', 'Boxup']
| 1.179688 | 1 |
Python-ML/PP04/code/PCA.py | JasonFil/Python-ML | 4 | 12763626 | <gh_stars>1-10
'''
Created on Nov 29, 2012
@author: jason
'''
from inspect import stack
import pandas as pd
import numpy as np
import os
from util.mlExceptions import DatasetError, LogicalError
from scipy.sparse import lil_matrix
from scipy.sparse.linalg import eigs
from numpy.linalg import eig
# Global constant for c... | 2.484375 | 2 |
enaml/qt/qt_html.py | xtuzy/enaml | 1,080 | 12763627 | <filename>enaml/qt/qt_html.py
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------... | 1.890625 | 2 |
tests/settings.py | jnsdrtlf/django-feather | 17 | 12763628 | <filename>tests/settings.py
import os
BASE_DIR = os.path.dirname(__file__)
INSTALLED_APPS = (
"django.contrib.auth",
"django.contrib.sessions",
"django.contrib.contenttypes",
"django.contrib.admin",
"django_feather",
)
SECRET_KEY = "django-feather-test"
DATABASES = {"default": {"ENGINE": "djang... | 1.664063 | 2 |
lib/devops/simple_cache.py | jpotter/angel | 0 | 12763629 | <gh_stars>0
# This is a very light-weight persistent cache setup for devops use. This cache setup stores one file
# per key/value pair, typically under tmpfs (ram-backed / reset on reboot) so that data can be stored and accessed
# between runs, and without relying on any running services.
#
# Key/value pairs are exp... | 2.6875 | 3 |
app/app.py | ellie271/ErdosProject | 0 | 12763630 | import streamlit as st
import numpy as np
import pickle
from sklearn.tree import DecisionTreeClassifier
#model = DecisionTreeClassifier(max_depth=8)
model = pickle.load(open('model.pickle','rb'))
st.write("""
# CoverMyMeds - PA Approval Chances
""")
st.write("This project was done as part of the Erdos Data Science... | 3.25 | 3 |
blogs/blog/db/post.py | caifeifei0329/blogs_study | 0 | 12763631 | import datetime
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from .base import Base
class Post(Base):
__tablename__ = "post"
id = Column(Integer, primary_key=True, autoincrement=True,)
title = Column(String)
content = Column(String)
... | 3.09375 | 3 |
SpaceHabitRPG/Models/BaseModel.py | joelliusp/SpaceHabit | 0 | 12763632 | <gh_stars>0
from AllDBFields import BaseFields
class BaseModel(object):
@classmethod
def get_dbFields(cls):
return BaseFields
def __init__(self):
self._changes = {}
self.dict = {}
def get_pk(self):
if not self.get_dbFields().PK_KEY in self.dict:
return None
return self.dict[self.ge... | 2.53125 | 3 |
apps/paddlefold/alphafold_paddle/relax/utils_test.py | kanz76/PaddleHelix | 1 | 12763633 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... | 2.109375 | 2 |
backtrader/backtrader/feeds/chainer.py | harshabakku/live-back-testing-trader | 1 | 12763634 | #!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015, 2016, 2017 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | 2.0625 | 2 |
tests/test_registration.py | NLeSC/python-pcl | 10 | 12763635 | from __future__ import print_function
import numpy as np
from numpy import cos, sin
from numpy.testing import assert_equal
import unittest
import pcl
from pcl.registration import icp, gicp, icp_nl, ia_ransac
bun0Tobun4 = [[0.85250509, -0.03745676, -0.52137518, 0.04118973],
[0.03552843, 0.999... | 2.125 | 2 |
setup.py | napetrov/dpctl | 0 | 12763636 | <gh_stars>0
##===---------- setup.py - dpctl.ocldrv interface -----*- Python -*-----===##
##
## Data Parallel Control Library (dpCtl)
##
## Copyright 2020 Intel Corporation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the Lice... | 1.484375 | 1 |
native/native/websocket.py | Andrew-Chen-Wang/django-3.0-private-messaging | 1 | 12763637 | from public.socket import handle_connect, handle_disconnect, handle_receive
async def websocket_application(scope, receive, send):
while True:
event = await receive()
# This is the implementation of our business logic
# Each function is located in socket.py to be more clean
if eve... | 2.78125 | 3 |
queue_fair_adapter/queue_fair_django_service.py | Queue-Fair/python | 0 | 12763638 | from queue_fair_adapter.queue_fair_service import QueueFairService
class QueueFairDjangoService(QueueFairService):
def __init__(self, request, response):
self.request = request
self.response = response
self.isSecure = request.is_secure()
def setCookie(self, name, value, lif... | 2.484375 | 2 |
tick/robust/tests/model_huber_test.py | sumau/tick | 411 | 12763639 | # License: BSD 3 clause
import unittest
import numpy as np
from scipy.sparse import csr_matrix
from tick.robust import ModelHuber
from tick.base_model.tests.generalized_linear_model import TestGLM
from tick.linear_model import SimuLinReg
class Test(TestGLM):
def test_ModelHuber(self):
"""...Numerical c... | 2.234375 | 2 |
ctapipe/calib/camera/tests/test_calibrator.py | pgrespan/ctapipe | 0 | 12763640 | """
Tests for CameraCalibrator and related functions
"""
import numpy as np
import pytest
from scipy.stats import norm
from traitlets.config.configurable import Config
from astropy import units as u
from ctapipe.calib.camera.calibrator import CameraCalibrator
from ctapipe.image.extractor import LocalPeakWindowSum, Ful... | 2.109375 | 2 |
mp3sum/util.py | okdana/mp3crc | 6 | 12763641 | # -*- coding: utf-8 -*-
"""
Utility functions.
"""
import crcmod.predefined
"""
Computes the CRC-16 check-sum of a string.
"""
crc16 = crcmod.predefined.mkCrcFun('crc-16')
def unpad_integer(integer, bits=7):
"""
Decodes a bit-padded integer such as the one used for ID3v2 tag sizes.
@param bytearray integer
... | 3.5 | 4 |
YoutubeImg.py | Chromeina/My_Python_Based_Tools | 0 | 12763642 | import urllib.request
from os import rename, mkdir
web_url = input("請輸入Youtube網址: ")
# web_url = input("Enter Youtube video url: ")
img_file = open("ytimg.txt", "a", encoding="utf-8")
video_link = web_url[32:]
img_link = ("https://img.youtube.com/vi/" + video_link + "/maxresdefault.jpg" + "\n")
img_file.wr... | 3.234375 | 3 |
tests/cases/files.py | HappyEinara/wingline | 0 | 12763643 | """Test cases."""
from wingline.files import containers, formats
def case_dynamodb_jsonl_gz(data_dir):
"""Gzipped, DynamoDb-serialized JsonLines."""
# b2sum --length 64 --binary examples/data/dynamodb-tv-casts.jl.gz
# c8e2e027a73751df *examples/data/dynamodb-tv-casts.jl.gz
return (
data_dir... | 2.046875 | 2 |
solutions/061_solution_02.py | UFResearchComputing/py4ai | 0 | 12763644 | <filename>solutions/061_solution_02.py
# 1. We can check out the first five rows of `americas` by executing
# `americas.head()` (allowing us to view the head of the DataFrame). We can
# specify the number of rows we wish to see by specifying the parameter `n`
# in our call to `americas.head()`. To view the first ... | 4.3125 | 4 |
orchard/configuration/__init__.py | BMeu/Orchard | 2 | 12763645 | # -*- coding: utf-8 -*-
"""
A collection of default configurations for certain operation modes of |projectname|.
"""
from .basedir import basedir
from .default import Default
from .development import Development
from .production import Production
from .testing import Testing
__all__ = ['basedir', 'Default', 'Dev... | 1.195313 | 1 |
tests/test_mr_presso.py | adriaan-vd-graaf/genome_integration | 13 | 12763646 | <filename>tests/test_mr_presso.py
from genome_integration import causal_inference
def test_mr_presso_with_reference_implementation():
"""
This test tests the reference implementation of MR presso, found on github:
https://github.com/rondolab/MR-PRESSO
It loads in the dataset located in the data folder... | 2.421875 | 2 |
tests/functional/__init__.py | netwrkr/ensconce | 1 | 12763647 | <gh_stars>1-10
import os.path
import threading
import socket
import collections
import time
import configobj
import cherrypy
import requests
from cherrypy.process.servers import wait_for_free_port
import selenium.webdriver as webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
fro... | 1.96875 | 2 |
tests/test_session.py | EdwardBetts/pyspotify | 2 | 12763648 | <gh_stars>1-10
# encoding: utf-8
from __future__ import unicode_literals
import unittest
import spotify
from spotify.session import _SessionCallbacks
import tests
from tests import mock
@mock.patch('spotify.session.lib', spec=spotify.lib)
class SessionTest(unittest.TestCase):
def tearDown(self):
spot... | 2.5 | 2 |
eval_extra_tester_v4.py | dgudenius/football_win_predictions | 4 | 12763649 | from util2 import *
from Pythag_Win import *
from Combined4 import *
# Read historical games from CSV
games = Util2.read_games("data/nfl_games.csv")
# Forecast every game
Combined4.combined4(games)
# Evaluate our forecasts against Elo
Util2.evaluate_forecasts(games)
| 1.9375 | 2 |
state_scrapper/state_scrapper/pipelines.py | nikmend/state-scrapper | 0 | 12763650 | <filename>state_scrapper/state_scrapper/pipelines.py
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exceptions import NotConfigured
import mysql.connector
import... | 2.4375 | 2 |