id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
237912
#!/usr/bin/env python """ Created on 2015-09-27T16:51:39 """ from __future__ import division, print_function import sys import argparse import re import time try: import numpy as np except ImportError: print('You need numpy installed') sys.exit(1) import pandas as pd from splinter.browser import Browser i...
StarcoderdataPython
6481185
<gh_stars>0 class XmlSchema: pass class XmlDeclaration: pass class XmlDefinition: pass
StarcoderdataPython
6597175
from kubeadm import Kubeadm # noqa
StarcoderdataPython
6584232
""" @author: wangguanan @contact: <EMAIL> """ import os, copy from .reid_samples import ReIDSamples import torchvision class OccludedReID(ReIDSamples): """Occluded ReID Only include query and gallery dataset Suppose all query images belong to camera0, and gallery images camera 1 """ def __i...
StarcoderdataPython
9605444
<reponame>arthurshmidt/website<filename>sql_com_class.py from random import randint import mariadb import datetime import time # general syntax for connecting to MariaDB server # mysql -u root -p # USE to connect # SHOW to display # SELECT FROM to read # DROP to delete class database: def __init__(self): ...
StarcoderdataPython
11382021
from __future__ import print_function import contextlib import errno import hashlib import shutil import subprocess import tempfile from distutils.spawn import find_executable from os import makedirs, utime, system from os.path import basename from sys import stderr from ._elapsed import BeginEnd def rmtree(folder):...
StarcoderdataPython
4847474
from django.http import HttpResponse from django.shortcuts import render # Create your views here. from front.models import Category, Article def index(request): category = Category(name='国产') category.save() article = Article(title='论母猪的产后抚养', content='遇见你的时候你是傻逼') article.category = category ar...
StarcoderdataPython
3250763
<reponame>zhongxinghong/Botzone-Tank2<filename>core/_backup/march_into_enemy_base.py<gh_stars>10-100 # -*- coding: utf-8 -*- # @Author: Administrator # @Date: 2019-04-28 03:31:43 # @Last Modified by: Administrator # @Last Modified time: 2019-04-30 04:33:13 """ 不顾一切冲向敌方基地 Step: 1. 通过 BFS 查找到达对方基地的最近路径 2. 优先移动 3. 如果...
StarcoderdataPython
3249347
import sys import struct STX=0x02 def get_bcc(telegram_bytes): bcc = 0 for c in telegram_bytes: bcc = bcc ^ c return bcc class USSUndefinedAddressException(Exception): pass class USSEmptyNetDataException(Exception): pass class USSIncorrectBCCException(Exception): pass class MasterTelegram(bytearray):...
StarcoderdataPython
6556284
<reponame>jianzhnie/d2nlp ''' Author: jianzhnie Date: 2021-12-23 16:23:02 LastEditTime: 2022-01-05 16:26:43 LastEditors: jianzhnie Description: ''' import os import d2l.torch as d2l import torch import torch.nn as nn d2l.DATA_HUB['glove.6b.50d'] = (d2l.DATA_URL + 'glove.6B.50d.zip', '...
StarcoderdataPython
5157843
<filename>cose/messages/sign1message.py from typing import Optional, Union, TYPE_CHECKING import cbor2 from cose import utils from cose.messages.cosemessage import CoseMessage from cose.messages.signcommon import SignCommon if TYPE_CHECKING: from cose.keys.ec2 import EC2 from cose.keys.okp import OKP fro...
StarcoderdataPython
1650134
# -*- coding: utf-8 -*- import logging from abc import ABC, abstractmethod import numpy as np import cvxpy as cp def cvx_desc_to_solver(solver_desc): if solver_desc == "SCS": return cp.SCS elif solver_desc == "MOSEK": return cp.MOSEK elif solver_desc == "CVXOPT": return cp.CVXOPT ...
StarcoderdataPython
1683992
<filename>build/django-blog-zinnia/zinnia/urls/search.py """Urls for the Zinnia search""" from django.conf.urls import url from django.conf.urls import patterns from zinnia.views.search import EntrySearch urlpatterns = patterns( '', url(r'^$', EntrySearch.as_view(), name='zinnia_entry_search'), )
StarcoderdataPython
318426
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 第一节 + Python解释器 + Python运行 + Python输入输出 + Python字符串 + Python整数和浮点数 ''' #%% Python 解释器 # Python拥有许多解释器 # + CPython 是默认的python解释器,用C语言编写。 # + ipython 基于 CPython 的交互式解释器 # + PyPy 采用JIT(动态编译)方法,加速Python运行 # + JPython 可以把 python 代码编译成 java 字节码,在JVM上运行 # + IronPython 把 pytho...
StarcoderdataPython
8119877
<reponame>glowlex/pydashlite from typing import Dict, TypeVar, Hashable, List V = TypeVar('V') K = TypeVar('K', bound=Hashable) def chunkDict(obj: Dict[K, V], size: int = 1) -> List[Dict[K, V]]: res = [] if size < 1: raise ValueError("size must be greater 0") ks = list(obj) for i in range(len...
StarcoderdataPython
8074684
<filename>modules/db.py # Get vulns to sync temp1 = 'select * from "ANALYSIS" INNER JOIN "VULNERABILITY" ON "ANALYSIS"."VULNERABILITY_ID" = "VULNERABILITY"."ID" where "ANALYSIS"."STATE" in (\'EXPLOITABLE\', \'IN_TRIAGE\');' # Get vulns to sync with properties ex_get_vulns_to_sync=''' select * from "ANALYSIS" inner j...
StarcoderdataPython
4954130
__version__ = "0.1.0" from .mws import MWS from .datatypes import ShipFromAddress, InboundShipmentHeader __all__ = ['MWS', 'ShipFromAddress', 'InboundShipmentHeader']
StarcoderdataPython
6545334
from rest_framework.response import Response from rest_framework.decorators import api_view from .models import Pessoa import random # Create your views here. @api_view(['GET']) def pessoas_view(request): if request.method == 'GET': pessoas = Pessoa.objects.all() output = [{ 'login': ca...
StarcoderdataPython
11342946
# python 3 import matplotlib # matplotlib.use('pgf') # pgf_with_pdflatex = { # "pgf.texsystem": "pdflatex", # "pgf.preamble": [ # r"\usepackage[utf8x]{inputenc}", # r"\usepackage[T1]{fontenc}", # r"\usepackage{cmbright}", # ] # } # matplotlib.rcParams.update(pgf_with_pdflate...
StarcoderdataPython
8176507
<reponame>demon-xxi/r8 #!/usr/bin/env python # Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. import sys import toolhelper if __name__ == '__main__': sys.e...
StarcoderdataPython
1627644
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='cabot-alert-xoxzo', version='1.0.0', description='A XoxZo plugin for Cabot by Arachnys', author='Shaurya', author_email='<EMAIL>', url='http://cabotapp.com', packages=find_packages(), )
StarcoderdataPython
6565611
<filename>container/model.py import collections ''' processing_callback: callable; called with (in_fh, out_fh) ''' ContainerImageUploadRequest = collections.namedtuple( 'ContainerImageUploadRequest', ['source_ref', 'target_ref', 'processing_callback'], # defaults=[None], XXX re-enable after upgrading to Py...
StarcoderdataPython
6470895
import pandas as pd import numpy as np import random import csv def isNan(string): return string != string def occurences(model): """returns percentage of each color in each model as a color: percent dictionary""" nulls = 0 notnulls = 0 occurence = {} #finds occurence of each c...
StarcoderdataPython
107130
<reponame>choderalab/gin import gin import flow import tensorflow as tf import numpy as np import lime import chinese_postman_routes mols = [gin.i_o.from_smiles.to_mol(idx * 'C') for idx in range(2, 4)] mols = [gin.deterministic.hydrogen.add_hydrogen(mol) for mol in mols] _chinese_postman_routes = [chinese_postman_r...
StarcoderdataPython
1910116
<reponame>pschulam/lmbases import numpy as np import lmbases def test_against_r_splines_uniform(): '''Compare BSplines class against R's bsplines with uniform knots. Generate the ground truth with the following R commands: > library(splines) > x <- c(1.5, 3.3, 5.1, 7.2, 9.9) > k <- c(2.5, 5.0, ...
StarcoderdataPython
12857364
import json import logging import os import pdb import re from helpers.app_helpers import * from helpers.page_helpers import * from helpers.jinja2_helpers import * from helpers.telegram_helpers import * #from main import * #from flask import request #####################################################################...
StarcoderdataPython
1638341
from collections import OrderedDict import json import errno import os import re class ConfigError(Exception): pass class FileNotFoundError(Exception): def __init__(self, filename): Exception.__init__(self, '[Errno %s] %s: \'%s\'' % (errno.ENOENT, os.strerror(errno.ENOENT), filename)) class FileFo...
StarcoderdataPython
6663661
# Copyright 2021 cedar.ai. 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 applicable law or agre...
StarcoderdataPython
8173871
#!/usr/bin/env python import re from datetime import datetime, timedelta, date from requests.exceptions import ConnectionError, ReadTimeout, SSLError import time, sys, traceback import mysql.connector from tweet_getter import TweetGetter from requests_oauthlib import OAuth1Session ''' crontab -eの場合は以下のimport ''' DB_...
StarcoderdataPython
6665505
#!/usr/bin/env python3 import argparse from enum import Enum class Actions(Enum): ARCHIVE = 0 DELETE = 1 class SelectorTypes(Enum): FROM = 0 TO = 1 SUBJECT_CONTAINS = 2 CSV_ACTIONS_2_ENUM_VALUE = { "deleted": Actions.ARCHIVE, "archive": Actions.DELETE, } CSV_SELECTOR_TYPES_2_ENUM_VALUE =...
StarcoderdataPython
6519563
<filename>integrator/fitbit_client.py<gh_stars>0 __author__ = 'Tauren' import os import requests import base64 class FitbitClient: def __init__(self): pass def exchange_refresh_token(self, current_refresh_token): """ Exchange a refresh token for new access and refresh token :return: ...
StarcoderdataPython
9665228
import subprocess import os import argparse import sys parser = argparse.ArgumentParser(description='Profile Codegen') parser.add_argument('--cuda-bin', default='/usr/local/cuda/bin/', type=str, help='Cuda Path') parser.add_argument('--task-name', default='MRPC', type=str, help='Glue Benchmark task.') parser.add_argu...
StarcoderdataPython
8131396
<gh_stars>0 from .torch_dataset import TorchDataset __all__ = ['TorchDataset']
StarcoderdataPython
1966023
<gh_stars>0 #1017 #ENTRADA tempo_horas = int(input()) velocidade = int(input()) #CALCULO #ANÁLISE BIDIMENSIONAL>> SE KM/H * H = KM, então: distancia_percorrida = velocidade*tempo_horas #ANÁLISE BIDIMENSIONAL>> SE TEMOS KM e QUEREMOS KM/L, então KM/KM/L = L: combustivel = distancia_percorrida/12 print('{:.3f}'....
StarcoderdataPython
58093
from __future__ import absolute_import, division, print_function, unicode_literals from builtins import * import unittest.mock as mock from zsl.service.service import SessionFactory from zsl.testing.db import TestSessionFactory as DbTestTestSessionFactory from zsl.utils.injection_helper import bind def mock_db_sess...
StarcoderdataPython
4827367
<filename>server/front.py<gh_stars>0 from flask import Flask from flask import jsonify from flask import render_template from api import api app = Flask(__name__) @app.route("/domain/<domain>/<lang>/<page>") @app.route("/") def main(**kwargs): return render_template("app.html") if __name__ == "__main__": app.re...
StarcoderdataPython
5014938
<reponame>ministryofjustice/analytics-platform-atlantis-example<filename>modules/lambda_function/hello_world/hello.py import os name = os.environ.get('NAME') def hello_handler(event, context): return f"Hello {name}"
StarcoderdataPython
11237572
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isBalanced(self, root): def getDepth(node): if not node: return 0 left = getDepth(node.left) right = ge...
StarcoderdataPython
1622673
#!/usr/bin/env python # encoding: utf-8 """ """ from web import Storage from teslafaas.container.webpy.context_manager import ContextManager from teslafaas.container.webpy.http_error_process import customize_http_error import os import sys import web import json import pkgutil import logging import importlib from cod...
StarcoderdataPython
1871711
<gh_stars>1-10 # coding: utf-8 get_ipython().magic(u'pylab inline') import csv, twitter, json, nltk import networkx as nx from functools import reduce from matplotlib import pyplot as plt from wordcloud import WordCloud CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET = "", "", "", "" def accede_a_tw...
StarcoderdataPython
13297
flat_x = x.flatten() flat_y = y.flatten() flat_z = z.flatten() size = flat_x.shape[0] filename = 'landscapeData.h' open(filename, 'w').close() f = open(filename, 'a') f.write('#include "LinearMath/btScalar.h"\n#define Landscape01VtxCount 4\n#define Landscape01IdxCount 4\nbtScalar Landscape01Vtx[] = {\n') for i in r...
StarcoderdataPython
8197254
#Set up file logging import datetime import sys args = sys.argv #If we're to print the output if 'print' in args: #Just raise exceptions def logexe(e): raise e #Print out all logging logfun = print #Otherwise, we're logging the output: else: import logging #Log to logs/bot <time>.log ...
StarcoderdataPython
8036737
<filename>model/components/__init__.py from model.components.binarizer import Binarizer
StarcoderdataPython
3335019
#!/usr/bin/env python3 import sys TARGETS = { 'A': 3, 'B': 5, 'C': 7, 'D': 9 } COSTS = { 'A': 1, 'B': 10, 'C': 100, 'D': 1000 } def blocked(cmap, x, y): a = min(x, y) b = max(x, y) for i in range(a, b): if cmap[1][i] != '.': return True return Fal...
StarcoderdataPython
6427348
<filename>feedback/backend/routes/user.py from datetime import datetime import urllib.parse from bcrypt import hashpw from flask import Blueprint, request, jsonify, redirect from flask_login import login_user, logout_user, current_user, login_required from feedback.backend.models import Role, Volunteer user_bp = Blu...
StarcoderdataPython
9660387
from setuptools import setup, find_packages import unittest import codecs import compare_mt def test_suite(): test_loader = unittest.TestLoader() test_suite = test_loader.discover("compare_mt/tests", pattern="test_*.py") return test_suite setup( name="compare_mt", version=compare_mt.__version__, descri...
StarcoderdataPython
12837623
<gh_stars>1-10 import django from os import path SECRET_KEY = 'not secret' INSTALLED_APPS = ('response_timeout', 'test') TEMPLATE_DEBUG = DEBUG = True DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'response_timeout.db', }, } ROOT_URLCONF = 'test.urls' # Testing i...
StarcoderdataPython
1744678
<reponame>Fabrice-64/OC_Project_8 """ These tests are for the views in food_items. RequestFactory has been selected in order to generate a request and check the transfer of data between the views and the templates. """ from django.test import TestCase, RequestFactory from django.contrib.auth.models imp...
StarcoderdataPython
4857399
""" Convert an LAS LIDAR file to a shapefile by creating a 3D triangle mesh using Delaunay Triangulation. """ # http://git.io/vOE4f # cPickle is used to store # tessalated triangles # to save time writing # future shapefiles import pickle import os import time import math import numpy as np import shapefile # laspy ...
StarcoderdataPython
5071609
<filename>2-Mandelbrot/cffi-out-of-line/build_mandelbrot.py<gh_stars>0 import numpy from cffi import FFI ffi = FFI() Ccode = open('C_fmandel.c', 'r').read() ffi.set_source("_mandelbrot", Ccode) Cdefs = open('C_fmandel.h', 'r').read() ffi.cdef(Cdefs) if __name__ == "__main__": ffi.compile()
StarcoderdataPython
6478670
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import numpy as np import argparse import csv import split_acti import pickle import time import keras.backend as K from numpy.random import seed from sklearn.metrics import accuracy_score import tensorflow def main(pca_dims, compress_rate, s_rate): ...
StarcoderdataPython
9635356
#!/usr/bin/env fontforge # # Copyright (c) 2017, <NAME> (https://sungsit.com | gibbozer [at] gmail [dot] com). # # This Font Software is licensed under the SIL Open Font License, Version 1.1 (OFL). # You should have received a copy of the OFL License along with this file. # If not, see http://scripts.sil.org/OFL # # T...
StarcoderdataPython
392188
<reponame>mpi-array/mpi_array """ ========================================= The :mod:`mpi_array.globale_ufunc` Module ========================================= Defines :obj:`numpy.ufunc` functions for :obj:`mpi_array.globale.gndarray`. Classes ======= .. autosummary:: :toctree: generated/ GndarrayArrayUfuncEx...
StarcoderdataPython
5029653
<gh_stars>10-100 # ---------------------------------------------------------------------- # Service documentation request handler # ---------------------------------------------------------------------- # Copyright (C) 2007-2015 The NOC Project # See LICENSE for details # -----------------------------------------------...
StarcoderdataPython
113823
<reponame>subhadarship/GermEval2021 import pandas as pd import os if __name__ == "__main__": LABEL_COLUMN_NAMES = ['Sub1_Toxic', 'Sub2_Engaging', 'Sub3_FactClaiming'] PRED_DIR = os.path.join('../predictions/best_models/') SUBMISSION_DIR = os.path.join('../submission') TEST_INP_FILE_PATH = os.path.join(...
StarcoderdataPython
1871565
from typing import Union from math import floor from .strings import SCALE, NUMBER_TEXT, TYPO_LIST, JOINERS, PREFIXES, UNITS, TEN, MAGNITUDE from ..ordinal_suffix import add as add_ordinal_suffix, remove as remove_ordinal_suffix from ..separator import add as add_separator class LANGUAGES: EN = 'en' FA = 'fa'...
StarcoderdataPython
6547860
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-20 20:39 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('showcase', '0007_gallery_total_rankers'), ] operations = [ migrations.RenameField( ...
StarcoderdataPython
5045709
import sdl2 from ui_element import UIElement from ui_dialog import UIDialog class PagedInfoDialog(UIDialog): "dialog that presents multiple pages of info w/ buttons to navigate next/last page" title = 'Info' # message = list of page strings, each can be triple-quoted / contain line breaks me...
StarcoderdataPython
1682809
<gh_stars>0 import datetime from typing import List, Optional import climsoft_api.api.station.schema as station_schema from climsoft_api.api.schema import BaseSchema, Response from pydantic import constr, Field class CreateStationLocationHistory(BaseSchema): belongsTo: constr(max_length=255) = Field(title="Belong...
StarcoderdataPython
1938423
<gh_stars>1-10 import unittest import doctest import unifhy._utils if __name__ == '__main__': test_loader = unittest.TestLoader() test_suite = unittest.TestSuite() test_suite.addTests(doctest.DocTestSuite(unifhy._utils.compass)) runner = unittest.TextTestRunner(verbosity=2) runner.run(test_suit...
StarcoderdataPython
6552822
<filename>char_scripts/migrations/0001_initial.py # Generated by Django 3.2.6 on 2021-09-25 17:10 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_de...
StarcoderdataPython
12850421
<filename>tasks/prime.py # -*- coding: utf-8 -*- """ TaskSets and tasks for the Prime & Support APIs """ import logging import json import random from copy import deepcopy from typing import Dict from locust import tag, task, TaskSet from utils.constants import ( INTERNAL_API_KEY, TEST_PDF, ZERO_UUID, ...
StarcoderdataPython
3271911
# Copyright 2021 <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, softw...
StarcoderdataPython
1619595
import pytest from brownie import PriceFeed, accounts, network def test_can_deploy_contract(mainnet_eth_usd_address): # Arrange if network.show_active() != 'mainnet-fork': pytest.skip('Only works for mainnet-fork network') # Act price_feed = PriceFeed.deploy( mainnet_eth_usd_address, {...
StarcoderdataPython
5078578
import os,sys,time os.system('clear') def babi(nob): for e in nob: sys.stdout.write(e) sys.stdout.flush() time.sleep(0.1) babi('<NAME> MY NAME IS <NAME>') print babi('YOU WELCOME TO VISIT OUR TOOL AND YOU DONT FORGET') print babi('FRIENDS THIS TOOL IT WAS CREATED BY MiSetya And Update With 080Hacker') ...
StarcoderdataPython
3553026
<filename>src/command_modules/azure-cli-reservations/azure/cli/command_modules/reservations/_help.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the projec...
StarcoderdataPython
4980488
#!/usr/bin/env python3 import scanner # ------------------------------------------------------------------------------ # Classes for holding source code entities class Module(object): def __init__(self): self.brief = '' self.detail = '' self.functions = set() self.calls = set() class Function(object): ...
StarcoderdataPython
3487026
<reponame>patrick-nanys/python_nlp_2020_fall #! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2020 <NAME> <<EMAIL>> # # Distributed under terms of the MIT license. from lab_solutions.lab02_03_is_matrix import is_matrix def rowwise_max(M): if not is_matrix(M): raise ValueError(f'Matrix {M} i...
StarcoderdataPython
3242764
<reponame>rodelrebucas/dev-overload-starterpack """ Thread or Thread of execution is a set of instructions that need to be executed. Resides under a Process, each threads can share resource from other threads. Threads are usually use for I/O bound task, to avoid an idle CPU and blocking a main thread. ...
StarcoderdataPython
12856159
<filename>remove_empty_csv's.py import psycopg2 import sys from nltk.tokenize import sent_tokenize import re import csv import os # pmid {16300001 - 16400000} try: # starting_pmid = 16300001 # intermediate_pmid = 16400000 starting_pmid = 100001 intermediate_pmid = 200000 ending_pmid = 32078260 ...
StarcoderdataPython
10716
import tensorflow as tf def _smooth_l1_loss(y_true, y_pred): t = tf.abs(y_pred - y_true) return tf.where(t < 1, 0.5 * t ** 2, t - 0.5) def MultiBoxLoss(num_class=2, neg_pos_ratio=3): """multi-box loss""" def multi_box_loss(y_true, y_pred): num_batch = tf.shape(y_true)[0] num_prior = ...
StarcoderdataPython
3316787
from django.db.models.signals import post_save from django.dispatch import receiver from .models import Question, Answer, QuestionAnswer from .utils import notify_new_question @receiver(post_save, sender=Question) def new_question_handler(sender, instance, created, **kwargs): subject = f'New question from {insta...
StarcoderdataPython
9689984
######## # Copyright (c) 2016 GigaSpaces Technologies Ltd. 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...
StarcoderdataPython
6577933
""" A reader for sunpy map data. """ from qtpy import QtWidgets import sunpy.map from sunpy.map.mapbase import GenericMap from glue.config import data_factory, importer, qglue_parser from glue.core.data import Data from glue.core.component import Component from glue.core.visual import VisualAttributes from glue.core...
StarcoderdataPython
343323
<filename>robot/Cumulus/resources/AffiliationPageObject.py<gh_stars>0 from cumulusci.robotframework.pageobjects import ListingPage from cumulusci.robotframework.pageobjects import DetailPage from cumulusci.robotframework.pageobjects import pageobject from BaseObjects import BaseNPSPPage from NPSP import npsp_lex_locato...
StarcoderdataPython
159102
#Exercício025 name = str(input('Qual seu nome completo?: ')).strip().upper() print('Seu nome tem a palavra SILVA?: {}'.format('SILVA'in name)) print('xD')
StarcoderdataPython
1991444
from flask_wtf import Form from wtforms.fields import StringField class SearchForm(Form): search_field = StringField('Search')
StarcoderdataPython
1858867
<filename>profile_app/views.py from django.shortcuts import render from django.http import HttpResponseRedirect from submit_site import models from django.contrib.auth.models import User # Create your views here. def edit_profile(request): if not request.user.is_authenticated(): return HttpRequestRedir...
StarcoderdataPython
9716685
""" Copyright 2016-present Nike, Inc. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
StarcoderdataPython
8186761
<filename>generate.py from jinja2 import Environment, FileSystemLoader import csv def _render_template(name, seats): file_loader = FileSystemLoader('templates') env = Environment( loader=file_loader, trim_blocks=True, lstrip_blocks=True, keep_trailing_newline=True, ) te...
StarcoderdataPython
1691834
import numpy as np class Activator(object): def forward(self, z): pass def backward(self, z, a, delta): pass class Identity(Activator): def forward(self, z): return z def backward(self, z, a, delta): return delta, a class Sigmoid(Activator): ...
StarcoderdataPython
8074617
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\routing\route_events\route_event_type_animation.py # Compiled at: 2020-08-25 01:06:19 # Size of sour...
StarcoderdataPython
256559
# -*- coding: utf-8 -*- """ *This application demonstrates a simulation of a schedule of fires given geospatial locations and specified datetimes (at one minute resolution)* The application contains a single :obj:`Environment` class which listens to the time status published by the manager application and ...
StarcoderdataPython
4934832
# Generated by Django 2.0.6 on 2019-03-13 17:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('misclientes', '0048_auto_20190301_1753'), ] operations = [ migrations.AlterField( model_name='enterprise', name='cod...
StarcoderdataPython
6423241
#!/usr/bin/python # -*- coding: utf-8 -*- # === About ============================================================================================================ """ getArticleURLController.py Copyright © 2017 <NAME>. This software is released under the MIT License. Version: 1.0.0 TranslateAuthors: <NAME> E-mail...
StarcoderdataPython
376473
#!/usr/bin/python # -*- coding: utf-8 -*- # Author: illuz <<EMAIL>uzen[at]gmail.com> # File: AC_stack_n.py # Create Date: 2015-07-26 10:53:38 # Usage: AC_stack_n.py # Descripton: # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left...
StarcoderdataPython
289026
from dataclasses import dataclass, field @dataclass class TaskRunnerConfig: onlyRunScenarioTags: list[str] = field(default_factory=list) featureFiles: list[str] = field(default_factory=list)
StarcoderdataPython
6651955
# -*- coding: utf-8 -*- from __future__ import absolute_import from .base import Type class Mp4(Type): """ Implements the MP4 video type matcher. """ MIME = 'video/mp4' EXTENSION = 'mp4' def __init__(self): super(Mp4, self).__init__( mime=Mp4.MIME, extension=...
StarcoderdataPython
5148484
<reponame>chaosannals/trial-python def selection_sort(source): ''' 选择排序 【不稳定排序】 平均时间复杂度:O(n^2) ''' target = source[:] count = len(target) for i in range(0, count - 1): minIndex = i for j in range(i + 1, count): minIndex = minIndex if target[minIndex] < target[...
StarcoderdataPython
12822564
<reponame>motazsaad/face-count # coding: utf-8 import numpy as np import os import warnings import logging #import xml.etree.ElementTree as ET import scipy.io import chainer from chainercv.utils import read_image class WIDERFACEDataset(chainer.dataset.DatasetMixin): def __init__(self, data_dir, label_mat_file...
StarcoderdataPython
9790572
<filename>presqt/targets/osf/tests/views/resource/test_resource_collection.py<gh_stars>1-10 from django.test import SimpleTestCase from rest_framework.reverse import reverse from rest_framework.test import APIClient from config.settings.base import OSF_PRESQT_FORK_TOKEN, OSF_TEST_USER_TOKEN class TestResourceCollect...
StarcoderdataPython
9679794
<filename>models/multihead_builders.py import sys from pathlib import Path from typing import Dict, NewType, Union import numpy as np import torch import torch.nn as nn root_path = Path(__file__).resolve().parents[1] if str(root_path) not in sys.path: print(f"Adding pipeline tf2 root in sys.path: {root_path}") ...
StarcoderdataPython
9616797
<filename>models/mreasoner/mreasoner.py import ccobra import numpy as np class MReasoner(ccobra.CCobraModel): def __init__(self, name='mReasoner'): super(MReasoner, self).__init__(name, ['syllogistic'], ['single-choice']) # Prepare cache self.cache = np.load('cache/2020-09-09-cache-11-10.n...
StarcoderdataPython
9631919
"""HADDOCK3 modules.""" from abc import ABC, abstractmethod from contextlib import contextmanager from functools import partial from pathlib import Path from haddock import EmptyPath, log, modules_defaults_path from haddock.core.defaults import MODULE_IO_FILE from haddock.core.exceptions import ConfigurationError from...
StarcoderdataPython
5128277
<filename>deneme2.py import locale import sys locale.setlocale(locale.LC_ALL, "tr_TR.utf-8") a = ["ali", "veli", "ahmet", "cengiz"] e = ["ayse", "vefa", "asli", "ceren"] b = "" c = "<NAME> VE iskata" d = 13 dosya = open("yeni", "r+") dosya.truncate(19)
StarcoderdataPython
8155440
import numpy as np import pytest import pandas as pd from pandas import DataFrame, Index, date_range import pandas._testing as tm @pytest.mark.parametrize("func", ["ffill", "bfill"]) def test_groupby_column_index_name_lost_fill_funcs(func): # GH: 29764 groupby loses index sometimes df = pd.DataFrame( ...
StarcoderdataPython
9663796
<filename>py/pe/pe8.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Discover the largest product of five consecutive digits in the 1000-digit number. """ def pe8(fname="../../res/pe8.txt", n=5): """ Discover the largest product of five consecutive digits in the 1000-digit number. >>> pe8() 40...
StarcoderdataPython
11318318
<gh_stars>1-10 import torch import torch.nn as nn import torch.nn.functional as F from .abstracts import BaseNetwork class GymEnvModel(BaseNetwork): def __init__(self, num_state=8, num_action=4, discrete_action=True, gru=True): super(GymEnvModel, self).__init__() self.num_action = num_action ...
StarcoderdataPython
5163974
<reponame>borisgrafx/client #!/usr/bin/env python """Code saving. The main script will be saved if enabled in the users profile settings. """ import wandb run = wandb.init() run.finish()
StarcoderdataPython
6429359
<reponame>vineetjohn/ctci-hackerrank ''' Sorting: Comparator ''' import json from functools import cmp_to_key class Player(object): ''' Player object containing name and score ''' def __init__(self, name, score): self.name = name self.score = score def __repr__(self): object_dic...
StarcoderdataPython