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 |
|---|---|---|---|---|---|---|
protector/tests/query_test/test_query.py | adobe/opentsdb-protector | 9 | 12794951 | # Copyright 2019 Adobe
# All Rights Reserved.
#
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it. If you have received this file from a source other than Adobe,
# then your use, modification, or distribution of it ... | 2.046875 | 2 |
openmdao.lib/src/openmdao/lib/differentiators/fd_helper.py | swryan/OpenMDAO-Framework | 0 | 12794952 | <gh_stars>0
""" Object that can take a subsection of a model and perform finite difference
on it."""
#import cPickle
#import StringIO
from copy import deepcopy
# pylint: disable-msg=E0611,F0401
from openmdao.lib.casehandlers.api import ListCaseRecorder
from openmdao.lib.drivers.distributioncasedriver import \
... | 2.421875 | 2 |
generators/app/templates/__main__.py | sbanwart/generator-morepath | 2 | 12794953 | import morepath
from .app import App
def run():
print('Running app...')
morepath.autoscan()
App.commit()
morepath.run(App())
if __name__ == '__main__':
run()
| 1.5625 | 2 |
google/appengine/datastore/datastore_stub_util.py | semk/hypergae | 1 | 12794954 | #!/usr/bin/env python
#
# Copyright 2007 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 o... | 1.859375 | 2 |
cart/migrations/0004_auto_20220119_1206.py | rahulbiswas24680/Django-Ecommerce | 0 | 12794955 | <filename>cart/migrations/0004_auto_20220119_1206.py
# Generated by Django 3.2.9 on 2022-01-19 12:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shop', '0003_product_favourite_products'),
('cart', '0003_auto_... | 1.328125 | 1 |
moto/datasync/__init__.py | symroe/moto | 0 | 12794956 | from ..core.models import base_decorator
from .models import datasync_backends
datasync_backend = datasync_backends["us-east-1"]
mock_datasync = base_decorator(datasync_backends)
| 1.65625 | 2 |
ui/ui.py | zinuzian-portfolio/ImageLab2019-ContourFinder | 4 | 12794957 | <filename>ui/ui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'basic.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
... | 2 | 2 |
alerta/webhooks/stackdriver.py | sauber/alerta | 0 | 12794958 | import json
import logging
from datetime import datetime
from typing import Any, Dict
from flask import current_app, g, jsonify, request
from flask_cors import cross_origin
from alerta.auth.decorators import permission
from alerta.exceptions import ApiError, RejectException
from alerta.models.alert import Alert
from... | 2.203125 | 2 |
blog/models.py | dkirel/HappyLens | 0 | 12794959 | <gh_stars>0
import datetime
import random
import string
import bcrypt
import os
from django.db import models
from django.conf import settings
from django.contrib import admin
from django import forms
from djangotoolbox.fields import EmbeddedModelField, ListField
SOURCES = (('du', 'Direct Upload'),
('tu', '... | 2.125 | 2 |
ibm_watson/version.py | mmmryd/python-sdk | 0 | 12794960 | __version__ = '5.2.3'
| 1.0625 | 1 |
takeyourmeds/utils/decorators.py | takeyourmeds/takeyourmeds-web | 11 | 12794961 | from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
logout_required = user_passes_test(
lambda x: not x.is_authenticated(),
settings.LOGIN_REDIRECT_URL,
)
superuser_required = user_passes_test(lambda u: (u.is_authenticated() and u.is_superuser))
| 2 | 2 |
tests/test_logic/test_tree/test_functions.py | cdhiraj40/wemake-python-styleguide | 1,931 | 12794962 | import pytest
from wemake_python_styleguide.logic.tree import functions
@pytest.mark.parametrize(('function_call', 'function_name'), [
# Simple builtin functions
('print("Hello world!")', 'print'),
('int("10")', 'int'),
('bool(1)', 'bool'),
('open("/tmp/file.txt", "r")', 'open'),
('str(10)', ... | 2.65625 | 3 |
python/niveau2/1-NombresAVirgulesEtAutresOutils/2.py | ThomasProg/France-IOI | 2 | 12794963 | nbLieues = float(input())
print(nbLieues / 0.707)
| 2.359375 | 2 |
microsoft_problems/problem_9.py | loftwah/Daily-Coding-Problem | 129 | 12794964 | """This problem was asked Microsoft.
Using a read7() method that returns 7 characters from a file, implement readN(n) which reads n characters.
For example, given a file with the content “Hello world”, three read7() returns “Hello w”, “orld” and then “”.
""" | 2.96875 | 3 |
src/arrays/word-ladder-2.py | vighnesh153/ds-algo | 0 | 12794965 | <reponame>vighnesh153/ds-algo
from collections import defaultdict
def generate_graph(word_list):
graph = defaultdict(set)
for word in word_list:
for i in range(len(word)):
new_word = word[:i] + '*' + word[i + 1:]
graph[new_word].add(word)
graph[word].add(new_word)
... | 3.546875 | 4 |
weld-python/weld/grizzly/core/indexes/base.py | tustvold/weld | 2,912 | 12794966 | <gh_stars>1000+
from abc import ABC
class Index(ABC):
"""
Base class for an index in Grizzly.
"""
pass
| 1.765625 | 2 |
vacca/main.py | tango-controls/VACCA | 2 | 12794967 | <gh_stars>1-10
#!/usr/bin/env python
"""
Vacca runner; this file emulates this call:
>taurusgui vacca
Config file (or Property name) is obtained from shell args, then env,
then properties in this order.
If empty, a DEFAULT profile is created pointing to default.py
MAIN CODE FOR PANELS GENERATION IS IN vacca.conf... | 2.828125 | 3 |
src/signal_processing.py | ninashp/Soundproof | 0 | 12794968 | <gh_stars>0
"""
This file contains the code for signal processing module of application.
"""
import numpy as np
from configuration import get_config
import scipy
import librosa
config = get_config() # get arguments from parser
# constants for output of identify_call_type
FIRST_SPEAKER_CUSTOMER = 0
FIRST_SPEAKER_R... | 2.984375 | 3 |
videoretrieval/base/base_dataset.py | googleinterns/via-content-understanding | 1 | 12794969 | <reponame>googleinterns/via-content-understanding
"""Defines a base class for datasets.
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
https://www.apache.org/license... | 2.390625 | 2 |
vispupu/colors.py | sscihz/vispupu | 0 | 12794970 | <filename>vispupu/colors.py<gh_stars>0
color_styles = {
"Turquoise": [
"#1abc9c",
"#e8f8f5",
"#d1f2eb",
'#a3e4d7',
'#76d7c4',
'#48c9b0',
'#1abc9c',
'#17a589',
'#148f77',
'#117864',
'#0e6251'],
"Green Sea":[
'#16a085',
'#e8f6f3',
'#d0ece7',
'#a2d9ce',
'#73c6b6',
'#45b39d',
'#16a085',
'#138d75',
'#117a65',
'#0e6655',
'... | 1.59375 | 2 |
apps/sshchan/views.py | zhoumjane/devops_backend | 53 | 12794971 | from django.shortcuts import render
# Create your views here.
from django.shortcuts import render, HttpResponse
from utils.tools.tools import unique
from devops_backend.settings import TMP_DIR
from rest_framework import viewsets, filters, mixins, status
from rest_framework.permissions import IsAuthenticated
from rest... | 2.015625 | 2 |
aib/custom/formdefn_funcs.py | FrankMillman/AccInABox | 3 | 12794972 | from collections import OrderedDict as OD
from lxml import etree
# parser = etree.XMLParser(remove_blank_text=True)
import db.objects
import db.api
db_session = db.api.start_db_session() # need independent connection for reading
import os.path
import __main__
schema_path = os.path.join(os.path.dirname(__main__.__fil... | 2.265625 | 2 |
src/Plotting/linear_plots.py | goeckslab/MarkerIntensityPredictor | 3 | 12794973 | <filename>src/Plotting/linear_plots.py<gh_stars>1-10
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
def __create_intensity_heatmap_plot(self):
fig, ax = plt.subplots(figsize=(30, 30), dpi=300) # Sample figsize in inches
sns.heatmap(self.train_data.X_train, xticklabels=self.tra... | 2.890625 | 3 |
g8/src/uber/wall_follower.py | YaBoyWonder/Racecar | 1 | 12794974 | <reponame>YaBoyWonder/Racecar<gh_stars>1-10
#!/usr/bin/env python
"""
YaBoyWonder LICENSE: Apache-2.0
"""
import os
import rospy
from enum import Enum
from ackermann_msgs.msg import AckermannDriveStamped
from sensor_msgs.msg import LaserScan
from controllers import PIDController
class WallFollowerNode:
def __... | 2.515625 | 3 |
amcp_pylib/core/client.py | dolejska-daniel/amcp-pylib | 5 | 12794975 | from .command import Command
from .connection import Connection
from .client_base import ClientBase
from amcp_pylib.response import ResponseBase, ResponseFactory
class Client(ClientBase):
""" Simple connection client class. """
def connect(self, host: str = "127.0.0.1", port: int = 5250):
if not... | 2.78125 | 3 |
CausalImpactExplainer/reporting.py | SpikeLab-CL/CausalImpactExplainer | 7 | 12794976 | <filename>CausalImpactExplainer/reporting.py
############
#
# Helper functions to report results of experiments
#
#
############
from os import error
import pandas as pd
from typing import Dict, List, Union, Optional, Tuple
import numpy as np
from .utils import ExperimentOutput
import causalimpact
import matplotlib.py... | 2.65625 | 3 |
18/test.py | AlecRosenbaum/adventofcode2017 | 0 | 12794977 | <reponame>AlecRosenbaum/adventofcode2017<gh_stars>0
import unittest
from solution import solution_part_one, solution_part_two
class TestPartOne(unittest.TestCase):
TEST_INPUT = """
set a 1
add a 2
mul a a
mod a 5
snd a
set a 0
rcv a
jgz a -1
set a 1
jgz a -2
"""
def test_one(self):
self.assertEqual(s... | 3.171875 | 3 |
tests/debug/debug_transformer_transform.py | v-smwang/HanLP | 2 | 12794978 | <reponame>v-smwang/HanLP
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-01-11 18:37
from hanlp.datasets.ner.msra import MSRA_NER_TRAIN
from hanlp.components.taggers.transformers.transformer_transform import TransformerTransform
transform = TransformerTransform(max_seq_length=128)
for x, y in transform.file_to_... | 2.25 | 2 |
Dataset/Leetcode/train/5/479.py | kkcookies99/UAST | 0 | 12794979 | <filename>Dataset/Leetcode/train/5/479.py
class Solution:
def XXX(self, s: str) -> str:
if s==s[::-1]:return s
maxlen,middle=1,0
i=1
len_s=len(s)
rev=s[0]
if(s[0]==s[1]):
rev=s[0:2]
maxlen=2
while i<len_s:
if(maxlen... | 2.953125 | 3 |
full-problems/floorInSortedArray.py | vikas-t/DS-Algo | 0 | 12794980 | <reponame>vikas-t/DS-Algo
#!/usr/bin/python
#https://practice.geeksforgeeks.org/problems/floor-in-a-sorted-array/0
def sol(arr, n, k):
f = None
for i in range(n):
if arr[i] <= k:
f = i
if not f:
return -1
return f | 3.234375 | 3 |
util/import struct.py | aadiljamal/project | 2 | 12794981 | <reponame>aadiljamal/project
import struct
from struct import unpack
def unpack_drawing(file_handle):
key_id, = unpack('Q', file_handle.read(8))
country_code, = unpack('2s', file_handle.read(2))
recognized, = unpack('b', file_handle.read(1))
timestamp, = unpack('I', file_handle.read(4))
n_strokes,... | 2.859375 | 3 |
downloader/RateLimiter.py | pixolution/PixolutionImageDownloader | 9 | 12794982 | <reponame>pixolution/PixolutionImageDownloader<gh_stars>1-10
#!bin/python3
# -*- coding: utf-8 -*-1
import threading
import functools
import time
from downloader.ThreadSafe import SingletonMixin
from downloader.ThreadSafe import synchronized
"""
A rate limiter to ensure that only a given number of call are made
per g... | 3.171875 | 3 |
lebanese_channels/channel_ids.py | ChadiEM/Lebanese-Channels | 10 | 12794983 | from lebanese_channels.channel import Channel
# noinspection PyUnresolvedReferences
from lebanese_channels.services import *
CHANNEL_LIST = []
for cls in Channel.__subclasses__():
CHANNEL_LIST.append(cls())
CHANNEL_LIST = sorted(CHANNEL_LIST, key=lambda x: x.get_name())
| 2.140625 | 2 |
tests/pyconverter-test/cases/array_generics2.py | jaydeetay/pxt | 977 | 12794984 | <gh_stars>100-1000
obstacles: List[List[number]] = []
obstacles.removeAt(0).removeAt(0) | 1.351563 | 1 |
test/test_log_utils.py | knkgun/federalist-garden-build | 5 | 12794985 | <gh_stars>1-10
import logging
from unittest.mock import patch
from log_utils.get_logger import (
LogFilter, Formatter, get_logger, init_logging,
set_log_attrs, DEFAULT_LOG_LEVEL)
from log_utils.db_handler import DBHandler
class TestLogFilter():
def test_it_filters_message_with_default_mask(self):
... | 2.515625 | 3 |
src/world_entity/player.py | rahul38888/opworld | 0 | 12794986 | from ursina.prefabs.first_person_controller import FirstPersonController
class Player(FirstPersonController):
def __init__(self, position, init_health):
super(Player, self).__init__()
self.position = position
self.health = init_health
self.last_max_jump_pos = 0
| 2.375 | 2 |
DAEGC/model.py | devvrit/DAEGC | 0 | 12794987 | import torch
import torch.nn as nn
import torch.nn.functional as F
from layer import GATLayer
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class GAT(nn.Module):
def __init__(self, num_features, hidden_size, embedding_size, alpha):
super(GAT, self).__init__()
self.hidden_s... | 2.53125 | 3 |
frontend/migrations/0003_page_js.py | MetLee/hackergame | 48 | 12794988 | # Generated by Django 2.1.12 on 2019-10-14 14:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('frontend', '0002_auto_20191010_0025'),
]
operations = [
migrations.AddField(
model_name='page',
name='js',
... | 1.4375 | 1 |
src/common/trainer.py | ilyailyash/Torch-Voice-activity-detection | 1 | 12794989 | import time
from functools import partial
from pathlib import Path
import toml
import torch
import colorful
import numpy as np
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
from torch.cuda.amp import GradScaler
from sklearn.metrics import DetCurveDisplay
import src.util.metrics as metrics
from... | 1.953125 | 2 |
python-worm/star-pie.py | AHongKong/Python-Practice | 0 | 12794990 | <gh_stars>0
from pyecharts import ThemeRiver
from pyecharts import Pie
rate = []
with open('quan.txt', mode='r',encoding='utf-8') as f:
lines = f.readlines()
for line in lines:
arr = line.split(',')
if len(arr) == 5:
rate.append(arr[3].replace('\n',''))
print(rate.count('5')+rate.count('4.5'))
print(rate.cou... | 2.421875 | 2 |
server/moback.py | dhilipsiva/moback | 2 | 12794991 | import api
app = api.app
# URLs
## API URLs
app.add_url_rule('/', view_func=api.index)
app.add_url_rule(
'/login',
view_func=api.login, methods=['POST', ])
app.add_url_rule(
'/register',
view_func=api.register, methods=['POST', ])
app.add_url_rule(
'/forgot_password',
view_func=api.forgot_pa... | 1.96875 | 2 |
awardsapp/migrations/0002_auto_20210407_1707.py | RYAN2540/awwwards | 0 | 12794992 | <gh_stars>0
# Generated by Django 3.1.7 on 2021-04-07 14:07
import awardsapp.models
import cloudinary.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('awardsapp', '0001_initial'),
]
operations = [
... | 1.796875 | 2 |
mtgmonte/mtgutils.py | Erotemic/mtgmonte | 0 | 12794993 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import itertools
import six
import operator
print, rrr, profile = ut.inject2(__name__, '[mtgutils]')
# Then check for color considerations
def can_cast(spell_sequence, mana_combos):
"""
... | 2.5625 | 3 |
torchlit/utils/__init__.py | himanshu-dutta/torchlit | 1 | 12794994 | <reponame>himanshu-dutta/torchlit
def to_device(data, device):
if isinstance(data, (list, tuple)):
return [to_device(x, device) for x in data]
return data.to(device, non_blocking=True) | 2.765625 | 3 |
src/data/reconstruction_datasets.py | martius-lab/beta-nll | 0 | 12794995 | import numpy as np
import torch
from torchvision import datasets, transforms
DEFAULT_DATA_DIR = "/is/rg/al/Projects/prob-models/data/"
class ReconstructionDataset(torch.utils.data.Dataset):
def __init__(
self, name, split="train", flatten=True, train_split=0.8, data_dir=None
):
assert split i... | 2.796875 | 3 |
getfutures.py | pushkarlanke/stockcode | 0 | 12794996 |
# coding: utf-8
# In[1]:
import pandas as pd
import nsepy as ns
from datetime import date
# In[2]:
stocks = pd.read_csv("stocklist.csv")
# In[3]:
stocks
# In[4]:
expiry = date(2017,2,23),date(2017,3,30),date(2017,4,27),date(2017,5,25),date(2017,6,29),
date(2017,7,27),date(2017,8,31),date(2017,9,28),date(201... | 2.890625 | 3 |
OKR_techsup_ga.py | omnisci/pymapd-examples | 5 | 12794997 | <reponame>omnisci/pymapd-examples
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 15 15:48:38 2018
@author: ericgrant
"""
import argparse
from apiclient.discovery import build
import httplib2
from oauth2client import client
from oauth2client import file
from oauth2client import tools
import pan... | 2.34375 | 2 |
tests/conftest.py | coma64/nextcloud-notes-api | 3 | 12794998 | from typing import Iterator
from _pytest.fixtures import FixtureRequest
from pytest import fixture
from nextcloud_notes_api import Note
def _example_note() -> Note:
return Note(
title='Spam',
content='Bacon',
category='Todo',
favorite=True,
id=1337,
# https://stac... | 2.265625 | 2 |
lookerapi/apis/__init__.py | jcarah/python_sdk | 0 | 12794999 | <reponame>jcarah/python_sdk
from __future__ import absolute_import
# import apis into api package
from .api_auth_api import ApiAuthApi
from .auth_api import AuthApi
from .color_collection_api import ColorCollectionApi
from .config_api import ConfigApi
from .connection_api import ConnectionApi
from .content_api import ... | 1.09375 | 1 |
static/dht22Measure.py | organicopium/pigrow | 0 | 12795000 | import sqlite3
from sqlite3 import Error
import time
import datetime
db = "/home/pi/projects/pigrow/db.sqlite3"
def create_table(conn):
create_table_query = """ CREATE TABLE IF NOT EXISTS dht_data (
id integer PRIMARY KEY,
humidity real ,
... | 3.59375 | 4 |
Users/serializers.py | gordiig/Un_RSOI_Curs_Auth | 0 | 12795001 | <filename>Users/serializers.py
from django.contrib.auth.models import User
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from Users.utils import is_moderator
class UserSerializer(serializers.ModelSerializer):
"""
Сериализатор спискового представления юзера
""... | 2.359375 | 2 |
VideoMix/makeNumberedVideos.py | ctralie/SlidingWindowVideoTDA | 6 | 12795002 | import sys
sys.path.append("../")
from VideoTools import *
import subprocess
import os
import scipy.misc
MAXHEIGHT = 160
MINWIDTH = 120
def saveVideoID(I, IDims, fileprefix, ID, FrameRate = 30, NumberFrames = 30):
N = I.shape[0]
print(I.shape)
if I.shape[0] > FrameRate*5:
I = I[0:FrameRate*5, :]
... | 2.5 | 2 |
fileshare/site_admin/views.py | sqz269/fileshare-flask | 4 | 12795003 | from flask import Blueprint, render_template
site_admin = Blueprint("admin_site", __name__, url_prefix="/admin",template_folder="template", static_folder="static", static_url_path="/admin/static")
@site_admin.route("/")
def admin():
return render_template("index.html")
| 2.1875 | 2 |
diofant/tests/printing/test_mathematica.py | rajkk1/diofant | 57 | 12795004 | <filename>diofant/tests/printing/test_mathematica.py
"""Mathematica code printing tests."""
import pytest
from diofant import (QQ, Catalan, Derivative, Dummy, E, Eq, EulerGamma,
Function, Gt, Heaviside, Integer, Integral, Lambda, Le,
Limit, Matrix, Max, Min, Ne, Or, Piecewise... | 2.390625 | 2 |
wait.py | Zadigo/zacoby | 1 | 12795005 | import time
from threading import Timer
from typing import Callable
from pydispatch import dispatcher
from zacoby import global_logger
from zacoby.exceptions import ElementDoesNotExist, MethodError
# from zacoby.pipeline import Pipeline
from zacoby.settings import settings
from zacoby.signals import signal
class Dr... | 2.125 | 2 |
reference/gtf2fasta.py | joshsbloom/eQTL_BYxRM | 3 | 12795006 | <reponame>joshsbloom/eQTL_BYxRM
#!/usr/local/bin/python
from optparse import OptionParser
from BCBio import GFF
from Bio.Seq import Seq
from Bio import SeqIO
from Bio.Alphabet import generic_dna
from Bio.SeqRecord import SeqRecord
import subprocess
import os
import sys
def lookupSequences(files):
gtf_file = open(... | 2.390625 | 2 |
rqrunner.py | angstwad/arlo-sms | 0 | 12795007 | # -*- coding: utf-8 -*-
import sys
from redis import Redis
from rq import Queue, Connection, Worker
from mailhook.config import config
# Preload libraries
import twilio
# Provide queue names to listen to as arguments to this script,
# similar to rqworker
redis_conn = Redis(config.REDIS_HOST)
with Connection(redis_... | 1.976563 | 2 |
libs/RVNpyIPFS/_IPFSrpcClient.py | sLiinuX/wxRaven | 11 | 12795008 | '''
Created on 5 janv. 2022
@author: slinux
'''
import sys
# The answer is that the module xmlrpc is part of python3
import xmlrpc.client
import os
import logging
class IPFS_RPC_Client(object):
#Put your server IP here
_ip='0.0.0.0'
_port=1234
_url = ""
_client = None
def _... | 2.640625 | 3 |
codedigger/codeforces/views.py | prayutsu/Backend | 0 | 12795009 | <gh_stars>0
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import generics, mixins, permissions
from .models import user, country, organization, contest
from .serializers import UserSerializer, CountrySerializer, OrganizationSerializer, ContestSerializer
from ... | 2.015625 | 2 |
vininfo/brands.py | ghilesmeddour/vininfo | 60 | 12795010 | <filename>vininfo/brands.py
from .common import Brand
from .details import *
class Lada(Brand):
extractor = AvtoVazDetails
class Nissan(Brand):
extractor = NissanDetails
class Opel(Brand):
extractor = OpelDetails
class Renault(Brand):
extractor = RenaultDetails
| 1.796875 | 2 |
puzzles/aoc.py | oogles/aoc_base | 0 | 12795011 | import datetime
import inspect
import os
import sys
class Puzzle:
# The delimiter to use to separate the input data into a list for subsequent
# processing. E.g. '\n', ',', etc. Delimited items can be processed prior to
# being added to the input list by overriding _process_input_item().
# Set to... | 3.5625 | 4 |
main.py | PravunathSingh/Realtime-Tweets | 0 | 12795012 | # create a credentials.py file with the following keys
from credentials import ckey, csecret, atoken, asecret
from tweepy import Stream, OAuthHandler
from tweepy.streaming import StreamListener
class listener(StreamListener):
def on_data(self, data):
print(data)
return True
def on_error(self,... | 2.53125 | 3 |
apps/sushi/migrations/0038_jsonfield.py | techlib/czechelib-stats | 1 | 12795013 | <reponame>techlib/czechelib-stats
# Generated by Django 3.1.3 on 2020-11-20 13:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sushi', '0037_broken_credentials'),
]
operations = [
migrations.AlterFiel... | 1.632813 | 2 |
l2_attack.py | jcperdomo/universal_noise | 0 | 12795014 | ## l2_attack.py -- attack a network optimizing for l_2 distance
##
## Copyright (C) 2016, <NAME> <<EMAIL>>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
## Modified by <NAME> 2017
import tensorflow as tf
import numpy as np
BINARY_SEARCH_STEPS = 9 ... | 2.953125 | 3 |
inspecta/__init__.py | grimen/python-inspecta | 0 | 12795015 |
# =========================================
# IMPORTS
# --------------------------------------
import rootpath
rootpath.append()
# =========================================
# EXPORTS
# --------------------------------------
from inspecta.inspector import *
| 1.554688 | 2 |
lab01/app/views.py | cesar-limachi/TECSUP-DAE-2021-2-B-CESAR-LIMACHI | 0 | 12795016 | from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("Desde la vista App")
def sumar(request, numero1, numero2):
sum = numero1 + numero2
return HttpResponse("La suma de %s + %s = %s" % (numero1, numero2, sum))
... | 2.796875 | 3 |
examples/simplequery.py | kenichi884/tomotoio | 1 | 12795017 | <filename>examples/simplequery.py<gh_stars>1-10
import logging as log
from time import sleep
from utils import createCubes, releaseCubes
# Identify each cube by the color and the sound signal,
# and report the battery level on the console.
cubes = createCubes(initialReport=True)
try:
for k in range(10):
... | 2.890625 | 3 |
students/K33401/Tikhonova_Elena/Lr1/task_4/server.py | ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021 | 4 | 12795018 | <filename>students/K33401/Tikhonova_Elena/Lr1/task_4/server.py
import socket
import threading
def get_connect(socket, number):
print("I am thread number", number)
clientsocket, address = socket.accept()
clientsocket.send(b'Please enter your name: ')
name = clientsocket.recv(1024)
name = name.decode... | 3.40625 | 3 |
Python studying/Codes of examples/A2.1-temp.py | BoyangSheng/Skill-studing | 1 | 12795019 | a = 1
b = 2
temp = a
a = b
b = temp
print(a,b) | 3.265625 | 3 |
apps/cars/migrations/0001_initial.py | Marpop/demo-car-app | 0 | 12795020 | import django.core.validators
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Car",
... | 1.921875 | 2 |
src/loaders/loader_json.py | rkulyn/telegram-dutch-taxbot | 2 | 12795021 | import os
import json
from .exceptions import DataLoadException
class JsonDataLoader:
"""
Load base calculation data
from provided JSON file.
"""
def __init__(self, path):
self._path = path
def load(self):
if not os.path.exists(self._path):
raise DataLoadExceptio... | 3.4375 | 3 |
ippon/cup_fight/views.py | morynicz/ippon_back | 0 | 12795022 | from rest_framework import viewsets, permissions
import ippon.cup_fight.permissions as cfp
import ippon.cup_fight.serializers as cfs
import ippon.models.cup_fight as cfm
class CupFightViewSet(viewsets.ModelViewSet):
queryset = cfm.CupFight.objects.all()
serializer_class = cfs.CupFightSerializer
permissio... | 1.8125 | 2 |
src/wai/common/adams/imaging/locateobjects/constants.py | waikato-datamining/wai-common | 0 | 12795023 | """
Module for constants relating to locating objects.
"""
# The key for the X location
KEY_X: str = "x"
# The key for the Y location
KEY_Y: str = "y"
# The key for the width
KEY_WIDTH: str = "width"
# The key for the height
KEY_HEIGHT: str = "height"
# The key for the location
KEY_LOCATION: str = "location"
# The... | 2.671875 | 3 |
tests/test_model_field_list.py | havron/wtforms-alchemy | 161 | 12795024 | <gh_stars>100-1000
import sqlalchemy as sa
from wtforms.fields import FormField
from wtforms_components import PassiveHiddenField
from tests import FormRelationsTestCase, MultiDict
from wtforms_alchemy import ModelFieldList, ModelForm
class ModelFieldListTestCase(FormRelationsTestCase):
def create_models(self):
... | 2.328125 | 2 |
jd/api/__init__.py | fengjinqi/linjuanbang | 5 | 12795025 | from jd.api.rest import *
from jd.api.base import FileItem | 1.070313 | 1 |
eslearn/utils/test.py | dongmengshi/easylearn | 0 | 12795026 | <reponame>dongmengshi/easylearn<filename>eslearn/utils/test.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 15:07:49 2018
@author: lenovo
"""
from lc_svc_oneVsRest import oneVsRest
import numpy as np
import pandas as pd
from lc_read_write_Mat import read_mat
import sys
sys.path.append(r'D:\myCodes\LC_MVPA\Python\... | 2.203125 | 2 |
datamgt/urls.py | timmo-d/MyTrader | 0 | 12795027 | <filename>datamgt/urls.py
from django.urls import path
from . import views
app_name = 'datamgt'
urlpatterns = [
#path('', views.DataMgtPageView.as_view(), name='index'),
path('', views.create, name='index'),
]
| 1.875 | 2 |
src/semsel/exceptions.py | modist-io/semsel | 0 | 12795028 | # -*- encoding: utf-8 -*-
# Copyright (c) 2019 <NAME> <<EMAIL>>
# ISC License <https://choosealicense.com/licenses/isc>
"""Contains custom exceptions and errors."""
from typing import Optional
class SemselException(Exception):
"""Module-wide exception namespace."""
def __init__(self, message: str):
... | 2.390625 | 2 |
call_sibling.py | sahlinet/tumbo-demoapp | 0 | 12795029 | def func(self):
return self.siblings.sibling_A(self)
| 1.679688 | 2 |
Chapter 11/Traversing_through_a_linked_list_4_2_1_method1.py | bpbpublications/Advance-Core-Python-Programming | 0 | 12795030 | <gh_stars>0
class Node:
def __init__(self,data = None):
self.data = data
self.reference = None
#EXECUTION
objNode1 = Node(1)
objNode2 = Node(2)
objNode3 = Node(3)
objNode4 = Node(4)
objNode1.reference = objNode2
objNode2.reference = objNode3
objNode3.reference = objNode4
objNode4.ref... | 3.015625 | 3 |
mtc/core/evaluator.py | MIC-DKFZ/n2c2-challenge-2019 | 1 | 12795031 | """
.. module:: evaluator
:synopsis: Holding all evaluator classes!
.. moduleauthor:: <NAME>
"""
from typing import List, Union, Dict
from abc import ABC, abstractmethod
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from sklearn.metrics import classification_report
from mtc.core.sentence... | 2.828125 | 3 |
backend/urls.py | opustm/mvp-backend | 0 | 12795032 | from django.contrib import admin
from django.urls import path, include
from .views import documentation
from .router import router
from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
path('tokenAuth/', obtain_jwt_token),
path('', documentation, name='documentation'),
path('', include('m... | 1.664063 | 2 |
template/tree_traversal.py | zh-plus/CodeJam | 3 | 12795033 | from queue import Queue
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
@staticmethod
def from_array(array):
# bfs construct binary tree
root = TreeNode(array[0])
q = Queue()
q.put(root)
i = 1
... | 3.765625 | 4 |
Warmup/compare_the_triplet.py | osamadel/Hacker-Rank | 0 | 12795034 | def compare(a, b):
scoreA = 0
scoreB = 0
for i in range(len(a)):
if a[i] > b[i]:
scoreA += 1
elif a[i] < b[i]:
scoreB += 1
return (scoreA, scoreB)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
scoreA, scoreB = compare(a,b)
print(scoreA, ... | 3.46875 | 3 |
beerbackend/beer/api.py | eternalnoob/beerbackend | 1 | 12795035 | from beerbackend.user.models import Beer, families, User
from flask_restful import Resource, Api, reqparse, fields, marshal_with
from flask.json import jsonify
import os
import json
beer_get_parse = reqparse.RequestParser()
beer_get_parse.add_argument('beer_name', dest='beer_name',
type=str, re... | 2.96875 | 3 |
samples/data-serialization/ds-python-grpc/main.py | obecto/perper | 24 | 12795036 | <reponame>obecto/perper<filename>samples/data-serialization/ds-python-grpc/main.py<gh_stars>10-100
import grpc
import fabric_pb2_grpc
import fabric_pb2
from SimpleData import SimpleData
from pyignite.datatypes.prop_codes import *
from AffinityKey import *
from Notification import CallData
from Notification import Noti... | 2.1875 | 2 |
src/nexgen/beamlines/__init__.py | DominicOram/nexgen | 0 | 12795037 | """Utilities for writing NeXus files for beamlines at Diamond Light Source."""
| 0.972656 | 1 |
talks/2016-09-27-intro-tensorflow/visualize_activations.py | ramhiser/deep-learning-with-tensorflow-meetup | 12 | 12795038 | <reponame>ramhiser/deep-learning-with-tensorflow-meetup
from models.base_convnet import inference
import matplotlib.pyplot as plt
import tensorflow as tf
import cv2
import os
IMAGE_SIZE = 24
def plotNNFilter(units):
"""
Function to plot a certain layer
:param units: convnet layer
"""
filters = un... | 3.359375 | 3 |
geepee/pep_models.py | MattAshman/geepee | 24 | 12795039 | <filename>geepee/pep_models.py
"""Summary
# TODO: this should reuse base models!
"""
import sys
import math
import numpy as np
import scipy.linalg as npalg
from scipy import special
from scipy.optimize import minimize
import matplotlib.pyplot as plt
import time
import pdb
from scipy.cluster.vq import kmeans2
from util... | 2.125 | 2 |
DrawBot.roboFontExt/lib/settings.py | michielkauwatjoe/drawBotRoboFontExtension | 6 | 12795040 | from vanilla import *
from mojo.extensions import getExtensionDefault, setExtensionDefault
class DrawBotSettingsController(object):
def __init__(self):
self.w = Window((250, 45), "DrawBot Settings")
self.w.openPythonFilesInDrawBot = CheckBox((10, 10, -10, 22),
"Open .py files direct... | 2.15625 | 2 |
abupy/FactorBuyBu/ABuFactorBuyDM.py | luqin/firefly | 1 | 12795041 | # -*- encoding:utf-8 -*-
"""
买入择时示例因子:动态自适应双均线策略
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import numpy as np
from .ABuFactorBuyBase import AbuFactorBuyXD, BuyCallMixin
from ..IndicatorBu.ABuNDMa import calc_ma_from_prices
from .... | 2.25 | 2 |
req_compile/metadata/patch.py | sputt/qer | 6 | 12795042 | """Patching modules and objects"""
import contextlib
import sys
def begin_patch(module, member, new_value):
if isinstance(module, str):
if module not in sys.modules:
return None
module = sys.modules[module]
if not hasattr(module, member):
old_member = None
else:
... | 3.15625 | 3 |
algoritmos/sort_recursive.py | corahama/python | 1 | 12795043 | def sort_array(stack):
if len(stack) == 0:
return stack
top = stack.pop()
sort_array(stack)
insert_element_in_ordered_stack(stack, top)
return stack
def insert_element_in_ordered_stack(stack, value):
if len(stack) == 0 or stack[-1] <= value:
stack.append(value)
return
... | 4.15625 | 4 |
samples/parallel-processing-california-housing-data/ml_service/pipelines/build_pipeline.py | h2floh/MLOpsManufacturing-1 | 20 | 12795044 | <filename>samples/parallel-processing-california-housing-data/ml_service/pipelines/build_pipeline.py
"""Build pipeline."""
from datetime import datetime
from logging import INFO, Formatter, StreamHandler, getLogger
from azureml.core import Environment, Workspace
from azureml.core.conda_dependencies import CondaDepende... | 2.234375 | 2 |
aoc2021/test_day2.py | jonsth131/aoc | 0 | 12795045 | <reponame>jonsth131/aoc
from day2 import part1, part2
test_input = ["forward 5", "down 5", "forward 8", "up 3", "down 8", "forward 2"]
def test_part1():
assert part1(test_input) == 150
def test_part2():
assert part2(test_input) == 900
| 2.921875 | 3 |
python/interactivepython1/src/unittest/python/rpsls_tests.py | edmathew/playground | 0 | 12795046 | <gh_stars>0
import unittest
import sys
from rpsls import rpsls
from cStringIO import StringIO
class RPSLSTest(unittest.TestCase):
def setUp(self):
sys.stdout = StringIO()
def tearDown(self):
sys.stdout.close()
sys.stdout = sys.__stdout__
def test_can_call_rpsls_module(self):
rpsls.na... | 2.796875 | 3 |
examen/p2/p2.py | Ale-Torrico/computacion_para_ingenieria | 0 | 12795047 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 9 07:33:20 2022
@author: AMD
"""
# Dada la lista [10,20,30,10,5, 1, 3, 5, 4] separar en dos listas
# una lista debe contener solo los pares y la segunda lista solo debe contener los impares
lista = [10,20,30,10,5, 1, 3, 5, 4]
Pares=[]
Impares=[]
for num in ... | 3.625 | 4 |
penut/__init__.py | penut85420/Penut | 0 | 12795048 | <filename>penut/__init__.py<gh_stars>0
from .utils import TimeCost, walk_dir, td2s, timedelta2string | 1.164063 | 1 |
setup.py | Jrsnow8921/SnowNasaPython | 0 | 12795049 | <gh_stars>0
from distutils.core import setup
setup(
name = 'SnowNasaPython',
packages = ['SnowNasaPython'],
version = '1.7',
description = 'A python lib to interact with Nasas API',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/Jrsnow8921/SnowNasaPython.git',
download_url = 'ht... | 1.242188 | 1 |
lib/mclib/setup.py | yusht000/clickhouse-learning | 0 | 12795050 | <gh_stars>0
__author__ = 'lucky'
from setuptools import setup, find_packages
setup(
name='mclib',
version='1.0.0',
keywords=['mclib'],
description=' mock data for ck ',
author='shengtao.yu',
author_email='<EMAIL>',
packages=find_packages(include=['mclib', 'mclib.*']),
install_requires... | 1.476563 | 1 |