id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
319960
<filename>applications/cpfecys/controllers/dsi.py # coding: utf8 @auth.requires_login() @auth.requires_membership('DSI') def index(): admin = False period = cpfecys.current_year_period() restrictions = db( (db.item_restriction.item_type==db.item_type(name='Activity'))& \ ((db.item_restriction...
StarcoderdataPython
288077
<filename>memorylane/memorylane/forms.py #files.py import re from django import forms from .models import Memory from django.utils.translation import ugettext_lazy as _ class RegistrationForm(forms.Form): username = forms.CharField(label="username", max_length=100) # if not User.objects.filter(username).exi...
StarcoderdataPython
5127801
from keras.layers import GRU, LSTM, Dense, Dropout, LeakyReLU do_rate = 0.10 def get_simple_single_layer_fc_lstm_func_api_model_output(model_input, num_classes): # LSTM: First and following return sequences must be True, Last return sequence must be False lstm_1 = LSTM(16, return_sequences=True, activation="...
StarcoderdataPython
6696504
# Copyright Notice: # Copyright 2018 Dell, Inc. All rights reserved. # License: BSD License. For full license text see link: https://github.com/RedDrum-Redfish-Project/RedDrum-Simulator/LICENSE.txt import os import sys import json import inspect # Backend root class for Simulator from .chassisBackend import...
StarcoderdataPython
1621869
<filename>examples/SemisupervisedDoubleHelix.py from shared import create_dummy_data as ccd from semisupervised.depLabelPropagation import label_propagation from pyspark.sql import functions as F from shared.Plot2DGraphs import plot3D def double_helix(sc, example, label): spark_double_helix = ccd.create_spark_dat...
StarcoderdataPython
6564821
"""smp_base.measures_probes .. moduleauthor:: <NAME>, 2018 Use measures inside a probe [1] to quantify location or time dependent model performance. Here we initially use regression rather than classification as the measure but the principle is the same: - create an adequate but simple model (e.g. ridge regression) ...
StarcoderdataPython
1802417
<reponame>sunwookimiub/BLSH from argparse import ArgumentParser import numpy as np import pickle import time import os import torch import torch.nn as nn from torch.autograd import Variable from utils import pt_to_np, signBNN, bssm_tanh, bssm_sign, bssm_sign_nograd, xent_fn, validate, save_pkl, load_pkl, get_beta im...
StarcoderdataPython
9703954
<filename>Sipros/Scripts/sipros_ensemble_filtering.py ''' Created on Sep 7, 2016 @author: xgo ''' import getopt, sys, os import numpy as np import csv import math import re try: from sets import Set except ImportError: pass from datetime import datetime, date, time from collections import namedtuple from sk...
StarcoderdataPython
11381462
## the following parameters are intrinsic to create_input_files - used in train dataset = 'coco' # options are {'coco', 'flickr8k', 'flickr30k'} karpathy_json_path = 'D:\\Datasets\\cv\\ms_coco\\caption_datasets\\dataset_coco.json' image_foldr_path = 'D:\\Datasets\\cv\\ms_coco\\images\\' captions_per_image = 5 min_word...
StarcoderdataPython
1690165
<filename>#2 Mundo/#14/58.2.py from random import randint computador= randint(0,10) acertou =False palpites=0 while not acertou: jogador= int(input('Qual seu palpite? ')) palpites +=1 if jogador== computador: acertou= True else: if jogador > computador: print('Muito alto') ...
StarcoderdataPython
33957
<gh_stars>0 from django.shortcuts import render,redirect from django.views.generic import View from django.contrib.auth.models import User from .forms import LoginUser,RegisterUser from django.http import HttpResponse,Http404 from django.contrib.auth import authenticate,login,logout class UserLogin(View): form_cla...
StarcoderdataPython
67192
<gh_stars>1-10 # Once for All: Train One Network and Specialize it for Efficient Deployment # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # International Conference on Learning Representations (ICLR), 2020. import yaml from search.rm_search.ofa.utils import download_url, make_divisible, MyNetwork __all__ = ['count_conv_fl...
StarcoderdataPython
8021766
from simiir.search_interfaces import Document from simiir.serp_impressions.base_serp_impression import BaseSERPImpression class PerfectSERPImpression(BaseSERPImpression): """ A SERP impression component that has access to TREC QRELS. From this information, the component is able to make a "perfect" judgemen...
StarcoderdataPython
11248577
from dataclasses import asdict, dataclass, field from pathlib import Path from typing import List import yaml from .exceptions import ( DatasetSetupException, NotAnArtifactException, ProjectSetupException, ) from .naming import ( COMPLETE_ENV_NAME, DATA_PATH, DEFAULT_BRANCH_NAME, DEFAULT_R...
StarcoderdataPython
11274407
<filename>examples/06_vtk/00_ClientOnly/client-side-cone.py r""" Version for trame 1.x - https://github.com/Kitware/trame/blob/release-v1/examples/PlainPython/ClientOnlyVTK/app.py Delta v1..v2 - https://github.com/Kitware/trame/commit/33f52b6bb9eb73129b181699a94be9ad86187d49 """ from trame.app import get_serv...
StarcoderdataPython
3532641
import logging from gevent.queue import Queue as TaskQueue from cronjob.settings import settings task_queue = TaskQueue(settings.DEFAULT_TASK_QUEUE_SIZE) class BaseTask: """ 这个类是对Job的封装,提供统一的接口给Worker执行 """ def run(self): raise NotImplementedError @property def logger(self): ...
StarcoderdataPython
4998093
<reponame>gdmcbain/quadpy # -*- coding: utf-8 -*- # from __future__ import division import numpy import sympy from .helpers import integrate_monomial_over_unit_nsphere from ..helpers import untangle, pm, fsd class Stroud1969(object): """ <NAME>, A Fifth Degree Integration Formula for the n-Simplex, ...
StarcoderdataPython
1752816
<gh_stars>0 from flask import current_app as app from flask_restful import Resource, fields, marshal_with, reqparse import http_status from models.courses import CourseModel from controllers.chapters import resource_fields as chapter_fields resource_fields = { 'id': fields.Integer(default=None), 'name': f...
StarcoderdataPython
11209471
# coding=utf-8 ''' @ Summary: @ Update: @ file: __init__.py @ version: 1.0.0 @ Author: <EMAIL> @ Date: 2020/12/23 16:54 '''
StarcoderdataPython
5172853
import pandas as pd df1 = pd.read_csv("student1.csv") df2 = pd.read_csv("student2.csv") s1 = set([ tuple(values) for values in df1.values.tolist()]) s2 = set([ tuple(values) for values in df2.values.tolist()]) s1.symmetric_difference(s2) print (pd.DataFrame(list(s1.difference(s2))),'\n\n') print (pd.DataFrame(list(...
StarcoderdataPython
9611741
<reponame>MaximeBaudette/PyCIM<filename>CIM14/IEC61968/Metering/SDPLocation.py # Copyright (C) 2010-2011 <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, includin...
StarcoderdataPython
1787670
<reponame>mazi76erX2/football_forecaster """ Django settings for Football Forecaster project. Generated by 'django-admin startproject' using Django 3.1. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djang...
StarcoderdataPython
1848245
<filename>aheuithon/codec/parser.py<gh_stars>1-10 import parso from aheuithon.codec.compiler import compile def ffc(typ, node): for x in node.children: if x.type == typ: return x def find_decorated_nodes(mod): decorated = [] q = [mod] while q: n = q.pop() if not has...
StarcoderdataPython
1801611
""" Object Tracker based on a color profile uses contour lines and rough area calculations """ import cv2 from controls import main_controller from . import colors from processing import cvfilters def process(image, camera_mode='RAW', color_mode='rgb', apply_mask=False): im...
StarcoderdataPython
4977935
<filename>Competition submissions/House Price Predictions/2nd_Paulina.py<gh_stars>10-100 # 2nd place - <NAME> import numpy as np import pandas as pd import matplotlib.pyplot as plt import xgboost import math from scipy.stats import pearsonr from sklearn.model_selection import train_test_split import pandas as pd import...
StarcoderdataPython
1991596
<gh_stars>1-10 #!/usr/bin/python """ This is an unit test for players in the game """ import unittest class TestPlayer(unittest.TestCase): """ Unit test for all basic players (firstBot, randomBot, userBot) """
StarcoderdataPython
4851709
<reponame>Sp00nyMan/BackgroundMattingV2-TensorFlow import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras.layers import Conv2D, BatchNormalization, ReLU class Decoder(Model): def __init__(self, channels): super().__init__() self.conv1 = Conv2D(channels[0], 3, paddi...
StarcoderdataPython
4937195
<reponame>Kadosh0/UriOnlineJudge<filename>uri1018.py u = int(input()) n100 = u // 100 n100r = u % 100 n50 = n100r // 50 n50r = n100r % 50 n20 = n50r // 20 n20r = n50r % 20 n10 = n20r // 10 n10r = n20r % 10 n5 = n10r // 5 n5r = n10r % 5 n2 = n5r // 2 n1 = n5r % 2 print('{}'.format(u)) print('{} nota(s) de R$ 100,00'.for...
StarcoderdataPython
11343915
from collections import deque def _process_multi_expr(expr): expr = expr.strip() size = len(expr) idx = 0 two_expr = ['>=', '<=', '=='] expr_list = [] while (idx < size): if idx + 2 <= size and expr[idx:idx + 2] in two_expr: expr_list.append(expr[idx:idx + 2]) idx += 2 else: expr...
StarcoderdataPython
104237
<filename>corefunctions/helpers.py from humanfriendly import format_size from pytube import Stream def map_stream(stream: Stream): return f'{stream.title} | itag: {stream.itag} | {stream.resolution} | {stream.mime_type} | {format_size(stream.filesize)} | is_progressive: {stream.is_progressive}'
StarcoderdataPython
11224103
<reponame>pknoe3lh/GM01<gh_stars>0 import socket import sys import thread import time import datetime import os import threading import subprocess import logging #logging.basicConfig(format="%(asctime)s %(message)s",level=logging.DEBUG) logging.basicConfig(filename='system.log',format="%(asctime)s %(messa...
StarcoderdataPython
5069274
import random from hunting.sim.entities import GameObject from hunting.sim.ai.core import MonsterAI from hunting.level.map import LevelMap import hunting.sim.skills as skills import hunting.constants as c class Behaviour: def __init__(self, ai): self.ai = ai # type: MonsterAI def can_execute(self): ...
StarcoderdataPython
11270257
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import from __future__ import division import sys, os, time import argparse try: import queue except ImportError: import Queue as queue curdir = os.path.dirname(os.path.abspath(sys.argv[0])) try: imp...
StarcoderdataPython
12814788
<reponame>ATNIO/dbot-server<filename>dbot-server/app/proxy.py #!/usr/bin/env python # -*- coding: utf-8 -*- ''' ''' import os import logging from flask import Blueprint, request, Response, make_response import requests import dbot from utils import remove_slash_prefix from .decorates import api_metric, middleware, c...
StarcoderdataPython
11230695
import time from irctest import cases from irctest.irc_utils.junkdrawer import ircv3_timestamp_to_unixtime from irctest.irc_utils.junkdrawer import to_history_message from irctest.irc_utils.random import random_name class ZncPlaybackTestCase(cases.BaseServerTestCase): def customizedConfig(self): return s...
StarcoderdataPython
3558860
# 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 required by applicable law or agreed to in writing,...
StarcoderdataPython
8113502
<gh_stars>1-10 # Copyright Unknown??? # # 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, modify, merge, publish, di...
StarcoderdataPython
3475928
<filename>model-optimizer/extensions/front/mxnet/activation.py """ Copyright (C) 2018-2020 Intel Corporation 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...
StarcoderdataPython
3296219
<reponame>xiangzaizi/base_spider # -*- coding:utf-8 -*- import requests from lxml import etree class TiebaSpider(object): def __init__(self): self.base_url = "http://tieba.baidu.com" # 特别点, 爬取贴吧只能使用IE的请求头 self.headers = {"User-Agent" : "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv...
StarcoderdataPython
1764511
<reponame>uktrade/lite-internal-frontend from conf.client import post from conf.constants import AUTHENTICATION_URL def authenticate_gov_user(request, json): data = post(request, AUTHENTICATION_URL, json) return data.json(), data.status_code
StarcoderdataPython
1617987
from itertools import takewhile, product import numpy as np import string # used for doc testing def letters_25(): """ >>> letters_25() array([['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I', 'J'], ['K', 'L', 'M', 'N', 'O'], ['P', 'Q', 'R', 'S', 'T'], ['U', 'W', '...
StarcoderdataPython
8041222
from django.test import TestCase from django.test.utils import override_settings from wagtail.admin import widgets from wagtail.core.models import Page from wagtail.tests.testapp.models import EventPage, SimplePage class TestAdminPageChooserWidget(TestCase): def setUp(self): self.root_page = Page.objects...
StarcoderdataPython
351210
import time import pytest from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.firefox import GeckoDriverManager from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By # Create a selenium test that does the following:...
StarcoderdataPython
116274
<gh_stars>0 from typing import NamedTuple from coordinates import spaced_coordinate Coordinates = spaced_coordinate("Coordinates", "xy") Orientation = NamedTuple( "Orientation", [("rot_x", float), ("rot_y", float), ("rot_z", float)] ) ThreeDCoordinates = spaced_coordinate("ThreeDCoordinates", "xyz") Spherical ...
StarcoderdataPython
1779892
import torch import torch.nn as nn from torch.nn.modules.batchnorm import _BatchNorm from mmcv.runner import load_checkpoint, BaseModule, load_state_dict from mmdet.utils import get_root_logger from ..builder import BACKBONES # RLA channel k: rla_channel = 32 (default) # https://github.com/moskomule/senet.pytorch/bl...
StarcoderdataPython
58788
<gh_stars>1-10 class Solution: def reverseStr(self, s, k): """ :type s: str :type k: int :rtype: str """ result = '' for i in range(0, len(s), 2*k): result += s[i:i+k][::-1] + s[i+k:i+2*k] return result
StarcoderdataPython
198956
<gh_stars>0 import os import lmdb from PIL import Image from xml.dom import minidom from io import BytesIO def checkImageIsValid(file): valid = True try: Image.open(file).load() except OSError: valid = False return valid def writeCache(env, cache): with env.begin(write=True) as txn...
StarcoderdataPython
27257
<reponame>huajitech/cyan<filename>cyan/util/_enum.py from enum import EnumMeta from typing import Any def get_enum_key(enum: EnumMeta, value: Any, default: Any = ...) -> Any: """ 获取 `Enum` 值对应的键。 参数: - enum: Enum 类型 - value: 将要查询对应键的值 - default: 当对应键不存在时返回的默认值(默认返回传入的 `value` 参数) ...
StarcoderdataPython
1913316
from tkinter import messagebox from medical_lab.frames.table_frame import TableFrame import tkinter as tk from tkinter import font as tkfont, ttk from tkinter.constants import NW from .base_frame import TitleFrame from tkcalendar import Calendar from datetime import datetime class LaborantFrame(TitleFrame): def _...
StarcoderdataPython
3363719
<filename>longest_pall_string.py s = 'cbbd' Substring = {} i = 0 for j in range(len(s)): if s[j] in Substring: i = max(i, Substring[s[j]] + 1) Substring[s[j]] = j print(Substring) a = '' for j in Substring: a = a + j print(a)
StarcoderdataPython
3528673
# # Functions for running away # from javascript import require, On, Once, AsyncTask, once, off from botlib import * import sys class CombatBot: # Special flag that is set while healing up healMode = False def __init__(self): print('combat ', end='') self.healMode = True def health...
StarcoderdataPython
3313008
<filename>AMBER/amber/utils/simulator.py from __future__ import print_function from collections import defaultdict import matplotlib.pyplot as plt import numpy as np from sklearn.preprocessing import PolynomialFeatures class BaseSimulator: def __init__(self, n, p, *args, **kwargs): """ Args: ...
StarcoderdataPython
12805358
<reponame>KwabenaYeboah/Solved-python-programming-Challenges-Source-code<gh_stars>0 #This is a Personal class module class Personal: def __init__(self,name,address,age,phone_number): self.__name = name self.__address = address self.__age = age self.__phone_number = phone_number ...
StarcoderdataPython
3580104
import os import stat import subprocess import glob executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH for filename in glob.glob("test_*"): if os.path.isfile(filename): st = os.stat(filename) mode = st.st_mode if mode & executable: print("Running " + filename) c...
StarcoderdataPython
3574341
<filename>src/hello/__init__.py from . import hello
StarcoderdataPython
11284620
<reponame>ChrisSeattle/data-structures-and-algorithms def radix_sort(arr): """ implement a radix sort """ base = 10 i = 0 work = arr[:] while True: buckets = [[] for _ in range(base)] i += 1 for val in work: idx = val % (base**i) idx = idx // (ba...
StarcoderdataPython
3278973
#!python3 """Multi-clipboard application. This program saves every clipboard text under a key. The .pyw extension means that Python won't open a terminal. python multi_clipboard.pyw """ import shelve, pyperclip, sys, os DIR = os.path.dirname(os.path.realpath(__file__)) FILE = DIR + "/data/clipboard.shelve" with shelve...
StarcoderdataPython
1899902
from PySide6.QtGui import QStandardItemModel def insert(self, el: QStandardItemModel, anchor=None): el.setParent(self) self.setModel(el) def remove(self, el): self.setModel(None)
StarcoderdataPython
8147024
<reponame>vztu/VIDEVAL<gh_stars>10-100 # -*- coding: utf-8 -*- """ Author: <NAME> """ # Load libraries import warnings import time import pandas import math import random as rnd import matplotlib.pyplot as plt from matplotlib import rc import scipy.stats import scipy.io from scipy.optimize import curve_fit from sklearn...
StarcoderdataPython
5016614
#!/usr/bin/env python3 import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) import convert_toc import util if __name__ == '__main__': path = sys.argv[1][2:] convert_toc.init_redirects() try: path = convert_toc.redirects[path] except KeyError: pass ...
StarcoderdataPython
9765337
<filename>src/ml_gym/io/config_parser.py import yaml from typing import Dict class YAMLConfigLoader: @staticmethod def load(path: str): with open(path, "r") as f: config: Dict = yaml.safe_load(f) if "global_config" in config: config.pop("global_config") ...
StarcoderdataPython
3266943
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer doubleEle5SWL1RDQM = DQMEDAnalyzer('EmDQM', genEtaAcc = cms.double(2.5), genEtAcc = cms.double(2.0), reqNum = cms.uint32(2), filters = cms.VPSet(cms.PSet( PlotBounds = cms.vdouble(0.0, 0.0), ...
StarcoderdataPython
6445130
import cv2 import sys import numpy as np from datetime import datetime, date, time # Usage grabframe.py [VIDFILENAME] # VIDFILENAME: optional video file name # creates two jpgs in current dir # The red mark is recognized by a color between these values lower_red = np.array([0,160,50]) upper_red = np.array([60,255,255...
StarcoderdataPython
1779991
def fatorial(n): i = acum = 1 while i <= n: acum = i*acum i = i + 1 print(acum) return acum n = int(input("Digite um número inteiro para calcular fatorial:")) while n >= 0: resultado = fatorial(n) print("O FATORIAL DO NÚMERO QUE VOCÊ DIGITOU É: ", resultado) n = int(inpu...
StarcoderdataPython
90412
import pytest from dagster import Any, String, usable_as_dagster_type from dagster.check import CheckError from dagster.core.types.dagster_type import resolve_dagster_type from dagster.utils import safe_tempfile_path from dagstermill.serialize import read_value, write_value def test_scalar(): with safe_tempfile_p...
StarcoderdataPython
3463179
from high2low import * import sys sys.path.append('../') from cas_utils import * def message_handler(body, message): js = json.loads(body) message.ack() print js t = high2low("redis://1192.168.3.11:6379/2") t.trans_high2low(js) if __name__ == '__main__': download_exchange = Exchange('download...
StarcoderdataPython
5072139
<reponame>DanielGrams/gsevp """empty message Revision ID: 12aac790ed5e Revises: f<PASSWORD> Create Date: 2021-11-16 09:01:00.569170 """ import sqlalchemy as sa import sqlalchemy_utils from alembic import op from project import dbtypes # revision identifiers, used by Alembic. revision = "12aac790ed5e" down_revision ...
StarcoderdataPython
1643372
<filename>homeworkpal_project/interviews/tests/factories.py import datetime import string from factory import Iterator, lazy_attribute from factory.django import DjangoModelFactory from factory.fuzzy import FuzzyText from ..models import ElegibilityCertificate __author__ = 'LBerrocal' class ElegibilityCertificateFac...
StarcoderdataPython
373718
<gh_stars>0 #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Nov 15 20:12:52 2018 @author: Dartoon """ import numpy as np from astropy.visualization import SqrtStretch from astropy.stats import SigmaClip from photutils import Background2D, SExtractorBackground from astropy.visualization.mpl_normaliz...
StarcoderdataPython
273589
# -*- coding: utf-8 -*- # http://www.apache.org/licenses/LICENSE-2.0.txt # # Copyright 2016 Intel Corporation # # 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/lic...
StarcoderdataPython
1721867
from torch.utils.data import Dataset class TimeseriesDataset(Dataset): def __init__(self, X, y, seq_len=1): self.X = X self.y = y self.seq_len = seq_len def __len__(self): return self.X.__len__() - (self.seq_len - 1) def __getitem__(self, index): return self.X[ind...
StarcoderdataPython
49423
from typing import NewType from typing import Union from typing import List from typing import Tuple from typing import TypedDict from typing import Optional Baz = NewType("Baz", bool) Foo = NewType("Foo", str) """array of strings is all... """ UnorderedSetOfFooz1UBFn8B = NewType("UnorderedSetOfFooz1UBFn8B", List[Foo...
StarcoderdataPython
6590676
<filename>rules/elimination.py # This converts COCO to C(=O)C (it converts the enol to keto in the same step) # to avoid enols elimination1 = [ruleGMLString("""rule [ ruleID "Elimination + enol to keto" left [ edge [ source 1 target 2 label "-" ] edge [ source 2 target 3 label "-" ] edge [ source 1 target 4 ...
StarcoderdataPython
5059892
<filename>StructureProjection/ModEligibility.py import dicom import numpy import matplotlib.path as mpltPath import matplotlib.pyplot as plt import math def CheckEligibility(RtPlan, FractionGroupNumber): EligibilityPlan=True#if a CP is not eligible, will turn to false BeamInPrescription=list() for prescrip...
StarcoderdataPython
5011365
# Copyright (c) 2021 CNES/JPL # # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """ Settings handling ----------------- """ from typing import Any, Dict, Iterator, Tuple, Union import contextlib import copy import importlib import logging import...
StarcoderdataPython
9735416
for _ in range(int(input())): b, w = map(int, input().split()) bc, wc, z = map(int, input().split()) if bc > wc + z: print(((b + w) * wc) + (b * z)) elif wc > bc + z: print(((b + w) * bc) + (w * z)) else: print((b * bc) + (w * wc))
StarcoderdataPython
4903426
# coding: utf-8 import os import sys from workspacemanager.utils import * from workspacemanager.test.utils import fileToStr import sh """ This file will install local dependencies to the current venv of the current project """ def installDeps(theProjectDirectory=None, theProjectVenvName=None, alreadyLocalInstal...
StarcoderdataPython
3471149
from configparser import ConfigParser def git_to_https(uri): "Convert git URI (for a GitHub SSH repo) to https" assert uri.startswith("git"), f"No git SSH repo at {uri}" https = uri.split("@")[1].replace(":","/") https = "https://" + https[:https.rfind(".git")] return https def parse_subdomain_url...
StarcoderdataPython
11218278
<filename>WEEKS/CD_Sata-Structures/_RESOURCES/pygorithm/pygorithm/sorting/brick_sort.py<gh_stars>1000+ def brick_sort(arr): """Performs an odd-even in-place sort, which is a variation of a bubble sort. https://www.geeksforgeeks.org/odd-even-sort-brick-sort/ :param arr: the array of values to sort ...
StarcoderdataPython
297546
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
StarcoderdataPython
3530976
#!/usr/bin/python3 import argparse import os import re import sys from aux import recursive from parser import create_parser, get_files, read_tagmap from core import tag_iter, replace_tags_in_string ############################################################ # main actions def count_tags(files: [ str ]) ->...
StarcoderdataPython
5148074
<gh_stars>0 # hack to return special attributes from _sys import * from javascript import JSObject has_local_storage=__BRYTHON__.has_local_storage has_json=__BRYTHON__.has_json argv = ['__main__'] base_exec_prefix = __BRYTHON__.brython_path base_prefix = __BRYTHON__.brython_path builtin_module_names=__BRYTHON__.bu...
StarcoderdataPython
9630238
"""Image annotation tools.""" __version__ = "0.1.0" from .annotator import PolygonAnnotator, PointAnnotator, BoxAnnotator __all__ = ["PolygonAnnotator", "PointAnnotator", "BoxAnnotator"]
StarcoderdataPython
8175761
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
StarcoderdataPython
4950078
#file = open("xyz.txt","w") #file.write("Hello") #print(file.seek(0)) #file.write("abc") #file.close() with open("xyz.txt","w") as file: file.write("hello")
StarcoderdataPython
1961273
# -*- coding: utf-8 -*- """ Created on Sat Mar 10 20:43:00 2018 @author: <NAME> """ #color BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 176, 80) BLUE = (0, 0, 255) ORANGE = (255, 128, 0) GRID_PIXEL = 10 GRID_SCALE_PIXEL = (GRID_PIXEL, GRID_PIXEL)
StarcoderdataPython
5179182
""" Benchmark for ANTs see: * http://stnava.github.io/ANTs * https://sourceforge.net/projects/advants/ * https://github.com/stnava/ANTsDoc/issues/1 INSTALLATION: See: https://brianavants.wordpress.com/2012/04/13/updated-ants-compile-instructions-april-12-2012/ * Do NOT download the binary code, there is an issue: ...
StarcoderdataPython
81572
# Desenvolva um program que leia 4 valores pelo teclado e guarde-os em uma tupla. # no final mostre: # a) quantas vezes apareceu o valor 9 # b) em que posição foi digitado o valor 3 # c) quais foram os números pares n = (int(input('Digite um número: ')), int(input('Digite outro número: ')), int(input('Digite...
StarcoderdataPython
3217451
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- import pytest from niacin.text.en import word @pytest.mark.parametrize( "string,p,exp", [ ("", 0.0, ""), ("", 1.0, ""), ("The man has a brown dog", 0.0, "The man has a brown dog"), ("The man has a brown dog", 1.0, "man has brow...
StarcoderdataPython
4994497
from typing import List, Dict import torch from torch.utils.data import Dataset import numpy as np from constant import PADDING_LABEL, LABEL2IX from data_utils import get_word2ix class DocDataset(Dataset): def __init__( self, sentences: List[List[str]], labels: List[List[str]], ...
StarcoderdataPython
1649922
<reponame>williamjamir/hookman from hookman.hooks import HookSpecs specs = HookSpecs(project_name="ACME", version="1", hooks=[])
StarcoderdataPython
3565152
from typing import Any, Callable F = Callable[[Any, Any], Any] F1 = Callable[[Any], Callable[[Any], Any]]
StarcoderdataPython
1667432
<gh_stars>0 import time from pynput.keyboard import Key, Controller def open_tab(): keyboard.press(Key.ctrl) keyboard.press("t") keyboard.release("t") keyboard.release(Key.ctrl) def search(word): open_tab() for i in word: keyboard.press(i) keyboard.release(i) keyboard.p...
StarcoderdataPython
225993
# Copyright (C) 2011 <NAME> # Distributed under the MIT license, see the LICENSE file for details. import logging import mb2freedb logger = logging.getLogger(__name__) class CDDB(object): EOL = "\r\n" def __init__(self, config, conn): self.config = config self.conn = conn self.cmd ...
StarcoderdataPython
8133514
<gh_stars>1-10 # encoding: utf8 from pygubu import BuilderObject, register_custom_property, register_widget from pygubu.builder.ttkstdwidgets import TTKFrame from pygubu.widgets.calendarframe import CalendarFrame class CalendarFrameBuilder(BuilderObject): class_ = CalendarFrame OPTIONS_STANDARD = TTKFrame.OPT...
StarcoderdataPython
3435664
<reponame>joewalk102/Adafruit_Learning_System_Guides<filename>PyGamer_NeoPixel_Strip_Control/code.py # PyGamer NeoPixel Strip Control with CusorControl # Adapted from PyPortal_NeoPixel_Color_Picker.py by <NAME> import time import board from adafruit_button import Button import displayio import neopixel from adafruit_cu...
StarcoderdataPython
1697550
# -*- coding: utf-8 -*- # Copyright 2017 <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, modify, merge, p...
StarcoderdataPython
123774
""" @Author : dilless @Time : 2018/6/23 1:01 @File : main.py """ import os import sys from scrapy.cmdline import execute sys.path.append(os.path.dirname(os.path.abspath(__file__))) execute(['scrapy', 'crawl', 'xueshu'])
StarcoderdataPython
4972653
<gh_stars>0 import urllib.request import sys import eyed3 # Program that automates id3 tag writing to .mp3 files. # The programs assumes that all the .mp3 files are initialized with their publishing years. # sy.argv[0] contains the wikipedia link to the album of the songs in the .mp3 files. # sys.argv[1] may contain ...
StarcoderdataPython
1727302
from opentera.db.Base import db, BaseModel class TeraServiceProject(db.Model, BaseModel): __tablename__ = 't_services_projects' id_service_project = db.Column(db.Integer, db.Sequence('id_service_project_sequence'), primary_key=True, autoincrement=True) id_service = db.Co...
StarcoderdataPython