id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1778072 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self,n_channels, scale):
super(L2Norm,self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
self.eps = 1e-10
se... | StarcoderdataPython |
194229 | from xnat_dashboards.data_cleaning import data_formatter
from xnat_dashboards.bbrc import data_formatter as data_formatter_b
formatter_object_connected = data_formatter.Formatter()
formatter_object_connected_b = data_formatter_b.Formatter()
def test_get_projects_details():
projects = 1
project_details = for... | StarcoderdataPython |
3344193 | <gh_stars>1-10
#!/usr/bin/python
"""Expand rocBLAS YAML test data file into binary Arguments records"""
import re
import sys
import os
import argparse
import ctypes
from fnmatch import fnmatchcase
try: # Import either the C or pure-Python YAML parser
from yaml import CLoader as Loader
except ImportError:
from... | StarcoderdataPython |
143969 | <gh_stars>1-10
'''
Created on 29.09.2017
@author: lemmerfn
'''
import numpy as np
import scipy.stats
from functools import total_ordering
from .measures import AbstractInterestingnessMeasure, BoundedInterestingnessMeasure
from .utils import effective_sample_size, powerset
from .subgroup import SubgroupDescription, Su... | StarcoderdataPython |
3332031 | <reponame>PaddlePaddle/trustAI
import abc
import functools
import paddle
from ...base_interpret import Interpreter
from ..common.utils import get_sublayer
class ExampleBaseInterpreter(Interpreter):
"""Interpreter is the base class for all interpretation algorithms.
Args:
paddle_model (callable): A m... | StarcoderdataPython |
3203708 | <gh_stars>10-100
# ----------------------------------------------------------------------
# Service command
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------... | StarcoderdataPython |
18020 | __description__ = \
"""
Fitter subclass for performing bayesian (MCMC) fits.
"""
__author__ = "<NAME>"
__date__ = "2017-05-10"
from .base import Fitter
import emcee, corner
import numpy as np
import scipy.optimize as optimize
import multiprocessing
class BayesianFitter(Fitter):
"""
"""
def __init__(sel... | StarcoderdataPython |
3255567 | <reponame>ysmiraak/darc
# from thesis_atomic import Setup
# from thesis_binary import Setup
# from thesis_onehot import Setup
from thesis_summed import Setup
if '__main__' == __name__:
trial = 0
use_form = False
use_lemma = False
embed_const = None
embed_dropout = 0
train_path = "./thesis/tra... | StarcoderdataPython |
4841482 | """Semantic Release."""
__version__ = "1.0.3"
from .errors import UnknownCommitMessageStyleError # noqa
from .errors import ImproperConfigurationError, SemanticReleaseBaseError
__all__ = ("__version__", "UnknownCommitMessageStyleError", "ImproperConfigurationError", "SemanticReleaseBaseError")
| StarcoderdataPython |
1692396 | import random
from math import ceil
enchs = ['ATK', 'ATK%', 'DEF', 'DEF%', 'MDEF', 'MDEF%', 'INT', 'INT%', 'HP', 'HP%']
enchs_acc = ['ATK', 'ATK%', 'DEF', 'DEF%', 'MDEF', 'MDEF%', 'INT', 'INT%', 'HP', 'HP%', 'CRIT%']
testing_base_stats = {
'HP': 3760,
'ATK': 550,
'INT': 243,
'DEF': 260,
'MDEF': 17... | StarcoderdataPython |
1784096 | <reponame>TillMacher/TaxonTableTools<filename>taxontabletools/taxon_table_filtering.py
## TaXon table filtering
#1.a create mask for user input
def create_taxa_mask(TaXon_table_xlsx, mask, taxon_mask):
import pandas as pd
from pandas import DataFrame
from pathlib import Path
TaXon_table_xlsx = Path(Ta... | StarcoderdataPython |
1729431 | <filename>codewars/7kyu/amrlotfy77/Reversed Strings/test_main.py
import unittest
from main import solution
class Test_solution(unittest.TestCase):
def test(self):
self.assertEqual(solution('world'), 'dlrow')
self.assertEqual(solution('hello'), 'olleh')
self.assertEqual(solution(''), '')
... | StarcoderdataPython |
4837017 | def f():
return 3
def test_f():
assert 4 == f()
| StarcoderdataPython |
3382928 | class PrimitiveError(Exception):
"""Base error of all primitives errors."""
pass
| StarcoderdataPython |
3254728 | from src.game.player import Player
from src.game.utilities import HUMAN_CODE, COMPUTER_CODE
from .action import PlaceDiscAction
class ConnectFourPlayer(Player):
def __init__(self, code, symbol, id=-1):
super().__init__()
self._code = code
self._symbol = symbol
self._id = id
@p... | StarcoderdataPython |
1762656 | <reponame>hartnetl/boutique-ado-walkthrough
from django.shortcuts import render, get_object_or_404, redirect, reverse
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.db.models.functions import Lower
from .models import Product, Cat... | StarcoderdataPython |
157017 | <filename>src/nets/__init__.py<gh_stars>1-10
from squeezeSeg import *
| StarcoderdataPython |
1727949 | import unittest
from unittest.mock import ANY, call, patch
from prompt_toolkit.enums import EditingMode
from prompt_toolkit.key_binding.key_bindings import KeyBindings
from prompt_toolkit.styles.style import Style
from InquirerPy.exceptions import InvalidArgument, RequiredKeyNotFound
from InquirerPy.prompts.checkbox ... | StarcoderdataPython |
184314 | # For Keystone Engine. AUTO-GENERATED FILE, DO NOT EDIT [systemz_const.py]
KS_ERR_ASM_SYSTEMZ_INVALIDOPERAND = 512
KS_ERR_ASM_SYSTEMZ_MISSINGFEATURE = 513
KS_ERR_ASM_SYSTEMZ_MNEMONICFAIL = 514
| StarcoderdataPython |
1680877 | # Copyright 2019 The Meson development team
# 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 ... | StarcoderdataPython |
71093 | #!/usr/bin/env python3
import io
import pwncat.manager
def test_config_fileobj():
configuration = io.StringIO(
"""
set -g db "memory://"
set -g prefix c-k
set -g on_load { }
set -g backdoor_user "config_test"
"""
)
with pwncat.manager.Manager(config=configuration) as manager:
asser... | StarcoderdataPython |
1705977 | <gh_stars>1-10
from __future__ import print_function, division, absolute_import
from glue.external.echo import CallbackProperty
from glue.core.state_objects import State
class SAMPState(State):
status = CallbackProperty('Not connected to SAMP Hub')
connected = CallbackProperty(False)
clients = CallbackP... | StarcoderdataPython |
1691585 | <filename>examples/servicenet/plotresults.py
# -*- coding: utf-8 -*-
"""Plot results read from a result set
"""
from __future__ import division
import os
import argparse
import collections
import logging
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from icarus.util import... | StarcoderdataPython |
3332055 | # -*- coding: utf-8 -*-
"""
This file contains the script for defining characteristic functions and using them
as a way to embed distributional information in Euclidean space
"""
import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def characteristic_function(sig,t,plot=False, taus=1, n... | StarcoderdataPython |
106515 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | StarcoderdataPython |
3370912 | <filename>congress/policy/hooks.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | StarcoderdataPython |
1679112 | <gh_stars>1-10
MAX_LEN = 100
CV_SPLIT = 0.9
NUM_OUTPUTS = 14
BATCH_SIZE = 1024
NUM_EPOCHS = 200 | StarcoderdataPython |
3231677 | <gh_stars>1-10
"PAPPER LINK https://arxiv.org/abs/1907.05321"
import tensorflow as tf
from tensorflow.keras.layers import *
batch_size = 32
seq_len = 128
d_k = 256
d_v = 256
n_heads = 12
ff_dim = 256
class Time2Vector(Layer):
def __init__(self, seq_len, **kwargs):
super(Time2Vector, sel... | StarcoderdataPython |
3267804 | <reponame>RoyLQ/Advanced_IDE_Recommendation
from tokenizers import BertWordPieceTokenizer
from tokenizers.processors import BertProcessing
from alive_progress import alive_bar
import numpy as np
import os
import pickle
def makeSenteces(rawInput):
print("Compiling sequnces into sentences")
with open("Sentences... | StarcoderdataPython |
3368385 | import os
from pathlib import Path
PATH_LIKE_KWARGS = [
"bids-filter-file",
"fs-license-file",
"fs-subjects-dir",
"work-dir",
"w",
]
FLAGS = (
"skip_bids_validation",
"low-mem",
"boilerplate",
"longitudinal",
"skull-strip-fixed-seed",
"no-submm-recon",
"fs-no-reconall",
... | StarcoderdataPython |
1702370 | from django.shortcuts import render,redirect,get_object_or_404
from .models import Profile,Project,UsabilityRating,DesignRating,ContentRating
from django.contrib.auth.models import User
from .forms import RegistrationForm,ProjectForm,EditProfileForm,DesignForm,UsabilityForm,ContentForm
from django.contrib.auth.decorato... | StarcoderdataPython |
3227529 | <filename>noxfile.py
import nox
import shutil
@nox.session
def test(session: nox.Session):
session.install('.')
session.run('python', '-m', 'unittest')
@nox.session
def clear(session: nox.Session):
shutil.rmtree('dist', ignore_errors=True)
shutil.rmtree('build', ignore_errors=True)
@nox.session
de... | StarcoderdataPython |
3335298 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Task queue task which deletes a Test, its subtest, and all their Rows.
A delete consists of listing all Test entities which match the name pattern,
and t... | StarcoderdataPython |
1768151 | <reponame>luluci/utilCParse
from typing import List, Dict
import enum
import pathlib
import pyparsing as pp
from . import parse_action
from . import grammar
pp.ParserElement.enablePackrat()
# PyParsing parseActionHandler管理クラス インスタンス
act_hdler = parse_action.parse_action
# parser
parser = grammar.parser
class var_info... | StarcoderdataPython |
3359259 | # Copyright (c) 2020 Sony Corporation. 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 applicabl... | StarcoderdataPython |
1668536 | <filename>drawing-source.py<gh_stars>1-10
import kandinsky as ky
import math
HEIGHT = 320
WIDTH = 222
class Options:
stroke_color = ky.color(0, 0, 0)
@staticmethod
def stroke(r = None, g = None, b = None):
if not (r == g == b == None):
Options.stroke_color = ky.color(r, g, b)
return Options.str... | StarcoderdataPython |
9109 | class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
| StarcoderdataPython |
1799931 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 18 17:06:47 2020
@author: anilosmantur
"""
import numpy as np
import cv2
import os
import pandas as pd
import torch
from torchvision import transforms
class CardImageDataset():
def __init__(self, root_dir='../data', header_file='gicsd_labels.csv', image_dir='images... | StarcoderdataPython |
49008 | import urllib2
import json
global base_url
global auth_key
global ticket
def get_ticket():
url = base_url + "/alfresco/service/api/login"
headers = {"Content-Type": "application/json"}
data = auth_key
try:
response = make_post_request(url, data, headers)
return json.load(response).get... | StarcoderdataPython |
142816 | <reponame>rako77/xbox-smartglass-core-python
"""
Wrapper around gevent's greenlets
"""
import gevent
class Event(object):
def __init__(self, green=False):
self.handlers = []
self.green = green
def add(self, handler):
if not callable(handler):
raise TypeError("Handler shoul... | StarcoderdataPython |
173081 | # 二分法
# TODO: a,bの選び直し
# 解が二つあるので,初期値によっては収束しなくなる.why?
import matplotlib.pyplot as plt
EQUATION = 1
def f(x):
if EQUATION == 1:
return x ** 2 + 2 * x - 1 # 手計算の解は√2 - 1, -1 - √2
elif EQUATION == 2:
return x
def main():
epsilon = 0.1 ** 16
n = 0
c_old = 0.191
WRITE = 1
cl... | StarcoderdataPython |
167294 | <reponame>askmuhsin/cryptography
##ONE TIME PAD
##Input : text
##Output: cipher text, key of length(text)
| StarcoderdataPython |
3283537 | <filename>scheduler/__init__.py
import asyncio
import logging
import time
import typing
import aiohttp
from uecp.commands import DataSetSelectCommand
from uecp.frame import UECPFrame
from scheduler import config
from scheduler.calendar_provider import Programme, ProgrammeEventProvider
from scheduler.rds import open_d... | StarcoderdataPython |
1603214 | <filename>api/urls.py
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from api import views
from rest_framework_swagger.views import get_swagger_view
router = DefaultRouter()
router.register(r'row_permit_data', views.RowPermitDataViewSet)
schema_view = get_swagger_view(titl... | StarcoderdataPython |
1616750 | # Program 21d: Animation of a JJ limit cycle bifurcation.
# See Figure 21.9.
from matplotlib import pyplot as plt
from matplotlib.animation import ArtistAnimation
import numpy as np
from scipy.integrate import odeint
fig = plt.figure()
myimages = []
bj = 1.2
tmax = 100
def jj_ode(x, t):
return [x[1], kappa - bj... | StarcoderdataPython |
1771135 | from django.urls import path, include
from . import views
urlpatterns = [
path('', views.index, name='paginas-home'),
path('sobre/', views.sobre, name='paginas-sobre'),
path('login/', views.login, name='paginas-login'),
path('process/', views.process_login, name='paginas-process'),
path('logout/',... | StarcoderdataPython |
4805573 | # coding: utf-8
from __future__ import unicode_literals
import six
__all__ = [
'collaboration',
'events',
'file',
'folder',
'group',
'group_membership',
'search',
'user',
]
if six.PY2:
__all__ = [unicode.encode(x, 'utf-8') for x in __all__]
| StarcoderdataPython |
4825842 | # system settings file for sysadmin and debugger use
class Settings(object):
def __init__(self,configName='default', **kwargs):
# always start from default setup:
self.showFrame = True
self.showBG = True
self.showResources = True
self.controlBG = False
self.music ... | StarcoderdataPython |
107590 | <filename>django/engagementmanager/rest/checklist.py
#
# ============LICENSE_START==========================================
# org.onap.vvp/engagementmgr
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ==========================... | StarcoderdataPython |
3210574 | <reponame>lumnn/sublime-git-diff-view
from os import path
from GitDiffView.status_commands.GitTextCommand import GitTextCommand
from GitDiffView.core.Command import Command
class GitDiffViewGotoFileCommand(GitTextCommand):
def run(self, edit):
if self.have_a_diff_to_show():
file = self.get_fil... | StarcoderdataPython |
3251136 | <gh_stars>0
import datetime
import hashlib
import traceback
import sys
import json
from pathlib import Path
from typing import List, Optional, Tuple, Dict, NamedTuple, Iterable, Set, Any, Callable
import click
import yaml
import openshift as oc
from doozerlib.rpm_utils import parse_nvr
from doozerlib.brew import Koji... | StarcoderdataPython |
1707698 | <gh_stars>0
import numpy as np
def normalize(v):
return v / np.linalg.norm(v)
def main():
a1 = np.array([3, 0, 1])
a2 = np.array([-1, 1, 2])
a3 = np.array([2, -1, -2])
us = []
u1 = a1 / np.linalg.norm(a1)
u2 = normalize(a2 - np.dot(a2, u1) * u1)
u3 = normalize(a3 - np.dot(a3, u1) *... | StarcoderdataPython |
3240041 | import pygeohash as pgh
import georaptor
import math
import time
import argparse
from clint.textui import puts, indent, colored
def in_circle_check(latitude, longitude, centre_lat, centre_lon, radius):
"""
Check if given latitude and longitude are within the circle
:param latitude: to be checked latitude
... | StarcoderdataPython |
12208 | <gh_stars>1-10
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__date__ = '10/28/2020 4:52 PM'
# import re
#
#
# def format_qs_score(score_str):
# """
# help you generate a qs score
# 1 - 100 : 5
# 141-200 : 4
# =100: 4
# N/A 3
# :param score_str:
# :return:
# """
# score = 3
# ... | StarcoderdataPython |
1731969 | <reponame>ktsstudio/gentle-python-pptx
from setuptools import setup, find_packages
setup(
name='gentle-python-pptx',
version='0.4.3',
description='Processes pptx presentations, optimized for repetitive processing large ones',
long_description=open('README.md').read(),
url='https://github.com/ktsst... | StarcoderdataPython |
1627627 | <gh_stars>10-100
#!/usr/bin/env python3
import argparse
#******************************************************************************
#
# CRC function that matches the CRC used by the Apollo bootloader.
#
#******************************************************************************
poly32 = 0x1EDC6F41
def crc32(... | StarcoderdataPython |
3212606 | <reponame>sixpearls/wagtail
class RemovedInWagtail10Warning(DeprecationWarning):
pass
class RemovedInWagtail11Warning(PendingDeprecationWarning):
pass
| StarcoderdataPython |
125688 | """
With molecular inversion probes, we map reads to the genome that include the
ligation and extension arms, along with a molecular tag (AKA UMI).
This script takes:
1) ref.fasta
2) mips design file (likely from MIPgen)
3) de-multiplxed, paired-end fastqs
and moves the UMI into the read-name, aligns the r... | StarcoderdataPython |
1793680 | <gh_stars>10-100
import unittest
import copy
from unittest.mock import Mock
from algorithms.configuration.entities.agent import Agent
from algorithms.configuration.entities.goal import Goal
from algorithms.configuration.entities.obstacle import Obstacle
from algorithms.configuration.entities.trace import Trace
from a... | StarcoderdataPython |
193953 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | StarcoderdataPython |
3384225 | #!/usr/bin/env python
import unittest
from faked_nfvo.requests import pim_request
from faked_nfvo.requests import request_utils
from faked_nfvo.requests.request_vimpim import RequestVIMPIM
class PimCmTest(unittest.TestCase):
def setUp(self):
self.req = RequestVIMPIM(request_utils.get_host(),
... | StarcoderdataPython |
52760 | <filename>ProbePage.py<gh_stars>0
# $Id$
#
# Author: <EMAIL>
# Date: 18-Jun-2015
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import sys
# import time
import math
try:
from Tkinter import *
import tkMessageBox
except ImportError:
from tkinter import *
import tkinter.messagebox as tkMessageBox
from CNC import CN... | StarcoderdataPython |
1721971 | <filename>shapefileimport/models.py
from django.contrib.gis.db import models
from django.contrib.auth.models import User
# Create your models here.
class ShapeImports(models.Model):
id = models.AutoField(primary_key=True)
djangoUser = models.ForeignKey(User, on_delete=models.CASCADE, editable=False)
filena... | StarcoderdataPython |
1626436 | del_items(0x80132930)
SetType(0x80132930, "struct Creds CreditsTitle[6]")
del_items(0x80132AD8)
SetType(0x80132AD8, "struct Creds CreditsSubTitle[28]")
del_items(0x80132F74)
SetType(0x80132F74, "struct Creds CreditsText[35]")
del_items(0x8013308C)
SetType(0x8013308C, "int CreditsTable[224]")
del_items(0x801342BC)
SetTy... | StarcoderdataPython |
162397 | """
Module: 'functools' on LEGO EV3 v1.0.0
"""
# MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3
# Stubber: 1.3.2
def partial():
pass
def reduce():
pass
def update_wrapper():
pass
def wraps():
pass
| StarcoderdataPython |
3283087 | <filename>soulsgym/core/static.py
"""The ``soulsgym.core.static`` module is a collection of all module constants.
We read all config files into dictionaries and make them available as Python objects. The static
collection is useful beyond the ``core`` module itself. We provide a complete list of possible
values for bo... | StarcoderdataPython |
1784798 | <gh_stars>0
# -*- coding: utf-8 -*-
# ======================================================================================================================
# Imports
# ======================================================================================================================
from python_practice.looping im... | StarcoderdataPython |
1686062 | <filename>ivy/functional/backends/tensorflow/linear_algebra.py<gh_stars>1-10
# global
import tensorflow as tf
from typing import Union, Optional, Tuple, Literal, List, NamedTuple
from collections import namedtuple
# local
from ivy import inf
import ivy
# Array API Standard #
# -------------------#
def eigh(x: Unio... | StarcoderdataPython |
131835 | <gh_stars>0
import numpy as np
import random
from dqn.snake import Snake, Directions
class CellType():
HEAD = 2
BODY = 3
EMPTY = 0
FOOD = 1
WALL = 4
AllDirections = [Directions.NORTH, Directions.WEST, Directions.SOUTH, Directions.EAST]
class Actions():
CONTINUE_FORWARD = 0
TURN_LEFT = 1
... | StarcoderdataPython |
3341515 | #!/usr/bin/env python
"""
Oracle session details
"""
import sys
import lib_oracle
import lib_common
from lib_properties import pc
from sources_types.oracle import schema as oracle_schema
from sources_types.oracle import session as oracle_session
# Associer a chaque table oracle une classe dynamique (Ce que ne peut... | StarcoderdataPython |
114047 | <reponame>jy1263/electronic-bike-rack-project
import sqlite3
import texttable
class SqliteManager:
def __init__(self):
self.self = self
def convertSqlite(self, tableName):
conn = sqlite3.connect('main.sqlite')
c = conn.cursor()
RowsArray=[]
RowsDescription=[]
... | StarcoderdataPython |
1682767 |
def get_id(seat_encoding):
row_data = seat_encoding[0:7]
col_data = seat_encoding[7:]
# Get row
row = 0
for i,c in enumerate(reversed(row_data)):
if c == "B":
row |= 1 << i
# Get col
col = 0
for i,c in enumerate(reversed(col_data)):
if c == "R":
... | StarcoderdataPython |
12015 | <filename>Kaspa/modules/extension_modules/spotify_module/spotifyModuleEn.py
from Kaspa.modules.abstract_modules.abstractSubmodule import AbstractSubmodule
from Kaspa.modules.exceptions.impossibleActionError import ImpossibleActionError
from Kaspa.config import Config
class SpotifyModuleEn(AbstractSubmodule):
modu... | StarcoderdataPython |
123342 | # coding: utf-8
"""
SignRequest API
API for SignRequest.com
OpenAPI spec version: v1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import signrequest_python_client
from signrequest_python_client.api... | StarcoderdataPython |
1794173 | from django.urls import path,re_path
from django.conf.urls import include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
from Profile import views
urlpatterns=[
re_path(r'^lista/$', views.ProfileList.as_view()),
re_path(r'^editprofile/(?P<pk>\d+)/$',views.Pr... | StarcoderdataPython |
3294556 | import six
from weakref import ref as weakref
from binascii import crc32
from rb.ketama import Ketama
from rb._rediscommands import COMMANDS
class UnroutableCommand(Exception):
"""Raised if a command was issued that cannot be routed through the
router to a single host.
"""
class BadHostSetup(Exception)... | StarcoderdataPython |
190440 | <reponame>1987539447/start-python<gh_stars>0
#!/usr/bin/env python3
# FileName:use_json.py
# -*- coding: utf-8 -*-
""" 使用json 转化对象 dict"""
import json
bob = dict(name='Bob', age=20, score=88)
json_str = json.dumps(bob)
print('json str--', json_str)
reborn = json.loads(json_str)
print(reborn)
class Student(object):
... | StarcoderdataPython |
3241396 | <reponame>leosmerling/hopeit.engine
import pytest
import asyncio
from hopeit.app.context import EventContext
from hopeit.server.collector import Collector, AsyncCollector
from mock_app import mock_app_config # type: ignore # noqa: F401
@pytest.mark.asyncio
async def test_async_collector(mock_app_config): # noqa:... | StarcoderdataPython |
3215353 | from public import public
from ibis.expr.types.generic import Column, Scalar, Value
@public
class CategoryValue(Value):
pass # noqa: E701,E302
@public
class CategoryScalar(Scalar, CategoryValue):
pass # noqa: E701,E302
@public
class CategoryColumn(Column, CategoryValue):
pass # noqa: E701,E302
| StarcoderdataPython |
3341243 | <filename>Discord-Bot/cogs/audio_player.py
import os
import discord
import youtube_dl
from discord.ext import commands
from discord.utils import get
class AudioPlayer(commands.Cog):
def __init__(self, client):
self.client = client
@client.command(pass_context=True)
async def join(ctx):
... | StarcoderdataPython |
1649521 | <reponame>Crazyokd/lan-explore
import dearpygui.dearpygui as dpg
def create_item():
with dpg.window(label="Tutorial") as window:
# When creating items within the scope of the context
# manager, they are automatically "parented" by the
# container created in the initial call. So, "window"
... | StarcoderdataPython |
3359004 | <reponame>byung-u/HackerRank
#!/usr/bin/env python3
import sys
from functools import reduce
from collections import OrderedDict
if __name__ == '__main__':
N = int(input())
item_and_price = OrderedDict()
for _ in range(N):
temp = input().split()
item_name = reduce(lambda x, y: str(x) + ... | StarcoderdataPython |
1655012 | <filename>testproj/testproj/core/models/mysql_json.py
# -*- coding: utf-8 -*-
from django_mysql.models import JSONField
from django_input_collection.models import AbstractCollectedInput
from .managers import JSONUserLatestCollectedInputQuerySet
__all__ = ["CollectedInput_MySQL_JSON"]
class CollectedInput_MySQL_JSON... | StarcoderdataPython |
1622115 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""Use blog post test to test user permissions logic"""
import frappe
import frappe.defaults
import unittest
test_records = frappe.get_test_records('Event')
class TestEvent(unittest.TestCase):
# def setUp(self):
... | StarcoderdataPython |
3288073 | # This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from xdrlib import Packer, Unpacker
from ..type_checked import type_checked
from .asset import Asset
from .int64 import Int64
from .uint256 import Uint256
__all__ = ["ClaimOfferAtomV0"]
@type_checked
class Clai... | StarcoderdataPython |
3347095 | <gh_stars>1-10
# :coding=utf-8:
from django.dispatch import Signal
user_logged_in = Signal(providing_args=['request', 'user'])
"""
This is `django.dispatch.Signal` instances.
This is sent at the end of the `newauth.api.login()` method.
Arguments sent with this signal:
**sender**
The class of the user that jus... | StarcoderdataPython |
69084 | <gh_stars>0
from django.urls import path
from .views import DeterminationCreateOrUpdateView, DeterminationDetailView
app_name = 'determinations'
urlpatterns = [
path('determination/<int:pk>/', DeterminationDetailView.as_view(), name="detail"),
path('determination/add/', DeterminationCreateOrUpdateView.as_vie... | StarcoderdataPython |
1695339 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obt... | StarcoderdataPython |
1761056 | def make_multipler(x: int):
def multipler(n: int) -> int:
return x * n
return multipler
times_10 = make_multipler(10)
times_4 = make_multipler(4)
print(times_10(10))
print(times_4(10))
| StarcoderdataPython |
3367197 | <reponame>bureau14/qdb-api-python
import logging
import quasardb
import threading
import functools
import weakref
logger = logging.getLogger('quasardb.pool')
def _create_conn(**kwargs):
return quasardb.Cluster(**kwargs)
class SessionWrapper(object):
def __init__(self, pool, conn):
self._conn = conn
... | StarcoderdataPython |
3275219 | <reponame>rikgj/Kattis
# preparations
# ASCII 65-90 (remove Q --> 81)
az = [chr(x) for x in range(65,91) if x != 81]
key = input().replace(" ","").upper()
plaintext = input().replace(" ","").upper()
cipher = ""
# key letter sequence
seq = ""
for k in key:
if k not in seq:
seq+= k
seq+= ''.join([a for a in ... | StarcoderdataPython |
135847 | # Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome separadamente.
print('-' * 100)
print('{: ^100}'.format('EXERCÍCIO 027 - PRIMEIRO E ÚLTIMO NOME DE UMA PESSOA'))
print('-' * 100)
nome = str(input('Digite seu nome completo: ')).title().strip().split()
print(f'... | StarcoderdataPython |
1777563 | from typing import List
class numerics(object):
"""Numeric utilities for solving the problem.
"""
@staticmethod
def plus_to_pos(original: List[int], position: int, k: int = 3) -> List[int]:
"""Recursive helper function to add one at a location of a list of (bit) integers
representi... | StarcoderdataPython |
3395140 | <gh_stars>0
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Dropout
from keras.layers import LSTM, Input, Bidirectional
from keras.optimizers import Adam
from keras.callbacks import EarlyStopping
from keras.callbacks import ModelCheckpoint
import collections
from random import ... | StarcoderdataPython |
1674775 | '''gff2bed.py - convert from gff/gtf to bed
=========================================
:Tags: Genomics Intervals GFF BED Conversion
Purpose
--------
This script converts GFF or GTF formatted files to BED formatted
files.
Documentation
--------------
Users can select the field from the GTF file to be used in the nam... | StarcoderdataPython |
1601203 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/18 12:32
# @Author : glacier
# @Site :
# @File : zhihu_story.py
# @Software: PyCharm Edu
from zhihu_oauth import ZhihuClient
from zhihu_oauth.exception import NeedCaptchaException
import pymysql
import traceback
from bs4 import Bea... | StarcoderdataPython |
127272 | <reponame>mparno/sdot2d<gh_stars>0
import pysdot as ot
import numpy as np
import matplotlib.pyplot as plt
import rasterio
from rasterio.features import shapes
import shapely.geometry as geom
#from shapely.geometry import shape, Polygon
from shapely.ops import unary_union
from descartes import PolygonPatch
from matplo... | StarcoderdataPython |
1674436 | from stix_shifter_utils.modules.base.stix_transmission.base_results_connector import BaseResultsConnector
from stix_shifter_utils.utils import logger
from stix_shifter_utils.utils.error_response import ErrorResponder
class ResultsConnector(BaseResultsConnector):
def __init__(self, api_client):
self.api_cli... | StarcoderdataPython |
55802 | <reponame>0xcrypto/webdetect
import os
from setuptools import setup
try:
from pypandoc import convert_file
read_md = lambda f: convert_file(f, 'rst', 'md')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
read_md = lambda f: open(f, 'r').read()
setup(
... | StarcoderdataPython |
1779628 | import time
from concurrent.futures.process import ProcessPoolExecutor as Executor
# from concurrent.futures.thread import ThreadPoolExecutor as Executor
def processar():
print('[', end='', flush=True)
for _ in range(1, 11):
print('#', end='', flush=True)
time.sleep(1)
print(']', end='', f... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.