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 |
|---|---|---|---|---|---|---|
dm_construction/environments_test.py | frangipane/dm_construction | 25 | 13300 | #!/usr/bin/python
#
# Copyright 2020 DeepMind Technologies Limited
#
# 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 a... | 2.4375 | 2 |
Modulo_3/semana 2/imagenes/imagen.py | rubens233/cocid_python | 0 | 13301 | <gh_stars>0
from tkinter import *
ventana = Tk()
ventana.geometry("500x500")
ventana.title('PythonGuides')
img = PhotoImage(file='./logo.png')
img = img.subsample(3, 3)
Label( ventana, image=img ).pack(fill="both")
ventana.mainloop() | 2.828125 | 3 |
htdfsdk/utils.py | youngqqcn/htdfsdk | 2 | 13302 | #coding:utf8
#author: yqq
#date: 2020/12/15 下午5:38
#descriptions:
from decimal import Decimal, getcontext
# getcontext()
def htdf_to_satoshi(amount_htdf: [float, int, str]) -> int:
return int(Decimal(str(amount_htdf)) * (10 ** 8))
if __name__ == '__main__':
assert htdf_to_satoshi(139623.71827296) == 1396... | 2.46875 | 2 |
hanzi_font_deconstructor/scripts/create_training_data.py | chanind/hanzi-font-deconstructor | 0 | 13303 | from dataclasses import asdict
from hanzi_font_deconstructor.common.generate_training_data import (
STROKE_VIEW_BOX,
get_training_input_svg_and_masks,
)
from os import path, makedirs
from pathlib import Path
import shutil
import argparse
PROJECT_ROOT = Path(__file__).parents[2]
DEST_FOLDER = PROJECT_ROOT / "da... | 2.734375 | 3 |
examples/generated_sample_regression.py | micheleantonazzi/gibson-dataset | 3 | 13304 | from generic_dataset.data_pipeline import DataPipeline
from generic_dataset.generic_sample import synchronize_on_fields
from generic_dataset.sample_generator import SampleGenerator
import numpy as np
import generic_dataset.utilities.save_load_methods as slm
pipeline_rgb_to_gbr = DataPipeline().add_operation(lambda dat... | 2.421875 | 2 |
setup.py | dilayercelik/neural-networks-tfw1 | 0 | 13305 | from setuptools import setup
setup(name='neural_networks_tfw1',
version='0.1',
description='Implementing Neural Networks with Tensorflow',
packages=['neural_networks_tfw1'],
author='<NAME>',
author_email='<EMAIL>',
zip_safe=False)
| 1.132813 | 1 |
half_json/json_util.py | half-pie/half-json | 4 | 13306 | <filename>half_json/json_util.py
# coding=utf8
import re
import json.decoder
from collections import namedtuple
from json.decoder import JSONDecoder
from json.scanner import py_make_scanner
from json.decoder import py_scanstring
class JSONDecodeError(object):
def __init__(self, parser, message):
self.me... | 3.09375 | 3 |
capa-system/capaSystem.py | slumbermachine/capatimelapse | 2 | 13307 | <reponame>slumbermachine/capatimelapse
#!/usr/bin/python
#####################################################################
# Name : capaSystem.py
# Description : Read system data and update db for web display
# Environment : Tested under Raspberry Pi Rasbian Jessie Summer 17
# Author ... | 2.234375 | 2 |
wagtail/wagtailadmin/tasks.py | willcodefortea/wagtail | 0 | 13308 | from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db.models import Q
from wagtail.wagtailcore.models import PageRevision, GroupPagePermission
from wagtail.wagtailusers.models import User... | 1.945313 | 2 |
app/map_sup_enrich_compose.py | onap/sdc-dcae-d-tosca-lab | 1 | 13309 | <gh_stars>1-10
#Author: <NAME>
#emaiL: <EMAIL>
from toscalib.tosca_workbook import ToscaWorkBook
from toscalib.tosca_builder import ToscaBuilder
import getopt, sys, json, logging
def usage():
print('OPTIONS:')
print('\t-h|--help: print this help message')
print('\t-i|--input: The home folder where all sp... | 2.53125 | 3 |
gollama/backend/tests/test_api/test_shorthand.py | benjaminhubbell/gollama | 1 | 13310 | <filename>gollama/backend/tests/test_api/test_shorthand.py
from django.test import TestCase
from rest_framework.test import APIClient
class TestShortHand(TestCase):
def setUp(self) -> None:
self.client = APIClient()
def test_get(self):
response_json = self.client.post('/api/v1/shorthand/', {'... | 2.390625 | 2 |
lusidtools/lpt/qry_scopes.py | fossabot/lusid-python-tools | 1 | 13311 | import pandas as pd
import dateutil
from lusidtools.lpt import lpt
from lusidtools.lpt import lse
from lusidtools.lpt import stdargs
from .either import Either
import re
import urllib.parse
rexp = re.compile(r".*page=([^=']{10,}).*")
TOOLNAME = "scopes"
TOOLTIP = "List scopes"
def parse(extend=None, args=None):
... | 2.421875 | 2 |
qqbot/qqbotcls.py | skarl-api/qqbot | 0 | 13312 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
QQBot -- A conversation robot base on Tencent's SmartQQ
Website -- https://github.com/pandolia/qqbot/
Author -- <EMAIL>
"""
import sys, os
p = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if p not in sys.path:
sys.path.insert(0, p)
import sys, subp... | 2.078125 | 2 |
tests/gear_scripts/buitin_runtime_func_GearsBuilder.py | jsam/redgrease | 17 | 13313 | from redgrease import GearsBuilder
gb = GearsBuilder()
gb.run()
| 1.179688 | 1 |
tests/tests.py | ActivityWatch/activitywatch-old | 4 | 13314 | from copy import copy
from itertools import groupby
import unittest
from datetime import datetime, timedelta
from typing import List
from activitywatch.base import Watcher, Activity, Logger
from activitywatch.settings import Settings
from activitywatch.utils import floor_datetime, ceil_datetime
from activitywatch.filt... | 2.40625 | 2 |
lang/it/basic_vocabulary_it.py | gtoffoli/commons-cops | 5 | 13315 | voc_it = [
['a', 'noun', 'c'],
['a', 'preposition', 'a'],
['abbagliante', 'pres_part', 'c'],
['abbagliante', 'adjective', 'c'],
['abbagliante', 'noun', 'c'],
['abbaiare', 'verb', 'c'],
['abbandonare', 'verb', 'a'],
['abbandonato', 'past_part', 'b'],
['abbandonato', 'adjective', 'b'],
['abbandono', 'noun', 'b'],
['abbas... | 1.828125 | 2 |
pytorch/torch/_utils_internal.py | raghavnauhria/whatmt | 15 | 13316 | <filename>pytorch/torch/_utils_internal.py<gh_stars>10-100
from __future__ import absolute_import, division, print_function, unicode_literals
import os
# this arbitrary-looking assortment of functionality is provided here
# to have a central place for overrideable behavior. The motivating
# use is the FB build enviro... | 2.109375 | 2 |
libs/models.py | aquastripe/DenseCLIP | 7 | 13317 | import json
from collections import OrderedDict
from typing import Union, List
import clip
import torch
import torch.nn as nn
import torch.nn.functional as F
from libs.definitions import ROOT
label_file = ROOT / 'imagenet_class_index.json'
with open(label_file, 'r') as f:
labels = json.load(f)
_DEFAULT_CLASSNAM... | 2.40625 | 2 |
src/basset_sick_loss.py | shtoneyan/Basset | 248 | 13318 | <filename>src/basset_sick_loss.py
#!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import os
import random
import subprocess
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
import pysam
from scipy.stats import binom
from scipy.sta... | 2.03125 | 2 |
level2/huge/split_huge_from_tar_strace.py | fishilico/sstic-2016 | 0 | 13319 | <reponame>fishilico/sstic-2016
#!/usr/bin/env python3
import codecs
import re
def trans_addr(addr):
"""Traduit une position de fichier en une adresse du programme"""
if addr < 0x1000:
return 0
if 0x0000000000001000 <= addr < 0x0000000000001000 + 0x00001ef000000000:
return 0x00002b0000000000... | 2.21875 | 2 |
UI/test/ui_test.py | tunapro1234/ai.destroy | 0 | 13320 | <filename>UI/test/ui_test.py
import pygame_gui
import pygame
class colors:
black = "#000000"
dimgrey = "#696969" # lmao
darkslategray = "#2F4F4F"
TITLE = "TUNAPRO1234"
BACKGROUND = colors.darkslategray
WIDTH, HEIGHT = 1920, 1080
"""
Hızlıca bir plan yapacağım
Neural ağları kontrol edebileceğimiz küçü... | 2.75 | 3 |
tests/test_temperature_system.py | SmartSleepIoT/SmartSleepCoding | 0 | 13321 | import time
import pytest
from flask import g
from flask import session
import paho.mqtt.client as paho
from SmartSleep.db import get_db
from flask import json
import runpy
msg_nr = 0
messages = [""]
broker = 'broker.emqx.io'
port = 1883
def update_contor():
global msg_nr
msg_nr += 1
def on_message(client... | 2.15625 | 2 |
3_gabor/model/gabor_rf/maprf/invlink.py | mackelab/IdentifyMechanisticModels_2020 | 3 | 13322 | import theano.tensor as tt
def explin(x):
return tt.where(x >= 0, 1 + x, tt.exp(x))
def log_exp1p(x):
return tt.log1p(tt.exp(x))
| 2.171875 | 2 |
readtest.py | pyEtherCAT/Test-Source | 0 | 13323 | from pyEtherCAT import MasterEtherCAT #ライブラリの読出し
nic = "eth0" # ネットワークカードのアドレスを記載
cat = MasterEtherCAT.MasterEtherCAT(nic)
ADP = 0x0000 #1台目
ADDR = 0x0E00 #コアレジスタのアドレス
cat.APRD(IDX=0x00, ADP=ADP, ADO=ADDR, DATA=[0,0,0,0,0,0,0,0]) #DATAは0を8個(64bit分)の枠を指示
(DATA, WKC) = cat.socket_read() #結果を読出し
print("[0x{:04X}]= 0x{:... | 2.328125 | 2 |
python/dataingest/grammar/dmo/python_loc_parser.py | jiportilla/ontology | 0 | 13324 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pprint
from base import BaseObject
from base import FileIO
class PythonLOCParser(BaseObject):
""" Parse T/LOC from a Python File
"""
def __init__(self,
file_path: str,
is_debug: bool = False):
"""
C... | 2.765625 | 3 |
time_series_data_generator/csv_to_df_generator.py | ArtHackDay-Plus1/ParameterServer | 0 | 13325 | <filename>time_series_data_generator/csv_to_df_generator.py
import pandas as pd
import time
df = pd.read_csv("data/sample.csv")
for num in range(1000):
argx = str(df["x"][num:num+1].get_values())
argy = str(df["y"][num:num+1].get_values())
print("x:{0} / y:{1}".format(argx,argy))
time.sleep(0.1)
| 3.1875 | 3 |
architecture_tool_django/graphdefs/urls.py | goldginkgo/architecture_tool_django | 1 | 13326 | from django.urls import path
from . import views
app_name = "graphs"
urlpatterns = [
path("graphs/", views.GraphListView.as_view(), name="graph.list"),
path("graphs/create/", views.GraphCreateView.as_view(), name="graph.create"),
path(
"graphs/<str:pk>/",
views.GraphDetailView.as_view(),
... | 1.890625 | 2 |
lib/utils/blob.py | TheRevanchist/DeepWatershedDetection | 0 | 13327 | <reponame>TheRevanchist/DeepWatershedDetection
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> - extended by <NAME>
# --------------------------------------------------------
"""Blob he... | 2.4375 | 2 |
edlm/convert/_get_media_folders.py | etcher-be/EDLM | 0 | 13328 | <gh_stars>0
# coding=utf-8
"""
Gathers the media folders
"""
import elib
from ._context import Context
def get_media_folders(ctx: Context):
"""
Gathers the media folders
"""
ctx.info('gathering media folders')
media_folders = []
this_folder = ctx.source_folder
while True:
ctx.d... | 2.890625 | 3 |
twister2/python-support/src/main/python/twister2/tset/TLink.py | pulasthi/twister2 | 63 | 13329 | <filename>twister2/python-support/src/main/python/twister2/tset/TLink.py
from inspect import signature
import twister2.tset.TSet as ts
from twister2.utils import function_wrapper
class TLink:
def __init__(self, java_ref, env):
self.__java_ref = java_ref
self.__env = env
def map(self, lam):
... | 2.390625 | 2 |
e2cnn/nn/modules/nonlinearities/concatenated.py | ziatdinovmax/e2cnn | 0 | 13330 | <filename>e2cnn/nn/modules/nonlinearities/concatenated.py
from e2cnn.gspaces import *
from e2cnn.nn import FieldType
from e2cnn.nn import GeometricTensor
from e2cnn.group import Representation
from e2cnn.group.representation import build_from_discrete_group_representation
from ..equivariant_module import EquivariantMo... | 2.75 | 3 |
modules/gathering/host_gathering.py | anouarbensaad/VulnX | 10 | 13331 | <gh_stars>1-10
import requests
import re
import socket
from common.colors import bad,que, info, good,run,W,end
from common.uriParser import parsing_url as hostd
class GatherHost():
def __init__(self,url,headers=None):
self.url = url
self.headers = headers
def match_info(self,regex,data):
... | 2.75 | 3 |
datastore/core/basic.py | datastore/datastore | 65 | 13332 |
from key import Key
from query import Cursor
class Datastore(object):
'''A Datastore represents storage for any key-value pair.
Datastores are general enough to be backed by all kinds of different storage:
in-memory caches, databases, a remote datastore, flat files on disk, etc.
The general idea is to wrap ... | 4 | 4 |
website/admin.py | jonfroehlich/makeabilitylabwebsite | 2 | 13333 | <reponame>jonfroehlich/makeabilitylabwebsite
from django.contrib import admin
from django.contrib.admin import widgets
from .models import Person, Publication, Position, Talk, Project, Poster, Keyword, News, Banner, Video, Project_header, Photo, Project_umbrella, Project_Role, Sponsor
from website.admin_list_filters im... | 2.125 | 2 |
python/annotation_orthologs_inference.py | liebermanlab/wide-variant | 0 | 13334 | <reponame>liebermanlab/wide-variant<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 26 21:39:04 2019
@author: fmk
"""
import argparse,subprocess,string,random
import pandas as pd
''' positional and optional argument parser'''
parser = argparse.ArgumentParser(formatter_class=arg... | 1.851563 | 2 |
tests/test_vtable.py | matthewpruett/angr | 6,132 | 13335 | import os
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_vtable_extraction_x86_64():
p = angr.Project(os.path.join(test_location, "x86_64", "cpp_classes"), auto_load_libs=False)
vtables_sizes = {0x403cb0: 24, 0x403cd8: 1... | 2.171875 | 2 |
sendmail.py | loitd/buzreportgenerator | 0 | 13336 | <gh_stars>0
from zeep import Client
def test():
client = Client('http://www.dneonline.com/calculator.asmx?wsdl')
result = client.service.Add(100,220)
print(result)
def test2():
client = Client('http://172.16.237.11:8080/SendNotify_Interface_Gmail/services/Notify?wsdl')
result = client.service.send... | 2.296875 | 2 |
pommerman/agents/http_agent.py | KaixiangLin/playground | 2 | 13337 | <gh_stars>1-10
'''The HTTP agent - provides observation using http push to remote
agent and expects action in the reply'''
import json
import time
import os
import threading
import requests
from . import BaseAgent
from .. import utility
from .. import characters
class HttpAgent(BaseAgent):
"""The HTTP Agent t... | 2.9375 | 3 |
cacao_app/event/serializers.py | CacaoMovil/guia-de-cacao-django | 1 | 13338 | # -*- coding: utf-8 -*-
from rest_framework import serializers
from django_countries.serializer_fields import CountryField
from .models import Event, CountryEvent
class CountryEventSerializer(serializers.ModelSerializer):
code = serializers.ReadOnlyField(source='country.code')
name = serializers.SerializerM... | 2.1875 | 2 |
examples/map.py | jlsajfj/NBT | 241 | 13339 | <filename>examples/map.py
#!/usr/bin/env python
"""
Prints a map of the entire world.
"""
import os, sys
import math
from struct import pack
# local module
try:
import nbt
except ImportError:
# nbt not in search path. Let's see if it can be found in the parent folder
extrasearchpath = os.path.realpath(os.p... | 2.8125 | 3 |
flaskcbv/protos/simple/apps/main/urls.py | procool/flaskcbv | 1 | 13340 | <gh_stars>1-10
from flaskcbv.url import Url, make_urls
from .views import mainView
namespases = make_urls(
Url('', mainView(), name="main"),
)
| 1.523438 | 2 |
main/permissions.py | hellojoshuatonga/notepik | 0 | 13341 | # Rest framework
from rest_framework import permissions
class IsAuthorOrReadOnly(permissions.BasePermission):
"""
Object level permission. Check if the requesting user is the author or not. If he/she the author then we will give him/her a read and write permission otherwise ready only
"""
def has_obje... | 2.96875 | 3 |
femagtools/vtu.py | dapu/femagtools | 0 | 13342 | <filename>femagtools/vtu.py<gh_stars>0
"""
femagtools.vtu
~~~~~~~~~~~~~~
Read FEMAG vtu files
"""
import vtk
import pathlib
import numpy as np
class Reader(object):
'''Class to read vtu-files'''
def __init__(self, pathname):
'''Read the vtu-files
Parameters
----------
... | 2.703125 | 3 |
__init__.py | rolc/python-package | 0 | 13343 | #!/usr/bin/python
#-------------------------------IMPORT--------------------------------#
from lib import *
#-------------------------------EXPORT--------------------------------#
__all__ = ['<#PREFIX#>_app','<#PREFIX#>_index']
| 1.46875 | 1 |
svm-rank/bag_of_words.py | Anthony-Alridge/individual_project | 0 | 13344 | from collections import Counter
import numpy as np
def keep_word(word):
return word.is_alpha
def unique_words(problems):
return set([word.lemma_ for problem in problems for word in problem.tokens() if keep_word(word)])
def create_word2idx(vocab):
return {word: idx for idx, word in enumerate(vocab)}
... | 2.78125 | 3 |
pymps/ansatz/tests/test_sweeper.py | GiggleLiu/pymps | 4 | 13345 | <reponame>GiggleLiu/pymps
#!/usr/bin/python
'''
Tests for MPS and MPO
'''
from numpy import *
import matplotlib.pyplot as plt
from numpy.testing import dec, assert_, assert_raises, assert_almost_equal, assert_allclose
import pdb
from ..sweep import *
def test_iterator():
start = (1, '->', 2)
stop = (3, '<-',... | 2.671875 | 3 |
ui/numbered_menu.py | LouisPi/PiPortableRecorder | 51 | 13346 | from threading import Lock
from time import time
from ui import Menu
from ui.utils import clamp, check_value_lock, to_be_foreground
class NumberedMenu(Menu):
"""
This Menu allows the user to jump to entries using the numpad. If the menu is 10 entries or less
the navigation is instant. Otherwise, it lets ... | 3.75 | 4 |
Math/RussianPeasantMultiplication.py | kopok2/algorithms | 0 | 13347 | # coding=utf-8
"""Russian Peasant Multiplication algorithm Python implementation."""
def russ_peasant(a, b):
res = 0
while b > 0:
if b & 1:
res += a
a <<= 1
b >>= 1
return res
if __name__ == '__main__':
for x in range(10):
for y in range(10):
p... | 3.71875 | 4 |
Assignment 4/src/optim/lr_scheduler.py | vamsi3/CS763-IIT-Bombay | 1 | 13348 | import math
import torch
from bisect import bisect_right
class _LRScheduler:
def __init__(self, optimizer, last_epoch=-1):
self.optimizer = optimizer
self.base_lr = optimizer.lr
self.last_epoch = last_epoch
def step(self):
self.last_epoch += 1
self.optimizer.lr = self.... | 2.234375 | 2 |
gluon/dal/adapters/teradata.py | lightcoder127/Web2py | 2 | 13349 | <reponame>lightcoder127/Web2py
# -*- coding: utf-8 -*-
from .._globals import IDENTITY
from ..connection import ConnectionPool
from .base import BaseAdapter
class TeradataAdapter(BaseAdapter):
drivers = ('pyodbc',)
types = {
'boolean': 'CHAR(1)',
'string': 'VARCHAR(%(length)s)',
'tex... | 1.976563 | 2 |
conan_tests/external_tools/vswhere_test.py | conan-io/test | 2 | 13350 | import os
import platform
import unittest
import nose
from conans import tools
from conans.errors import ConanException
from conans.model.version import Version
from conans import __version__ as client_version
from conans.model import settings
from conans.test.utils.tools import TestClient
from conans.test.assets.vis... | 2.171875 | 2 |
pinliner/pinliner.py | minazukie/pinliner | 53 | 13351 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import argparse
import json
import os
from pinliner import __version__
import sys
TEMPLATE_FILE = 'importer.template'
TEMPLATE_PATTERN = '${CONTENTS}'
def output(cfg, what, newline=True):
# We need indentation for PEP8
cfg... | 2.515625 | 3 |
list_s3_buckets.py | MarijaKalebota/aws-playground | 0 | 13352 | from dotenv import load_dotenv
load_dotenv()
import os
import boto3
#s3 = boto3.resource('s3')
s3 = boto3.resource('s3', aws_access_key_id=os.environ.get("AWS_KEY_ID"),
aws_secret_access_key=os.environ.get("AWS_SECRET_KEY"))
for bucket in s3.buckets.all():
print(bucket.name)
| 2.328125 | 2 |
GAScore/testbench/hold_buffer.py | sharm294/shoal | 1 | 13353 | <reponame>sharm294/shoal
import os
from sonar.testbench import Testbench, Module, TestVector, Thread
from sonar.interfaces import AXIS
from sonar_strToInt import strToInt
hold_buffer = Testbench.default('hold_buffer')
filepath = os.path.join(os.path.dirname(__file__), 'build/hold_buffer/')
dut = Module.default("DUT... | 2.03125 | 2 |
vaxtools/utils/pair.py | menis/vaxtools | 0 | 13354 | #!/usr/bin/env python
# filename: pair.py
#
# Copyright (c) 2015 <NAME>
# License: The MIT license (http://opensource.org/licenses/MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software witho... | 1.804688 | 2 |
t3f/riemannian.py | robol/t3f | 0 | 13355 | <filename>t3f/riemannian.py
import tensorflow as tf
from t3f.tensor_train import TensorTrain
from t3f.tensor_train_batch import TensorTrainBatch
from t3f import shapes
from t3f import decompositions
def project_sum(what, where, weights=None):
"""Project sum of `what` TTs on the tangent space of `where` TT.
proj... | 2.828125 | 3 |
dpauth/admin.py | askmeaboutlo0m/website | 9 | 13356 | <filename>dpauth/admin.py
from django.contrib import admin
from . import models
@admin.register(models.Username)
class UsernameAdmin(admin.ModelAdmin):
list_display = ('user', 'name', 'is_mod')
readonly_fields = ('normalized_name',)
search_fields = ('user__email', 'name')
| 2.078125 | 2 |
iptv_proxy/providers/beast/json_api.py | sfanous/IPTVProxy | 9 | 13357 | <gh_stars>1-10
import logging
from iptv_proxy.providers.beast.constants import BeastConstants
from iptv_proxy.providers.iptv_provider.json_api import ProviderConfigurationJSONAPI
logger = logging.getLogger(__name__)
class BeastConfigurationJSONAPI(ProviderConfigurationJSONAPI):
__slots__ = []
_provider_nam... | 1.640625 | 2 |
tests/random/random_testing.py | jkeiren/mCRL2 | 61 | 13358 | <reponame>jkeiren/mCRL2
#!/usr/bin/env python
# Copyright 2015 <NAME>.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import os
import os.path
import random
import re
import sys
import traceback
sys.path += [os.path.abspat... | 2.03125 | 2 |
src/download.py | stanislawbartkowski/webhdfsdirectory | 0 | 13359 | """ Main program to launch proc/hdfs.py
"""
import argparse
import logging
from pars import addargs
import sys
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
from proc.hdfs import DIRHDFS
def gettestargs(parser) :
i = "/home/sbartkowski/work/webhdfsdirectory/testdata/... | 2.65625 | 3 |
desktop/core/ext-py/josepy-1.1.0/src/josepy/json_util.py | kokosing/hue | 5,079 | 13360 | """JSON (de)serialization framework.
The framework presented here is somewhat based on `Go's "json" package`_
(especially the ``omitempty`` functionality).
.. _`Go's "json" package`: http://golang.org/pkg/encoding/json/
"""
import abc
import binascii
import logging
import OpenSSL
import six
from josepy import b64,... | 2.890625 | 3 |
norm/executable/schema/variable.py | reasoned-ai/norm | 8 | 13361 | <reponame>reasoned-ai/norm
from norm.models.norm import Status, Lambda
from norm.executable import NormExecutable
from typing import Union, List
import logging
logger = logging.getLogger(__name__)
class VariableName(NormExecutable):
def __init__(self, scope, name):
"""
The variable and its scope... | 2.453125 | 2 |
src/parserindexer/tika_parser.py | yyzhuang1991/parser-indexer-py | 8 | 13362 | <reponame>yyzhuang1991/parser-indexer-py
from __future__ import print_function
import os
import sys
import json
import tika
from tqdm import tqdm
from utils import LogUtil
from parser import Parser
from ioutils import read_lines
from tika import parser as tk_parser
class TikaParser(Parser):
""" The TikaParser cl... | 2.40625 | 2 |
checkov/cloudformation/checks/resource/aws/DocDBAuditLogs.py | niradler/checkov | 0 | 13363 | <gh_stars>0
from checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck
from checkov.common.parsers.node import DictNode
from checkov.common.models.enums import CheckResult, CheckCategories
class DocDBAuditLogs(BaseResourceCheck):
def __init__(self) -> None:
name = "Ensure Doc... | 2.125 | 2 |
py/server/deephaven/server/plugin/__init__.py | lbooker42/deephaven-core | 0 | 13364 | #
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import jpy
_JCallbackAdapter = jpy.get_type('io.deephaven.server.plugin.python.CallbackAdapter')
def initialize_all_and_register_into(callback: _JCallbackAdapter):
try:
from . import register
except ModuleNotFoundError as e:
... | 2.03125 | 2 |
mypy/test/testoutput.py | TimSimpsonR/mypy | 1 | 13365 | """Tests for parse tree pretty printing that preserves formatting
Test case descriptions are in file test/data/output.test.
"""
import os.path
import re
from typing import Undefined, Any
from mypy import build
from mypy.myunit import Suite, run_test
from mypy.test.helpers import assert_string_arrays_equal
from mypy... | 2.734375 | 3 |
tests/test_SklearnDecisionTreeConverters.py | c-bata/sklearn-onnx | 1 | 13366 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import un... | 2.25 | 2 |
tests/test_inference.py | MihailSalnikov/microscopeimagequality | 77 | 13367 | <gh_stars>10-100
import logging
import os
import tempfile
import PIL.Image
import numpy
import tensorflow
import microscopeimagequality.constants
import microscopeimagequality.data_provider
import microscopeimagequality.evaluation
import microscopeimagequality.prediction
class Inference(tensorflow.test.TestCase):
... | 2.0625 | 2 |
config.py | hiankun/qb_test | 4 | 13368 | <filename>config.py<gh_stars>1-10
"""
QuickBot wiring config.
Specifies which pins are used for motor control, IR sensors and wheel encoders.
"""
# Motor pins: (dir1_pin, dir2_pin, pwd_pin)
RIGHT_MOTOR_PINS = 'P8_12', 'P8_10', 'P9_14'
LEFT_MOTOR_PINS = 'P8_14', 'P8_16', 'P9_16'
# IR sensors (clock-wise, starting wi... | 2.09375 | 2 |
tools/tests/skimage_self_test.py | yinquan529/platform-external-skia | 1 | 13369 | <reponame>yinquan529/platform-external-skia<gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Self-test for skimage.
import filecmp
import os
import subprocess
impo... | 2.328125 | 2 |
pymachine/condition.py | landrew31/pymachine | 1 | 13370 | <filename>pymachine/condition.py
from collections import namedtuple
Condition = namedtuple(
'Condition',
['current_state', 'input_character'],
)
| 2.140625 | 2 |
examples/simple_lakehouse/simple_lakehouse/assets.py | bitdotioinc/dagster | 2 | 13371 | """Asset definitions for the simple_lakehouse example."""
import pandas as pd
from lakehouse import Column, computed_table, source_table
from pyarrow import date32, float64, string
sfo_q2_weather_sample_table = source_table(
path="data", columns=[Column("tmpf", float64()), Column("valid_date", string())],
)
@com... | 2.765625 | 3 |
tests/testresources/pytest_resource_path_ini.py | yukihiko-shinoda/pytest-resource-path | 5 | 13372 | <filename>tests/testresources/pytest_resource_path_ini.py
"""Implements test for pytest-resource-path Fixtures with pytest.ini."""
from pathlib import Path
import pytest
def test_resource_path_ini(resource_path, request):
"""Fixture resource_path should be following absolute path."""
assert resource_path == ... | 2.3125 | 2 |
17-files/read-file-with-try-block.py | johnehunt/Python3Intro | 1 | 13373 | # Illustrates combining exception / error handling
# with file access
print('Start')
try:
with open('myfile2.txt', 'r') as f:
lines = f.readlines()
for line in lines:
print(line, end='')
except FileNotFoundError as err:
print('oops')
print(err)
print('Done')
| 3.578125 | 4 |
Miscellaneous/test_script_pymc3/multinominal.py | junpenglao/Planet_Sakaar_Data_Science | 51 | 13374 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 11 13:30:53 2017
@author: laoj
"""
import numpy as np
import pymc3 as pm
import theano.tensor as tt
from pymc3.distributions.distribution import Discrete, draw_values, generate_samples, infer_shape
from pymc3.distributions.dist_math import bound, lo... | 1.679688 | 2 |
transformation_fnc.py | usrmaia/transformation-fnc | 0 | 13375 | from useful import *
from os import system
def remove_implication(formula):
while ">" in formula:
operator = formula.find(">")
print(formula, operator)
subform_left = get_subform_left(formula, operator)
subform_right = get_subform_right(formula, operator)
formula = get_remo... | 3.65625 | 4 |
src/implant/commands/__init__.py | diefans/debellator | 2 | 13376 | # 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, softwa... | 2.234375 | 2 |
trainer/utils/__init__.py | chriszhou0916/czai4art | 0 | 13377 | <reponame>chriszhou0916/czai4art<gh_stars>0
from trainer.utils.losses import *
from trainer.utils import custom_ssim
| 0.945313 | 1 |
src/Testing/ZopeTestCase/__init__.py | tseaver/Zope-RFA | 2 | 13378 | <filename>src/Testing/ZopeTestCase/__init__.py
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this ... | 1.507813 | 2 |
CIM14/CPSM/Equipment/LoadModel/SubLoadArea.py | MaximeBaudette/PyCIM | 58 | 13379 | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | 1.984375 | 2 |
bin/clean_pdb.py | caixiuhong/Stable-MCCE | 0 | 13380 | #!/usr/bin/env python
import sys
HATOMS = ["HG", "HD", "HE", "HH"]
lines = open(sys.argv[1]).readlines()
for line in lines:
if line[:6] == "ATOM " or line[:6] == "HETATM":
if line[17:20] == "WAT":
continue
if line[13] == "H":
continue
if line[12:14] in HATOMS:
... | 3.1875 | 3 |
old_logen/pylogen/OutputBook.py | leuschel/logen | 14 | 13381 | <gh_stars>10-100
import Pmw
import os
import re
from FastIndex import FastIndex, timer
from PrologFrame import PrologFrame
from TerminalFrame import TerminalFrame
class OutputBook(Pmw.NoteBook):
def __init__(self, master=None):
self.app = master
Pmw.NoteBook.__init__(self, self.app.bottom,createco... | 2.1875 | 2 |
back/db.py | belshoff/Agenda | 0 | 13382 | import sqlite3
with sqlite3.connect('storage.db') as conn:
cursor = conn.cursor()
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS Produtos (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
price REAL,
compra_id INTEGER,
... | 4 | 4 |
tools/build_rules/gtk_dependent.bzl | Ewpratten/frc_971_mirror | 39 | 13383 | disable_gtk_binaries = True
def gtk_dependent_cc_library(**kwargs):
if not disable_gtk_binaries:
native.cc_library(**kwargs)
def gtk_dependent_cc_binary(**kwargs):
if not disable_gtk_binaries:
native.cc_binary(**kwargs)
| 1.5625 | 2 |
vectorize.py | tomohiroando/recipe_gan | 0 | 13384 | <gh_stars>0
import sys
from gensim import models
from gensim.models.doc2vec import LabeledSentence
import pickle
def corpus_to_sentences(corpus):
sentences = []
for idx, (name, doc) in enumerate(corpus.items()):
sys.stdout.write('\r前処理中 {}/{}'.format(idx, len(corpus)))
sentence = LabeledSenten... | 2.609375 | 3 |
lxman/registry.py | stuxcrystal/lxman | 1 | 13385 | <gh_stars>1-10
# -*- encoding: utf-8 -*-
from collections import UserDict
from itertools import count
import shutil
import winreg
import uuid
PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Lxss"
KEY = winreg.HKEY_CURRENT_USER
class RegistryDescriptor(object):
def __init__(self, name):
... | 2.359375 | 2 |
virtual/lib/python3.6/site-packages/debian/changelog.py | marknesh/pitches | 0 | 13386 | # changelog.py -- Python module for Debian changelogs
# Copyright (C) 2006-7 <NAME> <<EMAIL>>
# Copyright (C) 2008 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version... | 1.851563 | 2 |
Median.py | fatih-iver/Intro-to-Computer-Science-with-Python | 0 | 13387 | # Define a procedure, median, that takes three
# numbers as its inputs, and returns the median
# of the three numbers.
# Make sure your procedure has a return statement.
def bigger(a,b):
if a > b:
return a
else:
return b
def biggest(a,b,c):
return bigger(a,bigger(b,c))
def... | 4.15625 | 4 |
miss_islington/util.py | webknjaz/miss-islington | 0 | 13388 | import requests
import os
import subprocess
import gidgethub
from gidgethub import sansio
AUTOMERGE_LABEL = ":robot: automerge"
def comment_on_pr(issue_number, message):
"""
Leave a comment on a PR/Issue
"""
request_headers = sansio.create_headers(
"miss-islington", oauth_token=os.getenv("... | 2.640625 | 3 |
src/plugins/database.py | Blitz-Raynor/Kiba | 4 | 13389 | import aiosqlite
import sqlite3
import asyncio
import nonebot
from nonebot.log import logger
driver: nonebot.Driver = nonebot.get_driver()
config: nonebot.config.Config = driver.config
@driver.on_startup
async def init_db():
config.db = await aiosqlite.connect("src/static/Kiba.db")
logger.info("Kiba Kernel -... | 2.234375 | 2 |
dexp/processing/utils/scatter_gather_i2i.py | haesleinhuepf/dexp | 16 | 13390 | from typing import Callable, Optional, Sequence, Tuple, Union
import numpy
from dexp.processing.utils.nd_slice import nd_split_slices, remove_margin_slice
from dexp.processing.utils.normalise import Normalise
from dexp.utils import xpArray
from dexp.utils.backends import Backend
def scatter_gather_i2i(
function... | 2.8125 | 3 |
http_shadow/__init__.py | abador/http-shadow | 0 | 13391 | <gh_stars>0
from .backend import Backend
from .thread import HttpPool
| 1.109375 | 1 |
Problems/sample.py | HKuz/Test_Code | 1 | 13392 | #!/usr/local/bin/python3
def main():
# Test suite
return
if __name__ == '__main__':
main()
| 1.335938 | 1 |
setup.py | wrmsr/omnibus | 2 | 13393 | <reponame>wrmsr/omnibus
import fnmatch
import glob
import os
import sys
import setuptools.command.build_ext
APPLE = sys.platform == 'darwin'
BASE_DIR = os.path.dirname(__file__)
ABOUT = {}
def _read_about():
with open(os.path.join(BASE_DIR, 'omnibus', '__about__.py'), 'rb') as f:
src = f.read()
... | 1.945313 | 2 |
day1/test_day1.py | Sundin/advent-of-code-2019 | 0 | 13394 | <filename>day1/test_day1.py
from day1 import *
import unittest
def test_get_fuel_requirements_for_mass():
assert get_fuel_requirements_for_mass(12) == 2
assert get_fuel_requirements_for_mass(14) == 2
assert get_fuel_requirements_for_mass(1969) == 654
assert get_fuel_requirements_for_mass(100756) == 33583
def ... | 2.890625 | 3 |
PyObjCTest/test_nspdfinfo.py | linuxfood/pyobjc-framework-Cocoa-test | 0 | 13395 | import AppKit
from PyObjCTools.TestSupport import TestCase, min_os_level
class TestNSPDFInfo(TestCase):
@min_os_level("10.9")
def testMethods(self):
self.assertResultIsBOOL(AppKit.NSPDFInfo.isFileExtensionHidden)
self.assertArgIsBOOL(AppKit.NSPDFInfo.setFileExtensionHidden_, 0)
| 1.90625 | 2 |
gap/src/util/data_iterator.py | cosmozhang/autoencoding_parsing | 0 | 13396 | <gh_stars>0
from collections import OrderedDict, defaultdict
import numpy as np
'''
generate a id to length dic
'''
def gen_sid_len(sentences):
sid2len = OrderedDict()
for i, sent in enumerate(sentences):
sid2len[i] = len(sent)
return sid2len
def batch_slice(data, batch_size):
# data is a li... | 2.6875 | 3 |
recipe_parser/recipes/thehappyfoodie.py | tyler-a-cox/recipe-parsing | 0 | 13397 | from ._schema import DefaultSchema
from ._utils import get_minutes, get_yields, normalize_string
class TheHappyFoodie(DefaultSchema):
@classmethod
def host(cls):
return "thehappyfoodie.co.uk"
def title(self):
return self.soup.find("h1", {"class": "main-title"}).get_text()
def total_t... | 2.484375 | 2 |
Scopuli/WEB/DebugToolbar/Toolbar.py | MaxOnNet/scopuli-core-web | 0 | 13398 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright [2017] <NAME> [<EMAIL>]
#
# 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... | 1.945313 | 2 |
CalculateLods.py | makeling/AGSSmartVectorTileTools | 3 | 13399 | # -*- coding: utf-8 -*-
# !/usr/bin/python
__author__ = 'ma_keling'
# Version : 1.0.0
# Start Time : 2018-11-29
# Update Time :
# Change Log :
## 1.
## 2.
## 3.
import time
import arcpy
import math
def express_arcpy_error():
severity = arcpy.GetMaxSeverity()
if severity =... | 2.328125 | 2 |