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 |
|---|---|---|---|---|---|---|
tests/test_formatter.py | hbraux/kafkacli | 0 | 3700 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pytest
import json
from kafkacli.formatter import Formatter
sampleJson = json.loads('{"a":"s", "b":1}')
def test_print_default(capsys):
Formatter().print(sampleJson)
captured = capsys.readouterr()
assert captured.out == '{"a": "s", "b": 1}\n... | 2.40625 | 2 |
src/jobs/forms.py | arc198/DJANGO-JOB-SITE | 20 | 3701 | from django import forms
from .models import Application
class ApplicationForm(forms.ModelForm):
class Meta:
model = Application
fields = ('resume', 'cover_letter',) | 1.820313 | 2 |
src/test/tests/unit/protocol.py | ylee88/visit | 1 | 3702 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: protocolo.py
#
# Tests: vistprotocol unit test
#
# <NAME>, Tue Jan 11 10:19:23 PST 2011
# ----------------------------------------------------------------------------
tapp = visit_bin_path("visitpr... | 2.09375 | 2 |
pyMazeBacktrack.py | Dozed12/pyMazeBacktrack | 2 | 3703 | import libtcodpy as libtcod
from random import randint
nSquares = 30
nTiles = nSquares * 2 + 1
SCREEN_WIDTH = nTiles
SCREEN_HEIGHT = nTiles
libtcod.console_set_custom_font("cp437_12x12.png", libtcod.FONT_LAYOUT_ASCII_INROW)
libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'pyMazeBacktrack', False, li... | 2.5625 | 3 |
source/tests/test_resources.py | aws-solutions/maintaining-personalized-experiences-with-machine-learning | 6 | 3704 | <gh_stars>1-10
# ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 1.570313 | 2 |
gradefiles-send.py | lapets/bu-gsubmit-grading | 3 | 3705 | #####################################################################
##
## gradefiles-send.py
##
## Script to send grade files by email to enrolled students; the
## input grade file names should correspond to the user names of
## the students.
##
##
from email.mime.text import MIMEText # For creating a message... | 3.328125 | 3 |
Publisher/PGGAN-1024 trained on CelebaHQ/2-exporter.py | GalAster/16 | 3 | 3706 | <filename>Publisher/PGGAN-1024 trained on CelebaHQ/2-exporter.py<gh_stars>1-10
import os
import pickle
import tensorflow as tf
import wolframclient.serializers as wxf
name = 'karras2018iclr-celebahq-1024x1024'
file = open(name + '.pkl', 'rb')
sess = tf.InteractiveSession()
G, D, Gs = pickle.load(file)
saver = tf.train... | 2.046875 | 2 |
src/moveGoogle.py | Quanta-Robotics/Robot-Blueberry | 25 | 3707 | #!/usr/bin/env python
import os
import os.path
import yaml
import time
import random
import multiprocessing
import RPi.GPIO as GPIO
from talk import say
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
from adafruit_servokit import ServoKit
Motor1 = {'EN': 27, 'input1': 19, 'input2': 16}
Motor2 = {'EN': 22, 'input1': 2... | 2.28125 | 2 |
src/onegov/translator_directory/models/language.py | politbuero-kampagnen/onegov-cloud | 0 | 3708 | from uuid import uuid4
from sqlalchemy import Index, Column, Text, Table, ForeignKey
from sqlalchemy.orm import object_session
from onegov.core.orm import Base
from onegov.core.orm.types import UUID
spoken_association_table = Table(
'spoken_lang_association',
Base.metadata,
Column(
'translator_i... | 2.515625 | 3 |
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py | djemeljanovs/tfjs | 0 | 3709 | <gh_stars>0
# Copyright 2019 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
#
# Unless required by applicable law or agreed to i... | 2.125 | 2 |
loss_fn/classification_loss_fns/binary_cross_entropy.py | apple/ml-cvnets | 209 | 3710 | <filename>loss_fn/classification_loss_fns/binary_cross_entropy.py
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch.nn import functional as F
from torch import Tensor
import argparse
from . import register_classification_loss_fn
from .. import BaseCrite... | 2.3125 | 2 |
Sorting/insertion_sort.py | lakshyarawal/pythonPractice | 0 | 3711 | <filename>Sorting/insertion_sort.py
""" Insertion Sort Algorithm:"""
"""Implementation"""
def insertion_sort(arr) -> list:
n = len(arr)
for i in range(1, n):
swap_index = i
for j in range(i-1, -1, -1):
if arr[swap_index] < arr[j]:
arr[swap_index], arr[j] = arr[j],... | 4.25 | 4 |
nipype/interfaces/spm/__init__.py | felixsc1/nipype | 8 | 3712 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Top-level namespace for spm."""
from .base import (Info, SPMCommand, logger, no_spm, scans_for_fname,
scans_for_fnames)
from .preprocess import ... | 1.40625 | 1 |
network.py | tobloef/neural-network | 3 | 3713 | <reponame>tobloef/neural-network<filename>network.py
import numpy as np
from mathUtils import *
class Network(object):
"""
Model for a feedforward Neural Network that use backpropagation with stochastic gradient decent.
"""
def __init__(self, layerSizes, biasVectors, weightMatrices):
"""
... | 3.8125 | 4 |
examples/airflow/dags/etl_orders_7_days.py | phixMe/marquez | 0 | 3714 | <reponame>phixMe/marquez
from datetime import datetime
from marquez_airflow import DAG
from airflow.operators.postgres_operator import PostgresOperator
from airflow.utils.dates import days_ago
default_args = {
'owner': 'datascience',
'depends_on_past': False,
'start_date': days_ago(1),
'email_on_failur... | 2.25 | 2 |
sample/pizza.py | marianarmorgado/python-starter | 0 | 3715 | <filename>sample/pizza.py
# store information about a pizza being ordered
pizza = {
'crust': 'thick',
'toppings': ['mushrooms', 'extra vegan cheese']
}
# summarize the order
print("You ordered a " + pizza['crust'] + "-crust pizza" +
"with the following toppings:")
for topping in pizza['toppings']:
pr... | 4.03125 | 4 |
YouTube/CursoEmVideo/python/ex012.py | Fh-Shadow/Progamando | 0 | 3716 | <filename>YouTube/CursoEmVideo/python/ex012.py<gh_stars>0
a = float(input('Qual é o preço do produto? R$'))
d = a - (a * 23 / 100)
print('O produto que custava R${:.2f}, na promoção de 23% de desconto vai custar: R${:.2f}' .format(a, d))
| 3.515625 | 4 |
dnnlib/submission/submit.py | gperdrizet/gansformer | 1,172 | 3717 | <reponame>gperdrizet/gansformer
# Submit a function to be run either locally or in a computing cluster.
# Compared to original StyleGAN implementation, we extend the support for automatic training resumption,
# and network recompilation.
import copy
import inspect
import os
import pathlib
import pickle
import platform
... | 2.125 | 2 |
pyecharts/custom/grid.py | zilong305/pycharts | 0 | 3718 | <gh_stars>0
#!/usr/bin/env python
# coding=utf-8
from pyecharts.option import grid
class Grid(object):
def __init__(self):
self._chart = None
self._js_dependencies = set()
def add(self, chart,
grid_width=None,
grid_height=None,
grid_top=None,
... | 2.375 | 2 |
smooch/conversations.py | devinmcgloin/smooch | 3 | 3719 | import logging
from .endpoint import ask
def send_message(user_id, message, sent_by_maker=True):
if not valid_args(user_id, message):
logging.warning("send message called with invalid args user_id={} message={}".format(user_id, message))
return
logging.debug("Sending message: user_id={0} mes... | 2.484375 | 2 |
cifar/evalit.py | Sharkbyteprojects/IRIS-ML_and_Deep-Learning | 0 | 3720 | <reponame>Sharkbyteprojects/IRIS-ML_and_Deep-Learning<gh_stars>0
import keras
from keras.models import load_model
from PIL import Image
import matplotlib.pylab as plt
import numpy as np
import zipfile
print("Extract")
zip_ref = zipfile.ZipFile("./asset.zip", 'r')
zip_ref.extractall(".")
zip_ref.close()
print("Load Mode... | 2.828125 | 3 |
tt/urls.py | samiksha-patil/Knowledge-Sharing-Platform | 1 | 3721 | """
tt URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... | 2.59375 | 3 |
src/git/cmd.py | danihodovic/dht | 2 | 3722 | import os
import click
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
@click.group()
def git():
pass
| 1.453125 | 1 |
TwitterImage2JPG.py | Tymec/Playground | 0 | 3723 | import glob
import os
def main():
os.chdir("F:/Downloads")
extensions = ["*.jpg_large", "*.png_large", "*.jpg_orig"]
file_list = list()
for extension in extensions:
file_list = file_list + glob.glob(extension)
for file in file_list:
for extension in extensions:
new_ex... | 3.5625 | 4 |
Data Analysis/classification.py | Riccardo95Facchini/DIL-2019 | 0 | 3724 | <filename>Data Analysis/classification.py
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import classification_report
#EVERY TIME THE DATASET IS RETRIEVED FROM GITHUB
input_file = 'https://raw.githubusercontent.com/lcphy/Digital-Innovation-Lab/master/... | 3.40625 | 3 |
tools/c7n_azure/tests/test_route_table.py | anastasiia-zolochevska/cloud-custodian | 2 | 3725 | # Copyright 2015-2018 Capital One Services, 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
#
# Unless required by applicable law or agreed ... | 1.78125 | 2 |
proto/tp_artifact_1.0/build/lib/sawtooth_artifact/processor/handler.py | pkthein/sparts_all_fam | 1 | 3726 | # Copyright 2016 Intel Corporation
# Copyright 2017 Wind River
# 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 applica... | 1.484375 | 1 |
ReviewsCollector.py | fsandx/moodybooks | 0 | 3727 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
STEP 2
Takes the list of urls in the json files and downloads the html files to local drive
Start with: scrapy runspider ReviewsCollector.py
"""
import scrapy
import json
class ReviewsCollector(scrapy.Spider):
def start_requests(self):
with open("data/b... | 3.40625 | 3 |
firelight/interfaces/light.py | roshie548/firelight | 16 | 3728 | <gh_stars>10-100
from abc import ABC, abstractmethod
from .color import Color
class LightSystem(ABC):
@classmethod
def __subclasshook__(cls, subclass):
return (hasattr(subclass, 'set_transition_time')
and callable(subclass.set_transition_time)
and hasattr(subclass, 'dis... | 3 | 3 |
PolymorphismPYTHON/Polypy.py | cadeng23/oop-cjgustafson | 0 | 3729 | <reponame>cadeng23/oop-cjgustafson
import random
class Family:
def __init__(self,first, last, hair):
self.first = first
self.last = last
self.hair = hair
def fullname(self):
return '{} {}'.format(self.first,self.last)
def eyefind(self):
temp = random.choice([1,2... | 3.9375 | 4 |
homeassistant/components/device_tracker/owntracks.py | evancohen/home-assistant | 14 | 3730 | """
homeassistant.components.device_tracker.owntracks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OwnTracks platform for the device tracker.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import json
import logging
im... | 2.28125 | 2 |
src/models/end_to_end_event_coreference.py | luyaojie/E3C | 2 | 3731 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Created by Roger on 2019-09-10
# Mostly by AllenNLP
import logging
import math
from typing import Any, Dict, List, Optional, Tuple
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.mod... | 2 | 2 |
week2/7litersProblem.py | vietanhtran2710/ArtificialIntelligenceHomework | 3 | 3732 | <filename>week2/7litersProblem.py
"""
Given 3 bottles of capacities 3, 5, and 9 liters,
count number of all possible solutions to get 7 liters
"""
current_path = [[0, 0, 0]]
CAPACITIES = (3, 5, 9)
solutions_count = 0
def move_to_new_state(current_state):
global solutions_count, current_path
if 7 in c... | 3.546875 | 4 |
st2common/st2common/bootstrap/rulesregistrar.py | avezraj/st2 | 0 | 3733 | <gh_stars>0
# Copyright 2019 Extreme Networks, 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... | 1.765625 | 2 |
sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py | aiven/azure-sdk-for-python | 1 | 3734 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 1.90625 | 2 |
test/test_simple_compression.py | jayvdb/brotlipy | 0 | 3735 | <reponame>jayvdb/brotlipy
# -*- coding: utf-8 -*-
"""
test_simple_compression
~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for compression of single chunks.
"""
import brotli
import pytest
from hypothesis import given
from hypothesis.strategies import binary, integers, sampled_from, one_of
def test_roundtrip_compression_with_f... | 2.234375 | 2 |
wexapi/models/ticker.py | madmis/wexapi | 3 | 3736 | <filename>wexapi/models/ticker.py
from decimal import Decimal
class Ticker(object):
def __init__(
self,
high: float,
low: float,
avg: float,
vol: float,
vol_cur: int,
last: float,
buy: float,
sell: float,
... | 2.890625 | 3 |
hard-gists/98bb452dc14e8c40e403/snippet.py | jjhenkel/dockerizeme | 21 | 3737 | <filename>hard-gists/98bb452dc14e8c40e403/snippet.py
from scryptos import *
p1 = 32581479300404876772405716877547
p2 = 27038194053540661979045656526063
p3 = 26440615366395242196516853423447
n = p1*p2*p3
e = 3
c = int(open("flag.enc", "rb").read().encode("hex"), 16)
# from User's Guide to PARI/GP, nth_root function
s... | 1.984375 | 2 |
musa/migrations/0001_initial.py | ccsreenidhin/Music-Web-Django | 0 | 3738 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-03-29 06:43
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import musa.models
class Migration(migrations.Migration):
initial = True
depe... | 1.664063 | 2 |
nuitka/codegen/LoopCodes.py | RESP3CT88/Nuitka | 1 | 3739 | # Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 2.015625 | 2 |
3_module/C_BloomFilter.py | L4mborg1n1-D14610/Algoritms_and_DataStructure | 0 | 3740 | import math
from sys import exit
# итак, n - приблизительное число элементов в массиве, P - вероятность ложноположительного ответа, тогда размер
# структуры m = -(nlog2P) / ln2 (2 - основание), количество хеш-функций будет равно -log2P
# хеш-функции используются вида: (((i + 1)*x + p(i+1)) mod M) mod m,где - x - ключ,... | 2.40625 | 2 |
pyzmq/examples/pubsub/subscriber.py | Surfndez/source-publish | 0 | 3741 | """A test that subscribes to NumPy arrays.
Uses REQ/REP (on PUB/SUB socket + 1) to synchronize
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2010 <NAME>
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distr... | 2.625 | 3 |
Doc/includes/sqlite3/load_extension.py | livioso/cpython | 36 | 3742 | import sqlite3
con = sqlite3.connect(":memory:")
# enable extension loading
con.enable_load_extension(True)
# Load the fulltext search extension
con.execute("select load_extension('./fts3.so')")
# alternatively you can load the extension using an API call:
# con.load_extension("./fts3.so")
# disable extension load... | 3.015625 | 3 |
lingvo/core/inference_graph_exporter.py | RunzheYang/lingvo | 1 | 3743 | # Lint as: python3
# Copyright 2018 The TensorFlow 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.617188 | 2 |
src/preprocessing/annual_hc_by_crime_loc.py | VijayKalmath/USCrimeAnalysis | 0 | 3744 | <filename>src/preprocessing/annual_hc_by_crime_loc.py
#! usr/env/bin python
import glob
import numpy as np
import pandas as pd
from tqdm import tqdm
def main():
# Fetch File Paths
file_paths = glob.glob(r'./data/raw/ucr/hc_count_by_place/*.xls')
# Sort them according to year
file_paths.sort(key = lam... | 3.09375 | 3 |
allennlp/tests/modules/token_embedders/bag_of_word_counts_token_embedder_test.py | ethanjperez/allennlp | 24 | 3745 | # pylint: disable=no-self-use,invalid-name
import numpy as np
from numpy.testing import assert_almost_equal
import torch
from allennlp.common import Params
from allennlp.data import Vocabulary
from allennlp.modules.token_embedders import BagOfWordCountsTokenEmbedder
from allennlp.common.testing import AllenNlpTestCase
... | 2.1875 | 2 |
demo/demo_shapenet.py | hengkaiz/meshrcnn | 0 | 3746 | import argparse
import logging
import multiprocessing as mp
import logging
import os
from detectron2.evaluation import inference_context
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from detectron2.utils.collect_env import collect_env_info
from detectron2.utils.logger import setup_lo... | 1.820313 | 2 |
proglearn/voters.py | jshin13/progressive-learning | 0 | 3747 | <gh_stars>0
import numpy as np
# from sklearn.ensemble import BaggingClassifier
# from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.utils.validation import (
check_X_y,
check_array,
NotFittedError,
)
from sklearn.utils.multiclass import check_... | 2.4375 | 2 |
config.py | jhattat/photoBooth | 0 | 3748 | <filename>config.py
# Tumblr Setup
# Replace the values with your information
# OAuth keys can be generated from https://api.tumblr.com/console/calls/user/info
consumer_key='<KEY>' #replace with your key
consumer_secret='<KEY>' #replace with your secret code
oath_token='<KEY>' #replace with your oath token
oath_secret=... | 2.375 | 2 |
accounts/admin.py | GuilhemN/site-interludes | 0 | 3749 | from django.contrib import admin
from django.contrib.auth.models import Group
from accounts.models import EmailUser
from shared.admin import ExportCsvMixin
# no need for groups - we only have regular users and superusers
admin.site.unregister(Group)
@admin.register(EmailUser)
class EmailUserAdmin(ExportCsvMixin, adm... | 2 | 2 |
rotkehlchen/exchanges/coinbase.py | vnavascues/rotki | 0 | 3750 | <reponame>vnavascues/rotki
import hashlib
import hmac
import logging
import time
from json.decoder import JSONDecodeError
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from urllib.parse import urlencode
import requests
from rotkehlchen.assets.asset import Asset
from rotkehlchen.assets.converters ... | 2.140625 | 2 |
lib/python3.7/site-packages/ldap/controls/deref.py | aonrobot/MSC-thug-auth-provider | 1 | 3751 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
ldap.controls.deref - classes for
(see https://tools.ietf.org/html/draft-masarati-ldap-deref)
See https://www.python-ldap.org/ for project details.
"""
__all__ = [
'DEREF_CONTROL_OID',
'DereferenceControl',
]
import ldap.controls
from ldap.controls import LDAPControl,KN... | 1.695313 | 2 |
emoji.py | notagoat/Deepmoji | 1 | 3752 | import requests
import urllib.request
import os.path
import shutil
import csv
def main():
with open("data.csv") as i: #Open the data.csv file
instances = i.readlines() #Write them into memory
instances = [x.strip() for x in instances] #Strip any weird issues from writing
instances.sort() #Sort t... | 3.359375 | 3 |
String/640.One Edit Distance/Solution_DP.py | Zhenye-Na/LxxxCode | 12 | 3753 | class Solution:
"""
@param s: a string
@param t: a string
@return: true if they are both one edit distance apart or false
"""
def isOneEditDistance(self, s, t):
# write your code here
if s == t:
return False
if abs(len(s) - len(t)) > 1:
return Fal... | 3.53125 | 4 |
nsq/__init__.py | jehiah/pynsq | 1 | 3754 | <gh_stars>1-10
from __future__ import absolute_import
import signal
import tornado.ioloop
import logging
from .protocol import (
Error,
unpack_response,
decode_message,
valid_topic_name,
valid_channel_name,
identify,
subscribe,
ready,
finish,
touch,
requeue,
nop,
pu... | 2.0625 | 2 |
scripts/summaryPlot.py | Hespian/ParFastKer | 3 | 3755 | import get_data_ours
import get_data_akiba
import get_data_NearLinear
import get_data_LinearTime
import os
import matplotlib.pyplot as plt
# graphs = ["uk-2002", "arabic-2005", "gsh-2015-tpd", "uk-2005", "it-2004", "sk-2005", "uk-2007-05", "webbase-2001", "asia.osm", "road_usa", "europe.osm", "rgg_n26_s0", "RHG-10000... | 1.945313 | 2 |
bouncer/cli/base.py | lrnt/git-bouncer | 0 | 3756 | <gh_stars>0
import configparser
import sys
import inspect
from argparse import ArgumentParser, RawDescriptionHelpFormatter
def opt(*args, **kwargs):
def decorator(method):
if not hasattr(method, 'options'):
method.options = []
method.options.append((args, kwargs))
return metho... | 2.609375 | 3 |
Examples/ExampleCodes_ssccoorriinngg.py | MahdadJafarzadeh/ssccoorriinngg | 2 | 3757 | <filename>Examples/ExampleCodes_ssccoorriinngg.py
#%% Import libs
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_validate
from sklearn.metrics import make_scorer, accuracy_score, precision_score, recall_score, f1_score
import h5py
import time
from ssccoo... | 2.5 | 2 |
igibson/examples/behavior/behavior_demo_collection.py | suresh-guttikonda/iGibson | 0 | 3758 | <reponame>suresh-guttikonda/iGibson
"""
Main BEHAVIOR demo collection entrypoint
"""
import argparse
import copy
import datetime
import os
import bddl
import numpy as np
import igibson
from igibson.activity.activity_base import iGBEHAVIORActivityInstance
from igibson.render.mesh_renderer.mesh_renderer_cpu import Mes... | 2 | 2 |
wagtail/wagtailadmin/menu.py | digitalmarmalade/wagtail | 1 | 3759 | <gh_stars>1-10
from django.utils.text import slugify
from django.utils.html import format_html
class MenuItem(object):
def __init__(self, label, url, name=None, classnames='', order=1000):
self.label = label
self.url = url
self.classnames = classnames
self.name = (name or slugify(u... | 2.375 | 2 |
django_mfa/migrations/0001_initial.py | timgates42/django-mfa | 0 | 3760 | # Generated by Django 2.1.5 on 2019-03-26 11:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | 1.851563 | 2 |
app/logger_example/main.py | khanh-nguyen-code/my-collection | 0 | 3761 | from my_collection import logger
if __name__ == "__main__":
logger.now().debug("debug1")
logger.now().debug("debug2")
logger.now().info("hello1")
logger.now().info("hello2")
logger.now().with_field("key", "val").error("with field1")
logger.now().with_field("key", "val").error("with field2")
| 2.28125 | 2 |
robotframework_iperf3/__main__.py | scathaig/robotframework-iperf3 | 0 | 3762 | <gh_stars>0
import argparse
from robotremoteserver import RobotRemoteServer
from .iperf3 import Iperf3
if __name__ == '__main__':
# create commandline parser
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.prog = 'python3 -m robotframework_iperf3'
# ad... | 2.59375 | 3 |
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_combine_frames_append_one_as_columns.py | ahmedengu/h2o-3 | 6,098 | 3763 | <filename>h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_combine_frames_append_one_as_columns.py
df8.cbind(df9)
# A B C D A0 B0 C0 D0
# ----- ------ ------ ------ ------ ----- ----- -----
# -0.09 0.944 0.160 0.271 -0.351 1.66 -2.32 -0.86
# -0.95 0.669 0.... | 3.03125 | 3 |
FluentPython/dynamic_attr_and_prop/frozen_json.py | xu6148152/Binea_Python_Project | 0 | 3764 | <gh_stars>0
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from collections import abc
from keyword import iskeyword
class FronzenJSON:
def __init__(self, mapping):
self._data = {}
for key, value in mapping.items():
if iskeyword(key):
key += '_'
# sel... | 2.8125 | 3 |
pomdp_problems/tag/models/transition_model.py | Semanti1/pomdp_findit | 0 | 3765 | <reponame>Semanti1/pomdp_findit
"""The Tag problem. Implemented according to the paper `Anytime Point-Based
Approximations for Large POMDPs <https://arxiv.org/pdf/1110.0027.pdf>`_.
Transition model: the robot moves deterministically. The target's movement
depends on the robot; With Pr=0.8 the target moves away... | 2.40625 | 2 |
packit/fedpkg.py | bocekm/packit | 0 | 3766 | <gh_stars>0
# MIT License
#
# Copyright (c) 2019 Red Hat, Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mo... | 1.742188 | 2 |
tests/test_MaskedArrayCollection.py | ahaldane/NDducktype_tests | 3 | 3767 | #!/usr/bin/env python
from ndarray_ducktypes.ArrayCollection import ArrayCollection
from ndarray_ducktypes.MaskedArray import MaskedArray
from ndarray_ducktypes.MaskedArrayCollection import MaskedArrayCollection
import numpy as np
# Tests for Masked ArrayCollections.
#
# First try: Simply make an arraycollection of Ma... | 3.09375 | 3 |
src/models/text_node.py | moevm/nosql1h19-text-graph | 0 | 3768 | <gh_stars>0
from neomodel import StructuredNode, StringProperty, JSONProperty, \
Relationship, IntegerProperty
import numpy as np
import re
from models.text_relation import TextRelation
__all__ = ['TextNode']
class TextNode(StructuredNode):
order_id = IntegerProperty(required=True, unique_... | 2.390625 | 2 |
tests/test_bishop_generate.py | otaviocarvalho/chess-negamax | 6 | 3769 | import unittest
from .helpers import StubBoard, StubPiece, C, WHITE, BLACK
class TestBishopGenerate(unittest.TestCase):
def get_bishop(self, board, team, position):
from chess.models import Bishop
return Bishop(board, team, position)
def compare_list(self, expected, results):
compared ... | 3 | 3 |
lib/fmdplugins/list_records.py | GonzaloAlvarez/py-ga-sysadmin | 2 | 3770 | from lib.fmd.namedentity import NamedEntity
from lib.fmd.decorators import Action, ListStage, GetStage
from lib.exceptions.workflow import EntryException
@Action(ListStage.DATAGATHERING)
def list_records(context, output):
output = []
if hasattr(context, 'filter'):
context.log.debug('Using filter [%s]'... | 2.125 | 2 |
pysoa/server/action/switched.py | zetahernandez/pysoa | 0 | 3771 | <gh_stars>0
from __future__ import (
absolute_import,
unicode_literals,
)
import abc
import six
from pysoa.server.internal.types import is_switch
__all__ = (
'SwitchedAction',
)
def _len(item):
# Safe length that won't raise an error on values that don't support length
return getattr(item, '_... | 2.53125 | 3 |
Seeder/settings/tests.py | WebarchivCZ/Seeder | 8 | 3772 | from .base import *
SECRET_KEY = 'test'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'sqlite3.db',
'USER': '',
'PASSWO... | 1.46875 | 1 |
blobStore.py | odeke-em/resty | 0 | 3773 | #!/usr/bin/env python3
# Author: <NAME> <<EMAIL>>
# This example steps you through using resty & restAssured to save pickled/serialized
# data as a blob and then later re-using it in after deserialization.
# Sample usage might be in collaborative computing ie publish results from an expensive
# computation on one mach... | 2.96875 | 3 |
venv/Lib/site-packages/dataframe/_dataframe_column_set.py | kavanAdeshara/Expense_Tracker | 0 | 3774 | # dataframe: a data-frame implementation using method piping
#
# Copyright (C) 2016 <NAME>
#
# This file is part of dataframe.
#
# dataframe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | 3.359375 | 3 |
java/image.bzl | Springworks/rules_docker | 0 | 3775 | # Copyright 2017 Google 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
#
# Unless required by applicable law or a... | 1.789063 | 2 |
cupyx/jit/_builtin_funcs.py | khushi-411/cupy | 0 | 3776 | import warnings
import cupy
from cupy_backends.cuda.api import runtime
from cupy.cuda import device
from cupyx.jit import _cuda_types
from cupyx.jit._internal_types import BuiltinFunc
from cupyx.jit._internal_types import Data
from cupyx.jit._internal_types import Constant
from cupyx.jit._internal_types import Range
... | 2.234375 | 2 |
python-basic-grammer/python-basic/02-python-variables-and-string/string_strip_demo.py | jinrunheng/base-of-python | 0 | 3777 | # 字符串删除空白
str1 = " hello "
print(str1)
print(len(str1))
# 去除两端的空格
print(str1.strip())
print(len(str1.strip()))
# 去除左侧的空格
print(str1.lstrip())
print(len(str1.lstrip()))
# 去除右侧的空格
print(str1.rstrip())
print(len(str1.rstrip())) | 3.984375 | 4 |
bruges/util/__init__.py | hyperiongeo/bruges | 0 | 3778 | <filename>bruges/util/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
from .util import rms
from .util import moving_average
from .util import moving_avg_conv
from .util import moving_avg_fft
from .util import normalize
from .util import next_pow2
from .util import top_and_tail
from .util import extrapolate
from .util i... | 1.375 | 1 |
toontown/estate/DistributedHouseDoor.py | CrankySupertoon01/Toontown-2 | 1 | 3779 | <gh_stars>1-10
from toontown.toonbase.ToonBaseGlobal import *
from panda3d.core import *
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import *
from direct.distributed import DistributedObject
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlo... | 1.851563 | 2 |
Neuro-Cognitive Models/Runs/Nonhier_run/res_nonhier.py | AGhaderi/spatial_attenNCM | 0 | 3780 | #!/home/a.ghaderi/.conda/envs/envjm/bin/python
# Model 2
import pystan
import pandas as pd
import numpy as np
import sys
sys.path.append('../../')
import utils
parts = 1
data = utils.get_data() #loading dateset
data = data[data['participant']==parts]
mis = np.where((data['n200lat']<.101)|(data['n200lat']>.... | 2.328125 | 2 |
rq_dashboard/dashboard.py | refgenomics/rq-dashboard | 0 | 3781 | <reponame>refgenomics/rq-dashboard<gh_stars>0
from redis import Redis
from redis import from_url
from rq import push_connection, pop_connection
from rq.job import Job
from functools import wraps
import times
from flask import Blueprint
from flask import current_app, url_for, abort
from flask import render_template
from... | 2.21875 | 2 |
layers/layer1_python3/0300_acquisition/acquisition/__init__.py | moas/mfdata | 0 | 3782 | from acquisition.step import AcquisitionStep
from acquisition.stats import AcquisitionStatsDClient
from acquisition.move_step import AcquisitionMoveStep
from acquisition.delete_step import AcquisitionDeleteStep
from acquisition.batch_step import AcquisitionBatchStep
from acquisition.reinject_step import AcquisitionRein... | 1.335938 | 1 |
frappe-bench/apps/erpnext/erpnext/non_profit/doctype/member/member.py | Semicheche/foa_frappe_docker | 0 | 3783 | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
class Member(Docum... | 2.09375 | 2 |
networks/networks.py | ayyuriss/TRHPO | 0 | 3784 | <reponame>ayyuriss/TRHPO
from torch import nn
import numpy as np
import base.basenetwork as BaseN
from networks.cholesky import CholeskyBlock
class FCNet(BaseN.BaseNetwork):
name ="FCNet"
def __init__(self,input_shape,output_shape,owner_name=""):
super(FCNet,self).__init__(input_shape,output_shape,owne... | 2.34375 | 2 |
icenews/api_important_words.py | sverrirab/icenews | 4 | 3785 | import logging
from pydantic import BaseModel, Field
from typing import List
from .similar import important_words
from .server import app
_MAX_LENGTH = 2000
logger = logging.getLogger(__name__)
class ImportantWordsResponse(BaseModel):
important_words: List[str] = Field(..., description="List of lemmas")
cla... | 2.421875 | 2 |
try-except.py | kmarcini/Learn-Python---Full-Course-for-Beginners-Tutorial- | 0 | 3786 | <reponame>kmarcini/Learn-Python---Full-Course-for-Beginners-Tutorial-<filename>try-except.py
try:
# num = 10 / 0
number = int(input("Enter a number: "))
print(number)
# catch specific errors
except ZeroDivisionError as err:
print(err)
except ValueError:
print("Invalid input")
| 4.0625 | 4 |
peaksampl.py | Gattocrucco/sipmfilter | 0 | 3787 | <reponame>Gattocrucco/sipmfilter
import numpy as np
def _adddims(a, b):
n = max(a.ndim, b.ndim)
a = np.expand_dims(a, tuple(range(n - a.ndim)))
b = np.expand_dims(b, tuple(range(n - b.ndim)))
return a, b
def _yz(y, z, t, yout):
"""
Shared implementation of peaksampl and sumpeaks.
"""
y... | 2.234375 | 2 |
arachne/hdl/xilinx/ps8/resources/pmu.py | shrine-maiden-heavy-industries/arachne | 3 | 3788 | <reponame>shrine-maiden-heavy-industries/arachne<filename>arachne/hdl/xilinx/ps8/resources/pmu.py<gh_stars>1-10
# SPDX-License-Identifier: BSD-3-Clause
from amaranth import *
from amaranth.build import *
from .common import PS8Resource, MIOSet
__all__ = (
'PMUResource',
)
class PMUResource(PS8Resource)... | 1.835938 | 2 |
backend/Washlist/tests.py | henrikhorluck/tdt4140-washlists | 0 | 3789 | <filename>backend/Washlist/tests.py
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from Dormroom.models import Dormroom
from SIFUser.mixins import AuthTestMixin
from StudentVillage.models import StudentVillage
from Washlist.jobs import reset_washlists
from Washlist.... | 2.515625 | 3 |
torchvision/prototype/models/mobilenetv3.py | piyush01123/vision | 0 | 3790 | from functools import partial
from typing import Any, Optional, List
from torchvision.prototype.transforms import ImageNetEval
from torchvision.transforms.functional import InterpolationMode
from ...models.mobilenetv3 import MobileNetV3, _mobilenet_v3_conf, InvertedResidualConfig
from ._api import WeightsEnum, Weight... | 2.125 | 2 |
rest_auth/registration/urls.py | soul4code/django-rest-auth | 0 | 3791 | from django.urls import re_path
from django.views.generic import TemplateView
from .views import RegisterView, VerifyEmailView
urlpatterns = [
re_path(r'^$', RegisterView.as_view(), name='rest_register'),
re_path(r'^verify-email/$', VerifyEmailView.as_view(), name='rest_verify_email'),
# This url is use... | 1.851563 | 2 |
crawler/tests.py | mental689/paddict | 1 | 3792 | from django.test import TestCase
# Create your tests here.
from crawler.download import *
from crawler.models import *
class AnimalDownloadTestCase(TestCase):
def setUp(self):
self.stopWords = ["CVPR 2019", "Computer Vision Foundation."]
self.url = "/Users/tuannguyenanh/Desktop/cvpr2019.html"#"htt... | 2.4375 | 2 |
test_scripts/xml_example.py | petervdb/testrep1 | 1 | 3793 | <gh_stars>1-10
#!/usr/bin/python3
from urllib.request import urlopen
from xml.etree.ElementTree import parse
# Download the RSS feed and parse it
u = urlopen('http://planet.python.org/rss20.xml')
doc = parse(u)
# Extract and output tags of interest
for item in doc.iterfind('channel/item'):
title = item.findtext('ti... | 3.171875 | 3 |
contacts/urls.py | anthowen/duplify | 1 | 3794 | """dedupper_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... | 2.59375 | 3 |
pydm/PyQt/uic.py | klauer/pydm | 0 | 3795 | <gh_stars>0
from . import qtlib
QT_LIB = qtlib.QT_LIB
if QT_LIB == 'PyQt5':
from PyQt5.uic import *
| 1.242188 | 1 |
CPB100/lab2b/scheduled/ingestapp.py | pranaynanda/training-data-analyst | 0 | 3796 | #!/usr/bin/env python
# Copyright 2016 Google 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 ... | 2.390625 | 2 |
index.py | StarSky1/microsoft-python-study | 0 | 3797 | name=input('input your name:');
print('hello');
print(name.capitalize()); | 3.640625 | 4 |
credentials.py | Machel54/-pass-locker- | 0 | 3798 | import pyperclip
import random
import string
class Credential:
'''
class that generates new credentials
'''
credential_list = []
def __init__(self,username,sitename,password):
self.username = username
self.password = password
self.sitename = sitename
def save_credential(self):
'''
sav... | 3.71875 | 4 |
tests/test_dice.py | mehulsatardekar/dice-on-demand | 1 | 3799 | <reponame>mehulsatardekar/dice-on-demand
import unittest
import app
def test_test():
assert app.test() == "Works!"
| 1.882813 | 2 |