id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5041297
<reponame>VictorKazankov/Python_training import random import string from model.contact import Contact def random_string(prefix,maxlen): symbols = string.ascii_letters + string.digits return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))]) def random_string_only_digits(max...
StarcoderdataPython
1858848
<filename>PycharmProjects/untitled1/firstPython.py<gh_stars>0 print("Hello world.",end="") print('hello python') # Pycharm是集成开发环境 # create New Project """ 标识符由数字字母下划线组成 数字不能开头 不能用内置关键字 区分大小写 见名知意 大驼峰 MyName 小驼峰 myName 下划线连接 my_name """
StarcoderdataPython
5080578
<reponame>ankit27kh/Xanadu-Quantum-Codebook """The code template to supply to the front end. This is what the user will be asked to complete and submit for grading. Do not include any imports. This is not a REPL environment so include explicit 'print' statements for any outputs you want to be displaye...
StarcoderdataPython
4887051
from django.core.management.base import BaseCommand from ...models import DSO from ...finder import create_dso_finder_chart class Command(BaseCommand): help = 'Create DSO finder charts' def add_arguments(self, parser): parser.add_argument('--dso_list', dest='dso_list', nargs='+', type=int) par...
StarcoderdataPython
11262357
#!/usr/bin/env python """This is a wrapper around the real compiler. It first invokes a real compiler to generate an object file. Then it invokes a bitcode compiler to generate a parallel bitcode file. It records the location of the bitcode in an ELF section of the object file so that it can be found later after all ...
StarcoderdataPython
11371000
#!/usr/bin/python3 # -*- coding: utf-8 -*- from import_export import resources from .models import TrainingAttendance, Distribution, Individual class TrainingAttendanceResource(resources.ModelResource): class Meta: model = TrainingAttendance class DistributionResource(resources.ModelResource): cl...
StarcoderdataPython
266428
import numpy as np import pandas as pd def dummy_prep(data, method=None): varlist = data.columns[(data.dtypes == "category").values] if not method: return pd.get_dummies(data.loc[:, data.dtypes == "category"]) if method == "drop_first": return pd.get_dummies(data.loc[:, data.dtypes == "cat...
StarcoderdataPython
353897
<filename>script/filterlog.py #!/usr/bin/env python import sys import getopt def main(argv): inp = '' outp = '' tag = '' force = 'a' try: opts, args = getopt.getopt( argv, "i:o:w:f", ["input=", "output=", "word=" ]) except getopt.GetoptError: print ('filterlog.py -i...
StarcoderdataPython
3342401
from .app import start_web_app
StarcoderdataPython
6503703
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ __init__.py ----------- TxTrader module init Copyright (c) 2015 Reliance Systems Inc. <<EMAIL>> Licensed under the MIT license. See LICENSE for details. """ __all__ = ['version', 'tcpserver', 'webserver', 'tws', 'cqg', 'client', 'mo...
StarcoderdataPython
9616043
<reponame>opensanctions/nomenklatura from nomenklatura.matching.model import compare_scored, explain_matcher __all__ = ["compare_scored", "explain_matcher"]
StarcoderdataPython
5183999
# Copyright 2021 The TensorFlow 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 applica...
StarcoderdataPython
8080423
<reponame>hashnfv/hashnfv-bottlenecks ############################################################################## # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 #...
StarcoderdataPython
3519987
N, M = map(int, input().split()) # 偶数回裏返す->表 # 奇数回裏返す->裏 # 四隅->4回->表 # 四隅以外の外枠->6回->表 # 内側->9回->裏 # 1マスの場合 if N == 1 and M == 1: print(1) exit(0) # 1行又は1列の場合->両端以外 if N == 1 or M == 1: print(max(N, M)-2) exit(0) # 内側のカードの枚数を求める print((N-2)*(M-2))
StarcoderdataPython
1611560
import argparse import multiprocessing from pyfiglet import Figlet from rich.console import Console from poc import nc_beanshell_rce,nc_upload_rce,nc_erp_sql,nc_u8_test_sql,nc_erp_directory console = Console() def main(target_url): if target_url[:4] != 'http': target_url = 'http://' + target_url if t...
StarcoderdataPython
295021
<reponame>smayya337/libcodebusters-python<filename>libcodebusters/encrypt.py import string import random from numpy import array, matmul from libcodebusters import utils import math def aristocrat(plaintext: str) -> str: """Encodes text with the Aristocrat cipher.""" ciphertext: str = "" alph_map: list = ...
StarcoderdataPython
6421139
# Generated by Django 2.2.6 on 2020-04-20 18:02 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('KnowledgeBase', '0018_auto_20200420_1759'), ] operations = [ migrations.AlterField( model_name=...
StarcoderdataPython
1648307
<filename>hadoop_script_2.0/common/valid/validator.py #!/usr/bin/env python # -*- coding: utf-8 -*- import abc __author__ = "jiandequn" """" 抽象验证器实现 """ class Validator(object): _metaclass__ = abc.ABCMeta @abc.abstractproperty def vlidate(self, val): """ 定义当前操作表 """ r...
StarcoderdataPython
29222
<reponame>vsukhor/cytoskeleton-analyser # Copyright (c) 2021 <NAME>. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, ...
StarcoderdataPython
133854
<gh_stars>1-10 import torch import torch.distributions as TD import numpy as np import numpy.matlib as nm class DataPosteriorTarget: def __init__(self): pass def sample_init(self, n): '''Samples from the prior distribution ''' raise NotImplementedError() def s...
StarcoderdataPython
4914644
<filename>suitcase/utils/tests/conftest.py import bluesky from bluesky.tests.conftest import RE # noqa from bluesky.plans import count from bluesky.plan_stubs import trigger_and_read, configure from ophyd.sim import SynGauss, SynAxis import numpy as np try: from ophyd.sim import DirectImage except ImportError: ...
StarcoderdataPython
3457530
from enum import IntEnum class ServerCode(IntEnum): DefaultServerError = -32000 VmValidationError = -32001 VmVerificationError = -32002 VmInvariantViolationError = -32003 VmDeserializationError = -32004 VmExecutionError = -32005 VmUnknownError = -32006 MempoolInvalidSeqNumber = -32007 ...
StarcoderdataPython
1960435
<filename>projects/dataprep/manage_background_overlaps_in_the_table.py """ Manage component overlaps: Prepare list of stars that don't have component overlaps yet Compute bg ols with the external code (multiprocessing) Insert bg ols back into the file """ import numpy as np from astropy.table import Table, vstack, uni...
StarcoderdataPython
6489085
<filename>libfennel/gateprover.py #!/usr/bin/python # # (C) 2017 <NAME> <<EMAIL>> # # gate provers # # pylint: disable=arguments-differ import libfennel.util as util from libfennel.defs import Defs import libfennel.arithcircuit as ac class _GateProver(object): gate_type_idx = None def __init__(self, isEarly,...
StarcoderdataPython
1697834
<filename>tests/test_envtool.py<gh_stars>1-10 import os.path # from sys import version_info # if version_info[0] == 2: # from mock import patch, mock_open, call # else: # from unittest.mock import patch, mock_open, call from pytest import fail from py.path import local from click.testing import CliRunner impo...
StarcoderdataPython
3345740
# coding=utf-8 # Copyright 2021 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
8032680
import sys weights = {} def wRec(name): if (weights[name]['sumW'] == 0): ch = set() weights[name]['sumW'] = weights[name]['w'] for n in weights[name]['child']: nw = wRec(n) ch.add(nw) weights[name]['sumW'] += nw if (len(ch)>1): for c in weights[name]['child']: print(c, weights[c]['w'], weig...
StarcoderdataPython
3368804
import os import tensorflow as tf import math import numpy as np import pandas as pd import itertools import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.animation as animation from matplotlib.lines import Line2D import matplotlib.patheffects as path_effects import matplotlib as mpl i...
StarcoderdataPython
5009693
<reponame>bjackman/millhouse #!/usr/bin/env python # Copyright 2017 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
StarcoderdataPython
9773877
############################################################################## # Copyright (c) 2015 Huawei Technologies Co.,Ltd. and others # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, ...
StarcoderdataPython
9741271
<gh_stars>0 import datetime as dt import matplotlib.pyplot as plt import matplotlib.dates as mdates from matplotlib.collections import PolyCollection import numpy as np filelist = [ "audio", "hologram", ] data = [] components = {} comp_tag = 1 colormapping = {} for file in filelist: with open(file, 'r') as...
StarcoderdataPython
12842234
import os import index.MovieDAO as movieDAO from pprint import pprint from index import SysConst import shutil def getAllMovies(path): movieTypes = set(["avi", "mp4", "mkv", "rmvb", "wmv", "txt"]) results = [] for fpath, dirs, fs in os.walk(path): for filename in fs: fullpath...
StarcoderdataPython
11375482
<reponame>ertis-research/reliable-iot from my_db.restful_API.modular_views import web_login_register_view from my_db.restful_API.modular_views import docker_commands_view from my_db.restful_API.modular_views import app_resource_usage from my_db.restful_API.modular_views import application_view from my_db.restful_API.mo...
StarcoderdataPython
3507269
<reponame>mrichar1/alchemyjsonschema # -*- coding:utf-8 -*- def _callFUT(*args, **kwargs): from alchemyjsonschema.dictify import objectify return objectify(*args, **kwargs) def test_it__simple(): from alchemyjsonschema import SchemaFactory, ForeignKeyWalker from alchemyjsonschema.dictify import Model...
StarcoderdataPython
11226777
#!/usr/bin/env python3 import os import time import yaml import lights def wait(): args_file = "args.yml" print("Daemon started") while True: print("Waiting...") try: with open(args_file) as f: a = yaml.safe_load(f) scene = a["scene"] ...
StarcoderdataPython
6643563
import logging import os import random from collections import OrderedDict from itertools import chain from typing import Callable, Dict, List, Tuple import torch import torch.nn as nn from sklearn.metrics import accuracy_score from rationale_benchmark.utils import Annotation from rationale_benchmark.models.pipeli...
StarcoderdataPython
312623
from mininet.topo import Topo class SingleSwitchTopo(Topo): def __init__(self, n, **opts): Topo.__init__(self, **opts) switch = self.addSwitch('s1') for i in xrange(1, n+1): host = self.addHost('h%d' % i, ip = "10.0.0.%d" % i, ...
StarcoderdataPython
3387880
# -*- coding:utf-8 -*- # !/usr/bin/env python3 # Power by zuosc import json import urllib.parse import urllib.request weatherApiAdder = 'http://widget.thinkpage.cn/api/weather?flavor=slim&location=WX4FBXXFKE4F&geolocation=enabled&language=zh-chs&unit=c&theme=chameleon&container=weather-widget&bubble=enabled&alarmTy...
StarcoderdataPython
336327
""" Evaluate a python string as code """ import importlib.machinery import importlib.util import tempfile import os def eval_code(code): """ save code in a temporary file and import it as a module """ new_file, filename = tempfile.mkstemp(text=True) os.write(new_file, bytes(code, 'ascii')) os...
StarcoderdataPython
1948019
<gh_stars>10-100 from pyedbglib.hidtransport.hidtransportfactory import hid_transport from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import avr8protocol from pyedbglib.protocols import avr8protocolerrors # Retrieve device info from pym...
StarcoderdataPython
3581777
from unittest.test.test_case import Test def format_poem(poem): if poem[-1:] == ".": return ".\n".join(x.strip() for x in str.split(poem, '.')) else: return ".\n".join(x.strip() for x in str.split(poem, '.'))[:-1] + poem[-1:] x=[1, 2, 3] a = sum(x)/len(x) print(format_poem('Beautiful is bette...
StarcoderdataPython
5145045
a = int(input()) arr = [] while a != 0: arr.append(a) a = int(input()) for item in arr[::-1]: print(item)
StarcoderdataPython
11250933
# -*- coding: utf-8 -*- """ TopGun Backtest Class @author: David """ # %% IMPORTs CELL # Default Imports import numpy as np import pandas as pd # Plotly for charting import plotly.express as px import plotly.graph_objs as go import plotly.io as pio # %% CLASS MODULE class BacktestAnalytics(object): """ Backte...
StarcoderdataPython
1627897
<filename>src/api2db/ingest/api2pandas.py # -*- coding: utf-8 -*- """ Contains the Api2Pandas class ============================= """ from ..app.log import get_logger from .api_form import ApiForm import pandas as pd import os from typing import Union, Callable class Api2Pandas(object): """Used to extract incomin...
StarcoderdataPython
3568276
IP_INFO = { 'facebook': { 'range': ('192.168.3.11', '192.168.127.12'), }, 'google': { 'range': ('192.168.127.12', '192.168.3.11') }, 'youtube': { 'range': ('192.168.127.12', '172.16.58.3') }, 'amazon': { 'range': ('172.16.17.32', '172.16.58.3') }, 'git...
StarcoderdataPython
5141133
<reponame>trhongbinwang/data_science_journey # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, ...
StarcoderdataPython
13954
import sys import PyQt5.QtWidgets as qtw import PyQt5.QtCore as qtc from Image import Image from main_layout import Ui_MainWindow import logging import os logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) formatter = logging.Formatter('%(levelname)s:%(name)s:%(asctime)s - %(message)s') file_handler ...
StarcoderdataPython
374427
<reponame>dunitian/BaseCode<gh_stars>10-100 from multiprocessing.dummy import Pool as ThreadPool, Condition s_list = [] con = Condition() def Shop(i): global con global s_list # 加锁保护共享资源 for x in range(5): with con: s_list.append(x) print(f"[生产者{i}]生产商品{x}") ...
StarcoderdataPython
1919114
# %load ../imports.py %matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.pyplot as plt import seaborn as sns width=20 height=3 plt.rcParams["figure.figsize"] = (width,height) sns.set(rc={'figure.figsize':(width,height)}) #impo...
StarcoderdataPython
6699782
<filename>setup.py<gh_stars>0 from setuptools import setup, find_namespace_packages from setuptools_rust import Binding, RustExtension, Strip setup( name='fluvio', version="0.10.0", long_description=open('README.md').read(), long_description_content_type='text/markdown', author = "<NAME>", desc...
StarcoderdataPython
8151844
<filename>y2020/d24.py from aoc_input import get_input import aoc_helpers as ah import re DAY = 24 YEAR = 2020 RE_STEPS = re.compile("e|w|nw|ne|sw|se") STEPS = { "e": (( 1, 1), 0), "w": ((-1, -1), 0), "nw": ((-1, 0), -1), "ne": (( 0, 1), -1), "sw": ((-1, 0), 1), "se": (( 0, 1), 1), } def sol0(pzin...
StarcoderdataPython
4868311
import pickle from typing import Dict, Any, Optional, Type from ..data import GraphDataset from .task_utils import task_name_to_dataset_class # This should rightfully live in model_utils.py, but that would lead to a circular import... def get_model_file_path(model_path: str, target_suffix: str): assert target_su...
StarcoderdataPython
1843618
import sys if sys.version_info[0] < 3: raise Exception('Must be running Python version 3 or up')
StarcoderdataPython
8046192
import numpy as np import math from scipy import signal # Return a box filter of size n by n # Requires n to be an odd integer def boxfilter(n): assert(n % 2 == 1), "Dimension must be odd" # Create n x n array, every element = n^-2 return np.full((n, n), pow(n, -2)) # Return a 1D Gaussian filter # Fix length of...
StarcoderdataPython
12854305
<filename>problem0650.py ########################### # # #650 Divisors of Binomial Product - Project Euler # https://projecteuler.net/problem=650 # # Code by <NAME> # ###########################
StarcoderdataPython
1938162
import sys from pylinac.version import __version__, __version_info__ # check python version if sys.version_info[0] < 3 or sys.version_info[1] < 6: raise ValueError("Pylinac is only supported on Python 3.6+. Please update your environment.") # import shortcuts from pylinac.ct import CatPhan504, CatPhan600, CatPh...
StarcoderdataPython
11261489
import secrets from Cryptodome.Cipher import ChaCha20 KEY_SIZE = 32 NONCE_SIZE = 12 def random_key() -> str: return secrets.token_hex(KEY_SIZE) + secrets.token_hex(NONCE_SIZE) # Note: all our API clients depend on this, can't change for legacy reasons. def decrypt(data: bytes, key: str) -> bytes: if len(ke...
StarcoderdataPython
3559293
<filename>cstar/command.py # Copyright 2017 Spotify AB # # 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 ...
StarcoderdataPython
12818759
# -*- coding: utf-8 -*- """ Created on Sun Feb 16 17:45:53 2020 @author: ashwin_menon """ #Made By <NAME>(101703120) import pandas as pd import numpy as np import sys from sklearn.impute import SimpleImputer def missing_values(inputfile,outputfile): dataset=pd.read_csv(inputfile) head=dataset....
StarcoderdataPython
1815211
<reponame>Nik6198/Advanced-DataStructure import _fib_heap import random import time import matplotlib.pyplot as plt class graph: def __init__(self,n): self.graph=[] for i in range(n): temp=[random.randint(0,1001) for i in range(n)] temp[i]=0 self.graph.append(temp) def acc...
StarcoderdataPython
11333091
import os import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from model.loss import MultiLabelSoftmaxLoss from model.loss import cross_entropy_loss from tools.accuracy_init import single_label_top1_accuracy, multi_label_accuracy class Attention(nn.Module): def ...
StarcoderdataPython
1921763
<reponame>imlegend19/GRAS from gras.github.entity.api_static import APIStaticV4, RepositoryStatic from gras.github.entity.github_models import ForkModel from gras.github.github import GithubInterface class ForkStruct(GithubInterface, ForkModel): """ The object models the query to fetch the list of directly fo...
StarcoderdataPython
1741338
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np from gputools import OCLArray, get_device from gputools.fft.oclfft import fft, fft_plan from gputools.core.oclalgos import OCLElementwiseKernel from gputools.core.ocltypes import assert_bufs_type _complex_multiply_k...
StarcoderdataPython
3489622
<reponame>Arongil/Diversity-Scraper import json import os names = [] sofar = set() journals = os.listdir() for j in journals: if os.path.isfile(j + '/names.txt') and os.access(j + '/names.txt', os.R_OK): with open(j + '/names.txt', encoding='utf-8-sig') as f: current = json.load(f) ...
StarcoderdataPython
1786610
# Offset for screen_grab x_pad = 622 y_pad = 99 width = 127 height = 248 # Columns to check left_column = 8 right_column = 113
StarcoderdataPython
1826040
<filename>python_lib/mitxgraders/plugins/template.py """ This is a template file that also is used to test that the plugin loading mechanism is working. """ from __future__ import print_function, division, absolute_import, unicode_literals # Make sure that imports are working from mitxgraders.baseclasses import ItemGr...
StarcoderdataPython
3400177
import cgi, datetime, dateutil.parser, os.path, pytz, sys from flask import Flask, request for sam_dir in ( # ./scheduler-and-mapper/ os.path.join(os.path.dirname(__file__), "scheduler-and-mapper"), # ../scheduler-and-mapper/ os.path.join( os.path.dirname(os.path.dirname(__file__)), "sc...
StarcoderdataPython
1801032
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Mar 10 10:32:35 2020 @author: Ethan """ from PyQt5 import uic fin = open('test_stimulation.ui','r') fout = open('test_stimulation.py','w') uic.compileUi(fin,fout,execute=False) fin.close() fout.close()
StarcoderdataPython
42315
<reponame>dargueso/IceVarFigs """ Calculates current year percentage of record daily low SIE 2002-present using JAXA metadata Website : https://ads.nipr.ac.jp/vishop/vishop-extent.html Author : <NAME> Date : 18 October 2016 """ ### Import modules import numpy as np import matplotlib.pyplot as plt import ma...
StarcoderdataPython
4926081
<gh_stars>0 a1 = 100 class Demo: def mymethod1(self): print(a1) myobj = Demo() myobj.mymethod1()
StarcoderdataPython
6677990
<reponame>webhacking/hhvm<filename>hphp/hack/test/integration/runner.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import sys import unittest import test_save_mini import test_save_restore if __na...
StarcoderdataPython
1865077
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: <EMAIL> # Maintained By: <EMAIL> from ggrc.models.mixins import Timeboxed from ggrc import db class RelativeTimeboxed(Timeboxed): # Frequencies ...
StarcoderdataPython
11393863
<reponame>azadoks/aiida-core # -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
StarcoderdataPython
3460094
import os, sys, re, tarfile, collections import argparse import pickle from collections import Counter import pandas as pd import numpy as np import matplotlib.pyplot as plt from bs4 import BeautifulSoup from nltk.util import ngrams from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.st...
StarcoderdataPython
306984
from django import forms from captcha.fields import CaptchaField import datetime class UserForm(forms.Form): username = forms.CharField(label='用户名', max_length= 128, widget = forms.TextInput(attrs={'class':'form-control'})) password = forms.CharField(label='密码', max_length= 256, widget = forms.PasswordInput(at...
StarcoderdataPython
1866840
import torch import torch.nn as nn from torch.autograd import Variable import numpy as np import editdistance as ed # CreateOnehotVariable function # *** DEV NOTE : This is a workaround to achieve one, I'm not sure how this function affects the training speed *** # This is a function to generate an one-hot encoded t...
StarcoderdataPython
256481
<filename>src/software/decode/ctypeAutoGen.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # *****************************************************************************/ # * Authors: <NAME> # *****************************************************************************/ ''' Brief: ctypeAutoGen.py - Method and Appra...
StarcoderdataPython
3493470
import logging import click from rdflib import Graph, URIRef from zib_uploader.fetch_data import OntologyMappingsFetcher from zib_uploader.process_data import OntologyMappingsProcessor logger = logging.getLogger(__name__) @click.command() @click.argument('output_filepath', type=click.Path()) def main(output_filepa...
StarcoderdataPython
1712815
import numpy as np def inverse(): print("Inverse of a matrix:") #Enter rows and columns row=int(input("Enter number of rows:")) column=int(input("Enter number of columns:")) if row==column: print("Enter the elements of Matrix:") matrix_a= [[int(input()) for i in range(column)] for i in range(row)] ...
StarcoderdataPython
5077284
import sys sys.path.append("/flash/userapp") import pyb import utime from uvacbot.io.pwm import Pwm alarm1 = { 'repeat': 10, 'sleep1': 15, 'sleep2': 10, 'sleep3': 300} alarm2 = { 'repeat': 4, 'sleep1': 100, 's...
StarcoderdataPython
5178655
""" The script generate score for the performance evaluation for kaggle contest "bag of words meets bag of popcorn", using split data from only train data set Text represents using tf-idf Predictive model: naive_bayes """ from sklearn.metric import roc_auc_score,roc_curve import first_attempt from sklearn.cross_v...
StarcoderdataPython
6560720
# coding=utf-8 from __future__ import unicode_literals, absolute_import, division, print_function import sopel.module # import sopel_modules.SpiceBot as SpiceBot # from sopel_modules.spicemanip import spicemanip from upsidedown import transform # TODO add upsidedown to spicemanip # TODO add prerun functionality as...
StarcoderdataPython
175050
#!/bin/python_3.9 import hashlib,os try: from cryptography_me_she import bases except: import bases class Hashing(): def __init__(self) -> None: pass def hashing(self, type_hash: str, masg: str) -> str: masg: bytes = bytes(masg, "ascii") hash2: str = "" ...
StarcoderdataPython
5088157
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from intera_core_msgs/HeadState.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class HeadState(genpy.Message): _md5sum = "51024ade10ffefe117049c9ba6fd743c" _type = "...
StarcoderdataPython
3525702
<gh_stars>0 from django.conf.urls import url from rest_framework import routers # Import standard views from .api import ( ProjectViewSet, MculeQuoteViewSet, BatchViewSet, TargetViewSet, MethodViewSet, ReactionViewSet, PubChemInfoViewSet, ProductViewSet, ReactantViewSet, Catalog...
StarcoderdataPython
1736686
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<<EMAIL>> # http://binux.me # Created on 2014-08-09 17:52:49 import json from tornado import gen from .base import * from libs import utils import traceback class TPLPushHandler(BaseHandler): @t...
StarcoderdataPython
11330663
<reponame>sixfwa/fastapi-basics import datetime as _dt import sqlalchemy as _sql import sqlalchemy.orm as _orm import database as _database class User(_database.Base): __tablename__ = "users" id = _sql.Column(_sql.Integer, primary_key=True, index=True) email = _sql.Column(_sql.String, unique=True, index=...
StarcoderdataPython
5090658
<reponame>rpytel1/vipriors-challenges-toolkit """ Arrange training, validation and test data for VIPriors object detection challenge. """ import tqdm import os import shutil if __name__ == '__main__': if os.path.exists("TEST_MARKER_DO_NOT_REMOVE"): raise ValueError("Test set has already been updated. Don'...
StarcoderdataPython
118514
import pandas as pd def resample_and_merge(df_blocks: pd.DataFrame, df_prices: pd.DataFrame, dict_params: dict, freq: str = "5T"): df = resample(df_blocks, freq, dict_params) df_prices = resample(df_prices, freq, dict_params) # we add ...
StarcoderdataPython
1670230
<gh_stars>0 from datetime import datetime import xlrd from openpyxl import load_workbook from csv import reader import json from pathlib import Path import os class XlsObj: typd = { 'str' : lambda v,_ : str(v), 'float' : lambda v,_ : float(v) if v!='' else None, 'int' : lambda v,_ : int(flo...
StarcoderdataPython
117199
<filename>Commands/ping.py from discord.commands import slash_command from discord.ext import commands from config import VERSIONS, EMOTES import discord class Ping(commands.Cog): def __init__(self, bot): self.bot = bot self.description = "Measure the bot latency" self.category = "Miscellan...
StarcoderdataPython
4988618
<filename>models/weatherRSConditions.py class WeatherRSConditions(object): """ Clouds, rain, snow and wind response data """ def __init__(self): self._clouds = None self._rain = None self._snow = None self._wind_deg = None self._wind_speed = None def set_conditions(...
StarcoderdataPython
11306583
<filename>PaddleCV/Research/webvision2018/utils/class_accuracy.py<gh_stars>1-10 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import numpy as np def accuracy(targets, preds): """Get the class-level top1 and top5 of model. Usa...
StarcoderdataPython
1782320
""" An Example on domain auction """ from boa.interop.System.Storage import * from boa.interop.System.Runtime import * from boa.interop.System.ExecutionEngine import * from boa.builtins import concat from boa.interop.Ontology.Native import * from boa.builtins import state ctx = GetContext() selfAddr = GetExecutingScri...
StarcoderdataPython
11343775
#!/usr/bin/env python """ Read a ftm text export and convert it to a json structure closely matching stb binary format """ import copy import ftmtxt import ftmmanip import json import sys # Parameters SOURCE_FILE_PATH = sys.argv[1] MAX_OPTIM_PASSES = 0 if len(sys.argv) < 3 else int(sys.argv[2]) # Logging def log(ms...
StarcoderdataPython
44318
<gh_stars>1-10 #!/usr/bin/env python from __future__ import print_function import os import matplotlib matplotlib.use('Agg') import pylab as plt import numpy as np from numpy.fft import fftn, ifftn import scipy.integrate as integrate from scipy import stats import PlotScripts import ReadScripts import AllVars def...
StarcoderdataPython
11268461
<reponame>Techno-Philes/python-short-programs def mergeArray(arr1,arr2): n1=len(arr1) n2=len(arr2) arr4=[] i=0 j=0 k=0 while i<n1 and j<n2: if arr1[i]<arr2[j]: arr4.append(arr1[i]) i=i+1 else: arr4.append(arr2[j]) ...
StarcoderdataPython
3597523
import pandas as pd import matplotlib.pyplot as plt gap = [0.05, 0.025, 0.01, 0.001, 0.0001] def Draw(cutoff_gap) : input_file = open(str(cutoff_gap) + "cutoff.count_array.txt", 'r') input_table = input_file.readlines() histogram_vector = [] for line in input_table : histogram_vecto...
StarcoderdataPython
3238575
""" Python 3 Object-Oriented Programming Chapter 13. Testing Object-Oriented Programs. """ import unittest import sys class SkipTests(unittest.TestCase): @unittest.expectedFailure def test_fails(self) -> None: self.assertEqual(False, True) @unittest.skip("Test is useless") def test_skip(sel...
StarcoderdataPython
4955795
import tqdm from torch.utils.data import Dataset from markuplmft.data.tag_utils import tags_dict import pickle import os import constants class SwdeFeature(object): def __init__(self, html_path, input_ids, token_type_ids, attention_mask, ...
StarcoderdataPython