id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
8022836
a00=( ''' ###################################################################### # ______ _____ _ _ # # | ___ \/ __ \ | | (_) # # | |_/ /| / \/ _ __ _ __ ___ _ __ ___ _ __| |_ _ ___ ___ # # | __/ | | | '...
StarcoderdataPython
5128193
<gh_stars>1-10 #!/usr/bin/env python3 # 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 appl...
StarcoderdataPython
3398191
<filename>fooof/plts/error.py """Plots for visualizing model error.""" import numpy as np from fooof.core.modutils import safe_import, check_dependency from fooof.plts.spectra import plot_spectra from fooof.plts.settings import PLT_FIGSIZES from fooof.plts.style import style_spectrum_plot, style_plot from fooof.plts....
StarcoderdataPython
11295882
<filename>main.py import torch from torch.utils import data import os import numpy as np from utils import trainer, visualizer, cagan_dataset, options, IS_score from tqdm import tqdm opt = options.GatherOptions().parse() cagan_dataset = cagan_dataset.CAGAN_Dataset(opt) if opt.mode == "train": train_dataloader = ...
StarcoderdataPython
1609072
<reponame>relsqui/protocards #!/usr/bin/python import unittest import random from .. import base class TestBase(unittest.TestCase): def test_property_attrs(self): prop = base.CardProperty("bar") self.assertEqual(prop.name, "bar") self.assertEqual(prop.plural, "bars") self.assertE...
StarcoderdataPython
1915523
import os from io import StringIO from django.core.management import call_command from django.db import transaction from django.db.utils import IntegrityError from django.test import TransactionTestCase from apps.author.models import Author PATH_FILE = os.path.dirname(os.path.abspath(__file__)) class Impo...
StarcoderdataPython
1863838
<reponame>davidbrownell/Common_cpp_boost_1.70.0 # ---------------------------------------------------------------------- # | # | _custom_data.py # | # | <NAME> <<EMAIL>> # | 2019-04-12 11:51:46 # | # ---------------------------------------------------------------------- # | # | Copyright <NAME> 2019-21...
StarcoderdataPython
6575618
<gh_stars>0 from app import * from app.vote.models import * db.__init__(app) def next_post(id): count = Question.query.count() while (count > 0): next_post = None id += 1 if Question.query.get(id) is not None: next_post = Question.query.get(id) return next_post....
StarcoderdataPython
6697465
<reponame>OSUmageed/pyHeatTransfer<filename>pyHeatTransfer/geometry.py ''' These are the global geometry parameters for the discretization. It's ugly and it's hand written, but there's very little pattern in this madness. Each coordinate will have a tag describing it's positionposition (i.e. center or top corner) in Ea...
StarcoderdataPython
3461178
<filename>tests/internal/commands/test_register.py import os import shutil import tempfile import unittest from concurrent.futures.thread import ThreadPoolExecutor import click import yaml from mock import MagicMock from mock import call from cli.internal.commands.register import RegisterApkCommand from cli.internal....
StarcoderdataPython
3450463
<reponame>heart-your-health/valve import socket import os import json from aiohttp.web import Response, Application, json_response, HTTPForbidden import aiohttp_cors from .lib.database import db_init from .lib.utils import get_config, get_file, parse_auth_header from .lib.loggers import logger from .middleware.validati...
StarcoderdataPython
4954702
<reponame>urbanenomad/clusterfuzz<gh_stars>1-10 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
StarcoderdataPython
4817290
class Surface_Brightness_Class(): def __init__(self, option=1): import sys if (option==1): from simpleBetaProfile import Surface_Brightness_Model elif (option==2): from simpleDoubleBetaProfile import Surface_Brightness_Model elif (option==3): from simpleCCandNC...
StarcoderdataPython
6704812
<filename>backend/appengine/routes/produtos/home.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from categoria.categoria_model import Categoria, Produto from config.template_middleware import TemplateResponse from gaecookie.decorator import no_csrf from gaepermission.decorator impor...
StarcoderdataPython
1655781
# Generated by Django 2.2.5 on 2020-10-22 03:58 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('health', '0007_auto_20201018_1832'), ] operations = [ migrations.AlterField( model_name='bodymassindex', ...
StarcoderdataPython
1616425
<gh_stars>1-10 from typing import Union, List from oolearning.model_processors.SingleUseObject import Cloneable from oolearning.model_wrappers.HyperParamsBase import HyperParamsBase from oolearning.model_wrappers.ModelWrapperBase import ModelWrapperBase from oolearning.transformers.TransformerBase import TransformerBa...
StarcoderdataPython
1835939
<reponame>ardihikaru/learn-to-cluster<filename>baseline/__init__.py from .sklearn_cluster import * # from .approx_rank_order_cluster import *
StarcoderdataPython
8107350
<reponame>gt-ros-pkg/hrl-haptic-manip<filename>hrl_haptic_mpc/src/hrl_haptic_mpc/crona_sim_arms.py #!/usr/bin/env python # Copyright 2013 Georgia Tech Research Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Yo...
StarcoderdataPython
9667516
import datetime import pandas as pd from django.core.management.base import BaseCommand from library.log_utils import console_logger from snpdb.models import Lab, LabProject, Organization LEADER = 'Leader' MEMBERS = 'Members' NAME = 'Name' INSTITUTION = 'Institution' CITY = 'City' COUNTRY = 'Country' LAT = 'Lat' LON...
StarcoderdataPython
1738303
#!/usr/bin/env python # # Copyright (c) 2020, Pycom Limited. # # This software is licensed under the GNU GPL version 3 or any # later version, with permitted additional terms. For more information # see the Pycom Licence v1.0 document supplied with this file, or # available at https://www.pycom.io/opensource/licensing ...
StarcoderdataPython
9622672
<gh_stars>1-10 __version_tuple__ = (0, 2, 1) __version__ = '0.2.1'
StarcoderdataPython
126731
""" Handles sounds for Some Platformer Game Created by sheepy0125 30/10/2021 """ ############# ### Setup ### ############# # Import from pygame_setup import pygame from utils import Logger, ROOT_PATH from time import time # Variables SOUND_PATH = ROOT_PATH / "assets" / "sfx" ####################### ### Sound datacla...
StarcoderdataPython
3437675
import re text = 'purple <EMAIL>, blah monkey <EMAIL> blah dishwasher' emails = re.findall(r'[\w\.-]+@[\w\.-]+', text) for email in emails: print email
StarcoderdataPython
3500170
#!/usr/bin/python """ 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 limitation the rights to use, copy, mo...
StarcoderdataPython
9616720
<reponame>codeif/WeChat-OAuth2 #!/usr/bin/env python from setuptools import setup, find_packages import re with open('README.rst') as f: readme = f.read() with open('wechat_oauth2/__about__.py', 'r') as fd: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.M...
StarcoderdataPython
3577939
import asyncio import logging from typing import AsyncGenerator, Dict, Optional from src.protocols.introducer_protocol import RespondPeers, RequestPeers from src.server.connection import PeerConnections from src.server.outbound_message import Delivery, Message, NodeType, OutboundMessage from src.types.sized_bytes impo...
StarcoderdataPython
1664333
<filename>tests/end_to_end/target_snowflake/tap_mariadb/__init__.py from tests.end_to_end.target_snowflake import TargetSnowflake class TapMariaDB(TargetSnowflake): """ Base class for E2E tests for tap mysql -> target snowflake """ # pylint: disable=arguments-differ def setUp(self, tap_id: str, t...
StarcoderdataPython
1686100
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
StarcoderdataPython
8127210
<filename>fenalib/writer.py import os import logging if __name__ == "__main__": import sys sys.path.append("..") del sys from fenalib.mcfunction import McFunction from fenalib.assert_utils import assert_type, assert_list_types PATH_TO_LOG_DIR = "log" def write_after_pre_pyexpander(text): current_dir...
StarcoderdataPython
8026714
<reponame>paprikachan/biotool # -*- coding: utf-8 -*- """ tenxtools.io ~~~~~~~~~~~~ @Copyright: (c) 2018-06 by <NAME> (<EMAIL>). @License: LICENSE_NAME, see LICENSE for more details. """ import os import gzip import csv import vcf import yaml import pysam class Record(object): fields = [] s...
StarcoderdataPython
4852081
import os from pathlib import Path config = """subscriptionID: tenant_id: app_id: client_secret: resource_group: location: # english name of the location, for example centralus. ssh_key_private_file: ssh_key_public_file: ansible_host_key_checking: true name_for_logging: my_public_ip: none # ports will be exposed t...
StarcoderdataPython
11235478
from setuptools import setup setup( name='re_transliterate', version='1.3', url="https://github.com/MatthewDarling/re_transliterate/", py_modules=['re_transliterate'], include_package_data=True, #Metadata description='Functions for transliteration using regular expressions', long_desc...
StarcoderdataPython
300121
# Generated by Django 2.1 on 2018-12-26 00:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('journeylog', '0012_auto_20181223_0055'), ] operations = [ migrations.AddField( model_name='journalpage', name='timezon...
StarcoderdataPython
1706498
from dateutil.relativedelta import relativedelta from django.shortcuts import get_object_or_404 from django.core.exceptions import PermissionDenied from django.utils import timezone from rest_framework.viewsets import GenericViewSet from rest_framework.permissions import IsAuthenticated, IsAuthenticatedOrReadOnly fr...
StarcoderdataPython
1885501
<filename>Utils/InferenceHelpers/NCNNHelper.py from abc import ABC from Utils.InferenceHelpers.BaseInferenceHelper import CustomInferenceHelper class NCNNInferenceHelper(CustomInferenceHelper, ABC): def __init__(self, _algorithm_name): super().__init__() self.name = _algorithm_name self.t...
StarcoderdataPython
12847114
<filename>django_frontend_presets/presets/__init__.py from .Bootstrap import Bootstrap from .Init import Init from .React import React from .Reset import Reset from .Vue import Vue
StarcoderdataPython
1700403
<gh_stars>0 #!/usr/bin/python # Classification (U) """Program: mysql_db_dump.py Description: Runs the mysqldump program against a MySQL database and dumps one or more databases to file(s). Usage: mysql_db_dump.py -c file -d path {-B db_name [db_name ...] -o /path/name [-s] [-z] ...
StarcoderdataPython
164311
#!/usr/bin/env python # Runs "mean absolute deviation" QC metrics on two long-RNA-seq gene quantifications import os, subprocess, json import dxpy def divide_on_common(str_a,str_b): '''Divides each string into [common_prefix,variable_middle,common_ending] and returns as set (parts_a,parts_b).''' parts_a = [''...
StarcoderdataPython
151086
from django.contrib import admin import pytz from .models import Event from .forms import EventAdminForm @admin.register(Event) class EventAdmin(admin.ModelAdmin): raw_id_fields = ('attendees', 'facilitators', 'projects',) form = EventAdminForm def save_model(self, request, obj, form, change): ...
StarcoderdataPython
3308183
import requests from .Models import ResponseTx import binascii class WhatsOnChainLib(object): def __init__(self, txid): self.txid = txid @classmethod def get_textdata(self, txid): try: #print("txid") #print(txid) #time.sleep(0.1) if txid...
StarcoderdataPython
1848172
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from .models import Question from django.http import Http404 from django.urls import reverse from django.shortcuts import get_object_or_404 from django.http import JsonResponse import urllib.parse as urlparse from urllib.pars...
StarcoderdataPython
3427068
<reponame>kiraacorsac/wonderwordsmodule<filename>wonderwords/cmdline.py from rich.console import Console from rich.panel import Panel from rich.text import Text from rich.emoji import Emoji from rich.padding import Padding from rich.markdown import Markdown from . import __version__ console = Console() AVAILABLE_CO...
StarcoderdataPython
4906405
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Common sampler utilities.""" import random from typing import Tuple, Union from torchgeo.datasets.utils import BoundingBox def _to_tuple(value: Union[Tuple[float, float], float]) -> Tuple[float, float]: """Convert ...
StarcoderdataPython
269104
<gh_stars>0 from lxml import etree html = etree.parse('./test.html', etree.HTMLParser()) result = html.xpath('//*') print(result)
StarcoderdataPython
4996048
from functions_files import get_plaintext_from_container_file def get_container_content(container_file_name, container_password): container_data = {} container_content = "" if container_file_name == "": container_data = {'error': True, 'status': 'ERROR: Container name was not specified!'} eli...
StarcoderdataPython
4946113
<filename>siwe_auth/admin.py from django import forms from django.contrib import admin from django.contrib.auth.models import Group from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.core.exceptions import ValidationError from .m...
StarcoderdataPython
4947051
<gh_stars>1-10 import pytest from pubnub.pubnub import PubNub from pubnub.pnconfiguration import PNConfiguration from pubnub.endpoints.space.get_space import GetSpace from pubnub.exceptions import PubNubException SUB_KEY = 'sub' AUTH = 'auth' def test_get_space(): config = PNConfiguration() config.subscrib...
StarcoderdataPython
11398744
"""Subclass of settings_dialog, which is generated by wxFormBuilder.""" import os import re import wx from . import dialog_base def pop_error(msg): wx.MessageBox(msg, 'Error', wx.OK | wx.ICON_ERROR) class SettingsDialog(dialog_base.SettingsDialogBase): def __init__(self, config_save_func, ...
StarcoderdataPython
6494231
<reponame>datamut/date-calculator<filename>scidate/scidate/exceptions.py """ Customised Exceptions """ class InvalidDateException(Exception): """ Invalid Date Exception """ pass class InvalidDateFormatException(Exception): """ Invalid Date Format Exception """ pass
StarcoderdataPython
302940
import sys, os ApplicationDirectory = 'warehouse' ApplicationName = 'warehouse' VirtualEnvDirectory = 'python-app-venv' VirtualEnv = os.path.join(os.getcwd(), VirtualEnvDirectory, 'bin', 'python') if sys.executable != VirtualEnv: os.execl(VirtualEnv, VirtualEnv, *sys.argv) sys.path.insert(0, os.path.join(os.getcwd(), A...
StarcoderdataPython
1670652
<filename>shb-vgg/exp/12-05_13-19_SHHB_VGG_1e-05_[norm+flip]/code/old-cca/loaders.py import csv import math import os from glob import glob import cv2 import numpy as np from scipy.io import loadmat def get_density_map_gaussian(im, points): """ Create a Gaussian density map from the points. Credits: http...
StarcoderdataPython
1957975
import torch import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt import numpy as np classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck') def _get_transform(): return transforms.Compose( [transforms.ToTensor(), transforms.No...
StarcoderdataPython
9697111
import pickle from collections import Counter import json import jieba import nltk from tqdm import tqdm import numpy as np from config import train_filename,valid_filename,maxlen_in,\ vocab_file, maxlen_out, data_file, sos_id, eos_id, n_src_vocab, \ unk_id from utils import normalizeString, encode_text de...
StarcoderdataPython
6701107
import argparse import sys from itertools import izip from scipy.optimize import curve_fit import matplotlib.pyplot as plt import numpy as np import trace_parser import trace as trace_utils import string import pdb import search dot = lambda x,y: sum(a*b for a,b in izip(x,y)) def produce_gnuplot_file(costs, times, n...
StarcoderdataPython
147502
#!/usr/bin/python # # Copyright (c) 2019 Zim Kalinowski, (@zikalino) # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
StarcoderdataPython
9765317
<gh_stars>0 import mock import os import pytest import yaml from mlflow.entities.run_status import RunStatus from mlflow.projects import Project TEST_DIR = "tests" TEST_PROJECT_DIR = os.path.join(TEST_DIR, "resources", "example_project") GIT_PROJECT_URI = "https://github.com/mlflow/mlflow-example" def load_projec...
StarcoderdataPython
8155987
def show_color_swatches(): colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) # Sort colors by hue, saturation, value and name. by_hsv = sorted((tuple(mcolors.rgb_to_hsv(mcolors.to_rgba(color)[:3])), name) for name, color in colors.items()) sorted_names = [name for hsv, name in...
StarcoderdataPython
3365396
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Sortmerna(CMakePackage): """SortMeRNA is a program tool for filtering, mapping and OTU-pic...
StarcoderdataPython
3323948
import random def get_enemy(player): if player == 'X': return 'O' return 'X' def determine(board, player): a = -2 choices = [] if len(board.available_moves()) == 9: return 4 for move in board.available_moves(): board.make_move(move, player) val =...
StarcoderdataPython
105803
# @time: 2021/12/10 4:00 下午 # Author: pan # @File: ATM.py # @Software: PyCharm # 选做题:编写ATM程序实现下述功能,数据来源于文件db.txt # 1、充值功能:用户输入充值钱数,db.txt中该账号钱数完成修改 # 2、转账功能:用户A向用户B转账1000元,db.txt中完成用户A账号减钱,用户B账号加钱 # 3、提现功能:用户输入提现金额,db.txt中该账号钱数减少 # 4、查询余额功能:输入账号查询余额 db_data = {} def update_db_data(): """更新数据""" with open("db...
StarcoderdataPython
3463880
# Generated by Django 2.2.4 on 2019-08-14 10:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('evento', '0002_auto_20190814_1001'), ] operations = [ migrations.RemoveField( model_name='palestrante', name='slug', ...
StarcoderdataPython
6543272
<filename>pytupi/datasets/loader.py<gh_stars>0 import os import urllib import gzip import cPickle as pickle class Loader: def __init__(self, datasets, cache_folder): self._datasets = datasets self._cache_folder = cache_folder def get(self, dataset_name): dataset = self._datasets[data...
StarcoderdataPython
11200963
<filename>xgboost-0.6-py3.6.egg/xgboost/rabit/guide/broadcast.py<gh_stars>0 #!/usr/bin/python """ demo python script of rabit """ import os import sys # add path to wrapper # for normal run without tracker script, add following line # sys.path.append(os.path.dirname(__file__) + '/../wrapper') import rabit rabit.init()...
StarcoderdataPython
8183874
expected_output = { "clock_state": { "system_status": { "associations_address": "172.16.229.65", "associations_local_mode": "active", "clock_offset": 73.819, "clock_refid": ".GNSS.", "clock_state": "synchronized", "clock_stratum": 1, ...
StarcoderdataPython
3254134
<reponame>jeisch/bokeh import numpy as np from bokeh.io import show from bokeh.plotting import Figure from bokeh.models import ColumnDataSource, CustomJS, Spinner from bokeh.layouts import row, column data = np.random.rand(10, 2) cds = ColumnDataSource(data=dict(x=data[:, 0], y=data[:, 1])) p = Figure(x_range=(0, 1)...
StarcoderdataPython
6591613
<reponame>nizovn/luna-sysmgr<filename>hooks/webkitpy/tool/bot/irc_command.py # Copyright (c) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source co...
StarcoderdataPython
6629439
from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") def home(): return "Hello World"
StarcoderdataPython
4800955
<reponame>FrancescoConforte/ICT-in-Transport-System #%% import pymongo as pm from datetime import datetime client = pm.MongoClient('bigdatadb.polito.it', ssl=True, authSource = 'carsharing', tlsAllowInvalidCertificates=True) db = client['carsharin...
StarcoderdataPython
202719
<filename>core/platform/auth/firebase_auth_services_test.py # coding: utf-8 # # Copyright 2020 The Oppia Authors. 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 # # ...
StarcoderdataPython
1899155
<filename>docs/_static/demos/ml/SecondaryStructureWord2VecEncoder.ipynb.py # coding: utf-8 # # Secondary Structure Word2Vec Encoder # # This demo creates a dataset of sequence segments derived from a non-redundent set. The dataset contains the seuqence segment, the DSSP Q8 and DSSP Q3 code of the center residue in a...
StarcoderdataPython
3211546
<gh_stars>0 from os import write import sympy n = 13 def prime_test(number, witness): if witness >= number: raise ValueError("witness must be smaller than the number") elif number % 2 == 0: return False factor = (number - 1)/2 d = 1 while factor % 2 == 0: d += 1 factor = factor / 2 fac...
StarcoderdataPython
100006
<reponame>paulveillard/cybersecurity-http-encrypted #!/usr/bin/python3 import ssl, socket import sys import time, datetime import yaml import smtplib exitcode = 0 messages = [] ''' Read yaml file and return dictionary ''' def parse_yaml(filepath): with open(filepath) as f: dataMap = yaml.safe_load(f) ...
StarcoderdataPython
6529311
<filename>api/calendars/tests.py import json from django.contrib.auth import authenticate from django.contrib.auth import get_user_model from rest_framework.test import APITestCase from rest_framework_jwt.settings import api_settings from rest_framework.authtoken.models import Token from companies.models import Comp...
StarcoderdataPython
350168
<gh_stars>0 # Given 2 ints, a and b, return their sum. However, sums in the range 10..19 inclusive, are forbidden, so in # that case just return 20. # # sorta_sum(3, 4) → 7 # sorta_sum(9, 4) → 20 # sorta_sum(10, 11) → 21 def sorta_sum(a, b): if (a + b >= 10 and a + b <= 19): return 20 return a + b
StarcoderdataPython
269804
from onnx_tf.handlers.frontend_handler import FrontendHandler from onnx_tf.handlers.handler import onnx_op from onnx_tf.handlers.handler import tf_op @onnx_op("Relu") @tf_op("Relu") class Relu(FrontendHandler): @classmethod def version_1(cls, node, **kwargs): return cls.make_node_from_tf_node(node) @class...
StarcoderdataPython
1633159
<filename>spanning/__init__.py """Python Span Library Written by Gorea (https://github.com/Gorea235). """ __author__ = "Gorea (https://github.com/Gorea235)" __all__ = ["Span", "ReadOnlySpan"] import math class __SpanIter__: def __init__(self, span): self.__span = span self.__i = 0 def __ite...
StarcoderdataPython
11284336
<reponame>jakzy/Simple-Automatas from distutils.core import setup setup(name="statemap", version="0.03", description="SM runtime", author="<NAME>", author_email="<EMAIL>", url="http://smc.sourceforge.net", license="MPL 1.1", py_modules=['stat...
StarcoderdataPython
3575562
# Generated by Django 2.2 on 2019-04-26 09:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mysite', '0001_initial'), ] operations = [ migrations.CreateModel( name='BaseInfo', fields=[ ('id', mo...
StarcoderdataPython
8073279
<reponame>naradta/MedrecSampleTestOnCluster from java.io import FileInputStream import java.lang import os import string import sys import java.sql.SQLException from oracle.jdbc.pool import OracleDataSource propdir=sys.argv[6] propfile= propdir+"/resource_config.properties" propInputStream = FileInputStream(propfile)...
StarcoderdataPython
170444
<gh_stars>0 """Methods related to jwt, including encode, decode""" import jwt from base64 import b64decode from django.conf import settings import time from random import randint def decode_jwt(token): """Decodes the jwt token with ecrypted key from settings Returns the dict of data """ # Removes some...
StarcoderdataPython
11388965
from collections import defaultdict from mesa.visualization.ModularVisualization import ModularServer from mesa.visualization.UserParam import UserSettableParameter from mesa.visualization.modules import CanvasGrid from src.core.agents import SlidingWindowVoronoiAgent, VoronoiAgent, MultiMinimaxAgent from src.core.mo...
StarcoderdataPython
8026267
'''8. Посчитать, сколько раз встречается определенная цифра в введенной последовательности чисел. Количество вводимых чисел и цифра, которую необходимо посчитать, задаются вводом с клавиатуры.''' user_range = input('Введите последовательность: ') user_patten = input('Введите цифру для поиска: ') count = 0 for i in u...
StarcoderdataPython
1863182
from locust import HttpUser class AbstractUser(HttpUser): abstract = True def __init__(self, parent): super(AbstractUser, self).__init__(parent) self.user_attr = {} def set_email(self, email): self.user_attr['email'] = email def get_email(self): if 'email' in self.us...
StarcoderdataPython
3511397
# encoding: utf-8 import io ''' 字符串api: ord(str) 字符串的编码 len(str) 字符串长度 input() 从控制台读取字符串 str1 + str2 / str * n 字符串拼接 str1[n] 使用[]提取字符 replace() 实现字符串替换 str[起始偏移量 start:终止偏移量 end:步长 step] 字符串切片slice操作 [:] 提取整个字符串 "abcdef"[:] => "abcdef" [start:]从 start 索引开始到结尾 ...
StarcoderdataPython
5002174
<gh_stars>1000+ # -*- coding: utf-8 -*- # @Time : 2021/6/28 23:15 # @File : aastock_new_stock.py # @Author : Rocky <EMAIL> ''' http://www.aastocks.com/sc/stocks/market/ipo/listedipo.aspx?s=3&o=0&page=20 ''' import time from parsel import Selector from selenium import webdriver import sys sys.path.append('..') impor...
StarcoderdataPython
6546412
from django.apps import AppConfig default_app_config = 'leonardo_celery_email.Config' LEONARDO_APPS = ['leonardo_celery_email', 'djcelery_email'] LEONARDO_CONFIG = { "CELERY_MAIL_FAIL_SILENTLY": (True, "Fail silently in sending emails") } class Config(AppConfig): name = 'leonardo_celery_email' verbos...
StarcoderdataPython
11761
<gh_stars>0 # -*- coding:utf8 -*- import random import time from lib.navigation.PathFinding import Pathfinding from lib.control.Control import Control from lib.unit.Player import Player from lib.struct.CoordiPoint import CoordiPoint # 区域打怪 class AreaFighting(Pathfinding): # area_pos: 区域4角坐标。顺序为:左上,右上,左下,右下 def...
StarcoderdataPython
5064520
import discord from discord.ext import commands import chickensmoothie as cs class Pet: def __init__(self, bot): self.bot = bot @commands.command() @commands.guild_only() async def pet(self, ctx, link: str = ''): # Pet command pet = await cs.pet(link) # Get pet data if pet ...
StarcoderdataPython
6701713
class ParsedRule(): def __init__(self, predicate, params=[]): self._predicate = predicate self._params = params def __str__(self): self.__repr__() def __repr__(self): return str({ 'predicate': self._predicate, 'params': self._params }) def __eq__(self, other): if isinstance(other, str) or cal...
StarcoderdataPython
9712256
# Generated by Django 2.2.12 on 2020-06-11 11:22 import django.contrib.auth.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auth', '0011_update_proxy_permissions'), ('rbac', '0003_auto_20200603_1440'), ...
StarcoderdataPython
6446727
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """\ Subsetsum by splitting <NAME> et <NAME> - 2014-2018 """ # snip{ def part_sum(x_table, i=0): """All subsetsums from x_table[i:] :param x_table: table of values :param int i: index_table defining suffix_table of x_table to be considered :it...
StarcoderdataPython
366883
from os import PathLike from typing import Union AnyStr = Union[bytes, str] FSPath = Union[AnyStr, PathLike]
StarcoderdataPython
64681
<reponame>aeroaks/PySyft<filename>src/syft/__init__.py<gh_stars>0 # -*- coding: utf-8 -*- """ Welcome to the syft package! This package is the primary package for PySyft. This package has two kinds of attributes: submodules and convenience functions. Submodules are configured in the standard way, but the convenience fu...
StarcoderdataPython
3282152
<filename>vortex/VortexServerConnection.py """ * Created by Synerty Pty Ltd * * This software is open source, the MIT license applies. * * Website : http://www.synerty.com * Support : <EMAIL> """ import logging from datetime import datetime import pytz from twisted.internet import task from .PayloadPriority imp...
StarcoderdataPython
1957222
# (C) Copyright 1996- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernment...
StarcoderdataPython
333666
from operator import itemgetter # - an individual node contains the word associated with the node along with # pointers to its kids and parents. class node: def __init__(self, word): if word != None: self.word = word self.kids = [] self.parent = [] self....
StarcoderdataPython
1786647
def least_rotation(s): a, n = 0, len(s) s = s + s for b in range(n): for i in range(n): if (a + i == b) or (s[a + i] < s[b + i]): b += max(0, i - 1) break if s[a + i] > s[b + i]: a = b break return s[a:a + ...
StarcoderdataPython
8193641
# 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 th...
StarcoderdataPython
8028970
<gh_stars>0 import torch import torch.nn as nn import torchvision.models as models import torch.nn.functional as F class EncoderCNN(nn.Module): def __init__(self, embed_size): super(EncoderCNN, self).__init__() resnet = models.resnet50(pretrained=True) for param in resnet.parameters(): ...
StarcoderdataPython
9614601
# -*- coding: utf-8 -*- import openerp from openerp.http import request from openerp.osv import osv from openerp import SUPERUSER_ID from openerp.tools.translate import _ from datetime import datetime from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT import werkzeug.urls import urllib2 import simplejson impor...
StarcoderdataPython