id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9708754
#!/usr/local/bin/python3 # Python Challenge - 12 # http://www.pythonchallenge.com/pc/return/evil.html # Username: huge; Password: <PASSWORD> # Keyword: disproportional def main(): ''' Hint: Dealing evils. evil1.jpg -> evil2.jpg not .jpg - _.gfx -> evil3.jpg No more evils evil4.jpg -> can't be displaye...
StarcoderdataPython
4865161
i = 1 sum = 0 while i <= 5: sum = sum + int(input("Please Enter A Number: ")) i += 1 print(sum)
StarcoderdataPython
5132073
"""This module contains the boards that we support.""" from .board import Board, BoardGroup __all__ = ["Board", "BoardGroup"]
StarcoderdataPython
6508588
<gh_stars>1-10 print (2+2)
StarcoderdataPython
130697
from django.test import TestCase from restaurants.models import Place
StarcoderdataPython
8183613
<reponame>vishalbelsare/inventoryanalytics<filename>inventoryanalytics/abc/__init__.py __all__ = ["abc_analysis","data","test"]
StarcoderdataPython
8057114
<reponame>SODALITE-EU/iac-quality-framework<filename>ansiblemetrics/metrics_cal.py # Python modules import argparse import inspect import json import os.path import re import sys from io import StringIO import yaml # Own modules from ansiblemetrics.import_metrics import general_metrics, playbook_metrics, tasks_metric...
StarcoderdataPython
1956407
<filename>pyN/Network.py<gh_stars>1-10 ''' Network class for running populations. Should be agnostic for population type ''' import numpy as np from synapse import * from datetime import datetime import os, sys parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0,parentdir) impor...
StarcoderdataPython
274511
<gh_stars>1-10 def GenerateCombination(N, ObjectNumber): # initiate the object B and C positions # Get all permutations of length 2 combinlist = [] for i in range(N): if i < N-1: j = i + 1 else: j = 0 combin = [ObjectNumber, i, j] combinlist.appen...
StarcoderdataPython
11208899
text0 = str(input('Digite algo: ')) text1 = str(input('Digite algo: ')) if text0 < text1: print(text1) else: print(text0)
StarcoderdataPython
1979595
""" Description: Developed to prototype an emoji led display installed on the back of the car. Author: <NAME> Credits: F.Stern 2014 for multilineMAX7219.py python library """ # Import library import multilineMAX7219_2x2 as LEDMatrix import time # Initialise the library and the MAX7219/8x8LED arrays LEDMatrix.init() ...
StarcoderdataPython
11360989
from . import settings from pythonjsonlogger import jsonlogger class GunicornJsonFormatter(jsonlogger.JsonFormatter): def add_fields(self, log_record, record, message_dict): super(GunicornJsonFormatter, self).add_fields(log_record, record, message_dict) log_record['type'] = settings.LOGSTASH_MESSA...
StarcoderdataPython
8199893
import csv import argparse import sys import os parser = argparse.ArgumentParser(description = 'Mismatch writer for Bert') parser.add_argument('--data_dir', type=str, required=True, help='Data directory') parser.add_argument('--output_dir', type=str, required=True, help='Output directory') def main(): parsed = pa...
StarcoderdataPython
8185757
<reponame>nhutnamhcmus/coding-bat-solutions # ======================================================================================================================================= # VNU-HCM, University of Science # Department Computer Science, Faculty of Information Technology # Authors: <NAME> (<NAME>) # © 2020 ""...
StarcoderdataPython
8867
<reponame>adiHusky/uber_backend from flask import Flask, flash, request, jsonify, render_template, redirect, url_for, g, session, send_from_directory, abort from flask_cors import CORS # from flask import status from datetime import date, datetime, timedelta from calendar import monthrange from dateutil.parser import p...
StarcoderdataPython
3233608
print(f'Loading {__file__}') # area_dets = [pilatus100k] # all_area_dets = [pilatus100k, tetramm] area_dets = [lambda_det] all_area_dets = [lambda_det, quadem] @bpp.stage_decorator(all_area_dets) def reflection_scan(alpha_start, alpha_stop, num, detector='lambda_det', precount_time=1, exp_time=1, default_att=1e-7, ...
StarcoderdataPython
3539279
<reponame>DmPo/Schemaorg_CivicOS ''' This module provides some datetime.tzinfo implementations. All those classes are taken from the Python documentation. ''' from datetime import timedelta, tzinfo import time ZERO = timedelta(0) # constant for zero time offset. class Utc(tzinfo): '''UTC Universal ...
StarcoderdataPython
8060955
<reponame>OscarMugendi/Project-Tracker # Generated by Django 3.2.8 on 2021-10-19 15:46 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('Trackerapp', '0008_auto_20211017_2325'), ('Trackerapp', '0010_auto_20211019_1133'), ] operations = [ ]
StarcoderdataPython
183444
from django.contrib.auth import authenticate from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django import forms from authentication.models import User class SignupForm(UserCreationForm): email = forms.EmailField(required=True) firstname = forms.CharField(max_length=100, requi...
StarcoderdataPython
3321821
<filename>mailerlite/__init__.py<gh_stars>10-100 from mailerlite.api import MailerLiteApi from ._version import get_versions __version__ = get_versions()['version'] del get_versions __all__ = ['MailerLiteApi', __version__]
StarcoderdataPython
9785662
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns( '', # Examples: # url(r'^$', 'readinglist.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^', include('books.urls')), url(r'^', include('readers.urls')), url...
StarcoderdataPython
255517
import os import subprocess import sys def _ParseDeps(base_dir): """Returns a tuple of (deps, hooks).""" f = open(os.path.join(base_dir, "win32", "DEPS")) global_context = {} local_context = {} exec(f.read(), global_context, local_context) return local_context.get("deps", {}), local_context.get...
StarcoderdataPython
9748580
def foo(): return {"foo":"bar"} print("pos: {} {} {}".format(1, *[2, 3]))
StarcoderdataPython
6500401
<reponame>sphoebs/rockshell #!/usr/bin/python2.5 # # Copyright 2010 Google 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 r...
StarcoderdataPython
205847
""" Copyright 2020 The OneFlow 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 law or agr...
StarcoderdataPython
1787244
<reponame>nuagenetworks/nuage-tempest-plugin<gh_stars>1-10 # Copyright 2012 OpenStack Foundation # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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. ...
StarcoderdataPython
6401512
""" Created on 18 Feb 2017 @author: <NAME> (<EMAIL>) """ from scs_core.data.datetime import LocalizedDatetime from scs_core.sample.climate_sample import ClimateSample from scs_core.sampler.sampler import Sampler # ----------------------------------------------------------------------------------------------------...
StarcoderdataPython
8166908
''' Результаты олимпиады ''' n = int(input()) arr = [] for i in range(n): a = list(input().split()) arr.append((a[0], int(a[1]))) arr.sort(key=lambda x: x[1]) arr.reverse() for i in arr: print(i[0], end='\n')
StarcoderdataPython
8099851
import pymysql class squirrel_module(): def __init__(self, squirrel): self.squirrel = squirrel self.squirrel_service = squirrel.squirrel_service self.squirrel_namespace = squirrel.squirrel_namespace self.squirrel_user = squirrel.squirrel_user self.squirrel_pass = <PASSWORD>...
StarcoderdataPython
3446105
#!/usr/bin/python import lldb import struct class OperatingSystemPlugIn(object): """Class that provides a OS plugin that along with the particular code in main.cpp emulates the following scenario: a) We stop in an OS Plugin created thread - which should be thread index 1 b) We st...
StarcoderdataPython
1646675
import os import requests import pygtrie as trie from joblib import dump from config import PUBLIC_SUFFIX_LIST_URL, SUFFIX_TRIE, DATA_DIR def fetch_public_suffix_data(): data = [] try: r = requests.get(PUBLIC_SUFFIX_LIST_URL, stream=True) data = r.text.split("\n") except Exception as e: ...
StarcoderdataPython
9618403
import pytest from node.blockchain.facade import BlockchainFacade from node.blockchain.inner_models import PVScheduleUpdateBlockMessage @pytest.mark.usefixtures('base_blockchain') def test_make_block_message_update(pv_schedule_update_signed_change_request, primary_validator_node): request = pv_schedule_update_si...
StarcoderdataPython
8126235
# -*- coding: UTF-8 -*- from sympy import pi, sin from scipy.sparse.linalg import spsolve from sympde.calculus import dot, div from sympde.topology import VectorFunctionSpace, ScalarFunctionSpace from sympde.topology import ProductSpace from sympde.topology import element_of from sympde.topology import ...
StarcoderdataPython
97762
<filename>notes/my_bad_script.py def split_full_name(string: str) -> list: """Takes a full name and splits it into first and last. Parameters ---------- string : str The full name to be parsed. Returns ------- list The first and the last name. """ return string.sp...
StarcoderdataPython
5088559
<reponame>hwf1324/nvda<gh_stars>0 # A part of NonVisual Desktop Access (NVDA) # Copyright (C) 2006-2021 NV Access Limited, <NAME>, <NAME> # This file is covered by the GNU General Public License. # See the file COPYING for more details. """A module used to record Windows versions. It is also used to define featu...
StarcoderdataPython
5047810
<filename>message_recall/frontend_app.py # Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
StarcoderdataPython
11211068
<reponame>tecnickcom/binsearch<filename>python/test/test_binsearch_col.py """Tests for binsearch module - column mode.""" import binsearch as bs import os from unittest import TestCase nrows = 251 testDataCol8 = [ (0, 251, 0x00, 0, 0, 0, 1, 2, 2), (1, 251, 0x00, 1, 1, 1, 1, 2, 2), (0, 251, 0x01, 2, 2, 2...
StarcoderdataPython
11377736
import time import sys import string import re from textblob import TextBlob from polyglot.text import Text import pymongo from pymongo import MongoClient from suffix_trees import STree import file_scanner import file_to_db import file_reader """ Boyer Moore string search algorithm """ class last_occurrence(object):...
StarcoderdataPython
4956260
<filename>examples/application_commands/cog.py import discord from discord.ext import commands class MyBot(commands.Bot): def __init__(self): super().__init__(command_prefix=commands.when_mentioned_or('$')) async def on_ready(self): print(f'Logged in as {self.user} (ID: {self.user.id})') ...
StarcoderdataPython
12802059
<gh_stars>1-10 from main.models import LocalUser, KUser import urllib.request import urllib.response import urllib.parse import json # 登录参数 # github github_param = { 'client_id': '2b18fc8f7305f2e73416', 'client_secret': '<KEY>' } # qq qq_param = { 'client_id': '101456289', 'client_secret': 'b26af05256...
StarcoderdataPython
5100378
import simulate_trajectories as sim import numpy as np for i in xrange(10): data = [] for j in xrange(550): data.append(sim.test(0.01*(1 + i))[1]) data = np.array(data) #print data.shape oname = 'l1l9_sim_25c_biasd_{}_100ms_fret.dat'.format(i+1) print oname np.savetxt(oname, data, delimiter = ',')
StarcoderdataPython
1818296
from questions_three.module_cfg import config_for_module from questions_three.vanilla import call_with_exception_tolerance from selenium import webdriver from twin_sister import dependency from ..exceptions import AllBrowsersBusy, UnsupportedBrowser from .browserstack import launch_browserstack_browser from .selenium...
StarcoderdataPython
377039
""" Abandon hope all ye who enter the depths of this module """
StarcoderdataPython
1817157
<reponame>devBOX03/DSApractice def sortStack(stack): if not stack: return top_element = stack.pop() sortStack(stack) insertAtCorrrectPos(stack, top_element) def insertAtCorrrectPos(stack, item): if not stack or stack[-1] >= item: stack.append(item) else: top_element = st...
StarcoderdataPython
5091753
from Node import Node class LinkedList: def __init__(self): self.head = None def add(self, new_data): # 1. Create a new node new_node = Node(new_data) # 2. Set new node's next pointer to where the head is pointing new_node.next = self.head # 3. Set head pointer to point ...
StarcoderdataPython
170004
import json from rest_framework.test import APIClient, APITestCase from rest_framework.authtoken.models import Token from ats.companies.models import CompanyAdmin, CompanyStaff, Company from ats.users.models import User from .factories import CompanyFactory class TestCompanyAPIViewSet(APITestCase): def setUp(s...
StarcoderdataPython
261506
import unittest from ctypes import c_uint16 from io import BytesIO from emu101.emu import EMU class LoadRegTest(unittest.TestCase): def setUp(self): self.emu = EMU() def load_rom(self, words): self.emu.rom.load(BytesIO(b''.join([ int.to_bytes(w, 2, "big") for w in wor...
StarcoderdataPython
3293486
# Generated by Django 3.2.6 on 2021-08-16 11:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('home', '0030_alter_solutionpage_body'), ] operations = [ migrations.CreateModel( name='UserProblem', fields=[ ...
StarcoderdataPython
3579442
<filename>tests/base_tests/expression_tests/test_pos.py from hypothesis import given from symba.base import Expression from . import strategies @given(strategies.expressions) def test_basic(expression: Expression) -> None: result = +expression assert isinstance(result, Expression) @given(strategies.defini...
StarcoderdataPython
11371820
<reponame>Actis92/lightning-flash import pytest import torch from flash.core.serve.types import Label def test_path(session_global_datadir): label = Label(path=str(session_global_datadir / "imagenet_labels.txt")) assert label.deserialize("chickadee") == torch.tensor(19) assert label.serialize(torch.tenso...
StarcoderdataPython
3516251
__version__ = "1.2.0" __author__ = "<NAME>" version_info = (1, 2, 0)
StarcoderdataPython
9719227
<filename>models/official/unet3d/unet_config.py # Copyright 2019 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/lic...
StarcoderdataPython
3323863
import sys sys.path.append("../../") from appJar import gui def test(): print("test") with gui() as app: app.label('hello world') app.addToolbar(['help', 'save', 'open'], test, True) app.button('PRESS', test, icon='help')
StarcoderdataPython
250216
#!/usr/bin/env python class XXX(object): def __init__(self, p1, p2=None, p3=None, p4=None): self.p1 = p1 self.p2 = p2 self.p3 = p3 self.p4 = p4 xxx = XXX(p2='222', p3='111', p4='444') print xxx.p1, xxx.p2, xxx.p3, xxx.p4
StarcoderdataPython
8129959
class Solution(object): def removeKdigits(self, num, k): """ :type num: str :type k: int :rtype: str """ l = len(num) if k == l: return "0" stack = [] for c in num: while k > 0 and len(stack) > 0 and stack[-1] > c: ...
StarcoderdataPython
4968253
from typing import Optional, List from bluesky.protocols import Readable, Movable # from pydantic import BaseModel from dataclasses import dataclass from ._units import ureg, get_units @dataclass class ConstantTerm: coeff: float = 0 var: Optional[Readable] = None @dataclass class Constant: units: str...
StarcoderdataPython
4808681
<gh_stars>1-10 # Copyright 2020 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 ...
StarcoderdataPython
3279477
<gh_stars>0 # Copyright (c) 2013 Mirantis, 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 ap...
StarcoderdataPython
5034098
from flask import g from plynx.db.demo_user_manager import DemoUserManager from plynx.web.common import app, requires_auth, make_fail_response from plynx.utils.common import JSONEncoder demo_user_manager = DemoUserManager() @app.route('/plynx/api/v0/token', strict_slashes=False) @requires_auth def get_auth_token():...
StarcoderdataPython
9623689
#!/usr/bin/env python # MIT License, (c) <NAME> <EMAIL> # https://github.com/joswr1ght/md5deep import os, sys, hashlib # Reproduce this output with slashes consistent for Windows systems #ba2812a436909554688154be461d976c A\SEC575-Clown-Chat\nvram # Optimized for low-memory systems, read whole file with blocksize=0 d...
StarcoderdataPython
8001972
<reponame>sundarsrst/pytablewriter<filename>pytablewriter/style/_font.py # encoding: utf-8 from __future__ import absolute_import from enum import Enum, unique @unique class FontSize(Enum): NONE = "none" TINY = "tiny" SMALL = "small" MEDIUM = "medium" LARGE = "large" @unique class FontStyle(En...
StarcoderdataPython
11218739
#!usr/bin/env python3 # # PORGAMMER: <NAME> # DATE CREATED: 8/8/2019 # REVISED DATE: 17/8/2019 # PURPOSE: This module contains all the initialisation code for the model # Loading and saving the the trained model is also implemented in this module. # # module imports # import torch from torch import nn, optim import tor...
StarcoderdataPython
9652858
<reponame>artefactual-labs/clockify-tool import argparse import dateutil import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from clockifytool import helpers def preprocess_argv(): # Remove script from argv argv = sys.argv[1:] if len(argv): ...
StarcoderdataPython
280458
"""@desc Parser for google scholar search results """ import re from ..base import BaseSearch, ReturnType, SearchItem class Search(BaseSearch): """ Searches Google Scholar for string """ name = "GoogleScholar" search_url = "https://scholar.google.gr/scholar?" summary = "\tGoogle Scholar is...
StarcoderdataPython
173723
<reponame>Lumexralph/python-algorithm-datastructures def linear_sum(S, n): if n == 0: return 0 return linear_sum(S, n - 1) + S[n - 1] S = [1, 5, 8, 9, 4, 9, 3] print(linear_sum(S, len(S)))
StarcoderdataPython
12863645
<filename>lang/Python/abstract-type-2.py<gh_stars>0 from abc import ABCMeta, abstractmethod class BaseQueue(metaclass=ABCMeta): """Abstract Class """ def __init__(self): self.contents = list() @abstractmethod def Enqueue(self, item): pass @abstractmethod def Dequeue(self...
StarcoderdataPython
4879689
<filename>example/plugins/quest.py<gh_stars>0 from kutana import Plugin pl = Plugin("Quest") @pl.on_commands(["quest"], user_state="") async def _(msg, ctx): await ctx.set_state(user_state="quest:1") await ctx.reply("Choose: left or right") @pl.on_commands(["left"], user_state="quest:1") async def _(msg, ...
StarcoderdataPython
14712
from resources import Resources import configparser def getConfigEntry(group, item): entry = None if group != None and item != None: config = configparser.ConfigParser() try: config.read(Resources.getConfigFile()) except(FileNotFoundError): print("ERROR: File '"...
StarcoderdataPython
5013144
class Token: def __init__(self,value,id=-1,document=-1,offset=-1): self.id=id self.attr={} self.attr['offset']=offset self.attr['length']=value.__len__() self.attr['document']=document self.value=value def __str__(self): s ="id: {0}, value: {1}, attribute...
StarcoderdataPython
3485271
from github import GitHub import math # Endpoint: GET https://api.github.com/users/<CSV_Data> # gh = GitHub(filename='get_users.csv') users = [] endpoint = [] required_fields = [] optional_fields = [] def read_user_row(i=0): if gh.data['Execution Results'][i] == '': if gh.data['Name'][i] == '': #ro...
StarcoderdataPython
6648678
''' Sends note on / off data to the Teensy for LED control. author: <NAME> date: 3/21/2021 Python: 3.7.x ''' # used to package the serial data in midi format import midi import os from midi import MidiConnector from midi import Message, NoteOff, NoteOn class OmniMidi: def __init__(self): ...
StarcoderdataPython
6526496
<filename>bindings/python/examples/simple.py #!/usr/bin/env python # simple.py -- basic ppamltracer-python example # This file is in the public domain. import os import sys from ppamltracer import Tracer def main(): # Disable buffering on stdout so we can see the numbers as they are printed. sys.stdout = os....
StarcoderdataPython
4820829
<reponame>YuelianINC/kombu-aliyun-mqs<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # Last modified: <NAME> (<EMAIL>) from setuptools import setup, find_packages setup( name='kombu-aliyun-mqs', version='0.1', packages=find_packages(), author='<NAME>', author_email='<EMAIL>', url...
StarcoderdataPython
9715512
<reponame>jacobmunson/lenskit_confidence from lenskit.algorithms import basic from lenskit.algorithms import bias import pandas as pd import numpy as np import lenskit.util.test as lktu from pytest import approx simple_df = pd.DataFrame({'item': [1, 1, 2, 3], 'user': [10, 12, 10, 13], ...
StarcoderdataPython
382672
<reponame>merlinran/acorn-precision-farming-rover """ ********************************************************************* This file is part of: The Acorn Project https://wwww.twistedfields.com/research ***********************************************************...
StarcoderdataPython
8053976
from impc_etl.jobs.extract.colony_tracking_extractor import ColonyTrackingExtractor from impc_etl.workflow.extraction import * from impc_etl.workflow.config import ImpcConfig class ExperimentCleaner(SparkSubmitTask): name = "Experiment_Cleaner" app = "impc_etl/jobs/clean/experiment_cleaner.py" output_path...
StarcoderdataPython
9783971
<reponame>FabienArcellier/spike-ariadne<filename>ariadne_spike/domain/user.py class User: def __init__(self, name, age): self.name = name if name is not None else "stranger" self.age = age if age is not None else 18
StarcoderdataPython
12852964
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # pipe.py # # Copyright 2014 <NAME> <<EMAIL>> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (...
StarcoderdataPython
6580997
from .dynamicdirectedgraph import DynamicDirectedGraph
StarcoderdataPython
9619689
<filename>bloch_sphere.py<gh_stars>0 # -*- coding: utf-8 -*- """Bloch Sphere.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1FOuaG4O4P5ialuB7a3Na6vZW6wyFG7P7 Use plot_bloch_vector() or plot_bloch_sphere_spherical() to plot a qubit in the states:...
StarcoderdataPython
228337
<gh_stars>1-10 import os import sqlite3 import pandas as pd import numpy as np import matplotlib.pyplot as plt import polyga.analysis as pga save_loc = 'Planet_Silly' df, fp_df = pga.load_planet(save_loc) for col in df.columns: print(col) def plot_average_lengths(df): """Plots average lengths of polymers v...
StarcoderdataPython
11273444
<filename>Alert Notification.py # This is a simple application for alert system from tkinter import * from tkinter import messagebox root = Tk() root.geometry("200x200") def message(): messagebox.showwarning("Alert Box", "Stop virus found") but = Button(root, text="ok", command=Message) but.place(x=100, y=100) ro...
StarcoderdataPython
3530262
<gh_stars>0 from ensembling.ensemble_framework import Ensemble_Framework from task_A.frameworks.base_framework import Base_Framework from task_A.frameworks.base_framework_seq import Base_Framework_SEQ from task_A.frameworks.bert_framework import BERT_Framework from task_A.frameworks.bert_framework_for_veracity import B...
StarcoderdataPython
9699176
# ----------------------------------------------------------------------------- # Name: ObserverDBModels.py # Purpose: ORM for observer, generated by pwiz via: # python -m pwiz -e sqlite data/observer.db > ObserverORM_new.py # then removed header info that is moved to ObserverDBBase...
StarcoderdataPython
8110932
"""Copyright 2009 <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, software distribut...
StarcoderdataPython
3560101
class Node: def __init__(self, order, pokemon): self.order = order self.values = [] self.keys = [] self.nextKey = None self.parent = None self.check_leaf = False self.pokemon = pokemon # Insert at the leaf def insert_at_leaf(self, leaf, value, key): ...
StarcoderdataPython
3496551
from unittest import TestCase import pytest from collections import defaultdict from .coarser import coarse_local class CoarserTest(TestCase): def test_coarse_local_extra_seat(self): community = { 0: [0, 5, 10], 1: [1, 2, 3, 4, 6, 7], 2: [8, 9] } tabl...
StarcoderdataPython
3537112
<filename>pipeline/cf_init_df/main.py """ Cloud Function which triggers Dataflow job when file is uploaded to Cloud Storage bucket """ import os import json import datetime import logging from googleapiclient.discovery import build import google.auth STAGE=os.environ['STAGE'] GCP_PROJECT = os.environ['GCP_PROJECT'] D...
StarcoderdataPython
9777622
# Copyright 2015 Tigera, 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, ...
StarcoderdataPython
4814462
import factory from django.contrib.auth import get_user_model, models from factory import DjangoModelFactory, Faker, Sequence from factory.fuzzy import FuzzyInteger from va_explorer.va_data_management.models import Location, VerbalAutopsy, VaUsername User = get_user_model() class PermissionFactory(DjangoModelFactory...
StarcoderdataPython
1746691
from qira_base import * import qira_config import os import sys import time import base64 import json sys.path.append(qira_config.BASEDIR+"/static2") import model def socket_method(func): def func_wrapper(*args, **kwargs): # before things are initted in the js, we get this for i in args: if i == None:...
StarcoderdataPython
8043700
<gh_stars>0 #!/usr/bin/env python """ String Utils for Python 3 """ import sys if sys.version_info[0] != 3: raise ImportError(" Python version 3 required") EPICS_STR_ENCODING = 'ASCII' EPICS_STR_ENCODING = 'latin_1' NULLCHAR_2 = '\x00' NULLCHAR = b'\x00' def s2b(st1): 'string to byte conversion' if isin...
StarcoderdataPython
1699711
""" A holder for horizon enhancement steps inherited from `.class:Detector` with the following functionality: - training a model on a horizon with synthetic distortions. - making inference on a selected data. """ from textwrap import indent import numpy as np from ...batchflow import Pipeline, B, V, C, P, R f...
StarcoderdataPython
5165135
<filename>pytorch_wavelets/dtcwt/transform2d.py import torch import torch.nn as nn from numpy import ndarray, sqrt from pytorch_wavelets.dtcwt.coeffs import qshift as _qshift, biort as _biort, level1 from pytorch_wavelets.dtcwt.lowlevel import prep_filt from pytorch_wavelets.dtcwt.transform_funcs import FWD_J1, FWD_J2...
StarcoderdataPython
199583
<gh_stars>1-10 import datetime def time_since(dt, human_readable=False): if dt is None: return None assert isinstance(dt, datetime.datetime) delta = (datetime.datetime.utcnow() - dt).total_seconds() if human_readable: return human_readable_time_delta(delta) return delta def human...
StarcoderdataPython
8090929
<gh_stars>10-100 import argparse import os import sys import shutil import time import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.nn.functional as F import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision.da...
StarcoderdataPython
8142507
#!/usr/bin/env python3 import numpy as np import numpy.random as npr from block import block def test_np(): npr.seed(0) nx, nineq, neq = 4, 6, 7 Q = npr.randn(nx, nx) G = npr.randn(nineq, nx) A = npr.randn(neq, nx) D = np.diag(npr.rand(nineq)) K_ = np.bmat(( (Q, np.zeros((nx,nin...
StarcoderdataPython
6434209
<filename>tensormodel/nsfw/_nsfw.py from typing import Optional, Tuple import cv2 import numpy as np import linora as la import tensordata as td import tensorflow as tf from tensorflow.keras import layers __all__ = ['NSFW_Model'] def _batch_norm(name: str) -> layers.BatchNormalization: return layers.BatchNormal...
StarcoderdataPython
8069222
<filename>PCI/decision_tree_sklearn.py # coding:utf-8 from sklearn.tree import DecisionTreeClassifier import pandas as pd from sklearn import preprocessing from sklearn import tree my_data = [['slashdot', 'USA', 'yes', 18, 'None'], ['google', 'France', 'yes', 23, 'Premium'], ['digg', 'USA', 'yes...
StarcoderdataPython
97286
<filename>file_read2.py #try out file I/O myfile=open("example.txt", "a+") secondfile=open("python.txt", "r") for _ in range(4): print(secondfile.read())
StarcoderdataPython