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 |
|---|---|---|---|---|---|---|
samples/highscore.py | cmu-cs-academy/desktop-cmu-graphics | 3 | 12777451 | <gh_stars>1-10
from cmu_graphics import *
import os
# Set up or reset the game
# Here we clear labels from the screen, create our game objects,
# set their properties, and set our mode to playing
# (rather than start screen or game over)
def startGame():
app.group.clear()
app.mode = 'playing'
app.scoreLabe... | 3.375 | 3 |
benchmark/test-msgpack.py | azawawi/perl6-msgpack | 2 | 12777452 | <filename>benchmark/test-msgpack.py
#!/usr/bin/env python
import msgpack
def test():
SIZE = 10000000;
data = [1] * SIZE
packed = msgpack.packb(data)
unpacked = msgpack.unpackb(packed)
for i in range(1,10 + 1):
test();
| 2.359375 | 2 |
manyssh/about.py | linkdd/manyssh | 3 | 12777453 | <reponame>linkdd/manyssh
# -*- coding: utf-8 -*-
from gi.repository import Gtk
from manyssh import meta
class About(Gtk.AboutDialog):
"""
ManySSH about dialog.
"""
def __init__(self, *args, **kwargs):
kwargs['title'] = '{0} {1}'.format(meta.PROGRAM_NAME, meta.VERSION)
super(About, s... | 2.0625 | 2 |
tests/agent/test_caracal_backend.py | dioptra-io/iris | 6 | 12777454 | <filename>tests/agent/test_caracal_backend.py
from iris.agent.backend.caracal import probe
from tests.helpers import superuser
@superuser
def test_probe(agent_settings, tmp_path):
excluded_filepath = tmp_path / "excluded.csv"
excluded_filepath.write_text("8.8.4.4/32")
probes_filepath = tmp_path / "probes.... | 2.125 | 2 |
voicenet/utils/__init__.py | Robofied/Voicenet | 32 | 12777455 | # from .features_extraction import FeatureExtraction
# print("Invoking __init__.py for {}".format(__name__))
# __all__ = ["FeatureExtraction"] | 1.476563 | 1 |
applications/plugins/Flexible/python/Flexible/sml.py | sofa-framework/issofa | 0 | 12777456 | <reponame>sofa-framework/issofa
import SofaPython.sml
def getSolidSkinningIndicesAndWeights(solidModel, skinningArmatureBoneIndexById) :
""" Construct the indices and weights vectors for the skinning of solidModel
"""
indices = dict()
weights = dict()
for skinning in solidModel.skinnings:
c... | 2.484375 | 2 |
numtotext.py | teko424/num-to-eng | 0 | 12777457 | <reponame>teko424/num-to-eng
def two_digits(n):
nums = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
nums_2 = ["twen", "thir", "for", "fif", "six", "seven", "eigh", "nine"]
uniqteens = ["ten", "eleven", "twelve"]
teens = ["thir", "four", "fif", "six", "seven", "eig... | 3.484375 | 3 |
rllib/examples/serving/cartpole_server.py | 77loopin/ray | 39 | 12777458 | <gh_stars>10-100
#!/usr/bin/env python
"""
Example of running an RLlib policy server, allowing connections from
external environment running clients. The server listens on
(a simple CartPole env
in this case) against an RLlib policy server listening on one or more
HTTP-speaking ports. See `cartpole_client.py` in this s... | 2.984375 | 3 |
event/urls.py | vis7/connection | 1 | 12777459 | <gh_stars>1-10
from django.urls import path
from .views import (
EventCreateView, EventUpdateView, EventDeleteView, EventDetailView, EventListView
)
app_name = 'event'
urlpatterns = [
path('create/', EventCreateView.as_view(), name='event_create'),
path('<int:pk>/update/', EventUpdateView.as_view(), ... | 1.703125 | 2 |
cheminfo/openbabel/amon_f.py | binghuang2018/aqml | 19 | 12777460 | #!/usr/bin/env python
"""
Enumerate subgraphs & get amons
"""
import aqml.cheminfo.math as cim
import aqml.cheminfo.rw.pdb as crp
import aqml.cheminfo.graph as cg
import networkx as nx
from itertools import chain, product
import numpy as np
import os, re, copy, time
#from rdkit import Chem
import openbabel as ob
impo... | 2.21875 | 2 |
section11/section_11_175_randomgame.py | anadebarros/ZTM_Complete_Python_Developer | 0 | 12777461 | <reponame>anadebarros/ZTM_Complete_Python_Developer<gh_stars>0
import sys
from random import randint
random_number = randint(int(sys.argv[1]), int(sys.argv[2]))
while True:
try:
number = int(
input('Please choose a number that falls between those two you just chose: '))
if number >= i... | 4.0625 | 4 |
tsm/tsdb/helper.py | espang/projects | 0 | 12777462 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 28 20:01:48 2015
The redis script_load method is inspired by 'Redis in Action' from Dr. <NAME>
--see https://github.com/josiahcarlson/redis-in-action
@author: Eike
"""
import redis
def script_load(script):
sha = [None]
def call(conn, keys=[], args=[], force_ev... | 3.0625 | 3 |
feder/letters/migrations/0018_auto_20180227_1926.py | dzemeuksis/feder | 16 | 12777463 | # Generated by Django 1.11.10 on 2018-02-27 19:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("letters", "0017_auto_20180227_1908")]
operations = [
migrations.AlterField(
model_name="letter",
... | 1.585938 | 2 |
python_codes/twoSum.py | the-moonLight0/Hactober-fest-2021 | 11 | 12777464 | <gh_stars>10-100
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
map={}#to store element and its index
list=[]
for i in range(len(nums)):
diff=target-nums[i]... | 3.25 | 3 |
models/layers.py | KazukiChiyo/Vogel | 1 | 12777465 | # Author: <NAME>
# Date: Nov 13, 2018; revision: Mar 13, 2019
# License: MIT
import torch.nn as nn
import torch.nn.init as init
from torch.nn.init import kaiming_normal_, constant_
activation_functions = {
'relu': nn.ReLU,
'leaky_relu': nn.LeakyReLU,
'elu': nn.ELU,
'sigmoid': nn.Sigmoid,
'tanh': n... | 2.578125 | 3 |
ax/metrics/tests/test_chemistry.py | mpolson64/Ax-1 | 1 | 12777466 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from enum import Enum
from unittest import mock
import numpy as np
import pandas as pd
from ax.core.arm import Arm
f... | 2.390625 | 2 |
core/src/zeit/edit/tests/test_block.py | rickdg/vivi | 5 | 12777467 | from unittest import mock
from zeit.cms.testcontenttype.testcontenttype import ExampleContentType
import lxml.objectify
import persistent.interfaces
import zeit.cms.interfaces
import zeit.edit.testing
import zeit.edit.tests.fixture
import zope.component
class ElementUniqueIdTest(zeit.edit.testing.FunctionalTestCase):... | 2 | 2 |
LeetCode/257. Binary Tree Paths.py | QinganZhao/LXXtCode | 3 | 12777468 | <reponame>QinganZhao/LXXtCode<filename>LeetCode/257. Binary Tree Paths.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
### path outside the stack
class Solution:
def binaryTreePaths(self, root: Tree... | 3.859375 | 4 |
aquests/protocols/http/localstorage.py | hansroh/aquests | 8 | 12777469 | import base64
import random
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from . import util
g = None
def create (logger):
global g
g = LocalStorage (logger)
class LocalStorage:
def __init__ (self, logger):
self.logger = logger
self.cookie = {}
self.data = {} ... | 2.671875 | 3 |
HPCscripts/grid_response.py | vetlewi/AFRODITE | 0 | 12777470 | <filename>HPCscripts/grid_response.py<gh_stars>0
import numpy as np
from typing import Dict, List, Optional
from pathlib import Path
class MacroGenResponse:
def __init__(self, energy: Optional[float] = None,
nevent: Optional[int] = None):
self.energy = energy
self.nevent = nevent
... | 2.46875 | 2 |
pyjfuzz/core/pjf_encoder.py | zyLiu6707/PyJFuzz | 0 | 12777471 | <reponame>zyLiu6707/PyJFuzz<filename>pyjfuzz/core/pjf_encoder.py
"""
The MIT License (MIT)
Copyright (c) 2016 <NAME> <<EMAIL>>
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,... | 2.234375 | 2 |
code/functions.py | Grupo-de-Oceanografia-Costeira/TCC_Vini_Public | 0 | 12777472 | <filename>code/functions.py
import pandas as pd
import numpy as np
import collections
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import geopandas as gp
def load(cnv):
"""
This function opens our .cnv file and reads it.... | 3.25 | 3 |
Python3/0099-Recover-Binary-Search-Tree/soln.py | wyaadarsh/LeetCode-Solutions | 5 | 12777473 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def recoverTree(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify root in-place i... | 3.703125 | 4 |
helx/rl/memory.py | epignatelli/helx | 1 | 12777474 | <gh_stars>1-10
import abc
import logging
from collections import deque
from typing import Callable, NamedTuple
import dm_env
import jax
import jax.numpy as jnp
from dm_env import specs
from helx.jax import device_array
from helx.random import PRNGSequence
from helx.typing import Action, Batch, Discount, Key, Observati... | 2.03125 | 2 |
setup.py | FongAnthonyM/python-hdf5objects | 0 | 12777475 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
""" setup.py
The setup for this package.
"""
# Package Header #
from src.hdf5objects.__header__ import *
# Header #
__author__ = __author__
__credits__ = __credits__
__maintainer__ = __maintainer__
__email__ = __email__
# Imports #
# Standard Libraries #
import io
impo... | 1.789063 | 2 |
OOP/car.py | dimi-fn/Various-Data-Science-Scripts | 8 | 12777476 | class Car:
'''
* Creating a class called "Car"
* Properties/attributes: brand, colour, horses, country production, current speed
* "current_speed" is set to 0, unless other value is assigned
* Method definitions:
* def move_car() moves the car by 10
* def accelerate_car() accelerates the car by ... | 4.3125 | 4 |
helper/pointCloud.py | lidiaxp/plannie | 6 | 12777477 | import rospy
from sensor_msgs.msg import PointCloud2
from sensor_msgs import point_cloud2
from geometry_msgs.msg import PoseArray, Pose
from tf.transformations import euler_from_quaternion
import time
import math
import struct
import ctypes
from scipy import ndimage
import matplotlib.pyplot as plt
from nav_msgs.msg im... | 2.25 | 2 |
src/httpdaemon/request.py | jamessimmonds/PyHTTPDaemon | 0 | 12777478 | import re
class HttpRequest:
"""
Parser for HTTP requests
"""
def __init__(self, request):
"""
Accepts an HTTP request bytestring
"""
# Convert from bytes to string
self.request = request.decode("utf-8")
self.requestline = re.match("GET .* HTTP/1.1", s... | 3.40625 | 3 |
server/stylegan2_hypotheses_explorer/models/style_configuration_style_array.py | HealthML/StyleGAN2-Hypotheses-Explorer | 2 | 12777479 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import Dict, List # noqa: F401
from ..util import deserialize_model
from .base_model_ import Base_Model
class StyleConfigurationStyleArray(Base_Model):
"""NOTE: This class is auto generated by ... | 2.109375 | 2 |
rlgraph/agents/sac_agent.py | RLGraph/RLGraph | 290 | 12777480 | # Copyright 2018/2019 The RLgraph 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 appli... | 1.804688 | 2 |
euler-problems/euler-problem-3.py | sdenisen/test | 0 | 12777481 | <gh_stars>0
__author__ = 'sdenisenko'
target_number = 600851475143
def isNatural(item, naturals):
for nat_number in naturals:
if not item % nat_number:
break
else:
return True
return False
def getNaturals(n):
naturals = []
for i in range(2, n):
if isNatural(i,... | 3.21875 | 3 |
easy/sum of digits in base k/solution.py | ilya-sokolov/leetcode | 4 | 12777482 | <gh_stars>1-10
class Solution:
def sumBase(self, n: int, k: int) -> int:
result = 0
while n > 0:
result += n % k
n = n // k
return result
s = Solution()
print(s.sumBase(34, 6))
print(s.sumBase(10, 10))
print(s.sumBase(10, 9))
print(s.sumBase(7, 2))
print(s.sumBase(2... | 3.0625 | 3 |
dev-burst-analysis.py | bcodegard/xrd-analysis | 0 | 12777483 | <reponame>bcodegard/xrd-analysis
"""
separate a dataset into segments separated by points which
exceed a thredhold for a branch or its derivative, and then
perform analysis on the separated datasets.
typical case is to use the derivative of a timestamp variable,
in which case the threshold is a time separation between... | 2.75 | 3 |
pokedataset32_vae.py | EtreSerBe/PokeAE | 1 | 12777484 | <gh_stars>1-10
# -*- coding: utf-8 -*-
""" Variational Auto-Encoder Example.
Using a variational auto-encoder to generate digits images from noise.
MNIST handwritten digits are used as training examples.
References:
- Auto-Encoding Variational Bayes The International Conference on Learning
Representations (ICL... | 3.171875 | 3 |
refsql/__init__.py | akaariai/django-refsql | 7 | 12777485 | <filename>refsql/__init__.py
from .expressions import RefSQL # noqa
| 1.039063 | 1 |
nlp_202/hw4/model.py | daohuei/ucsc-nlp-unicorn | 0 | 12777486 | import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from constants import START_TAG, STOP_TAG, DEVICE
from helper import argmax, log_sum_exp, hamming_loss, convert_to_char_tensor
from data import tag_vocab, max_word_len, char_vocab, word_vocab
class BiLSTM_CRF(... | 2.46875 | 2 |
napari/_qt/qt_plugin_sorter.py | danielballan/napari | 0 | 12777487 | """Provides a QtPluginSorter that allows the user to change plugin call order.
"""
from typing import List, Optional, Union
from qtpy.QtCore import QEvent, Qt, Signal, Slot
from qtpy.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QFrame,
QGraphicsOpacityEffect,
QHBoxLayout,
QLabel,
Q... | 2.484375 | 2 |
tests/test_docs.py | hopcolony/python-aiohopcolony | 0 | 12777488 | <gh_stars>0
import pytest
from .config import *
import aiohopcolony
from aiohopcolony import docs
@pytest.fixture
async def project():
return await aiohopcolony.initialize(username=user_name, project=project_name,
token=token)
@pytest.fixture
def db():
return docs.cl... | 1.976563 | 2 |
jiant/scripts/download_data/constants.py | isspek/jiant | 0 | 12777489 | <gh_stars>0
# Directly download tasks when not available in HF Datasets, or HF Datasets version
# is not suitable
SQUAD_TASKS = {"squad_v1", "squad_v2"}
DIRECT_SUPERGLUE_TASKS_TO_DATA_URLS = {
"wsc": f"https://dl.fbaipublicfiles.com/glue/superglue/data/v2/WSC.zip",
"multirc": f"https://dl.fbaipublicfiles.com/... | 1.390625 | 1 |
easybill_rest/tests/test_logins.py | soerenbe/py-ebrest | 5 | 12777490 | import unittest
from unittest import mock
from easybill_rest import Client
from easybill_rest.resources.resource_logins import ResourceLogins
from easybill_rest.tests.test_case_abstract import EasybillRestTestCaseAbstract
class TestResourceLogins(unittest.TestCase, EasybillRestTestCaseAbstract):
def setUp(self)... | 2.59375 | 3 |
tests/test_model.py | rychallener/TauREx3_public | 0 | 12777491 | <reponame>rychallener/TauREx3_public<filename>tests/test_model.py
import unittest
import shutil
import tempfile
from os import path
from unittest.mock import patch, mock_open
from taurex.model.model import ForwardModel
from taurex.model.simplemodel import SimpleForwardModel
import numpy as np
import pickle
class For... | 2.34375 | 2 |
other/mean_std.py | huhuzwxy/keras_classfication | 2 | 12777492 | import os
from PIL import Image
import numpy as np
## 图像数据集的均值与方差的计算
root_path = '../train_data'
_filename = os.listdir(root_path)
filename = []
for _file in _filename:
if not _file.endswith('.txt'):
filename.append(_file)
#均值之和
R_channel_m = 0
G_channel_m = 0
B_channel_m = 0
#方差之和
R_channel_s = 0
G_ch... | 2.6875 | 3 |
pydefect/tests/cli/vasp/test_make_unitcell.py | KazMorita/pydefect | 1 | 12777493 | # -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from pydefect.cli.vasp.make_unitcell import make_unitcell_from_vasp
from pymatgen.io.vasp import Vasprun, Outcar
def test_unitcell(vasp_files):
"""
HEAD OF MICROSCOPIC STATIC DIELECTRIC TENSOR (INDEPENDENT PARTICLE... | 1.945313 | 2 |
chromapy/chromapy.py | KShammout632/ChromaPy | 0 | 12777494 | import argparse
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from skimage import color
from PIL import Image
import matplotlib.pyplot as plt
from cnn_model import Model
# from cnn_model2... | 2.515625 | 3 |
tests/test_validating.py | ealesid/starlette-jsonrpc | 29 | 12777495 | from . import client
# JSON
def test_payload_as_empty_dict():
payload = {}
response = client.post("/api/", json=payload)
assert response.json() == {
"jsonrpc": "2.0",
"id": "None",
"error": {"code": -32600, "message": "Invalid Request.", "data": {}},
}
def test_payload_as_e... | 2.625 | 3 |
basic_email_user/models.py | garyburgmann/django-basic-email-user | 1 | 12777496 | from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractUser
from django.core.validators import EmailValidator
from django.contrib.auth.validators import UnicodeUsernameValidator
class UserManager(BaseUserManager):
def validate_email(self, email):
""" Verify email arg... | 2.75 | 3 |
Triangle_Solver/main.py | RobertElias/PythonProjects | 0 | 12777497 | import math
# Triangle Solver
print("Welcome to the Right Triangle Solver App.")
side_a = float(input("\nWhat is the first leg of the triangle: "))
side_b = float(input("What is the second leg of the triangle: "))
# Calculations
side_c = math.sqrt(side_a**2 + side_b**2)
side_c = round(side_c, 3)
area = 0.5 * side... | 4.21875 | 4 |
python/chartParsing.py | pramitmallick/spinn | 103 | 12777498 | """
Artifical test for chart parsing
"""
from random import shuffle
import numpy as np
import string
def generate_string(length):
letters = list(string.ascii_lowercase) + list(string.ascii_uppercase)
shuffle(letters)
output = []
for i in range(length):
output.append(letters[i])
return outp... | 2.8125 | 3 |
Day 28/pomodoro-start/main.py | Jean-Bi/100DaysOfCodePython | 0 | 12777499 | <gh_stars>0
from tkinter import *
import math
# ---------------------------- CONSTANTS ------------------------------- #
PINK = "#e2979c"
RED = "#e7305b"
GREEN = "#9bdeac"
YELLOW = "#f7f5dd"
FONT_NAME = "Courier"
WORK_MIN = 1
SHORT_BREAK_MIN = 5
LONG_BREAK_MIN = 20
# Number of repetitions
reps = 0
timer = None
# -... | 3.046875 | 3 |
source/16-Valor_da_conta.py | FelixLuciano/DesSoft-2020.2 | 0 | 12777500 | <reponame>FelixLuciano/DesSoft-2020.2
# Valor da conta
# Escreva um programa que pergunta para o usuário o valor da conta do restaurante e imprime: "Valor da conta com 10%: R$ X.YZ", onde X.YZ é um número com exatamente duas casas decimais.
valor = float(input('Qual o valor da conta?'))
gorjeta = valor * 10/100 # 10% ... | 3.671875 | 4 |
to-jpg/to-jpg.py | niebniebnieb/echotango | 0 | 12777501 | <reponame>niebniebnieb/echotango
import os
from ftplib import FTP
from PIL import Image
from psd_tools import PSDImage
mode = 'ADD' # ADD | TEST | BULK
skipftp = False
QUALITY = 50
IM_SIZE = 800
savos = "/Users/thomasnieborowski/Desktop/SAVOS/IMG/"
remote_img = 'public_html/sebartsvirtual/wp-content/uploads/img'
i... | 2.65625 | 3 |
adaptdl/adaptdl/torch/__init__.py | pandyakaa/modified-adaptdl-sched | 0 | 12777502 | # Copyright 2020 Petuum, Inc. 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 applicable law or... | 1.75 | 2 |
loss.py | Dyfine/SphericalEmbedding | 41 | 12777503 | import myutils
from torch.nn import Module, Parameter
import torch.nn.functional as F
import torch
import torch.nn as nn
import numpy as np
class TripletLoss(Module):
def __init__(self, instance, margin=1.0):
super(TripletLoss, self).__init__()
self.margin = margin
self.instance = instance
... | 2.46875 | 2 |
algo-c-to-_/src/tarai.py | nobi56/aRepo | 0 | 12777504 | <reponame>nobi56/aRepo
#
# from src/tarai.c
#
# int tarai(int, int, int) to tarai
# tarai to tak(*)
#
# *) https://en.wikipedia.org/wiki/Tak_(function)
#
def tarai(x, y, z):
if x <= y:
return y
return tarai(tarai(x-1,y,z), tarai(y-1,z,x), tarai(z-1,x,y))
def tak(x, y, z):
if x <= y:
ret... | 2.65625 | 3 |
python/src/zero/activations.py | d-ikeda-sakurasoft/deep-learning | 0 | 12777505 | <filename>python/src/zero/activations.py
from layers import *
from keras.datasets import mnist
from keras.utils import to_categorical
x = np.random.randn(1000, 100)
node_num = 100
hidden_layer_size = 5
activations = {}
for i in range(hidden_layer_size):
if i != 0:
x = activations[i - 1]
#w = np.... | 3.0625 | 3 |
students/k3342/practical_works/Kataeva_Veronika/simple_django_web_project/django_project_kataeva/project_first_app/views.py | KataevaVeronika/ITMO_ICT_WebProgramming_2020 | 0 | 12777506 | <filename>students/k3342/practical_works/Kataeva_Veronika/simple_django_web_project/django_project_kataeva/project_first_app/views.py
import datetime
from django.http import Http404
from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView
from ... | 2.3125 | 2 |
src/tap_apple_search_ads/api/campaign.py | mighty-digital/tap-apple-search-ads | 1 | 12777507 | <reponame>mighty-digital/tap-apple-search-ads
"""Get All Campaigns stream"""
import json
from typing import Any, Dict, List, Optional
import requests
import singer
from tap_apple_search_ads import api
from tap_apple_search_ads.api.auth import RequestHeadersValue
logger = singer.get_logger()
DEFAULT_URL = "https://... | 2.8125 | 3 |
rough_trade_calendar/graphql.py | craiga/rough-trade-calendar | 1 | 12777508 | """
GraphQL + Relay interface to Rough Trade Calendar data.
"""
import django_filters
import graphene
import graphene.relay
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from rough_trade_calendar import models
class CountConnection(graphene.Connection):
... | 2.265625 | 2 |
catkin_ws/src/navigation/src/sr_turns_node.py | DiegoOrtegoP/Software | 12 | 12777509 | #!/usr/bin/env python
import rospy
import numpy
from duckietown_msgs.msg import FSMState, AprilTags, BoolStamped
from std_msgs.msg import String, Int16 #Imports msg
class SRTurnsNode(object):
def __init__(self):
# Save the name of the node
self.node_name = rospy.get_name()
self.turn_type = ... | 2.515625 | 3 |
src/byro/office/views/accounts.py | mhannig/byro | 0 | 12777510 | <reponame>mhannig/byro
from django import forms
from django.contrib import messages
from django.db import models
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.views.generic import DetailView... | 2.25 | 2 |
usage.py | mjclawar/sd-range-slider | 2 | 12777511 | <reponame>mjclawar/sd-range-slider
import sd_range_slider
import dash
import dash_html_components as html
app = dash.Dash('')
app.scripts.config.serve_locally = True
app.layout = html.Div([
# Test normal use case
html.Div(
sd_range_slider.SDRangeSlider(
id='input',
value=[1, ... | 2.328125 | 2 |
cameo/mod/yuwei/utility/mailHelper.py | muchu1983/104_cameo | 0 | 12777512 | <reponame>muchu1983/104_cameo
#coding: utf-8
import smtplib
from email.mime.text import MIMEText
class mailHelper:
DEFAULT_SMTP = "smtp.gmail.com:587"
DEFAULT_ACCOUNT = "<EMAIL>"
DEFAULT_PASSWORD = "<PASSWORD>"
@staticmethod
def send(strSubject, strFrom, strTo, strMsg, lstStrTarget, strSmtp = None, strAccount =... | 2.859375 | 3 |
moldynplot/relaxation.py | KarlTDebiec/myplotspec_sim | 8 | 12777513 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# moldynplot.relaxation.py
#
# Copyright (C) 2012-2017 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
Processes NMR relaxation and related data
"""
###########... | 2.859375 | 3 |
src/comms/imc2lib/imc2_trackers.py | abbacode/avaloria | 0 | 12777514 | """
Certain periodic packets are sent by connected MUDs (is-alive, user-cache,
etc). The IMC2 protocol assumes that each connected MUD will capture these and
populate/maintain their own lists of other servers connected. This module
contains stuff like this.
"""
from time import time
class IMC2Mud(object):
... | 3.3125 | 3 |
Y2018/day2/python/day2.py | Khranovskiy/advent-of-code | 0 | 12777515 | <filename>Y2018/day2/python/day2.py
import itertools
print(*[''.join(a for a,b in zip(this,that) if a == b) for this,that in combinations(open('inp', 'r').readlines(),2) if len([a for a,b in zip(this,that) if a != b]) == 1])
| 3.25 | 3 |
1.Study/2. with computer/4.Programming/2.Python/8. Python_intermediate/p_chapter02_01.py | jskim0406/Study | 0 | 12777516 | # -*- coding: utf-8 -*-#
# chapter 02-01
# 객체지향 프로그래밍(OOP) (<-> 절차지향) 장점 : 코드 재사용, 코드 중복 방지, 유지 보수 쉬움, 대형 프로젝트 관리 용이
# 규모가 큰 프로젝트 수행 시, 과거에는 함수 중심으로 코딩됨(함수에서 함수 호출하며 복잡해짐) -> 데이터가 방대해질 수록 개선 어려움 (구조 복잡)
# 클래스 중심 -> 객체로 관리
# 일반적인 코딩
# 차량 1
car_company1 = 'Ferrari'
car_detail1 = [
{'color' : 'white'},
{'horse_power' : 4... | 2.515625 | 3 |
VoigtFit/VoigtFit_example.py | InspectorDidi/VoigtFit | 2 | 12777517 | import numpy as np
import matplotlib.pyplot as plt
import VoigtFit
import pickle
### Fit DLA towards quasar Q1313+1441
### Observed in X-shooter P089.A-0068
z_DLA = 1.7941
logNHI = 21.3, 0.1 # value, uncertainty
# If log(NHI) is not known use:
#logNHI = None
#### Load UVB and VIS data:
UVB_fname = 'data/test_UVB_1... | 2.1875 | 2 |
heat/common/utils.py | devcamcar/heat | 1 | 12777518 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | 2.03125 | 2 |
polecat/data/examples/helloworld/helloworld/project.py | furious-luke/polecat | 4 | 12777519 | <reponame>furious-luke/polecat
from polecat.project import Project
class HelloWorldProject(Project):
bundle = 'bundle.js'
| 1.289063 | 1 |
books/python-3-oop-packt/Chapter10/10_10_decorator_syntax.py | phiratio/lpthw | 73 | 12777520 | @log_calls
def test1(a,b,c):
print("\ttest1 called")
| 1.210938 | 1 |
tests/utils/test_application.py | SpiNNakerManchester/nengo_spinnaker | 13 | 12777521 | import mock
import pytest
from nengo_spinnaker.utils import application
@pytest.mark.parametrize("app_name", ["Arthur", "Robin"])
def test_get_application(app_name):
with mock.patch.object(application, "pkg_resources") as pkg_resources:
pkg_resources.resource_filename.return_value = "Camelot"
# ... | 2.40625 | 2 |
config.py | namaggarwal/transaction-reminder | 0 | 12777522 | <reponame>namaggarwal/transaction-reminder
FLASK_SECRET_KEY = 'namana'
DATABASE_URI = 'sqlite:///test.db'
DEBUG = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
GOOGLE_CLIENT_ID = ''
GOOGLE_CLIENT_SECRET = ''
WUNDERLIST_CLIENT_ID = ''
WUNDERLIST_CLIENT_SECRET = ''
WUNDERLIST_NAME = 'Splitwise'
APPLICATION_ROOT = None
... | 1.234375 | 1 |
envs/mujoco/humanoid_env.py | artberryx/LSD | 7 | 12777523 | <filename>envs/mujoco/humanoid_env.py
# 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 ap... | 2.046875 | 2 |
data_cleaning/bad_parallel_fixes.py | sharad461/nepali-translator | 29 | 12777524 | from functions import _read, write_lines
import re
a, b = _read("1.en"), _read("1.ne")
# For English
# Joins an incomplete line to the line above
i = 1
while i < len(a):
if re.match("^([a-z0-9])+[^0-9i\.\)]", a[i]):
a[i-1] = a[i-1].strip() + ' ' + a[i].strip()
del(a[i])
else:
i += 1
# Joins ... | 2.890625 | 3 |
python/experiments/SVGD/goodwin12.py | DrawZeroPoint/VIPS | 12 | 12777525 | from time import time
import os
import numpy as np
from scipy.stats import multivariate_normal
from experiments.lnpdfs.create_target_lnpfs import build_Goodwin_grad
from sampler.SVGD.python.svgd import SVGD as SVGD
unknown_params = [1, 2] + np.arange(4, 12).tolist()
num_dimensions = len(unknown_params)
seed=1
target_l... | 2.0625 | 2 |
datasets/metadataset.py | luukschagen/Thesis_code | 0 | 12777526 | <gh_stars>0
import torch.utils.data as data
from math import pi
import torch
class MetaDataset(data.Dataset):
def __init__(self, task_num, k_shot, k_query, n_way=None):
super(MetaDataset, self).__init__()
self.task_num = task_num
self.k_shot = k_shot
self.k_query = k_query
... | 1.992188 | 2 |
sdk/python/approzium/_postgres/scram.py | UpGado/approzium | 59 | 12777527 | <reponame>UpGado/approzium<filename>sdk/python/approzium/_postgres/scram.py
import base64
import re
# try to import the secrets library from Python 3.6+ for the
# cryptographic token generator for generating nonces as part of SCRAM
# Otherwise fall back on os.urandom
try:
from secrets import token_bytes as generat... | 2.578125 | 3 |
pipeline/data/Zhang/_source/helper.py | Voineagulab/NeuroCirc | 0 | 12777528 | <reponame>Voineagulab/NeuroCirc
import csv, re, os, math
if __name__ == '__main__':
write_file1 = csv.writer(open("zhang.csv", 'w', newline=''), delimiter=',', quotechar='\"', quoting=csv.QUOTE_NONNUMERIC)
write_file1.writerow(["id", "symbol", "ensembl"])
write_file2 = csv.writer(open("zhang_cpm.csv", 'w'... | 2.40625 | 2 |
Ago-Dic-2017/Enrique Castillo/Práctica1/Agencia.py | Andremm303/DAS_Sistemas | 0 | 12777529 | <gh_stars>0
class Agencia:
def __init__(self, nomAgencia, direccion):
self.nomAgencia = nomAgencia
self.direccion = direccion
def getNomAgencia(self):
return self.nomAgencia
def setNomAgencia(self, nombrAgencia):
self.nombrAgencia = nombrAgencia
def getDireccion(self):
... | 2.875 | 3 |
aerisweather/responses/AerisLocation.py | jkoelndorfer/aerisweather-python-sdk | 5 | 12777530 | <filename>aerisweather/responses/AerisLocation.py
class AerisLocation:
""" Defines an object for the Aeris API loc data returned in an Aeris API responses. """
def __init__(self, json_data=None):
""" Constructor """
self.data = json_data
@property
def long(self)->float:
""" R... | 2.96875 | 3 |
src/Expired_Filter/ChromeDriver.py | brianfong96/Experiment_Web_Scraping | 1 | 12777531 | <reponame>brianfong96/Experiment_Web_Scraping
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
def CreateDriver(extra_arguments = ["--start-maximized"]):
arguments = ['--ignore-certificate-errors', '--incognito', '--headless']
arguments += extra_arguments
#Use seleniu... | 3.171875 | 3 |
python/frequency_calc.py | amojarro/carrierseq | 5 | 12777532 | <reponame>amojarro/carrierseq<filename>python/frequency_calc.py
import sys
channel_out = open(sys.argv[1], 'r')
channel_list = channel_out.readlines()
xcrit_value_txt = open(sys.argv[2], 'r')
xcrit_value = xcrit_value_txt.read()
xcrit = float(xcrit_value)
# channel_list: A list containing strings of each channel wit... | 3.515625 | 4 |
test_test1.py | scottohalloran/python-sample-vscode-flask-tutorial | 0 | 12777533 | def func(a):
return a - 1
def test_testmethod():
assert func(6) -- 5
| 2.390625 | 2 |
sim_correlation.py | Renata1995/Topic-Distance-and-Coherence | 5 | 12777534 | from scipy import stats
import sys
import utils.name_convention as name
from similarity.SimTopicLists import SimTopicLists
if len(sys.argv) <= 1:
src = "pp_reuters"
else:
src = sys.argv[1]
stl = SimTopicLists()
distance_list, rank_list = [], []
jtotal, ktotal, cos_total, kl_total, bha_total = [], [], [], [],... | 2.15625 | 2 |
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_policy_repository_oper.py | tkamata-test/ydk-py | 0 | 12777535 | <filename>cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_policy_repository_oper.py
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
fro... | 1.453125 | 1 |
accelbyte_py_sdk/api/platform/models/currency_update.py | encyphered/accelbyte-python-sdk | 0 | 12777536 | <filename>accelbyte_py_sdk/api/platform/models/currency_update.py
# Auto-generated at 2021-09-27T17:12:36.265221+08:00
# from: Justice Platform Service (3.24.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact you... | 1.617188 | 2 |
conformer/configs/model.py | dudgns0908/KoASR | 0 | 12777537 | <reponame>dudgns0908/KoASR<filename>conformer/configs/model.py<gh_stars>0
from dataclasses import dataclass
@dataclass
class ConformerLargeConfig:
encoder_dim: int = 512
num_encoder_layers: int = 17
num_attention_heads: int = 8
conv_kernel_size: int = 31
dropout_p: float = 0.1
| 1.78125 | 2 |
fortytwocli/main.py | dhaiibfiukkiu/42cli | 4 | 12777538 | #!/usr/bin/env python
# -*- coding: utf=8 -*-
import click
import fortytwocli.init as init_
import fortytwocli.status as status_
import fortytwocli.project as project
import fortytwocli.util as util
import fortytwocli.ipCalc as ip
@click.group()
def fourtyTwo():
pass
@fourtyTwo.command(help="initializes setti... | 2.546875 | 3 |
tictactoe/common.py | ephjos/ai | 0 | 12777539 | <reponame>ephjos/ai
#!/usr/bin/env python
from enum import Enum, auto
class Tile:
Empty = '-'
X = 'X'
O = 'O'
class Result(Enum):
Tie = auto()
X_Win = auto()
O_Win = auto()
def show_board(board):
for i in range(3):
i *= 3
print(f'{board[i]} {board[i+... | 3.75 | 4 |
grid-navigation-paths-count/tests/test_string_permutations.py | dompuiu/puzzles | 1 | 12777540 | from unittest import TestCase
from grid_path.string_permutations import Permutations
class TestPermutations(TestCase):
def test_get_permutations_with_empty_string(self):
self.assertEqual(Permutations('').get_permutations(), set(['']))
def test_get_permutations_with_one_letter_word(self):
self... | 3.5 | 4 |
windbell/core/windfile.py | HawkinsZhao/windbell | 4 | 12777541 | <gh_stars>1-10
import os
import json
import yaml
import pystache
from windbell.core.exceptions import *
class WindfileConfig():
def __init__(self, content):
super(WindfileConfig)
self.value = yaml.load(content)
def check_schema(self):
return True
def calc_env_deps(self):
... | 2.140625 | 2 |
src/second_mininum_node_671.py | xiezhq-hermann/LeetCode-in-Python | 3 | 12777542 | <reponame>xiezhq-hermann/LeetCode-in-Python
#
# Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes.
#
# Given such a binar... | 3.6875 | 4 |
deinkscape.py | Emoji-COLRv0/emojitwo | 313 | 12777543 | #!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# By HarJIT in 2020. MIT/Expat licence.
import os, xml.dom.minidom, shutil, re, glob
svgpresattrs = ("alignment-baseline", "baseline-shift", "clip", "clip-path", "clip-rule", "color",
"color-interpolation", "color-interpolation-filters", "color-profile", "... | 1.929688 | 2 |
snapboard/forms.py | SarathkumarJ/snapboard | 0 | 12777544 | from sets import Set
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.forms import widgets, ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from snapboard.models import C... | 2.234375 | 2 |
SeamErasure/lib/weight_data.py | fdp0525/seam-erasure | 1 | 12777545 | #!/usr/bin/env python
"""
Reads and writes weight data files.
!!! Weight data files must be in Image row ordering (0, 0) in the top-left. !!!
"""
from __future__ import print_function, division
from numpy import *
import gzip
def read_tex_from_file(ioFile):
'''
Reads a .data file into memory.
Inputs:
... | 3.125 | 3 |
customer/migrations/0014_pspuser_pending_deposit.py | neonexchange/psp_template | 5 | 12777546 | # Generated by Django 2.0 on 2018-01-20 23:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('customer', '0013_auto_20180120_2322'),
]
operations = [
migrations.AddField(
model_name='pspuser'... | 1.578125 | 2 |
utils/random.py | Saizuo/EpicBot | 3 | 12777547 | """
Copyright 2021 Nirlep_5252_
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
d... | 1.945313 | 2 |
lib/rucio/db/sqla/migrate_repo/versions/4783c1f49cb4_create_distance_table.py | balrampariyarath/rucio | 1 | 12777548 | <gh_stars>1-10
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
# - <NAME>... | 1.90625 | 2 |
bpf-echo.py | cwyzb/bpf-echo | 2 | 12777549 | <reponame>cwyzb/bpf-echo
#!/usr/bin/env python3
# Copyright 2019 Path Network, Inc. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from bcc import BPF
from pyroute2 import IPRoute
import socket
import ipaddress
import argparse
import time
imp... | 2.359375 | 2 |
tests/test_learning.py | priyankshah7/hypers | 10 | 12777550 | import numpy as np
import hypers as hp
class TestLearning:
def setup(self):
self.n3 = np.random.rand(10, 10, 30)
self.n4 = np.random.rand(10, 10, 10, 30)
self.n5 = np.random.rand(10, 10, 10, 2, 30)
self.h3 = hp.hparray(self.n3)
self.h4 = hp.hparray(self.n4)
self.h5... | 2.671875 | 3 |