id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
12801495
<reponame>chenrb/bk-sops<gh_stars>0 # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); yo...
StarcoderdataPython
5019714
<reponame>marcosptf/cpython-2.0.1 #! /usr/bin/env python """Test script for the imageop module. This has the side effect of partially testing the imgfile module as well. <NAME> """ from test_support import verbose, unlink import imageop, uu def main(use_rgbimg=1): # Create binary test files uu.decod...
StarcoderdataPython
82669
# Open3D: www.open3d.org # The MIT License (MIT) # See license file or visit www.open3d.org for details # examples/Python/Basic/solution.py import numpy as np import os import open3d as o3d import sys results_file = "" ply_path = "" if len(sys.argv) > 2 and len(sys.argv) < 4 : ply_path = sys.argv[1] results...
StarcoderdataPython
5060545
<reponame>murawaki/comp-typology #!/bin/env python # -*- coding: utf-8 -*- # simple parser of NEXUS annotated trees import sys import os import re def label_clades(node): clade_dict = {} def _label_clades_main(node): label_list = [] for cnode in node.children: label_list += _label_c...
StarcoderdataPython
1953254
<reponame>parshakova/-GAMs<filename>r_plambda_pitheta_full.py<gh_stars>1-10 import argparse import time from datetime import datetime import os import sqlite3 import random from random import shuffle import math from tqdm import tqdm import numpy as np import torch import torch.nn as nn import torch.nn.functional ...
StarcoderdataPython
1924376
import sys import weakref from _weakref import ref try: from _weakref import _remove_dead_weakref except ImportError: def _remove_dead_weakref(o, key): del o[key] import types AIO_AVAILABLE = sys.version_info >= (3, 5) if AIO_AVAILABLE: import asyncio else: asyncio = None PY2 = sys.version_inf...
StarcoderdataPython
5009165
import contextlib from typing import Generator, List import fastapi import fastapi.middleware __all__ = ["override_middleware"] @contextlib.contextmanager def override_middleware( app: fastapi.FastAPI, middleware: List[fastapi.middleware.Middleware] ) -> Generator[None, None, None]: """Temporarily override ...
StarcoderdataPython
1834473
<reponame>861934367/genecast<filename>genecast_package/depth_coverage_plot.py import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np import multiprocessing import sh import pysam from collections import defaultdict class TypeException(Excep...
StarcoderdataPython
12831950
import random import cv2 import numpy as np import torch from torchvision.transforms import RandomApply, Compose class PrepareImageAndMask(object): """Prepare images and masks like fixing channel numbers.""" def __call__(self, data): img = data['input'] img = img[:, :, :3] # max 3 channels ...
StarcoderdataPython
5074921
import py class DefaultPlugin: """ Plugin implementing defaults and general options. """ def pytest_pyfunc_call(self, pyfuncitem, args, kwargs): pyfuncitem.obj(*args, **kwargs) return def pytest_collect_file(self, path, parent): ext = path.ext pb = path.purebasename ...
StarcoderdataPython
373937
#!/usr/bin/env python # # Author: <NAME> # Copyright (c) 2020 Arizona Board of Regents # About: Works within the strym package to collect metadata files # from within a folder and print interesting aspects of the collection # License: MIT License # # Permission is hereby granted, free of charge, to any person ob...
StarcoderdataPython
3449443
# CheckSum.py # By: LawlietJH def GetChecksum(Pin): Pin = str(Pin) Acc = 0 # Se Inicializa Un Acumulador. if not Pin.isdigit() or len(Pin) > 7: return 'Error' if len(Pin) < 7: Pin = Pin.zfill(7) # Si El Pin es Menor a 7 Digitos se Agregan 0's por Izquierda. Pin = int(Pin) Pin = Pin * 10 #...
StarcoderdataPython
11310935
<gh_stars>1-10 # -*- coding: utf-8 -*- # 编译器Python3.6/3.4 64bit # 相关包:pyautocad,comtypes from pyautocad import Autocad,APoint,aDouble,aShort,aInt,ACAD from math import * acad=Autocad(create_if_not_exists=True) #对于autocad中的lwpolyline def job1(): '''绕中心点逆时针旋转45度,绘制的线用红色表示 ''' try: acad.doc.Selection...
StarcoderdataPython
74897
<gh_stars>0 from time import time TARGET_SUM = 200 COINS = [1, 2, 5, 10, 20, 50, 100, 200] DYNAMIC_TABLE = {} def calculate(point, coinset): if point - coinset[0] < 0: return 0 elif point == coinset[0]: return 1 else: if (point, str(coinset)) in DYNAMIC_TABLE: return ...
StarcoderdataPython
5064439
import warnings from . import Force from . import Potential from . import planarPotential from . import linearPotential from . import verticalPotential from . import MiyamotoNagaiPotential from . import MiyamotoNagaiPotential2 from . import MiyamotoNagaiPotential3 from . import IsochronePotential from . import Logarith...
StarcoderdataPython
3338263
<filename>src/test_all.py import unittest import snapshottest import numpy as np from process_data import ( preprocess, load_data, column_dtypes, build_city_df, calc_monthly, load_city_lat_long, ) class TestStringMethods(unittest.TestCase): def test_load_data(self): df = preproces...
StarcoderdataPython
1657296
from typing import List class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: res = [] if len("".join(words)) > len(s): return res if words == ["ab", "ba"] * 100: # 这里确实有点力不从心....面对这么长的串....取巧了 return [] if s and words and "".join(...
StarcoderdataPython
50805
<reponame>gokul-sarath07/Nymblelabs-Expence-Tracker<filename>income_expense_tracker/authentication/views.py from django.views import View from django.contrib import messages from django.contrib.auth import authenticate, login, logout from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mod...
StarcoderdataPython
241496
<reponame>pmp-p/wapy-pack<filename>wapy-lib/pythons/aio/upy/aio.py # ❯❯❯ import sys from ujson import loads, dumps import uasyncio from uasyncio import * try: loop = get_event_loop() except: print("18 : BAD ASYNCIO VERSION") raise q = {} req = [] lio_listio = [] lio = {} fds = {} try: DBG = 'aio'...
StarcoderdataPython
3317694
#!/usr/bin/env python3 from distutils.core import setup setup( name='cc-container-worker', version='0.12', summary='Curious Containers is an application management service that is able to execute thousands of ' 'short-lived applications in a distributed cluster by employing Docker container en...
StarcoderdataPython
11285256
# main.py from app import app import views import dashinterface if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
StarcoderdataPython
3427827
<gh_stars>0 import gspread import matplotlib.pyplot as plt from gspread_dataframe import get_as_dataframe import seaborn as sns class PlotMyGoogleSheet(): # Constructor def __init__(self, link): # Authenticating using serive account # Open the file using the sheet URL. # S...
StarcoderdataPython
3324995
<reponame>caleberi/LeetCode<filename>python/isPalindrome.py # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: if head is None: retu...
StarcoderdataPython
3218649
<reponame>JurgenKriel/cdeep3m<filename>aws/delete_keypair.py #!/usr/bin/env python import sys import os import argparse import datetime from datetime import tzinfo, timedelta import json from dateutil.tz import tzutc import boto3 from ipify import get_ip def _parse_arguments(desc, theargs): """Parses command lin...
StarcoderdataPython
8104495
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'NUMBER STATE TOKHEAT TOKTARGET TOKTEMPRATUREcommands : empty\n | commands command\n command : heatswitch\n | ta...
StarcoderdataPython
1834099
from typing import Tuple from docker.models.containers import Container from sip.utils.custom_docker_comm import CustomDockerClient class TestBpiServer: def test_if_container_starts( self, bpi_example_server: Tuple[Container, CustomDockerClient], ): container, custom_docker_client = bpi_examp...
StarcoderdataPython
6608871
from nbconvert.preprocessors import Preprocessor class JekyllPreprocessor(Preprocessor): # skipcq: PYL-W0223 """Preprocessor to add Jekyll metadata""" def preprocess(self, nb, resources): # skipcq: PYL-R0201 """Preprocess notebook Add Jekyll metadata to notebook resources. Args: ...
StarcoderdataPython
1759798
<reponame>astar-club/scikit-snowland<filename>test/testcase/qgis_tool.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: 深圳星河软通科技有限公司 A.Star # @contact: <EMAIL> # @site: www.astar.ltd # @file: qgis_tool.py # @time: 2022/01/06 23:48 # @Software: PyCharm import sys import unittest import pathlib this_file = p...
StarcoderdataPython
6588449
from django.apps import AppConfig class FirstpageConfig(AppConfig): name = 'firstPage'
StarcoderdataPython
3426945
import sys import torch from torch import nn from vedacore.misc import registry def kl_div(inp, trg, reduction): eps = sys.float_info.epsilon d = trg*torch.log(eps+torch.div(trg, (inp+eps))) if reduction == 'sum': loss = torch.sum(d) elif reduction == 'mean': loss = torch.mean(d) ...
StarcoderdataPython
287811
from random import seed from random import randrange import csv # Load a CSV file def load_csv(filename): dataset = list() with open(filename, 'r') as input1: reader = csv.reader(input1) for row in reader: if not row: continue dataset.append(row) dataset.pop(0) numrow = len(dataset) numcol = l...
StarcoderdataPython
6662831
# Adaptive gamma correction based on the reference. # Reference: # <NAME>, <NAME> and <NAME>, "Efficient Contrast Enhancement Using Adaptive Gamma Correction With # Weighting Distribution," in IEEE Transactions on Image Processing, vol. 22, no. 3, pp. 1032-1041, # March 2013. doi: 10.1109/TIP.2012.2226047 # Revis...
StarcoderdataPython
8184877
<gh_stars>1-10 import math from lcd_digit_recognizer.recognition.utils import unit_vector, absolute_angle, calculate_angle_distance class DigitCenter(object): def __init__(self, x, y, voter): self._x = x self._y = y self._voters = set([voter]) self._neighbours = [] self._c...
StarcoderdataPython
6487724
def binary_search(nums, target): length = len(nums) while length != 0: def main(): nums = [] for i in range(100): nums.append(i) index = binary_search(nums, 98) if __name__ == '__main__': main()
StarcoderdataPython
3530642
from src.core.util.tools import prompt, print_error from src.core.validator.validators import validate_string, validate_int, validate_date from src.model.book import Book class BookBuilder: def __init__(self): self.build() @staticmethod def build(): valid = False book = book_name ...
StarcoderdataPython
8114862
# coding: utf-8 import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="pymoment", version="0.0.6", packages=['moment'], author="<NAME>", author_email="<EMAIL>", description='The python version of "moment" which is made w...
StarcoderdataPython
6526512
<filename>bootstrap.py from const import DB_NAME, DB_USER from psycopg2 import connect from pq import PQ conn = connect('dbname={0} user={1}'.format(DB_NAME, DB_USER)) pq = PQ(conn) pq.create()
StarcoderdataPython
12846181
<reponame>rpi-techfundamentals/spring2020_website<gh_stars>1-10 **Chapter 19 – Training and Deploying TensorFlow Models at Scale** _This notebook contains all the sample code in chapter 19._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/maste...
StarcoderdataPython
11290717
<gh_stars>10-100 # Copyright 2015 Internap. # # 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
9619977
<reponame>FrederichRiver/neutrino3 from typing import Tuple import pandas as pd from libmysql_utils.mysql8 import mysqlHeader, mysqlQuery from libbasemodel.form import formStockManager from pandas import DataFrame, Series from .event import XrdrEvent """ 1.从MySQL查询数据 2.数据清理 3.生成迭代器 """ class DataBase(mysqlQuery): ...
StarcoderdataPython
94743
<filename>scrapy-template/spider/{{class_prefix}}.py # -*- coding: utf-8 -*- import scrapy class {{class_prefix}}Spider(scrapy.Spider): name = '{{spider_name}}' allowed_domains = ['{{spider_name}}'] custom_settings = { 'CONCURRENT_REQUESTS': 2, 'DOWNLOAD_DELAY': 0.25 } defaultHeader...
StarcoderdataPython
3415347
<reponame>gustavo-mendel/my-college-projects<gh_stars>1-10 #!/usr/bin/env python3 from __future__ import print_function import os import os.path import tempfile import subprocess import time import signal import re import sys import shutil create = 0 log = 0 file_locations = os.path.expanduser(os.getcwd()) logisim_l...
StarcoderdataPython
4919274
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
StarcoderdataPython
9751143
<reponame>msarilar/simplefix #! /usr/bin/env python3 import simplefix p = simplefix.FixParser() f = open("secdef.dat") for line in f: line = line.rstrip('\n') p.append_buffer(b'8=FIX.4.2\x01') p.append_buffer(line) p.append_buffer(b'10=000\x01') m = p.get_message() print(m) f.close()
StarcoderdataPython
1618524
<gh_stars>10-100 from collections import MutableSequence from celery import Celery,chord,group from kombu import Queue import pandas as pd from sklearn.metrics.pairwise import linear_kernel from scipy.io import mmread import pickle import requests from bs4 import BeautifulSoup import time from celery.result import allo...
StarcoderdataPython
6579219
<reponame>HerrX2000/zreader #!/usr/bin/env python3 import zreader import ujson as json # Adjust chunk_size as necessary -- defaults to 16,384 if not specified reader = zreader.Zreader("reddit_data.zst", chunk_size=8192) # Read each line from the reader for line in reader.readlines(): obj = json.loads(line) ...
StarcoderdataPython
5088736
<filename>hash_api/config/settings.py #!/usr/bin/env python3 import os class BaseConfig(object): def __init__(self): self.debug = True if os.environ['HASH_API_DEBUG'].lower() == 'true' else False self.host = os.environ['HASH_API_HOST'] self.port = int(os.environ['HASH_API_PORT']) se...
StarcoderdataPython
8028514
<filename>BrowserRefresh.py import os import sys import platform import sublime import sublime_plugin # Fix windows imports __file__ = os.path.normpath(os.path.abspath(__file__)) __path__ = os.path.dirname(__file__) if __path__ not in sys.path: sys.path.insert(0, __path__) _pywinauto = os.path.join(__path__ + ...
StarcoderdataPython
3439485
from os import path, mkdir, listdir from click import echo, argument, option from steam.enums.common import EType from . import app, db from .models import Map, Server, Access, User from .util import string_to_steamid @app.cli.group('db') def database(): """Database-related commands""" pass @database.comman...
StarcoderdataPython
1727021
from datetime import datetime, timedelta def create_expiration_cookie_time(): tomorrow = datetime.now() + timedelta(days=2) tomorrow = datetime.replace(tomorrow, hour=0, minute=0, second=0) expires = tomorrow.strftime("%a, %d-%b-%Y %H:%M:%S GMT") return expires
StarcoderdataPython
4964161
from __future__ import print_function import sys import h2o sys.path.insert(1,"../../../") from tests import pyunit_utils from h2o.estimators.isolation_forest import H2OIsolationForestEstimator #testing default setup of following parameters: #distribution (available in Deep Learning, XGBoost, GBM): #stopping_metric (a...
StarcoderdataPython
5197342
import warnings warnings.warn( "datalad.plugin.check_dates is deprecated and will be removed in a future " "release. " "Use the module from its new location datalad.local.check_dates instead.", DeprecationWarning) from datalad.local.check_dates import *
StarcoderdataPython
1687314
<filename>coalescent/scripts/calc_rho.py #!/usr/bin/env python3 import numpy as np from scipy import stats from scipy.spatial.distance import hamming from skbio import TreeNode, DistanceMatrix, TabularMSA, DNA from docopt import docopt import re def sample_matrix_to_runs(dist, reps=3): '''Repeats a distance matr...
StarcoderdataPython
11332470
# -*- coding: utf-8 -*- import os import requests requests.packages.urllib3.disable_warnings() class Device42BaseException(Exception): pass class Device42BadArgumentError(Exception): pass class Device42HTTPError(Device42BaseException): pass class Device42WrongRequest(Device42...
StarcoderdataPython
3336364
import pymysql from pymysql import OperationalError def test_pymysql_connect_returns_error(): try: connection = pymysql.connect() except OperationalError as err: pass except BaseException as err: pass
StarcoderdataPython
6596185
<gh_stars>0 import random from exceptions import * symbols = [i for i in range(10)] difficult = 4 unique_elements = True def make_code(symbols, difficult): rnd = random.Random() # rnd.seed(0) s = symbols.copy() res = [] for i in range(1, int(difficult) + 1): sym =rnd.choice(s) ...
StarcoderdataPython
3362095
from fourparts import NoteProgression, ToneRow from tests.test_structures.test_progression.test_ToneRow.tone_row_samples import TONEROW import pytest def test_cases(): return [ ([9, 2, 11, 4, 5, 7, 6, 8, 1, 10, 3, 0], TONEROW), ([21, 2, 23, 4, 5, 7, 6, 32, 1, 10, 39, 60], TONEROW), ] @pytes...
StarcoderdataPython
3202338
from django.db import models from students.models import Class, Subject, Teacher, Student from news.models import BaseAbstractPost class Homework(models.Model): topic = models.CharField(default='Homework', max_length=50) subject = models.ForeignKey(Subject, on_delete=models.CASCADE) clazz = models.Forei...
StarcoderdataPython
11220201
import numpy as np # import tensorboardX as tensorboard import torch from torch.utils import tensorboard as tensorboard from torch.utils.data import DataLoader from datasets.captioning_dataset import ActivityNetCaptionsDataset from epoch_loops.captioning_epoch_loops import (greedy_decoder, save_model, ...
StarcoderdataPython
11377425
<gh_stars>1-10 #coding=utf-8 """Module for visualizing common curve The function of this Module is served for visualizing common curve. """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm def plot_cphCoef(dfx, coef_col='coef', se_col='se(coef)', c_col='p', name_col...
StarcoderdataPython
3506633
<filename>COE/contents/building/farm.py from COE.contents.entity_types import EntityTypes from COE.logic.Player import Player from .storage_building import StorageBuilding from .market import Market class Farm(StorageBuilding): def __init__(self, resource, position: tuple, player: Player): super().__init_...
StarcoderdataPython
4844749
from typing import Iterable, Mapping, Sequence, Tuple Index = int Indices = Sequence[Index] Offset = int Word = str Text = Sequence[Word] FeatureName = str FeatureValue = float Feature = Tuple[FeatureName, FeatureValue] FeatureVector = Iterable[Feature] FeatureWindow = Iterable[Tuple[Offset, FeatureVector]] StringV...
StarcoderdataPython
6406665
import re from ..compatpatch import ClientCompatPatch USER_CHANNEL_ID_RE = r'^user_[1-9]\d+$' class IGTVEndpointsMixin: """For endpoints in ``/igtv/``.""" def tvchannel(self, channel_id, **kwargs): """ Get channel :param channel_id: One of 'for_you', 'chrono_following', 'popular', ...
StarcoderdataPython
9634272
#import os #import csv import argparse from parlai.utils.io import PathManager from parlai.core.teachers import register_teacher, DialogTeacher from parlai.scripts.display_model import DisplayModel from parlai.scripts.train_model import TrainModel parser = argparse.ArgumentParser(description="Dataset Information") pa...
StarcoderdataPython
3482873
<filename>bsm/logger.py import time import logging _MAIN_LOGGER_NAME = 'BSM' def _time_zone(t): if t.tm_isdst == 1 and time.daylight == 1: tz_sec = time.altzone tz_name = time.tzname[1] else: tz_sec = time.timezone tz_name = time.tzname[0] if tz_sec > 0: tz_sign = ...
StarcoderdataPython
11296697
<gh_stars>1-10 import sys, re # modified from http://code.activestate.com/recipes/475116/ TERM_ESCAPE = False class TerminalController: """ A class that can be used to portably generate formatted output to a terminal. `TerminalController` defines a set of instance variables whose values are init...
StarcoderdataPython
3225697
""" Copyright 2018 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
StarcoderdataPython
6415949
import datetime from django.conf import settings from django.db import models from aniMango.bleach_html import bleach_tinymce, bleach_no_tags class HomeAlert(models.Model): title = models.CharField(max_length=100) content = models.TextField() def __str__(self): return self.title def save(s...
StarcoderdataPython
6544303
<gh_stars>0 import unittest from easylogger import Log class TestLogger(unittest.TestCase): def setUp(self) -> None: pass def test_child_log(self): parent = Log('parent', log_level_str='DEBUG') # Regular child - should inherit level child_1 = Log(parent, child_name='child_1') ...
StarcoderdataPython
330466
# -*- coding: utf-8 -*- ''' Created on October 17, 2019 @author: <EMAIL> ''' import pytest from luna_core.common.Node import Node, CONTAINER_TYPES, ALL_DATA_TYPES def test_patient_create(): create_string = Node("patient", "my_patient", properties={"namespace":"my_cohort", "Description":"a patient"}).get_create_s...
StarcoderdataPython
3383199
""" ===================================================================================== Copyright (c) 2020 <NAME>, <EMAIL> ===================================================================================== """ from utilis_prediction import * import os from ...
StarcoderdataPython
8003266
# Imports import json import torch from torchvision import datasets, transforms, models __all__ = ["load_dir", "dataloader", "write_labels"] def load_dir(path): """ Loads the image to be used in training, validating, and testing. Input: path as a String, to the parent folder Output: three directories...
StarcoderdataPython
52867
# Топ-3 + Выигрышные номера последнего тиража def test_top_3_winning_numbers_last_draw(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_top_3() app.ResultAndPrizes.button_get_report_winners() assert "ВЫИГРЫШНЫЕ НОМЕРА" in app.ResultAndPrizes.parser_report_text_w...
StarcoderdataPython
9689769
#!/usr/bin/env python # Time-stamp: <2008-02-04 13:20:05 <NAME>> """Module Description Copyright (c) 2007 <NAME> <<EMAIL>> This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file COPYING included with the distribution). @status: experimental @version: $...
StarcoderdataPython
378001
<gh_stars>1-10 import json import logging import config as cfg from modules.const import Keys, DeviceKey, AttrKey from modules.zabbix.sender import send_to_zabbix logger = logging.getLogger(__name__) """zabbixにDevice LLDデータを送信します。 """ def send_device_discovery(data): logger.info("Sending device discovery to...
StarcoderdataPython
3438122
from __future__ import (absolute_import, division, print_function, unicode_literals) import os # Check that the test directories exist if not os.path.exists(os.path.join( os.path.dirname(__file__), 'baseline_images')): raise IOError( 'The baseline image directory does not ...
StarcoderdataPython
3220354
import defs_query_estacionamento as f NAME = 'root' SENHA = '' HOST = 'localhost' DATABASE = 'shopping_estacionamento' db, cursor = f.open_db(NAME, SENHA, HOST, DATABASE) for bloco in range(1, 5): for andar in range(1, 4): for vaga in range(1, 81): if andar == 1 and vaga <= 25: ...
StarcoderdataPython
8073327
<reponame>eugman/eugeneQuest from app import app, db from app.models import * from app.config import * from typing import List from flask import render_template, request, Response from flask_sqlalchemy import SQLAlchemy @app.route('/weeklies', methods=['GET', 'POST']) def weeklies(): player = db.session.query(P...
StarcoderdataPython
1630521
from rest_framework import viewsets from serializers import OrderSerializer from models import * # Create your views here. class OrderViewSet(viewsets.ModelViewSet): """ allow to browse and edit API endpoint """ queryset = Order.objects.all() serializer_class = OrderSerializer
StarcoderdataPython
5126506
<filename>Basic/ratings-counter.py<gh_stars>0 from pyspark.sql import SparkSession from pyspark.sql.functions import col import collections import datetime spark = SparkSession\ .builder\ .appName("PythonRatings")\ .getOrCreate() print("-------------------------------------#Program Started----...
StarcoderdataPython
11396433
# Copyright (c) 2020 kamyu. All rights reserved. # # Google Code Jam 2013 Round 1B - Problem C. Garbled Email # https://code.google.com/codejam/contest/2434486/dashboard#s=p2 # # Time: hash: O(N * L^3), N is the number of words # , L is the max length of words # dp: O(S * D * L^4) # Spa...
StarcoderdataPython
8102425
from .resnet import * from .mobilenet import * from .mnasnet import * from .hrnet import *
StarcoderdataPython
207087
import cv2 import time import mediapipe as np import math class handDetector(): def __init__(self, mode=False, maxhands=2, detectcon=0.5, trackcon=0.5): self.mode=mode self.maxhands=maxhands self.detectcon=detectcon self.trackcon=trackcon self.nphands=n...
StarcoderdataPython
1790380
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from requests import Response from typing import Any, Optional, Mapping Headers = Optional[Mapping[str, str]] class RequestError(Exception): """ Error que se genera cuando hay un fallo accediendo al servidor""" def __init__(self, url: str, headers...
StarcoderdataPython
5123364
<reponame>Satyam-Bhalla/Competitive-Coding # A Dynamic Programming based Python Program for the Egg Dropping Puzzle INT_MAX = 10000000000 def eggDrop(n, k): eggFloor = [[0 for x in range(k+1)] for x in range(n+1)] for i in range(1, n+1): eggFloor[i][1] = 1 eggFloor[i][0] = 0 for j in range(1...
StarcoderdataPython
1997067
<reponame>WuQianyong/awesome_web #!/usr/bin/env Python3 # -*- coding: utf-8 -*- # # Name : phan_demo # Fatures: # Author : qianyong # Time : 2017-06-01 16:19 # Version: V0.0.1 # from selenium import webdriver import time # profile_dir = r'' # driver = webdriver.Chrome(executable_path=r'C:\Users\wqy\AppData\Local\...
StarcoderdataPython
1831460
import torch from torch import LongTensor from torch.utils.data import DataLoader, TensorDataset from .Constants import * def create_vocab(file_list, vocab_num=-1): def create_corpus(file): with open(file, 'r') as f: corpus = [word.lower() for line in f.readlines() for word in line.s...
StarcoderdataPython
1729931
<gh_stars>0 # Copyright (c) 2016 Baidu, Inc. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
9694670
import c4d """ Storing the AutoIK Hardcoded values to be replaced later down the road so this isn't necessary """ """Face Capture """ # facial_morphs = [ # c4d.FACECAPTURE_BLENDSHAPE_LEFTEYE_BLINK, # c4d.FACECAPTURE_BLENDSHAPE_LEFTEYE_LOOKDOWN, # c4d.FACECAPTURE_BLENDSHAPE_LEFTEYE_LOOKIN, # c4d.FACEC...
StarcoderdataPython
1769774
<reponame>CI-WATER/tethysapp-parleys_creek_management import os from datetime import datetime from time import time from django.http import JsonResponse from django.shortcuts import render, redirect from django.core.urlresolvers import reverse from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger f...
StarcoderdataPython
3538563
from six import text_type, binary_type, integer_types from openapi_core.schema.schemas.enums import SchemaFormat, SchemaType from openapi_core.schema.schemas.exceptions import ( InvalidSchemaValue, InvalidCustomFormatSchemaValue, OpenAPISchemaError, MultipleOneOfSchema, NoOneOfSchema, InvalidSchemaProperty...
StarcoderdataPython
3462345
<gh_stars>0 from django.db import models class Video(models.Model): title = models.CharField("Title", max_length=250) embed_code = models.TextField("Embed Code") def __str__(self): return self.title
StarcoderdataPython
84377
#!/usr/bin/python3 # -*- coding: utf8 -*- # Copyright (c) 2021 Baidu, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
StarcoderdataPython
3451073
<filename>problem.py import os import numpy as np import pandas as pd import rampwf as rw from rampwf.score_types.base import BaseScoreType from sklearn.model_selection import ShuffleSplit from sklearn.metrics import mean_squared_error problem_title = 'Prediction of suicide rates' _target_column_name = 'rate-total' ...
StarcoderdataPython
3401147
print("What is your name?") print("This is") input() print("How old are you?") print("It is") input() print("Where are you live?") print("(S)he live in") input()
StarcoderdataPython
8195308
try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages setup( name='hola', version='0.1', description='', author='', author_email='', url='', install_requires=[ "Pylons>=1.0.1rc1", "SQLAlchemy>...
StarcoderdataPython
5082871
<reponame>H0oxy/sportcars from django.contrib.auth.views import LoginView from rest_framework.viewsets import ModelViewSet from authapp.forms import MyAuthForm from authapp.models import UserProfile from authapp.serializers import UserProfileSerializer class UserViewSet(ModelViewSet): queryset = UserProfile.obje...
StarcoderdataPython
6554195
<reponame>mkirby1995/DS-Unit-3-Sprint-2-SQL-and-Databases import sqlite3 conn = sqlite3.connect("""/Users/mattkirby/Desktop/demo_data.sqlite3""") curs = conn.cursor() create_table = """CREATE TABLE demo( s VARCHAR(5), x INT, y INT, PRIMARY...
StarcoderdataPython
177634
<filename>genericclient_base/__init__.py try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse from . import exceptions, utils from .response import ParsedResponse # noqa from .routes import DetailRoute, ListRoute _version = "1.4.2" __version__ = VERSION = tuple(map(int, _v...
StarcoderdataPython
5083591
from starlette import responses, status from endpoints import healthcheck def test_database_status_without_exception(): expected = 'UP' response = responses.Response() actual = healthcheck.database(response, MockSession()) assert expected == actual['status'] assert status.HTTP_200_OK == respons...
StarcoderdataPython