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 |
|---|---|---|---|---|---|---|
gui_showcase/main.py | maliozer/rodnet | 1 | 30900 | <gh_stars>1-10
from tkinter import *
from PIL import ImageTk, Image
from tkinter import filedialog
gui = Tk()
gui.title('RODNET | Inzva AI Project Showcase v0.1')
#logo var en son ekleriz yorumda kalabilir
logo_image_path = Image.open('./images/inzva_logo.png')
inzva_logo = ImageTk.PhotoImage(logo_image_path)
inzva_... | 3.0625 | 3 |
heap_md.py | sorrento/sdopt-tearing | 0 | 30901 | # Copyright (C) 2014, 2015 University of Vienna
# All rights reserved.
# BSD license.
# Author: <NAME> <<EMAIL>>
# Heap-based minimum-degree ordering with NO lookahead.
#
# See also min_degree.py which uses lookahead, and simple_md.py which is a
# hacked version of min_degree.py that still uses repeated linear scans... | 2.609375 | 3 |
philia-service/wit-service/wit_service.py | BuildForSDGCohort2/masta-backend | 1 | 30902 | <filename>philia-service/wit-service/wit_service.py<gh_stars>1-10
import json
from wit import Wit
access_token = "<KEY>"
client = Wit(access_token=access_token)
def wit_handler(event, context):
utterance = 'good morning john'
response = client.message(msg=utterance)
intent = None
entity = None
tr... | 2.453125 | 2 |
py/server/tests/test_plot/test_color.py | mattrunyon/deephaven-core | 0 | 30903 | #
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import unittest
from deephaven import read_csv, DHError
from deephaven.plot import Color, Colors
from deephaven.plot import Figure
from deephaven.plot import LineEndStyle, LineStyle
from tests.testbase import BaseTestCase
class ColorTestCase(Base... | 2.609375 | 3 |
Tools/unicode/genmap_support.py | shawwn/cpython | 52,316 | 30904 | <filename>Tools/unicode/genmap_support.py
#
# genmap_support.py: Multibyte Codec Map Generator
#
# Original Author: <NAME> <<EMAIL>>
# Modified Author: <NAME> <<EMAIL>>
#
class BufferedFiller:
def __init__(self, column=78):
self.column = column
self.buffered = []
self.cline = []
... | 2.359375 | 2 |
tests/qlayers_test.py | kshithijiyer/qkeras | 388 | 30905 | <reponame>kshithijiyer/qkeras
# Copyright 2019 Google LLC
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 1.960938 | 2 |
253/meetingroomII.py | cccccccccccccc/Myleetcode | 0 | 30906 | """
timecompliexty = O(nlog(n))
separate start and end time into two list
sort each of them
use s,e represent start and end index from 0
iterate start time list by while loop
compare start[s] end[e]
if start >= end means after cur meeting finish another one can use the meeting room ,no need to add a new room
else mea... | 3.59375 | 4 |
uiza/api_resources/entity/entity.py | uizaio/api-wrapper-python | 2 | 30907 | import uiza
from uiza import Connection
from uiza.api_resources.base.base import UizaBase
from uiza.settings.config import settings
from uiza.utility.utility import set_url
class Entity(UizaBase):
def __init__(self):
self.connection = Connection(workspace_api_domain=uiza.workspace_api_domain, api_key=uiz... | 2.265625 | 2 |
text_models/vocabulary.py | INGEOTEC/text_models | 12 | 30908 | # Copyright 2020 <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, software... | 2.25 | 2 |
mi/dataset/parser/test/test_nutnrb.py | rhan1498/marine-integrations | 0 | 30909 | #!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_nutnrb
@file marine-integrations/mi/dataset/parser/test/test_nutnrb.py
@author <NAME>
@brief Test code for a Nutnrb data parser
"""
import unittest
import gevent
from StringIO import StringIO
from nose.plugins.attrib import attr
from mi.core.log import g... | 2.09375 | 2 |
wp/tests/data/test_benchmark.py | ExLeonem/master-thesis-code | 0 | 30910 | <filename>wp/tests/data/test_benchmark.py<gh_stars>0
import numpy as np
import pytest
import os
from modules.data import BenchmarkData, DataSetType
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
BASE_PATH = os.path.join(DIR_PATH, "..", "..")
MNIST_PATH = os.path.join(BASE_PATH, "datasets", "mnist")
class Tes... | 2.53125 | 3 |
src/taskmaster/example.py | alex/taskmaster | 2 | 30911 | <reponame>alex/taskmaster
"""
taskmaster.example
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
def get_jobs(last=0):
# last_job would be sent if state was resumed
# from a previous run
for i in xrange(last, 20000):
yield i
def ha... | 1.9375 | 2 |
orchestration/hca_manage/verify_release_manifest.py | DataBiosphere/hca-ingest | 5 | 30912 | <gh_stars>1-10
"""
Given a file containing a list of constituent staging dirs for a DCP release (aka a manifest),
verify that data has been loaded from each of them to the target DCP dataset and the count of loaded files
matches the # in the staging area.
Files are determined to be loaded if they exist at the desired ... | 2.25 | 2 |
camd3/infrastructure/component/tests/test_component.py | mamrhein/CAmD3 | 0 | 30913 | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Name: test_component
# Purpose: Test driver for module component
#
# Author: <NAME> (<EMAIL>)
#
# Copyright: (c) 2014 <NAME>
# ------------------------------------------------------------------------... | 2.640625 | 3 |
docs/source/examples/data_exploration.py | SimulatedANeal/carpedm | 2 | 30914 | <gh_stars>1-10
#
# Copyright (C) 2018 <NAME>.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
"""Data exploration.
If this file is changed, please also change the ``:lines:`` option in
the following files where this code is referenced with the
... | 1.671875 | 2 |
backend/czi_hosted/auth/__init__.py | danmedani/cellxgene | 1 | 30915 | # import the built in auth types so they can be registered
import backend.czi_hosted.auth.auth_test # noqa: F401
import backend.czi_hosted.auth.auth_session # noqa: F401
import backend.czi_hosted.auth.auth_oauth # noqa: F401
import backend.czi_hosted.auth.auth_none # noqa: F401
| 1.195313 | 1 |
core/net_loader.py | nikon-petr/perceptron | 0 | 30916 | import os
from json import JSONDecodeError
from json import dump
from json import load
import numpy as np
from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound
def upload(net_object, path):
if not os.path.isfile(path):
raise JsonFileNotFound()
try:
with open(path, 'r') as... | 2.515625 | 3 |
analytics/settings.py | Kratos-Freyja/analytics | 0 | 30917 | <gh_stars>0
"""
Django settings for analytics project.
Generated by 'django-admin startproject' using Django 1.11.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/... | 1.742188 | 2 |
production/tests/O365_SE_Email.py | GoVanguard/SeleniumBase | 0 | 30918 | <gh_stars>0
"""
The Office 365 Social Engineering Email draft producer uses a customized
library of methods in this master class to maintain continuous delivery.
This repository is controlled by a single boolean that is set to false by
default. Please ensure that the emailDraft.py file is correct.
"""
# Built-in Impor... | 1.914063 | 2 |
test.py | FirstDraftGIS/is-a-place-counter | 1 | 30919 | <reponame>FirstDraftGIS/is-a-place-counter<filename>test.py
from datetime import datetime
from csv import DictReader
from numpy import mean
from numpy import median
import pickle
import unittest
from config import path_to_pickled_counter
from config import path_to_tsv
class TestDataMethods(unittest.TestCase):
... | 3.03125 | 3 |
scalpel/utils/sensor.py | straizys/elliptical-excision-force-model | 0 | 30920 | <reponame>straizys/elliptical-excision-force-model
#!/usr/bin/env python
import sys, serial
import numpy as np
from collections import deque
import itertools
import csv
from datetime import datetime
import time
import rospy
from std_msgs.msg import Int32MultiArray
class Sensor:
def __init__(self, strPort, max... | 2.40625 | 2 |
tests/test_play_turn.py | Avashist1998/tictactoe-abhay | 0 | 30921 | <reponame>Avashist1998/tictactoe-abhay<gh_stars>0
import unittest
from tic_tac_toe.TicTacToe import TicTacToe
def board_starter(spot:int):
game = TicTacToe()
status = game.play_turn(spot)
return game, status
class test_play_turn(unittest.TestCase):
def test_perfect_case(self):
game, status = b... | 3.4375 | 3 |
p3_collab-compet/envs.py | albimc/deep-reinforcement-learning | 0 | 30922 | from env_wrapper import SubprocVecEnv, DummyVecEnv
import numpy as np
import multiagent.scenarios as scenarios
from multiagent.environment import MultiAgentEnv
def make_parallel_env(n_rollout_threads, seed=1):
def get_env_fn(rank):
def init_env():
env = make_env("simple_adversary")
... | 2.421875 | 2 |
talipp/indicators/CHOP.py | solocarrie/talipp | 54 | 30923 | <filename>talipp/indicators/CHOP.py
from math import log10
from typing import List, Any
from talipp.indicators.Indicator import Indicator
from talipp.indicators.ATR import ATR
from talipp.ohlcv import OHLCV
class CHOP(Indicator):
"""
Choppiness Index
Output: a list of OHLCV objects
"""
def __in... | 2.671875 | 3 |
unleash_client/clients.py | rarruda/unleash-client-python | 2 | 30924 | <filename>unleash_client/clients.py
import time
import logging
from urllib.parse import urljoin
from .strategy import DEFAULT_STRATEGIES
from .io import UrlFetcher, Reporter
from .features import Feature
log = logging.getLogger(__name__)
def name_instance():
import os
import socket
return "%s:%s" % (so... | 1.96875 | 2 |
bot/cogs/utils/logging.py | Kobu/MasarykBOT | 13 | 30925 | <gh_stars>10-100
import logging
import os
from logging import FileHandler, Formatter
from logging.handlers import TimedRotatingFileHandler
from pathlib import Path
from rich.logging import RichHandler
def my_namer(default_name):
# This will be called when doing the log rotation
# default_name is the default ... | 2.578125 | 3 |
amdtemp/amdtemp.py | micaelbergeron/amdtemp | 0 | 30926 | #!/usr/bin/env python
import os
import sys
import anyconfig
import re
import time
import importlib
import pdb
from select import poll, POLLIN
from statsd import StatsClient
def import_class(klass):
(module, klass) = klass.rsplit('.', 1)
module = importlib.import_module(module)
return getattr(module, klass... | 2.25 | 2 |
keccak256hash_pcie.py | shahbaazlokh/Picoevb_Keccak256hash_Pcie_ipi | 1 | 30927 |
#!/usr/bin/env python3
import os
import time
import binascii
import codecs
def swap_order(d, wsz=16, gsz=2 ):
return "".join(["".join([m[i:i+gsz] for i in range(wsz-gsz,-gsz,-gsz)]) for m in [d[i:i+wsz] for i in range(0,len(d),wsz)]])
expected_genesis_hash = "00000009c4e61bee0e8d6236f847bb1dd23f4c61ca5240b748521... | 2.4375 | 2 |
tests/test_policy.py | forkedOrg/RocAlphaGo | 0 | 30928 | from AlphaGo.models.policy import CNNPolicy
from AlphaGo import go
from AlphaGo.go import GameState
from AlphaGo.ai import GreedyPolicyPlayer, ProbabilisticPolicyPlayer
import numpy as np
import unittest
import os
class TestCNNPolicy(unittest.TestCase):
def test_default_policy(self):
policy = CNNPolicy(["board", ... | 2.5 | 2 |
conference/factories.py | mattaustin/django-conference | 1 | 30929 | <reponame>mattaustin/django-conference
# -*- coding: utf-8 -*-
#
# Copyright 2016 <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
#
#... | 2.15625 | 2 |
anchore_engine/db/db_users.py | bjwschaap/anchore-engine | 0 | 30930 | import time
from anchore_engine import db
from anchore_engine.db import User
def add(userId, password, inobj, session=None):
if not session:
session = db.Session()
#our_result = session.query(User).filter_by(userId=userId, password=password).first()
our_result = session.query(User).filter_by... | 2.609375 | 3 |
tiledb/segy/convert.py | TileDB-Inc/tilesegy | 0 | 30931 | <reponame>TileDB-Inc/tilesegy
import copy
from abc import ABC, abstractmethod
from collections import namedtuple
from contextlib import contextmanager
from pathlib import PurePath
from typing import Any, Iterable, Iterator, Optional, Union, cast
import numpy as np
import segyio
import segyio.tools
from cached_property... | 2.03125 | 2 |
src/maggma/api/__init__.py | materialsproject/maggflow | 15 | 30932 | <reponame>materialsproject/maggflow
""" Simple API Interface for Maggma """
| 0.929688 | 1 |
dos/gen_palette.py | dbrotz/fire-effect | 0 | 30933 | <reponame>dbrotz/fire-effect<filename>dos/gen_palette.py
import colorsys
palette_size = 80
palette = []
for i in range(palette_size):
t = i / (palette_size - 1)
h = t * (60 / 360)
l = t
s = 1.0
color = colorsys.hls_to_rgb(h, l, s)
color = tuple(map(lambda x: round(x * 63), color))
palette.... | 2.515625 | 3 |
HITCON-Training/LAB/lab7/crack.py | kernweak/HITCON-Training-writeup | 30 | 30934 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwn import *
host = "training.pwnable.tw"
port = 11007
r = remote(host,port)
password_addr = 0x8<PASSWORD>
r.recvuntil("?")
r.sendline(p32(password_addr) + "#" + "%10$s" + "#" )
r.recvuntil("#")
p = r.recvuntil("#")
password = u32(p[:4])
r.recvuntil(":")
r.sendli... | 2.296875 | 2 |
tests/test_records.py | tomfallen/python-fitparse | 548 | 30935 | #!/usr/bin/env python
import sys
from fitparse.records import Crc
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
class RecordsTestCase(unittest.TestCase):
def test_crc(self):
crc = Crc()
self.assertEqual(0, crc.value)
crc.update(b'\x0e\x10\x98\... | 2.578125 | 3 |
bazel/deps.bzl | quantapix/semtools | 0 | 30936 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
BAZEL_INSTALLER = struct(
revision = "4.0.0",
sha256 = "bd7a3a583a18640f58308c26e654239d412adaa833b6b6a7b57a216ab62fabc2",
)
DEBS_TARBALL = struct(
revision = "1608132805",
sha256 = "7ed2d4869f19c11d8c39345bd75f908a51410bf4e512e9fc368ad... | 1.78125 | 2 |
Python/Sets/Set.add().py | pavstar619/HackerRank | 61 | 30937 | if __name__ == '__main__':
n = int(input())
s = set()
for i in range (n):
s.add(input())
print((len(s)))
| 3.265625 | 3 |
main.py | spdir/sakf | 0 | 30938 | <gh_stars>0
# -*- coding: utf-8 -*-
from sakf.sakf import main
if __name__ == '__main__':
main() | 1.125 | 1 |
compiler.py | ayung8/CodeBoard | 2 | 30939 | <filename>compiler.py
from sphere_engine import CompilersClientV4
from sphere_engine.exceptions import SphereEngineException
import time
# define access parameters
accessToken = '77501c36922866a03b1822b4508a50c6'
endpoint = 'dd57039c.compilers.sphere-engine.com'
# initialization
client = CompilersClientV4(accessToke... | 2.703125 | 3 |
main.py | bzsam/password_generator | 0 | 30940 | import tkinter as tk
import gui
wd = tk.Tk()
gui = gui.GUI(wd)
wd.mainloop() | 2.03125 | 2 |
backend/lost/api/user/login_manager.py | JonasGoebel/lost | 490 | 30941 | import datetime
from flask_ldap3_login import LDAP3LoginManager, AuthenticationResponseStatus
from lost.settings import LOST_CONFIG, FLASK_DEBUG
from flask_jwt_extended import create_access_token, create_refresh_token
from lost.db.model import User as DBUser, Group
from lost.db import roles
class LoginManager():
de... | 2.140625 | 2 |
betterthanbackprop/feedbackLearners/learningViz/OptimTrajViz.py | conradliste/SmarterThanBackProp | 0 | 30942 | import os
import torch
import numpy as np
import torch.nn as nn
import matplotlib.pyplot as plt
def get_param_matrix(model_prefix, model_dir):
"""
Grabs the parameters of a saved model and returns them as a matrix
"""
# Load and combine the parameters
param_matrix = []
for file in os.listdir(... | 2.8125 | 3 |
docs/cornell CS class/lesson 9. Conditionals/demos/angl.py | LizzieDeng/kalman_fliter_analysis | 0 | 30943 | <reponame>LizzieDeng/kalman_fliter_analysis
"""
Functions to anglicize integers in the range 1..19
This is a simple example for now. We will see a more complex
version of this later.
Author: <NAME>
Date: March 30, 2019
"""
def anglicize(n):
"""
Returns: English equiv of n.
Parameter: the integer to ... | 3.84375 | 4 |
hackerearth/Algorithms/Matt's Graph Book/solution.py | ATrain951/01.python-com_Qproject | 4 | 30944 | <filename>hackerearth/Algorithms/Matt's Graph Book/solution.py
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# W... | 3.734375 | 4 |
python/863.all-nodes-distance-k-in-binary-tree.py | stavanmehta/leetcode | 0 | 30945 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def distanceK(self, root, target, K):
"""
:type root: TreeNode
:type target: TreeNode
:type K: int
... | 3.75 | 4 |
downloader_cli/__version__.py | srevinsaju/downloader-cli | 1 | 30946 | """Contiain the version of the package"""
__version__ = "0.2.0"
| 1.101563 | 1 |
apps/ffmpeg/ffmpeg_GUI.py | rboman/progs | 2 | 30947 | <reponame>rboman/progs
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2019 <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/license... | 1.757813 | 2 |
tests/nn/softmax_test.py | kbrodt/tor4 | 0 | 30948 | import numpy as np
import tor4
import tor4.nn as nn
def test_softmax():
a = tor4.tensor(data=[0, 0, 0.0])
a_sm = nn.functional.softmax(a, dim=0)
assert not a_sm.requires_grad
assert a_sm.tolist() == [1 / 3, 1 / 3, 1 / 3]
def test_softmax2():
a = tor4.tensor(data=[[0, 0, 0], [0, 0, 0.0]])
a... | 2.40625 | 2 |
ForestTool(Python2)/Main.py | paltis5212/ForestTool | 9 | 30949 | #coding=utf-8
__author__ = 'zxlee'
__github__ = 'https://github.com/SmileZXLee/forestTool'
import json
import time
import HttpReq
from User import User
from datetime import datetime,timedelta
import sched
import sys
import os
import platform
from dateutil.parser import parse
#是否是Windows
os_is_windows = platform.system... | 2.65625 | 3 |
samples/sendRps.py | vsgobbi/Nfse-python | 0 | 30950 | # -*- coding: utf-8 -*-
from services.Services import Services
# NFSe Provider
taxId = "87654321000198"
providerSubscription = "12345678" # Provider city subscription
# NFSe Taker
companyName = "<NAME>"
takerTaxId = "12345678000198"
objServ = Services(
certificateContent=open("../certfiles/converted.crt", "rb"... | 1.984375 | 2 |
python/course/leetcode/leetcode.py | TimVan1596/ACM-ICPC | 1 | 30951 | # -*- coding:utf-8 -*-
# @Time:2020/6/15 11:38
# @Author:TimVan
# @File:leetcode.py
# @Software:PyCharm
# Definition for singly-linked list.
# for j in range(10, 5, -1):
# print(j)
print('a'.find(' '))
| 3.328125 | 3 |
inlp/text_preprocessing/KerasBow.py | Jie-Yuan/iNLP | 9 | 30952 | from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
class KerasBow(object):
"""doc
词袋模型:我们可以为数据集中的所有单词制作一张词表,然后将每个单词和一个唯一的索引关联。
每个句子都是由一串数字组成,这串数字是词表中的独立单词对应的个数。
通过列表中的索引,我们可以统计出句子中某个单词出现的次数。
"""
def __init__(self, num_words=20000, maxlen=None... | 3.25 | 3 |
trojsten/people/migrations/0011_auto_20170218_1724.py | MvonK/web | 5 | 30953 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-18 16:24
from django.db import migrations
countries = {
"Ma\u010farsko": "HU",
"Czech Republic": "CZ",
"\u010cesk\xe1 republika": "CZ",
"United Kingdom": "GB",
"Austria": "AT",
"Madarsko": "HU",
"Australia": "AU",
"Srbsko":... | 2.078125 | 2 |
test/test_commands/test_tail.py | Rudedog9d/pypsi | 18 | 30954 | <filename>test/test_commands/test_tail.py<gh_stars>10-100
from pypsi.shell import Shell
from pypsi.commands.tail import TailCommand
class CmdShell(Shell):
tail = TailCommand()
class TestTail:
def setup(self):
self.shell = CmdShell()
def teardown(self):
self.shell.restore()
| 2.21875 | 2 |
linuxOperation/app/domain/constants.py | zhouli121018/core | 0 | 30955 | # -*- coding: utf-8 -*-
'''
常量
'''
import base64
from django.utils.translation import ugettext_lazy as _
DOMAIN_BASIC_PARAMS = (
(u"cf_limit_mailbox_cnt", _(u"限定邮箱数量")),
#(u"cf_limit_alias_cnt", u"限定别名数量"), #这个开关没人用
(u"cf_limit_mailbox_size", _(u"限定邮箱空间总容量")),
(u"cf_limit_netdisk_size", _(u"限定... | 1.929688 | 2 |
splunk_add_on_ucc_framework/modular_alert_builder/build_core/alert_actions_merge.py | livehybrid/addonfactory-ucc-generator | 0 | 30956 | <filename>splunk_add_on_ucc_framework/modular_alert_builder/build_core/alert_actions_merge.py
# SPDX-FileCopyrightText: 2020 2020
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
import os
import os.path as op
from os.path import dirname as dn
from os.path import basename as bn
from shuti... | 2.0625 | 2 |
authapp/models.py | MSFC-NASA/NasaPD | 0 | 30957 | <filename>authapp/models.py<gh_stars>0
from django.db import models
from django.conf import settings
# Create your models here.
class UserRegistrationModel(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE) | 1.773438 | 2 |
src/commercetools/predicates.py | mikedingjan/commercetools-python-sdk | 0 | 30958 | <gh_stars>0
import json
import typing
from collections.abc import Collection
from decimal import Decimal
from functools import reduce
class QueryPredicate:
AND = "AND"
OR = "OR"
_operators = {
"exact": "=",
"gte": ">=",
"lte": "=<",
"lt": "<",
"gt": ">",
"i... | 2.46875 | 2 |
accounts/views.py | DipeshYogi/PetsProj | 0 | 30959 | from django.shortcuts import render, redirect
from .forms import UserRegisterForm
def register(request):
if request.method == 'POST':
form = UserRegisterForm(request.POST)
if form.is_valid():
form.save()
return redirect('login')
else:
form = UserRegisterForm()
... | 2.234375 | 2 |
thunderpush/handler.py | welingtonsampaio/thunderpush | 0 | 30960 | import logging
from sockjs.tornado import SockJSConnection
from thunderpush.sortingstation import SortingStation
try:
import simplejson as json
except ImportError:
import json
logger = logging.getLogger()
class ThunderSocketHandler(SockJSConnection):
def on_open(self, info):
logger.debug("New c... | 2.359375 | 2 |
archiv/migrations/0015_auto_20210505_1145.py | acdh-oeaw/mmp | 2 | 30961 | <reponame>acdh-oeaw/mmp
# Generated by Django 3.2 on 2021-05-05 11:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('archiv', '0014_stelle_ort'),
]
operations = [
migrations.AddField(
model_name='stelle',
name='... | 1.632813 | 2 |
65-Spam-filter/main.py | PawelZabinski/ocr-code-challenges-files | 0 | 30962 | # Spam filter
# Take a list of dishes from a menu and add “spam” to them. See https://en.wikipedia.org/wiki/Spam_(Monty_Python).
def main():
try:
dishCount = int(input('Enter number of dishes in menu > '))
dishes = [input(f'Enter Dish No.{i + 1} > ') for i in range(dishCount)]
dishes = [f'{dish} spam' ... | 3.921875 | 4 |
app/cli.py | Jiyvn/pyautotest | 0 | 30963 | import argparse
class appOptions:
show_devices = '--show-devices'
clean_report = '--clean-report'
device_config = '--device-config'
global_config = '--global-config'
test_case = '--test-case'
tests_dir = '--tests-dir'
device = '--device'
test = '--test'
service_address = '--ser... | 2.453125 | 2 |
config/settings/base.py | ComputationalMechanics/TopoBank | 1 | 30964 | <reponame>ComputationalMechanics/TopoBank<filename>config/settings/base.py
"""
Base settings to build other settings files upon.
"""
import environ
import topobank
ROOT_DIR = environ.Path(__file__) - 3 # (topobank/config/settings/base.py - 3 = topobank/)
APPS_DIR = ROOT_DIR.path('topobank')
env = environ.Env()
REA... | 2.21875 | 2 |
teste_app/search.py | rafaelang/teste_app | 0 | 30965 | import requests
from teste_app import settigns
def google(q: str):
"""Faz uma pesquisa no google"""
return requests.get(settigns.GOOGLE, params={"q": q})
| 2.203125 | 2 |
src/data/prepare_train_data.py | ds-praveenkumar/m5-accuracy-prediction | 0 | 30966 | # github link: https://github.com/ds-praveenkumar/kaggle
# Author: ds-praveenkumar
# file: forcasting/prepare_train_data.py/
# Created by ds-praveenkumar at 13-06-2020 15 34
# feature:
import os
import pandas as pd
import numpy as np
import click
from src.utility.timeit import timeit
root = os.path.dirname(os.getcwd(... | 2.578125 | 3 |
IoTCognito/get_auth_creds.py | devendersatija/IoTCognito | 0 | 30967 | <filename>IoTCognito/get_auth_creds.py
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENS... | 2.296875 | 2 |
python/db_conn.py | oerpli/MONitERO | 2 | 30968 | import psycopg2
import psycopg2.extras
import sys
from sqlalchemy import create_engine
import pandas as pd
def get_cursor():
conn_string = "host='localhost' dbname='HintereggerA' user='HintereggerA' password='<PASSWORD>'"
# print the connection string we will use to connect
print("Connecting to database: {}".forma... | 3.59375 | 4 |
oldplugins/lurk.py | sonicrules1234/sonicbot | 1 | 30969 | arguments = ["self", "info", "args"]
helpstring = "lurk"
minlevel = 3
def main(connection, info, args) :
"""Deops and voices the sender"""
connection.rawsend("MODE %s -o+v %s %s\n" % (info["channel"], info["sender"], info["sender"]))
| 1.960938 | 2 |
volume_editor_layout.py | singleswitch/ticker | 0 | 30970 | <filename>volume_editor_layout.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'volume_layout.ui'
#
# Created: Tue Mar 26 12:40:36 2013
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(obj... | 2.03125 | 2 |
pipeline/models/nmap_model.py | ponderng/recon-pipeline | 352 | 30971 | <reponame>ponderng/recon-pipeline<filename>pipeline/models/nmap_model.py
import textwrap
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, ForeignKey, String, Boolean
from .base_model import Base
from .port_model import Port
from .ip_address_model import IPAddress
from .nse_model import ... | 2.40625 | 2 |
examples/isinstance.py | quynhanh-ngx/pytago | 206 | 30972 | def main():
a = ["a", 1, "5", 2.3, 1.2j]
some_condition = True
for x in a:
# If it's all isinstance, we can use a type switch
if isinstance(x, (str, float)):
print("String or float!")
elif isinstance(x, int):
print("Integer!")
else:
print("... | 4 | 4 |
sarcsdet/utils/mark_ling_feat.py | castargo/SarcDetectionRusModels | 1 | 30973 | from sarcsdet.configs.ling_feat_config import interjections, funny_marks
def funny_marks_feature(text):
text_set = (str(text)).split()
return sum([text_set.count(x) for x in funny_marks])
def interjections_feature(text):
text_set = (str(text)).split()
return sum([text_set.count(x) for x in interject... | 3.015625 | 3 |
fastapy/_fasta.py | proloyd/fastapy | 3 | 30974 | # Author: <NAME> <<EMAIL>>
"""Module implementing the FASTA algorithm"""
import numpy as np
from math import sqrt
from scipy import linalg
import time
import logging
def _next_stepsize(deltax, deltaF, t=0):
"""A variation of spectral descent step-size selection: 'adaptive' BB method.
Reference:
-------... | 3.0625 | 3 |
pycorrector/utils/io_utils.py | zouning68/pycorrector | 45 | 30975 | # -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Brief:
import os
import pickle
def load_pkl(pkl_path):
"""
加载词典文件
:param pkl_path:
:return:
"""
with open(pkl_path, 'rb') as f:
result = pickle.load(f)
return result
def dump_pkl(vocab, pkl_path, overwrite=True):
"""
存... | 3.203125 | 3 |
chat_service/mecab_service/mecab_ner_app/app/application/service/mecab_parser.py | YoungchanChang/ES_BERT_CHAT | 1 | 30976 | import copy
import _mecab
from collections import namedtuple
from typing import Generator
from mecab import MeCabError
from domain.mecab_domain import MecabWordFeature
def delete_pattern_from_string(string, pattern, index, nofail=False):
""" 문자열에서 패턴을 찾아서 *로 변환해주는 기능 """
# raise an error if index is outsid... | 2.8125 | 3 |
linux/.local/scripts/update_pip_pkgs.py | rodrigoestevao/configuration-files | 0 | 30977 | <gh_stars>0
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
call(
f"pip install --upgrade --no-cache-dir {' '.join(packages)}", shell=True
)
| 1.734375 | 2 |
yaga_ga/evolutionary_algorithm/operators/single_individual/base.py | alessandrolenzi/yaga | 0 | 30978 | <reponame>alessandrolenzi/yaga
from abc import abstractmethod
from typing import TypeVar
from yaga_ga.evolutionary_algorithm.operators.base import GeneticOperator
IndividualType = TypeVar("IndividualType")
GeneType = TypeVar("GeneType")
class SingleIndividualOperator(GeneticOperator[IndividualType, GeneType]):
... | 2.96875 | 3 |
pulsus/services/apns/service.py | pennersr/pulsus | 14 | 30979 | <gh_stars>10-100
import logging
import os
import struct
import binascii
import gevent
from gevent import socket, ssl
from gevent.event import Event
from gevent.queue import Queue
from ..base.service import BaseService
from .notification import APNSNotification
INITIAL_TIMEOUT = 5
MAX_TIMEOUT = 600
logger = loggin... | 2.359375 | 2 |
pysql.py | morfat/PySQL | 0 | 30980 | <filename>pysql.py
import MySQLdb
from urllib import parse
class PySQL:
"""
For making Mariadb / Mysql db queries
"""
FILTER_COMMANDS = {
"$eq":" = %s ",
"$in":" IN (%s) ",
"$nin":" NOT IN (%s) ",
"$neq":" != %s ",
"$lt":" < %s ",
"$lte":" <= %s ... | 3.359375 | 3 |
src/preprocess.py | Mukulthakur17/Skin-Pigment-Analysis | 1 | 30981 | from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import model_from_json
import numpy as np
import tensorflow.keras.models as models
def predict(temp_file):
test_image = image.load_img(temp_file, target_size = (224, 224))
test_image = image.img_to_array(test_image)
test_image = ... | 2.890625 | 3 |
help.py | Wizard684/YouTube-DL-Mega | 0 | 30982 | <reponame>Wizard684/YouTube-DL-Mega<gh_stars>0
from pyrogram import Client, Filters
@Client.on_message(Filters.command(["help"]))
async def start(client, message):
helptxt = f"Currently Only supports Youtube Single (No playlist) Just Send Youtube Url But You must join my Updation channel👉👉 @Mega_Bots_Updates"... | 2.078125 | 2 |
software/scripts/LoopbackTesting.py | slaclab/pgp-pcie-apps | 2 | 30983 | #!/usr/bin/env python3
##############################################################################
## This file is part of 'PGP PCIe APP DEV'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/disp... | 1.773438 | 2 |
MachineInterface/mproxy/core/rpc.py | KTH-HPC/vestec-system | 1 | 30984 | import inspect
import json
from .serialisation import JsonObjHelper, JsonTypeError
class RpcMethod:
"""Encapsulate argument/result (de)serialisation for a function
based on a type-annotated function signature and name.
"""
def __init__(self, name, signature, doc=None):
if (
signat... | 2.921875 | 3 |
setup.py | ajaniv/python-basic-utils | 0 | 30985 | <gh_stars>0
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
... | 1.476563 | 1 |
emails/utils.py | jmhubbard/quote_of_the_day_custom_user | 1 | 30986 | <reponame>jmhubbard/quote_of_the_day_custom_user<gh_stars>1-10
import os
from django.core.mail import send_mail
from django.urls import reverse
from django.contrib.sites.models import Site
from django.template.loader import render_to_string
def email_all_users_an_email(user, showlist):
#Gets the current domain n... | 2.484375 | 2 |
addons/meme.py | 916253/Kurisu-Reswitched | 13 | 30987 | <filename>addons/meme.py
import discord
import random
from discord.ext import commands
class Meme:
"""
Meme commands.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
@commands.command(pass_context=True, hidden=True, name="bam... | 2.65625 | 3 |
google/cloud/recommender/v1beta1/recommender-v1beta1-py/google/cloud/recommender/__init__.py | googleapis/googleapis-gen | 7 | 30988 | <filename>google/cloud/recommender/v1beta1/recommender-v1beta1-py/google/cloud/recommender/__init__.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 obtain a copy of the... | 1.164063 | 1 |
catsndogs/training.py | simonpf/catsndogs | 1 | 30989 | <filename>catsndogs/training.py
import os
import glob
from catsndogs.data import get_training_data
folder = get_training_data()
cats = glob.glob(os.path.join(get_training_data(), "cat", "*.jpg"))
dogs = glob.glob(os.path.join(get_training_data(), "dog", "*.jpg"))
| 2.46875 | 2 |
models/ir_module.py | linjiyou/Odoo-UpgreadOnly | 2 | 30990 | <filename>models/ir_module.py
# -*- coding: utf-8 -*-
# ========================================
# Author: wjh
# Date:2021/1/19
# FILE: ir_module
# ========================================
from odoo import api, fields, models, _
from odoo.exceptions import UserError
ACTION_DICT = {
'view_type': 'for... | 2.046875 | 2 |
nullunit/MCP.py | pnhowe/MCP-agent | 0 | 30991 | import logging
from cinp import client
MCP_API_VERSIONS = ( '0.10', '0.11', )
class MCP( object ):
def __init__( self, host, proxy, job_id, instance_id, cookie, stop_event ):
self.cinp = client.CInP( host, '/api/v1/', proxy, retry_event=stop_event )
self.job_id = job_id
self.instance_id = instance_id
... | 2.03125 | 2 |
fitter.py | quantummind/quantum-rcs-boundaries | 0 | 30992 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
import datetime
def func(x, a, b):
return a + b*x
def exp_regression(x, y):
p, _ = curve_fit(func, x, np.log(y))
p[0] = np.exp(p[0])
return p
def r2(coe... | 3.296875 | 3 |
modules/misc.py | OpenXAIProject/dac | 17 | 30993 | <reponame>OpenXAIProject/dac<filename>modules/misc.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class Flatten(nn.Module):
def __init__(self, dim_start=-3):
super().__init__()
self.dim_start = dim_start
def forward(self, x):
return x.view(x.shape[:self.dim_start... | 2.1875 | 2 |
env/Lib/site-packages/IPython/lib/tests/test_latextools.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 2 | 30994 | """Tests for IPython.utils.path.py"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from contextlib import contextmanager
from unittest.mock import patch
import pytest
from IPython.lib import latextools
from IPython.testing.decorators import (
onlyif_cmds_ex... | 2.234375 | 2 |
crits/ips/urls.py | dutrow/crits | 738 | 30995 | <reponame>dutrow/crits<filename>crits/ips/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^search/$', views.ip_search, name='crits-ips-views-ip_search'),
url(r'^search/(?P<ip_str>\S+)/$', views.ip_search, name='crits-ips-views-ip_search'),
url(r'^details/(?P<ip>\S+)/$', ... | 2.0625 | 2 |
notes/reference/moocs/udacity/cs50-introduction-to-computer-science/assignments/pset1/pennies/pennies.py | aav789/study-notes | 43 | 30996 | """
pennies.py
Computer Science 50 in Python (Hacker Edition)
Problem Set 1
Get num of days in month then works out how many $$ you'd have by end of the month
if you received a penny on the first day, two on second, four on third and so on
"""
def get_input(question):
"""Get the days input from the user """
... | 3.9375 | 4 |
bcc-apps/python/hello_world.py | Huweicai/ebpf-apps | 59 | 30997 | #!/usr/bin/python3
#
# This is a Hello World example of BPF.
from bcc import BPF
# define BPF program
prog = """
int kprobe__sys_clone(void *ctx)
{
bpf_trace_printk("Hello, World!\\n");
return 0;
}
"""
# load BPF program
b = BPF(text=prog)
b.trace_print()
| 2.65625 | 3 |
accounts/admin.py | kamel2700/Build-a-team-for-Startup | 0 | 30998 | from django.contrib import admin
from accounts.models import *
admin.site.register(UserProfile)
admin.site.register(ProjectPage)
admin.site.register(Comment)
| 1.367188 | 1 |
RandomScripts/FibonacciGenerator.py | AlexGatz/PythonFor100Days | 2 | 30999 | """
Created By: <NAME>
Date: 06/07/2018
This is some code playing with the usage of a python
"Generator" which is really very cool. Another use case
I want to play with is properly ordering installation of
packages to ensure that if there are dependencies that they are installed in the proper order.
Created a recur... | 3.171875 | 3 |