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 |
|---|---|---|---|---|---|---|
api/ddu/management-zone-calculation/dduConsumptionPerMZ.py | pawelsiwek/snippets | 11 | 14200 | import sys, requests, json, time
METRIC_NAME = "builtin:billing.ddu.metrics.byEntity"
PAGE_SIZE = 500
sys.tracebacklimit = 0
# python .\dduConsumptionPerMZ.py 2020-08-01T12:00:00+02:00 2020-08-10T12:00:00+02:00 https://mySampleEnv.live.dynatrace.com/api/ abcdefghijklmnop 60
# python .\dduConsumptionPerMZ.py 2020-08-0... | 2.59375 | 3 |
Lesson3/coefficient_of_determination2.py | rmhyman/DataScience | 1 | 14201 | import numpy as np
import scipy
import matplotlib.pyplot as plt
import sys
def compute_r_squared(data, predictions):
'''
In exercise 5, we calculated the R^2 value for you. But why don't you try and
and calculate the R^2 value yourself.
Given a list of original data points, and also a li... | 4.40625 | 4 |
setup.py | 10sr/pyltsv | 0 | 14202 | #!/usr/bin/env python
# type: ignore
"""Setup script."""
from setuptools import setup
def _get_version():
with open("pyltsv/_version.py") as f:
for line in f:
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
... | 1.867188 | 2 |
hypha/apply/projects/models/project.py | slifty/hypha | 0 | 14203 | import collections
import decimal
import json
import logging
from django.apps import apps
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError
from django.core.validators i... | 1.664063 | 2 |
logsight/result/template.py | aiops/logsight-sdk-py | 1 | 14204 |
class Template:
def __init__(self, data):
"""Class representing log templates.
Note:
Timestamps are represented in ISO format with timezone information.
e.g, 2021-10-07T13:18:09.178477+02:00.
"""
self._timestamp = data.get("@timestamp", None)
self.... | 2.640625 | 3 |
temp/src/square.py | wvu-irl/smart-2 | 0 | 14205 | <reponame>wvu-irl/smart-2
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from math import radians
import os
import numpy as np
from nav_msgs.msg import Odometry
class DrawASquare():
def __init__(self):
# initiliaze
rospy.init_node('drawasquare', anonymous=True)
#... | 3.078125 | 3 |
ellipses/script_train_radon_tiramisu_jitter_v6.py | jmaces/robust-nets | 14 | 14206 | import os
import matplotlib as mpl
import torch
import torchvision
from data_management import IPDataset, Jitter, SimulateMeasurements
from networks import IterativeNet, Tiramisu
from operators import Radon
# ----- load configuration -----
import config # isort:skip
# ----- global configuration -----
mpl.use("agg... | 2.15625 | 2 |
Python practice/Mit opencourceware(2.7)/quiz1_p2.py | chiranjeevbitp/Python27new | 0 | 14207 | <filename>Python practice/Mit opencourceware(2.7)/quiz1_p2.py
#import pdb
T = (0.1, 0.1)
x = 0.0
for i in range(len(T)):
for j in T:
x += i + j
print x
print i
#pdb.set_trace()
| 3.203125 | 3 |
invMLEnc_toy/main.py | Lupin1998/inv-ML | 1 | 14208 | <gh_stars>1-10
import os
import numpy as np
import random as rd
import time
import argparse
import torch
import torch.utils.data
from torch import optim
import dataset
import gifploter
from trainer.InvML_trainer import InvML_trainer
from generator.samplegenerater import SampleIndexGenerater
def PlotLatenSpace(model... | 2.34375 | 2 |
backend/openweathermap.py | tangb/cleepmod-openweathermap | 0 | 14209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
import requests
from cleep.exception import CommandError, MissingParameter
from cleep.libs.internals.task import Task
from cleep.core import CleepModule
from cleep.common import CATEGORIES
__all__ = ["Openweathermap"]
class Openweathermap(CleepMo... | 2.4375 | 2 |
tests/test_wps_dummy.py | f-PLT/emu | 3 | 14210 | from pywps import Service
from pywps.tests import assert_response_success
from .common import client_for, get_output
from emu.processes.wps_dummy import Dummy
def test_wps_dummy():
client = client_for(Service(processes=[Dummy()]))
datainputs = "input1=10;input2=2"
resp = client.get(
service='WPS'... | 2.5 | 2 |
test/talker.py | cjds/rosgo | 148 | 14211 | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String)
rospy.init_node('talker', anonymous=True)
while not rospy.is_shutdown():
str = "%s: hello world %s" % (rospy.get_name(), rospy.get_time())
rospy.loginfo(str)
pu... | 2.28125 | 2 |
point_to_box/model.py | BavarianToolbox/point_to_box | 0 | 14212 | <reponame>BavarianToolbox/point_to_box
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_model.ipynb (unless otherwise specified).
__all__ = ['EfficientLoc', 'CIoU']
# Cell
#export
from efficientnet_pytorch import EfficientNet
import copy
import time
import math
import torch
import torch.optim as opt
from torch.u... | 2.015625 | 2 |
Receptive_Field_PyNN/2rtna_connected_to_4ReceptiveFields/anmy_TDXY.py | mahmoud-a-ali/Thesis_sample_codes | 0 | 14213 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 2 13:09:55 2018
@author: mali
"""
#import time
import pickle
import pyNN.utility.plotting as plot
import matplotlib.pyplot as plt
import comn_conversion as cnvrt
import prnt_plt_anmy as ppanmy
# file and folder names =============================... | 2.359375 | 2 |
meAdota/settings.py | guipeeix7/website | 6 | 14214 | <reponame>guipeeix7/website
"""
Django settings for meAdota project.
Generated by 'django-admin startproject' using Django 3.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref... | 2.09375 | 2 |
Machine Learning/Regression/reg.py | brett-harvey/Brett-s-AI-Library | 0 | 14215 | from sklearn import preprocessing, svm
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn import cross_validation
import pandas as pd
import numpy as np
import quandl
import math
df = quandl.get('WIKI/GOOGL')
df = df[['Adj. Open', 'Adj. High', 'Adj. Lo... | 2.796875 | 3 |
src/app.py | tatianamaia/Corona | 0 | 14216 | import datetime
import os
import yaml
import numpy as np
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
import plotly.graph_objs as go
ENV_F... | 2.5625 | 3 |
tests/io/test_kepseismic.py | jorgemarpa/lightkurve | 235 | 14217 | import pytest
from astropy.io import fits
import numpy as np
from lightkurve.io.kepseismic import read_kepseismic_lightcurve
from lightkurve.io.detect import detect_filetype
@pytest.mark.remote_data
def test_detect_kepseismic():
"""Can we detect the correct format for KEPSEISMIC files?"""
url = "https://arch... | 2.25 | 2 |
backend/appengine/routes/gallerys/model.py | SamaraCardoso27/eMakeup | 0 | 14218 | __author__ = '<NAME>'
| 1.085938 | 1 |
recipes/Python/223585_Stable_deep_sorting_dottedindexed_attributes/recipe-223585.py | tdiprima/code | 2,023 | 14219 | <gh_stars>1000+
def sortByAttrs(seq, attrs):
listComp = ['seq[:] = [(']
for attr in attrs:
listComp.append('seq[i].%s, ' % attr)
listComp.append('i, seq[i]) for i in xrange(len(seq))]')
exec('%s' % ''.join(listComp))
seq.sort()
seq[:] = [obj[-1] for obj in seq]
return
#
# begin test code
#
from random... | 3.125 | 3 |
spirit/topic/forms.py | ImaginaryLandscape/Spirit | 974 | 14220 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import gettext_lazy as _
from django.utils.encoding import smart_bytes
from django.utils import timezone
from ..core import utils
from ..core.utils.forms import NestedModelChoiceField
from ..category.models import Catego... | 2.09375 | 2 |
OST_helper/parameter.py | HomeletW/OST | 1 | 14221 | <filename>OST_helper/parameter.py<gh_stars>1-10
# constant
import json
import logging
import os
import platform
import subprocess
from datetime import date
from os.path import exists, expanduser, isdir, isfile, join, abspath, dirname
from PIL import Image
logging.basicConfig(
style="{",
format="{threadName:<1... | 2.1875 | 2 |
examples/compat/ggplot_point.py | azjps/bokeh | 1 | 14222 | from ggplot import aes, geom_point, ggplot, mtcars
import matplotlib.pyplot as plt
from pandas import DataFrame
from bokeh import mpl
from bokeh.plotting import output_file, show
g = ggplot(mtcars, aes(x='wt', y='mpg', color='qsec')) + geom_point()
g.make()
plt.title("Point ggplot-based plot in Bokeh.")
output_fil... | 3.40625 | 3 |
src/train_tune.py | vanang/korquad-challenge | 0 | 14223 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import random
import sys
from io import open
import numpy as np
import torch
import json
from torch.utils.data import (DataLoader, SequentialSampler, RandomSampl... | 1.882813 | 2 |
BuyandBye_project/users/forms.py | sthasam2/BuyandBye | 1 | 14224 | from datetime import date
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from phonenumber_field.formfields import PhoneNumberField
from .models import Profile
from .options import STATE_CHOICES, YEARS
from .utils import AgeValidator
class ... | 2.484375 | 2 |
kolab/tokibi/tokibi.py | oshiooshi/kolab | 0 | 14225 | <filename>kolab/tokibi/tokibi.py<gh_stars>0
import sys
import pegtree as pg
from pegtree.visitor import ParseTreeVisitor
import random
# from . import verb
import verb
EMPTY = tuple()
# オプション
OPTION = {
'Simple': False, # シンプルな表現を優先する
'Block': False, # Expressionに <e> </e> ブロックをつける
'EnglishFirst': Fals... | 2.359375 | 2 |
kaggle_downloader/kaggle_downloader.py | lars-reimann/kaggle-downloader | 0 | 14226 | <filename>kaggle_downloader/kaggle_downloader.py
from typing import Callable, Union
from kaggle import KaggleApi
from kaggle.models.kaggle_models_extended import Competition, Kernel
class KaggleDownloader:
def __init__(self) -> None:
self.client = KaggleApi()
self.client.authenticate()
def f... | 2.328125 | 2 |
trip/urls.py | tboonma/thairepose | 4 | 14227 | from django.urls import path
from . import views
app_name = 'trip'
urlpatterns = [
path('', views.index, name='index'),
path('tripblog/', views.AllTrip.as_view(), name="tripplan"),
path('likereview/', views.like_comment_view, name="like_comment"),
path('tripdetail/<int:pk>/', views.trip_detail, name="t... | 1.984375 | 2 |
tests/test_rpc.py | tzoiker/aio-pika | 0 | 14228 | <reponame>tzoiker/aio-pika
import asyncio
import logging
import pytest
from aio_pika import Message, connect_robust
from aio_pika.exceptions import DeliveryError
from aio_pika.patterns.rpc import RPC, log as rpc_logger
from tests import AMQP_URL
from tests.test_amqp import BaseTestCase
pytestmark = pytest.mark.asyn... | 2.03125 | 2 |
tests/python/pants_test/base/test_cmd_line_spec_parser.py | dturner-tw/pants | 0 | 14229 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | 2.25 | 2 |
code/strats/switcher.py | Barigamb738/PrisonersDilemmaTournament | 23 | 14230 | <reponame>Barigamb738/PrisonersDilemmaTournament
def strategy(history, memory):
round = history.shape[1]
GRUDGE = 0
LASTACTION = 1
if round == 0:
mem = []
mem.append(False)
mem.append(0)
return "cooperate", mem
mem = memory
if mem[GRUDGE]:
return "defect",... | 2.953125 | 3 |
pull_into_place/commands/run_additional_metrics.py | Kortemme-Lab/pull_into_place | 3 | 14231 | #!/usr/bin/env python2
"""\
Run additional filters on a folder of pdbs and copy the results back
into the original pdb.
Usage:
pull_into_place run_additional_metrics <directory> [options]
Options:
--max-runtime TIME [default: 12:00:00]
The runtime limit for each design job. The default value is... | 2.28125 | 2 |
setup.py | japherwocky/cl3ver | 1 | 14232 | <gh_stars>1-10
from distutils.core import setup
setup(
name = 'cl3ver',
packages = ['cl3ver'],
license = 'MIT',
install_requires = ['requests'],
version = '0.2',
description = 'A python 3 wrapper for the cleverbot.com API',
author = '<NAME>',
... | 1.429688 | 1 |
linux-distro/package/nuxleus/Source/Vendor/Microsoft/IronPython-2.0.1/Lib/headstock/example/microblog/microblog/jabber/pubsub.py | mdavid/nuxleus | 1 | 14233 | # -*- coding: utf-8 -*-
import re
from Axon.Component import component
from Kamaelia.Util.Backplane import PublishTo, SubscribeTo
from Axon.Ipc import shutdownMicroprocess, producerFinished
from Kamaelia.Protocol.HTTP.HTTPClient import SimpleHTTPClient
from headstock.api.jid import JID
from headstock.api.im impor... | 1.765625 | 2 |
examples/task_sequence_labeling_ner_lstm_crf.py | lonePatient/TorchBlocks | 82 | 14234 | import os
import json
from torchblocks.metrics import SequenceLabelingScore
from torchblocks.trainer import SequenceLabelingTrainer
from torchblocks.callback import TrainLogger
from torchblocks.processor import SequenceLabelingProcessor, InputExample
from torchblocks.utils import seed_everything, dict_to_text, bu... | 2.46875 | 2 |
teachers/views.py | xuhairmeer/school-management | 0 | 14235 | <filename>teachers/views.py
# Create your views here.
from django.urls import reverse_lazy
from django.views import generic
from forms.forms import UserCreateForm
class SignUp(generic.CreateView):
form_class = UserCreateForm
success_url = reverse_lazy('home')
template_name = 'signup.html'
| 2.03125 | 2 |
Code/Main.py | iqbalsublime/EPCMS | 0 | 14236 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 20 01:33:18 2019
@author: iqbalsublime
"""
from Customer import Customer
from Restaurent import Restaurent
from Reserve import Reserve
from Menu import Menu
from Order import Order
cust1= Customer(1,"Iqbal", "0167****671")
rest1= Restaurent(1,"Farmgate", "102 Kazi Naz... | 3.015625 | 3 |
venv/Lib/site-packages/twisted/logger/_io.py | AironMattos/Web-Scraping-Project | 2 | 14237 | # -*- test-case-name: twisted.logger.test.test_io -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
File-like object that logs.
"""
import sys
from typing import AnyStr, Iterable, Optional
from constantly import NamedConstant
from incremental import Version
from twisted.python.deprecat... | 2.53125 | 3 |
bot/exts/cricket.py | ShakyaMajumdar/ShaqqueBot | 0 | 14238 | from dataclasses import dataclass
# from pprint import pprint
import aiohttp
import discord
from discord.ext import commands
from bot import constants
API_URL = "https://livescore6.p.rapidapi.com/matches/v2/"
LIVE_MATCHES_URL = API_URL + "list-live"
HEADERS = {
"x-rapidapi-key": constants.RAPIDAPI_KEY,
"x-r... | 2.984375 | 3 |
u24_lymphocyte/third_party/treeano/sandbox/nodes/update_dropout.py | ALSM-PhD/quip_classification | 45 | 14239 | <reponame>ALSM-PhD/quip_classification<filename>u24_lymphocyte/third_party/treeano/sandbox/nodes/update_dropout.py
"""
technique that randomly 0's out the update deltas for each parameter
"""
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
import treeano
import treeano.nod... | 2.125 | 2 |
zeromq/test/manifest.py | brettin/liquidhandling | 0 | 14240 | import os
import os.path
from datetime import datetime
import time
from stat import *
import pathlib
import json
def generateFileManifest(filename, manifest_filename=None):
string = ""
data = {}
if os.path.isfile(filename):
f = pathlib.Path(filename)
data[os.path.abspath(filename)] = {
... | 3.0625 | 3 |
shops/shop_util/test_shop_names.py | ikp4success/shopasource | 3 | 14241 | <gh_stars>1-10
from enum import Enum
class TestShopNames(Enum):
AMAZON = ("AMAZON",)
TARGET = ("TARGET",)
WALMART = ("WALMART",)
TJMAXX = ("TJMAXX",)
GOOGLE = ("GOOGLE",)
NEWEGG = ("NEWEGG",)
HM = ("HM",)
MICROCENTER = ("MICROCENTER",)
FASHIONNOVA = ("FASHIONNOVA",)
SIXPM = ("S... | 2.546875 | 3 |
package_manager/util_test.py | shahriak/dotnet5 | 10,302 | 14242 | import unittest
import os
from six import StringIO
from package_manager import util
CHECKSUM_TXT = "1915adb697103d42655711e7b00a7dbe398a33d7719d6370c01001273010d069"
DEBIAN_JESSIE_OS_RELEASE = """PRETTY_NAME="Distroless"
NAME="Debian GNU/Linux"
ID="debian"
VERSION_ID="8"
VERSION="Debian GNU/Linux 8 (jessie)"
HOME_UR... | 1.898438 | 2 |
testscripts/RDKB/component/TAD/TS_TAD_Download_SetInvalidDiagnosticsState.py | cablelabs/tools-tdkb | 0 | 14243 | ##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... | 1.53125 | 2 |
Tutorials/tutorial_01_intro.py | mseinstein/openCV | 0 | 14244 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 01 14:09:03 2017
@author: BJ
"""
import cv2
import os
from matplotlib import pyplot as plt
os.chdir('E:\\GitHub\\openCV\\Tutorials')
# %% IMAGES
# Load color image
# Add the flags 1, 0 or -1, to load a color image, load an image in
# grayscale mode or l... | 3.5 | 4 |
mutational_landscape/migrations/0003_auto_20220225_1650.py | protwis/Protwis | 0 | 14245 | # Generated by Django 2.2.1 on 2022-02-25 15:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mutational_landscape', '0002_auto_20180117_1457'),
]
operations = [
migrations.RemoveField(
model_name='diseasemutations',
n... | 1.453125 | 1 |
redis_benchmarks_specification/__init__.py | LaudateCorpus1/redis-benchmarks-specification | 4 | 14246 | # Apache License Version 2.0
#
# Copyright (c) 2021., Redis Labs
# All rights reserved.
#
# This attribute is the only one place that the version number is written down,
# so there is only one place to change it when the version number changes.
import pkg_resources
PKG_NAME = "redis-benchmarks-specification"
try:
... | 1.695313 | 2 |
rest_framework_helpers/fields/relation.py | Apkawa/django-rest-framework-helpers | 0 | 14247 | <reponame>Apkawa/django-rest-framework-helpers<filename>rest_framework_helpers/fields/relation.py
# coding: utf-8
from __future__ import unicode_literals
from collections import OrderedDict
import six
from django.db.models import Model
from rest_framework import serializers
class SerializableRelationField(serialize... | 2.015625 | 2 |
examples/guojiadianwang/devops/devopsPro.py | peng5550/DecryptLogin | 0 | 14248 | import requests
from utils import loginFile, dataAnalysis
import os
import datetime
from dateutil.relativedelta import relativedelta
import json
from utils.logCls import Logger
dirpath = os.path.dirname(__file__)
cookieFile = f"{dirpath}/utils/cookies.txt"
dataFile = f"{dirpath}/datas"
class DevopsProject:
def... | 2.421875 | 2 |
ezalor.py | WellerV/EzalorTools | 13 | 14249 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (c) 2018 - huwei <<EMAIL>>
"""
This is a python script for the ezalor tools which is used to io monitor.
You can use the script to open or off the switch, or point the package name which you want to monitor it only.
The core function is to export data what ezalor... | 2.71875 | 3 |
revisions/models.py | debrouwere/django-revisions | 6 | 14250 | # encoding: utf-8
import uuid
import difflib
from datetime import date
from django.db import models
from django.utils.translation import ugettext as _
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import IntegrityError
from django.contrib.contenttypes.models import ContentType... | 1.945313 | 2 |
noir/templating.py | gi0baro/noir | 2 | 14251 | <filename>noir/templating.py
import json
import os
from typing import Any, Dict, Optional
import tomlkit
import yaml
from renoir.apis import Renoir, ESCAPES, MODES
from renoir.writers import Writer as _Writer
from .utils import adict, obj_to_adict
class Writer(_Writer):
@staticmethod
def _to_unicode(data)... | 2.34375 | 2 |
GUI/lib/plotData.py | apajon/GUIPythonEncodeur | 0 | 14252 | <gh_stars>0
# Copyright (c) 2021 <NAME> (<EMAIL>)
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from api_phidget_n_MQTT.src.lib_global_python import searchLoggerFile
def PlotData(con... | 2.46875 | 2 |
nova/tests/unit/objects/test_resource.py | Nexenta/nova | 1 | 14253 | <gh_stars>1-10
# 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 in writing, ... | 1.796875 | 2 |
mandala/storages/rel_impl/psql_utils.py | amakelov/mandala | 9 | 14254 | from sqlalchemy.engine.base import Connection
from sqlalchemy.sql.selectable import Select, CompoundSelect
from sqlalchemy.engine.result import Result
from sqlalchemy.dialects import postgresql
from .utils import transaction
from ...common_imports import *
from ...util.common_ut import get_uid
from ...core.config imp... | 2.21875 | 2 |
tests/test_ami.py | seek-oss/aec | 6 | 14255 | import pytest
from moto import mock_ec2
from moto.ec2.models import AMIS
from aec.command.ami import delete, describe, share
@pytest.fixture
def mock_aws_config():
mock = mock_ec2()
mock.start()
return {
"region": "ap-southeast-2",
}
def test_describe_images(mock_aws_config):
# describ... | 2.078125 | 2 |
mainapp/views.py | H0oxy/sportcars | 0 | 14256 | <filename>mainapp/views.py<gh_stars>0
from django.views.generic import ListView
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
from mainapp.models import Manufacturer, Car
from mainapp.serializers import ManufacturerSerializer, CarSerializer
class ManufacturerList(Li... | 1.976563 | 2 |
BrandDetails.py | p10rahulm/brandyz-reco | 0 | 14257 | <filename>BrandDetails.py
# In this module we will get the brand count and the users per brand as a list.
# Add more details as deemed necessary
# I'm using mergesort here instead of quicksort as the size of data is much larger than for users
import Mergesort
import numpy as np
def get_brand_purchase_deets(shoppers,... | 3.21875 | 3 |
ATSAMD51P19A/libsrc/ATSAMD51P19A/MPU_.py | t-ikegami/WioTerminal-CircuitPython | 0 | 14258 | <filename>ATSAMD51P19A/libsrc/ATSAMD51P19A/MPU_.py
import uctypes as ct
MPU_ = {
'TYPE' : ( 0x00, {
'reg' : 0x00 | ct.UINT32,
'SEPARATE' : 0x00 | ct.BFUINT32 | 0 << ct.BF_POS | 1 << ct.BF_LEN,
'DREGION' : 0x00 | ct.BFUINT32 | 8 << ct.BF_POS | 8 << ct.BF_LEN,
'IREGION' : 0x00 | ct.BFUINT32... | 1.921875 | 2 |
lib/core/postprocess.py | Chris1nexus/tmp | 0 | 14259 | import torch
from lib.utils import is_parallel
import numpy as np
np.set_printoptions(threshold=np.inf)
import cv2
from sklearn.cluster import DBSCAN
def build_targets(cfg, predictions, targets, model, bdd=True):
'''
predictions
[16, 3, 32, 32, 85]
[16, 3, 16, 16, 85]
[16, 3, 8, 8, 85]
torch.t... | 2.1875 | 2 |
name.py | dachuanz/crash-course | 0 | 14260 | <filename>name.py<gh_stars>0
name = "<NAME>"
print(name.title())
| 1.546875 | 2 |
buildbot/runCI.py | DenisBakhvalov/perf-ninja | 1 | 14261 | <filename>buildbot/runCI.py
import sys
import subprocess
import os
import shutil
import argparse
import json
import re
from enum import Enum
from dataclasses import dataclass
import gbench
from gbench import util, report
from gbench.util import *
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYA... | 2.234375 | 2 |
main.py | TheSkidSlayer/VissageMassBanner | 1 | 14262 | <filename>main.py
try:
from concurrent.futures import ThreadPoolExecutor
import random, time, os, httpx
from colorama import Fore, Style
except ImportError:
print("Error [!] -> Modules Are not installed")
token, guild = input("Token -> "), input("\nGuild ID -> ")
threads = []
apiv = [6, 7, 8, 9]
code... | 2.3125 | 2 |
panos/example_with_output_template/loader.py | nembery/Skillets | 1 | 14263 | <gh_stars>1-10
#!/usr/bin/env python3
from skilletlib import SkilletLoader
sl = SkilletLoader('.')
skillet = sl.get_skillet_with_name('panos_cli_example')
context = dict()
context['cli_command'] = 'show system info'
context['username'] = 'admin'
context['password'] = '<PASSWORD>'
context['ip_address'] = 'NOPE'
out... | 1.976563 | 2 |
treasurehunt/views.py | code-haven/Django-treasurehunt-demo | 1 | 14264 | from django.views.generic import View
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'treasurehunt/treasurehunt_index.html') | 1.46875 | 1 |
setup.py | pletnes/cloud-pysec | 0 | 14265 | <filename>setup.py<gh_stars>0
""" xssec setup """
import codecs
from os import path
from setuptools import setup, find_packages
from sap.conf.config import USE_SAP_PY_JWT
CURRENT_DIR = path.abspath(path.dirname(__file__))
README_LOCATION = path.join(CURRENT_DIR, 'README.md')
VERSION = ''
with open(path.join(CURRENT_D... | 1.710938 | 2 |
mutators/implementations/mutation_change_proto.py | freingruber/JavaScript-Raider | 91 | 14266 | # Copyright 2022 @ReneFreingruber
#
# 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 2.109375 | 2 |
homeassistant/components/smarthab/light.py | tbarbette/core | 22,481 | 14267 | <gh_stars>1000+
"""Support for SmartHab device integration."""
from datetime import timedelta
import logging
import pysmarthab
from requests.exceptions import Timeout
from homeassistant.components.light import LightEntity
from . import DATA_HUB, DOMAIN
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelt... | 2.265625 | 2 |
hello.py | AaronTrip/cgi-lab | 0 | 14268 | #!/usr/bin/env python3
import os, json
print("Content-type: text/html\r\n\r\n")
print()
print("<Title>Test CGI</title>")
print("<p>Hello World cmput404 class!<p/>")
print(os.environ)
json_object = json.dumps(dict(os.environ), indent = 4)
print(json_object)
'''for param in os.environ.keys():
if(param == "HTT... | 2.828125 | 3 |
VCD/utils/utils.py | Xingyu-Lin/VCD | 25 | 14269 | <filename>VCD/utils/utils.py
import os.path as osp
import numpy as np
import cv2
import torch
from torchvision.utils import make_grid
from VCD.utils.camera_utils import project_to_image
import pyflex
import re
import h5py
import os
from softgym.utils.visualization import save_numpy_as_gif
from chester import logger
imp... | 2.171875 | 2 |
tests/test_classes.py | fossabot/RPGenie | 32 | 14270 | <filename>tests/test_classes.py
#! python3
""" Pytest-compatible tests for src/classes.py """
import sys
from pathlib import Path
from copy import deepcopy
from unittest import mock
# A workaround for tests not automatically setting
# root/src/ as the current working directory
path_to_src = Path(__file__).parent.pa... | 3.015625 | 3 |
biosteam/units/_shortcut_column.py | tylerhuntington222/biosteam | 0 | 14271 | <gh_stars>0
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020, <NAME> <<EMAIL>>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""
"""
from .... | 1.65625 | 2 |
vital/bindings/python/vital/types/camera_intrinsics.py | dstoup/kwiver | 0 | 14272 | """
ckwg +31
Copyright 2016 by Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the ... | 1.164063 | 1 |
utils/lanzouyun.py | Firesuiry/jdmm-client | 0 | 14273 | <gh_stars>0
from lanzou.api import LanZouCloud
import urllib.parse
final_files = []
final_share_infos = []
def lzy_login(cookies):
lzy = LanZouCloud()
cookie_dic = cookie_to_dic(cookies)
print(cookie_dic)
cookies = {
'ylogin': cookie_dic['ylogin'],
'phpdisk_info': urllib.parse.quote(c... | 2.421875 | 2 |
util/ndcg.py | voschezang/Data-Mining | 0 | 14274 | import numpy as np
import util.data
def ndcg(X_test, y_test, y_pred, ):
Xy_pred = X_test.copy([['srch_id', 'prop_id', 'score']])
Xy_pred['score_pred'] = y_pred
Xy_pred['score'] = y_test
Xy_pred.sort_values(['srch_id', 'score_pred'], ascending=[True, False])
dcg_test = DCG_dict(Xy_pred)
ndcg = ... | 2.453125 | 2 |
pycorrector/bert/bert_detector.py | zouning68/pycorrector | 45 | 14275 | <filename>pycorrector/bert/bert_detector.py
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description: use bert detect chinese char error
"""
import sys
import time
import numpy as np
import torch
from pytorch_transformers import BertForMaskedLM
from pytorch_transformers import BertTokenizer
sys.path.append('.... | 2.90625 | 3 |
example_app/core/models/input.py | dazza-codes/serverless-fast-api | 2 | 14276 | <reponame>dazza-codes/serverless-fast-api
from pydantic import BaseModel
class InputExample(BaseModel):
a: int = ...
b: int = ...
| 1.695313 | 2 |
2020/8/input.py | sishtiaq/aoc | 0 | 14277 | <gh_stars>0
test = [
'nop +0',
'acc +1',
'jmp +4',
'acc +3',
'jmp -3',
'acc -99',
'acc +1',
'jmp -4',
'acc +6',
]
actual = [
'acc +17',
'acc +37',
'acc -13',
'jmp +173',
'nop +100',
'acc -7',
'jmp +447',
'nop +283',
'acc +41',
'acc +32',
... | 1.390625 | 1 |
islecler.py | mrtyasar/PythonLearn | 0 | 14278 | <reponame>mrtyasar/PythonLearn
#----------------------------------#
######### ARİTMETİK İŞLEÇLER #######
#----------------------------------#
# + toplama
# - çıkarma
# * çarpma
# / bölme
# ** kuvvet
# % modülüs/kalan bulma
# // taban bölme/ tam bölme
#aritmetik işleçler sayısal işlemler yapmamızı sağlar
... | 4.0625 | 4 |
twindb_backup/modifiers/gzip.py | akuzminsky/twindb-mysql-backup | 1 | 14279 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Module defines modifier that compresses a stream with gzip
"""
from contextlib import contextmanager
from subprocess import Popen, PIPE
from twindb_backup.modifiers.base import Modifier
class Gzip(Modifier):
"""
Modifier that compresses the input_stream with gzip.
... | 2.671875 | 3 |
heat/objects/resource.py | larsks/heat | 0 | 14280 | # Copyright 2014 Intel Corp.
#
# 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 in writing, soft... | 1.796875 | 2 |
pyrez/exceptions/IdOrAuthEmpty.py | CLeendert/Pyrez | 25 | 14281 | <filename>pyrez/exceptions/IdOrAuthEmpty.py
from .PyrezException import PyrezException
class IdOrAuthEmpty(PyrezException):
"""Raises an error that the current Credentials is invalid or missing"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
| 2.5 | 2 |
leetcode/practise/59.py | Weis-98/learning_journey | 0 | 14282 | class Solution:
def generateMatrix(self, n):
matrix = []
num = 1
for i in range(n):
matrix.append([0 for i in range(n)])
top = 0
bottom = n - 1
left = 0
right = n - 1
while top <= bottom and left <= right:
for i in range(left, r... | 3.484375 | 3 |
capnpy/segment/builder.py | GambitResearch/capnpy | 45 | 14283 | import struct
from six import binary_type
from capnpy import ptr
from capnpy.packing import mychr
from capnpy.printer import print_buffer
class SegmentBuilder(object):
def __init__(self, length=None):
self.buf = bytearray()
def get_length(self):
return len(self.buf)
def as_string(self):... | 2.3125 | 2 |
test_project/test_app/migrations/0002_auto_20180514_0720.py | iCHEF/queryfilter | 4 | 14284 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-14 07:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app', '0001_initial'),
]
operations = [
migrations.AddField(
... | 1.695313 | 2 |
file.py | AllenGao6/P2P-File-Sharing | 0 | 14285 | <gh_stars>0
'''
objective of file.py:
define the object class for file,
information to include:
name
size of file
chunk list (should automaticlly be splitted into chunks, each chunk should have indicator)
'''
import base64
import sys
import hashlib
JPG, PNG, PDF, MP3, MP4, UNKNOWN = 1, 2... | 3.125 | 3 |
pdx-extract/tests/test_utils.py | michaelheyman/PSU-Code-Review | 0 | 14286 | import unittest.mock as mock
from app import utils
@mock.patch("app.utils.get_current_timestamp")
def test_generate_filename_generates_formatted_timestamp(mock_timestamp):
mock_timestamp.return_value = 1_555_555_555.555_555
filename = utils.generate_filename()
assert mock_timestamp.called is True
a... | 2.8125 | 3 |
.my_scripts/network/analyze_speedtest.py | infokiller/config-public | 17 | 14287 | <reponame>infokiller/config-public<gh_stars>10-100
#!/usr/bin/env python3
import argparse
import datetime
import os
import matplotlib.pyplot as plt
import pandas as pd
def main():
parser = argparse.ArgumentParser(description='Analyze speedtest csv file')
parser.add_argument('speedtest_file', help='Path to s... | 2.765625 | 3 |
tensorflow_datasets/text/wikipedia_toxicity_subtypes.py | stwind/datasets | 1 | 14288 | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | 1.554688 | 2 |
estimate-retrofit-impact-on-heat-pump-viability/plot_uvalue_distribution.py | rdmolony/projects | 3 | 14289 | <reponame>rdmolony/projects
import pandas as pd
import seaborn as sns
sns.set()
# + tags=["parameters"]
upstream = ["download_buildings"]
product = None
# -
buildings = pd.read_csv(upstream["download_buildings"])
buildings["wall_uvalue"].plot.hist(bins=30)
buildings["roof_uvalue"].plot.hist(bins=30)
buildings["w... | 2.5 | 2 |
src/core/base/Logging.py | albertmonfa/Banhmi | 0 | 14290 | #!/usr/bin/python
'''
Copyright 2018 <NAME>
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 in writing... | 2.421875 | 2 |
IzVerifier/test/test_izverifier.py | ahmedlawi92/IzVerifier | 0 | 14291 | from IzVerifier.izspecs.containers.izclasses import IzClasses
__author__ = 'fcanas'
import unittest
from IzVerifier.izspecs.containers.izconditions import IzConditions
from IzVerifier.izspecs.containers.izstrings import IzStrings
from IzVerifier.izspecs.containers.izvariables import IzVariables
from IzVerifier.izver... | 2.234375 | 2 |
src/envoxy/postgresql/client.py | muzzley/envoxy | 2 | 14292 | <gh_stars>1-10
from psycopg2.pool import ThreadedConnectionPool
import psycopg2.extras
import psycopg2.sql as sql
from contextlib import contextmanager
from threading import Semaphore
from ..db.exceptions import DatabaseException
from ..utils.logs import Log
from ..constants import MIN_CONN, MAX_CONN, TIMEOUT_CONN, DE... | 2.609375 | 3 |
treadmill/cli/admin/blackout.py | gaocegege/treadmill | 2 | 14293 | <reponame>gaocegege/treadmill
"""Kills all connections from a given treadmill server."""
import logging
import re
import click
import kazoo
from treadmill import presence
from treadmill import utils
from treadmill import zkutils
from treadmill import context
from treadmill import cli
from treadmill import zknamespa... | 2.1875 | 2 |
tests/view_tests/urls.py | peteralexandercharles/django | 0 | 14294 | import os
from functools import partial
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path, re_path
from django.utils.translation import gettext_lazy as _
from django.views import defaults, i18n, static
from . import views
base_dir = os.path.dirname(os.path.abspath(__file__))
media... | 2.109375 | 2 |
sympy/solvers/ode/systems.py | nsfinkelstein/sympy | 2 | 14295 | <reponame>nsfinkelstein/sympy<gh_stars>1-10
from sympy import (Derivative, Symbol)
from sympy.core.numbers import I
from sympy.core.relational import Eq
from sympy.core.symbol import Dummy
from sympy.functions import exp, im, cos, sin, re
from sympy.functions.combinatorial.factorials import factorial
from sympy.matrice... | 2.890625 | 3 |
python/torch_mlir/eager_mode/__init__.py | burntfalafel/torch-mlir-internal | 2 | 14296 | <gh_stars>1-10
import os
EAGER_MODE_DEBUG = os.environ.get("EAGER_MODE_DEBUG", 'False').lower() in ('true', '1', 't')
| 1.515625 | 2 |
docs/rips/tests/test_surfaces.py | OPM/ResInsight-UserDocumentation | 1 | 14297 | import sys
import os
import tempfile
from pathlib import Path
import pytest
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
import rips
import dataroot
@pytest.mark.skipif(
sys.platform.startswith("linux"),
reason="Brugge is currently exceptionally slow on Linux",
)
def test_create_and_export_surfac... | 2.25 | 2 |
samcli/cli/main.py | langn/aws-sam-cli | 0 | 14298 | """
Entry point for the CLI
"""
import logging
import click
from samcli import __version__
from .options import debug_option
from .context import Context
from .command import BaseCommand
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y-%m-%d %... | 2.3125 | 2 |
ast_to_json.py | visr/Py2Jl.jl | 53 | 14299 | <gh_stars>10-100
import ast
import typing as t
import numbers
import json
from wisepy.talking import Talking
from Redy.Tools.PathLib import Path
talking = Talking()
def to_dict(node: t.Union[ast.AST, str, numbers.Number, list]):
if isinstance(node, complex):
return {"class": "complex", "real": node.real,... | 2.921875 | 3 |