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 |
|---|---|---|---|---|---|---|
zip.py | aziz-alqudsy/basic-python | 0 | 12768651 | # dictionaries
friends = ["john", "andre", "mark", "robert"]
ages = [23, 43, 54, 12]
biodatas_dict = dict(zip(friends, ages))
print(biodatas_dict)
# list
biodatas_list = list(zip(friends, ages))
print(biodatas_list)
# tuple
biodatas_tuple = tuple(zip(friends, ages))
print(biodatas_tuple)
| 4.0625 | 4 |
lithium/manage/templates/app.py | PressLabs/lithium | 2 | 12768652 | <reponame>PressLabs/lithium
import os
from importlib import import_module
from flask import Flask
from flask.ext.admin.contrib.sqla import ModelView as AdminModelView
from {{app_name}}.extensions import db, admin, migrate
from lithium.views import ModelView
cache = []
def create_app(config=None):
app = Flask(__... | 2.03125 | 2 |
fitness_guide/menu/migrations/0003_alter_product_options_product_name_and_more.py | tunsmm/fitness_guide | 1 | 12768653 | <reponame>tunsmm/fitness_guide
# Generated by Django 4.0.1 on 2022-04-07 20:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('menu', '0002_product_alter_client_options'),
]
operations = [
migrations.AlterModelOptions(
name=... | 1.726563 | 2 |
145.py | juandarr/ProjectEuler | 0 | 12768654 | """
Finds the amount of reversible numbers below limit_n
Author: <NAME>
"""
import math
from time import time
# Iterator to create values to run in the algorithm
class Range_reverse:
def __init__(self, start,limit_n):
self.current_value = start
self.limit = 10**7
self.maximum = limit_n
... | 3.703125 | 4 |
tests/setup_logger.py | nyoungstudios/multiflow | 0 | 12768655 | import logging
import sys
LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
def get_logger(name, log_format=LOG_FORMAT):
logger = logging.getLogger(name)
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(logging.Formatter(log_format))
logger.addHandler(handler)... | 2.75 | 3 |
views/spot.py | sbutler/spacescout_web | 0 | 12768656 | <gh_stars>0
""" Copyright 2012, 2013 UW Information Technology, University of Washington
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
... | 1.859375 | 2 |
worker/utils/extra_helpers/memcached_helper.py | pugpngying123/dataflux-func | 1 | 12768657 | # -*- coding: utf-8 -*-
# Builtin Modules
import json
import time
import traceback
# 3rd-party Modules
import memcache
import six
# Project Modules
from worker.utils import toolkit
from worker.utils.log_helper import LogHelper
def get_config(c):
servers = c.get('servers') or None
if servers and isinstance(s... | 2.171875 | 2 |
swagger.py | victorgrubio/flask-mongo-template-api | 0 | 12768658 | <filename>swagger.py
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin
import json
import yaml
import schemas
from app import app as flask_app
import app
"""Create spec
"""
spec = APISpec(
openapi_version="3.0.0",
title="Healt... | 2.328125 | 2 |
python/hard_python/guess/method.py | ii6uu99/ipynb | 1 | 12768659 | <filename>python/hard_python/guess/method.py<gh_stars>1-10
#引入模块
# import method2
# method2.a
# method2.f1()
# import method2 as m2
# m2.a
# m2.f1()
# from method2 import f1
# f1()
# from method2 import f1 as func1
# func1()
from method2 import *
f1()
f2()
print(a)
| 2.515625 | 3 |
Q07__/43_Network_Delay_Time/test.py | hsclinical/leetcode | 0 | 12768660 | <reponame>hsclinical/leetcode
#!/usr/bin/python
from Solution import MyCalendarTwo
| 1.164063 | 1 |
python/rosie/evaluation/modifiers/fill/run_rosie.py | SoarGroup/rosie | 20 | 12768661 | <gh_stars>10-100
from tkinter import *
import tkinter.font
import sys
import os
from rosie import RosieGUI
from rosie.testing import TestAgent
from mobilesim.rosie import MobileSimAgent
def launch_gui(rosie_config):
root = Tk()
eval_agent = MobileSimAgent(rosie_config)
eval_agent.messages.append("!CMD cl... | 2.5625 | 3 |
werewolf/parser.py | jan-g/slackwolf | 0 | 12768662 | import re
from .sentinel import Sentinel
def kleene(parser):
def parse_many(text):
text = text.lstrip()
if len(text) > 0:
for item, text1 in parser(text):
for items, text2 in parse_many(text1):
yield ([item] + items, text2)
else:
... | 2.90625 | 3 |
bindings/Python/src/pylibkriging/__init__.py | libKriging/libKriging | 8 | 12768663 | import platform
if platform.system() == "Windows":
import os
import sys
shared_lib_paths = [os.path.join(os.path.dirname(__file__), 'shared_libs')] # cf setup.py
lk_path = os.environ.get("LIBKRIGING_DLL_PATH")
if lk_path:
for path in lk_path.split(os.pathsep):
shared_lib_paths... | 1.960938 | 2 |
read_file.py | its-mithril/HVALLA-Item-Roller-public-vers | 0 | 12768664 | # this handles all the reading from file + creating dictionaries
# everything is separated by tabs
import os
def open_table(path, hunting=False):
if hunting:
_bullshit = "hunting/" + path
else:
_bullshit = path
file_path = "loot_tables"
num_tables = sum(len(files) for f, f... | 3.390625 | 3 |
todo/admin.py | fidele000/Ftodo-RestAPI-Django | 0 | 12768665 | <reponame>fidele000/Ftodo-RestAPI-Django
from todo.models import UserProfile
from django.contrib import admin
# Register your models here.
admin.site.register(UserProfile) | 1.445313 | 1 |
tests/test_linter/test_contract.py | rpdelaney/deal | 0 | 12768666 | <filename>tests/test_linter/test_contract.py
import ast
from textwrap import dedent
import astroid
import pytest
from deal.linter._contract import Category, Contract
from deal.linter._func import Func
TEXT = """
import deal
@deal.raises(ValueError, UnknownError, idk_what_is_it())
@notadeal.raises(KeyError)
def f(x... | 2.546875 | 3 |
app/messenger/utils.py | joeseggie/resourceidea | 0 | 12768667 | <reponame>joeseggie/resourceidea
"""
Messenger utils.
"""
import os
import boto3
from botocore.exceptions import ClientError
def send_email(
recipients: list,
subject: str,
message_text: str = None,
message_html: str = None) -> dict:
"""
Send email.
Args:
recipien... | 2.0625 | 2 |
temp.py | VincentGaoHJ/Spyder-Mafengwo | 0 | 12768668 | <filename>temp.py
# -*- coding: utf-8 -*-
"""
@Date: Created on Tue Mar 26 21:25:29 2019
@Author: <NAME>
@Description: 用于调试代码
"""
<<<<<<< HEAD
=======
import csv
with open("test.csv", "w", newline='') as csvfile:
writer = csv.writer(csvfile)
# 先写入columns_name
writer.writerow(["index", "a_name", "b_name"]... | 3.234375 | 3 |
tests/unit_tests/test_tethys_apps/test_templatetags/test_tags.py | rfun/tethys | 79 | 12768669 | import unittest
from unittest import mock
from tethys_apps.templatetags import tags as t
class TestTags(unittest.TestCase):
def setUp(self):
# app_list
self.app_names = ['app1', 'app2', 'app3', 'app4', 'app5', 'app6']
self.tag_names = ['tag1', 'tag_2', 'tag 3', 'tag four', 'Tag Five', 'tag... | 2.640625 | 3 |
choice/apps.py | prayogateguh/smk-quiz | 0 | 12768670 | <filename>choice/apps.py
from django.apps import AppConfig
class ChoiceConfig(AppConfig):
name = 'choice'
| 1.507813 | 2 |
test/kernel/integration/LiveUpdate/test.py | jaeh/IncludeOS | 3,673 | 12768671 | <filename>test/kernel/integration/LiveUpdate/test.py<gh_stars>1000+
#!/usr/bin/env python3
from builtins import str
import sys
import os
import socket
from vmrunner import vmrunner
vm = vmrunner.vms[0]
def begin_test(line):
f = open('./kernel_LiveUpdate','rb')
s = socket.socket()
s.connect(("10.0.0.59",... | 1.773438 | 2 |
classification/optimizer/optimizer.py | hirune924/CVpipeline | 0 | 12768672 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch.optim as optim
import optimizer.custom_optimizer as custom_optimizer
def get_optimizer_from_name(opt_name=None, model=None, target=[], opt_params={}, mode='yaml', lib='torch'):
if lib=='torch':
lib=optim
elif lib=='custom':
lib = custom... | 2.40625 | 2 |
lib_stylegan/style_gan/seed.py | leoHeidel/3d-style | 4 | 12768673 | import tensorflow as tf
import tensorflow.keras as keras
import lib_stylegan
def get_random_noise(batch_size=8):
random_noise = tf.random.normal(shape=(batch_size, 8))
return random_noise[:,:3], random_noise[:,3:6], random_noise[:,6], random_noise[:,7]
def make_seed_standard(model):
start_dim = mod... | 2.46875 | 2 |
mentor/matching/models.py | JarettSutula/GoatBoat | 0 | 12768674 | <filename>mentor/matching/models.py<gh_stars>0
from django.db import models
from django import forms
from utils import start_db, collection_link, dynamic_class_dropdown
from django.core.exceptions import ValidationError
import bcrypt
# Create your models here.
CLASS_CHOICES = [
('none', ''),
('CMPT120', 'CMPT ... | 2.265625 | 2 |
Python/parsers/rssparser.py | hyPnOtICDo0g/code-dump | 0 | 12768675 | <reponame>hyPnOtICDo0g/code-dump
# Simple RSS feed item scraper
import feedparser
items = []
n = 0
file = open("rss_urls.txt", "r")
rss_list = file.read().splitlines()
for feeds in rss_list:
items = feedparser.parse(feeds)
while(n>=0):
try:
print (items.entries[n]['link'])
#p... | 3.09375 | 3 |
management_api_app/models/schemas/workspace_template.py | LizaShak/AzureTRE | 0 | 12768676 | from typing import List, Dict
from pydantic import BaseModel, Field
from models.domain.resource import ResourceType
from models.domain.resource_template import ResourceTemplate, Property
def get_sample_workspace_template_object(template_name: str = "tre-workspace-vanilla") -> ResourceTemplate:
return ResourceTem... | 2.25 | 2 |
ramannoodles/dataprep.py | raman-noodles/Raman-noodles | 15 | 12768677 | <filename>ramannoodles/dataprep.py
"""docstring"""
import h5py
import pandas as pd
import matplotlib.pyplot as plt
from ramannoodles import spectrafit
def new_hdf5(new_filename):
"""docstring"""
# handling input errors
if not isinstance(new_filename, str):
raise TypeError('Passed value of `filenam... | 3.015625 | 3 |
dec_6/dec_6.py | gasparia405/aoc2021 | 0 | 12768678 | <gh_stars>0
#!/usr/bin/env python
def count_fish(lanternfish: list, repro_day: int) -> int:
return len([x for x in lanternfish if x == repro_day])
def pass_one_day(fish_age_hash: dict, day: int, lanternfish: list=None):
if day == 0:
if not lanternfish:
raise AttributeError("Error: lanternf... | 3.265625 | 3 |
hmcli/listener/scan.py | JarbasHiveMind/hmcli | 0 | 12768679 | import click
from rich.console import Console
from rich.table import Table
from .cmd_group import listener_cmds
@click.command("scan", help="scan for Nodes")
def scan_and_print():
from HiveMind_presence import LocalDiscovery
table = Table(title="HiveMind Devices")
table.add_column("Name", justify="cente... | 2.5625 | 3 |
chapter6/6_9Decoding and Encoding Hexadecimal Digits/6_9.py | atigerboy/PythonCookBook | 0 | 12768680 | s = b'Hello World'
import binascii
h = binascii.b2a_hex( s )
print( h )
print( binascii.a2b_hex( h ))
import base64
h = base64.b16encode( s )
print( h )
print( base64.b16decode( h ) )
print( h.decode('ascii')) | 2.859375 | 3 |
taichi_course01_final/Scene.py | SIGUSR97/taichi_course01_final | 1 | 12768681 | import taichi as ti
from taichi_course01_final.Types import HitResult, HittableObject, HittableObjectType, MaterialType
import taichi_course01_final.HittableObject.Sphere as Sphere
import taichi_course01_final.HittableObject.Plane as Plane
import taichi_course01_final.HittableObject.Ellipse as Ellipse
@ti.data_orien... | 2.140625 | 2 |
underworld/libUnderworld/config/packages/StGermain.py | longgangfan/underworld2 | 116 | 12768682 | <filename>underworld/libUnderworld/config/packages/StGermain.py
import os
from config import Package
from .libXML2 import libXML2
from .MPI import MPI
from .pcu import pcu
class StGermain(Package):
def setup_dependencies(self):
self.mpi = self.add_dependency(MPI, required=True)
self.libxml2 = self... | 2.21875 | 2 |
src/ufdl/json/core/jobs/_WorkableTemplateSpec.py | waikato-ufdl/ufdl-json-messages | 0 | 12768683 | <reponame>waikato-ufdl/ufdl-json-messages
from typing import List
from wai.json.object import StrictJSONObject
from wai.json.object.property import StringProperty, ArrayProperty
from ._InputSpec import InputSpec
from ._ParameterSpec import ParameterSpec
class WorkableTemplateSpec(StrictJSONObject['WorkableTemplateS... | 2.125 | 2 |
Kafkastuff/Kafka consumer.py | chouams/Stream-Analytics | 2 | 12768684 | from kafka import KafkaConsumer
import time
Topic ='pi_test'
consumer = KafkaConsumer(Topic,auto_offset_reset='earliest', enable_auto_commit=False)
i=0
DATA_DICT = {"u","v","t","s"}
for message in consumer:
text = message.value.decode("utf-8")
text = text.translate('b')
print (message.topic, text)
appen... | 2.75 | 3 |
invenio_app/wsgi_ui.py | topless/invenio-app | 0 | 12768685 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""UI-only WSGI application for Invenio flavours."""
from __future__ import absolute... | 0.976563 | 1 |
21/01/3.py | pylangstudy/201707 | 0 | 12768686 | class MyClass:
def __call__(self): print('__call__')
c = MyClass()
c()
c.__call__()
print()
c.__call__ = lambda: print('overriding call')
c()
c.__call__()
| 3.25 | 3 |
activity/activity_ApplyVersionNumber.py | elifesciences/elife-bot | 17 | 12768687 | <gh_stars>10-100
import json
import os
import re
from os import path
import boto.s3
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from provider.execution_context import get_session
from provider.article_structure import ArticleInfo
import provider.article_structure as article_structure
import ... | 1.859375 | 2 |
assets/scripts/test_tmx.py | hanselrd/bubble-warriors-adventure | 1 | 12768688 | <reponame>hanselrd/bubble-warriors-adventure
def main(map):
from game import settings
from game.tmx import Map, Layer
print('Map [%s]:' % 'some map')
print(' width:', map.width)
print(' height:', map.height)
print(' tilewidth:', map.tilewidth)
print(' tileheight:', map.tileheight)
p... | 3.015625 | 3 |
src/tools/sac_vis.py | Yunaik/drl_env | 0 | 12768689 | <reponame>Yunaik/drl_env
import os
import glob2, pickle
import numpy as np
from matplotlib import pyplot as plt
from scipy.ndimage.filters import gaussian_filter1d
dataPath = '../data/report_data/async'
sync_prefix = '../data/report_data/sync/laikago-report-b'
async_prefix = '../data/report_data/async/laikago-repor... | 2.28125 | 2 |
fastfood/customer/forms.py | Toffy-dev/bds-project-assignment-3 | 0 | 12768690 | <filename>fastfood/customer/forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm
from main.models import Customer
from phonenumber_field.modelfields import PhoneNumberField
class RegisterForm(UserCreationForm):
email = forms.EmailField()
phone_number = PhoneNumberField()
... | 2.015625 | 2 |
Rustik Bot/config.py | Creveoolus/youtube-discord-bot | 0 | 12768691 | token = '<PASSWORD>'
firebase = {
"apiKey": "<KEY>",
"authDomain": "test24-13912.firebaseapp.com",
"databaseURL": "https://test24-13912-default-rtdb.firebaseio.com",
"projectId": "test24-13912",
"storageBucket": "test24-13912.appspot.com",
"messagingSenderId": "939334214645",
"appId": "1:939334214645:web:3d8f56... | 1.46875 | 1 |
baseline.py | gautierdag/cultural-evolution-engine | 4 | 12768692 | <reponame>gautierdag/cultural-evolution-engine
# Baseline setting in which there are only two agents
# - no evolution
import pickle
import argparse
import sys
import torch
from tensorboardX import SummaryWriter
from utils import *
from cee.metrics import representation_similarity_analysis, language_entropy
from bas... | 2.359375 | 2 |
examples/experiments/calm-textgame/drrn/model.py | qxcv/jiminy-cricket | 11 | 12768693 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import itertools
from memory import State
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class DRRN(torch.nn.Module):
"""
Deep Reinforcement Relevance Network - He et al. '16
"""
def __i... | 2.734375 | 3 |
igramscraper/endpoints/instagram_query_id.py | a7t0fwa7/instagram-scraper | 1 | 12768694 | class InstagramQueryId:
USER_MEDIAS = '17880160963012870'
USER_STORIES = '17890626976041463'
STORIES = '17873473675158481'
| 1.1875 | 1 |
fbcrawl/spiders/fbcrawl.py | ziostanko/fbcrawl | 0 | 12768695 | <reponame>ziostanko/fbcrawl
import scrapy
from scrapy.loader import ItemLoader
from scrapy.http import FormRequest
from fbcrawl.items import FbcrawlItem
class FacebookSpider(scrapy.Spider):
"""
Parse FB pages (needs credentials)
"""
name = "fb"
def __init__(self, email='', password='', page=... | 2.640625 | 3 |
test.py | moosetraveller/arcpy-util | 0 | 12768696 | import test.xcursor_test as xcursor_test
import test.toolbox.parameters_test as parameters_test
import test.helper_test as helper_test
if __name__ == "__main__":
xcursor_test.run_tests()
parameters_test.run_tests()
helper_test.run_tests()
| 1.132813 | 1 |
flash/image/__init__.py | tszumowski/lightning-flash | 0 | 12768697 | <reponame>tszumowski/lightning-flash
from flash.image.backbones import OBJ_DETECTION_BACKBONES # noqa: F401
from flash.image.classification import ( # noqa: F401
ImageClassificationData,
ImageClassificationPreprocess,
ImageClassifier,
)
from flash.image.classification.backbones import IMAGE_CLASSIFIER_BAC... | 1.351563 | 1 |
saleor/unurshop/package/migrations/0007_auto_20200916_1452.py | nlkhagva/saleor | 0 | 12768698 | # Generated by Django 3.1 on 2020-09-16 06:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('package', '0006_auto_20200916_1440'),
]
operations = [
migrations.RenameField(
model_name='packageline',
old_nam... | 1.53125 | 2 |
Semana 4/maximal_manhattan_distance/test_pytest_plane.py | juandausa/CompetitiveProgrammingCoreSkills | 0 | 12768699 | from plane import Plane
def test_create():
assert Plane() is not None
assert Plane().points_count == 0
assert Plane().maximum_distance_between_points == 0
def test_add_first_point():
plane = Plane()
plane.add_point((1,2))
assert plane.points_count == 1
assert plane.maximum_dis... | 3.46875 | 3 |
funktionen/store_datas_in_db_new_case.py | Bitterlin/easy_absence_scheduling_App | 0 | 12768700 |
import sqlite3
def sql_insert_now(sql_datensatz):
dsatz = sql_datensatz
vorname = dsatz[0]
nachname = dsatz[1]
gruppenleiter = dsatz[2]
bearbeitet = dsatz[3]
grund = dsatz[4]
abwesend_seit = dsatz[5]
gemeldet = dsatz[6]
gemeldet_time =dsatz[7]
meldepflicht = dsatz[8]
meldep... | 2.984375 | 3 |
src/LayoutFigures.py | dbpedia/gsoc-2020-dashboard | 12 | 12768701 | <gh_stars>10-100
import json
from io import StringIO
from os import path
import pandas as pd
import plotly.graph_objs as go
from SPARQLWrapper import JSON, CSV
import src.CSVParser as CSVP
import src.Constants as Constants
import src.JSONParser as JP
import src.RequestData as RD
data_path = 'data/v1'
bg_color = '#26... | 2.4375 | 2 |
blog/views.py | kevincornish/HeckGuide | 4 | 12768702 | <gh_stars>1-10
from django.views import generic
from .models import Post
class PostList(generic.ListView):
queryset = Post.objects.filter(status=1).order_by('-created_on')
template_name = 'blog/blog.html'
paginate_by = 3
class PostDetail(generic.DetailView):
model = Post
template_name = 'blog/post... | 2.203125 | 2 |
tests/PhuongHoang/Object.py | PhuongHoang1182/consensus-specs | 0 | 12768703 | class person:
def __init__(self, first_name, last_name, age):
self.first_name = first_name
self.last_name = last_name
self.age = age
def get_full_name(self):
return f"{self.first_name} {self.last_name}"
def introduce(self):
return f"Hi. I'm {self.first_name}. {se... | 4.0625 | 4 |
bmtk/tests/simulator/bionet/conftest.py | mjhyman/bmtk | 1 | 12768704 | try:
import bmtk.simulator.bionet as bionet
from bmtk.simulator.bionet.gids import GidPool
from bmtk.simulator.bionet.pyfunction_cache import *
from neuron import h
h.load_file('stdrun.hoc')
nrn_installed = True
except ImportError:
nrn_installed = False
has_mechanism = False
if nrn_... | 1.9375 | 2 |
govhack/models.py | MatthewJA/govhack-2016 | 0 | 12768705 | import sqlalchemy as sa
import sqlalchemy.ext as ext
import sqlalchemy.ext.declarative
import sqlalchemy.orm as orm
from .database import Base
class InterestingTrend():
def __init__(self, title, description):
self.title = title
self.description = description
def to_dict(self):
return ... | 2.84375 | 3 |
GimmeProxyAPI.py | DeyaaMuhammad/GimmeProxyApi | 3 | 12768706 |
import json
import requests
class GimmeProxyAPI(object):
"""docstring for proxy"""
def __init__(self, **args):
self.base_url = "https://gimmeproxy.com/api/getProxy"
self.response = None
if self.response is None:
self.response = self.get_proxy(args=args)
def response(self):
return sel... | 3.15625 | 3 |
bookingapp/forms.py | vetsinen/etalki | 0 | 12768707 | <filename>bookingapp/forms.py
from django import forms
from .models import Lesson
class LessonForm(forms.ModelForm):
class Meta:
model = Lesson
fields = ('date', 'hour')
| 2.140625 | 2 |
trading_environment.py | namm2008/DRL_stock_trading | 8 | 12768708 | <reponame>namm2008/DRL_stock_trading
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 17:22:57 2021
@author: matthewyeung
"""
import numpy as np
import pandas as pd
import pandas_datareader.data as web
#RSI
def rsi(dataset, window_length):
# Get the difference in price from previous step
... | 2.734375 | 3 |
ws-tests/test_fetch_all_collections.py | mtholder/pyraphyletic | 1 | 12768709 | <filename>ws-tests/test_fetch_all_collections.py<gh_stars>1-10
#!/usr/bin/env python
import sys
from opentreetesting import test_http_json_method, config
DOMAIN = config('host', 'apihost')
# backwards compat, support "list_all"
SUBMIT_URI = DOMAIN + '/v3/collections/find_collections'
r = test_http_json_method(SUBMIT_... | 2.25 | 2 |
refactorization/train_utils.py | Jiayuan-Gu/policy-refactorization | 6 | 12768710 | <filename>refactorization/train_utils.py
import warnings
import torch
def build_optimizer(cfg, model):
name = cfg.OPTIMIZER.TYPE
if name == '':
warnings.warn('No optimizer is built.')
return None
elif hasattr(torch.optim, name):
return getattr(torch.optim, name)(
model.... | 2.40625 | 2 |
google/cloud/datalabeling_v1beta1/types/data_labeling_service.py | pallabiwrites/python-datalabeling | 0 | 12768711 | <reponame>pallabiwrites/python-datalabeling<filename>google/cloud/datalabeling_v1beta1/types/data_labeling_service.py
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtai... | 1.492188 | 1 |
tap/api_resources/customer.py | obytes/tap-python | 3 | 12768712 | from __future__ import absolute_import, division, print_function
from tap.api_resources.abstract.createable_api_resource import CreateableAPIResource
from tap.api_resources.abstract.updateable_api_resource import UpdateableAPIResource
from tap.api_resources.abstract.deleteable_api_resource import DeleteableAPIResource... | 2.109375 | 2 |
software/pynguin/tests/ga/test_chromosome.py | se2p/artifact-pynguin-ssbse2020 | 3 | 12768713 | # This file is part of Pynguin.
#
# Pynguin 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 3 of the License, or
# (at your option) any later version.
#
# Pynguin is distributed in the ho... | 2.125 | 2 |
cbam/cbamsim.py | Evangeline98/Multi-Label-Classification-with-CNN-and-RNN | 1 | 12768714 | <filename>cbam/cbamsim.py
from datetime import datetime
import json
import glob
import os
from pathlib import Path
from multiprocessing.pool import ThreadPool
from typing import Dict
import numpy as np
import pandas as pd
from scipy.stats.mstats import gmean
import torch
from torch import nn
from torch.utils.data impo... | 2.265625 | 2 |
PY_OpenCV_Incomplete/a_prelim/1_intro_basics/10_color_spaces/entrypoint.py | CodexLink/StashedCodes | 0 | 12768715 | from cv2 import destroyAllWindows, imread, imshow, imwrite, split, waitKey
# Choose one for these image path.
# IMAGE_PATH = "../0_assets/cmyk_paint.png"
IMAGE_PATH = "../0_assets/RGB_paint.png"
DISPLAY_WINDOW_COLOR_STRING = [
"Blue",
"Green",
"Red",
]
image = imread(IMAGE_PATH)
# Get Color Buffer to St... | 3.265625 | 3 |
src/cake/library/compilers/clang.py | anlongfei/cake | 14 | 12768716 | <reponame>anlongfei/cake
"""The Clang Compiler.
@see: Cake Build System (http://sourceforge.net/projects/cake-build)
@copyright: Copyright (c) 2010 <NAME>, <NAME>.
@license: Licensed under the MIT license.
"""
from cake.library import memoise
from cake.target import getPaths, getPath
from cake.library.compilers impor... | 2.40625 | 2 |
setup.py | Jonas-Luetolf/todo-list | 1 | 12768717 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name="Todo-List",
version=2.0,
description='a todo-list cli',
author='<NAME>',
license='MIT',
url='http://github.com/Jonas-Luetolf/Todo-List',
python_requires='>=3.10',
install_requi... | 1.328125 | 1 |
fdk_client/application/models/StoreManagerSerializer.py | kavish-d/fdk-client-python | 0 | 12768718 | """Application Models."""
from marshmallow import fields, Schema
from marshmallow.validate import OneOf
from ..enums import *
from ..models.BaseSchema import BaseSchema
from .SellerPhoneNumber import SellerPhoneNumber
class StoreManagerSerializer(BaseSchema):
# Catalog swagger.json
mobile_no = fie... | 2.03125 | 2 |
nom_predict_sentence.py | Michael-Dyq/SRL-English | 0 | 12768719 | from typing import List, Iterator, Optional
import argparse
import sys
import json
from overrides import overrides
from allennlp.commands.subcommand import Subcommand
from allennlp.common.checks import check_for_gpu, ConfigurationError
from allennlp.common.file_utils import cached_path
from allennlp.common.util impor... | 2.203125 | 2 |
project_templates/fastapi_safir_app/hooks/post_gen_project.py | lsst/templates | 6 | 12768720 | <reponame>lsst/templates<filename>project_templates/fastapi_safir_app/hooks/post_gen_project.py
"""Post project creation hook for cookiecutter.
This script runs from the root directory of the created project itself. In
addition, cookiecutter interpolates Jinja2 templates to insert any necessary
variables.
This is use... | 1.890625 | 2 |
src/lap_time_calculator.py | ShravanK55/RacingLineGenerator | 3 | 12768721 | <reponame>ShravanK55/RacingLineGenerator<filename>src/lap_time_calculator.py
"""
Module to calculate lap times for a given car and racing line.
"""
from matplotlib import pyplot
from constants import AIR_DENSITY, GRAV_ACCELERATION
class LapTimeCalculator:
"""
Class to calculate lap times for a given car and... | 3.890625 | 4 |
Python3/664.py | rakhi2001/ecom7 | 854 | 12768722 | __________________________________________________________________________________________________
sample 140 ms submission
from functools import lru_cache
class Solution:
def strangePrinter(self, s: str) -> int:
@lru_cache(None)
def find_min(start, end):
if start >= end: return 1 if end... | 2.921875 | 3 |
django_input_collection/admin.py | pivotal-energy-solutions/django-input-collection | 0 | 12768723 | <reponame>pivotal-energy-solutions/django-input-collection<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.contrib import admin
from django.contrib.admin.templatetags.admin_list import _boolean_icon
from django.forms import fields_for_model, Textarea
from django.u... | 1.679688 | 2 |
plaso/frontend/image_export.py | CNR-ITTIG/plasodfaxp | 1 | 12768724 | <filename>plaso/frontend/image_export.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""The image export front-end."""
import abc
import collections
import logging
import os
from dfvfs.helpers import file_system_searcher
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from dfvfs.resol... | 2.421875 | 2 |
accelerator/models/member_profile.py | masschallenge/django-accelerator | 6 | 12768725 | from accelerator.managers.member_profile_manager import MemberProfileManager
from accelerator.models import CoreProfile
class MemberProfile(CoreProfile):
user_type = 'member'
default_page = "member_homepage"
objects = MemberProfileManager()
class Meta:
db_table = 'accelerator_memberprofile'
| 2.046875 | 2 |
autoIncrementor.py | OrdiNeu/AutoIncrementor | 0 | 12768726 | # OrdiNeu's auto incrementor for Dugnutt
import keyboard
import wx
# Globals
Filename = "test.txt"
Format = "Number of times pressed: {}"
count = 0
hotkey = "ctrl+alt+z"
dehotkey = "ctrl+alt+x"
error = ""
refresh = None
# Callback to automatically write in the text file
def changeCount(amount, auto):
global count... | 2.890625 | 3 |
make_train_data.py | KentaroAOKI/imagenet_tools | 0 | 12768727 | import glob
import os
import random
import cv2
def crop_image(src_image_path, dst_image_path):
output_side_length=256
img = cv2.imread(src_image_path)
height, width, depth = img.shape
new_height = output_side_length
new_width = output_side_length
if height > width:
new_height = int(outp... | 2.6875 | 3 |
tensorflow/python/ipu/tests/dropout_test.py | DebeshJha/tensorflow-1 | 2 | 12768728 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.375 | 2 |
apps/seqGraph.py | zanejobe/co2seq | 0 | 12768729 | <reponame>zanejobe/co2seq
import plotly.graph_objects as go
import plotly.express as px
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd
import base64
import dash
from dash.dependencies import Output, Input
from app import app
from rend... | 2.3125 | 2 |
source.py | Kimeg/Raycasting-Visualization-in-3D | 0 | 12768730 | from static import *
from lib import map_value
from point import Point
from ray import Ray
import numpy as np
import random
import math
class Source:
def __init__(self, x, y, fov, pg, screen):
self.pos = Point(x, y)
self.angle = np.random.randint(0, 360)
self.view_mode = 0
self.... | 3.328125 | 3 |
sample-apps/segmentation_spleen/lib/train.py | IntroAI-termproject/MONAILabel | 214 | 12768731 | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... | 1.84375 | 2 |
aa/ca.py | philipp-leitl/aapy | 1 | 12768732 | """Simple client to the Channel Archiver using xmlrpc."""
import logging as log
from xmlrpc.client import ServerProxy
import numpy
from . import data, utils
from .fetcher import Fetcher
__all__ = [
"CaClient",
"CaFetcher",
]
class CaClient(object):
"""Class to handle XMLRPC interaction with a channel a... | 2.703125 | 3 |
aphla/contrib/extendwf.py | NSLS-II/aphla | 0 | 12768733 | <filename>aphla/contrib/extendwf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numpy import *
import os
import commands
import time
import datetime
import re
import string
import sys
# python
'''
from extendwf import *
outputwf=extendwf(Nwfleng... | 2.921875 | 3 |
libs/configs/_base_/models/retinanet_r50_fpn.py | Artcs1/RotationDetection | 850 | 12768734 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
import math
ROOT_PATH = os.path.abspath('../../')
print(ROOT_PATH)
SUMMARY_PATH = os.path.join(ROOT_PATH, 'output/summary')
# backbone
NET_NAME = 'resnet50_v1d'
RESTORE_FROM_RPN = False
FIXED_BL... | 1.523438 | 2 |
NSGA-II.py | MacKur/Genetic_Algorithm_Parking_System | 1 | 12768735 | import random as rn
import numpy as np
import matplotlib.pyplot as plt
import math
from matplotlib import patches
from matplotlib.patches import Polygon
def random_population(_nv, n, _lb, _ub):
_pop = np.zeros((n, 2 * nv))
for i in range(n):
_pop[i, :] = np.random.uniform(lb, ub)
f... | 3.09375 | 3 |
movie_scraper.py | jamesduvall/SummerMovieWager | 0 | 12768736 | import urllib2
import movie
from bs4 import BeautifulSoup
class Movie_Scrapper
def Scrape_Movies():
page = urllib2.urlopen('http://www.boxofficemojo.com/seasonal/?view=releasedate&yr=2015&season=Summer')
soup = BeautifulSoup(page.read(), 'html.parser')
rows = soup.select('table[bgcolor="#ff... | 3.421875 | 3 |
providers/a4kScrapers/en/torrent/bitlord.py | henryjfry/a4kScrapers | 0 | 12768737 | # -*- coding: utf-8 -*-
from providerModules.a4kScrapers import core
class sources(core.DefaultSources):
def __init__(self, *args, **kwargs):
super(sources, self).__init__(__name__, *args, **kwargs)
def _get_token_and_cookies(self, url):
response = self._request.get(url.base)
token_id... | 1.953125 | 2 |
lairdrone/dirb.py | lair-framework/lair-drones-version1--deprecated- | 2 | 12768738 | <filename>lairdrone/dirb.py
#!/usr/bin/env python
import os
import copy
import re
from urlparse import urlparse
from lairdrone import drone_models as models
from lairdrone import helper
TOOL = 'dirb'
def build_clean_path(base_url, path, replace_specials=False):
"""Remove the base url value out of a path and optiona... | 2.5 | 2 |
web100_userland-1.8/python/readall.py | m-lab/web100_userland-debian | 0 | 12768739 | <filename>web100_userland-1.8/python/readall.py
"""readall.py: Read all Web100 variables from all connections."""
from Web100 import *
a = Web100Agent()
cl = a.all_connections()
for c in cl:
print("Connection %d (%s %d %s %d)"%(c.cid, \
c.read('LocalAddress'), \
c.... | 2.703125 | 3 |
bsolutions/domain/factoryboy_utils.py | xergioalex/django-multiple-databases-engines | 8 | 12768740 | # factoryboy_utils.py
@classmethod
def _get_manager(cls, model_class):
return super(cls, cls)._get_manager(model_class).using(cls.database)
class DBAwareFactory(object):
"""
Context manager to make model factories db aware
Usage:
with DBAwareFactory(PersonFactory, 'db_qa') as personfactory_o... | 2.71875 | 3 |
examples/galaxy.py | xxao/miniml | 0 | 12768741 | <reponame>xxao/miniml<gh_stars>0
import miniml
import numpy as np
from matplotlib import pyplot as plt
# Adapted from:
# https://github.com/kevinzakka/cs231n.github.io/blob/master/neural-networks-case-study.md
# init data
N = 100 # points per class
C = 3 # classes
X = np.zeros((N*C, 2))
y = np.zeros(N*C, dtype='ui... | 3.03125 | 3 |
lib/python/abcutils/CMakeCache.py | ryu-sw/alembic | 921 | 12768742 | <gh_stars>100-1000
#!/usr/bin/env python2.6
#-*- mode: python -*-
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## <NAME> Imageworks Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
... | 1.242188 | 1 |
Birnn_Transformer/ncc/data/type_prediction/utils.py | code-backdoor/code-backdoor | 71 | 12768743 | import os
import numpy as np
from typing import Dict, Generic, List, NamedTuple, Tuple, TypeVar
TTensorizedNodeData = TypeVar("TTensorizedNodeData")
def enforce_not_None(e):
"""Enforce non-nullness of input. Used for typechecking and runtime safety."""
if e is None:
raise Exception("Input is None.")
... | 2.828125 | 3 |
HiggsAnalysis/Skimming/python/higgsToWW2Leptons_OutputModule_cff.py | SWuchterl/cmssw | 6 | 12768744 | <reponame>SWuchterl/cmssw<filename>HiggsAnalysis/Skimming/python/higgsToWW2Leptons_OutputModule_cff.py
import FWCore.ParameterSet.Config as cms
from HiggsAnalysis.Skimming.higgsToWW2LeptonsOutputModuleAODSIM_cfi import *
from HiggsAnalysis.Skimming.higgsToWW2LeptonsOutputModuleRECOSIM_cfi import *
| 1.1875 | 1 |
ndg/xacml/parsers/etree/policyreader.py | philipkershaw/ndg_xacml | 5 | 12768745 | """NDG XACML ElementTree Policy Reader
NERC DataGrid
"""
__author__ = "<NAME>"
__date__ = "16/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "<EMAIL>"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
from ndg.xacml.... | 1.820313 | 2 |
affiliate/ad_statis_new.py | gods-view/AdclickIO | 0 | 12768746 | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
import os,time
import subprocess
import sys,copy
import gevent
from gevent.event import Event
from multiprocessing.dummy import Pool as ThreadPool
import gc
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
import time... | 2.15625 | 2 |
init.py | shanisma/plant-keeper | 1 | 12768747 | import os
import sys
import django
import psycopg2
from django.core.management import call_command
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
sys.path.insert(0, os.path.abspath("."))
django.setup()
from water.models import Device as W... | 2.359375 | 2 |
hostlock/views/views_ajax.py | davidslusser/padlock | 0 | 12768748 | <filename>hostlock/views/views_ajax.py
"""
Views used specifically for handling AJAX Requests
"""
# import system modules
import json
# import django modules
from django.http import HttpResponse
from django.template import Context, loader
from django.views.decorators.http import require_GET, require_POST
# import mod... | 2.4375 | 2 |
mskpy/photometry/outbursts.py | mkelley/mskpy | 10 | 12768749 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
outbursts --- Lightcurve and outburst analysis
==============================================
"""
__all__ = [
'CometaryTrends'
]
from collections import namedtuple
import logging
import numpy as np
from scipy.cluster import hierarchy
from scipy.... | 1.632813 | 2 |
api/users/me/__init__.py | ezchat/backend | 3 | 12768750 | <filename>api/users/me/__init__.py
# pylint: disable=no-name-in-module
from api.users.me.channels import UserMeChannels # noqa: F401
from api.users.me.index import UserMe # noqa: F401
| 1.132813 | 1 |