id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11322828 | from django.contrib.auth.models import User
from django.core import mail
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils import timezone
from wagtail.core.models import Page
from wagtail_review.models import Comment, ExternalReviewer, Reviewer, Share
from .factories impo... | StarcoderdataPython |
11220425 | <reponame>luohenyueji/Python-Study-Notes
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 25 05:58:50 2020
bingioliu网站必应每日高清壁纸爬取
@author: luohenyueji
"""
import requests
from lxml import etree
from fake_useragent import UserAgent
import os
import time
# ----- 获得网页
def get_one_page(page_start):
print('当前爬取第{}页'.form... | StarcoderdataPython |
8080292 | # -*- coding: utf-8 -*-
# Copyright 2022 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 applicable law or... | StarcoderdataPython |
70329 | import logging
import h5py
import event_model
from suitcase import nxsas
from suitcase.nxsas.tests.rsoxs_run_documents import (
rsoxs_start_doc,
rsoxs_descriptor_en_doc,
rsoxs_event_page_en_doc,
)
techniques_md = {
"md": {
"techniques": [
# SAXS technique
{
... | StarcoderdataPython |
3373168 | def compare(idct1, idct2):
odct = {}
for key, value in idct1.items():
if key in idct2:
odct[key] = (idct1[key], idct2[key])
for key, value in idct2.items():
if key in idct1 and key not in odct:
odct[key] = (idct1[key], idct2[key])
return odct
| StarcoderdataPython |
3496934 | from datetime import timedelta
from threading import local
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from sentry.plugins import plugins
from sentry.plugins.sentry_mail.models import MailPlugin
from sentry.plugins.bases.notify import NotificationPlugin
from sentry.tasks.... | StarcoderdataPython |
12836253 | #!/usr/bin/env python2
# vim: set syntax=none nospell:
import subprocess
import os
import fnmatch
import datetime
from bottle import default_app, route, run, template, response, redirect, debug, error, static_file
from wraphtml import WrapHtml
# for WSGI use:
application = default_app()
# config option #
debug(Tru... | StarcoderdataPython |
3404711 | import mido
import mido.backends.rtmidi
class Midi:
def __init__(self, port_name):
""" Create a data stream from midi input """
self.notes = []
self.port = 0
self.port_name = port_name
try:
self.port = mido.open_input(self.port_name)
except IOError:
... | StarcoderdataPython |
1911945 | import os
import glob
import math
import random
import torch
import torch.nn as nn
import numpy as np
# import freesurfer as fs
import nibabel as nib
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from torchvision.datasets.vision import VisionDataset
from torchvision.datasets.utils import verify_s... | StarcoderdataPython |
5092757 | import os
import argparse
import pandas as pd
import time
import matplotlib.pyplot as plt
import traceback
import torch.optim as optim
from tqdm import trange
import threading
from utils import *
import cv2
from base_logger import logger
from fast import FAST
# 是否使用多线程显示图像
draw_threaded: bool = False
# 一些全局变量
g_fig =... | StarcoderdataPython |
8147615 | <gh_stars>10-100
__version__ = "2.4.0.dev"
| StarcoderdataPython |
5049202 |
import os
from datetime import timedelta
try:
from .local_settings import *
except ImportError:
pass
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
AUTH_USER_MODEL = 'accounts.User'
DEBUG = False
ALLOWED_HOSTS = ['10.0.27.142']
CORS_ORIGIN_ALLOW_ALL = True
REST_KNOX = {
'TOKEN_... | StarcoderdataPython |
8040749 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | StarcoderdataPython |
1630061 | <filename>sigopt/orchestrate/services/bag.py
class ServiceBag(object):
"""
A top-level container for all of our services. A service bag should be passed
around where needed to grant access to these services. This gives us
dependency injection, and lets us reuse services when they have a startup
cost (such as ... | StarcoderdataPython |
5007523 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python [conda env:bandit_38]
# language: python
# name: conda-env-bandi... | StarcoderdataPython |
142371 | <gh_stars>0
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | StarcoderdataPython |
8143061 | #!/usr/bin/env python
# TODO: Document how to use.
# TODO: Add list of the plugins which provides the mappings.
# TODO: Deal with multiple values.
# TODO: Deal with fixed values.
# TODO: Deal with conditional values.
# TODO: Deal with units
# TODO: Deal with expressions
# TODO: Deal with attributes in specialisation no... | StarcoderdataPython |
1710527 | <reponame>wuerges/mapnames<gh_stars>0
import numpy as np
def diff_view(str1, str2):
""" Calculate the lengths of the longest common prefix
and suffix between str1 and str2.
Let str1 = axb of length m and str2 = ayb of length n,
then this function finds and returns i and j such that:
str1[0:i] = s... | StarcoderdataPython |
5061662 | <reponame>shamilbi/curseradio
import curses
from curseradio.curseradio import OPMLBrowser
def main():
curses.wrapper(OPMLBrowser)
if __name__ == '__main__':
main()
| StarcoderdataPython |
3391138 | <reponame>RevansChen/online-judge
# Python - 3.6.0
test.assert_equals(f(1), 1)
test.assert_equals(f(100), 5050)
| StarcoderdataPython |
3428544 | import os
import json
import argparse
from transformers import BertTokenizer, BertModel
import copy
import re
# with open('./data/NCBI_Disease/mentions_candidates_tfidf.json') as f:
# mentions_candidates_tfidf = json.load(f)
def preprocess_data(data_dir):
tokenizer = BertTokenizer.from_pretrained... | StarcoderdataPython |
6666421 | <gh_stars>1-10
for num in range(1, 5 + 1):
print(num)
| StarcoderdataPython |
9692933 | import numpy as np
import snc.utils.snc_types as types
from typing import Set
def is_pull_model(model_type: str) -> bool:
"""
Function determines whether network is a pull model by checking the model type string.
"""
return model_type == 'pull'
def get_dynamic_bottlenecks(w: types.WorkloadSpace,
... | StarcoderdataPython |
1909436 | # -*- coding: utf-8 -*-
# @File : pca_utils.py
# @Author : <NAME>
# @Time : 2021/11/4 上午6:43
# @Disc :
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from typing import Any
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler
def plot_pca_res(train: p... | StarcoderdataPython |
2262 | <filename>Examples/Space Truss - Nodal Load.py
# Engineering Mechanics: Statics, 4th Edition
# <NAME>
# Problem 6.64
# Units for this model are meters and kilonewtons
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
truss = FEMod... | StarcoderdataPython |
8020617 | <reponame>mbsariyildiz/resnet-pytorch
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as transforms
def create_loaders(args):
if args.dataset == 'cifar10':
n_classes = 10
norm_mean, norm_std = (0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)
dset = torchvision.d... | StarcoderdataPython |
339989 | from datetime import datetime
from django.shortcuts import get_object_or_404
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic import dates
from models import Section
from pressroom.models import Article
class SectionListView(ListVie... | StarcoderdataPython |
8168684 | #!/usr/bin/env python
"""Tests for the access control mechanisms."""
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
# pylint: enable=unused-import,g-bad-import-order
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import d... | StarcoderdataPython |
1685964 | import html
import json
import logging
import re
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from .utils import *
from .upload import uploadFile
from . import auth
CALL_INTERVAL = 0.35
MAX_CALLS_IN_EXECUTE = 25
def retOrCall(s, *p):
return s(*p) if callable(s) else... | StarcoderdataPython |
1711695 | # encoding: utf-8
"""
Example RESTful API Server.
"""
from flask import Flask
def create_app(**kwargs):
"""
Entry point to the Flask RESTful Server application.
"""
# Initialize the Flas-App
app: Flask = Flask(__name__, **kwargs)
# Load the config file
app.config.from_object('config.Deve... | StarcoderdataPython |
9721477 | <reponame>Sirius2051/atbash
class Exponential:
def __init__(self):
self.rules = ""
def Convertion(self, text):
pass
| StarcoderdataPython |
4975263 |
# Define the network client
from xrpl.clients import JsonRpcClient
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/"
client = JsonRpcClient(JSON_RPC_URL)
# Create a wallet using the testnet faucet:
# https://xrpl.org/xrp-testnet-faucet.html
from xrpl.wallet import generate_faucet_wallet
test_wallet = generate_... | StarcoderdataPython |
11330528 | <gh_stars>100-1000
import getpass
import datetime
import os
import six
import pytest
from px import px_process
from . import testutils
import sys
if sys.version_info.major >= 3:
# For mypy PEP-484 static typing validation
from typing import MutableSet # NOQA
def test_create_process():
process_builder... | StarcoderdataPython |
4902524 | <reponame>a84885640/Python
import re
pattern = re.compile('ell')
print(pattern.match('hello world'))
print(pattern.match('hello world', 1))
result = pattern.match('hello world', 1)
| StarcoderdataPython |
4956382 | #!/usr/bin/env python3
"""
Copyright (c) 2019, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions a... | StarcoderdataPython |
1936068 | <filename>blogs/admin.py<gh_stars>0
from django.contrib import admin
from .models import Article, ListItem, CountdownItem
class ListItemAdmin(admin.StackedInline):
model = ListItem
class CountdownItemAdmin(admin.StackedInline):
model = CountdownItem
class ArticleAdmin(admin.ModelAdmin):
list_display ... | StarcoderdataPython |
3222187 | <reponame>jeffsgrover/twitter-bot-python-heroku
#!/usr/bin/env python
# coding: utf-8
import json
import random
import time
import sys
import tweepy
import credentials
import urllib.request
from os import environ
import gc
CONSUMER_KEY = credentials.CONSUMER_KEY
CONSUMER_SECRET = credentials.CONSUMER_SECRET
ACCESS_KEY... | StarcoderdataPython |
267316 | <gh_stars>1-10
from pypinyin.standard import convert_finals
from pypinyin.style._constants import _INITIALS
from pypinyin.style._constants import _INITIALS_NOT_STRICT
from pypinyin.style._constants import PHONETIC_SYMBOL_DICT
from pypinyin.style._constants import PHONETIC_SYMBOL_DICT_KEY_LENGTH_NOT_ONE
from pypinyin.st... | StarcoderdataPython |
3481313 | <filename>pyrolite_meltsutil/automation/__init__.py
"""
This submodule contains functions for automated execution of alphamelts 1.9.
Issues
------
* names are truncated for modifychem melts files?
* need a timeout so processes can keep going, add unfinished experiments to failed list
"""
import itertools
from... | StarcoderdataPython |
6478236 | <filename>cpol_processing/phase.py
"""
Codes for correcting the differential phase and estimating KDP.
@title: phase
@author: <NAME> <<EMAIL>>
@institutions: Monash University and the Australian Bureau of Meteorology
@date: 08/02/2020
.. autosummary::
:toctree: generated/
_fix_phidp_from_kdp
phidp_bringi... | StarcoderdataPython |
3550416 | from aiohttp.web import Response, json_response
from functools import wraps
from flask import current_app
from uuid import UUID
import sentry_sdk
from zeus import auth
from zeus.exceptions import InvalidPublicKey, UnknownRevision
from zeus.utils.sentry import span
from .utils import get_vcs, save_revision
def log_... | StarcoderdataPython |
3238003 | <reponame>Minkov/python-web-2020-09
from urllib import parse
def get_protocol(scheme):
if scheme in ('http', 'https'):
return scheme
return None
def get_host(netloc):
if '.' not in netloc:
return None
if ':' in netloc:
return netloc.split(':')[0]
return ne... | StarcoderdataPython |
1670763 | import sys
import os
import logging
from datetime import datetime
from db.db import Database
from telegram.telegram import TelegramBot
# Log level 1 is INFO, Log level 2 is Debug
loglevel = int(os.environ.get('loglevel'))
# Database password
dbpassword = os.environ.get('POSTGRES_PASSWORD')
# Telegram API Token
telegra... | StarcoderdataPython |
1921266 | # Copyright 2012 OpenStack Foundation
# 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 requ... | StarcoderdataPython |
3575325 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import asyncio
from typing import Any, Dict, Optional, cast
from aiokafka import AIOKafkaConsumer
from aiokafka.errors import KafkaError
from ..exceptions import (
ClientRestartError,
ClientRuntimeError,
ClientStoppedError,
... | StarcoderdataPython |
4888345 | <reponame>mjoppich/miRExplore
import sys
from collections import defaultdict
class RelexParser:
def __init__(self):
self.sent2res = defaultdict(list)
@classmethod
def loadFromFile(cls, filename):
ret = RelexParser()
with open(filename) as fin:
relMode = False
... | StarcoderdataPython |
8173102 | # -*- coding: UTF-8 -*-
""" Generates and decodes an unique invoice id, which can use characters
to shorten its length.
Author: <NAME>
Date: December 2008
Usage: >>> encode(1)
"488KR"
Description: Invoice numbers like "0000004" are unprofessional in that they
expose how m... | StarcoderdataPython |
9702300 | """
Large-scale version of population.py
"""
import pandas as pd
import numpy as np
import humanleague
import neworder
import ethpop
from helpers import *
class Microsynth:
def __init__(self, countries):
country_lookup = pd.read_csv("./examples/world/data/CountryLookup.csv", sep="\t").set_index("Code")["Count... | StarcoderdataPython |
179995 | <gh_stars>0
class Test:
def __init__(self, text):
self.text = text
def text(self):
return self.text
| StarcoderdataPython |
8072037 | <reponame>jeremiedecock/snippets<gh_stars>10-100
def setup():
size(640, 480)
smooth()
def draw():
ellipse(50, 50, 80, 80)
| StarcoderdataPython |
4849267 | <gh_stars>1-10
import os
import uuid
from django.db import models
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
class CaseInsensitiveTextField(models.TextField):
description = _("Case insensitive text")
def db_type(self, connection):
ret... | StarcoderdataPython |
395969 | <reponame>Yomguithereal/fog<filename>fog/cli/reporting/__init__.py<gh_stars>10-100
from fog.cli.reporting.html import print_html_report
from fog.cli.reporting.toml import print_toml_report
RENDERERS = {
'html': print_html_report,
'toml': print_toml_report
}
| StarcoderdataPython |
6536570 | ## Python Classes project 3 - Musician.py
# PARENT CLASS:
class Musician(object):
def __init__(self, sounds):
self.sounds = sounds
def solo(self, length):
for i in range(length):
print(self.sounds[i % len(self.sounds)], end=" ")
print()
# CHILD CLASSES:
class Bassist(... | StarcoderdataPython |
1846150 | <reponame>kieranrcampbell/curver-python
"""
Main Curver file:
Curve reconstruction from noisy data
Based on "Curve reconstruction from unorganized points",
In-<NAME>, Computer Aided Geometric Design 17
<EMAIL>
"""
import numpy as np
import statsmodels.api as sm
from scipy.optimize import minimize
"""
NB in general... | StarcoderdataPython |
3331182 | <gh_stars>10-100
import tensorflow as tf
from tensorflow.contrib import rnn
import numpy as np
import matplotlib.pyplot as plt
class VarDropoutEmbedding(object):
def __init__(self, input_size, layer_size, batch_size, name="embedding"):
self.name = name
self.input_size = input_size
self.laye... | StarcoderdataPython |
12834237 | from typing import Any, Dict
from ....models.models import Speaker
from ....permissions.permissions import Permissions
from ....shared.patterns import FullQualifiedId
from ...generics.delete import DeleteAction
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
@register_ac... | StarcoderdataPython |
3222204 | # ToolKit criado por Pharaoh
# Versão 0.0.5 (2017) [Ter, 11 Jul 19:12:03]
# Linguagem = PT-BR
# Novo na versão 0.0.4:
# Atualização para PEP8.
# Correção de bugs.
# Adicionado Fibonacci no mudulo Calculadora.
# Adicionado Numeros primos no modulo Calculadora.
# Adicionado nova opção no menu principal, python.
#
# ----... | StarcoderdataPython |
3297723 | <reponame>brianherman/data-act-broker-backend<filename>dataactcore/migrations/versions/b8bf72c05b0f_historical_load_derivations_changes.py
"""Historical Load Derivations Changes
Revision ID: b8bf72c05b0f
Revises: 1fc4844837cf
Create Date: 2017-09-18 13:01:50.097333
"""
# revision identifiers, used by Alembic.
revisi... | StarcoderdataPython |
8116057 | <reponame>jaydenwindle/giftbit-python<filename>tests/test_giftbit.py<gh_stars>1-10
import os
import pytest
import vcr
from giftbit import GiftbitClient
@pytest.fixture
def brand_keys():
return ['brand', 'info']
@pytest.fixture
def brand_list_keys():
return ['brands', 'info', 'number_of_results', 'limit', 'off... | StarcoderdataPython |
5157281 | <reponame>areke/app<gh_stars>0
import numpy as np
import os
from flask import Flask, request, redirect, url_for
from werkzeug.utils import secure_filename
from sklearn.neighbors import NearestNeighbors
from vgg16 import VGG16
from keras.models import Model
import json
import cv2
app = Flask(__name__)
model = VGG16(weig... | StarcoderdataPython |
5041983 | """0002_News_pubdate
Revision ID: 4848a7d55a11
Revises: <PASSWORD>
Create Date: 2021-03-23 20:49:01.092430
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4848a7d55a11'
down_revision = 'f<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
#... | StarcoderdataPython |
5045761 | <gh_stars>1-10
# Link --> https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem
# Code:
def deleteNode(head, position):
if head and position != 0:
currentNode = head
while position > 1 and currentNode:
currentNode = currentNode.next
position -= 1
... | StarcoderdataPython |
9635736 | <reponame>City-of-Helsinki/youth-membership
from django.core.management.base import BaseCommand
from django_ilmoitin.models import NotificationTemplate
from common_utils.utils import generate_notifications
class Command(BaseCommand):
help = "Generates notifications from templates"
def add_arguments(self, pa... | StarcoderdataPython |
4833297 | #-*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns("spirit.views.topic_poll",
url(r'^update/(?P<pk>\d+)/$', 'poll_update', name='poll-update'),
url(r'^close/(?P<pk>\d+)/$', 'poll_close', name='poll-close'),
url(r'^vote/(?P<pk>\d+)/$', 'poll_vote', name='poll-vote'),
... | StarcoderdataPython |
4920680 | from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.slider import Slider
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.slider import Slider
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle, Color, Line
from kivy.properties im... | StarcoderdataPython |
103605 | <reponame>kubawolanin/Sony-PMCA-RE<gh_stars>1000+
import abc
from collections import namedtuple
from ...util import *
USB_CLASS_PTP = 6
USB_CLASS_MSC = 8
USB_CLASS_VENDOR_SPECIFIC = 255
UsbDeviceHandle = namedtuple('UsbDeviceHandle', 'handle, idVendor, idProduct')
MSC_SENSE_OK = (0, 0, 0)
MSC_SENSE_ERROR_UNKNOWN = ... | StarcoderdataPython |
5004772 | # Generated by Django 2.2.13 on 2021-05-06 10:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0005_auto_20200306_1150'),
]
operations = [
migrations.AlterField(
model_name='plistcutoff',
name='year',
... | StarcoderdataPython |
3392586 | import sys
import os
import cv2 # it is necessary to use cv2 library
import numpy as np
def SubImg( x, y ):
dif = x - y
dif = np.sqrt( np.sum( dif * dif, axis=2 ) )
msk = ( dif > 10 ).astype(np.uint8)*255
kernel = np.ones((3,3),np.uint8)
# opening
msk = cv2.erode(msk, kernel,iterations = 1)
... | StarcoderdataPython |
3543908 | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | StarcoderdataPython |
4880762 | <filename>tests/test_json_http_resp.py
from mock import MagicMock
from lambda_decorators import json_http_resp
def test_json_http_resp_no_response():
@json_http_resp
def hello(example, context):
return
assert hello({}, MagicMock()) == {"statusCode": 200, "body": "null"}
| StarcoderdataPython |
9799023 | <reponame>rcsb/py-rcsb_app_file
##
# File: JWTAuthBearer.py
# Date: 23-Aug-2021
#
##
import logging
import os
from fastapi import HTTPException
from fastapi import Request
from fastapi.security import HTTPAuthorizationCredentials
from fastapi.security import HTTPBearer
from rcsb.app.file.JWTAuthToken import JWTAuthTo... | StarcoderdataPython |
191613 | import re
import urllib2
from bs4 import BeautifulSoup
'''
Created on Oct 29, 2013
@author: <NAME>
'''
class WindSpot(object):
def __init__(self, name=None, spotMetrics=None):
if spotMetrics is None:
spotMetrics = []
self.name = name
self.spotMetrics = spotMetrics
... | StarcoderdataPython |
4935421 | <filename>lib/console.py
"""console.py"""
import os
import time
import sys
class Console(object):
"""Console class"""
def clear(self):
"""Clear"""
os.system('cls' if os.name == 'nt' else 'clear')
def simulate_typing(self, message):
"""Simulate typeing"""
for offset in ra... | StarcoderdataPython |
6691121 | <reponame>colesbury/pglast<filename>pglast/enums/xml.py
# -*- coding: utf-8 -*-
# :Project: pglast -- DO NOT EDIT: automatically extracted from xml.h @ 13-2.1.0-0-gd1d0186
# :Author: <NAME> <<EMAIL>>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017-2021 Lele Gaifax
#
from enum impo... | StarcoderdataPython |
1847563 | <reponame>nikolabebic95/LoopsOptimizationTests<filename>Python/src/cuda_sine/out.py
import numba
import numpy as np
import math
import sys
from time import time
# WARNING!!!
# This code assumes that all types passed to this function are floats.
# If the actual types are not all float64, you must edit the correspondin... | StarcoderdataPython |
3529319 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... | StarcoderdataPython |
11344171 | <reponame>biocore/microsetta-private-api
import unittest
from microsetta_private_api.model.vioscreen import (
VioscreenSession, VioscreenDietaryScore,
VioscreenDietaryScoreComponent)
from microsetta_private_api.repo.transaction import Transaction
from microsetta_private_api.repo.vioscreen_repo import (
Vios... | StarcoderdataPython |
107013 | <reponame>LuomingXu/selfusepy
from selfusepy.log import Logger
def log_test():
log = Logger().logger
log.info('third')
| StarcoderdataPython |
1814200 | from httpx import AsyncClient
from starlette import status
from app.core.config import settings
async def test_ingredient_create(async_client: AsyncClient):
"""Test that ingredient can be created"""
url = f"{settings.api_version}/ingredients/"
payload = {"ingredient": "tomato"}
response = await asyn... | StarcoderdataPython |
6565454 | <filename>discord/types/invite.py
"""
The MIT License (MIT)
Copyright (c) 2015-2021 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the ri... | StarcoderdataPython |
3489410 | <gh_stars>1-10
import logging
import argparse
from vcd import VCDWriter
from enum import IntEnum
from nmigen import *
from nmigen.lib.cdc import FFSynchronizer
from ... import *
class TAPInstruction(IntEnum):
idCode = 0x3
pdiCom = 0x7
bypass = 0xf
class PDIOpcodes(IntEnum):
(
LDS, LD, STS, ST,
LDCS, REPEAT, ... | StarcoderdataPython |
6509284 | <gh_stars>1-10
import torch
import numpy as np
from trainer import TrainingConfig, Trainer
from dataset import CIFAR10
from model import ConvNet
from torchvision.transforms import Compose,ToTensor,RandomHorizontalFlip,RandomRotation,ColorJitter,Normalize
train_set = CIFAR10(root="./cifar-10-batches-py",train=Tr... | StarcoderdataPython |
11276171 | <reponame>udcymen/leetcode
class Solution:
def missingNumber(self, nums: List[int]) -> int:
if not nums:
return
l = len(nums)
expectSum = l * (l + 1) // 2
actualSum = sum(nums)
return expectSum - actualSum | StarcoderdataPython |
2363 | import pytest
from nbformat.v4.nbbase import new_notebook, new_markdown_cell, new_code_cell, new_raw_cell
from jupytext.compare import compare_notebooks, NotebookDifference, test_round_trip_conversion as round_trip_conversion
def test_raise_on_different_metadata():
ref = new_notebook(metadata={'kernelspec': {'lan... | StarcoderdataPython |
6425883 | <gh_stars>1-10
"""This module contains the Material LinearProgress and CircularProgress"""
import param
from awesome_panel_extensions.frameworks._base.progress import Progress as _BaseProgress
_ATTRIBUTES_TO_WATCH_BASE = {"class": "bar_color"}
_PROPERTIES_TO_WATCH_BASE = {
"indeterminate": "active",
"progress... | StarcoderdataPython |
1900500 | <filename>backends/paltoodl/rev20150404/backend.py
#!/usr/bin/env python3
from .odl_adapter import ODLAdapter
from palto.rfc7285 import AbstractNetworkMapBackend
from palto.ird import BasicIRDResource
from palto import palto_config
from palto import errors
import logging
ODL_INFO = ['revision', 'type', 'host', 'user... | StarcoderdataPython |
6490606 | from django.db import models
class Message(models.Model):
title = models.CharField('Заголовок', max_length=50)
body = models.TextField('Тело сообщения')
date = models.DateField('Дата сообщения')
def __str__(self):
return self.title
class Meta:
verbose_name = 'Сообщение'
v... | StarcoderdataPython |
6492773 | # Copyright (c) OpenMMLab. All rights reserved.
from .bbox_head import BBoxHead
from .convfc_bbox_head import (ConvFCBBoxHead, Shared2FCBBoxHead,
Shared4Conv1FCBBoxHead)
from .dii_head import DIIHead
from .double_bbox_head import DoubleConvFCBBoxHead
from .sabl_head import SABLHead
from .... | StarcoderdataPython |
9750640 | <reponame>andylolz/IATI-Standard-Website
"""Settings for production environments (overrides base settings)."""
from .base import * # noqa: F401, F403 # pylint: disable=unused-wildcard-import, wildcard-import
DEBUG = False
try:
from .local import * # noqa: F401, F403 # pylint: disable=unused-wildcard-import, ... | StarcoderdataPython |
4952845 | <filename>backend/forms/views.py
import json
import traceback
from datetime import datetime
import pytz
from dateutil.parser import parse
from django.http import Http404
from berkeleytime.utils.requests import render_to_json
from forms.hooks import dispatch_hooks
from forms.googleapi import (
check_yaml_format,
... | StarcoderdataPython |
1870389 | """Implement random accelerated molecular dynamics (RAMD) in OpenMM."""
from . import _version
__version__ = _version.get_versions()['version'] | StarcoderdataPython |
5073553 | from rest_framework import viewsets
from .serializers import SpaceSerializer
from .models import Space
from .filters import FilterSpaces
class SpaceViewset(viewsets.ModelViewSet):
queryset = Space.objects.all()
serializer_class = SpaceSerializer
filter_backends = [FilterSpaces]
| StarcoderdataPython |
8062498 | import enum
# *********************************************** Clase Enum ***********************************************
#Enum para los tipos de datos
class Data_Type(enum.Enum):
numeric = 1
character = 2
data_time = 3
boolean = 4
enumerated = 5
non = 6
error = 7
# *************************... | StarcoderdataPython |
11384945 | import os
from urllib.parse import urlparse, parse_qs
import requests
def check_error_response(response, expected_msg):
"""Checks an error response for structure and content
This function uses assert for its checks.
params:
response: A requests.Response object
expected_msg: A string with... | StarcoderdataPython |
8052341 | # -*- coding: utf-8 -*-
"""
Map tile acquisition
--------------------
Demonstrates cartopy's ability to draw map tiles which are downloaded on
demand from the Stamen tile server. Internally these tiles are then combined
into a single image and displayed in the cartopy GeoAxes.
"""
__tags__ = ["Scalar data"]
import m... | StarcoderdataPython |
4969832 | <gh_stars>1-10
"""Generated client library for container version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.container.v1 import container_v1_messages as messages
class ContainerV1(base_api.BaseApiClient):
"""... | StarcoderdataPython |
11362459 | def test_DBN():
from test_cy_DBN import run_tests
run_tests()
| StarcoderdataPython |
11263471 | <filename>python/tvm/tir/transform/transform.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Licen... | StarcoderdataPython |
8099543 | <reponame>aidanbharath/dolfyn<filename>dolfyn/rotate/awac.py<gh_stars>10-100
from .vector import inst2earth, earth2principal
from .rdi import beam2inst
| StarcoderdataPython |
9703918 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2019, <NAME> <akoenzen | uvic.ca>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.