id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4843175
import numpy as np import time as time import plane_finding_tools as pf import sys snapshot = sys.argv[1] systems_file='/data78/welker/madhani/systems/traced_systems_' + str(snapshot) + '.pickle' #systems_file = '/Users/JanviMadhani/satellite_planes/systems/MWsystems.pickle' systems = pf.read_systems(systems_file)...
StarcoderdataPython
1645596
<gh_stars>0 """ Código modificado do código base: https://github.com/itsmeale/algoritmos-geneticos/tree/master/ga-basico """ import math, random class Cromossomo(): def __init__(self, tamanho, limiteMaximo, limiteMinimo): self.tamanho = tamanho self.valorX = "" self.valorY = "" ...
StarcoderdataPython
3441251
import sys; #reload(sys) #sys.setdefaultencoding="utf-8" if (len(sys.argv)<4): print('no enough parameter') exit(); hownet_filename = sys.argv[1]; embedding_filename = sys.argv[2]; target_filename = sys.argv[3]; with open(hownet_filename,'r',encoding='utf-8') as hownet: with open(embedding_filename,'r',enco...
StarcoderdataPython
5098384
import requests import pandas as pd import os import re schema_url = 'https://stat-xplore.dwp.gov.uk/webapi/rest/v1/schema' def get_full_schema(schema_headers, types_to_include = ["FOLDER","DATABASE","MEASURE","FIELD"], check_cache = False, schema_filename = 'schema.csv'): '''Get the schema information of all el...
StarcoderdataPython
8114719
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: © 2019- d3p Developers and their Assignees # 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
9739005
""" Even Numbers Given a list of numbers, you want to take out all of the odd ones and leave just the even ones. Task: Evaluate each number in your list to see if it is even or odd. Then, output a new list that only contains the even numbers from your original list. Input Format: A string that includes all of the...
StarcoderdataPython
11204066
<gh_stars>1-10 import sys sys.path.append('../') import unittest from cog_abm.core.simulation import * class TestSimulation(unittest.TestCase): def setUp(self): pass class TestMultiThreadSimulation(unittest.TestCase): def setUp(self): from cog_abm.extras.additional_tools import generate_...
StarcoderdataPython
5070775
<filename>tbl/util.py<gh_stars>0 RIGHT = 0 LEFT = 1 CENTER = 2 def pad (in_string, limit=20, side=RIGHT): current = len(in_string) + 1 padding = ' ' * (limit - current) half_padding = ' ' * ((limit - current) // 2) padded = in_string if side == RIGHT: padded = padded + padding elif side == LEFT: ...
StarcoderdataPython
3513031
#!/usr/bin/python # coding: UTF-8 from urllib.request import urlopen import re import os from html.parser import HTMLParser import yaml from yaml.loader import SafeLoader import generate_yaml def configure(): script_path = os.path.dirname(os.path.realpath(__file__)) obj = {} try: with open(script...
StarcoderdataPython
6600146
from functools import reduce def get_nested(dictionary: dict, keys: str, default=None): """ Get a value inside a nested dict, or return the default value otherwise. source: https://stackoverflow.com/a/46890853 :param dictionary: the dict with the value inside :param keys: a string to the path, ne...
StarcoderdataPython
5178320
<filename>eegnb/experiments/visual_cueing/cueing.py import numpy as np from pandas import DataFrame from psychopy import visual, core, event from time import time, strftime, gmtime from optparse import OptionParser from pylsl import StreamInfo, StreamOutlet import scipy.io import os import sys # TODO: These default v...
StarcoderdataPython
5070887
import unittest from csc131.Point import Point class MyTestCase(unittest.TestCase): """ Unit test suite for the Point class. """ def test_default_initializer(self): x, y = 0, 0 p1 = Point() self.assertTrue(p1._x == x and p1._y == y) def test_one_param_initializer(self): ...
StarcoderdataPython
8033789
import unittest import csv import datetime from finances import finances class TestMintCSVData(unittest.TestCase): example_data_header = "Date,Description,Original Description,Amount,Transaction Type,Category,Account Name,Labels,Notes\n" example_data_january = """1/15/2018,McDonald's,MCDONALD'S F00000,6.66,de...
StarcoderdataPython
6594175
import pyramid_retry import pyramid_tm from sqlalchemy.exc import IntegrityError from lms.config import configure def configure_jinja2_assets(config): jinja2_env = config.get_jinja2_environment() jinja2_env.globals["asset_url"] = config.registry["assets_env"].url jinja2_env.globals["asset_urls"] = config...
StarcoderdataPython
4982800
<reponame>RocKing1001/Forma #!/usr/bin/python3 from codegen import compiler from tokengen import tokenizer import os import sys #open file class RevoMain: def __init__(self, filename): self.f = open(filename,"r") def build(self): tokens = tokenizer.create_tokens(self.f) compiler.scel(tokens) def debug...
StarcoderdataPython
3230162
<reponame>stephenbradshaw/pentesting_stuff #!/usr/bin/env python import SimpleHTTPServer import SocketServer import sys import urllib import logging from optparse import OptionParser class ResultsProvider(object): '''Base class used to fetch data from server for forwarding''' import requests import socke...
StarcoderdataPython
11213057
""" ConstantMagellanResponse definition file """ from __future__ import annotations from typing import TYPE_CHECKING from magellan_models.interface.magellan_response import MagellanResponse from magellan_models.config import MagellanConfig from magellan_models.exceptions import MagellanRuntimeException if TYPE_CHECKIN...
StarcoderdataPython
150005
<reponame>CrazyJ36/python #!/usr/bin/env python3 # Testing apostraphes' in single quotes # if I were to: print('he's done') # error: compiler thinks the statement # is ended at the apostraphe after 'he'. # In order to print apostraphes and other # characters like it, escape them: print('he\'s done')
StarcoderdataPython
1978828
<filename>testing/validation/stripreg/diff_stripreg.py import argparse import glob import os import numpy as np np.set_printoptions(suppress=True) def main(): parser = argparse.ArgumentParser(description=( "Compares 'Mean/Median Vertical Residual' and " "'Translation Vector' sections of " ...
StarcoderdataPython
8190438
from os import path from setuptools import setup, find_packages from src.version import version install_requires = [ "requests==2.26.0", "PySide6==6.2.0", "toml==0.10.2", "pillow==8.4.0", "pyaoaddons==0.2.8" ] this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory...
StarcoderdataPython
279638
# Practice (contd.) # may now run SQL queries on the populated database import sqlite3 connection = sqlite3.connect("myTable.db") cursor = connection.cursor() cursor.execute("SELECT * FROM emp") # store fetched data in a variable ans = cursor.fetchall() # loop to print all data for i in ans: print(i)
StarcoderdataPython
3308502
<reponame>pkmtum/Physics-aware_MOR<filename>Training/training.py """ September 2020 @author: <NAME> """ import model as m import tensorflow as tf import time import scipy.io import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt mat = np.load('Data_AD.npy') md=mat train_image...
StarcoderdataPython
12833090
import numpy as np from models import ALOCC_Model from keras.datasets import mnist import matplotlib.pyplot as plt from keras import backend as K import os from keras.losses import binary_crossentropy os.environ['CUDA_VISIBLE_DEVICES'] = '0' self =ALOCC_Model(dataset_name='mnist', input_height=32,input_width=32) sel...
StarcoderdataPython
8015925
<filename>files/runs_small/cores_2/cholesky/power.py power = {'BUSES': {'Area': 1.08752, 'Bus/Area': 1.08752, 'Bus/Gate Leakage': 0.00541455, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0564625, 'Bus/Subthreshold Le...
StarcoderdataPython
8079840
#!/usr/bin/env python3 """ See https://github.com/chembl/chembl_webresource_client New with ChEMBL 25 March 2019: https://chembl.gitbook.io/chembl-interface-documentation/web-services/chembl-data-web-services """ ### import sys,os,argparse,logging import csv from chembl_webresource_client.new_client import new_client ...
StarcoderdataPython
6538167
<filename>app/__init__.py from flask import Flask, render_template app = Flask(__name__) app.config.from_object("config") from app.module_one.controllers import module_one app.register_blueprint(module_one)
StarcoderdataPython
9799562
<reponame>my-personal-forks/Vintageous<filename>ex/parser/scanner_command_vsplit.py from .state import EOF from .tokens import TokenEof from .tokens_base import TOKEN_COMMAND_VSPLIT from .tokens_base import TokenOfCommand from Vintageous.ex.ex_error import ERR_INVALID_ARGUMENT from Vintageous.ex.ex_error import VimErr...
StarcoderdataPython
1813313
<filename>profiler.py import cProfile, pstats, io from pstats import SortKey pr = cProfile.Profile() pr.enable() #import Tracker.py pr.run('python3 Tracker.py') pr.disable() s = io.StringIO() sortby = SortKey.CUMULATIVE ps = pstats.Stats(pr, stream=s).sort_stats(sortby) ps.print_stats() print(s.getvalue())
StarcoderdataPython
9718749
# VMware vSphere Python SDK # Copyright (c) 2008-2015 VMware, 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...
StarcoderdataPython
3463066
#!/usr/bin/python3 class Const(object): SETTING_FILE_PATH = './config.json' PUBLIC_DIR = 'public' PRIVATE_DIR = 'private' RAW_VIEW_DIR = '/'.join([PRIVATE_DIR, 'views', 'raw']) TEMPLATE_VIEW_DIR = '/'.join([PRIVATE_DIR, 'views', 'template']) COOKIE_SESSION_ID = 'session_id' AUTHENTICATION_...
StarcoderdataPython
1763107
<reponame>ngaurav/bootcamp from django.test import TestCase from rest_framework.test import APIRequestFactory from bootcamp.factories import UserFactory class TestsApiUsers(TestCase): request_factory: APIRequestFactory def setUp(self): self.user1 = UserFactory() self.request_factory = APIRe...
StarcoderdataPython
8141002
<gh_stars>0 #! /usr/bin/python3 # -*- coding: utf-8 -*-S def is_palindrome(line: str) -> bool: formatted_line = ''.join(e for e in line.lower() if e.isalnum()) return formatted_line == formatted_line[::-1] print(is_palindrome(input()))
StarcoderdataPython
8053502
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-28 15:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('review', '0018_gradecomponent_mandatory'), ] operations = [ migrations.AddF...
StarcoderdataPython
9706048
<reponame>RHDZMOTA/minesweeper<filename>minesweeper/src/minesweeper/__main__.py<gh_stars>0 import os import logging from .cli import CLI if __name__ == "__main__": log_level = os.environ.get("LOGLEVEL", "WARN").upper() logging.basicConfig(level=log_level) CLI()
StarcoderdataPython
3397265
"""Emission model for GPSSM's.""" from torch import Tensor from gpytorch.distributions import MultivariateNormal from .utilities import inverse_softplus, safe_softplus import torch import torch.nn as nn __author__ = '<NAME>' __all__ = ['Emissions'] class Emissions(nn.Module): """Implementation of Emissions of th...
StarcoderdataPython
95899
import functools import warnings import matplotlib.pyplot as plt import numpy as np import seaborn as sns import tensorflow.compat.v2 as tf import tensorflow_probability as tfp from tensorflow_probability import bijectors as tfb from tensorflow_probability import distributions as tfd tf.enable_v2_behavior() warnin...
StarcoderdataPython
1610684
import sys import math def is_prime(num): for x in xrange(2,num): if num%x==0: return 0 return 1 if sys.version_info[0] >= 3: num=int(input("Enter a number: ")) else: num=int(raw_input("Enter a number: ")) if is_prime(num): print("\nThe number is prime\n") else: print("\nThe number is not prime\n")
StarcoderdataPython
6493394
"""add table for tests results Revision ID: 39f35c43a242 Revises: 01ab5b43e4bb Create Date: 2021-04-12 18:35:36.629415 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '39f35c43a242' down_revision = '01ab5b43e4bb' branch_labels = None depends_on = None def upg...
StarcoderdataPython
1717526
<reponame>yangwawa0323/Learning-Python-Networking-Second-Edition<gh_stars>10-100 #!/usr/bin/env python3 import urllib.request url = input("Enter the URL:") http_response = urllib.request.urlopen(url) if http_response.code == 200: print(http_response.headers) for key,value in http_response.getheaders(): print(ke...
StarcoderdataPython
5061442
import numpy as np import cgt from cgt.tests import across_configs @across_configs def test_stack(): x = cgt.scalar() y = cgt.scalar() z = cgt.scalar() s0 = cgt.stack([x, y, z], axis=0) assert cgt.numeric_eval(s0, {x: 1, y: 2, z: 3}).shape == (3,) x = cgt.vector() y = cgt.vector() z = ...
StarcoderdataPython
1719557
<gh_stars>1-10 import argparse parser = argparse.ArgumentParser(description='runs kmeans on spark for .csv files') parser.add_argument("-k","--K", help="the K parameter of K-means", type=int, required=True) parser.add_argument("-mi","--max_iterations", help="the max iterations of the algorithm", type=int, required=Tr...
StarcoderdataPython
1808897
<filename>bin/create_wonder_batch.py import argparse import sys import logging import os import subprocess import re from lxml import etree import hustler.helpers.DirCrawler as DirCrawler import hustler.helpers.MediaInfo as MediaInfo SRC_EXTENSIONS = "mov" # Instantiate the parser parser = argparse.Argum...
StarcoderdataPython
3509228
# Copyright (c) 2021, Djaodjin Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
StarcoderdataPython
1637845
<filename>sponge-jython/src/main/resources/org/openksavi/sponge/jython/jython_library.py """ Sponge Knowledge Base Jython library. This file may define Jython specific code that could be used as one of knowledge base files. """
StarcoderdataPython
370754
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from categoria.categoria_model import ProdutoForm, Produto from gaecookie.decorator import no_csrf from gaepermission.decorator import login_not_required from tekton.gae.middleware.json_middleware import JsonUnsecureResponse ...
StarcoderdataPython
6407047
<filename>CSA/Easy/Attack and Speed.py # a simple parser for python. use get_number() and get_word() to read def parser(): while 1: data = list(input().split(' ')) for number in data: if len(number) > 0: yield(number) input_parser = parser() def get_word(): globa...
StarcoderdataPython
3241357
<gh_stars>1-10 """A module for the Coding DNA insertion Classifier.""" from typing import List from .set_based_classifier import SetBasedClassifier from variation.schemas.classification_response_schema import ClassificationType class CodingDNAInsertionClassifier(SetBasedClassifier): """The Coding DNA insertion Cl...
StarcoderdataPython
9623806
<reponame>hwipl/kernfab<filename>kernfab/run.py<gh_stars>0 """ Module for running commands """ import time import invoke # type: ignore from fabric import Connection # type: ignore from kernfab import config def _run_cmd(host: str, cmd: str, hide=False) -> invoke.runners.Result: """ Hel...
StarcoderdataPython
5172696
<reponame>satra/NiPypeold # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import os from tempfile import mkdtemp from shutil import rmtree import numpy as np from nipype.testing import (assert_equal, assert_false, assert_true, ...
StarcoderdataPython
8100583
<filename>utilities/format.py import re from datetime import datetime from dateutil import tz from random import randint SYMBOLS = { 'asterisk': '\u002A', 'bullet': '\u2022', 'hollow': '\u25E6', 'hyphen': '\u2043', 'triangle': '\u2023' } def alphabet(string): """ A function to filter a s...
StarcoderdataPython
9775298
<reponame>sassoftware/conary<gh_stars>10-100 # # Copyright (c) SAS Institute 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...
StarcoderdataPython
8186071
<gh_stars>1-10 import sys from modelFood.config import Config import numpy as np from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file config = Config() np.set_printoptions(threshold=np.nan) sys.stdout = open('./checkSave1.txt', 'w') print_tensors_in_checkpoint_file(file_name=config.di...
StarcoderdataPython
1702835
<gh_stars>1-10 # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app_notification_specifics.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.pr...
StarcoderdataPython
11389874
#!/usr/bin/env python """This is the example module. This module does stuff. """ import pytest from podspy.petrinet.elements import * from podspy.petrinet.elements import PetrinetEdge def test_make_petrinet_node(): # using a subclass of the abstract petrinet node class to test it graph = None label = ...
StarcoderdataPython
102205
import pandas as pd from flask import Flask, request app = Flask(__name__) from flask_cors import CORS CORS(app) from flask import Flask app = Flask(__name__) #dataset.shape @app.route('/getWeeklyReports/', methods=["GET"]) def get_weekly_hours(): #dataset = pd.read_csv('C:\\Users\\Priya\\Desktop\\Sivisoft\\Time Mo...
StarcoderdataPython
5097501
#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'AppWall (Radware)' def is_waf(self): schema1 = [ self.matchContent(r'CloudWebSec\.radware\.com'), self.matchHeader(('X-SL-CompState', '.+')) ] schema2 = [ sel...
StarcoderdataPython
1845829
<gh_stars>0 # Generated by Django 3.0 on 2020-05-16 06:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("grades", "0018_auto_20200515_1746"), ] operations = [ migrations.AlterField( model_name="department", name...
StarcoderdataPython
4961253
from __future__ import absolute_import from django.http import Http404 from sentry.models import Group, GroupSubscription from sentry.web.frontend.unsubscribe_notifications import UnsubscribeBaseView class UnsubscribeIssueNotificationsView(UnsubscribeBaseView): object_type = "issue" def fetch_instance(self...
StarcoderdataPython
6644861
<filename>chap_01/exe_010_arithmetic.py """ The Program receives from the USER TWO INTEGERS and returns (displaying) SUM, DIFFERENCE, PRODUCT, DIVISION (with quotient and remainder), LOGARITHM and POWER ELEVATION. """ # IMPORT Module MATH import math # Start Definition of FUNCTIONS def somma(a, b): return a + ...
StarcoderdataPython
1991044
from file_reader import XmlReader, JSONReader from constants import bugReport, final_score_path, proj from util import FileIdx, FileIdxForEclipse from mapper import BugSrcMapper import sys from collections import defaultdict class Metric: def __init__(self, resPath): # fileidx 和 filename之间的转换 self...
StarcoderdataPython
1661843
<gh_stars>0 import time import ciscopy.config as config class Command: """Not used yet. Needed in future.""" def __new__(cls, str_or_command): if type(str_or_command) is str: return Command(str_or_command) # how not to loop??? elif type(str_or_command) is Command: retu...
StarcoderdataPython
6588468
class Solution: def XXX(self, n: int) -> List[str]: dp = [[] for _ in range(n+1)] dp[0].append("") for i in range(1, n+1): for j in range(0, i): for p in range(len(dp[j])): for q in range(len(dp[i-1-j])): dp[i].append("...
StarcoderdataPython
9731739
import sys import glob import json import os.path import argparse import urllib2 import shutil import tempfile from datetime import datetime from subprocess import call from StringIO import StringIO from zipfile import ZipFile from find_package import find_github_repo, find_matlabcentral_repo HOMEDIR = os.path.expandu...
StarcoderdataPython
1788211
import math import typing as tp T = tp.TypeVar("T") def generate_batch(items: tp.List[T], batch_size: int) -> tp.Iterator[tp.List[T]]: num_items = len(items) num_batches = math.ceil(num_items / batch_size) for i in range(num_batches): batch = items[i * batch_size:(i + 1) * bat...
StarcoderdataPython
5082461
#!/usr/bin/python # -*- coding: utf-8 -*- # # Developed by <NAME> <<EMAIL>> '''ref: http://pytorch.org/docs/master/torchvision/transforms.html''' import cv2 import numpy as np import torch import torchvision.transforms.functional as F from config import cfg from PIL import Image import random import numbers class Co...
StarcoderdataPython
312188
<reponame>akononovicius/pyjsd # -*- coding: utf-8 -*- from .jsd import JSD __all__=["JSD"]
StarcoderdataPython
8086900
<gh_stars>0 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from ._enums import * from .cluster import * from .cluster_endpoint import * fr...
StarcoderdataPython
396340
<gh_stars>100-1000 # -*- coding: utf-8 -*- import os import sys import unittest import numpy as np # temporary solution for relative imports in case pyod is not installed # if suod # is installed, no need to use the following line sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from ...
StarcoderdataPython
5182482
<gh_stars>0 """p2048: 2048 but in python and with an easy interface just a toy project because I am sick and bored af also wanna see if it can be optimized with AI at some point License is the WTFPL """ from .game import *
StarcoderdataPython
6408355
<reponame>RevansChen/online-judge # Python - 3.6.0 Test.it('Basic Tests') Test.assert_equals(shape_area(2), 5) Test.assert_equals(shape_area(3), 13) Test.assert_equals(shape_area(1), 1) Test.assert_equals(shape_area(5), 41)
StarcoderdataPython
9629071
<reponame>leomoreno11/Projects<filename>Income expectation calculator/iec.py import numpy as np import pandas as pd amount = float(input('Whats the amount you want to invest ?\n')) rate = float(input('Whats the growth rate percentage of your investment ?\n')) months = int(input('For how many months ?\n')) contribution...
StarcoderdataPython
8045061
<gh_stars>0 class BMI: def __init__(self, height, weight): self._height = height self._weight = weight def get_bmi(self): bmi = self._weight / (self._height * 0.01)**2 return bmi def get_bmi_label(self): bmi = self.get_bmi() if bmi > 30: return 'Ob...
StarcoderdataPython
11396495
#!/usr/bin/env python3 # encoding: utf-8 import curses import actions from tiles import TileFactory from colors import Colors class Map: def __init__(self, filename): with open(filename) as f: self.tiles = [] for y, r in enumerate(f): row = [] for ...
StarcoderdataPython
1801469
from typing import List from .Collision import Collision class CollisionList: def __init__(self, dt: float): self.dt: float = dt self.collisions: List[Collision] = [] def __iter__(self): return iter(self.collisions) def __len__(self): return len(self.collisions) def...
StarcoderdataPython
1916561
import opa_client.opa from lib import action class DeletePolicy(action.OpaBaseAction): def run(self, policy): return self.opa.delete_opa_policy(policy)
StarcoderdataPython
5103509
import numpy as np from PIL import Image from torch.utils.data import Dataset def load_voice(voice_item): voice_data = np.load(voice_item['filepath']) voice_data = voice_data.T.astype('float32') voice_label = voice_item['label_id'] return voice_data, voice_label def load_face(face_item): face_dat...
StarcoderdataPython
6517950
# # Copyright (C) 2012 - 2017 <NAME> <<EMAIL>> # License: MIT # # pylint: disable=missing-docstring, protected-access from __future__ import absolute_import import os.path import unittest import anyconfig.backend.ini as TT import tests.common from anyconfig.compat import OrderedDict as ODict CNF_0_S = """[DEFAULT]...
StarcoderdataPython
9730821
#!/usr/bin/env python3 import argparse def main(args): """Token Transducer""" # <eps> entry print('0 1 <eps> <eps>') # skip begining and ending <blank> print('1 1 <blank> <eps>') print('2 2 <blank> <eps>') # <eps> exit print('2 0 <eps> <eps>') # linking `token` between node 1 and ...
StarcoderdataPython
6402462
""" The MIT License (MIT) Copyright (c) 2021-present Dolfies 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, mer...
StarcoderdataPython
1706103
import numpy as np from matplotlib import pyplot import smooth1d #(0) Check that Simulator is working properly: sim = smooth1d.sim.Simulator() sim.set_alpha(0.05) sim.set_dataset_name('Vaughan1982') sim.set_sample_size(5) sim.set_noise_amp(0.05) # sim.set_filter('None') # sim.set_filter('Butterworth', params...
StarcoderdataPython
11367109
<reponame>agrif/earendil # This file is generated. Make sure you are editing the right source! # Earendil IRC Protocol Specification, version {{major_version}}.{{minor_version}} import attr class IrcParseError(Exception): pass def decode(line, encoding='utf-8'): line = line.rstrip(b'\r\n').decode(encoding)...
StarcoderdataPython
8166328
import torch from torch import nn as nn from jerex import util class RelationClassificationMultiInstance(nn.Module): def __init__(self, hidden_size, entity_types, relation_types, meta_embedding_size, token_dist_embeddings_count, sentence_dist_embeddings_count, prop_drop): super().__init_...
StarcoderdataPython
3555290
<reponame>pmateusz/cordia """Execute the main program.""" # pylint: import-error, no-name-in-module, no-member import logging import rows.parser import rows.console import rows.settings import rows.location_finder import rows.csv_data_source import rows.sql_data_source import rows.pull_command import rows.solve_comm...
StarcoderdataPython
6587920
# Generated by Django 2.0.2 on 2018-07-29 08:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0013_auto_20180728_2220'), ] operations = [ migrations.DeleteModel( name='Crop_requirements', ), ]
StarcoderdataPython
12848273
<gh_stars>0 from __future__ import unicode_literals import uuid try: from django.contrib.contenttypes.fields import GenericForeignKey except ImportError: from django.contrib.contenttypes.generic import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.utils.translation i...
StarcoderdataPython
130425
<gh_stars>0 import datetime import os import contextlib import unittest import numpy as np import numpy.testing as nptest from chaco.scales.time_scale import ( tfrac, trange, TimeScale, CalendarScaleSystem) from chaco.scales.api import TimeFormatter # Note on testing: # Chaco assumes times are in UTC seconds sin...
StarcoderdataPython
188442
# stdlib import re import sys from typing import Dict # 3rd party import pytest from consolekit.testing import CliRunner, Result from domdf_python_tools.compat import PYPY from domdf_python_tools.paths import PathPlus, in_directory from domdf_python_tools.utils import strtobool from dulwich.repo import Repo # this pa...
StarcoderdataPython
11354102
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
StarcoderdataPython
6618082
<reponame>pirate-505/python-pattern-draw<filename>GOL.py import patterner as pt from random import random import time pause = False # create randomized 60*60 matrix field = pt.rnd_matrix(60) ''' # create planer for classic GOL rule field = pt.filled_matrix(50, 0) field[9][8] = 1 field[9][9] = 1 field[9][10] = 1 field...
StarcoderdataPython
298517
<reponame>kokosing/hue import re from pprint import pprint r_line = re.compile(r"^(syn keyword vimCommand contained|syn keyword vimOption " r"contained|syn keyword vimAutoEvent contained)\s+(.*)") r_item = re.compile(r"(\w+)(?:\[(\w+)\])?") def getkw(input, output): out = file(output, 'w') ...
StarcoderdataPython
1724192
<reponame>title848/ALPR from switchtest import * x = " " a = 'l' for i in range(3): x = x + a print(x)
StarcoderdataPython
8007732
<filename>venv/lib/python3.6/site-packages/ansible_collections/community/general/tests/unit/plugins/modules/packaging/language/test_npm.py # # Copyright: (c) 2021, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, divi...
StarcoderdataPython
3500258
import isotp import queue import os import binascii import time import unittest from functools import partial import isotp from . import unittest_logging from .TransportLayerBaseTest import TransportLayerBaseTest Message = isotp.CanMessage # Check the behaviour of the transport layer. Sequenece of CAN frames, timings...
StarcoderdataPython
8096170
<filename>dollarbot.py from bs4 import BeautifulSoup import requests import yaml import json import time CONFIG_FILE = "conf.yml" DATA_FILE = "data.txt" NOTIFICATION = "Buy: ${:04.2f} Sell: ${:04.2f} - Percentage: {:03.1f}% {}" def poll_prices(): 'Gets prices from DolayHoy and reads data from files, then uses dec...
StarcoderdataPython
3416771
<reponame>riamaria/antiope<gh_stars>1-10 import boto3 from botocore.exceptions import ClientError from azure_lib.common import * import json import os import time import logging logger = logging.getLogger() logger.setLevel(logging.INFO) logging.getLogger('botocore').setLevel(logging.WARNING) logging.getLogger('boto...
StarcoderdataPython
8026727
<reponame>spencerpomme/coconuts-on-fire<filename>dragxy.py file = open(r'E:\规划与建筑学\27\研究生(2014-2017)\研一(下)\四会多规合一\relics.csv') def Cities(csv): ''' A function to drag out x and y coordinates from a csv file(n roww 2 col) and convert them into complex numbers and store into a frozen set. ''' assembl...
StarcoderdataPython
6654978
# Intel® Single Event API # # This file is provided under the BSD 3-Clause license. # Copyright (c) 2021, Intel Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # Redistri...
StarcoderdataPython
6513571
import requests from .errors import YuleakAPIError from .logs import logger class YuleakClient(object): """ Client for Yuleak API. Class must be used without instance of it. """ BASE_URL = 'https://api.yuleak.com/' APIKEY = 'demo' REQUESTS_RETRY = 3 REQUESTS_TIMEOUT = 3 @classmethod...
StarcoderdataPython
1884602
<gh_stars>0 from typing import Dict, Union import yaml # Type alias for the config object # Three-level max nesting of str -> str -> str Config = Dict[str, Union[str, Dict[str, Dict[str, str]]]] def load_config(path: str = 'config.yaml') -> Config: with open(path, 'r') as f: config = yaml.safe_load(f) ...
StarcoderdataPython
6490520
<reponame>EduotavioFonseca/ProgramasPython<gh_stars>0 # Seno, cosseno, tangente import math num = float(input('Digite o ângulo desejado: ')) n1 = math.radians(num) # float((num * math.pi)/180) print() print('{:^36}'.format('Para o ângulo {}°'.format(num))) print('_' * 36) ...
StarcoderdataPython