id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
86
<reponame>bertonha/python-zeep from .compose import Compose # noqa from .signature import BinarySignature, Signature, MemorySignature # noqa from .username import UsernameToken # noqa
StarcoderdataPython
138592
<gh_stars>0 from django.conf.urls import url from django.contrib.admin import AdminSite from django.contrib.auth.admin import GroupAdmin, UserAdmin from django.contrib.auth.models import Group, User from punchline.music.admin import ( AlbumAdmin, ArtistAdmin, PunchlineAdmin, SongAdmin, ) from punchline.music.model...
StarcoderdataPython
3345104
from unittest.mock import MagicMock, call from tqdm import tqdm from rnnr import Event from rnnr.attachments import ProgressBar def test_ok(runner): batches = range(10) mock_tqdm_cls = MagicMock(spec=tqdm) ProgressBar(tqdm_cls=mock_tqdm_cls).attach_on(runner) runner.run(batches) mock_tqdm_cls....
StarcoderdataPython
95070
<filename>scripts/dwnld.py<gh_stars>0 """This module contains functions for API calls used in other scripts The basic calls are first and the more complex ones are last Logs are saved in dwnld_debug.log and printed to terminal """ import io import json import logging import os import requests import sys import zipfi...
StarcoderdataPython
3378498
<reponame>pawelptak/AI-Anomaly-Detection import pandas as pd """ Class for Loading KDDCUP99 Data The full data can be found here: http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html """ class KDDLoader: def __init__(self, service="http"): self.dataset_name = "KDD" self.data_basepath = f"Data/...
StarcoderdataPython
162648
<reponame>Epatzan/tytus from gramatica import parse from principal import * import ts as TS import ts_index as TSINDEX from expresiones import * from instrucciones import * from report_ast import * from report_tc import * from report_ts import * from report_errores import * class Intermedio(): instrucciones_Global...
StarcoderdataPython
1733685
import csv import json from django.views import generic from django.http import HttpResponse from django.utils.encoding import smart_text class DataPrepMixin(object): """ Provides a method for preping a context object for serialization as JSON or CSV. """ def prep_context_for_serialization(self, c...
StarcoderdataPython
137919
# O(n) time and space where n is number of chars def get_longest_unique_substring(s): start_index = 0 end_index = 0 answer = 0 char_to_position = {} for i,let in enumerate(s): if let not in char_to_position: char_to_position[let] = i elif char_to_position[let] >= start_in...
StarcoderdataPython
4827358
<filename>sdk/python/pulumi_digitalocean/get_kubernetes_versions.py # 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 imp...
StarcoderdataPython
1638218
#coding:utf-8 #webqq自动登陆和群组信息察看 from selenium import webdriver import time,re,requests import getpass class QQ: h={'Referer':'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3'} def __init__(self): self.d=wendriver.Firefox() self.get('http://web2.qq.com/webqq.html') def login(self,qq,pw,check=0): ...
StarcoderdataPython
1699315
<reponame>LJIJCJ/front_page #!/usr/bin/env python # -*- coding: utf-8 -*- MYSQL_URL = 'mysql+mysqldb://root@localhost:3306/job_web?charset=utf8' SQLITE_URL = 'sqlite:///../job_web/jobs' # 去重所用的Redis HOST = 'localhost' PORT = 6379 KEY_NAME = 'job' UA = { 'Accept': 'text/html,application/xhtml+xml,...
StarcoderdataPython
3364844
<filename>tools/arctographer/arcmap/backgroundio.py<gh_stars>0 ################################################################################ # Authors: <NAME> (<NAME>) # Copyright: <NAME> (<NAME>aran # Date: Oct 25 2009 # License: # # This program is free software: you can redistribute it and/or modify # it under th...
StarcoderdataPython
29127
<gh_stars>1-10 """ Show the INI config(s) used by a command tree. """ from .. import command class Show(command.Command): """ Show current INI configuration. Programs may make use of a configuration file which is usually located in your $HOME directory as .<prog>_config. The file is a standard INI ...
StarcoderdataPython
3213928
<reponame>sriramcu/MissingPersonsTracing from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm from django.forms import inlineformset_factory from police.models import Police, Victim, Sightings from bootstrap_datepicker_plus import DatePickerInput, T...
StarcoderdataPython
1779253
<reponame>ucx-code/ucXception import re import logging from core import utils logger = logging.getLogger(__name__) import pandas as pd from StringIO import StringIO class Sar_to_CSV: def run(self, target, paths, keep=True): logger.info("Starting Sar to CSV transformer for files %s" % paths) new_...
StarcoderdataPython
3275854
<filename>matrix/x_view.py class XView(object): def __init__(self, x, matrix): self._x = x self._matrix = matrix def __getitem__(self, key): return self._matrix.get_matrix_data(x=self._x, y=key) def __setitem__(self, key, value): self._matrix.set_data(x=self._x, y=key, val...
StarcoderdataPython
4837211
<filename>python_module/megengine/module/identity.py<gh_stars>1-10 # -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed unde...
StarcoderdataPython
3276353
<gh_stars>0 # -*- coding: utf-8 -*- """DEVPoliticsDataset.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1-1CATzPCSLI1-oDo9SvNGO4dLazgSJNn """ # Commented out IPython magic to ensure Python compatibility. # %tensorflow_version 1.x !pip install -...
StarcoderdataPython
121542
from io import BytesIO import qrcode.image.svg # Combined path factory, fixes white space that may occur when zooming factory = qrcode.image.svg.SvgPathImage def get_qr_code_svg(data_string, include_xml_declaration=False): img = qrcode.make(data_string, image_factory=factory) with BytesIO() as bytes_out: ...
StarcoderdataPython
49563
import turtle turtle.bgcolor("black") sq = turtle.Turtle() sq.speed(20) sq.color("white") for i in range(500): sq.forward(i) sq.left(91)
StarcoderdataPython
1772217
<reponame>matiaspizarro/pybsd-ezjail # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import unittest import ipaddress import unipath from pybsd import AttachNonMasterError, InvalidUIDError, Jail, Master, System from ..utils import extract_message class JailTestCase...
StarcoderdataPython
3371763
#!/usr/bin/env python3 # # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import sys from lambdas.common import all_execution_events if len(sys.argv) < 2: prin...
StarcoderdataPython
1657842
<filename>micropython_gy521/gy521.py # -*- coding: utf-8 -*- from struct import pack """Main module.""" # SDA=Pin(5) # SCL=Pin(16) # Int = None DEFAULT_ADDR = 0x68 REG_WHO_AM_I = 0x75 class gy521: def __init__(self): from machine import Pin, I2C self.bus = I2C(scl=Pin(16), sda=Pin(5), freq=400000) self....
StarcoderdataPython
61611
<gh_stars>0 from rest_framework import viewsets, status, filters from rest_framework.response import Response from rest_framework.decorators import action from django.http import Http404, HttpResponse from django.core import serializers import django_filters.rest_framework from .serializers import OrderSerializer, Ord...
StarcoderdataPython
28701
import sensor, image, time, pyb from pid import PID from pyb import Servo from pyb import UART uart = UART(3, 19200) usb = pyb.USB_VCP() led_red = pyb.LED(1) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4. led_green = pyb.LED(2) pan_pid = PID(p=0.07, i=0, imax=90) #脱机运行或者禁用图像传输,使用这个PID tilt_pid = PID(p=0...
StarcoderdataPython
40959
from sklearn.model_selection import GridSearchCV from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.neural_network import MLPClassifier from sklearn.svm import SVC import numpy as np import pandas as pd impo...
StarcoderdataPython
4819232
import os # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = ( os.path.join(PROJECT_DIR, "static"), os.path.join(BASE_DIR, "assets"), ) STATICFILES_STORAG...
StarcoderdataPython
3216538
from common import * DEPLOYMENT_LEVEL = "hegenv" STANDALONE = True DEBUG = True RELOAD_TEMPLATES = True ALLOWED_HOSTS = ["*","192.168.127.12","localhost","127.0.0.1","172.16.58.3"] injectSecrets(DEPLOYMENT_LEVEL) INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.ad...
StarcoderdataPython
1724190
from __future__ import print_function import sys import toolshed as ts import itertools as it from operator import itemgetter from concurrent.futures import ProcessPoolExecutor fam_beds = sys.argv[1:] min_sites = 2 min_flank = 20 max_sites = 20 max_length = 3000 print("#chrom\tstart\tend\tsites-left\tsites-in\tsite...
StarcoderdataPython
3238987
#!/usr/bin/python # -*- coding: utf-8 -*- ''' 1607. Taxi Time limit: 0.5 second Memory limit: 64 MB [Description] Petr likes going by taxi. For him, it is not only the pleasure of a fast and comfortable ride, but also the opportunity to bargain with the driver over the fare. The bargaining between Petr and taxi drive...
StarcoderdataPython
136535
<filename>src/generative_playground/utils/fit.py<gh_stars>1-10 import torch from torch.autograd import Variable from generative_playground.utils.gpu_utils import to_gpu def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad) def to_variable(x): if type(x) == tuple: ...
StarcoderdataPython
3253987
import murraylab_tools.biotek as mt_biotek import os gitexamplepath = "C:\\Users\\Andrey\\Documents\\GitHub\\"+\ "murraylab_tools\\examples\\biotek_examples\\" data_filename = gitexamplepath+\ "180515_big384wellplate.csv" supplementary_filename = gitexamplepath+\ "supp_in...
StarcoderdataPython
1609597
<gh_stars>0 # 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 Any, Mapping, Optional, Sequence, Union from ... import _utilities, ...
StarcoderdataPython
53279
import math from typing import Union, Dict import numpy as np import torch import torchvision.transforms as transforms from torchvision.transforms import InterpolationMode import utility as utils import utility.color as color class Resolution: def __init__(self, width, height): self.width = width ...
StarcoderdataPython
14476
<gh_stars>100-1000 from container.base import TimeBase from container.array import TimeArray, TimeDtype from container.timeseries import TimeSeries from container.timeframe import TimeFrame
StarcoderdataPython
3225000
days = int(input()) people_who_liked_advertise = 2 current_people_reached = people_who_liked_advertise for i in range(1, days): current_people_reached = (current_people_reached * 3) // 2 people_who_liked_advertise += current_people_reached print(people_who_liked_advertise)
StarcoderdataPython
140473
<gh_stars>1-10 from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 # Importing the Kratos Library import KratosMultiphysics as KM # Importing the base class from KratosMultiphysics.CoSimulationApplication.base_classes.co_simulation_s...
StarcoderdataPython
1767651
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Read in Mechanical Turk results files to calculate demographic information for various funding and regulatory agencies. Outputs an xlsx file with columns of interest that is easy to do pivot tables for getting the necessary counts """ import argparse from datetime imp...
StarcoderdataPython
31297
import tensorflow as tf import numpy as np import cv2 import os import rospy from timeit import default_timer as timer from styx_msgs.msg import TrafficLight CLASS_TRAFFIC_LIGHT = 10 MODEL_DIR = 'light_classification/models/' IMG_DIR = 'light_classification/img/' DEBUG_DIR = 'light_classification/result/' class TL...
StarcoderdataPython
92202
<filename>app/api/models/Base.py<gh_stars>100-1000 from abc import ABC, abstractmethod class Base(ABC): @abstractmethod def info(self): raise NotImplementedError() @abstractmethod def create(self): raise NotImplementedError() @abstractmethod def delete(self): raise Not...
StarcoderdataPython
155685
<filename>sphinxcontrib/dd/data_dictionary.py from docutils import nodes from docutils.parsers.rst import directives from docutils.parsers.rst import Directive as BaseDirective from recommonmark.parser import CommonMarkParser from . import yaml def string_list(argument): if ',' in argument: entries = arg...
StarcoderdataPython
3360530
<filename>BQ/train.py import os import tensorflow as tf import keras.backend.tensorflow_backend as KTF from keras.models import load_model from stats_graph import stats_graph from keras import backend as K from keras.engine.topology import Layer # 指定第一块GPU可用 #os.environ["CUDA_VISIBLE_DEVICES"] = "0" #++++++++++++++++...
StarcoderdataPython
1628407
<reponame>hawkowl/axiom from setuptools import setup, find_packages from setuptools.command.install import install as Install import re versionPattern = re.compile(r"""^__version__ = ['"](.*?)['"]$""", re.M) with open("axiom/_version.py", "rt") as f: version = versionPattern.search(f.read()).group(1) class Inst...
StarcoderdataPython
1722687
""" Communications -------------- A module containing Windows functions related to communications. """ from pywincffi.core import dist from pywincffi.core.checks import NON_ZERO, input_check, error_check from pywincffi.wintypes import HANDLE, wintype_to_cdata def ClearCommError(hFile): """ Retrieves informa...
StarcoderdataPython
3242385
<reponame>siva-moturi/vessel-ml import argparse import logging import sys import os import pandas as pd from kubernetes import client, config, watch from kfmd import metadata from datetime import datetime import pandas KUBEFLOW_METADATA_URL_PREFIX = "metadata-service.kubeflow:8080" #Vessel Kubeflow metdata accessor ...
StarcoderdataPython
1799216
<filename>features/bdd/account_util.py # -*- coding: utf-8 -*- import json import time import logging import requests from datetime import datetime, timedelta from bdd.client import RestClient from bdd import util as bdd_util class Corp(object): def __init__(self, id): self.id = id def join_platform(s...
StarcoderdataPython
39422
from django.apps import AppConfig class SuperlistsConfig(AppConfig): name = 'superlists'
StarcoderdataPython
117852
""" main.py """ import re import os import os.path import sys import multiprocessing import importlib import os.path import timeit import cProfile import tsscraper class Application(object): thread_count = 8 threads = None target_directory = None target_exporter = None def print_usage(sel...
StarcoderdataPython
77144
""" Django settings for app project. Generated by 'django-admin startproject' using Django 2.1.15. For more information on this file, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) from typing import List BASE_DIR = os.p...
StarcoderdataPython
3221761
# set implementation maybe better keeping track of black tiles # %% import re f=open('test0.txt') lines = [line.rstrip('\n') for line in f] delta = { 'e':(0,2), 'se':(1,1), 'sw':(1,-1), 'w':(0,-2), 'nw':(-1,-1), 'ne':(-1,1)} blacks = set() for line in lines: instructions = re.findall(r...
StarcoderdataPython
19525
# -*- coding: utf-8 -*- import pickle from sklearn.ensemble import RandomForestClassifier from base_shallow_classifier import BaseShallowClassifier class RFClassifier(BaseShallowClassifier): ''' Image classification using random forest classifier (RFC). Can reach 87.82% accuracy on test set of FashionM...
StarcoderdataPython
1694790
#px8 / python cartridge #version 1 #__python__ CHIPTUNE_MUSIC = "./examples/assets/AmsterdamBoppe.kt" CHIPTUNE_SOUND_1 = "./examples/assets/the_horror.ki" CHIPTUNE_SOUND_2 = "./examples/assets/clap.ki" class Button(object): def __init__(self, x1, y1, x2, y2, color, text, highlight=False): self.x1 = x1 ...
StarcoderdataPython
60872
"""load cmat cmat10. import matplotlib.pyplit as plt import seaborn as sns sns.set() plt.ion() # interactive plot plt.clf(); sns.heatmap(cmat, cmap="gist_earth_r").invert_yaxis() plt.clf(); sns.heatmap(cmat, cmap="viridis_r").invert_yaxis() """ import pickle from pathlib import Path cdir = Path(__file__).parent....
StarcoderdataPython
188169
<filename>models/search_result.py # coding: utf-8 from __future__ import absolute_import from .base_model_ import Model from . import util class SearchResult(Model): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, n...
StarcoderdataPython
4807017
<filename>app/migrations/0026_usersubmission_publication_datetime.py # Generated by Django 3.2.6 on 2021-08-27 02:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0025_alter_report_embed_code'), ] operations = [ migrations.AddF...
StarcoderdataPython
3369403
<reponame>DanielSchuette/CalciumImagingAnalyzer ''' HELPER FUNCTIONS AND CLASSES! CalciumImagingAnalyzer App developed by Daniel (<EMAIL>) -> runs with python 2.7.14 and python 3.6.x on macOS High Sierra repository: https://github.com/DanielSchuette/CalciumImagingAnalyzer.git ''' current_app_version = "v0.2" ##########...
StarcoderdataPython
110945
<filename>open_spiel/python/games/tt_tournament.py # Copyright 2019 DeepMind Technologies Limited # # 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/LICEN...
StarcoderdataPython
3296557
<reponame>tgsoverly/rover from adafruit_motorkit import MotorKit from picamera import PiCamera from time import sleep import time import tkinter import os import json camera = PiCamera() front_kit = MotorKit(address=0x60) middle_kit = MotorKit(address=0x61) rear_kit = MotorKit(address=0x62) right_motors = [front_ki...
StarcoderdataPython
116596
<filename>hash&heap/0685_First_Unique_Number_in_Data_Stream.py ''' Description Given a continuous stream of data, write a function that returns the first unique number (including the last number) when the terminating number arrives. If the terminating number is not found, return -1. Example Example1 Input: [1, 2, 2,...
StarcoderdataPython
1650299
#Write a program that lets the user enter a nonnegative integer then uses a loop #to calculate the factorial of that number. Display the factorial. total = 1 integer = int(input('Enter any non negative number you want to calculate the '\ 'factorial of: ')) for number in range(1, integer + 1...
StarcoderdataPython
4825440
<filename>pysrc/labstreaminglayer_ros/Converter/__init__.py import ConverterBase import Bool import Float32 import ExoDataArray import Int32 import Image import Transform import TransformStamped import EEGLiveAmp
StarcoderdataPython
130979
def calculate_nearest_5(percentage_list: list[float]): total_errors = 0 for i in range(5, 100): portions = [i * j for j in percentage_list] errors = [j % 5 for j in portions] adj_ports = [ for j, k in zip(portions, errors)] """ Make a matched bet calculator Add in options for 1) No...
StarcoderdataPython
1645471
"""This module contains the Hook class to handle pipeline hooks.""" import weakref class Hook(object): """Convenient class for handling hooks. :param key: str, unique identifier of the hook :param func: function to be called by the hook The function can not modify any items fed by its arguments...
StarcoderdataPython
3235321
<reponame>Loracio/retrato-de-fases from ..exceptions import exceptions def is_number(x): return isinstance(x, (float,int)) def is_range(U): return isinstance(U, (list,tuple)) def construct_interval_1d(var): try: if is_number(var): if var !=0: return sorted([-var, var])...
StarcoderdataPython
1622254
<reponame>soratidus999/allianceauth-signal-pings # Generated by Django 2.2.12 on 2020-07-04 02:30 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('eveonline', '0012_index_additions'), ('signalpings', '0003_hrappsi...
StarcoderdataPython
1724515
<reponame>Jar-win/fts-rest #!/usr/bin/env python # Copyright notice: # Copyright Members of the EMI Collaboration, 2013. # # See www.eu-emi.eu for details on the copyright holders # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
StarcoderdataPython
3310162
#!/usr/bin/env python """ Module for reading TXT files This expects a segment from class derived in convert_text """ # do not delete - needed in time_aligned_text from asrtoolkit.data_handlers.data_handlers_common import footer, header, separator from asrtoolkit.data_structures.segment import segment def format_seg...
StarcoderdataPython
3349005
<filename>tests/test_closed_universe.py from copy import copy from unittest import TestCase from life import ClosedUniverse class ClosedUniverseTestCase(TestCase): def test_init(self): with self.assertRaises(ValueError): ClosedUniverse(0, 1) with self.assertRaises(ValueError): ...
StarcoderdataPython
3228350
<filename>Algorithm/Easy/1000+/1033Minimum Difference Between BST Nodes.py """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root @return: the minimum difference between the va...
StarcoderdataPython
115038
<gh_stars>1-10 #!/usr/bin/env python3 import sys import markdown def main(argv): if len(argv) != 2: print("Usage: {} data.md".format(argv[0])) exit(64) with open(argv[1], 'rt', encoding="utf-8") as stream: html = markdown.markdown(stream.read(), extensions=['attr_list']) print(ht...
StarcoderdataPython
3390955
<filename>compiler/autotest/cmd/test.py from os import listdir, chdir from os.path import dirname, abspath, isfile, join from subprocess import call import sys def run_python( file ): run_cmd( "python3 " + file ) def run_cmd( cmdline, expected_ret_code=0 ): if expected_ret_code: print ( "\033[90mRunn...
StarcoderdataPython
68312
<reponame>SakshayMahna/fras """ Attendance based views """ from flask import current_app as app from flask import (Flask, jsonify, request, session) from flask.blueprints import Blueprint from werkzeug.utils import secure_filename from passlib.hash import pbkdf2_sha256 from common import * from models.models import * f...
StarcoderdataPython
83130
import requests import os import textwrap import re import json import urllib from bs4 import BeautifulSoup import requests_toolbelt as rt from requests_toolbelt import MultipartEncoderMonitor from requests_toolbelt import MultipartEncoder from functools import partial import uuid import time from ProxyClo...
StarcoderdataPython
3292840
# coding: utf-8 # Author: Xset # Version: 2.0 # Last updated: 2017-03-24 import re import os import sys import lzma import struct import sqlite3 import binascii import subprocess from PIL import Image, ImageDraw from modules import * compileDir = './compile/' compiledDir = './compiled/' findFiles = {} picCount = 0...
StarcoderdataPython
4828651
#!/usr/bin/env python3 """Attach relevant information from small Files/Subseries to parent ndjson records. """ import json import re import sys def load_series(): """Returns a uniqueID --> series record dict.""" out = {} for line in open('data/series.ndjson'): record = json.loads(line) i...
StarcoderdataPython
4811828
<filename>test/obj_op_test.py from logger import logger from common_utils.common_types.point import Point2D, Point3D, Point2D_List, Point3D_List from common_utils.common_types.keypoint import Keypoint2D, Keypoint3D, Keypoint2D_List, Keypoint3D_List from common_utils.common_types.bbox import BBox from common_utils.commo...
StarcoderdataPython
3252366
import itertools import requests from ..constants import API_URLS class H2HLeague(): """ A class representing a h2h league in the Fantasy Premier League. """ def __init__(self, league_id, session=None): self.league_id = league_id self._information = self._get_information() sel...
StarcoderdataPython
1792220
from django import template from django.contrib.auth.models import User register = template.Library() from django.shortcuts import render, get_object_or_404 from ..models import Analysis, ProjectComment, Module, Project, File, ParamsComment, Param from ..forms import ProjectEditCommForm, ParamForm2, ModuleParamForm, P...
StarcoderdataPython
40049
from django import forms gender = [('male', 'M'), ('female', 'F')] response = [('1', 'yes'), ('0', 'no')] time = [('1', 'one'), ('2', 'two'), ('3', 'three'), ('4', 'four')] education = [('0', 'zero'),('1', 'zero'), ('2', 'two'), ('3', 'three'), ('4', 'four')] rating = [('1', 'one'), ('2', 'two'), ('3', 'three'), ('4',...
StarcoderdataPython
69416
<gh_stars>1-10 # -*- coding: utf-8 -*- """QA_Struture工厂模式 """ import pandas as pd from QUANTAXIS.QAData.QADataStruct import QA_DataStruct_Index_day, QA_DataStruct_Index_min from QUANTAXIS.QAData.QADataStruct import QA_DataStruct_Stock_day, QA_DataStruct_Stock_min from QUANTAXIS.QAData.QADataStruct import QA_DataStruc...
StarcoderdataPython
1680976
import turicreate as tc #use sframe containing all images data = tc.SFrame('Nolmyra2.sframe') train_set, test_set = data.random_split(0.8) train_set.save("Train_Data.sframe") test_set.save("Test_Data.sframe")
StarcoderdataPython
1786847
<reponame>kozakusek/ipp-2020-testy<filename>z2/part2/interactive/jm/random_fuzzy_arrows_1/837840602.py from part1 import ( gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new, ) """ scenario: test_random_action...
StarcoderdataPython
30225
#Faça um Programa que leia um vetor de 5 números inteiros e mostre-os. lista=[] for i in range(1, 6): lista.append(int(input('Digite um número: '))) print(lista)
StarcoderdataPython
98694
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, torch from tqdm import tqdm from silence_tensorflow import silence_tensorflow silence_tensorflow() import tensorflow.compat.v1 as tf from metrics.FVD.FVD import Embedder, preprocess, calculate_fvd imp...
StarcoderdataPython
1792419
"""Admin API""" import arrow from purepage.ext import r, db, abort class Admin: """ 后台管理 $shared: user: id?str: 用户ID role?str: 角色 email?email&optional: 邮箱 github?url&optional: Github地址 avatar?url&default="http://purepage.org/static/avata...
StarcoderdataPython
72542
<filename>tests/test_pat_variation.py from __future__ import division import datetime import os import pytest import numpy as np import pandas as pd from fasttrips import Assignment from fasttrips import PathSet from fasttrips import Run EXAMPLE_DIR = os.path.join(os.getcwd(), 'fasttrips', 'Examples', 'Springfield'...
StarcoderdataPython
4801293
from django.test import SimpleTestCase from django.urls import reverse, resolve from posts.views import get_posts, post_detail, CommentUpdateView, CommentDeleteView class TestUrls(SimpleTestCase): def test_get_posts_url_is_resolved(self): url = reverse('posts:get_posts') print(resolve(url)) ...
StarcoderdataPython
122292
<filename>moveNegative.py # -*- coding: utf-8 -*- # Record the position of left 0, if != 0 then exchange, zero move to next, zero keep stay at left position of zeros class Solution(object): def moveNegative(self, nums): ng = 0 # records the position of "0" for i in xrange(len(nums)): #...
StarcoderdataPython
3350269
import os import pytest import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ["MOLECULE_INVENTORY_FILE"] ).get_hosts("molecule-coturn-debian10") @pytest.mark.parametrize( "name", ["coturn"], ) def test_packages(host, name): print(testinfra_hosts...
StarcoderdataPython
1712492
N, M = map(int, input().split()) input_route = [[float("inf") for _ in range(N)] for _ in range(N)] next_points = [] for i in range(M): u, v, l = map(int, input().split()) if u == 1: next_points.append([v - 1, l]) continue if v == 1: next_points.append([u - 1, l]) continue ...
StarcoderdataPython
1771997
###File Name:get_distence.py ###Author:haicg ###Mail:<EMAIL> ###Created Time: Mon 07 Jul 2014 08:13:00 PM HKT ###File Name : get_distence.py #!/usr/bin/python import math from geopy import distance '''Return value is the distance with the unit of mile ''' # 这个函数以前计算距离可能有点问题,不够精准,同时对于边界问题处理过于粗暴 # 这个修改成GeoPy的实现 def c...
StarcoderdataPython
1640621
<gh_stars>0 from .synthetic import random, plane, constant, sine __all__ = ["random", "plane", "constant", "sine"]
StarcoderdataPython
4837104
<gh_stars>1-10 # Copyright 2000 - 2015 NeuStar, 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 ...
StarcoderdataPython
1780557
import pytest import copy from formulabot.mep import Population, Solution def test_Solution_init_params(): # make sure list object passed with pytest.raises(ValueError): Solution(None, 10, 10) # make sure list is not empty with pytest.raises(ValueError): Solution([], 10, 10) ...
StarcoderdataPython
3355103
<reponame>polfpilf/feedback-bot from dataclasses import dataclass, field from datetime import datetime, timezone from typing import Optional, Type, TypeVar T = TypeVar('T') def _utc_now(): """Return current UTC timezone-aware datetime""" return datetime.now(timezone.utc) @dataclass(frozen=True, eq=True) cl...
StarcoderdataPython
64907
# Copyright 2012 Cisco Systems, 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 requir...
StarcoderdataPython
1798000
<filename>src/nauka/utils/torch/__init__.py # -*- coding: utf-8 -*- from . import cuda, optim, random
StarcoderdataPython
20518
import sys sys.path.append('../') from abc import ABCMeta, abstractmethod # https://www.python-course.eu/python3_abstract_classes.php import logging import oandapyV20 from oandapyV20 import API import oandapyV20.endpoints.orders as orders from oandapyV20.contrib.requests import MarketOrderRequest class...
StarcoderdataPython
6559
# - Generated by tools/entrypoint_compiler.py: do not edit by hand """ Trainers.LightGbmBinaryClassifier """ import numbers from ..utils.entrypoints import EntryPoint from ..utils.utils import try_set, unlist def trainers_lightgbmbinaryclassifier( training_data, predictor_model=None, number_...
StarcoderdataPython
4807418
<gh_stars>0 import re import os, glob import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo from collections import OrderedDict from tensorboardX import SummaryWriter import torchvision.utils as vutils import pdb __all__ = ['DenseNet', 'densenet121', '...
StarcoderdataPython