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 |
|---|---|---|---|---|---|---|
projects/article_generator/tests/test_pipeline_corner_cases.py | JackonYang/projects-in-one | 3 | 12771751 | <reponame>JackonYang/projects-in-one
from article_generator.tools.file_group import FileGroup
from article_generator.configs import image_pipe_group_data_file
def test_image_out_of_range():
g = FileGroup(image_pipe_group_data_file)
# make sure no exception
g.get_file_group('anything', 1)
g = FileGrou... | 2.234375 | 2 |
tests/printmidimessages.py | binokaryg/Piano-LED-Visualizer | 0 | 12771752 | <reponame>binokaryg/Piano-LED-Visualizer
import mido
from mido import MidiFile, Message, tempo2bpm, MidiTrack,MetaMessage
import time
ports = mido.get_input_names()
for port in ports:
if "Through" not in port and "RPiD" not in port and "RtMidOut" not in port:
try:
inport = mido.open_input(port)
print("Inpo... | 2.515625 | 3 |
test_keysmith.py | dmtucker/cs112 | 3 | 12771753 | """Test Keysmith."""
import subprocess
import sys
import keysmith
def test_script():
"""Test a full run when directly invoking."""
subprocess.check_call([sys.executable, keysmith.__file__])
def test_python_m():
"""Test python -m."""
command = [sys.executable, '-m', keysmith.__name__]
assert su... | 2.609375 | 3 |
src/deepen/propagation.py | petejh/deepen | 0 | 12771754 | import numpy as np
from deepen.activation import relu, relu_backward, sigmoid, sigmoid_backward
def initialize_params(layer_dims):
"""Create and initialize the params of an L-layer neural network.
Parameters
----------
layer_dims : list or tuple of int
The number of neurons in each layer of th... | 3.65625 | 4 |
web/templatetags/project.py | HongDaMa/sass_project | 1 | 12771755 | #!E:\py_virtual_env\saas_project\Scripts\python.exe
# -*- coding: utf-8 -*-
from django.template import Library
from web import models
register = Library()
@register.inclusion_tag('inclusion/all_project_list.html')
def all_project_list(request):
"""
1。获取我创建的所有项目
2.获取我参与的所有项目
:return:
"""
my_pro... | 1.914063 | 2 |
python/advent_of_code/y2020/day02.py | stonecharioteer/advent-of-code | 0 | 12771756 | <gh_stars>0
"""--- Day 2: Password Philosophy ---
Your flight departs in a few days from the coastal airport; the easiest way
down to the coast from here is via toboggan.
The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day.
"Something's wrong with our computers; we can't log in!" You ask if you ... | 3.359375 | 3 |
elab.py | RobertBaruch/mz80 | 10 | 12771757 | from nmigen import *
from nmigen.cli import main
from nmigen.asserts import *
from enum import Enum, unique, IntEnum
# Two different types of "enums".
class Thing(object):
"""A fake enumerated value.
This isn't actually an Enum, but is just a bag of constants,
and not at all Pythonic.
"... | 3.640625 | 4 |
674. Longest Continuous Increasing Subsequence.py | Muthu2093/Algorithms-practice | 0 | 12771758 | <reponame>Muthu2093/Algorithms-practice
# Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).
# Example 1:
# Input: [1,3,5,4,7]
# Output: 3
# Explanation: The longest continuous increasing subsequence is [1,3,5], its length is 3.
# Even though [1,3,5,7] is als... | 4.21875 | 4 |
ABC/164/a.py | fumiyanll23/AtCoder | 0 | 12771759 | S, W = map(int, input().split())
if(W >= S):
print("unsafe")
else:
print("safe") | 3.078125 | 3 |
fasteve/io/mongo/__init__.py | Wytamma/fasteve | 31 | 12771760 | from .mongo import Mongo, MongoClient
| 1.0625 | 1 |
huaweicloud-sdk-cdn/huaweicloudsdkcdn/v1/model/sources.py | NQLoong/huaweicloud-sdk-python-v3 | 1 | 12771761 | <filename>huaweicloud-sdk-cdn/huaweicloudsdkcdn/v1/model/sources.py
# coding: utf-8
import pprint
import re
import six
class Sources:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is... | 2.4375 | 2 |
pymdwizard/gui/MetadataRoot.py | mmfink/fort-pymdwizard | 53 | 12771762 | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
The MetadataWizard(pymdwizard) software was developed by the
U.S. Geological Survey Fort Collins Science Center.
See: https://github.com/usgs/fort-pymdwizard for current project source code
See: https://usgs.github.io/fort-pymdwizard/ for current user documentation
See: ... | 1.5625 | 2 |
skyportal/tests/frontend/test_individual_spectra.py | bparazin/skyportal | 52 | 12771763 | import uuid
import pytest
from selenium.common.exceptions import TimeoutException
from skyportal.tests import api
def enter_comment_text(driver, comment_text):
comment_xpath = "//div[contains(@data-testid, 'individual-spectrum-id_')]//textarea[@name='text']"
comment_box = driver.wait_for_xpath(comment_xpath... | 2.53125 | 3 |
优化算法/test.py | shao1chuan/pythonbook | 95 | 12771764 | lr = pow(2,-2)*16
print(lr) | 2.796875 | 3 |
library/library.py | rh01/p2p | 0 | 12771765 | <reponame>rh01/p2p<filename>library/library.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import logging
import json
import socket
def sigint_handler(signal, frame):
# 负责linux kernel信号处理
"""
handle keyboard interrupts (CTRL-C)
"""
# cli_outp... | 2.421875 | 2 |
python-format-strings/exercise3.py | ATelders/learn-python | 0 | 12771766 | <gh_stars>0
#medicine = 'Coughussin'
#dosage = 5
#duration = 4.5
#instructions = '{} - Take {} ML by mouth every {} hours.'.format(medicine, dosage, duration)
#print(instructions)
#instructions = '{2} - Take {1} ML by mouth every {0} hours'.format(medicine, dosage, duration)
#print(instructions)
#instructions = '{medi... | 3.3125 | 3 |
graphene_django_pagination/objects_type.py | daniel2101/graphene-django-pagination | 1 | 12771767 | <reponame>daniel2101/graphene-django-pagination
from graphene import ObjectType, Boolean
class PageInfoExtra(ObjectType):
has_next_page = Boolean(
required=True,
name="hasNextPage",
description="When paginating forwards, are there more items?",
)
has_previous_page = Boolean(
... | 2.859375 | 3 |
tests/test_Crypto.py | sondreod/pysj | 1 | 12771768 | import string
import pytest
from pysj import md5, sha1, sha256, uuid
from pysj.crypto import ALPHABET
@pytest.mark.parametrize(
"hash_algorithm, digest",
[
("sha256", "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"),
("sha1", "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"),
... | 2.484375 | 2 |
wxpy_rofi_config/config/rofi.py | thecjharries/wxpy-rofi-config | 2 | 12771769 | <gh_stars>1-10
# coding=utf8
"""This file provides the Rofi class"""
from collections import OrderedDict
from filecmp import cmp as file_cmp
from os import environ, stat as file_stat
from os.path import exists, expanduser, join
from re import (
compile as re_compile,
DOTALL,
finditer,
IGNORECASE,
... | 2.171875 | 2 |
main.py | if1live/rpi-mpd-controller | 1 | 12771770 | <filename>main.py
#!/usr/bin/python
#-*- coding: utf-8 -*-
u'''
http://www.rpiblog.com/2012/09/using-gpio-of-raspberry-pi-to-blink-led.html
'''
import RPi.GPIO as GPIO
import time
import commands
import re
PIN_STATUS = 3
PIN_PREV_BTN = 8
PIN_PLAY_BTN = 10
PIN_NEXT_BTN = 12
class Player(object):
def __init__(sel... | 3.28125 | 3 |
ringmaster/snowflake.py | declarativesystems/ringmaster | 1 | 12771771 | <gh_stars>1-10
# Copyright 2020 Declarative Systems Pty 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 applicabl... | 1.78125 | 2 |
tutorial/tetrix.py | apetcho/pyside6tut | 0 | 12771772 | #!/usr/bin/env python3
"""Tetrix
This is a Qt6 version of the classic Tetrix game.
The object of the game is to stack pieces dropped from the top of the playing
area so that they fill entire rows at the bottom of the playing area.
When a row is filled, all the blocks on that row are removed, the player earns
a numbe... | 3.8125 | 4 |
baseline/sota_semantic_hashing/data_formatting_stterror.py | gcunhase/StackedDeBERT | 32 | 12771773 | import csv
from baseline.base_utils import INTENTION_TAGS_WITH_SPACE
''' Convert .tsv to .csv without header for each intent
Format:
example1 intent1
example2 intent1
...
exampleN intentM
'''
dataset_arr = ['chatbot', 'snips']
dataset_fullname_arr = ['ChatbotCorpus', 'snips']
for tts_stt in ["gtts_witai", "macsay_wi... | 2.9375 | 3 |
kindlerWeb/shelf/migrations/0002_auto_20200517_0052.py | ssanjaysubramaniam/OpenKindlerWeb | 1 | 12771774 | # Generated by Django 3.0.6 on 2020-05-17 00:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shelf', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='clipping',
name='kind_of_clipping',
... | 1.601563 | 2 |
python/testlib/tool_assembler_vasm.py | rmtew/peasauce | 40 | 12771775 | """
Peasauce - interactive disassembler
Copyright (C) 2012-2017 <NAME>
Licensed using the MIT license.
This file is intended to allow compilation of assembler instructions and
from the compiled binary, the ability to isolate the machine code those
instructions produce.
The targeted assembl... | 2.859375 | 3 |
__init__.py | billyfranklim1/twitter-python | 0 | 12771776 | # TWITTER PYTHON
# Copyright 2022 Billyfranklim
# See LICENSE for details.
__version__ = '0.1.0'
__author__ = '<NAME>'
__license__ = 'MIT' | 0.984375 | 1 |
submission/Ugo_utils.py | MattiaMolon/Atari-Pong-RL | 2 | 12771777 | import matplotlib.pyplot as plt
import numpy as np
import random
from collections import namedtuple
def plot_winsratio(
wins: list,
title: str,
start_idx: int = 0,
wsize_mean: int = 100,
wsize_means_mean: int = 1000,
opponent_update_idxs=None,
):
"""Winrate plotting function, plots both a ... | 3.484375 | 3 |
lintcode/586.py | jianershi/algorithm | 1 | 12771778 | <filename>lintcode/586.py
"""
586. Sqrt(x) II
Implement double sqrt(double x) and x >= 0.
Compute and return the square root of x.
You do not care about the accuracy of the result, we will help you to output results.
binary search?
by result?
"""
class Solution:
"""
@param x: a double
@return: the squar... | 4.1875 | 4 |
Female_Health_Analysis/Female_Health_Analysis/__init__.py | danielschulz/Female_Health_Analysis | 1 | 12771779 | <filename>Female_Health_Analysis/Female_Health_Analysis/__init__.py
"""Top-level package for Female Health Analysis."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 1.070313 | 1 |
src/prg_state_ctrl.py | ccarr66/handwriting_gui | 0 | 12771780 | <reponame>ccarr66/handwriting_gui
import sys, os, platform
import ocr_image_analyzer as OCR
try:
import PIL.Image
import PIL.ImageTk
except ModuleNotFoundError:
print('Required libraries not found, please install PIL')
if __name__ == "__main__":
raise Exception('Cannot be called as main script... | 2.71875 | 3 |
Python/shortest-distance-to-target-color.py | RideGreg/LeetCode | 1 | 12771781 | <gh_stars>1-10
# Time: O(n)
# Space: O(n)
# 1182 biweekly contest 8 9/7/2019
# You are given an array colors, in which there are three colors: 1, 2 and 3.
#
# You are also given some queries. Each query consists of two integers i and c, return the shortest distance
# between the given index i and the target color c.... | 3.578125 | 4 |
Castessoft_Python/Castessoft_Fund01.py | JuanDiegoCastellanos/All-in-one-Python-Full | 1 | 12771782 | <filename>Castessoft_Python/Castessoft_Fund01.py
# def print_hi(name):
# print(f'Hi, {name}')
# if __name__ == '__main__':
# print_hi('PyCharm')
print("Hello World Python xd")
# Para saber la direccion de memoria de cierta variable se usa el metodo id()
name = "<NAME>"
print(name)
print(id(name))
print("------... | 3.75 | 4 |
kanmail/server/mail/oauth_settings.py | frznvm0/Kanmail | 1,118 | 12771783 | <reponame>frznvm0/Kanmail
from kanmail.settings.hidden import get_hidden_value
OAUTH_PROVIDERS = {
'gmail': {
'auth_endpoint': 'https://accounts.google.com/o/oauth2/auth',
'token_endpoint': 'https://accounts.google.com/o/oauth2/token',
'profile_endpoint': 'https://www.googleapis.com/userin... | 1.476563 | 1 |
foxtail/clinics/models.py | scottbarnes/foxtail | 5 | 12771784 | <reponame>scottbarnes/foxtail<filename>foxtail/clinics/models.py
""" foxtail/clinics/models.py """
from datetime import datetime
from django.contrib.auth import get_user_model
from django.db import models
from model_utils.models import TimeStampedModel
from guardian.shortcuts import get_objects_for_group
from foxtail... | 2.46875 | 2 |
mp3treesim/__main__.py | michelezoncheddu/mp3treesim | 1 | 12771785 | import mp3treesim as mp3
import argparse
def main():
parser = argparse.ArgumentParser(
description='mp3treesim', # TODO: fix this
add_help=True)
parser.add_argument('trees', metavar='TREE', nargs=2,
help='Paths to the trees')
group_mode = parser.add_mutually_excl... | 3.09375 | 3 |
RestAdm/apps/system/migrations/0019_auto_20200704_0022.py | xeroCBW/testmodel | 0 | 12771786 | # Generated by Django 2.2.5 on 2020-07-04 00:22
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('system', '0018_auto_20200703_2354'),
]
operations = [
migrations.AddField(
model_name='role',
name='code... | 1.703125 | 2 |
modules.py | thu-spmi/LABES | 14 | 12771787 | <reponame>thu-spmi/LABES
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from config import global_config as cfg
def cuda_(var):
return var.cuda() if cfg.cuda else var
def get_one_hot_input(input_t, v_dim=None):
"""
word index sequ... | 2.5 | 2 |
tp2/src/grid.py | ha2398/robotica-movel | 2 | 12771788 | <reponame>ha2398/robotica-movel<filename>tp2/src/grid.py
#!/usr/bin/env python2
'''
@author: <NAME>
Class Grid models the robot environment as a grid of cells.
'''
from nav_msgs.msg import OccupancyGrid
from scipy import ndimage
import numpy as np
import rospy
class Grid:
# Constants
OUTPUT_NAME = 'map.p... | 2.828125 | 3 |
eventstore_grpc/constants.py | jmshnds/eventstore_grpc | 6 | 12771789 | """
Shared constant values.
"""
"""
## Handling Concurrency.
When appending events to a stream, you can supply a
*stream state* or *stream revision*. Your client can
use this to tell EventStoreDB what state or version
you expect the stream to be in when you append. If the
stream isn't in that state the an exception wi... | 1.914063 | 2 |
buildVars.py | bingen13/unspokenPy3 | 2 | 12771790 | from pathlib import Path
_ = lambda x : x
addon_info = {
"addon_name" : "unspokenPy3",
"addon_summary" : _("Unspoken"),
"addon_description" : _("""Removes names label from object like, link, button. It plays different sounds instead of labels."""),
"addon_version" : "0.4",
"addon_author" : u", Sean (ported py... | 1.742188 | 2 |
applications/zcomx/private/bin/process_activity_logs.py | zcomx/zco.mx | 0 | 12771791 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
process_activity_logs.py
Script to process activity_log records.
* Create activity_log records from tentative_activity_log records.
* Delete tentative_activity_log records converted thus.
"""
import sys
import traceback
from optparse import OptionParser
from applicat... | 2.703125 | 3 |
Command/exercise.py | NachoCP/python-design-patterns | 0 | 12771792 | <filename>Command/exercise.py
import unittest
from enum import Enum
class Command:
class Action(Enum):
DEPOSIT = 0
WITHDRAW = 1
def __init__(self, action, amount):
self.action = action
self.amount = amount
self.success = False
class Account:
def __init__(self, ba... | 3.640625 | 4 |
app.py | vidyadharmestry/magnet_chatbot | 0 | 12771793 | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
import cx_Oracle
install_aliases()
import json
import os
import sys
import pandas as pd
sys.path.append('cognitiveSQL')
from flask import Flask,session
from flask import request
from flask import make_respon... | 2.140625 | 2 |
src/skallel_tensor/test/test_variants_dataframe.py | alimanfoo/skallel-tensor | 2 | 12771794 | <gh_stars>1-10
import zarr
import numpy as np
from numpy.testing import assert_array_equal
import pandas as pd
import dask.dataframe as dd
import pytest
from skallel_tensor.api import variants_to_dataframe
def setup_variants_numpy():
variants = dict()
variants["ID"] = np.array(["RS1", "RS3", "RS9", "RS11"])
... | 2.140625 | 2 |
Python/geocoding/leaflet map/geocod_script.py | fugrusha/blackhole | 0 | 12771795 | <filename>Python/geocoding/leaflet map/geocod_script.py
from arcgis.gis import GIS
from arcgis.geocoding import batch_geocode
import pandas as pd
import csv
from time import sleep
# login to ARCGIS
gis = GIS("http://www.arcgis.com", "fugrusha", "NiWhuBTtRrFqk3X")
#File location
input_file = input('Enter the name of ... | 3.0625 | 3 |
rest_auth/__init__.py | lordpeara/django-rest-auth | 1 | 12771796 | <filename>rest_auth/__init__.py
"""
Django Rest Framework Auth provides very simple & quick way to adopt
authentication APIs' to your django project.
Rationale
---------
django-rest-framework's `Serializer` is nice idea for detaching
business logic from view functions. It's very similar to django's
``Form``, but ser... | 2.5 | 2 |
run.py | capralifecycle/office-games-client | 0 | 12771797 | <gh_stars>0
#!/usr/bin/python
import sys
import os
from clint.arguments import Args
from commands.backup import backup
from commands.check_player_statistics import check_player_statistics
from commands.start import start
AVAILABLE_COMMANDS = [
'backup',
'check_player_statistics',
'recalculate_player_ratin... | 2.46875 | 2 |
import_handler.py | LucidumInc/update-manager | 0 | 12771798 | import sys
import os
from loguru import logger
from config_handler import get_mongo_config
from docker_service import create_archive, get_docker_container
from exceptions import AppError
class MongoImportRunner:
container_dest_dir = "/home"
def __call__(self, source, destination):
container = get_d... | 2.234375 | 2 |
src/graph.py | manucordova/ProbAsn | 6 | 12771799 | ####################################################################################################
### ###
### Functions for graph handling (creation, ...) ###
### ... | 2.84375 | 3 |
example.py | arjd/aio-peewee | 9 | 12771800 | <gh_stars>1-10
"""Example application
Requirements:
asgi-tools
uvicorn
Run the example with uvicorn:
$ uvicorn --port 5000 example:app
"""
import datetime as dt
from asgi_tools import App
from aiopeewee import PeeweeASGIPlugin
import peewee as pw
db = PeeweeASGIPlugin(url='sqlite+async:///db.sqlite'... | 2.734375 | 3 |
portals/wwits/groups/access/function_authorize_list/models.py | jalanb/portals | 0 | 12771801 | from dataclasses import dataclass
from typing import List
from portals.wwits.mixins import WWITSBaseMixin
@dataclass
class ParmModel:
Version: str
Env: str
UserID: str
Session: int
Source: str
RC: int
ResultMsg: str
@dataclass
class FunctionModel(WWITSBaseMixin):
FunctionName: str
... | 2.109375 | 2 |
ocs_ci/utility/workloads/fio.py | zmc/ocs-ci | 0 | 12771802 | """
This module implements all the functionalities required for setting up and
running Fio workloads on the pods.
This module implements few functions
setup(): for setting up fio utility on the pod and any necessary
environmental params.
run(): for running fio on pod on specified mount point
Note: The above menti... | 2.390625 | 2 |
alembic/versions/6458bd3b46dc_add_pending_flag.py | evz/budget | 1 | 12771803 | """Add pending flag
Revision ID: 6458bd3b46dc
Revises: <PASSWORD>
Create Date: 2017-11-26 07:32:09.814699
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### comm... | 1.335938 | 1 |
extra_models.py | vincnt/tcn-audio-fx | 0 | 12771804 | <reponame>vincnt/tcn-audio-fx
import torch
import torch.nn as nn
from models import BaseTCN, TCN, CausalConv1d, _conv_stack
from model_utilities import GatedActivation
class OutputcoderTCN(TCN):
def __init__(self, num_channels, dilation_depth, num_repeat, kernel_size=2, dilation_factor=2, conditioning=False, num_... | 2.15625 | 2 |
bumblebee_status/modules/contrib/http_status.py | rosalogia/bumblebee-status | 1,089 | 12771805 | # pylint: disable=C0111,R0903
"""Display HTTP status code
Parameters:
* http__status.label: Prefix label (optional)
* http__status.target: Target to retrieve the HTTP status from
* http__status.expect: Expected HTTP status
contributed by `valkheim <https://github.com/valkheim>`_ - many thanks!
"""
from ... | 2.6875 | 3 |
aristotle/__main__.py | secureworks/aristotle | 12 | 12771806 | from .aristotle import main as aristotle_main
aristotle_main()
| 1.085938 | 1 |
spike/backends/x86_32/__init__.py | spikeio/lang | 1 | 12771807 | <filename>spike/backends/x86_32/__init__.py<gh_stars>1-10
from CodeGenerator import CodeGenerator
| 1.234375 | 1 |
{{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/service_layer.py | gbozee/api-scaffold | 0 | 12771808 | import jwt
from {{cookiecutter.project_slug}} import types, settings
async def verify_access_token(bearer_token, **kwargs) -> types.AuthorizedUser:
init = jwt.decode(bearer_token, verify=False)
if "aud" in init:
decoded_value = decode_access_token(bearer_token, audience=init["aud"][0])
else:... | 2.296875 | 2 |
examples/commandline.py | eronde/vim_suggest | 0 | 12771809 | """commandline.
Usage:
commandline.py lookup --lang=<lang> --word=<preword> [--ip=<redis-ip>] [--port=<redis-port>]
commandline.py -h | --help
Options:
-h --help Show this screen.
--lang=<lang> Language of suggested word.
--word=<preword> Pre-word of suggested word.
--ip=<rediis-i... | 3.171875 | 3 |
service/tests/__init__.py | tuub/jper | 2 | 12771810 | <reponame>tuub/jper<filename>service/tests/__init__.py<gh_stars>1-10
"""
This module contains all of the system tests and associated fixtures
"""
| 1.21875 | 1 |
safetylinespackage/__init__.py | MCasteras/safetylinespackage | 0 | 12771811 |
import json
import numpy as np
from sklearn.datasets import make_classification, make_regression
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, ac... | 1.632813 | 2 |
SEIP/Segmentation.py | seip-tool/seip | 0 | 12771812 | <reponame>seip-tool/seip
import numpy as np
import pandas as pd
from multiprocessing import Process, Queue, current_process, freeze_support, cpu_count
from NW import NW
from DTW import DTW
from utils import *
class Segmentation(object):
def __init__(self, executor, cpu = 0):
self.mode = type(executor)... | 2.4375 | 2 |
src_old/tests/scripts/inprogress/itertools/ex3.py | toddrme2178/pyccel | 0 | 12771813 | <gh_stars>0
# coding: utf-8
from pyccel.stdlib.parallel.openmp import omp_get_thread_num
#$ header class StopIteration(public, hide)
#$ header method __init__(StopIteration)
#$ header method __del__(StopIteration)
class StopIteration(object):
def __init__(self):
pass
def __del__(self):
pass
... | 2.65625 | 3 |
language/syntax/_syntax/tests/test_expr.py | jedhsu/language | 0 | 12771814 | from ...symbol.symbol import Symbol
from ..expr import Atom, ForwardIs, Option, Seq, ZeroOrMore, _Expr, _Expr_, _Op_
class Test_Op_:
def test_sequence(self):
...
class TestAtom:
def test_init(self):
expr = Atom(Symbol("A"))
def test_mro(self):
expr = Atom(Symbol("A"))
a... | 2.796875 | 3 |
tests/test_background_loader.py | pjeanjean/dakara-player | 0 | 12771815 | <filename>tests/test_background_loader.py
from unittest import TestCase
from unittest.mock import call, patch
from path import Path
from dakara_player_vlc.background_loader import (
BackgroundLoader,
BackgroundNotFoundError,
)
class BackgroundLoaderTestCase(TestCase):
"""Test the loader for backgrounds
... | 2.8125 | 3 |
model.py | EST09/cross-modal-autoencoders | 20 | 12771816 | import torch
import torch.nn as nn
from torch.autograd import Variable
# adapted from pytorch/examples/vae and ethanluoyc/pytorch-vae
class ImageClassifier(nn.Module):
def __init__(self, latent_variable_size, pretrained, nout=2):
super(ImageClassifier, self).__init__()
self.latent_variable_size =... | 2.734375 | 3 |
op/dataDraw/demo_data_funnel.py | RustFisher/python-playground | 2 | 12771817 | <gh_stars>1-10
from openpyxl import load_workbook
from pyecharts.charts import Funnel
import pyecharts.options as opts
def read_in_data(file_path):
print('获取原始数据 >>>')
wb = load_workbook(file_path)
st = wb['data3']
data_list = []
for row_index in range(2, st.max_row + 1):
event_name = st.c... | 2.90625 | 3 |
python_fishc/48.0.py | iisdd/Courses | 1 | 12771818 | <reponame>iisdd/Courses
'''
0. 用 while 语句实现与以下 for 语句相同的功能:
for each in range(5):
print(each)
'''
r = iter(range(5))
while 1:
try:
each = next(r)
except StopIteration:
break
print(each)
| 3.421875 | 3 |
MultiCal.py | ZiadHatab/multiline-trl-calibration | 0 | 12771819 | <filename>MultiCal.py
# -*- coding: utf-8 -*-
"""
@author: <NAME> (<EMAIL>)
This is an implementation of the MultiCal multiline TRL calibration algorithm
discussed in [1]. The original algorithm is from [2].
Some concerns regarding [1]:
1. on page 139, the paragraph after Eq. (11). It says that "MultiCal... | 2.3125 | 2 |
test.py | linzhiming0826/ADSL | 6 | 12771820 | import urllib2
proxies = {"http": "192.168.3.11:6666"}
proxy_s = urllib2.ProxyHandler(proxies)
opener = urllib2.build_opener(proxy_s)
urllib2.install_opener(opener)
content = urllib2.urlopen('http://wwww.baidu.com').read()
print content
| 2.59375 | 3 |
flixed_django/flixedREST/admin.py | nilesh1168/flixed-movie-tracker | 0 | 12771821 | <reponame>nilesh1168/flixed-movie-tracker
from django.contrib import admin
# Register your models here.
from .models import WatchList
from .models import WatchedMovie
admin.site.register(WatchList)
admin.site.register(WatchedMovie)
| 1.320313 | 1 |
ECE650-system-programming/HW4_db/hw4_django_orm/app_homepage/apps.py | yo1995/cht_Duke_courses | 8 | 12771822 | <filename>ECE650-system-programming/HW4_db/hw4_django_orm/app_homepage/apps.py<gh_stars>1-10
from django.apps import AppConfig
class AppHomepageConfig(AppConfig):
name = 'app_homepage'
| 1.195313 | 1 |
Python32/alice.py | andersonsilvade/python_C | 0 | 12771823 | import string
texto = open('alice.txt').read().lower()
for c in string.punctuation:
texto = texto.replace(c, ' ')
palavras = texto.split()
wc = {}
for p in palavras:
if p in wc:
wc[p] += 1
else:
wc[p] = 1
def contador(dupla):
return dupla[1]
duplas = sorted(wc.items(), key=contador... | 3.140625 | 3 |
utils/drift_diffusion_analysis.py | ClaraKuper/VVSS2021 | 0 | 12771824 | <filename>utils/drift_diffusion_analysis.py
import pandas as pd
import numpy as np
import pickle
import os
from ddm import Fittable, Model, Sample, Bound
from ddm.models import LossRobustBIC, DriftConstant, NoiseConstant, BoundConstant, OverlayNonDecision, Drift
from ddm.functions import fit_adjust_model, display_mode... | 2.703125 | 3 |
MT_2018_PPGIA/AULA_05_06/LE_04/resolutions/k-nn/pre-processing-001.py | MWTA/Text-Mining | 0 | 12771825 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Software: Pre-Processing-01
Description:
- Processa todos arquivos, dos diretórios neg_ e pos_ do dataset que contem os registros
já separados em arquivos .TXT;
- Converte todos para caracteres minusculos;
- Remove carac... | 2.78125 | 3 |
circuitpython/sparkfun_alphanumeric_ex1.py | thess/qwiic_alphanumeric_py | 4 | 12771826 | <reponame>thess/qwiic_alphanumeric_py<filename>circuitpython/sparkfun_alphanumeric_ex1.py
#!/usr/bin/python3
# CircuitPython version
# Basic example of setting digits on a LED segment display.
# This example and library is meant to work with the Sparkfun qwiic_alphanumeric display.
# Author: <NAME>
# License: Public ... | 3.46875 | 3 |
grok/knowledge_transfer.py | arpitvaghela/grok | 0 | 12771827 | import torch as th
from copy import deepcopy
def knowledge_transfer(net2: th.nn.Module, old_state_path: str):
print(f"Copied weights from {old_state_path}")
net1 = th.load(old_state_path)
old_state = net1.state_dict()
n_layers_old = net1.transformer.n_layers
n_head_old = net1.transformer.n_heads
... | 2.1875 | 2 |
widget.py | wangzqzero/calculator | 0 | 12771828 | ## This Python file uses the following encoding: utf-8
from PyQt5.QtWidgets import *
from mainwindow import MainWindow
from call_standard import StandardPageWindow
import sys
if __name__ == '__main__':
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
| 1.671875 | 2 |
9 - statistical thinking in python - part 2/case study/4 - Hypothesis test: Are beaks deeper in 2012?.py | Baidaly/datacamp-samples | 0 | 12771829 | '''
Your plot of the ECDF and determination of the confidence interval make it pretty clear that the beaks of G. scandens on Daphne Major have gotten deeper. But is it possible that this effect is just due to random chance? In other words, what is the probability that we would get the observed difference in mean beak d... | 2.78125 | 3 |
moi/menu/migrations/0001_initial.py | Ecotrust/F2S-MOI | 0 | 12771830 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-21 06:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0023_alter_page_revision_... | 1.75 | 2 |
test/integration/src/py/test_ebrelayer_restart.py | salahgapr5/snif | 0 | 12771831 | import copy
import json
import logging
import time
import pytest
import test_utilities
from pytest_utilities import create_new_sifaddr
from pytest_utilities import generate_test_account, generate_minimal_test_account
from test_utilities import EthereumToSifchainTransferRequest
def test_ebrelayer_restart(
ba... | 1.90625 | 2 |
iwg_blog/taskapp/__init__.py | razortheory/who-iwg-webapp | 0 | 12771832 | <gh_stars>0
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
if not settings.configured:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.dev')
app = Celery('iwg_blog')
app.config_from_object('django.conf:settings')
app.autodiscover_t... | 1.710938 | 2 |
setup.py | stuart-nolan/mpdb | 0 | 12771833 | import setuptools
import os, sys
sys.path.append(os.getcwd())
import mpdb
with open("README.md", "r") as fh:
long_description = fh.read()
try:
from Cython.Build import cythonize
cem = cythonize("mpdb/eq/*.pyx")
except:
cem = []
setuptools.setup(
author="<NAME>",
author_email="<EMAIL>",
cl... | 1.609375 | 2 |
resources/Wireshark/WiresharkDissectorFoo/tools/generate-nl80211-fields.py | joshis1/C_Programming | 2 | 12771834 | #!/usr/bin/env python
# Parses the nl80211.h interface and generate appropriate enums and fields
# (value_string) for packet-netlink-nl80211.c
#
# Copyright (c) 2017, <NAME> <<EMAIL>>
# Copyright (c) 2018, <NAME> <<EMAIL>>
#
# Wireshark - Network traffic analyzer
# By Ger<NAME> <<EMAIL>>
# Copyright 1998 Gerald Combs
#... | 2.203125 | 2 |
project/number.py | rainbowhuanguw/electionguard-SDK | 0 | 12771835 | <gh_stars>0
import random
import hashlib
from typing import (
Sequence
)
LARGE_PRIME = (int(('''104438888141315250669175271071662438257996424904738378038423348328
3953907971553643537729993126875883902173634017777416360502926082946377942955704498
542097614841825246773580689398386320439747911160897731551074903967243... | 1.640625 | 2 |
app/core/migrations/0002_auto_20200610_1443.py | Amirh-zahmatkesh/acc-back | 0 | 12771836 | # Generated by Django 3.0.6 on 2020-06-10 14:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0001_initial'),
... | 1.6875 | 2 |
server.py | theSage21/evo-site | 2 | 12771837 | import bottle
from genetic import GA
ga = GA()
app = bottle.Bottle()
@app.get('/')
def home():
data = ga.get_data()
return bottle.template('home.html', **data)
@app.get('/mark-hit/<ident>')
def mark_hit(ident):
ga.mark_hit(ident)
if __name__ == '__main__':
app.run(debug=True)
| 1.96875 | 2 |
flod_sak/documents/epost/tilskudd_emails.py | Trondheim-kommune/Tilskuddsbasen | 0 | 12771838 | <gh_stars>0
# -*- coding: utf-8 -*-
import urllib
from flask import render_template, current_app, request
from celery import Celery
from flask.ext.restful.representations import json
from api import SoknaderFilterResource
from api.auth import get_user_by_id, get_organisation, get_person
from statemachine.soknad_sm im... | 1.867188 | 2 |
lab_2/start.py | shmaginadi/2020-2-level-labs | 0 | 12771839 | <gh_stars>0
"""
Longest common subsequence implementation starter
"""
from lab_2 import main
if __name__ == "__main__":
original_text = '''The horse is running.
It is fast.'''
second_text = '''The cow is eating.
It is slow.'''
original_tokens = main.tokenize_by_lines(original_text)
pri... | 2.984375 | 3 |
controller/front_controller.py | jvpersuhn/Certo | 0 | 12771840 | <gh_stars>0
from dao.front_dao import FrontDao, FrontEnd
class FrontController:
def __init__(self):
self.dao = FrontDao()
def select_all(self):
lista = self.dao.select_all()
lista_retorno = []
for b in lista:
ba = FrontEnd(b[0], b[1], b[2], b[3])
... | 2.4375 | 2 |
tests/test_doctests.py | doranid/pottery | 0 | 12771841 | <filename>tests/test_doctests.py
# --------------------------------------------------------------------------- #
# test_doctests.py #
# #
# Copyright © 2015-2021, <NAME>, original aut... | 2.5 | 2 |
netbox/extras/management/commands/runscript.py | markkuleinio/netbox | 0 | 12771842 | <filename>netbox/extras/management/commands/runscript.py<gh_stars>0
import json
import logging
import sys
import traceback
import uuid
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand, CommandError
from django.db ... | 2.03125 | 2 |
cabby/evals/utils_test.py | googleinterns/cabby | 2 | 12771843 | <filename>cabby/evals/utils_test.py<gh_stars>1-10
# coding=utf-8
# Copyright 2020 Google LLC
# 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.53125 | 3 |
python/slack_types/rtm_api/reaction_removed_event.py | warrenseine/slack-types | 0 | 12771844 | <filename>python/slack_types/rtm_api/reaction_removed_event.py<gh_stars>0
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = reaction_removed_event_from_dict(json.loads(json_string))
from dataclasses import dataclass
from typing import Optional, Any, ... | 2.515625 | 3 |
files/p2_metodo_nuevo.py | ce-box/CE3102-CALC_FX | 0 | 12771845 | from sympy import sympify, Symbol
x = Symbol('x') #Se comvierte la variable a simbolico
#Funcion principal del metodo
def metodo_nuevo(x_0, f, tol, iter_max):
if tol <= 0:
raise ValueError('Tolerancia no debe ser cero.') #Error al ingresar una tolerancia con las condiones no aptas
f = sympify(f)
... | 3.515625 | 4 |
dcd_traj_SaltDistribution.py | naotohori/cafysis | 2 | 12771846 | <reponame>naotohori/cafysis
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2015/06/03
@author: <NAME>
'''
import sys
import math
import numpy as np
from cafysis.lib_f2py import py_distance2_hist
from cafysis.file_io.dcd import DcdFile
from cafysis.file_io.psf import PsfFile
if len(sys.argv) != 4:
pri... | 2.125 | 2 |
nlp-scripts/word-counts.py | aJns/CS574_NLP | 0 | 12771847 | <filename>nlp-scripts/word-counts.py
import nltk
import csv
import os
data_dir = "../project-data"
def get_word_count(file_path):
tokens = list()
with open(file_path, 'r') as f:
try:
text = f.read()
tokenizer = nltk.tokenize.RegexpTokenizer(r'\w+')
tokens = tokeniz... | 3.296875 | 3 |
looking_for_group/gamer_profiles/migrations/0005_auto_20180705_1559.py | andrlik/looking-for-group | 0 | 12771848 | <filename>looking_for_group/gamer_profiles/migrations/0005_auto_20180705_1559.py
# Generated by Django 2.0.7 on 2018-07-05 19:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gamer_profiles', '0004_gamerprofile_private'),
]
operations = [
... | 1.601563 | 2 |
test/python/TestRFileWrites.py | BuildJet/sharkbite | 30 | 12771849 | from testmodule import *
class TestRFileWrites(TestRunner):
def __init__(self):
parser = ArgumentParser(description="This is an Apache Accummulo Python connector")
parser.add_argument("-i", "--instance", dest="instance",
help="Apache Accumulo Instance Name", required=True)
parser.add_argument("-z", "... | 2.6875 | 3 |
utils.py | satyenrajpal/speed-prediction-challenge | 5 | 12771850 | import numpy as np
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import matplotlib.ticker as ticker
def movingAverage(x, window):
ret = np.zeros_like(x)
for i in range(len(x)):
idx1 = max(0, i - (window - 1) // 2)
idx2 = min(len(x), i + (window - 1) // 2 + (2 - (window % 2)))
... | 3.296875 | 3 |