id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3228691
<filename>checks/checksls.py import yaml import sys from jinja2 import Environment, PackageLoader, Template import os def check(fn): print("Consider {0}".format(fn)) r = os.system("~/.local/bin/pylint -E --rcfile=pylint.rc %s" % fn) if r not in (0, 512) : # 512= check failed raise Exception('fail ...
StarcoderdataPython
3290955
# -*- coding: utf-8 -*- """ Created on Mon Sep 18 18:17:19 2017 @author: HCHO """ #collections 和 counter #problem:关于停词和词频的选择 import re import string import operator import os class nGramAlgo(object): def __init__(self,fiction): self.fiction=fiction #剔除常用字函数(停词) def isCommon(self,ngram...
StarcoderdataPython
40288
import itertools import pathlib from pathlib import Path from typing import Union import gdspy from gdsfactory.component import Component from gdsfactory.import_gds import import_gds COUNTER = itertools.count() def xor_polygons(A: Component, B: Component, hash_geometry: bool = True): """Given two devices A and...
StarcoderdataPython
4837531
# Copyright (c) 2016-2017 Anki, 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
1635499
<filename>tests/globimap_test.py import unittest import globimap as gm class MainTest(unittest.TestCase): def test_instance(self): m = gm.globimap() self.assertEqual(m, m) def test_configure(self): m = gm.globimap() m.configure(12, 20) self.assertEqual(m.d...
StarcoderdataPython
3271275
#!/usr/bin/python # -*- coding: utf8 -*- import os import psycopg2 import time # Создание картинки с картой маршрутов Московского трамвая # Необходим tilemill, который будет генерировать подложку, и накладываемую карту линий. def cleardb(): dbname='osmot' user='user' host='localhost' password='<P...
StarcoderdataPython
19592
import json from aleph.tests.util import TestCase class DocumentsApiTestCase(TestCase): def setUp(self): super(DocumentsApiTestCase, self).setUp() self.load_fixtures('docs.yaml') def test_index(self): res = self.client.get('/api/1/documents') assert res.status_code == 200, r...
StarcoderdataPython
192371
#!/usr/bin/env python3 import torch from .. import settings from ..lazy import LazyTensor class NonLazyTensor(LazyTensor): def __init__(self, tsr): """ Not a lazy tensor Args: - tsr (Tensor: matrix) a Tensor """ if not torch.is_tensor(tsr): raise Runti...
StarcoderdataPython
132663
<reponame>rodel-talampas/gpdb<filename>src/test/tinc/tincrepo/mpp/gpdb/tests/package/contrib/pgcrypto/functional/__init__.py """ Copyright (c) 2004-Present Pivotal Software, Inc. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License");...
StarcoderdataPython
1662559
<gh_stars>1-10 # -*- coding: utf-8 -*- import urllib from bs4 import BeautifulSoup class CrearDiccionario: """ Clase que crea un diccionario de manera automática Args: modusuario: instancia de la clase modelo """ def __init__(self, modusuario): self.mod = modu...
StarcoderdataPython
172938
<gh_stars>0 from .augment import KPImageAug from .dataset import Dataset from .utils import utils
StarcoderdataPython
158114
<filename>datatrans/structured_data/video.py """ https://developers.google.com/search/docs/data-types/video """ from typing import Iterable, Union from datatrans.structured_data.base import URL, Date, Property, Text, Thing from datatrans.structured_data.lower.interaction_counter import \ InteractionCounter from da...
StarcoderdataPython
1677633
import numpy as np print('----> starts here') #create array of ten zeros my_array = np.zeros(10) print(my_array) print('---------') #create array of ten ones my_array = np.ones(10) print(my_array) print('---------') #create array of ten fives my_array = np.ones(10) * 5 print(my_array) print('---------') #create a...
StarcoderdataPython
3293211
"""MasterTherm Controller, for handling MasterTherm Data.""" import logging from .connection import Connection from .const import ( CHAR_MAP, DEVICE_DATA_MAP, DEVICE_DATA_PADMAP, DEVICE_INFO_MAP, DEVICE_SWITCH_MAP, PAD_MAP, SUPPORTED_ROLES, ) from .exceptions import MasterThermUnsupportedRo...
StarcoderdataPython
7803
<filename>keystone/tests/unit/token/test_provider.py # 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
144012
import numpy as np from math import inf as infinity from itertools import product from collections import defaultdict import random import time # Initializing the Tic-Tac-Toe environment # Three rows-Three columns, creating an empty list of three empty lists state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ...
StarcoderdataPython
166974
<reponame>rahulmkumar/ZeroSim1 import shelve import pandas as pd class Watchlist(object): def __init__(self, list_name, l_sym): self.watchlist_name = list_name self.l_symbols = l_sym def get_watchlist_name(self): return self.watchlist_name def get_watchlist_sym(self): ret...
StarcoderdataPython
3282958
<gh_stars>0 # --coding:utf-8-- # # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. import pytest from tests.common.nebula_test_suite import NebulaTestSuite class TestConfigs(NebulaTestSuite): @classmethod def prepare(self): pass @cl...
StarcoderdataPython
3348272
import unittest class Solution: def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ s_to_t = [0] * 256 t_to_s = [0] * 256 for a, b in zip(s, t): a, b = ord(a), ord(b) b2 = s_to_t[a] a2 = t_...
StarcoderdataPython
3302845
<reponame>bfYSKUY/Adafruit_CircuitPython_NeoPixel # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT # This example shows how to create a single pixel with a specific color channel # order and blink it. # Most NeoPixels = neopixel.GRB or neopixel.GRBW # The 8mm Diffused NeoPi...
StarcoderdataPython
91264
description = 'Actuators and feedback of the shutter, detector, and valves' group = 'lowlevel' excludes = ['IOcard'] devices = dict( I1_pnCCD_Active = device('nicos.devices.generic.ManualSwitch', description = 'high: Detector is turned on', states = [0, 1], ), I2_Shutter_safe = device('ni...
StarcoderdataPython
1645533
# Write your solution for algorithm 3 below
StarcoderdataPython
3213431
<filename>webots_ros2_core/webots_ros2_core/laser_publisher.py # Copyright 1996-2019 Cyberbotics Ltd. # # 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/LI...
StarcoderdataPython
4805373
import typing import strawberry import api.mutation as mutation import api.query as query from .type import Beach @strawberry.type class Query: beach: typing.Optional[Beach] = strawberry.field(resolver=query.beach) beaches: typing.List[Beach] = strawberry.field(resolver=query.beaches) @strawberry.type cl...
StarcoderdataPython
3255310
import abc from typing import * from .error import Error from .typevar import * __all__ = [ 'Result', 'Ok', 'Err', 'IResult', 'IOk', 'IErr', ] class Result(Generic[T, E], metaclass=abc.ABCMeta): """ enum Result<T> { Ok(T), Err(E), } """ def is_ok(self) -...
StarcoderdataPython
104923
<reponame>ckamtsikis/cmssw from DPGAnalysis.Skims.goodvertexSkim_cff import * ###Tracks selection trackSelector =cms.EDFilter("TrackSelector", src = cms.InputTag("generalTracks"), cut = cms.string('quality("highPurity")') ...
StarcoderdataPython
1692840
<gh_stars>0 from datetime import date """ ano = int(input('Digite um ano: ')) if ano % 4 != 0: ano % 400 != 0 print(f'O ano de {ano} NÃO É bissextu') else: print(f'O ano de {ano} É bissextu') #POS CORREÇÃO -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- """ ano = int(input('Que ano quer analisar? ...
StarcoderdataPython
3371500
<reponame>GSK-AI/meta-learning-qsar<gh_stars>10-100 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Featurizer for graph convolutional neural networks""" from collections import OrderedDict import numpy as np from src.featurizer.molgraph import MolGraph def featurize_df( data_df, smiles_col, output...
StarcoderdataPython
3259199
def max_min(numbers): if len(numbers) == 1: return numbers[0], numbers[0] elif len(numbers) == 2: return max(numbers[0], numbers[1]), min(numbers[0], numbers[1]) else: mid = int(len(numbers)/2) (max1, min1) = max_min(numbers[:mid]) (max2, min2) = max_min(numbers[mid:...
StarcoderdataPython
3273342
<gh_stars>0 from rest_framework.generics import ( ListAPIView, CreateAPIView, RetrieveAPIView, RetrieveDestroyAPIView ) from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework import status from django.contrib.gis.db.models.functions import Distance fr...
StarcoderdataPython
3386622
<reponame>androm3da/clang_sles<filename>3.7.0/lldb-3.7.0.src/test/functionalities/stop-hook/TestStopHookMechanism.py """ Test lldb target stop-hook mechanism to see whether it fires off correctly . """ import os import unittest2 import lldb from lldbtest import * class StopHookMechanismTestCase(TestBase): mydir ...
StarcoderdataPython
4825508
<gh_stars>10-100 import numpy as np from .tensor import Tensor __all__ = ['eq'] def eq(input: Tensor, target: Tensor) -> Tensor: if input.shape != target.shape: raise ValueError( "Expected input shape ({}) to match target shape ({}).".format(input.shape, target.shape) ) return Ten...
StarcoderdataPython
3241577
<filename>grapy/store/base/record.py class RecordValidation(type): def __new__(mcs, name, bases, class_dict): if bases != (object,): if '__iter__' not in class_dict: raise TypeError('Record implementation has to provide __iter__ method') return type.__new__(mcs, name, ba...
StarcoderdataPython
1628814
# -*- coding: utf-8 -*- from .pure_pynacl import TypeEnum, integer, Int, IntArray from .pure_pynacl import tweetnacl from .pure_pynacl.tweetnacl import u8 from .saltlib_base import SaltLibBase class SaltLibPure(SaltLibBase): @staticmethod def isAvailable(): import importlib.util mod = import...
StarcoderdataPython
3286344
import tensorflow as tf # tf.config.experimental_run_functions_eagerly(True) # tf.enable_eager_execution() # print(tf.executing_eagerly()) from tensorflow.keras import backend as K smooth = 1. # # def tversky_loss(y_true, y_pred): # alpha = 0.5 # beta = 0.5 # # ones = tf.ones(tf.shape(y_true)) # p0 = y...
StarcoderdataPython
3295485
import os import obspy import pickle import numpy as np import scipy.integrate as ig import matplotlib.pyplot as plt from matplotlib.ticker import StrMethodFormatter, NullFormatter from mtspec import mtspec from . import utils as ut from . import config as cfg # VARIABLES READ FROM CONFIG SUPPORTED_SAVE_METHODS = ['p...
StarcoderdataPython
3331834
# Copyright (c) 2011, <NAME> [see LICENSE.txt] # This software is funded in part by NIH Grant P20 RR016454. # Python 2 to 3 workarounds import sys if sys.version_info[0] == 2: _strobj = str _xrange = xrange elif sys.version_info[0] == 3: _strobj = str _xrange = range # std lib import math from colle...
StarcoderdataPython
3395382
<reponame>darpa-l2m/l2logger """ Copyright © 2021-2022 The Johns Hopkins University Applied Physics Laboratory LLC 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 ...
StarcoderdataPython
57305
# Importing external package dependency: import os import logging from datetime import datetime from flask import Flask, render_template, request, url_for, redirect, flash, session, abort, jsonify from flask_migrate import Migrate from flask_login import LoginManager, AnonymousUserMixin from flask_mail import Ma...
StarcoderdataPython
3255986
<reponame>remicongee/Mint<filename>mint/modules/flat.py ## Flattern import numpy as np from .module import Module from ..utils import functional as F class Flat(Module): def __init__(self): super(Flat, self).__init__() self.in_size = None def forward(self, input): if self.traini...
StarcoderdataPython
1695187
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('communication', '0026_auto_20161026_1812'), ] operations = [ migrations.CreateModel( name='Letter', ...
StarcoderdataPython
3231822
<filename>2019/src/Advent2019_12.py # Advent of Code 2019 # # From https://adventofcode.com/2019/day/12 # import re from itertools import combinations import numpy as np class Moon(object): def __init__(self, positions, velocities=[0, 0, 0]): self.positions = positions[:] self.velocities = velo...
StarcoderdataPython
1774768
<gh_stars>1-10 # Please fill out this stencil and submit using the provided submission script. ## Problem 1 def myFilter(L, num): return [ n for n in L if n%num != 0 ] ## Problem 2 def myLists(L): return [ list(range(1,n+1)) for n in L] ## Problem 3 def myFunctionComposition(f, g): return {k:g[f[...
StarcoderdataPython
172334
<reponame>Advik-B/YoutubeVideo-Downloader from threading import Thread from platform import system from subprocess import run from time import sleep import os try: from functions import * from search import * from sounds import * from PIL import Image except ModuleNotFoundError: run('python -m pip i...
StarcoderdataPython
3338441
import base64 import os import datetime import plaid import json import time from flask import Flask from flask import render_template from flask import request from flask import jsonify app = Flask(__name__) # Fill in your Plaid API keys - https://dashboard.plaid.com/account/keys PLAID_CLIENT_ID = os.getenv('PLAID_...
StarcoderdataPython
3235277
<gh_stars>0 import json from bs4 import BeautifulSoup from django.contrib.auth import get_user_model from django.core.urlresolvers import reverse from django.test import TestCase, RequestFactory from django.test.client import Client from django.utils.text import slugify from molo.core.models import (Languages, Main, Si...
StarcoderdataPython
26506
from sklearn.datasets import load_wine from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression wine = load_wine(as_frame=True) X, y = wine.data, wine.target X_train, X_test, y_train, y_test = train_test_split( X, y...
StarcoderdataPython
3227034
<filename>pokerthproto/transport.py # -*- coding: utf-8 -*- """ The low-level transport functionality for packing/unpacking and enveloping/ developing messages. """ from __future__ import print_function, absolute_import, division from .pokerth_pb2 import PokerTHMessage __author__ = '<NAME>' __copyright__ = '<NAME>' ...
StarcoderdataPython
3316781
<gh_stars>1-10 import math from typing import Optional, Tuple import torch from torch import nn class Idomp(nn.Module): @staticmethod def forward(x: torch.Tensor) -> torch.Tensor: return x class LinearWithActivation(torch.nn.Module): def __init__( self, in_dim: int, out...
StarcoderdataPython
131001
<gh_stars>0 class C: @staticmethod def baz(): print "hello world" @staticmethod def foo(): C.baz()
StarcoderdataPython
41320
from ... import helpers import ivy def test_eye(): # docstring test assert helpers.docstring_examples_run(ivy.eye) == True
StarcoderdataPython
86210
<gh_stars>1-10 #!/usr/bin/env python2 # The MIT License (MIT) # # Copyright (c) 2015 <NAME> # # 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 limitatio...
StarcoderdataPython
1606739
from dgdynamic.choices import SupportedStochasticPlugins, SupportedOdePlugins import importlib import warnings def tab_init(d): table = {} plugin_common_prefix = 'dgdynamic.plugins' for mode, plugin_dict in d.items(): table[mode] = {} plugin_mode_prefix = plugin_common_prefix + '.' + mode ...
StarcoderdataPython
109394
# -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding("utf-8") import os import json from PySide.QtCore import * from PySide.QtGui import * class SceneController(QObject): def __init__(self): super(SceneController,self).__init__() self.path = "" self.view = None self.needSave = False def...
StarcoderdataPython
3291597
<gh_stars>10-100 #!/usr/bin/env python3 import apsw as lite import os as os import tempfile import numpy as np import pandas as pd import bcolz as bcz import time import time from .Tools import log from .Config import cf from .Exceptions import CamocoExistsError from apsw import ConstraintError def busyhandler(num_p...
StarcoderdataPython
3231796
<gh_stars>0 # Copyright (c) 2007 The Regents of The University of Michigan # Copyright (c) 2010 The Hewlett-Packard Development Company # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistribu...
StarcoderdataPython
173731
#<NAME> # XII - B # 40 #WAP to display only those sentences which that start with #"The" from the text file hello.txt #function to add data to the file def addData(br): F = open("hello.txt", 'a+') F.writelines(br) F.close() #function to display all the required data given in the question def display...
StarcoderdataPython
167871
<reponame>hamburgcodingschool/L2C-1903 # CONCATENATION firstName = "Helder" lastName = "Pereira" fullName = "Helder" + " " + lastName print(fullName)
StarcoderdataPython
3325532
<filename>sdk/python/pulumi_azure_native/datashare/v20201001preview/_inputs.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import A...
StarcoderdataPython
75087
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import unittest from generator import generator, generate from extensions.ops.Cast import Cast from mo.middle.passes.convert_data_type import packed_U4, packed_I4 from mo.middle.passes.infer import partial_infer from ...
StarcoderdataPython
1681416
import sys from collections import defaultdict as d from optparse import OptionParser, OptionGroup import math #Author: <NAME> ######################################################### HELP ######################################################################### usage="""\npython %prog \ --mpileup data.mpi...
StarcoderdataPython
4827482
<reponame>zaltoprofen/chainer import pytest import chainerx def test_no_backprop_mode(): with chainerx.backprop_scope('bp1') as bp1, \ chainerx.backprop_scope('bp2') as bp2: assert chainerx.is_backprop_required() assert chainerx.is_backprop_required(bp1) assert chainerx.is_bac...
StarcoderdataPython
4816499
<reponame>NervanaSystems/ngraph-python<gh_stars>10-100 from __future__ import print_function import pytest import os import subprocess import re pytestmark = pytest.mark.flex_only @pytest.mark.parametrize("script_path, description, misclass_threshold", ( ("examples/mnist/mnist_mlp.py", "Check if MNIST MLP is tra...
StarcoderdataPython
3327135
# Generated by Django 3.2.6 on 2021-08-14 02:09 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('authentication', '0003_auto_20210812_1034'), ] operations = [ migrations.Al...
StarcoderdataPython
3354501
# -*- coding: utf-8 -*- """ Created on Sat Nov 2 14:43:16 2019 @author: kerma """ from sys import argv from fpdf import FPDF import json import csv def write_cover_letter(): # open csv file and read input with open("info.csv") as info_csv: reader = csv.reader(info_csv) for row in reader: ...
StarcoderdataPython
67426
<reponame>micro-fan/fan_tools from django.db.models import Index class LTreeIndex(Index): def create_sql(self, model, schema_editor, using='', **kwargs): """ Update ltree label path when parent/child relationships changed Taken from: https://github.com/peopledoc/django-ltree-demo ...
StarcoderdataPython
166228
<reponame>NeCTAR-RC/designate # Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: <NAME> <<EMAIL>> # # 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.apach...
StarcoderdataPython
3276665
<gh_stars>1-10 from spada.methods import method from spada.network import ensembl_transcript_network import os import pytest scriptPath = os.path.realpath(__file__) dataPath = os.path.dirname(scriptPath) + "/../../data/" txs = ensembl_transcript_network.ENSEMBLTranscriptNetwork('aName') txs.skip_filter = False def ...
StarcoderdataPython
1615549
<reponame>DayGitH/Python-Challenges """ The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square ...
StarcoderdataPython
137618
<reponame>ESA-VirES/eoxserver #------------------------------------------------------------------------------- # $Id$ # # Project: EOxServer <http://eoxserver.org> # Authors: <NAME> <<EMAIL>> # #------------------------------------------------------------------------------- # Copyright (C) 2013 EOX IT Services GmbH # #...
StarcoderdataPython
1796325
#or x in range(0,6): # for i in range(1,x+1): # print( i,end=" ") #print() #for x in range(0,6): #for i in range(1,x+1): # print( x,end=" ") #print() for x in range(0,6): for j in range(0,x+1): j+=65 print( char(j),end=" ") print()
StarcoderdataPython
3232116
# Code generated by `typeddictgen`. DO NOT EDIT. """V1PodDNSConfigDict generated type.""" from typing import TypedDict, List from kubernetes_typed.client import V1PodDNSConfigOptionDict V1PodDNSConfigDict = TypedDict( "V1PodDNSConfigDict", { "nameservers": List[str], "options": List[V1PodDNSCo...
StarcoderdataPython
1758494
<gh_stars>0 #!/usr/bin/env python TEST_INPUTS = """aa bb cc dd ee aa bb cc dd aa aa bb cc dd aaa""".split('\n') REAL_INPUT = """<paste inputs here>""".split('\n') PART_TWO_TEST_INPUT = """abcde fghij abcde xyz ecdab a ab abc abd abf abj iiii oiii ooii oooi oooo oiii ioii iioi iiio""".split('\n') def v...
StarcoderdataPython
1652379
import numpy a = numpy.array(input().split(), int) b = numpy.array(input().split(), int) print(numpy.inner(a, b), numpy.outer(a, b), sep = "\n")
StarcoderdataPython
1730116
<gh_stars>0 import cv2 import numpy as np def seuil(img, seuil): img[img < seuil] = 0 img[img >= seuil] = 255 return img def afficher(im, titre): cv2.imshow(titre, im) cv2.waitKey(0) # La fonction de callback de la souris # Le premier parametre decrit l'evenement de la souris qui a appele la fon...
StarcoderdataPython
145766
<filename>waverage.py<gh_stars>0 import numpy as np def waverage(x,sigx): # Weighted average # <NAME> # 2014-06-10 # References: http://en.wikipedia.org/wiki/Weighted_arithmetic_mean # http://stats.stackexchange.com/questions/47325/bias-correction-in-weighted-variance ax = np.array(x) ...
StarcoderdataPython
1771191
<reponame>kennartfoundation/flask_10<filename>Chapter01/banana_survey.py """A banana preferences survey written in Python with Tkinter""" import tkinter as tk # Create the root window root = tk.Tk() # set the title root.title('Banana interest survey') # set the root window size root.geometry('640x480+300+300') root...
StarcoderdataPython
86024
<reponame>jimfenton/datatracker<filename>ietf/doc/tests_js.py # Copyright The IETF Trust 2021, All Rights Reserved # -*- coding: utf-8 -*- import debug # pyflakes:ignore from ietf.doc.factories import WgDraftFactory, DocumentAuthorFactory from ietf.person.factories import PersonFactory from...
StarcoderdataPython
4811004
<filename>examples/celery_app/app.py<gh_stars>10-100 from flask import Flask, jsonify from flask_cors import CORS import tasks app = Flask(__name__) # Allow any origin CORS(app) @app.route('/') def index(): return 'Its working!' @app.route('/add/<int:x>/<int:y>', methods=['POST']) def add(x, y): task = ta...
StarcoderdataPython
3396215
import datetime as dt from textwrap import dedent from typing import Any, AsyncIterator, List, Optional import httpx import pytest from starlette.applications import Starlette from starlette.datastructures import URL from starlette.requests import Request from starlette.routing import Route import asgi_sitemaps @py...
StarcoderdataPython
197559
<filename>pymmrouting/routeplanner.py """ Find multimodal optimal paths with proper multimodal shortest path algorithms wrapped in pymmspa4pg """ from ctypes import CDLL, POINTER, \ c_double, c_char_p, c_int, c_void_p, c_longlong from .routingresult import RoutingResult, RawMultimodalPath, ModePath from .orm_...
StarcoderdataPython
3362121
from django.contrib import admin from .models import Contest, ContestInfo, Division, Kind, Problem, Tag # Register your models here. admin.site.register([Contest, ContestInfo, Division, Kind, Problem, Tag])
StarcoderdataPython
3333718
from abc import ABCMeta, abstractmethod class Fruit(metaclass=ABCMeta): @abstractmethod def taste(self): pass @abstractmethod def originated(self): pass class Apple(Fruit): def taste(self): return "Sweet" def originated(self): return "Central Asia" app...
StarcoderdataPython
1670451
#!/usr/bin/env python from __future__ import print_function import click import os import signal import sys import time from watchdog.observers import Observer from watchdog.tricks import AutoRestartTrick from aeriscloud.cli.aeris.sync import sync from aeriscloud.cli.helpers import standard_options, Command class ...
StarcoderdataPython
3247157
print('=='*20) print('10 TERMOS DE UM PA') print('=='*20) p = int(input('Primeiro termo: ')) r = int(input('Razão:',)) decimo= p+ (10-1)* r for c in range (p,decimo+r,r): print(c,end='->') print('Acabou') print('=='*20) print('10 TERMOS DE UM PA') print('=='*20) t=int(input('Primeiro termo: ')) r=i...
StarcoderdataPython
1616710
from subprocess import call import shutil import maskgen.exif from PIL import Image def emc_update_size(size,imageFile): width, height = size maskgen.exif.runexif(['-P', '-q', '-m', '-ExifImageWidth=' + str(width), '-ImageWidth=' + str(width), ...
StarcoderdataPython
3328011
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- ''' 系统随机生成一个1~100之间的整数,玩家有5次机会,每猜一次系统就会提示玩家该数字是偏大还是偏小, 如果猜中了,则告知玩家并提前结束游戏,如果5次都没猜中,结束游戏并告知正确答案。 ''' import random number = random.randint(1, 100) print("游戏开始!") chances = 5 while True: try: guess = int(input("请输入你的数字: ")) if guess == nu...
StarcoderdataPython
1737396
<gh_stars>0 import time import torch from torch import optim import matplotlib.pyplot as plt from common.util import sample, save_models from common.initialize import initialize, infer_iteration from . import model def disc_loss_generation(data, target, z_dim, eps, lp, critic1, critic2, generator, device): z = t...
StarcoderdataPython
1738746
from django.conf.urls import url from django.contrib import admin from . import views # 查询省市区数据 areas/ urlpatterns = [ url(r'^areas/$', views.AreasView.as_view()), ]
StarcoderdataPython
3255254
<gh_stars>0 from flask import Flask from flask import request app = Flask(__name__) @app.route('/user', methods=['GET']) def signin_form(): return 'user: csh' def registe(): print('user registe') app.run()
StarcoderdataPython
156709
import json from pathlib import Path import typer def get_skill_config(name=None): app_dir = Path(typer.get_app_dir('skills-cli', force_posix=True)) config_file = app_dir / 'config.json' if not app_dir.exists(): typer.echo('Creating default configuration') app_dir.mkdir(parents=True) ...
StarcoderdataPython
3370062
<filename>tests/helper/__init__.py<gh_stars>0 from converterpy.converter import Converter from converterpy.unit import Unit from converterpy.unit.quantityunit import QuantityUnit from converterpy.converter.quantity_based_converter import QuantityBasedConverter, Quantity MOCK_TIME_QUANTITY = Quantity("MOCK_TIME_QUANTI...
StarcoderdataPython
1666955
<reponame>oliverlee/antlia # -*- coding: utf-8 -*- import gzip import pickle import numpy as np LIDAR_NUM_ANGLES = 1521 LIDAR_FOV_DEG = 190 LIDAR_SAMPLE_RATE = 20 LIDAR_ANGLES = np.linspace( # in radians (90 - LIDAR_FOV_DEG/2)*np.pi/180, (90 + LIDAR_FOV_DEG/2)*np.pi/180, LIDAR_NUM_ANGLES ) """LIDAR dataty...
StarcoderdataPython
42946
from collections import defaultdict s = """ 0 <-> 2 1 <-> 1 2 <-> 0, 3, 4 3 <-> 2, 4 4 <-> 2, 3, 6 5 <-> 6 6 <-> 4, 5 """ s = """ 0 <-> 659, 737 1 <-> 1, 1433 2 <-> 982, 1869 3 <-> 306, 380, 1462, 1827 4 <-> 1076 5 <-> 794, 1451 6 <-> 146, 1055 7 <-> 834, 1557 8 <-> 1333 9 <-> 849, 906, 1863 10 <-> 362, 505 11 <-> 33...
StarcoderdataPython
124319
# -*- coding: utf-8 -*- # # Copyright 2017 Inc # @author ipqhjjybj ''' 上传期货的数据 ''' import sys import os import six import numpy as np import pandas as pd sys.path.append("..") from config import * from connect import * from reportPyConfig import * upload_date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%...
StarcoderdataPython
117857
<reponame>cariad/stackwhy<filename>tests/test_cli.py from io import StringIO from mock import Mock from stackwhy.cli import entry valid_arn = "arn:aws:cloudformation:eu-west-2:000000000000:stack/X/00000000-0000-0000-0000-000000000000" def test_help() -> None: writer = StringIO() assert entry([], session=Mo...
StarcoderdataPython
3235225
<reponame>pulumi/pulumi-alicloud # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequenc...
StarcoderdataPython
168963
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.4' # jupytext_version: 1.1.5 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # s_ga...
StarcoderdataPython
3247464
<gh_stars>0 from django_elasticsearch_dsl_drf.serializers import DocumentSerializer from ..documents import BookDocument class BookDocumentSerializer(DocumentSerializer): """Serializer for the Book document.""" class Meta(object): """Meta options.""" # Specify the correspondent document cla...
StarcoderdataPython
1738445
<reponame>Tim-The/GearBot import logging import os from argparse import ArgumentParser import discord from discord.ext import commands import Util from Util import Configuration, GearbotLogging, GlobalHandlers def prefix_callable(bot, message): return GlobalHandlers.prefix_callable(bot, message) bot = commands...
StarcoderdataPython