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 |
|---|---|---|---|---|---|---|
src/interactive_conditional_samples.py | 50417/gpt-2 | 0 | 22100 | #!/usr/bin/env python3
import fire
import json
import os
import numpy as np
import tensorflow as tf
import model, sample, encoder
def interact_model(
model_name='117M',
seed=None,
nsamples=1000,
batch_size=1,
length=None,
temperature=1,
top_k=0,
top_p=0.0
):
"""
Interactively ... | 3.078125 | 3 |
todofy/tests/conftest.py | bokiex/eti_todo | 1 | 22101 | <gh_stars>1-10
import pytest
@pytest.fixture(scope='module')
def driver():
from selenium import webdriver
options = webdriver.ChromeOptions()
options.headless = True
chrome = webdriver.Chrome(options=options)
chrome.set_window_size(1440, 900)
yield chrome
chrome.close()
| 1.695313 | 2 |
Fase 4 - Temas avanzados/Tema 11 - Modulos/Leccion 01 - Modulos/Saludos/test.py | ruben69695/python-course | 1 | 22102 | import saludos
saludos.saludar() | 1.109375 | 1 |
question_bank/split-array-into-fibonacci-sequence/split-array-into-fibonacci-sequence.py | yatengLG/leetcode-python | 9 | 22103 | <reponame>yatengLG/leetcode-python
# -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:148 ms, 在所有 Python3 提交中击败了35.57% 的用户
内存消耗:13.7 MB, 在所有 Python3 提交中击败了36.81% 的用户
解题思路:
回溯
具体实现见代码注释
"""
class Solution:
def splitIntoFibonacci(self, S: str) -> List[int]:
def backtrack(S, current):
if S... | 3.359375 | 3 |
convert_bootswatch_vurple.py | douglaskastle/bootswatch | 0 | 22104 | import re
import os
values = {
'uc': 'Vurple',
'lc': 'vurple',
'cl': '#116BB7',
}
def main():
infile = "yeti/variables.less"
f = open(infile, 'r')
lines = f.readlines()
f.close()
outfile = values['lc'] + "/variables.less"
f = open(outfile, 'w')
for line in lines:
l... | 2.625 | 3 |
python/interface_getPixel.py | BulliB/PixelTable | 2 | 22105 | #!/usr/bin/python3
from validData import *
from command import *
from readback import *
import sys
import time
# Expected Input
# 1: Row -> 0 to 9
# 2: Column -> 0 to 19
if (
isInt(sys.argv[1]) and strLengthIs(sys.argv[1],1) and
isInt(sys.argv[2]) and (strLengthIs(sys.argv[2],1) or strLengthIs(sys.ar... | 2.734375 | 3 |
FunTOTP/interface.py | Z33DD/FunTOTP | 3 | 22106 | from getpass import getpass
from colorama import init, Fore, Back, Style
yes = ['Y', 'y', 'YES', 'yes', 'Yes']
class interface(object):
"""
Terminal CLI
"""
def log(self, arg, get=False):
if not get:
print("[*]: {} ".format(arg))
else:
return "[*]: {} ".format(a... | 3.40625 | 3 |
envdsys/envcontacts/apps.py | NOAA-PMEL/envDataSystem | 1 | 22107 | from django.apps import AppConfig
class EnvcontactsConfig(AppConfig):
name = 'envcontacts'
# def ready(self) -> None:
# from envnet.registry.registry import ServiceRegistry
# try:
# from setup.ui_server_conf import run_config
# host = run_config["HOST"]["name"]
# ... | 1.90625 | 2 |
tests/interpreter.py | AndrejHatzi/Haya | 0 | 22108 | from sly import Lexer
from sly import Parser
import sys
#--------------------------
# While Loop
# Del Var
# Print stmt
# EQEQ, LEQ
#--------------------------
#=> This version has parenthesis precedence!
class BasicLexer(Lexer):
tokens = { NAME, NUMBER, STRING, IF, FOR, PRINT, CREATEFILE, WRITE, EQEQ,... | 2.953125 | 3 |
braintree/apple_pay_card.py | futureironman/braintree_python | 182 | 22109 | <filename>braintree/apple_pay_card.py
import braintree
from braintree.resource import Resource
class ApplePayCard(Resource):
"""
A class representing Braintree Apple Pay card objects.
"""
class CardType(object):
"""
Contants representing the type of the credit card. Available types are... | 3.25 | 3 |
src/lda_without_tf_idf_sports.py | mspkvp/MiningOpinionTweets | 1 | 22110 | <gh_stars>1-10
from __future__ import print_function
from time import time
import csv
import sys
import os
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
import lda
import logging
logging.basicConfig(filename='lda_analyser.log', level=logging.DEBUG)
entities = ['jose_mourinho',
... | 2.640625 | 3 |
glab_common/allsummary.py | gentnerlab/glab-common-py | 3 | 22111 | <reponame>gentnerlab/glab-common-py
from __future__ import print_function
import re
import datetime as dt
from behav.loading import load_data_pandas
import warnings
import subprocess
import os
import sys
process_fname = "/home/bird/opdat/panel_subject_behavior"
box_nums = []
bird_nums = []
processes = []
with open(p... | 1.984375 | 2 |
api/v1/circuits.py | tahoe/janitor | 52 | 22112 | from app.models import Circuit, CircuitSchema, Provider
from flask import make_response, jsonify
from app import db
def read_all():
"""
This function responds to a request for /circuits
with the complete lists of circuits
:return: sorted list of circuits
"""
circuits = Circuit.query.al... | 2.84375 | 3 |
youtube_related/client.py | kijk2869/youtube-related | 7 | 22113 | import asyncio
import json
import re
from collections import deque
from typing import Deque, Dict, List, Match, Pattern
import aiohttp
from .error import RateLimited
headers: dict = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
}
DATA_JSON: Pattern = re.compile(
r'(... | 2.53125 | 3 |
app/request/migrations/0001_initial.py | contestcrew/2019SeoulContest-Backend | 0 | 22114 | # Generated by Django 2.2.5 on 2019-09-24 09:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
... | 1.78125 | 2 |
field/FieldFactory.py | goph-R/NodeEditor | 0 | 22115 | <reponame>goph-R/NodeEditor
from PySide2.QtGui import QVector3D, QColor
from field.ColorField import ColorField
from field.FloatField import FloatField
from field.StringField import StringField
from field.Vector3Field import Vector3Field
class FieldFactory(object):
def create(self, property):
... | 2.453125 | 2 |
scrapy/utils/engine.py | sulochanaviji/scrapy | 8 | 22116 | """Some debugging functions for working with the Scrapy engine"""
# used in global tests code
from time import time # noqa: F401
def get_engine_status(engine):
"""Return a report of the current engine status"""
tests = [
"time()-engine.start_time",
"engine.has_capacity()",
"len(engin... | 2.75 | 3 |
share/pegasus/init/population/scripts/full_res_pop_raster.py | hariharan-devarajan/pegasus | 0 | 22117 | #!/usr/bin/python3
from typing import Dict
import optparse
import numpy as np
import rasterio
from rasterio import features
def main(county_pop_file, spatial_dist_file, fname_out, no_data_val=-9999):
'''
county_pop_file: County level population estimates
spatial_dist_file: Spatial projection of populati... | 2.71875 | 3 |
TestCase/pr_test_case.py | openeuler-mirror/ci-bot | 1 | 22118 | <reponame>openeuler-mirror/ci-bot
import os
import requests
import subprocess
import time
import yaml
class PullRequestOperation(object):
def __init__(self, owner, repo, local_owner):
"""initialize owner, repo and access_token"""
self.owner = owner
self.repo = repo
self.local_owner... | 2.6875 | 3 |
tempest/api/hybrid_cloud/compute/flavors/test_flavors_operations.py | Hybrid-Cloud/hybrid-tempest | 0 | 22119 | import testtools
from oslo_log import log
from tempest.api.compute import base
import tempest.api.compute.flavors.test_flavors as FlavorsV2Test
import tempest.api.compute.flavors.test_flavors_negative as FlavorsListWithDetailsNegativeTest
import tempest.api.compute.flavors.test_flavors_negative as FlavorDetailsNegativ... | 2.0625 | 2 |
dycall/exports.py | demberto/DyCall | 0 | 22120 | #!/usr/bin/env python3
"""
dycall.exports
~~~~~~~~~~~~~~
Contains `ExportsFrame` and `ExportsTreeView`.
"""
from __future__ import annotations
import logging
import pathlib
from typing import TYPE_CHECKING
import ttkbootstrap as tk
from ttkbootstrap import ttk
from ttkbootstrap.dialogs import Messagebox
from ttkbo... | 2.03125 | 2 |
src/homologs/filter_by_occupancy.py | jlanga/smsk_selection | 4 | 22121 | <filename>src/homologs/filter_by_occupancy.py<gh_stars>1-10
#!/usr/bin/env python
"""
Filter a fasta alignment according to its occupancy:
filter_by_occupancy.py fasta_raw.fa fasta_trimmed.fa 0.5
"""
import os
import sys
from helpers import fasta_to_dict
def filter_by_occupancy(filename_in, filename_out, min_occu... | 2.75 | 3 |
setup.py | eppeters/xontrib-dotenv | 0 | 22122 | <reponame>eppeters/xontrib-dotenv<filename>setup.py
#!/usr/bin/env python
"""
xontrib-dotenv
-----
Automatically reads .env file from current working directory
or parentdirectories and push variables to environment.
"""
from setuptools import setup
setup(
name='xontrib-dotenv',
version='0.1',
description... | 1.921875 | 2 |
tests/sample_app/urls.py | dreipol/meta-tagger | 3 | 22123 | <filename>tests/sample_app/urls.py
# -*- coding: utf-8 -*-
from django.conf.urls import url
from tests.sample_app.views import NewsArticleDetailView
urlpatterns = [
url(r'^(?P<pk>\d+)/$', NewsArticleDetailView.as_view(), name='news-article-detail'),
]
| 1.679688 | 2 |
RCNN/config_RCNN.py | andrew-miao/ECE657A_Project-text-classification | 4 | 22124 | class Config(object):
embedding_size = 300
n_layers = 1
hidden_size = 128
drop_prob = 0.2 | 1.359375 | 1 |
utils/bbox_utils/center_to_corner.py | Jaskaran197/Red-blood-cell-detection-SSD | 0 | 22125 | <filename>utils/bbox_utils/center_to_corner.py
import numpy as np
def center_to_corner(boxes):
""" Convert bounding boxes from center format (cx, cy, width, height) to corner format (xmin, ymin, xmax, ymax)
Args:
- boxes: numpy array of tensor containing all the boxes to be converted
Returns:
... | 3.71875 | 4 |
pytest/np.py | i0Ek3/disintegration | 0 | 22126 | <gh_stars>0
import numpy as np
list = [np.linspace([1,2,3], 3),\
np.array([1,2,3]),\
np.arange(3),\
np.arange(8).reshape(2,4),\
np.zeros((2,3)),\
np.zeros((2,3)).T,\
np.ones((3,1)),\
np.eye(3),\
np.full((3,3), 1),\
np.random.rand(3),\
np.random.rand(3,3),\
np.random.uniform(5,15,3),\
np.random.randn(3),\
np.random.nor... | 2.3125 | 2 |
api/data_explorer/models/__init__.py | karamalhotra/data-explorer | 0 | 22127 | <gh_stars>0
# coding: utf-8
# flake8: noqa
from __future__ import absolute_import
# import models into model package
from data_explorer.models.dataset_response import DatasetResponse
from data_explorer.models.facet import Facet
from data_explorer.models.facet_value import FacetValue
from data_explorer.models.facets_re... | 1.226563 | 1 |
seabird/cli.py | nicholas512/seabird | 38 | 22128 | <filename>seabird/cli.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Command line utilities for package Seabird
"""
import click
from seabird.exceptions import CNVError
from .cnv import fCNV
from .netcdf import cnv2nc
@click.group()
def cli():
""" Utilities for seabird files
"""
pa... | 2.5625 | 3 |
main.py | Mitch-the-Fridge/pi | 0 | 22129 | #!/usr/bin/env python3
#import face_recognition
import cv2
import numpy as np
from datetime import datetime, timedelta
from buffer import Buffer
from collections import deque
import os
from copy import copy
import archive
WEIGHT_EPS = 5
TIMEOUT = 5 # in seconds
def poll_weight():
return 500
# with an fps we the... | 2.671875 | 3 |
OpenPNM/Network/models/pore_topology.py | Eng-RSMY/OpenPNM | 1 | 22130 | r"""
===============================================================================
pore_topology -- functions for monitoring and adjusting topology
===============================================================================
"""
import scipy as _sp
def get_subscripts(network, shape, **kwargs):
r"""
Retu... | 2.859375 | 3 |
contrib/workflow/SpiffWorkflow/src/SpiffWorkflow/Tasks/Join.py | gonicus/clacks | 2 | 22131 | # Copyright (C) 2007 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed ... | 2.046875 | 2 |
covsirphy/visualization/bar_plot.py | ardhanii/covid19-sir | 97 | 22132 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
from matplotlib.ticker import ScalarFormatter
import pandas as pd
from covsirphy.util.argument import find_args
from covsirphy.visualization.vbase import VisualizeBase
class BarPlot(VisualizeBase):
"""
Create ... | 2.859375 | 3 |
03-process-unsplash-dataset.py | l294265421/natural-language-image-search | 0 | 22133 | import os
import math
from pathlib import Path
import clip
import torch
from PIL import Image
import numpy as np
import pandas as pd
from common import common_path
# Set the path to the photos
# dataset_version = "lite" # Use "lite" or "full"
# photos_path = Path("unsplash-dataset") / dataset_version / "photos"
ph... | 2.734375 | 3 |
treadmill_pipeline/treadmill.py | ttngu207/project-treadmill | 0 | 22134 | import numpy as np
import datajoint as dj
from treadmill_pipeline import project_database_prefix
from ephys.utilities import ingestion, time_sync
from ephys import get_schema_name
schema = dj.schema(project_database_prefix + 'treadmill_pipeline')
reference = dj.create_virtual_module('reference', get_schema_name('re... | 2.265625 | 2 |
management/api/v1/serializers.py | bwksoftware/cypetulip | 3 | 22135 | from rest_framework import serializers
from management.models.main import MailSetting, LdapSetting, ShopSetting, LegalSetting, Header, CacheSetting, Footer
class MailSettingSerializer(serializers.ModelSerializer):
id = serializers.ReadOnlyField()
class Meta:
model = MailSetting
fields = '__a... | 1.96875 | 2 |
tests/test_optimal.py | craffer/fantasy-coty | 0 | 22136 | """Unit test optimal lineup functions."""
import unittest
import copy
import ff_espn_api # pylint: disable=import-error
from collections import defaultdict
from fantasy_coty.main import add_to_optimal
class TestAddToOptimal(unittest.TestCase):
"""Test add_to_optimal() function."""
def setUp(self):
"... | 2.5625 | 3 |
spark/explorer.py | Elavarasan17/Stack-Overflow-Data-Dump-Analysis | 0 | 22137 | from pyspark import SparkConf, SparkContext
from pyspark.sql import SparkSession, functions, types
from pyspark.sql.functions import date_format
from pyspark.sql.functions import year, month, dayofmonth
import sys
import json
import argparse
assert sys.version_info >= (3, 5) # make sure we have Python 3.5+
# add more ... | 2.640625 | 3 |
self_supervised/loss.py | ravidziv/self-supervised-learning | 0 | 22138 | <filename>self_supervised/loss.py
"""Contrastive loss functions."""
from functools import partial
import tensorflow as tf
LARGE_NUM = 1e9
def cont_loss2(temperature: float):
func = partial(add_contrastive_loss, temperature=temperature)
func.__name__ = 'cont_loss2'
return func
def add_supervised_loss(l... | 2.78125 | 3 |
suzieq/engines/pandas/tables.py | zxiiro/suzieq | 0 | 22139 | import pandas as pd
from suzieq.engines.pandas.engineobj import SqPandasEngine
from suzieq.sqobjects import get_sqobject
class TableObj(SqPandasEngine):
@staticmethod
def table_name():
return 'tables'
def get(self, **kwargs):
"""Show the known tables for which we have information"""
... | 2.265625 | 2 |
connect_box/data.py | jtru/python-connect-box | 0 | 22140 | <gh_stars>0
"""Handle Data attributes."""
from datetime import datetime
from ipaddress import IPv4Address, IPv6Address, ip_address as convert_ip
from typing import Iterable, Union
import attr
@attr.s
class Device:
"""A single device."""
mac: str = attr.ib()
hostname: str = attr.ib(cmp=False)
ip: Uni... | 2.546875 | 3 |
components/server/src/data_model/sources/jenkins.py | m-zakeri/quality-time | 0 | 22141 | """Jenkins source."""
from ..meta.entity import Color, EntityAttributeType
from ..parameters import (
access_parameters,
Days,
FailureType,
MultipleChoiceParameter,
MultipleChoiceWithAdditionParameter,
TestResult,
)
from ..meta.source import Source
def jenkins_access_parameters(*args, **kwarg... | 2.28125 | 2 |
tests/test_transducer.py | dandersonw/myouji-kenchi | 7 | 22142 | <filename>tests/test_transducer.py
import myouji_kenchi
# Given that the output depends on what goes into the attested myouji file I'm
# hesitant to write too many tests in the blast radius of changes to that file
class TestTransducer():
nbt = myouji_kenchi.MyoujiBackTransliteration()
def assert_transliter... | 2.4375 | 2 |
algorithms/named/mergesort.py | thundergolfer/uni | 1 | 22143 | <filename>algorithms/named/mergesort.py
import unittest
from typing import List, Optional
# Consider making generic with:
# https://stackoverflow.com/a/47970232/4885590
def merge_sort(items: List[int], lo: int = 0, hi: Optional[int] = None) -> None:
if hi is None:
hi = len(items) - 1
if lo < hi:
... | 3.65625 | 4 |
pages/main_page.py | thaidem/selenium-training-page-objects | 0 | 22144 | <filename>pages/main_page.py
from selenium.webdriver.support.wait import WebDriverWait
class MainPage:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(driver, 10)
def open(self):
self.driver.get("https://litecart.stqa.ru/en/")
return self
@prop... | 2.78125 | 3 |
src/frr/tests/lib/test_nexthop_iter.py | zhouhaifeng/vpe | 0 | 22145 | import frrtest
class TestNexthopIter(frrtest.TestMultiOut):
program = "./test_nexthop_iter"
TestNexthopIter.onesimple("Simple test passed.")
TestNexthopIter.onesimple("PRNG test passed.")
| 1.40625 | 1 |
setup.py | themis-project/themis-finals-checker-app-py | 0 | 22146 | <gh_stars>0
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import io
import os
about = {}
about_filename = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'themis', 'finals', 'checker', 'app', '__about__.py')
with io.open(about_filename, 'rb') as fp:
exec(fp.read(), about)
... | 1.523438 | 2 |
tools/xenserver/cleanup_sm_locks.py | bopopescu/nova-token | 0 | 22147 | begin_unit
comment|'#!/usr/bin/env python'
nl|'\n'
nl|'\n'
comment|'# Copyright 2013 OpenStack Foundation'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License");'
nl|'\n'
comment|'# you may not use this file except in compliance with the License.'
nl|'\n'
comment|'# You m... | 1.625 | 2 |
clifun.py | tdimiduk/clifun | 1 | 22148 | <reponame>tdimiduk/clifun<gh_stars>1-10
import datetime as dt
import importlib.util
import inspect
import itertools
import json
import os
import pathlib
import sys
import types
import typing
from typing import (
Any,
Callable,
Dict,
Generic,
Iterable,
Iterator,
List,
Optional,
Set,
... | 2.84375 | 3 |
pages/views.py | joshua-hashimoto/eigo-of-the-day-django | 0 | 22149 | <reponame>joshua-hashimoto/eigo-of-the-day-django
import os
import json
import uuid
from django.conf import settings
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import View
import cloudinary
class MarkdownImageUploader(View):
"""
cus... | 2.515625 | 3 |
shc/log/in_memory.py | fabaff/smarthomeconnect | 5 | 22150 | import datetime
from typing import Optional, Type, Generic, List, Tuple
from ..base import T
from .generic import PersistenceVariable
class InMemoryPersistenceVariable(PersistenceVariable, Generic[T]):
def __init__(self, type_: Type[T], keep: datetime.timedelta):
super().__init__(type_, log=True)
... | 2.578125 | 3 |
guts/api/contrib/type_actions.py | smallwormer/stable-liberty-guts | 0 | 22151 | <reponame>smallwormer/stable-liberty-guts
# Copyright (c) 2015 Aptira Pty Ltd.
# 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.or... | 1.71875 | 2 |
models/StyleTransfer/AdaIN.py | mtroym/pytorch-train | 2 | 22152 | """
Author: <NAME> - <EMAIL>
Description: Transplant from "https://github.com/xunhuang1995/AdaIN-style/blob/master/train.lua"
"""
import functools
import os
from collections import OrderedDict
import torch
import torch.nn as nn
from torchvision.models import vgg19
from datasets.utils import denorm
from mo... | 1.84375 | 2 |
airflow/migrations/versions/52d714495f0_job_id_indices.py | rubeshdcube/incubator-airflow | 6 | 22153 | <reponame>rubeshdcube/incubator-airflow<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# 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 require... | 1.476563 | 1 |
deep_semantic_similarity_keras.py | viksit/Deep-Semantic-Similarity-Model | 3 | 22154 | <reponame>viksit/Deep-Semantic-Similarity-Model
# <NAME> (<EMAIL>)
# An implementation of the Deep Semantic Similarity Model (DSSM) found in [1].
# [1] <NAME>., <NAME>., <NAME>., <NAME>., and <NAME>. 2014. A latent semantic model
# with convolutional-pooling structure for information retrieval. In CIKM, pp. 101... | 2.984375 | 3 |
posthog/migrations/0087_fix_annotation_created_at.py | avoajaugochukwu/posthog | 7,409 | 22155 | # Generated by Django 3.0.7 on 2020-10-14 07:46
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("posthog", "0086_team_session_recording_opt_in"),
]
operations = [
migrations.AlterField(
model_name... | 1.789063 | 2 |
tumorevo/tumorfig/main.py | pedrofale/tumorevo | 2 | 22156 | """
Create a cartoon of a tumor given the frequencies of different genotypes.
"""
from .util import *
import pandas as pd
import matplotlib.pyplot as plt
import click
import os
from pathlib import Path
from pymuller import muller
@click.command(help="Plot the evolution of a tumor.")
@click.argument(
"genotype-... | 3.078125 | 3 |
Aulas/aula20/src/bb_circular.py | alexNeto/data-struct | 5 | 22157 | <reponame>alexNeto/data-struct
class Circular():
| 1.46875 | 1 |
src/brouwers/online_users/urls.py | modelbrouwers/modelbrouwers | 6 | 22158 | from django.conf.urls import url
from .views import get_online_users, set_online
app_name = 'online_users'
urlpatterns = [
url(r'^so/$', set_online),
url(r'^ous/$', get_online_users),
]
| 1.554688 | 2 |
dftb+/plot_spline.py | hsulab/DailyScripts | 2 | 22159 | <reponame>hsulab/DailyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import argparse
import numpy as np
import matplotlib as mpl
mpl.use('Agg') #silent mode
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, InsetPosition, zoomed_inset_axes, mark_in... | 2.484375 | 2 |
network_monitor/__init__.py | brennanhfredericks/network-monitor-client | 0 | 22160 | <gh_stars>0
import argparse
import netifaces
import sys
import signal
import os
import asyncio
from asyncio import CancelledError, Task
from typing import Optional, List, Any
from .services import (
Service_Manager,
Packet_Parser,
Packet_Submitter,
Packet_Filter,
)
from .configurations import gene... | 1.304688 | 1 |
investing_com/cs_pattern_list.py | filipecn/maldives | 1 | 22161 | #!/usr/bin/py
import pandas as pd
import os
# Holds investing.com candlestick patterns
class CSPatternList:
def __init__(self, path):
self.data = None
with os.scandir(path) as entries:
for e in entries:
if e.is_file() and os.path.splitext(e.path)[1] == '.csv':
... | 2.828125 | 3 |
simpleTest04Client_.py | LaplaceKorea/APIClient | 0 | 22162 | <filename>simpleTest04Client_.py
from LaplaceWSAPIClient import *
from MarkowitzSerde import *
from TargetSerde import *
from Operators import *
from TargetOperators import *
from RLStructure import *
from ClientConfig import client_config
query = RLQuery("default", datetime(2021,1,1), datetime(2021,1,21), {
... | 1.960938 | 2 |
vdisk.py | cookpan001/vdisk | 1 | 22163 | <gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
# author: cookpan001
import sys
import logging
import time
import mimetypes
import urllib
import urllib2
"""
oauth2 client
"""
class OAuth2(object):
ACCESS_TOKEN_URL = "https://auth.sina.com.cn/oauth2/access_token"
AUTHORIZE_URL = "https://auth.sina.com.cn/... | 2.6875 | 3 |
setup.py | thevoxium/netspeed | 0 | 22164 | from setuptools import setup
setup(
name='netspeed',
version='0.1',
py_modules=['netspeed'],
install_requires=[
'Click',
'pyspeedtest'
],
entry_points='''
[console_scripts]
netspeed=netspeed:cli
''',
)
| 1.28125 | 1 |
store/admin.py | salemzii/ChopFast | 0 | 22165 | from django.contrib import admin
from .models import (Dish, Payments, Order, Delivery, OrderItem)
admin.site.register(Dish)
admin.site.register(Payments)
admin.site.register(Order)
admin.site.register(Delivery)
admin.site.register(OrderItem)
| 1.3125 | 1 |
hpedockerplugin/request_context.py | renovate-bot/python-hpedockerplugin | 49 | 22166 | <reponame>renovate-bot/python-hpedockerplugin
import abc
import json
import re
from collections import OrderedDict
from oslo_log import log as logging
import hpedockerplugin.exception as exception
from hpedockerplugin.hpe import share
LOG = logging.getLogger(__name__)
class RequestContextBuilderFactory(object):
... | 2.34375 | 2 |
scripts/train_image_.py | shafieelab/SPyDERMAN | 1 | 22167 | <reponame>shafieelab/SPyDERMAN<filename>scripts/train_image_.py
import argparse
import csv
import os
import os.path as osp
import statistics
import tqdm
import time
from datetime import datetime
import copy
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import helper_utils.network as ... | 2.34375 | 2 |
src/freshchat/client/configuration.py | twyla-ai/python-freshchat | 4 | 22168 | import os
from dataclasses import dataclass, field
from typing import AnyStr, Dict, Optional
from urllib.parse import urljoin
@dataclass
class FreshChatConfiguration:
"""
Class represents the base configuration for Freshchat
"""
app_id: str
token: str = field(repr=False)
default_channel_id: O... | 2.984375 | 3 |
get_headers.py | rupendrab/py_unstr_parse | 0 | 22169 | <reponame>rupendrab/py_unstr_parse
#!/usr/bin/env python3.5
import sys
import re
import os
import csv
import numpy as np
from operator import itemgetter
from time import time
from multiprocessing import Pool
from extract_toc import parseargs
from predict_using_toc_mapper import Mapper, get_topic, read_model_file
from... | 1.84375 | 2 |
dalle_pytorch/dalle_pytorch.py | tensorfork/DALLE-pytorch | 1 | 22170 | from math import log2
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange
from x_transformers import Encoder, Decoder
# helpers
def exists(val):
return val is not None
def masked_mean(t, mask, dim = 1):
t = t.masked_fill(~mask[:, :, None], 0.)
return t.... | 2.234375 | 2 |
aiida_phonopy/parsers/phonopy.py | giovannipizzi/aiida-phonopy | 0 | 22171 | <reponame>giovannipizzi/aiida-phonopy
# -*- coding: utf-8 -*-
from aiida.orm.data.folder import FolderData
from aiida.parsers.parser import Parser
from aiida.common.datastructures import calc_states
from aiida.parsers.exceptions import OutputParsingError
from aiida.common.exceptions import UniquenessError
import numpy... | 2.46875 | 2 |
bagua/bagua_define.py | jphgxq/bagua | 1 | 22172 | import enum
from typing import List
import sys
if sys.version_info >= (3, 9):
from typing import TypedDict # pytype: disable=not-supported-yet
else:
from typing_extensions import TypedDict # pytype: disable=not-supported-yet
from pydantic import BaseModel
class TensorDtype(str, enum.Enum):
F32 = "f32"
... | 2.453125 | 2 |
instaphotos/apps.py | LekamCharity/insta-IG | 0 | 22173 | <reponame>LekamCharity/insta-IG
from django.apps import AppConfig
class InstaphotosConfig(AppConfig):
name = 'instaphotos'
| 1.007813 | 1 |
services/backend/expiring_links/tests/test_expiring_link_generator_serializer.py | patpio/drf_images_api | 1 | 22174 | <gh_stars>1-10
import pytest
from expiring_links.serializers import ExpiringLinkGeneratorSerializer
@pytest.mark.serializers
def test_fields(db, create_test_expiring_link_serializer_data):
assert list(create_test_expiring_link_serializer_data.keys()) == ['image_id', 'expiration_time']
@pytest.mark.serializers
... | 2.21875 | 2 |
com/vmware/nsx/trust_management_client.py | adammillerio/vsphere-automation-sdk-python | 0 | 22175 | <reponame>adammillerio/vsphere-automation-sdk-python
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2020 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.nsx.trust_management.
#--------... | 1.875 | 2 |
bottleneck/tests/list_input_test.py | stroxler/bottleneck | 2 | 22176 | "Test list input."
# For support of python 2.5
from __future__ import with_statement
import numpy as np
from numpy.testing import assert_equal, assert_array_almost_equal
import bottleneck as bn
# ---------------------------------------------------------------------------
# Check that functions can handle list input
... | 3.125 | 3 |
hanzo/warcindex.py | ukwa/warctools | 1 | 22177 | #!/usr/bin/env python
"""warcindex - dump warc index"""
import os
import sys
import sys
import os.path
from optparse import OptionParser
from .warctools import WarcRecord, expand_files
parser = OptionParser(usage="%prog [options] warc warc warc")
parser.add_option("-l", "--limit", dest="limit")
parser.add_option(... | 2.484375 | 2 |
tsdata/migrations/0001_initial.py | OpenDataPolicingNC/Traffic-Stops | 25 | 22178 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dataset',
fields=[
('id', models.AutoField(prim... | 1.796875 | 2 |
api/tests/opentrons/protocol_engine/execution/test_run_control_handler.py | mrod0101/opentrons | 235 | 22179 | <reponame>mrod0101/opentrons
"""Run control side-effect handler."""
import pytest
from decoy import Decoy
from opentrons.protocol_engine.state import StateStore
from opentrons.protocol_engine.actions import ActionDispatcher, PauseAction
from opentrons.protocol_engine.execution.run_control import RunControlHandler
from... | 2.34375 | 2 |
Datasets/Generator/Healthcare/mergedrug.py | undraaa/m2bench | 0 | 22180 | <gh_stars>0
import json
import glob
def merge_drug(drug_dirpath):
#start_time = time.time()
print("\n----- MERGING json data into merged_drug.json -----")
result = []
for f in glob.glob(drug_dirpath+'/*.json'):
with open(f,"rb") as infile:
result.append(json.load(infile))
with... | 2.78125 | 3 |
tests/test_rundramatiq_command.py | BradleyKirton/django_dramatiq | 0 | 22181 | <reponame>BradleyKirton/django_dramatiq
import os
import sys
from io import StringIO
from unittest.mock import patch
from django.core.management import call_command
from django_dramatiq.management.commands import rundramatiq
def test_rundramatiq_command_autodiscovers_modules():
assert rundramatiq.Command().disco... | 2.25 | 2 |
WordRPG/data/states/new_game.py | ChristopherLBruce/WordRPG | 2 | 22182 | """ 'new_game' state. Includes character creation. """
from ...engine.gui.screen import const, Screen
from ...engine.state_machine import State
class New_Game(State):
def __init__(self):
""" Initiailize class and super class """
super(New_Game, self).__init__()
self.screen = self._init... | 3.140625 | 3 |
guestbook.py | Tycx2ry/FKRTimeline | 0 | 22183 | <filename>guestbook.py
#!/usr /bin/env python
# -*- coding: utf-8 -*-
__author__ = 'jiangge'
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from flask import Flask, request, render_template, redirect
application = Flask(__name__)
application.config['SQLALCHEMY_DATABASE_URI'] = 'sqlit... | 2.84375 | 3 |
dash_test_runner/testapp/migrations/0001_initial.py | Ilhasoft/dash | 0 | 22184 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orgs', '0015_auto_20160209_0926'),
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
('id', models.AutoField(verbose_name='ID', seria... | 1.734375 | 2 |
tests/test_integration.py | Radico/business-rules | 0 | 22185 | <reponame>Radico/business-rules<filename>tests/test_integration.py
from __future__ import absolute_import
from business_rules.actions import rule_action, BaseActions
from business_rules.engine import check_condition, run_all
from business_rules.fields import FIELD_TEXT, FIELD_NUMERIC, FIELD_SELECT
from business_rules.v... | 2.328125 | 2 |
cog/cli/user_argparser.py | Demonware/cog | 2 | 22186 |
# -*- coding: utf-8 -*-
import sys
import argparse
arg_no = len(sys.argv)
tool_parser = argparse.ArgumentParser(add_help=False)
tool_subparsers = tool_parser.add_subparsers(help='commands', dest='command')
# The rename command.
rename_parser = tool_subparsers.add_parser('rename', help='rename an existing user acco... | 2.6875 | 3 |
custom_components/wisersmart/climate.py | tomtomfx/wiserSmartForHA | 1 | 22187 | """
Climate Platform Device for Wiser Smart
https://github.com/tomtomfx/wiserSmartForHA
<EMAIL>
"""
import asyncio
import logging
import voluptuous as vol
from functools import partial
from ruamel.yaml import YAML as yaml
from homeassistant.components.climate import ClimateEntity
from homeassistant.core import cal... | 2.34375 | 2 |
src/dataset/utils/process_df.py | Fkaneko/kaggle_g2net_gravitational_wave_detection- | 0 | 22188 | import os
from functools import partial
from multiprocessing import Pool
from typing import Any, Callable, Dict, List, Optional
import numpy as np
import pandas as pd
from tqdm import tqdm
from src.dataset.utils.waveform_preprocessings import preprocess_strain
def id_2_path(
image_id: str,
is_train: bool = ... | 2.296875 | 2 |
sa/migrations/0051_managedobject_set_profile.py | prorevizor/noc | 84 | 22189 | <reponame>prorevizor/noc
# ----------------------------------------------------------------------
# managedobject set profile
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------... | 1.851563 | 2 |
oct2py/compat.py | sdvillal/oct2py | 8 | 22190 | <reponame>sdvillal/oct2py
# -*- coding: utf-8 -*-
import sys
PY2 = sys.version[0] == '2'
PY3 = sys.version[0] == '3'
if PY2:
unicode = unicode
long = long
from StringIO import StringIO
import Queue as queue
else: # pragma : no cover
unicode = str
long = int
from io import StringIO
im... | 2.1875 | 2 |
lambda_functions/compute/campaign/aws.py | pierrealixt/MapCampaigner | 0 | 22191 | <filename>lambda_functions/compute/campaign/aws.py
import os
import json
import boto3
class S3Data(object):
"""
Class for AWS S3
"""
def __init__(self):
"""
Initialize the s3 client.
"""
self.s3 = boto3.client('s3')
self.bucket = os.environ['S3_BUCKET']
de... | 3.375 | 3 |
infra/utils/launch_ec2.py | philipmac/nephele2 | 1 | 22192 | #!/usr/bin/env python3
import os
import boto3
import botocore.exceptions
import argparse
import yaml
from nephele2 import NepheleError
mand_vars = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY']
perm_error = """\n\nIt seems you have not set up your AWS correctly.
Should you be running this with Awssume? Or have profile... | 2.1875 | 2 |
tests/test_wvlns.py | seignovert/pyvims | 4 | 22193 | <filename>tests/test_wvlns.py
"""Test VIMS wavelength module."""
from pathlib import Path
import numpy as np
from numpy.testing import assert_array_almost_equal as assert_array
from pyvims import QUB
from pyvims.vars import ROOT_DATA
from pyvims.wvlns import (BAD_IR_PIXELS, CHANNELS, FWHM, SHIFT,
... | 2.484375 | 2 |
Outliers/loss/losses.py | MakotoTAKAMATSU013/Outliers | 0 | 22194 | <filename>Outliers/loss/losses.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class LabelSmoothingCrossEntropy(nn.Module):
def __init__(self, smoothing = 0.1):
super(LabelSmoothingCrossEntropy, self).__init__()
assert smoothing < 0.1
self.smoothing = smoothing
... | 2.5625 | 3 |
esiosdata/importdemdata.py | azogue/esiosdata | 20 | 22195 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 27 18:16:24 2015
@author: <NAME>
A raíz del cambio previsto:
DESCONEXIÓN DE LA WEB PÚBLICA CLÁSICA DE E·SIOS
La Web pública clásica de e·sios (http://www.esios.ree.es) será desconectada el día 29 de marzo de 2016.
Continuaremos ofreciendo servicio en la nueva Web del Op... | 2.359375 | 2 |
brainfrick.py | rium9/brainfrick | 0 | 22196 | class BrainfuckException(Exception):
pass
class BLexer:
""" Static class encapsulating functionality for lexing Brainfuck programs. """
symbols = [
'>', '<', '+', '-',
'.', ',', '[', ']'
]
@staticmethod
def lex(code):
""" Return a generator for tokens in... | 3.5625 | 4 |
infra_macros/fbcode_macros/build_defs/build_info.bzl | martarozek/buckit | 0 | 22197 | load("@fbcode_macros//build_defs:config.bzl", "config")
load("@fbcode_macros//build_defs/config:read_configs.bzl", "read_int")
load("@fbcode_macros//build_defs:core_tools.bzl", "core_tools")
def _create_build_info(
build_mode,
buck_package,
name,
rule_type,
platform,
epochtime=0,
host="",
... | 1.757813 | 2 |
src/scan.py | Unitato/github-public-alert | 0 | 22198 | #!#!/usr/bin/env python
import os
from github import Github
from libraries.notify import Notify
import json
print("")
print("Scanning Github repos")
GITHUB_API_KEY = os.environ.get('GITHUB_API_KEY')
WHITELIST = json.loads(os.environ.get('GITHUB_WHITELIST').lower())
GITHUB_SCAN = json.loads(os.environ.get('GITHUB_SCAN... | 2.734375 | 3 |
models.py | YavorPaunov/await | 0 | 22199 | from flask.ext.sqlalchemy import SQLAlchemy
from util import hex_to_rgb, rgb_to_hex
from time2words import relative_time_to_text
from datetime import datetime
from dateutil.tz import tzutc
import pytz
db = SQLAlchemy()
def created_on_default():
return datetime.utcnow()
class Counter(db.Model):
__tablename__ ... | 2.421875 | 2 |