id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
168740 | from JumpScale import j
def cb():
from .CodeTools import CodeTools
return CodeTools()
j._register('codetools', cb)
| StarcoderdataPython |
27307 | "Common functions that may be used everywhere"
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import sys
from distutils.util import strtobool
try:
input = raw_input
except NameError:
pass
def yes_no_query(question):
"""Ask the user... | StarcoderdataPython |
99458 | import json
from django.test import TestCase, LiveServerTestCase
import django.test.client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
import oauthlib.oauth1.rfc5849
from restless_oauth.models import *
import requests
from oau... | StarcoderdataPython |
1769667 | # -*- coding: utf-8 -*-
#
# This file is part of SplashSync Project.
#
# Copyright (C) 2015-2020 Splash Sync <www.splashsync.com>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPO... | StarcoderdataPython |
3243838 | <filename>client/tc/azext_tc/_completers.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ------------------------... | StarcoderdataPython |
3204749 | import asyncio
import importlib
import json
import logging
import os
import pprint
import re
import sys
import time
import docker
import netaddr
import netifaces
import sh
import tornado.httpclient
from wotemu.enums import Labels
_CGROUP_PATH = "/proc/self/cgroup"
_STACK_NAMESPACE = "com.docker.stack.namespace"
_CID... | StarcoderdataPython |
31224 | <reponame>sundayliu/flask-tutorial
# -*- coding:utf-8 -*-
from flask import Blueprint
main = Blueprint('main',__name__)
from . import views,errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission) | StarcoderdataPython |
9812 | <reponame>yaosir0317/my_first
from enum import Enum
import requests
class MusicAPP(Enum):
qq = "qq"
wy = "netease"
PRE_URL = "http://www.musictool.top/"
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"}
def... | StarcoderdataPython |
3369738 | from src.contexts.kms.clients.domain.entities.ClientId import ClientId
from src.contexts.kms.cryptokeys.domain.entities.CryptoKey import CryptoKey
from src.contexts.kms.cryptokeys.domain.entities.CryptoKeyId import CryptoKeyId
from src.contexts.kms.cryptokeys.domain.entities.CryptoKeyIsMaster import CryptoKeyIsMaster
f... | StarcoderdataPython |
4805945 | #coding=utf-8
import requests
s=requests
###init
# data = {"labelData":"{'性别': [], '年龄': [], '病理诊断': ['腺鳞癌'], '病人批次': []}"}
data = {"labelData":"{'性别': ['男'], '年龄': ['40','50'], '病理诊断': [], '病人批次': ['2018-01-01','2018-01-10']}"}
# data = {"labelData": "{'性别': ['男'], '年龄': ['65'], '病理诊断': [], '病人批次': ['2018-01-0... | StarcoderdataPython |
1659856 | from typing import List, Dict
from zhixuewang.teacher.urls import Url
from zhixuewang.teacher.models import TeaPerson
class Teacher(TeaPerson):
"""老师账号"""
def __init__(self, session):
super().__init__()
self._session = session
self.role = "teacher"
def set_base_info(self):
... | StarcoderdataPython |
91066 | import numpy as np
import scipy as sp
from scipy.linalg import cho_factor, cho_solve
import time
start_time = time.time()
#float_formatter = '{:.4f}'.format
#np.set_printoptions(formatter={'float_kind':float_formatter})
N = 1000
print('N: ', N)
#Filling N*N array to initialize it
A1 = np.zeros((N,N), float)
A2 = np.... | StarcoderdataPython |
1628005 | <filename>net.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('./lib')
import theano
theano.config.on_unused_input = 'warn'
import theano.tensor as T
import numpy as np
from layers import Weight, DataLayer, ConvPoolLayer, DropoutLayer, FCLayer, MaxoutLayer
def cosine(x, y, epsilon=np.array(1e-6).astype(np.fl... | StarcoderdataPython |
1609583 | <gh_stars>1-10
import os
import pathlib
import shutil
import tempfile
import pytest
import torch
import torchtraining as tt
from torch.utils.tensorboard import SummaryWriter
@pytest.mark.parametrize(
"klass,inputs",
[
(tt.callbacks.tensorboard.Scalar, 15),
(tt.callbacks.tensorboard.Scalar, to... | StarcoderdataPython |
3262823 | # 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.
import torch
import theseus as th
from theseus.utils.examples.bundle_adjustment.util import random_small_quaternion
def test_residual():
... | StarcoderdataPython |
3367579 | import pytest
from unittest import TestCase
from pyflamegpu import *
import random as rand
AGENT_COUNT = 2049
out_mandatory2D = """
FLAMEGPU_AGENT_FUNCTION(out_mandatory2D, flamegpu::MessageNone, flamegpu::MessageSpatial2D) {
FLAMEGPU->message_out.setVariable<int>("id", FLAMEGPU->getVariable<int>("id"));
FLAM... | StarcoderdataPython |
19336 | import gpsd
import json
import logging
import socket
import httpx
import paho.mqtt.client as mqtt
class MQTTReporter:
def __init__(self, name, mqtt_server=None, gps_server=None, compass=False):
self.name = name
self.mqtt_server = mqtt_server
self.compass = compass
self.gps_server... | StarcoderdataPython |
160743 | #!/usr/bin/env python3
import os
import json
import torch
from misc_scripts import run_cl_exp, run_rep_exp
from utils import get_mini_imagenet, get_omniglot
from core_functions.vision import evaluate
from core_functions.vision_models import OmniglotCNN, MiniImagenetCNN, ConvBase
from core_functions.maml import MAML
... | StarcoderdataPython |
3309293 | from __future__ import print_function, absolute_import
import os
import subprocess
import sys
import threading
import warnings
import numpy as np
from numba import jit, autojit, SmartArray, cuda, config
from numba.errors import (NumbaDeprecationWarning,
NumbaPendingDeprecationWarning, NumbaWar... | StarcoderdataPython |
84965 | <reponame>piyushrpt/isce3<filename>python/packages/isce3/core/Ellipsoid.py
#-*- coding: utf-8 -*-
# Import the extension
from .. import isceextension
class Ellipsoid(isceextension.pyEllipsoid):
"""
Wrapper for pyEllipsoid.
"""
pass
| StarcoderdataPython |
1677597 | """
Ray factory
classes that provide vertex and triangle information for rays on spheres
Example:
rays = Rays_Tetra(n_level = 4)
print(rays.vertices)
print(rays.faces)
"""
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from scipy.spatial import Con... | StarcoderdataPython |
1680407 | <filename>mfr/extensions/jasp/exceptions.py
from mfr.core.exceptions import RendererError
class JaspRendererError(RendererError):
def __init__(self, message, *args, **kwargs):
super().__init__(message, *args, renderer_class='jasp', **kwargs)
class JaspVersionError(JaspRendererError):
"""The jasp re... | StarcoderdataPython |
1633708 | <filename>tests/tiebreaks/test_buchholz_minus_2.py
import unittest
from swiss_tournament.data.player import Player, BYE
from swiss_tournament.data.result import Result
from swiss_tournament.data.round_pairing import RoundPairing
from swiss_tournament.data.tournament import Tournament
from swiss_tournament.step.tie_bre... | StarcoderdataPython |
3260039 | <filename>python/Exercicios/ex008.py
# CONVERSOR DE METRO PARA OUTROS TIPOS DE MEDIDAS
mt = float(input('Digite um valor (metro):'))
km = mt / 1000
hm = mt / 100
dam = mt / 10
dm = mt * 10
cm = mt * 100
mm = mt * 1000
print(f'\n {mt}M equivale a {km}km.\n {mt}M equivale a {hm}hm.\n {mt}M equivale a {dam}dam.\n {mt}M e... | StarcoderdataPython |
3301417 | from z3 import Optimize, Real, If
x = Real('x')
y = Real('y')
z = Real('z')
def z3abs(obj):
return If(x > 0, x, -x)
optimizer = Optimize()
# optimizer.add(x>0.0)
# optimizer.add(y>0.0)
optimizer.add(x*x+y*y==1.0)
optimizer.add_soft(z == x+y)
optimizer.maximize(z)
result = optimizer.check()
print(optimizer.mode... | StarcoderdataPython |
34600 | # WRITE YOUR SOLUTION HERE:
| StarcoderdataPython |
3333422 | from django import forms
class ContactForm(forms.Form):
amount = forms.IntegerField(label='Количество экземпляров') | StarcoderdataPython |
3245588 | <filename>home/forms.py
from django import forms
from .models import product
class productform(forms.ModelForm):
class Meta:
model = product
fields = [
'id',
'name',
'instagram',
'snapchat',
'others',
]
| StarcoderdataPython |
1682143 | # from .vpype import cli
import vpype
vpype.cli()
| StarcoderdataPython |
57597 | from typing import Any
from dataclasses import dataclass
@dataclass
class ScenarioResult:
scenario: Any = None
steps: Any = None
id: str = None
message: str = None
elapsed: float = 0.0
exception: str = None
threadId: int = None
pid: int = None
startTime: Any = None
endTime: Any ... | StarcoderdataPython |
4818685 | <filename>seamges/patologias/migrations/0003_auto_20191124_1657.py
# Generated by Django 2.2.7 on 2019-11-24 19:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('patologias', '0002_auto_20191124_1630'),
]
operations = [
migrations.AlterModelOp... | StarcoderdataPython |
4807240 | import math
import collections
class Cell(object):
def __repr__(self):
return 'C{val}'.format(val=self.val)
def __str__(self):
return self.__repr__()
def __init__(self, board, val, x, y):
self.val = val
self.change = False
self.x = x
self.y = y
sel... | StarcoderdataPython |
99997 | <gh_stars>0
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
app_name = "videodownloader"
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^downloadfile/$', views.downloadfile, name='downloadfile'),
]
| StarcoderdataPython |
1687419 | <reponame>zpiman/golemScripts
from subprocess import call
import urllib
import xml.etree.ElementTree as ET
import time, math
## serial is not no buon
#import serialDecoder.py as sd
TELNET = "telnet 192.168.2.241 10001"
device = '/dev/cu.usbserial'
time_delay = 0.1
time_step = 0.001
class DataGetter():
"""Abstract... | StarcoderdataPython |
1050 | from __future__ import division
from mmtbx.tls import tools
import math
import time
pdb_str_1 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C
"""... | StarcoderdataPython |
1695068 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
#... | StarcoderdataPython |
189183 | <filename>servicios/urls.py<gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.servicios, name="servicios"),
path ('constancia/', views.constancia, name="constancia"),
path('kardex/', views.kardex, name="kardex"),
path('seguro/', views.seguro, name="seguro"),
] | StarcoderdataPython |
86158 | <filename>mindware/optimizers/base_optimizer.py
import abc
import os
import time
import numpy as np
import pickle as pkl
from mindware.utils.constant import MAX_INT
from mindware.utils.logging_utils import get_logger
from mindware.components.evaluators.base_evaluator import _BaseEvaluator
from mindware.components.utils... | StarcoderdataPython |
153947 | <reponame>object-oriented-human/competitive
n = int(input())
l = list(map(int, input().split()))
print(all([x > 0 for x in l]) and any([str(x)[::-1] == str(x) for x in l])) | StarcoderdataPython |
3315392 | import torch
from torch import Tensor
from torch.nn import Module
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from typing import Optional, Sequence, List, Dict, SupportsFloat
from utils import make_batch_one_hot
class CumulativeStatistic:
def __init__(self):
sel... | StarcoderdataPython |
3204196 | <reponame>2degrees/djeneralize<gh_stars>1-10
from django.db import models
from djeneralize.fields import SpecializedForeignKey
from djeneralize.models import BaseGeneralizationModel
class Shop(models.Model):
name = models.CharField(max_length=30)
producer = SpecializedForeignKey('FruitProducer', related_nam... | StarcoderdataPython |
156816 | <filename>tau/core/migrations/0002_reset_all_account_webhooks.py
# Generated by Django 3.1.7 on 2021-11-06 12:18
from django.db import migrations
from constance import config
def toggle_reset_webhooks(apps, schema_editor):
config.RESET_ALL_WEBHOOKS = True
class Migration(migrations.Migration):
dependencies ... | StarcoderdataPython |
1703292 | """add new section table
Revision ID: c5cf60c29302
Revises: <KEY>
Create Date: 2016-06-21 13:26:54.041246
"""
# revision identifiers, used by Alembic.
revision = 'c5cf60c29302'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.creat... | StarcoderdataPython |
8423 | <filename>pctest/test_publish.py<gh_stars>0
#!/usr/bin/python3
# pip3 install websockets
import asyncio
import websockets
import json
import datetime
import sys
class test_publish:
idnum = 1
def __init__( self, sym, price, spread ):
self.symbol = sym
self.pidnum = test_publish.idnum
test_publish.idnu... | StarcoderdataPython |
1735811 | #
# script.py
#
# This file is modified from python-mitcoinlib.
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
"""Scripts
Functionality to build scripts, as well as SignatureHash().
"""
from __future__ import absolute_i... | StarcoderdataPython |
3372880 | <reponame>christus02/citrix-adc-metrics-exporter-serverless<gh_stars>1-10
import json
import copy
IN_JSON = "metrics.json"
OUT_JSON = "out.json"
#Read the input metrics json
with open(IN_JSON) as f:
metrics = json.load(f)
f.close()
UNIT_CONVERSION = [
{"key": "_mbits_rate", "value": "Megabits/Second"},
{"... | StarcoderdataPython |
3329144 | <filename>Lagrange_poly1.py
#! /usr/bin/env python
"""
File: Lagrange_poly1.py
Copyright (c) 2016 <NAME>
License: MIT
Course: PHYS227
Assignment: 5.23
Date: Feb 20, 2016
Email: <EMAIL>
Name: <NAME>
Description: Implements Lagrange's interpolation formula
"""
import numpy as np
def p_L(x, xp, yp):
"""
Return... | StarcoderdataPython |
3359742 | <reponame>davidcim/wirinj
from unittest import TestCase
from wirinj import Autowiring, Definitions
from wirinj.core import INJECTED
from wirinj.injector import Injector
class Reality(object):
pass
class Thing:
reality: Reality = INJECTED
cfg = INJECTED
not_injected = 'ABC'
def __init__(self, ... | StarcoderdataPython |
1770520 | <filename>sphinx/source/docs/user_guide/examples/styling_fixed_ticker.py
from bokeh.plotting import figure, output_file, show
output_file("fixed_ticks.html")
p = figure(plot_width=400, plot_height=400)
p.circle([1,2,3,4,5], [2,5,8,2,7], size=10)
p.xaxis.ticker = [2, 3.5, 4]
show(p)
| StarcoderdataPython |
192894 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 14:53:39 2020
@author: nbarl
"""
import csv
def mirrorDouble(fileName) :
with open(fileName, 'r+', newline='') as file:
dataReader = csv.reader(file, delimiter=';')
newData = []
for row in dataReader :
newLine = createMirror(ro... | StarcoderdataPython |
3397685 | import tests.perf.test_ozone_ar_speed_many as gen
gen.run_test(350)
| StarcoderdataPython |
75701 | from setuptools import find_packages, setup
LONG_DESCRIPTION = (
'Desc.'
)
setup(
name='mhealth',
version='0.0.3',
packages=find_packages(where='src'),
package_dir={'': 'src'},
url='https://github.com/callumstew/pymhealth',
author='<NAME>',
author_email='<E... | StarcoderdataPython |
1616853 | <reponame>ETLopes/Marmileve-kivy<gh_stars>0
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from prettytable import from_db_cursor
from prettytable import PrettyTable
import sqlite3
conn = sqlite3.connect('marmileve.db')
c = conn.cursor()
class TelaInicial(FloatLayout):
def on_pr... | StarcoderdataPython |
41534 | <filename>flask_tube/app.py
# -*- coding: utf-8 -*-
import os
import logging
import inspect
from logging.handlers import SMTPHandler, RotatingFileHandler
from werkzeug.utils import import_string, find_modules
from flask import Flask, Blueprint
class App(Flask):
"""Custom Flask Class."""
def __init__(
... | StarcoderdataPython |
29808 | <reponame>Surfict/osparc-simcore
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
# pylint:disable=no-member
# pylint:disable=protected-access
# pylint:disable=too-many-arguments
import re
import shutil
import tempfile
import threading
from collections import nam... | StarcoderdataPython |
159883 | <reponame>satori99/example-custom-config
"""Platform for sensor integration."""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from . import DOMAIN
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the sensor platform."""
# We only wa... | StarcoderdataPython |
1760782 | <filename>utils.py
# -*- coding: utf-8 -*-
import io
import math
from collections import Counter
from tqdm import tqdm
import tensorflow as tf # TF 2.0
FILE_PATH = './data/'
def create_dataset(path, limit_size=None):
lines = io.open(path, encoding='UTF-8').read().strip().split('\n')
lines = ['<s> ' + line... | StarcoderdataPython |
153421 | import datetime
import simplejson as json
from django.conf import settings
from django.http import HttpResponse
from django.utils.encoding import force_text
from django.utils.functional import Promise
from django.views.generic import FormView
from .app_settings import SLICK_REPORTING_DEFAULT_END_DATE, SLICK_REPORTING... | StarcoderdataPython |
1642853 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from sumy.parsers.html import HtmlParser
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummari... | StarcoderdataPython |
187738 | <filename>__init__.py
from .core.detectors import CornerNet, LineNet, CornerNet_Squeeze, CornerNet_Saccade, CornerNet_ifp_Saccade
from .core.vis_utils import draw_bboxes
| StarcoderdataPython |
3335269 | # -*- coding: utf-8 -*-
#
# Copyright The Plasma Project.
# See LICENSE.txt for details.
"""
`ISmallMessage` Flex Messaging compatibility tests.
.. versionadded:: 0.1
"""
import unittest
import datetime
import uuid
import pyamf
from plasma.test import util
from plasma.flex.messaging import messages
from plasma.fle... | StarcoderdataPython |
143383 | <filename>uliweb/utils/timeit.py
import time
from contextlib import contextmanager
@contextmanager
def timeit(output):
"""
If output is string, then print the string and also time used
"""
b = time.time()
yield
print(output, 'time used: %.3fs' % (time.time()-b)) | StarcoderdataPython |
11984 | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
convolve_grayscale_padding = __import__(
'2-convolve_grayscale_padding').convolve_grayscale_padding
if __name__ == '__main__':
dataset = np.load('../../supervised_learning/data/MNIST.npz')
images = dataset['X_train']
print(ima... | StarcoderdataPython |
1655363 | <gh_stars>1-10
import codecs
import pandas as pd
import numpy as np
import argparse
import jieba
import os
def is_chinese(uchar):
if uchar >= u'\u4e00' and uchar <= u'\u9fa5':
return True
else:
return False
def is_punctuation(uchar):
punctuations = [',', '。', '?', '!', ':']
if uchar in... | StarcoderdataPython |
3231121 | <filename>src/fcrypt.py<gh_stars>0
from . import encryptor, logger
import os
import argparse
from platform import system, release
from pathlib import Path
from time import sleep
__version__ = '1.0.0'
system_os = system()
system_release = release()
current_dir = os.getcwd()
default_key_path = '\\default.key' if syste... | StarcoderdataPython |
3336901 | <reponame>paulcacheux/ctw
# -*- coding: utf-8 -*-
"""
Created on Thu May 9 18:24:31 2019
@author: Mathurin
"""
from fractions import Fraction
import markov
import graphviz
class Tree:
def __init__(self, m):
self.m = m
self.top = Node(None, 0, None, [], m)
self.nodes = [sel... | StarcoderdataPython |
14431 | from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy, reverse
from django.shortcuts import redirect
from .models import StockEntry, StockEntryLine
from .forms import StockEntryForm, StockEntryLineForm, StockEn... | StarcoderdataPython |
4832817 | <filename>schema.py<gh_stars>0
from loopDB import LoopDB # Importing the LoopDB module
loopDB = LoopDB( app.config["DATABASE_URL"] , clean = True)
loopDB.initFromFile('schema.json') # Initialising from the schema file | StarcoderdataPython |
146077 | import re
import pandas as pd
import numpy as np
COLUMN_NAMES = [
'Material family',
'Youngs modulus',
'Specific stiffness',
'Yield strength',
'Tensile strength',
'Specific strength',
'Elongation',
'Compressive strength',
'Flexural modulus',
'Flexural strength',
'Shear modul... | StarcoderdataPython |
197755 | <reponame>v22arvind/Plot-Pings-in-Python
import datetime
import os
import re
import sys
import time
from optparse import OptionParser
import numpy as np
# software version
__version__ = "1.1.0"
ping_flag = "n"
if sys.platform != "win32":
ping_flag = "c"
# ping
def pinger(host, n):
"""Executes the PCs ping... | StarcoderdataPython |
1730868 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Shared interfaces
"""
import logging as log
from pydoc import locate
from dacite import from_dict
from dataclasses import dataclass, field
from typing import List, Optional, Union, cast
from .common import IDebugDecorator
"""
Component co... | StarcoderdataPython |
102292 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import h5py
import sys
if __name__ == '__main__' :
EXIT_FAILURE = 1
EXIT_SUCCESS = 0
# Check if we have a program argument, otherwise terminate
if len(sys.argv) <= 1 :
print("Usage: " + sys.argv[0] + " H5FILE\n")
sys.exit(EXIT_FAILURE)
file... | StarcoderdataPython |
1771386 | <filename>numpyro/contrib/module.py<gh_stars>1-10
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from functools import partial
from jax import numpy as jnp
import numpyro
from numpyro.distributions.discrete import PRNGIdentity
def flax_module(name, nn, input_shape=None):
""... | StarcoderdataPython |
28436 | from setuptools import setup
setup(
name='torch-dimcheck',
version='0.0.1',
description='Dimensionality annotations for tensor parameters and return values',
packages=['torch_dimcheck'],
author='<NAME>',
author_email='<EMAIL>',
)
| StarcoderdataPython |
153474 | from collections import OrderedDict
from decimal import Decimal, ROUND_DOWN
from models import models
def get_results(name):
results = models.Result.select(
models.Result,
models.Call.accept_ap,
models.Call.override_winner
).where(
(models.Result.level == 'state') | (models.Res... | StarcoderdataPython |
4821612 | from drf_yasg.utils import swagger_auto_schema
from social_django.utils import load_strategy, load_backend
from social_core.exceptions import MissingBackend
from social_core.backends.oauth import BaseOAuth1
from django.http import HttpResponseRedirect
from django.conf import settings
from django.core import mail
from ... | StarcoderdataPython |
3248652 | <reponame>feifeigood/watch<gh_stars>1-10
import threading
from datetime import datetime
from time import sleep
from cx_Oracle import DatabaseError, OperationalError
from watch import app, lock, notification_pool, task_pool, unsent_pool
from watch.utils.chat_bot import send_message
from watch.utils.manage_message impo... | StarcoderdataPython |
3380263 | import sys
import argparse
import numpy as np
import json
from plot_config import * # plot configuration file
width = 4.5 # default_width
height = 3.5 # default_height
def plot_runtime(x, y, z, group_labels, group_size, nolegend=False, mnist=False):
######################## PLOT CODE ########################
... | StarcoderdataPython |
1740590 | <gh_stars>100-1000
##########################################################################
#
# Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2012, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permi... | StarcoderdataPython |
3219875 | <filename>sympy/physics/quantum/tests/test_dagger.py
from sympy import I, Matrix, symbols, conjugate, Expr, Integer
from sympy.physics.quantum.dagger import adjoint, Dagger
from sympy.external import import_module
from sympy.testing.pytest import skip
def test_scalars():
x = symbols('x', complex=True)
assert... | StarcoderdataPython |
1659435 | from pyramid.config import Configurator
from clld.interfaces import IMapMarker
from clld.web.icon import ICON_MAP
"""
Even if not used, these models should still be imported. The original comment:
we must make sure custom models are known at database initialization!
"""
from northeuralex import models
"""
An ugly... | StarcoderdataPython |
117868 | <reponame>haihala/space-tavern
from constants import CONFPATH
from engine import Engine
from json import load, dump
from os import mkdir
import sys
from os.path import isdir, isfile, dirname
def load_config():
with open(CONFPATH) as f:
return load(f)
def main(resolution):
engine = Engine(load_config(... | StarcoderdataPython |
1701027 | <reponame>k4rrot/escrow-api<filename>api/escrow.py
from datetime import datetime
from flask import current_app, Blueprint, request, make_response, jsonify
from mongoengine.errors import DoesNotExist
import requests
from models.record import EscrowRecord
escrow = Blueprint('escrow', __name__, url_prefix='/escrow')
... | StarcoderdataPython |
147977 | #!/usr/bin/python3
# Transfer vector graph (.svg) into LEdit code (.tco)
# usage: python3 svg2tco.py [-s SHIFTX SHIFTY] MASKFILENAME > OUTPUTCODE.tco
# NOTICE: Currently, only boxes(rectangles) & polygons will work.
import xml.dom.minidom
import sys
def polygonProcess(pgpcps): # since codes about polygon and path sha... | StarcoderdataPython |
4838775 | <filename>stubs.min/System/Windows/Forms/__init___parts/PropertyValueChangedEventArgs.py<gh_stars>1-10
class PropertyValueChangedEventArgs(EventArgs):
"""
Provides data for the System.Windows.Forms.PropertyGrid.PropertyValueChanged event of a System.Windows.Forms.PropertyGrid.
PropertyValueChangedEventArgs(c... | StarcoderdataPython |
1777700 | <filename>pop_elements_even_index.py
''' write a function that pops all elements at even indexes
'''
def pop_elements(alist):
for i in range(0, len(alist)):
if i%2 == 0:
alist.pop(i)
return alist
| StarcoderdataPython |
3375913 | """Utilities for constructing a metric
"""
import functools
import itertools
from typing import Tuple, Union, List
import sympy
from sympy import Function, sin, Expr, Array, Derivative as D, MatrixBase, Matrix, Symbol
from sympy.diffgeom import twoform_to_matrix
from sympy.printing.latex import latex
from pystein i... | StarcoderdataPython |
3280184 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/text.symbols.ipynb (unless otherwise specified).
__all__ = ['symbols_portuguese', 'PORTUGUESE_SYMBOLS', 'symbols_polish', 'POLISH_SYMBOLS', 'symbols_dutch',
'DUTCH_SYMBOLS', 'symbols_spanish', 'SPANISH_SYMBOLS', 'symbols', 'symbols_nvidia_taco2', 'symbols_with... | StarcoderdataPython |
94317 | <reponame>Mymoza/pyannote-audio
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016-2019 CNRS
# 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 restr... | StarcoderdataPython |
170517 | <filename>utils/util.py
import sys
import os
import logging
from datetime import datetime
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tensorboardX import SummaryWriter
class AverageMeter(object):
def __init__(self, name=''):
self._name = name
self.... | StarcoderdataPython |
1747227 | <filename>freegames/Code Description/bounce_d.py
"""bounce.py를 한국어로 알기 쉽게 설명하는 파일"""
"""Bounce, a simple animation demo. # Bounce, 간단한 애니메이션 데모
Exercises # 연습문제들
1. Make the ball speed up and down. # 1. 공의 속... | StarcoderdataPython |
3354228 | #!/usr/bin/env python
#
# This code implements the segment mining in Entropy/IP
# @1 finds frequency outliers (like constants, enums, etc.)
# @2 finds highly dense ranges of values (like close /32 prefixes)
# @3 finds uniformly distributed ranges of values (like counters)
# @4 prints what didn't get into @1-@3
... | StarcoderdataPython |
26979 | from hamcrest import *
from tests.helpers.sql import sql_query
class TestSqlQueries:
def test_sql_select(self, namespace, index, item):
# Given("Create namespace with item")
db, namespace_name = namespace
item_definition = item
# When ("Execute SQL query SELECT")
query = f... | StarcoderdataPython |
4823605 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from utilities.commander import Commander
from versioning.git.command import GitCommand
class GitVersioner:
"""
Class which is for interaction with git and version control.
"""
def __init__(self, project_dir: str):
"""
Initializes git v... | StarcoderdataPython |
180425 | <reponame>google-cloud-sdk-unofficial/google-cloud-sdk<gh_stars>1-10
"""Generated message classes for iamcredentials version v1.
Creates short-lived credentials for impersonating IAM service accounts. To
enable this API, you must enable the IAM API (iam.googleapis.com).
"""
# NOTE: This file is autogenerated and shoul... | StarcoderdataPython |
1683694 | """
KnowYourData
============
A rapid and lightweight module to describe the statistics and structure of
data arrays for interactive use.
The most simple use case to display data is if you have a numpy array 'x':
>>> from knowyourdata import kyd
>>> kyd(x)
"""
import sys
import numpy as np
from IPython.dis... | StarcoderdataPython |
1740004 | <reponame>cfrancisco/dojot
"""
Certificate utilities.
"""
import os
import requests
from src.config import CONFIG
from src.utils import Utils
from src.ejbca.thing import Thing
from src.mqtt_locust.redis_client import RedisClient
LOGGER = Utils.create_logger("cert_utils")
class CertUtils:
"""
Handles certif... | StarcoderdataPython |
3374241 | <gh_stars>10-100
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | StarcoderdataPython |
4832377 | <gh_stars>0
from kubernetes import client, config, watch
class ClusterApi(object):
def __init__(self, namespace):
config.load_kube_config()
self.core = client.CoreV1Api()
self.batch = client.BatchV1Api()
self.namespace = namespace
def create_persistent_volume_claim(self, name,... | StarcoderdataPython |
3393185 | <reponame>skitazaki/python-school-ja<filename>src/cmdline-3.py<gh_stars>0
from pprint import pprint
import settings
pprint(dir(settings))
pprint({'DEBUG': settings.DEBUG})
pprint(settings.DATABASES['default'])
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.